////
This commit is contained in:
parent
cb3062153f
commit
c198294e12
@ -394,8 +394,8 @@ internal class LauncherHome : Fragment() {
|
||||
// binding.time.textLocale = Locale.US
|
||||
// binding.date.textLocale = Locale.US
|
||||
// if (DateFormat.is24HourFormat(requireContext())) {
|
||||
binding.time.format24Hour = timeFormat
|
||||
binding.date.format24Hour = "yyyy년 M월 W주차, dd일 E요일"
|
||||
// binding.time.format24Hour = timeFormat
|
||||
// binding.date.format24Hour = "yyyy년 M월 W주차, dd일 E요일"
|
||||
// } else {
|
||||
// binding.time.format12Hour = timeFormat
|
||||
// binding.date.format12Hour = dateFormat
|
||||
|
||||
@ -9,6 +9,9 @@ import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.text.SpannableString
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.Spanned
|
||||
import android.text.style.AbsoluteSizeSpan
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -46,8 +49,18 @@ class DateTimeView : AppCompatTextView {
|
||||
val spannableBuilder = SpannableStringBuilder()
|
||||
|
||||
private fun setTime() {
|
||||
spannableBuilder.clear()
|
||||
val now = Date(System.currentTimeMillis())
|
||||
val time = SpannableString(simpleTimeFormat.format(now))
|
||||
val date = SpannableString(simpleDateFormat.format(now))
|
||||
spannableBuilder.append(time)
|
||||
spannableBuilder.setSpan(AbsoluteSizeSpan(48,true), 0, time.length , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
spannableBuilder.append("\n")
|
||||
spannableBuilder.append(date)
|
||||
var start = time.length + "\n".length
|
||||
spannableBuilder.setSpan(AbsoluteSizeSpan(30,true), start , start+date.length , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
mHandler.removeCallbacks(runable)
|
||||
setText(simpleDateFormat.format(Date(System.currentTimeMillis())))
|
||||
setText(spannableBuilder)
|
||||
mHandler.postDelayed(runable, DateTimeView.DALEY)
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="this is init sentence"
|
||||
android:id="@+id/time"
|
||||
android:gravity="center"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@ -30,34 +31,34 @@
|
||||
android:textSize="16sp"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textIsSelectable="false"
|
||||
android:textSize="@dimen/clockText"
|
||||
android:textStyle="bold"
|
||||
android:textLocale="en_US"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/batteryProgress"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
<!-- <TextClock-->
|
||||
<!-- android:id="@+id/time"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:maxLines="1"-->
|
||||
<!-- android:textIsSelectable="false"-->
|
||||
<!-- android:textSize="@dimen/clockText"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- android:textLocale="en_US"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/batteryProgress"-->
|
||||
<!-- tools:ignore="UnusedAttribute" />-->
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textSize="20sp"
|
||||
android:format12Hour="yyyy년 M월 d일 E요일"
|
||||
android:textIsSelectable="false"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/time"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
<!-- <TextClock-->
|
||||
<!-- android:id="@+id/date"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:maxLines="1"-->
|
||||
<!-- android:textSize="20sp"-->
|
||||
<!-- android:format12Hour="yyyy년 M월 d일 E요일"-->
|
||||
<!-- android:textIsSelectable="false"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/time"-->
|
||||
<!-- tools:ignore="UnusedAttribute" />-->
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/weather"
|
||||
@ -68,7 +69,7 @@
|
||||
android:textIsSelectable="false"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/date"
|
||||
app:layout_constraintTop_toBottomOf="@+id/time"
|
||||
app:layout_constraintVertical_bias="0.100" />
|
||||
|
||||
<RadioGroup
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user