Update the ui

This commit is contained in:
Tommaso Berlose 2020-10-02 18:02:22 +02:00
parent e8f3c110a8
commit a873c71918
26 changed files with 70 additions and 13 deletions

View File

@ -96,6 +96,7 @@ class ClockTabFragment : Fragment() {
) { ) {
binding.isClockVisible = Preferences.showClock binding.isClockVisible = Preferences.showClock
binding.is24Format = DateFormat.is24HourFormat(requireContext()) binding.is24Format = DateFormat.is24HourFormat(requireContext())
binding.isDarkModeEnabled = activity?.isDarkTheme() == true
viewModel.showBigClockWarning.observe(viewLifecycleOwner, Observer { viewModel.showBigClockWarning.observe(viewLifecycleOwner, Observer {
large_clock_warning?.isVisible = it large_clock_warning?.isVisible = it

View File

@ -65,6 +65,7 @@ class GeneralTabFragment : Fragment() {
binding.lifecycleOwner = this binding.lifecycleOwner = this
binding.viewModel = viewModel binding.viewModel = viewModel
binding.isDarkModeEnabled = activity?.isDarkTheme() == true
return binding.root return binding.root
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 953 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M11,7h2v2h-2zM11,11h2v6h-2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
</vector>

View File

@ -11,6 +11,9 @@
name="is24Format" name="is24Format"
type="Boolean" /> type="Boolean" />
<import type="android.view.View" /> <import type="android.view.View" />
<variable
name="isDarkModeEnabled"
type="Boolean" />
</data> </data>
<com.tommasoberlose.anotherwidget.components.FixedFocusScrollView <com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
@ -184,7 +187,8 @@
android:src="@drawable/round_palette" android:src="@drawable/round_palette"
app:tint="@color/colorPrimaryText"/> app:tint="@color/colorPrimaryText"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="8dp" android:paddingLeft="8dp"
android:paddingRight="8dp" android:paddingRight="8dp"
@ -200,6 +204,27 @@
android:id="@+id/clock_text_color_label" android:id="@+id/clock_text_color_label"
style="@style/AnotherWidget.Settings.Subtitle"/> style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout> </LinearLayout>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="4dp"
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
android:layout_gravity="center_vertical"
app:cardBackgroundColor="@color/colorPrimary"
android:layout_marginEnd="8dp"
app:cardElevation="0dp">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimaryText"
android:textSize="12sp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:text="@string/settings_subtitle_dark_theme_dark"/>
</androidx.cardview.widget.CardView>
</LinearLayout> </LinearLayout>
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -349,18 +374,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/small_clock_warning" android:id="@+id/small_clock_warning"
android:orientation="vertical"> android:padding="10dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="24dp"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="10dp"
android:src="@drawable/outline_info_24"
app:tint="@color/colorSecondaryText"/>
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingBottom="32dp"
android:duplicateParentState="true" android:duplicateParentState="true"
android:textSize="14sp" android:textSize="14sp"
android:layout_marginTop="8dp"
android:text="@string/clock_warning" android:text="@string/clock_warning"
android:textColor="@color/colorPrimaryText" android:textColor="@color/colorSecondaryText"
android:letterSpacing="0" android:letterSpacing="0"
android:fontFamily="@font/product_sans" android:fontFamily="@font/product_sans"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Medium"

View File

@ -5,6 +5,10 @@
<variable <variable
name="viewModel" name="viewModel"
type="com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel" /> type="com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel" />
<variable
name="isDarkModeEnabled"
type="Boolean" />
<import type="android.view.View" />
</data> </data>
<com.tommasoberlose.anotherwidget.components.FixedFocusScrollView <com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -111,6 +115,7 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
app:cardBackgroundColor="@color/colorPrimary" app:cardBackgroundColor="@color/colorPrimary"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
app:cardElevation="0dp"> app:cardElevation="0dp">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -254,6 +259,7 @@
app:cardCornerRadius="4dp" app:cardCornerRadius="4dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
app:cardBackgroundColor="@color/colorPrimary" app:cardBackgroundColor="@color/colorPrimary"
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
app:cardElevation="0dp"> app:cardElevation="0dp">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
@ -360,6 +366,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:cardCornerRadius="4dp" app:cardCornerRadius="4dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
app:cardBackgroundColor="@color/colorPrimary" app:cardBackgroundColor="@color/colorPrimary"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
app:cardElevation="0dp"> app:cardElevation="0dp">
@ -514,6 +521,7 @@
app:cardCornerRadius="4dp" app:cardCornerRadius="4dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
app:cardBackgroundColor="@color/colorPrimary" app:cardBackgroundColor="@color/colorPrimary"
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
app:cardElevation="0dp"> app:cardElevation="0dp">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView

View File

@ -362,18 +362,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/small_clock_warning" android:id="@+id/small_clock_warning"
android:orientation="vertical"> android:padding="10dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="24dp"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="10dp"
android:src="@drawable/outline_info_24"
app:tint="@color/colorSecondaryText"/>
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingBottom="32dp"
android:duplicateParentState="true" android:duplicateParentState="true"
android:textSize="14sp" android:textSize="14sp"
android:layout_marginTop="8dp"
android:text="@string/glance_info" android:text="@string/glance_info"
android:textColor="@color/colorPrimaryText" android:textColor="@color/colorSecondaryText"
android:letterSpacing="0" android:letterSpacing="0"
android:fontFamily="@font/product_sans" android:fontFamily="@font/product_sans"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Medium"