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