UI update

This commit is contained in:
Tommaso Berlose 2021-01-08 01:17:48 +01:00
parent 20c5ce61b4
commit b903fff10f
9 changed files with 105 additions and 115 deletions

View File

@ -81,8 +81,6 @@ class PreferencesFragment : Fragment() {
viewModel.showEvents.observe(viewLifecycleOwner) {
maintainScrollPosition {
binding.isCalendarEnabled = it
if (it) {
CalendarHelper.setEventUpdatesAndroidN(requireContext())
} else {
@ -93,16 +91,10 @@ class PreferencesFragment : Fragment() {
}
viewModel.showWeather.observe(viewLifecycleOwner) {
maintainScrollPosition {
binding.isWeatherVisible = it
}
checkLocationPermission()
}
viewModel.showClock.observe(viewLifecycleOwner) {
maintainScrollPosition {
binding.isClockVisible = it
}
}
}

View File

@ -5,15 +5,6 @@
<variable
name="viewModel"
type="com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel" />
<variable
name="isCalendarEnabled"
type="Boolean" />
<variable
name="isWeatherVisible"
type="Boolean" />
<variable
name="isClockVisible"
type="Boolean" />
<import type="android.view.View" />
</data>
<com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
@ -171,7 +162,6 @@
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:checked="@{isClockVisible}"
android:id="@+id/show_clock_switch"
android:buttonTint="@color/colorAccent" />
</LinearLayout>
@ -237,7 +227,6 @@
android:layout_marginStart="16dp"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
android:checked="@{isCalendarEnabled}"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:id="@+id/show_events_switch"
@ -299,7 +288,6 @@
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:checked="@{isWeatherVisible}"
android:id="@+id/show_weather_switch"
android:buttonTint="@color/colorAccent" />
</LinearLayout>

View File

@ -143,7 +143,7 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_add_to_home_screen_24"
android:src="@drawable/round_today_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="match_parent"
@ -181,7 +181,7 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_add_to_home_screen_24"
android:src="@drawable/round_brightness_5_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="match_parent"
@ -218,7 +218,7 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_add_to_home_screen_24"
android:src="@drawable/round_schedule_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="match_parent"

View File

@ -29,6 +29,43 @@
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textAppearance="@style/AnotherWidget.Settings.Header" />
<LinearLayout
android:id="@+id/action_clock_bottom_margin_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingTop="12dp"
android:paddingRight="8dp"
android:paddingBottom="12dp">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_format_line_spacing"
app:tint="@color/colorPrimaryText" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp">
<TextView
style="@style/AnotherWidget.Settings.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_clock_bottom_margin_title" />
<TextView
android:id="@+id/clock_bottom_margin_label"
style="@style/AnotherWidget.Settings.Subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -66,43 +103,6 @@
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_clock_bottom_margin_size"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_format_line_spacing"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="@string/settings_clock_bottom_margin_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/clock_bottom_margin_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -21,6 +21,51 @@
android:paddingTop="8dp"
android:paddingBottom="48dp"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_custom_font_title"
android:paddingTop="16dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textAppearance="@style/AnotherWidget.Settings.Header" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_custom_font"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_font_download_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="@string/font_family_settings_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/custom_font_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -60,12 +105,12 @@
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="@string/title_main_text_size"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/main_text_size_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/main_text_size_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -272,43 +317,6 @@
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textAppearance="@style/AnotherWidget.Settings.Header" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_date_format"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:src="@drawable/round_text_format_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="@string/settings_date_format_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/date_format_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -397,13 +405,13 @@
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_custom_font"
android:id="@+id/action_date_format"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_font_download_24"
android:padding="10dp"
android:src="@drawable/round_text_format_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="match_parent"
@ -415,11 +423,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="@string/settings_custom_font_title"/>
android:text="@string/settings_date_format_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/custom_font_label"
android:id="@+id/date_format_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>

View File

@ -25,6 +25,6 @@
<!-- <color name="disabledButtonBackground">#131D28</color>-->
<color name="disabledButtonBackground">#33000000</color>
<color name="badgeBackground">#202020</color>
<color name="cardBorder">#252525</color>
<color name="rippleColor">#202020</color>
<color name="cardBorder">#333333</color>
<color name="rippleColor">#111111</color>
</resources>

View File

@ -7,6 +7,7 @@
<color name="colorPrimaryLight">#DAEAF6</color>
<color name="black_50">#80000000</color>
<color name="black_30">#48000000</color>
<color name="black_20">#33000000</color>
<color name="black_10">#1A000000</color>
<color name="white_80">#CCFFFFFF</color>
<color name="white_50">#80FFFFFF</color>

View File

@ -21,14 +21,14 @@
<string name="custom_date_format">Custom date format</string>
<string name="alpha">Alpha</string>
<string name="transparent">Transparent</string>
<string name="settings_show_dividers_title">Show text dividers</string>
<string name="settings_show_dividers_title">Text separators</string>
<string name="first_row_header">Primary Text</string>
<string name="second_row_header">Secondary Text</string>
<string name="global_style_header">Widget</string>
<string name="action_capitalize_the_date">Capitalize the date</string>
<string name="settings_date_format_title">Date format</string>
<string name="header_widget_background">Widget background</string>
<string name="settings_secondary_row_top_margin_title">Margin</string>
<string name="settings_secondary_row_top_margin_title">Rows spacing</string>
<string name="action_custom_font_to_search">Custom font…</string>
<string name="font_100" translatable="false">Thin</string>
@ -63,7 +63,7 @@
<string name="settings_show_until_subtitle_5">7 days later</string>
<string name="settings_show_until_title">Show events at least</string>
<string name="day_char">d</string>
<string name="settings_calendar_app_title">Calendar default application</string>
<string name="settings_calendar_app_title">Calendar</string>
<string name="error_no_calendar">No calendars found.</string>
<string name="tomorrow">tomorrow</string>
<string name="today">today</string>
@ -111,7 +111,7 @@
<string name="custom_location_gps">Geolocation</string>
<string name="show_weather_visible">Weather info is visible</string>
<string name="show_weather_not_visible">Weather info is hidden</string>
<string name="settings_weather_app_title">Tap on weather opens</string>
<string name="settings_weather_app_title">Weather</string>
<string name="settings_weather_provider_api_key_title">Weather API key</string>
<string name="settings_weather_provider_api_key_subtitle_all_set">The weather provider is configured correctly.</string>
<string name="settings_weather_provider_api_key_subtitle_not_set">The weather provider must be configured.</string>
@ -174,7 +174,7 @@
<string name="show_clock_visible">Clock is visible</string>
<string name="show_clock_not_visible">Clock is hidden</string>
<string name="settings_clock_text_size_title">Text size</string>
<string name="default_clock_app">Default clock app</string>
<string name="default_clock_app">Clock</string>
<string name="settings_clock_bottom_margin_title">Clock bottom margin</string>
<string name="settings_clock_bottom_margin_subtitle_none">None</string>
<string name="settings_clock_bottom_margin_subtitle_small">Small</string>
@ -338,4 +338,5 @@
<string name="clock_settings_subtitle">Set size, color and time zones</string>
<string name="layout_settings_subtitle">Widget spacing and tweaks</string>
<string name="smart_content_header">Smart content</string>
<string name="font_family_settings_title">Font family</string>
</resources>

View File

@ -9,7 +9,7 @@
<item name="android:windowLightStatusBar">@bool/is_not_dark_theme</item>
<item name="android:fitsSystemWindows">true</item>
<item name="android:colorControlActivated">@color/colorAccent</item>
<item name="colorControlHighlight">@color/black_10</item>
<item name="colorControlHighlight">@color/black_20</item>
<item name="android:windowActivityTransitions">true</item>
</style>