diff --git a/.idea/navEditor.xml b/.idea/navEditor.xml
index 4628089..8b8435a 100644
--- a/.idea/navEditor.xml
+++ b/.idea/navEditor.xml
@@ -108,6 +108,47 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/components/GlanceSettingsDialog.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/components/GlanceSettingsDialog.kt
index 2eac147..e6e8649 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/components/GlanceSettingsDialog.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/components/GlanceSettingsDialog.kt
@@ -228,9 +228,11 @@ class GlanceSettingsDialog(val context: Activity, val provider: Constants.Glance
}
view.alarm_set_by_title.text = context.getString(R.string.settings_show_next_alarm_app_title).format(appNameOrPackage)
view.alarm_set_by_subtitle.text = if (AlarmHelper.isAlarmProbablyWrong(context)) context.getString(R.string.settings_show_next_alarm_app_subtitle_wrong) else context.getString(R.string.settings_show_next_alarm_app_subtitle_correct)
- view.alarm_set_by_title.isVisible = true
+ view.alarm_set_by_container.isVisible = true
} else {
- view.alarm_set_by_title.isVisible = false
+ view.alarm_set_by_container.isVisible = false
+ view.header.isVisible = false
+ view.divider.isVisible = false
}
}
statusCallback?.invoke()
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomLocationActivity.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomLocationActivity.kt
index 659b986..25ec63d 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomLocationActivity.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/CustomLocationActivity.kt
@@ -68,7 +68,7 @@ class CustomLocationActivity : AppCompatActivity() {
.register(R.layout.custom_location_item) { _, injector ->
injector
.text(R.id.text, getString(R.string.custom_location_gps))
- .clicked(R.id.text) {
+ .clicked(R.id.item) {
MaterialBottomSheetDialog(this, message = getString(R.string.background_location_warning))
.setPositiveButton(getString(android.R.string.ok)) {
requirePermission()
@@ -78,7 +78,7 @@ class CustomLocationActivity : AppCompatActivity() {
}
.register(R.layout.custom_location_item) { item, injector ->
injector.text(R.id.text, item.getAddressLine(0))
- injector.clicked(R.id.text) {
+ injector.clicked(R.id.item) {
Preferences.bulk {
customLocationLat = item.latitude.toString()
customLocationLon = item.longitude.toString()
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/CalendarTabFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/CalendarTabFragment.kt
index 0973f1c..b1a69b9 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/CalendarTabFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/CalendarTabFragment.kt
@@ -39,6 +39,8 @@ import com.tommasoberlose.anotherwidget.utils.isDefaultSet
import com.tommasoberlose.anotherwidget.utils.toast
import kotlinx.android.synthetic.main.fragment_calendar_settings.*
import kotlinx.android.synthetic.main.fragment_calendar_settings.scrollView
+import kotlinx.android.synthetic.main.fragment_settings.*
+import kotlinx.android.synthetic.main.fragment_tab_selector.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlin.Comparator
@@ -82,6 +84,10 @@ class CalendarTabFragment : Fragment() {
show_multiple_events_toggle.isChecked = Preferences.showNextEvent
setupListener()
+
+ scrollView?.viewTreeObserver?.addOnScrollChangedListener {
+ viewModel.fragmentScrollY.value = scrollView?.scrollY ?: 0
+ }
}
private fun subscribeUi(
@@ -215,91 +221,73 @@ class CalendarTabFragment : Fragment() {
}
action_show_all_day.setOnClickListener {
- if (Preferences.showEvents) {
- show_all_day_toggle.isChecked = !show_all_day_toggle.isChecked
- }
+ show_all_day_toggle.isChecked = !show_all_day_toggle.isChecked
}
show_all_day_toggle.setOnCheckedChangeListener { _, isChecked ->
- if (Preferences.showEvents) {
- Preferences.calendarAllDay = isChecked
- updateCalendar()
- }
+ Preferences.calendarAllDay = isChecked
+ updateCalendar()
}
action_change_attendee_filter.setOnClickListener {
- if (Preferences.showEvents) {
- val selectedValues = emptyList().toMutableList()
- if (Preferences.showDeclinedEvents) {
- selectedValues.add(CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED)
- }
- if (Preferences.showInvitedEvents) {
- selectedValues.add(CalendarContract.Attendees.ATTENDEE_STATUS_INVITED)
- }
- if (Preferences.showAcceptedEvents) {
- selectedValues.add(CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED)
- }
-
- val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.settings_attendee_status_title), isMultiSelection = true)
- .setSelectedValues(selectedValues)
-
- dialog.addItem(
- getString(R.string.attendee_status_invited),
- CalendarContract.Attendees.ATTENDEE_STATUS_INVITED
- )
- dialog.addItem(
- getString(R.string.attendee_status_accepted),
- CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED
- )
- dialog.addItem(
- getString(R.string.attendee_status_declined),
- CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED
- )
-
- dialog.addOnMultipleSelectItemListener { values ->
- Preferences.showDeclinedEvents = values.contains(CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED)
- Preferences.showAcceptedEvents = values.contains(CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED)
- Preferences.showInvitedEvents = values.contains(CalendarContract.Attendees.ATTENDEE_STATUS_INVITED)
- updateCalendar()
- }.show()
+ val selectedValues = emptyList().toMutableList()
+ if (Preferences.showDeclinedEvents) {
+ selectedValues.add(CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED)
}
+ if (Preferences.showInvitedEvents) {
+ selectedValues.add(CalendarContract.Attendees.ATTENDEE_STATUS_INVITED)
+ }
+ if (Preferences.showAcceptedEvents) {
+ selectedValues.add(CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED)
+ }
+
+ val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.settings_attendee_status_title), isMultiSelection = true)
+ .setSelectedValues(selectedValues)
+
+ dialog.addItem(
+ getString(R.string.attendee_status_invited),
+ CalendarContract.Attendees.ATTENDEE_STATUS_INVITED
+ )
+ dialog.addItem(
+ getString(R.string.attendee_status_accepted),
+ CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED
+ )
+ dialog.addItem(
+ getString(R.string.attendee_status_declined),
+ CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED
+ )
+
+ dialog.addOnMultipleSelectItemListener { values ->
+ Preferences.showDeclinedEvents = values.contains(CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED)
+ Preferences.showAcceptedEvents = values.contains(CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED)
+ Preferences.showInvitedEvents = values.contains(CalendarContract.Attendees.ATTENDEE_STATUS_INVITED)
+ updateCalendar()
+ }.show()
}
action_show_only_busy_events.setOnClickListener {
- if (Preferences.showEvents) {
- show_only_busy_events_toggle.isChecked = !show_only_busy_events_toggle.isChecked
- }
+ show_only_busy_events_toggle.isChecked = !show_only_busy_events_toggle.isChecked
}
show_only_busy_events_toggle.setOnCheckedChangeListener { _, isChecked ->
- if (Preferences.showEvents) {
- Preferences.showOnlyBusyEvents = isChecked
- updateCalendar()
- }
+ Preferences.showOnlyBusyEvents = isChecked
+ updateCalendar()
}
action_show_multiple_events.setOnClickListener {
- if (Preferences.showEvents) {
- show_multiple_events_toggle.isChecked = !show_multiple_events_toggle.isChecked
- }
+ show_multiple_events_toggle.isChecked = !show_multiple_events_toggle.isChecked
}
show_multiple_events_toggle.setOnCheckedChangeListener { _, isChecked ->
- if (Preferences.showEvents) {
- Preferences.showNextEvent = isChecked
- }
+ Preferences.showNextEvent = isChecked
}
action_show_diff_time.setOnClickListener {
- if (Preferences.showEvents) {
- show_diff_time_toggle.isChecked = !show_diff_time_toggle.isChecked
- }
+ show_diff_time_toggle.isChecked = !show_diff_time_toggle.isChecked
}
show_diff_time_toggle.setOnCheckedChangeListener { _, isChecked ->
- if (Preferences.showEvents) {
- Preferences.showDiffTime = isChecked
- }
+ Preferences.showDiffTime = isChecked
}
action_widget_update_frequency.setOnClickListener {
@@ -315,38 +303,33 @@ class CalendarTabFragment : Fragment() {
}
action_second_row_info.setOnClickListener {
- if (Preferences.showEvents) {
- val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.settings_second_row_info_title)).setSelectedValue(Preferences.secondRowInformation)
- (0 .. 1).forEach {
- dialog.addItem(getString(SettingsStringHelper.getSecondRowInfoString(it)), it)
- }
- dialog.addOnSelectItemListener { value ->
- Preferences.secondRowInformation = value
- }.show()
+ val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.settings_second_row_info_title)).setSelectedValue(Preferences.secondRowInformation)
+ (0 .. 1).forEach {
+ dialog.addItem(getString(SettingsStringHelper.getSecondRowInfoString(it)), it)
}
+ dialog.addOnSelectItemListener { value ->
+ Preferences.secondRowInformation = value
+ }.show()
}
action_show_until.setOnClickListener {
- if (Preferences.showEvents) {
- val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.settings_show_until_title)).setSelectedValue(Preferences.showUntil)
- intArrayOf(6,7,0,1,2,3, 4, 5).forEach {
- dialog.addItem(getString(SettingsStringHelper.getShowUntilString(it)), it)
- }
- dialog.addOnSelectItemListener { value ->
- Preferences.showUntil = value
- }.show()
+ val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.settings_show_until_title)).setSelectedValue(Preferences.showUntil)
+ intArrayOf(6,7,0,1,2,3, 4, 5).forEach {
+ dialog.addItem(getString(SettingsStringHelper.getShowUntilString(it)), it)
}
+ dialog.addOnSelectItemListener { value ->
+ Preferences.showUntil = value
+ }.show()
}
action_open_event_details.setOnClickListener {
- if (Preferences.showEvents) {
- BottomSheetMenu(requireContext(), header = getString(R.string.settings_event_app_title)).setSelectedValue(Preferences.openEventDetails)
- .addItem(getString(R.string.default_event_app), true)
- .addItem(getString(R.string.default_calendar_app), false)
- .addOnSelectItemListener { value ->
- Preferences.openEventDetails = value
- }.show()
- }
+ BottomSheetMenu(requireContext(), header = getString(R.string.settings_event_app_title)).setSelectedValue(Preferences.openEventDetails)
+ .addItem(getString(R.string.default_event_app), true)
+ .addItem(getString(R.string.default_calendar_app), false)
+ .addOnSelectItemListener { value ->
+ Preferences.openEventDetails = value
+ }
+ .show()
}
action_calendar_app.setOnClickListener {
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/ClockTabFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/ClockTabFragment.kt
index 9671c1c..bd6f87e 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/ClockTabFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/ClockTabFragment.kt
@@ -39,7 +39,10 @@ import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import com.tommasoberlose.anotherwidget.utils.isDarkTheme
import com.tommasoberlose.anotherwidget.utils.isDefaultSet
+import kotlinx.android.synthetic.main.fragment_calendar_settings.*
import kotlinx.android.synthetic.main.fragment_clock_settings.*
+import kotlinx.android.synthetic.main.fragment_clock_settings.scrollView
+import kotlinx.android.synthetic.main.fragment_tab_selector.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@@ -91,6 +94,10 @@ class ClockTabFragment : Fragment() {
}
}
setupListener()
+
+ scrollView?.viewTreeObserver?.addOnScrollChangedListener {
+ viewModel.fragmentScrollY.value = scrollView?.scrollY ?: 0
+ }
}
private fun subscribeUi(
@@ -197,98 +204,84 @@ class ClockTabFragment : Fragment() {
}
action_clock_text_size.setOnClickListener {
- if (Preferences.showClock) {
- val dialog = BottomSheetMenu(
- requireContext(),
- header = getString(R.string.settings_clock_text_size_title)
- ).setSelectedValue(Preferences.clockTextSize)
- (46 downTo 12).filter { it % 2 == 0 }.forEach {
- dialog.addItem("${it}sp", it.toFloat())
- }
- dialog.addOnSelectItemListener { value ->
- Preferences.clockTextSize = value
- }.show()
+ val dialog = BottomSheetMenu(
+ requireContext(),
+ header = getString(R.string.settings_clock_text_size_title)
+ ).setSelectedValue(Preferences.clockTextSize)
+ (46 downTo 12).filter { it % 2 == 0 }.forEach {
+ dialog.addItem("${it}sp", it.toFloat())
}
+ dialog.addOnSelectItemListener { value ->
+ Preferences.clockTextSize = value
+ }.show()
}
action_ampm_indicator_size.setOnClickListener {
- if (Preferences.showClock) {
- ampm_indicator_toggle.isChecked = !ampm_indicator_toggle.isChecked
- }
+ ampm_indicator_toggle.isChecked = !ampm_indicator_toggle.isChecked
}
ampm_indicator_toggle.setOnCheckedChangeListener { _, isChecked ->
- if (Preferences.showClock) {
- Preferences.showAMPMIndicator = isChecked
- }
+ Preferences.showAMPMIndicator = isChecked
}
action_clock_text_color.setOnClickListener {
- if (Preferences.showClock) {
- BottomSheetColorPicker(requireContext(),
- colors = colors,
- header = getString(R.string.settings_font_color_title),
- getSelected = { ColorHelper.getClockFontColorRgb(activity?.isDarkTheme() == true) },
- onColorSelected = { color: Int ->
- val colorString = Integer.toHexString(color)
- if (activity?.isDarkTheme() == true) {
- Preferences.clockTextColorDark =
- "#" + if (colorString.length > 6) colorString.substring(2) else colorString
- } else {
- Preferences.clockTextColor =
- "#" + if (colorString.length > 6) colorString.substring(2) else colorString
- }
- },
- showAlphaSelector = true,
- alpha = if (activity?.isDarkTheme() == true) Preferences.clockTextAlphaDark.toIntValue() else Preferences.clockTextAlpha.toIntValue(),
- onAlphaChangeListener = { alpha ->
- if (activity?.isDarkTheme() == true) {
- Preferences.clockTextAlphaDark = alpha.toHexValue()
- } else {
- Preferences.clockTextAlpha = alpha.toHexValue()
- }
+ BottomSheetColorPicker(requireContext(),
+ colors = colors,
+ header = getString(R.string.settings_font_color_title),
+ getSelected = { ColorHelper.getClockFontColorRgb(activity?.isDarkTheme() == true) },
+ onColorSelected = { color: Int ->
+ val colorString = Integer.toHexString(color)
+ if (activity?.isDarkTheme() == true) {
+ Preferences.clockTextColorDark =
+ "#" + if (colorString.length > 6) colorString.substring(2) else colorString
+ } else {
+ Preferences.clockTextColor =
+ "#" + if (colorString.length > 6) colorString.substring(2) else colorString
}
- ).show()
- }
+ },
+ showAlphaSelector = true,
+ alpha = if (activity?.isDarkTheme() == true) Preferences.clockTextAlphaDark.toIntValue() else Preferences.clockTextAlpha.toIntValue(),
+ onAlphaChangeListener = { alpha ->
+ if (activity?.isDarkTheme() == true) {
+ Preferences.clockTextAlphaDark = alpha.toHexValue()
+ } else {
+ Preferences.clockTextAlpha = alpha.toHexValue()
+ }
+ }
+ ).show()
}
action_clock_bottom_margin_size.setOnClickListener {
- if (Preferences.showClock) {
- BottomSheetMenu(
- requireContext(),
- header = getString(R.string.settings_clock_bottom_margin_title)
- ).setSelectedValue(Preferences.clockBottomMargin)
- .addItem(
- getString(R.string.settings_clock_bottom_margin_subtitle_none),
- Constants.ClockBottomMargin.NONE.value
- )
- .addItem(
- getString(R.string.settings_clock_bottom_margin_subtitle_small),
- Constants.ClockBottomMargin.SMALL.value
- )
- .addItem(
- getString(R.string.settings_clock_bottom_margin_subtitle_medium),
- Constants.ClockBottomMargin.MEDIUM.value
- )
- .addItem(
- getString(R.string.settings_clock_bottom_margin_subtitle_large),
- Constants.ClockBottomMargin.LARGE.value
- )
- .addOnSelectItemListener { value ->
- Preferences.clockBottomMargin = value
- }.show()
- }
+ BottomSheetMenu(
+ requireContext(),
+ header = getString(R.string.settings_clock_bottom_margin_title)
+ ).setSelectedValue(Preferences.clockBottomMargin)
+ .addItem(
+ getString(R.string.settings_clock_bottom_margin_subtitle_none),
+ Constants.ClockBottomMargin.NONE.value
+ )
+ .addItem(
+ getString(R.string.settings_clock_bottom_margin_subtitle_small),
+ Constants.ClockBottomMargin.SMALL.value
+ )
+ .addItem(
+ getString(R.string.settings_clock_bottom_margin_subtitle_medium),
+ Constants.ClockBottomMargin.MEDIUM.value
+ )
+ .addItem(
+ getString(R.string.settings_clock_bottom_margin_subtitle_large),
+ Constants.ClockBottomMargin.LARGE.value
+ )
+ .addOnSelectItemListener { value ->
+ Preferences.clockBottomMargin = value
+ }.show()
}
action_clock_app.setOnClickListener {
- if (Preferences.showClock) {
- if (Preferences.showClock) {
- startActivityForResult(
- Intent(requireContext(), ChooseApplicationActivity::class.java),
- RequestCode.CLOCK_APP_REQUEST_CODE.code
- )
- }
- }
+ startActivityForResult(
+ Intent(requireContext(), ChooseApplicationActivity::class.java),
+ RequestCode.CLOCK_APP_REQUEST_CODE.code
+ )
}
}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/GeneralTabFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/GeneralTabFragment.kt
index 80a2048..77799ce 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/GeneralTabFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/GeneralTabFragment.kt
@@ -42,9 +42,11 @@ import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
import com.tommasoberlose.anotherwidget.utils.isDarkTheme
+import kotlinx.android.synthetic.main.fragment_calendar_settings.*
import kotlinx.android.synthetic.main.fragment_clock_settings.*
import kotlinx.android.synthetic.main.fragment_general_settings.*
import kotlinx.android.synthetic.main.fragment_general_settings.scrollView
+import kotlinx.android.synthetic.main.fragment_tab_selector.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@@ -96,6 +98,10 @@ class GeneralTabFragment : Fragment() {
colors = lazyColors
}
}
+
+ scrollView?.viewTreeObserver?.addOnScrollChangedListener {
+ viewModel.fragmentScrollY.value = scrollView?.scrollY ?: 0
+ }
}
@@ -104,106 +110,6 @@ class GeneralTabFragment : Fragment() {
viewModel: MainViewModel
) {
- viewModel.textMainSize.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- main_text_size_label?.text = String.format("%.0fsp", it)
- }
- })
-
- viewModel.textSecondSize.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- second_text_size_label?.text = String.format("%.0fsp", it)
- }
- })
-
- viewModel.textGlobalColor.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- if (Preferences.textGlobalAlpha == "00") {
- font_color_label?.text = getString(R.string.transparent)
- } else {
- font_color_label?.text =
- "#%s".format(Integer.toHexString(ColorHelper.getFontColor(activity?.isDarkTheme() == true))).toUpperCase()
- }
- }
- })
-
- viewModel.textGlobalColorDark.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- if (Preferences.textGlobalAlphaDark == "00") {
- font_color_label?.text = getString(R.string.transparent)
- } else {
- font_color_label?.text =
- "#%s".format(Integer.toHexString(ColorHelper.getFontColor(activity?.isDarkTheme() == true))).toUpperCase()
- }
- }
- })
-
- viewModel.textGlobalAlpha.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- if (Preferences.textGlobalAlpha == "00") {
- font_color_label?.text = getString(R.string.transparent)
- } else {
- font_color_label?.text =
- "#%s".format(Integer.toHexString(ColorHelper.getFontColor(activity?.isDarkTheme() == true))).toUpperCase()
- }
- }
- })
-
- viewModel.textGlobalAlphaDark.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- if (Preferences.textGlobalAlphaDark == "00") {
- font_color_label?.text = getString(R.string.transparent)
- } else {
- font_color_label?.text =
- "#%s".format(Integer.toHexString(ColorHelper.getFontColor(activity?.isDarkTheme() == true))).toUpperCase()
- }
- }
- })
-
- viewModel.textSecondaryColor.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- if (Preferences.textSecondaryAlpha == "00") {
- secondary_font_color_label?.text = getString(R.string.transparent)
- } else {
- secondary_font_color_label?.text =
- "#%s".format(Integer.toHexString(ColorHelper.getSecondaryFontColor(activity?.isDarkTheme() == true))).toUpperCase()
- }
- }
- })
-
- viewModel.textSecondaryColorDark.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- if (Preferences.textSecondaryAlphaDark == "00") {
- secondary_font_color_label?.text = getString(R.string.transparent)
- } else {
- secondary_font_color_label?.text =
- "#%s".format(Integer.toHexString(ColorHelper.getSecondaryFontColor(activity?.isDarkTheme() == true))).toUpperCase()
- }
- }
- })
-
- viewModel.textSecondaryAlpha.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- if (Preferences.textSecondaryAlpha == "00") {
- secondary_font_color_label?.text = getString(R.string.transparent)
- } else {
- secondary_font_color_label?.text =
- "#%s".format(Integer.toHexString(ColorHelper.getSecondaryFontColor(activity?.isDarkTheme() == true))).toUpperCase()
- }
- }
- })
-
- viewModel.textSecondaryAlphaDark.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- if (Preferences.textSecondaryAlphaDark == "00") {
- secondary_font_color_label?.text = getString(R.string.transparent)
- } else {
- secondary_font_color_label?.text =
- "#%s".format(Integer.toHexString(ColorHelper.getSecondaryFontColor(activity?.isDarkTheme() == true))).toUpperCase()
- }
- }
- })
-
viewModel.secondRowTopMargin.observe(viewLifecycleOwner, Observer {
maintainScrollPosition {
second_row_top_margin_label?.text = when (it) {
@@ -259,58 +165,12 @@ class GeneralTabFragment : Fragment() {
}
})
- viewModel.textShadow.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- if (activity?.isDarkTheme() != true) {
- text_shadow_label?.text =
- getString(SettingsStringHelper.getTextShadowString(it))
- }
- }
- })
-
- viewModel.textShadowDark.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- if (activity?.isDarkTheme() == true) {
- text_shadow_label?.text =
- getString(SettingsStringHelper.getTextShadowString(it))
- }
- }
- })
-
viewModel.dateFormat.observe(viewLifecycleOwner, Observer {
maintainScrollPosition {
date_format_label?.text = DateHelper.getDateText(requireContext(), Calendar.getInstance())
}
})
- viewModel.customFont.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- custom_font_label?.text = SettingsStringHelper.getCustomFontLabel(requireContext(), it)
- MainWidget.updateWidget(requireContext())
- }
- })
-
- viewModel.customFontFile.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- custom_font_label?.text = SettingsStringHelper.getCustomFontLabel(requireContext(), Preferences.customFont)
- MainWidget.updateWidget(requireContext())
- }
- })
-
- viewModel.customFontName.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- custom_font_label?.text = SettingsStringHelper.getCustomFontLabel(requireContext(), Preferences.customFont)
- MainWidget.updateWidget(requireContext())
- }
- })
-
- viewModel.customFontVariant.observe(viewLifecycleOwner, Observer {
- maintainScrollPosition {
- custom_font_label?.text = SettingsStringHelper.getCustomFontLabel(requireContext(), Preferences.customFont)
- MainWidget.updateWidget(requireContext())
- }
- })
-
viewModel.showDividers.observe(viewLifecycleOwner, Observer {
maintainScrollPosition {
show_dividers_label?.text =
@@ -320,77 +180,6 @@ class GeneralTabFragment : Fragment() {
}
private fun setupListener() {
- action_main_text_size.setOnClickListener {
- val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.title_main_text_size)).setSelectedValue(Preferences.textMainSize)
- (40 downTo 10).filter { it % 2 == 0 }.forEach {
- dialog.addItem("${it}sp", it.toFloat())
- }
- dialog.addOnSelectItemListener { value ->
- Preferences.textMainSize = value
- }.show()
- }
-
- action_second_text_size.setOnClickListener {
- val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.title_second_text_size)).setSelectedValue(Preferences.textSecondSize)
- (40 downTo 10).filter { it % 2 == 0 }.forEach {
- dialog.addItem("${it}sp", it.toFloat())
- }
- dialog.addOnSelectItemListener { value ->
- Preferences.textSecondSize = value
- }.show()
- }
-
- action_font_color.setOnClickListener {
- BottomSheetColorPicker(requireContext(),
- colors = colors,
- header = getString(R.string.settings_font_color_title),
- getSelected = { ColorHelper.getFontColorRgb(activity?.isDarkTheme() == true) },
- onColorSelected = { color: Int ->
- val colorString = Integer.toHexString(color)
- if (activity?.isDarkTheme() == true) {
- Preferences.textGlobalColorDark = "#" + if (colorString.length > 6) colorString.substring(2) else colorString
- } else {
- Preferences.textGlobalColor = "#" + if (colorString.length > 6) colorString.substring(2) else colorString
- }
- },
- showAlphaSelector = true,
- alpha = if (activity?.isDarkTheme() == true) Preferences.textGlobalAlphaDark.toIntValue() else Preferences.textGlobalAlpha.toIntValue(),
- onAlphaChangeListener = { alpha ->
- if (activity?.isDarkTheme() == true) {
- Preferences.textGlobalAlphaDark = alpha.toHexValue()
- } else {
- Preferences.textGlobalAlpha = alpha.toHexValue()
- }
- }
- ).show()
- }
-
- action_secondary_font_color.setOnClickListener {
- BottomSheetColorPicker(requireContext(),
- colors = colors,
- header = getString(R.string.settings_secondary_font_color_title),
- getSelected = { ColorHelper.getSecondaryFontColorRgb(activity?.isDarkTheme() == true) },
- onColorSelected = { color: Int ->
- val colorString = Integer.toHexString(color)
- if (activity?.isDarkTheme() == true) {
- Preferences.textSecondaryColorDark =
- "#" + if (colorString.length > 6) colorString.substring(2) else colorString
- } else {
- Preferences.textSecondaryColor =
- "#" + if (colorString.length > 6) colorString.substring(2) else colorString
- }
- },
- showAlphaSelector = true,
- alpha = if (activity?.isDarkTheme() == true) Preferences.textSecondaryAlphaDark.toIntValue() else Preferences.textSecondaryAlpha.toIntValue(),
- onAlphaChangeListener = { alpha ->
- if (activity?.isDarkTheme() == true) {
- Preferences.textSecondaryAlphaDark = alpha.toHexValue()
- } else {
- Preferences.textSecondaryAlpha = alpha.toHexValue()
- }
- }
- ).show()
- }
action_second_row_top_margin_size.setOnClickListener {
BottomSheetMenu(
@@ -474,49 +263,6 @@ class GeneralTabFragment : Fragment() {
).show()
}
- action_text_shadow.setOnClickListener {
- val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.title_text_shadow)).setSelectedValue(if (activity?.isDarkTheme() == true) Preferences.textShadowDark else Preferences.textShadow)
- (2 downTo 0).forEach {
- dialog.addItem(getString(SettingsStringHelper.getTextShadowString(it)), it)
- }
- dialog.addOnSelectItemListener { value ->
- if (activity?.isDarkTheme() == true) {
- Preferences.textShadowDark = value
- } else {
- Preferences.textShadow = value
- }
- }.show()
- }
-
- action_custom_font.setOnClickListener {
- val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.settings_custom_font_title)).setSelectedValue(Preferences.customFont)
- dialog.addItem(SettingsStringHelper.getCustomFontLabel(requireContext(), 0), 0)
-
- if (Preferences.customFont == Constants.CUSTOM_FONT_GOOGLE_SANS) {
- dialog.addItem(SettingsStringHelper.getCustomFontLabel(requireContext(), Constants.CUSTOM_FONT_GOOGLE_SANS), Constants.CUSTOM_FONT_GOOGLE_SANS)
- }
-
- if (Preferences.customFontFile != "") {
- dialog.addItem(SettingsStringHelper.getCustomFontLabel(requireContext(), Preferences.customFont), Constants.CUSTOM_FONT_DOWNLOADED)
- }
- dialog.addItem(getString(R.string.action_custom_font_to_search), Constants.CUSTOM_FONT_DOWNLOAD_NEW)
- dialog.addOnSelectItemListener { value ->
- if (value == Constants.CUSTOM_FONT_DOWNLOAD_NEW) {
- startActivityForResult(
- Intent(requireContext(), CustomFontActivity::class.java),
- RequestCode.CUSTOM_FONT_CHOOSER_REQUEST_CODE.code
- )
- } else if (value != Constants.CUSTOM_FONT_DOWNLOADED) {
- Preferences.bulk {
- customFont = value
- customFontFile = ""
- customFontName = ""
- customFontVariant = ""
- }
- }
- }.show()
- }
-
action_show_dividers.setOnClickListener {
show_dividers_toggle.isChecked = !show_dividers_toggle.isChecked
}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/GlanceTabFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/GlanceTabFragment.kt
index 4ed2cdc..a5f8bd1 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/GlanceTabFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/GlanceTabFragment.kt
@@ -47,7 +47,10 @@ import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
import com.tommasoberlose.anotherwidget.utils.convertDpToPixel
+import kotlinx.android.synthetic.main.fragment_calendar_settings.*
import kotlinx.android.synthetic.main.fragment_glance_settings.*
+import kotlinx.android.synthetic.main.fragment_glance_settings.scrollView
+import kotlinx.android.synthetic.main.fragment_tab_selector.*
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import net.idik.lib.slimadapter.SlimAdapter
@@ -320,10 +323,12 @@ class GlanceTabFragment : Fragment() {
ViewCompat.setElevation(view, 2f.convertDpToPixel(requireContext()))
view.setCardBackgroundColor(ContextCompat.getColor(requireContext(),
R.color.colorPrimary))
+ view.strokeWidth = 0
} else {
ViewCompat.setElevation(view, 0f)
view.setCardBackgroundColor(ContextCompat.getColor(requireContext(),
R.color.colorPrimaryDark))
+ view.strokeWidth = 1
}
val topEdge = if ((view.top == 0 && dY < 0) || ((view.top + view.height >= recyclerView.height - 32f.convertDpToPixel(requireContext())) && dY > 0)) 0f else dY
@@ -350,6 +355,10 @@ class GlanceTabFragment : Fragment() {
providers_list.isNestedScrollingEnabled = false
setupListener()
+
+ scrollView?.viewTreeObserver?.addOnScrollChangedListener {
+ viewModel.fragmentScrollY.value = scrollView?.scrollY ?: 0
+ }
}
private fun subscribeUi(
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/MainFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/MainFragment.kt
index ca02d3f..eaaf4b2 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/MainFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/MainFragment.kt
@@ -9,6 +9,7 @@ import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.util.DisplayMetrics
+import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
@@ -24,6 +25,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavController
import androidx.navigation.Navigation
+import androidx.navigation.fragment.FragmentNavigatorExtras
import com.google.android.material.badge.BadgeDrawable
import com.google.android.material.tabs.TabLayoutMediator
import com.google.android.material.transition.MaterialSharedAxis
@@ -104,6 +106,15 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
}
.show()
}
+
+// Navigation.findNavController(settings_fragment).addOnDestinationChangedListener { controller, destination, _ ->
+// action_back?.isVisible = destination.id != R.id.tabSelectorFragment
+// Log.d("ciao", "${controller.currentDestination?.displayName} ${destination.id} - ${R.id.tabSelectorFragment}")
+// }
+
+ viewModel.fragmentScrollY.observe(viewLifecycleOwner) {
+ toolbar?.cardElevation = if (it > 0) 24f else 0f
+ }
}
private var uiJob: Job? = null
@@ -313,12 +324,8 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
}
})
- logo.setOnClickListener {
-// startActivity(Intent(this, SupportDevActivity::class.java))
- }
-
action_settings.setOnClickListener {
- Navigation.findNavController(it).navigate(R.id.action_appMainFragment_to_appSettingsFragment)
+ Navigation.findNavController(it).navigate(R.id.action_appMainFragment_to_appSettingsFragment, null, null, FragmentNavigatorExtras(fragment_title to "settings_title"))
}
}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/SettingsFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/SettingsFragment.kt
index 2e01549..65f48db 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/SettingsFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/SettingsFragment.kt
@@ -4,7 +4,6 @@ import android.Manifest
import android.content.Intent
import android.os.Build
import android.os.Bundle
-import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -15,6 +14,7 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.navigation.Navigation
+import androidx.transition.TransitionInflater
import com.google.android.material.transition.MaterialSharedAxis
import com.karumi.dexter.Dexter
import com.karumi.dexter.MultiplePermissionsReport
@@ -27,13 +27,13 @@ import com.tommasoberlose.anotherwidget.components.BottomSheetMenu
import com.tommasoberlose.anotherwidget.databinding.FragmentSettingsBinding
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.helpers.ActiveNotificationsHelper
-import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
-import com.tommasoberlose.anotherwidget.ui.activities.SupportDevActivity
-import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import com.tommasoberlose.anotherwidget.helpers.CalendarHelper
import com.tommasoberlose.anotherwidget.helpers.MediaPlayerHelper
import com.tommasoberlose.anotherwidget.helpers.WeatherHelper
import com.tommasoberlose.anotherwidget.ui.activities.IntegrationsActivity
+import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
+import com.tommasoberlose.anotherwidget.ui.activities.SupportDevActivity
+import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
import com.tommasoberlose.anotherwidget.utils.openURI
import kotlinx.android.synthetic.main.fragment_settings.*
@@ -51,17 +51,21 @@ class SettingsFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
+ sharedElementEnterTransition = TransitionInflater.from(context).inflateTransition(android.R.transition.move)
enterTransition = MaterialSharedAxis(MaterialSharedAxis.X, true)
- returnTransition = MaterialSharedAxis(MaterialSharedAxis.X, false)
+// returnTransition = MaterialSharedAxis(MaterialSharedAxis.X, false)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
+ savedInstanceState: Bundle?,
): View {
viewModel = ViewModelProvider(activity as MainActivity).get(MainViewModel::class.java)
- val binding = DataBindingUtil.inflate(inflater, R.layout.fragment_settings, container, false)
+ val binding = DataBindingUtil.inflate(inflater,
+ R.layout.fragment_settings,
+ container,
+ false)
binding.lifecycleOwner = this
binding.viewModel = viewModel
@@ -84,10 +88,14 @@ class SettingsFragment : Fragment() {
setupListener()
app_version.text = "v%s (%s)".format(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)
+
+ scrollView.viewTreeObserver.addOnScrollChangedListener {
+ toolbar?.cardElevation = if (scrollView.scrollY > 0) 24f else 0f
+ }
}
private fun subscribeUi(
- viewModel: MainViewModel
+ viewModel: MainViewModel,
) {
viewModel.darkThemePreference.observe(viewLifecycleOwner, Observer {
AppCompatDelegate.setDefaultNightMode(it)
@@ -103,7 +111,9 @@ class SettingsFragment : Fragment() {
})
viewModel.installedIntegrations.observe(viewLifecycleOwner, Observer {
- integrations_count_label?.text = getString(R.string.label_count_installed_integrations).format(it)
+ integrations_count_label?.text =
+ getString(R.string.label_count_installed_integrations).format(
+ it)
})
viewModel.showPreview.observe(viewLifecycleOwner, Observer {
@@ -150,7 +160,8 @@ class SettingsFragment : Fragment() {
action_change_theme.setOnClickListener {
maintainScrollPosition {
- BottomSheetMenu(requireContext(), header = getString(R.string.settings_theme_title))
+ BottomSheetMenu(requireContext(),
+ header = getString(R.string.settings_theme_title))
.setSelectedValue(Preferences.darkThemePreference)
.addItem(
getString(R.string.settings_subtitle_dark_theme_light),
@@ -213,7 +224,7 @@ class SettingsFragment : Fragment() {
Dexter.withContext(requireContext())
.withPermissions(
Manifest.permission.READ_EXTERNAL_STORAGE
- ).withListener(object: MultiplePermissionsListener {
+ ).withListener(object : MultiplePermissionsListener {
override fun onPermissionsChecked(report: MultiplePermissionsReport?) {
report?.let {
if (report.areAllPermissionsGranted()) {
@@ -223,9 +234,10 @@ class SettingsFragment : Fragment() {
}
}
}
+
override fun onPermissionRationaleShouldBeShown(
permissions: MutableList?,
- token: PermissionToken?
+ token: PermissionToken?,
) {
// Remember to invoke this method when the custom rationale is closed
// or just by default if you don't want to use any custom rationale.
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/TabSelectorFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/TabSelectorFragment.kt
index 73c265c..378cb09 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/TabSelectorFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/TabSelectorFragment.kt
@@ -39,6 +39,7 @@ import com.tommasoberlose.anotherwidget.ui.activities.ChooseApplicationActivity
import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
import com.tommasoberlose.anotherwidget.utils.*
+import kotlinx.android.synthetic.main.fragment_calendar_settings.*
import kotlinx.android.synthetic.main.fragment_tab_selector.*
import kotlinx.android.synthetic.main.fragment_tab_selector.scrollView
import kotlinx.coroutines.delay
@@ -79,6 +80,10 @@ class TabSelectorFragment : Fragment() {
super.onActivityCreated(savedInstanceState)
setupListener()
+
+ scrollView?.viewTreeObserver?.addOnScrollChangedListener {
+ viewModel.fragmentScrollY.value = scrollView?.scrollY ?: 0
+ }
}
private fun subscribeUi(
@@ -127,6 +132,10 @@ class TabSelectorFragment : Fragment() {
private fun setupListener() {
+ action_typography.setOnClickListener {
+ Navigation.findNavController(it).navigate(R.id.action_tabSelectorFragment_to_typographyTabFragment)
+ }
+
action_general_settings.setOnClickListener {
Navigation.findNavController(it).navigate(R.id.action_tabSelectorFragment_to_generalTabFragment)
}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/TypographyTabFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/TypographyTabFragment.kt
new file mode 100644
index 0000000..6d88cff
--- /dev/null
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/TypographyTabFragment.kt
@@ -0,0 +1,374 @@
+package com.tommasoberlose.anotherwidget.ui.fragments
+
+import android.annotation.SuppressLint
+import android.content.Intent
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.databinding.DataBindingUtil
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.ViewModelProvider
+import androidx.lifecycle.lifecycleScope
+import com.chibatching.kotpref.blockingBulk
+import com.chibatching.kotpref.bulk
+import com.google.android.material.transition.MaterialSharedAxis
+import com.tommasoberlose.anotherwidget.R
+import com.tommasoberlose.anotherwidget.components.BottomSheetColorPicker
+import com.tommasoberlose.anotherwidget.components.BottomSheetMenu
+import com.tommasoberlose.anotherwidget.databinding.FragmentGeneralSettingsBinding
+import com.tommasoberlose.anotherwidget.databinding.FragmentTypographyTabBinding
+import com.tommasoberlose.anotherwidget.global.Constants
+import com.tommasoberlose.anotherwidget.global.Preferences
+import com.tommasoberlose.anotherwidget.global.RequestCode
+import com.tommasoberlose.anotherwidget.helpers.ColorHelper
+import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toHexValue
+import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toIntValue
+import com.tommasoberlose.anotherwidget.helpers.DateHelper
+import com.tommasoberlose.anotherwidget.helpers.SettingsStringHelper
+import com.tommasoberlose.anotherwidget.ui.activities.CustomDateActivity
+import com.tommasoberlose.anotherwidget.ui.activities.CustomFontActivity
+import com.tommasoberlose.anotherwidget.ui.activities.MainActivity
+import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
+import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
+import com.tommasoberlose.anotherwidget.utils.isDarkTheme
+import kotlinx.android.synthetic.main.fragment_calendar_settings.*
+import kotlinx.android.synthetic.main.fragment_tab_selector.*
+import kotlinx.android.synthetic.main.fragment_typography_tab.*
+import kotlinx.android.synthetic.main.fragment_typography_tab.scrollView
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
+import java.util.*
+
+class TypographyTabFragment : Fragment() {
+
+ companion object {
+ fun newInstance() = TypographyTabFragment()
+ }
+
+ private lateinit var viewModel: MainViewModel
+ private lateinit var colors: IntArray
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ enterTransition = MaterialSharedAxis(MaterialSharedAxis.X, true)
+ returnTransition = MaterialSharedAxis(MaterialSharedAxis.X, false)
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+
+ viewModel = ViewModelProvider(activity as MainActivity).get(MainViewModel::class.java)
+ val binding = DataBindingUtil.inflate(inflater, R.layout.fragment_typography_tab, container, false)
+
+ subscribeUi(viewModel)
+
+ binding.lifecycleOwner = this
+ binding.viewModel = viewModel
+ binding.isDarkModeEnabled = activity?.isDarkTheme() == true
+
+ return binding.root
+ }
+
+ override fun onActivityCreated(savedInstanceState: Bundle?) {
+ super.onActivityCreated(savedInstanceState)
+
+ setupListener()
+ lifecycleScope.launch(Dispatchers.IO) {
+ val lazyColors = requireContext().resources.getIntArray(R.array.material_colors)
+ withContext(Dispatchers.Main) {
+ colors = lazyColors
+ }
+ }
+
+ scrollView?.viewTreeObserver?.addOnScrollChangedListener {
+ viewModel.fragmentScrollY.value = scrollView?.scrollY ?: 0
+ }
+ }
+
+
+ @SuppressLint("DefaultLocale")
+ private fun subscribeUi(
+ viewModel: MainViewModel
+ ) {
+
+ viewModel.textMainSize.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ main_text_size_label?.text = String.format("%.0fsp", it)
+ }
+ }
+
+ viewModel.textSecondSize.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ second_text_size_label?.text = String.format("%.0fsp", it)
+ }
+ }
+
+ viewModel.textGlobalColor.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ if (Preferences.textGlobalAlpha == "00") {
+ font_color_label?.text = getString(R.string.transparent)
+ } else {
+ font_color_label?.text =
+ "#%s".format(Integer.toHexString(ColorHelper.getFontColor(activity?.isDarkTheme() == true))).toUpperCase()
+ }
+ }
+ }
+
+ viewModel.textGlobalColorDark.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ if (Preferences.textGlobalAlphaDark == "00") {
+ font_color_label_dark?.text = getString(R.string.transparent)
+ } else {
+ font_color_label_dark?.text =
+ "#%s".format(Integer.toHexString(ColorHelper.getFontColor(activity?.isDarkTheme() == true))).toUpperCase()
+ }
+ }
+ }
+
+ viewModel.textGlobalAlpha.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ if (Preferences.textGlobalAlpha == "00") {
+ font_color_label?.text = getString(R.string.transparent)
+ } else {
+ font_color_label?.text =
+ "#%s".format(Integer.toHexString(ColorHelper.getFontColor(activity?.isDarkTheme() == true))).toUpperCase()
+ }
+ }
+ }
+
+ viewModel.textGlobalAlphaDark.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ if (Preferences.textGlobalAlphaDark == "00") {
+ font_color_label_dark?.text = getString(R.string.transparent)
+ } else {
+ font_color_label_dark?.text =
+ "#%s".format(Integer.toHexString(ColorHelper.getFontColor(activity?.isDarkTheme() == true))).toUpperCase()
+ }
+ }
+ }
+
+ viewModel.textSecondaryColor.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ if (Preferences.textSecondaryAlpha == "00") {
+ secondary_font_color_label?.text = getString(R.string.transparent)
+ } else {
+ secondary_font_color_label?.text =
+ "#%s".format(Integer.toHexString(ColorHelper.getSecondaryFontColor(activity?.isDarkTheme() == true))).toUpperCase()
+ }
+ }
+ }
+
+ viewModel.textSecondaryColorDark.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ if (Preferences.textSecondaryAlphaDark == "00") {
+ secondary_font_color_label_dark?.text = getString(R.string.transparent)
+ } else {
+ secondary_font_color_label_dark?.text =
+ "#%s".format(Integer.toHexString(ColorHelper.getSecondaryFontColor(activity?.isDarkTheme() == true))).toUpperCase()
+ }
+ }
+ }
+
+ viewModel.textSecondaryAlpha.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ if (Preferences.textSecondaryAlpha == "00") {
+ secondary_font_color_label?.text = getString(R.string.transparent)
+ } else {
+ secondary_font_color_label?.text =
+ "#%s".format(Integer.toHexString(ColorHelper.getSecondaryFontColor(activity?.isDarkTheme() == true))).toUpperCase()
+ }
+ }
+ }
+
+ viewModel.textSecondaryAlphaDark.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ if (Preferences.textSecondaryAlphaDark == "00") {
+ secondary_font_color_label_dark?.text = getString(R.string.transparent)
+ } else {
+ secondary_font_color_label_dark?.text =
+ "#%s".format(Integer.toHexString(ColorHelper.getSecondaryFontColor(activity?.isDarkTheme() == true))).toUpperCase()
+ }
+ }
+ }
+
+ viewModel.textShadow.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ if (activity?.isDarkTheme() != true) {
+ text_shadow_label?.text =
+ getString(SettingsStringHelper.getTextShadowString(it))
+ }
+ }
+ }
+
+ viewModel.textShadowDark.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ if (activity?.isDarkTheme() == true) {
+ text_shadow_label_dark?.text =
+ getString(SettingsStringHelper.getTextShadowString(it))
+ }
+ }
+ }
+
+ viewModel.customFont.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ custom_font_label?.text = SettingsStringHelper.getCustomFontLabel(requireContext(), it)
+ MainWidget.updateWidget(requireContext())
+ }
+ }
+
+ viewModel.customFontFile.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ custom_font_label?.text = SettingsStringHelper.getCustomFontLabel(requireContext(), Preferences.customFont)
+ MainWidget.updateWidget(requireContext())
+ }
+ }
+
+ viewModel.customFontName.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ custom_font_label?.text = SettingsStringHelper.getCustomFontLabel(requireContext(), Preferences.customFont)
+ MainWidget.updateWidget(requireContext())
+ }
+ }
+
+ viewModel.customFontVariant.observe(viewLifecycleOwner) {
+ maintainScrollPosition {
+ custom_font_label?.text = SettingsStringHelper.getCustomFontLabel(requireContext(), Preferences.customFont)
+ MainWidget.updateWidget(requireContext())
+ }
+ }
+ }
+
+ private fun setupListener() {
+ action_main_text_size.setOnClickListener {
+ val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.title_main_text_size)).setSelectedValue(
+ Preferences.textMainSize)
+ (40 downTo 10).filter { it % 2 == 0 }.forEach {
+ dialog.addItem("${it}sp", it.toFloat())
+ }
+ dialog.addOnSelectItemListener { value ->
+ Preferences.textMainSize = value
+ }.show()
+ }
+
+ action_second_text_size.setOnClickListener {
+ val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.title_second_text_size)).setSelectedValue(
+ Preferences.textSecondSize)
+ (40 downTo 10).filter { it % 2 == 0 }.forEach {
+ dialog.addItem("${it}sp", it.toFloat())
+ }
+ dialog.addOnSelectItemListener { value ->
+ Preferences.textSecondSize = value
+ }.show()
+ }
+
+ action_font_color.setOnClickListener {
+ BottomSheetColorPicker(requireContext(),
+ colors = colors,
+ header = getString(R.string.settings_font_color_title),
+ getSelected = { ColorHelper.getFontColorRgb(activity?.isDarkTheme() == true) },
+ onColorSelected = { color: Int ->
+ val colorString = Integer.toHexString(color)
+ if (activity?.isDarkTheme() == true) {
+ Preferences.textGlobalColorDark = "#" + if (colorString.length > 6) colorString.substring(2) else colorString
+ } else {
+ Preferences.textGlobalColor = "#" + if (colorString.length > 6) colorString.substring(2) else colorString
+ }
+ },
+ showAlphaSelector = true,
+ alpha = if (activity?.isDarkTheme() == true) Preferences.textGlobalAlphaDark.toIntValue() else Preferences.textGlobalAlpha.toIntValue(),
+ onAlphaChangeListener = { alpha ->
+ if (activity?.isDarkTheme() == true) {
+ Preferences.textGlobalAlphaDark = alpha.toHexValue()
+ } else {
+ Preferences.textGlobalAlpha = alpha.toHexValue()
+ }
+ }
+ ).show()
+ }
+
+ action_secondary_font_color.setOnClickListener {
+ BottomSheetColorPicker(requireContext(),
+ colors = colors,
+ header = getString(R.string.settings_secondary_font_color_title),
+ getSelected = { ColorHelper.getSecondaryFontColorRgb(activity?.isDarkTheme() == true) },
+ onColorSelected = { color: Int ->
+ val colorString = Integer.toHexString(color)
+ if (activity?.isDarkTheme() == true) {
+ Preferences.textSecondaryColorDark =
+ "#" + if (colorString.length > 6) colorString.substring(2) else colorString
+ } else {
+ Preferences.textSecondaryColor =
+ "#" + if (colorString.length > 6) colorString.substring(2) else colorString
+ }
+ },
+ showAlphaSelector = true,
+ alpha = if (activity?.isDarkTheme() == true) Preferences.textSecondaryAlphaDark.toIntValue() else Preferences.textSecondaryAlpha.toIntValue(),
+ onAlphaChangeListener = { alpha ->
+ if (activity?.isDarkTheme() == true) {
+ Preferences.textSecondaryAlphaDark = alpha.toHexValue()
+ } else {
+ Preferences.textSecondaryAlpha = alpha.toHexValue()
+ }
+ }
+ ).show()
+ }
+
+ action_text_shadow.setOnClickListener {
+ val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.title_text_shadow)).setSelectedValue(if (activity?.isDarkTheme() == true) Preferences.textShadowDark else Preferences.textShadow)
+ (2 downTo 0).forEach {
+ dialog.addItem(getString(SettingsStringHelper.getTextShadowString(it)), it)
+ }
+ dialog.addOnSelectItemListener { value ->
+ if (activity?.isDarkTheme() == true) {
+ Preferences.textShadowDark = value
+ } else {
+ Preferences.textShadow = value
+ }
+ }.show()
+ }
+
+ action_custom_font.setOnClickListener {
+ val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.settings_custom_font_title)).setSelectedValue(
+ Preferences.customFont)
+ dialog.addItem(SettingsStringHelper.getCustomFontLabel(requireContext(), 0), 0)
+
+ if (Preferences.customFont == Constants.CUSTOM_FONT_GOOGLE_SANS) {
+ dialog.addItem(SettingsStringHelper.getCustomFontLabel(requireContext(), Constants.CUSTOM_FONT_GOOGLE_SANS), Constants.CUSTOM_FONT_GOOGLE_SANS)
+ }
+
+ if (Preferences.customFontFile != "") {
+ dialog.addItem(SettingsStringHelper.getCustomFontLabel(requireContext(), Preferences.customFont), Constants.CUSTOM_FONT_DOWNLOADED)
+ }
+ dialog.addItem(getString(R.string.action_custom_font_to_search), Constants.CUSTOM_FONT_DOWNLOAD_NEW)
+ dialog.addOnSelectItemListener { value ->
+ if (value == Constants.CUSTOM_FONT_DOWNLOAD_NEW) {
+ startActivityForResult(
+ Intent(requireContext(), CustomFontActivity::class.java),
+ RequestCode.CUSTOM_FONT_CHOOSER_REQUEST_CODE.code
+ )
+ } else if (value != Constants.CUSTOM_FONT_DOWNLOADED) {
+ Preferences.bulk {
+ customFont = value
+ customFontFile = ""
+ customFontName = ""
+ customFontVariant = ""
+ }
+ }
+ }.show()
+ }
+ }
+
+ private fun maintainScrollPosition(callback: () -> Unit) {
+ scrollView.isScrollable = false
+ callback.invoke()
+ lifecycleScope.launch {
+ delay(200)
+ scrollView.isScrollable = true
+ }
+ }
+}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/WeatherTabFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/WeatherTabFragment.kt
index d06cd77..50abab5 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/WeatherTabFragment.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/WeatherTabFragment.kt
@@ -45,6 +45,8 @@ import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
import com.tommasoberlose.anotherwidget.utils.collapse
import com.tommasoberlose.anotherwidget.utils.expand
+import kotlinx.android.synthetic.main.fragment_calendar_settings.*
+import kotlinx.android.synthetic.main.fragment_tab_selector.*
import kotlinx.android.synthetic.main.fragment_weather_settings.*
import kotlinx.android.synthetic.main.fragment_weather_settings.scrollView
import kotlinx.coroutines.delay
@@ -83,6 +85,10 @@ class WeatherTabFragment : Fragment() {
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
setupListener()
+
+ scrollView?.viewTreeObserver?.addOnScrollChangedListener {
+ viewModel.fragmentScrollY.value = scrollView?.scrollY ?: 0
+ }
}
private fun subscribeUi(
@@ -190,66 +196,54 @@ class WeatherTabFragment : Fragment() {
private fun setupListener() {
action_weather_provider.setOnClickListener {
- if (Preferences.showWeather) {
- startActivityForResult(
- Intent(requireContext(), WeatherProviderActivity::class.java),
- RequestCode.WEATHER_PROVIDER_REQUEST_CODE.code
- )
- }
+ startActivityForResult(
+ Intent(requireContext(), WeatherProviderActivity::class.java),
+ RequestCode.WEATHER_PROVIDER_REQUEST_CODE.code
+ )
}
action_custom_location.setOnClickListener {
- if (Preferences.showWeather) {
- startActivityForResult(
- Intent(requireContext(), CustomLocationActivity::class.java),
- Constants.RESULT_CODE_CUSTOM_LOCATION
- )
- }
+ startActivityForResult(
+ Intent(requireContext(), CustomLocationActivity::class.java),
+ Constants.RESULT_CODE_CUSTOM_LOCATION
+ )
}
action_change_unit.setOnClickListener {
- if (Preferences.showWeather) {
- BottomSheetMenu(requireContext(), header = getString(R.string.settings_unit_title)).setSelectedValue(Preferences.weatherTempUnit)
- .addItem(getString(R.string.fahrenheit), "F")
- .addItem(getString(R.string.celsius), "C")
- .addOnSelectItemListener { value ->
- if (value != Preferences.weatherTempUnit) {
- viewLifecycleOwner.lifecycleScope.launch {
- WeatherHelper.updateWeather(requireContext())
- }
+ BottomSheetMenu(requireContext(), header = getString(R.string.settings_unit_title)).setSelectedValue(Preferences.weatherTempUnit)
+ .addItem(getString(R.string.fahrenheit), "F")
+ .addItem(getString(R.string.celsius), "C")
+ .addOnSelectItemListener { value ->
+ if (value != Preferences.weatherTempUnit) {
+ viewLifecycleOwner.lifecycleScope.launch {
+ WeatherHelper.updateWeather(requireContext())
}
- Preferences.weatherTempUnit = value
- }.show()
- }
+ }
+ Preferences.weatherTempUnit = value
+ }.show()
}
action_weather_refresh_period.setOnClickListener {
- if (Preferences.showWeather) {
- val dialog =
- BottomSheetMenu(requireContext(), header = getString(R.string.settings_weather_refresh_period_title)).setSelectedValue(Preferences.weatherRefreshPeriod)
- (5 downTo 0).forEach {
- dialog.addItem(getString(SettingsStringHelper.getRefreshPeriodString(it)), it)
- }
- dialog
- .addOnSelectItemListener { value ->
- Preferences.weatherRefreshPeriod = value
- }.show()
+ val dialog =
+ BottomSheetMenu(requireContext(), header = getString(R.string.settings_weather_refresh_period_title)).setSelectedValue(Preferences.weatherRefreshPeriod)
+ (5 downTo 0).forEach {
+ dialog.addItem(getString(SettingsStringHelper.getRefreshPeriodString(it)), it)
}
+ dialog
+ .addOnSelectItemListener { value ->
+ Preferences.weatherRefreshPeriod = value
+ }.show()
}
action_weather_icon_pack.setOnClickListener {
- if (Preferences.showWeather) {
- IconPackSelector(requireContext(), header = getString(R.string.settings_weather_icon_pack_title)).show()
- }
+ IconPackSelector(requireContext(), header = getString(R.string.settings_weather_icon_pack_title)).show()
}
action_weather_app.setOnClickListener {
- if (Preferences.showWeather) {
- startActivityForResult(
- Intent(requireContext(), ChooseApplicationActivity::class.java),
- RequestCode.WEATHER_APP_REQUEST_CODE.code
- )
- }
+ startActivityForResult(
+ Intent(requireContext(), ChooseApplicationActivity::class.java),
+ RequestCode.WEATHER_APP_REQUEST_CODE.code
+ )
}
}
diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt
index 5e2a799..7b0cc86 100644
--- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt
+++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt
@@ -88,4 +88,7 @@ class MainViewModel : ViewModel() {
val showWallpaper = Preferences.asLiveData(Preferences::showWallpaper)
val showPreview = Preferences.asLiveData(Preferences::showPreview)
val installedIntegrations = Preferences.asLiveData(Preferences::installedIntegrations)
+
+ // UI
+ val fragmentScrollY = MutableLiveData()
}
diff --git a/app/src/main/res/layout/activity_app_notifications_filter.xml b/app/src/main/res/layout/activity_app_notifications_filter.xml
index 2f34b48..86012bb 100644
--- a/app/src/main/res/layout/activity_app_notifications_filter.xml
+++ b/app/src/main/res/layout/activity_app_notifications_filter.xml
@@ -63,7 +63,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="2dp"
- style="@style/CustomCardViewStyle"
app:cardBackgroundColor="@color/colorPrimary">
diff --git a/app/src/main/res/layout/activity_custom_font.xml b/app/src/main/res/layout/activity_custom_font.xml
index 0fcb4c8..6ec89bd 100644
--- a/app/src/main/res/layout/activity_custom_font.xml
+++ b/app/src/main/res/layout/activity_custom_font.xml
@@ -104,6 +104,9 @@
diff --git a/app/src/main/res/layout/activity_custom_location.xml b/app/src/main/res/layout/activity_custom_location.xml
index 85310e3..51e338e 100644
--- a/app/src/main/res/layout/activity_custom_location.xml
+++ b/app/src/main/res/layout/activity_custom_location.xml
@@ -103,6 +103,9 @@
diff --git a/app/src/main/res/layout/activity_integrations.xml b/app/src/main/res/layout/activity_integrations.xml
index a8391f1..2d81f36 100644
--- a/app/src/main/res/layout/activity_integrations.xml
+++ b/app/src/main/res/layout/activity_integrations.xml
@@ -62,6 +62,9 @@
diff --git a/app/src/main/res/layout/activity_music_players_filter.xml b/app/src/main/res/layout/activity_music_players_filter.xml
index 7ea00b0..e84a6c5 100644
--- a/app/src/main/res/layout/activity_music_players_filter.xml
+++ b/app/src/main/res/layout/activity_music_players_filter.xml
@@ -116,6 +116,9 @@
diff --git a/app/src/main/res/layout/application_info_layout.xml b/app/src/main/res/layout/application_info_layout.xml
index 6215717..7134619 100644
--- a/app/src/main/res/layout/application_info_layout.xml
+++ b/app/src/main/res/layout/application_info_layout.xml
@@ -1,54 +1,67 @@
-
-
-
-
+
-
-
\ No newline at end of file
+ android:paddingBottom="8dp"
+ android:paddingTop="8dp"
+ android:orientation="horizontal"
+ android:gravity="center_vertical|start">
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/custom_location_item.xml b/app/src/main/res/layout/custom_location_item.xml
index d72b728..8be6b34 100644
--- a/app/src/main/res/layout/custom_location_item.xml
+++ b/app/src/main/res/layout/custom_location_item.xml
@@ -1,16 +1,35 @@
-
\ No newline at end of file
+ android:focusable="true"
+ app:cardElevation="0dp"
+ android:id="@+id/item"
+ app:strokeWidth="1dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="4dp"
+ android:layout_marginLeft="12dp"
+ android:layout_marginRight="12dp"
+ app:strokeColor="@color/cardBorder"
+ android:foreground="?android:attr/selectableItemBackground"
+ app:cardBackgroundColor="@color/colorPrimaryDark"
+ app:cardCornerRadius="8dp">
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_app_main.xml b/app/src/main/res/layout/fragment_app_main.xml
index 127a05e..736700b 100644
--- a/app/src/main/res/layout/fragment_app_main.xml
+++ b/app/src/main/res/layout/fragment_app_main.xml
@@ -5,16 +5,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
- android:background="?android:attr/colorPrimaryDark"
+ android:background="?android:attr/colorPrimary"
tools:context=".ui.activities.MainActivity">
+ android:visibility="gone"
+ android:id="@+id/action_back"/>
@@ -63,7 +69,6 @@
android:layout_alignParentRight="true"
android:id="@+id/action_settings"/>
-
-
-
+ android:layout_height="match_parent" />
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_calendar_settings.xml b/app/src/main/res/layout/fragment_calendar_settings.xml
index 48142f9..5ce7033 100644
--- a/app/src/main/res/layout/fragment_calendar_settings.xml
+++ b/app/src/main/res/layout/fragment_calendar_settings.xml
@@ -17,8 +17,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
- android:scrollbarThumbVertical="@color/colorPrimary"
- android:background="@color/colorPrimaryDark">
+ android:background="@color/colorPrimary"
+ android:scrollbarThumbVertical="@color/colorPrimaryDark">
-
@@ -197,9 +201,13 @@
style="@style/AnotherWidget.Settings.Subtitle"
android:text="@string/settings_busy_events_subtitle"/>
-
@@ -289,9 +297,13 @@
android:id="@+id/show_diff_time_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
-
@@ -419,9 +431,13 @@
android:id="@+id/show_multiple_events_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
-
diff --git a/app/src/main/res/layout/fragment_clock_settings.xml b/app/src/main/res/layout/fragment_clock_settings.xml
index 9ce2ca8..fad61c4 100644
--- a/app/src/main/res/layout/fragment_clock_settings.xml
+++ b/app/src/main/res/layout/fragment_clock_settings.xml
@@ -20,8 +20,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
- android:scrollbarThumbVertical="@color/colorPrimary"
- android:background="@color/colorPrimaryDark">
+ android:background="@color/colorPrimary"
+ android:scrollbarThumbVertical="@color/colorPrimaryDark">
-
diff --git a/app/src/main/res/layout/fragment_general_settings.xml b/app/src/main/res/layout/fragment_general_settings.xml
index 9cac4ae..166fa29 100644
--- a/app/src/main/res/layout/fragment_general_settings.xml
+++ b/app/src/main/res/layout/fragment_general_settings.xml
@@ -14,8 +14,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
- android:scrollbarThumbVertical="@color/colorPrimary"
- android:background="@color/colorPrimaryDark">
+ android:background="@color/colorPrimary"
+ android:scrollbarThumbVertical="@color/colorPrimaryDark">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ app:tint="@color/colorPrimaryText"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ app:tint="@color/colorPrimaryText"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ app:tint="@color/colorPrimaryText"/>
-
@@ -466,6 +162,7 @@
android:text="@string/header_widget_background"
android:textAlignment="viewStart"
android:paddingLeft="20dp"
+ android:textColor="@color/colorAccent"
android:paddingRight="20dp"
android:textAppearance="@style/AnotherWidget.Settings.Header"
app:textAllCaps="false" />
@@ -487,7 +184,7 @@
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_aspect_ratio_24"
- app:tint="@color/colorAccent"/>
+ app:tint="@color/colorPrimaryText"/>
+ android:background="@color/colorPrimary"
+ android:scrollbarThumbVertical="@color/colorPrimaryDark">
@@ -54,12 +55,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
- android:scrollbarThumbVertical="@color/colorPrimary"
- android:background="@color/colorPrimaryDark">
+ android:scrollbarThumbVertical="@color/colorPrimaryDark"
+ android:background="@color/colorPrimary">
+ android:orientation="vertical"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp">
-
@@ -189,9 +196,13 @@
android:id="@+id/show_wallpaper_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
-
diff --git a/app/src/main/res/layout/fragment_tab_selector.xml b/app/src/main/res/layout/fragment_tab_selector.xml
index 3325887..02e5f88 100644
--- a/app/src/main/res/layout/fragment_tab_selector.xml
+++ b/app/src/main/res/layout/fragment_tab_selector.xml
@@ -23,18 +23,18 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
- android:scrollbarThumbVertical="@color/colorPrimary"
- android:background="@color/colorPrimaryDark">
+ android:background="@color/colorPrimary"
+ android:scrollbarThumbVertical="@color/colorPrimaryDark">
-
+ android:orientation="vertical">
-
+
+
-
+ android:layout_weight="1"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:orientation="vertical">
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+ android:orientation="vertical">
-
+
+
+
+
+
+
+
+
+
-
+ android:layout_marginEnd="16dp"
+ 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"
+ android:buttonTint="@color/colorAccent" />
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+ android:layout_marginEnd="16dp"
+ android:layout_marginStart="16dp"
+ app:kswThumbWidth="16sp"
+ app:kswThumbHeight="16sp"
+ app:kswBackRadius="16dp"
+ app:kswTintColor="@color/colorAccent"
+ android:checked="@{isWeatherVisible}"
+ android:id="@+id/show_weather_switch"
+ android:buttonTint="@color/colorAccent" />
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+ android:layout_marginEnd="16dp"
+ android:layout_marginStart="16dp"
+ app:kswThumbWidth="16sp"
+ app:kswThumbHeight="16sp"
+ app:kswBackRadius="16dp"
+ app:kswTintColor="@color/colorAccent"
+ android:checked="@{isClockVisible}"
+ android:id="@+id/show_clock_switch"
+ android:buttonTint="@color/colorAccent" />
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+ android:layout_marginEnd="16dp"
+ android:layout_marginStart="16dp"
+ app:kswThumbWidth="16sp"
+ app:kswThumbHeight="16sp"
+ app:kswBackRadius="16dp"
+ app:kswTintColor="@color/colorAccent"
+ android:checked="@{isGlanceVisible}"
+ android:id="@+id/show_glance_switch"
+ android:buttonTint="@color/colorAccent" />
-
-
diff --git a/app/src/main/res/layout/fragment_typography_tab.xml b/app/src/main/res/layout/fragment_typography_tab.xml
new file mode 100644
index 0000000..d993f7f
--- /dev/null
+++ b/app/src/main/res/layout/fragment_typography_tab.xml
@@ -0,0 +1,382 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_weather_settings.xml b/app/src/main/res/layout/fragment_weather_settings.xml
index 161fdf8..3b152f8 100644
--- a/app/src/main/res/layout/fragment_weather_settings.xml
+++ b/app/src/main/res/layout/fragment_weather_settings.xml
@@ -13,8 +13,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
- android:scrollbarThumbVertical="@color/colorPrimary"
- android:background="@color/colorPrimaryDark">
+ android:background="@color/colorPrimary"
+ android:scrollbarThumbVertical="@color/colorPrimaryDark">
@@ -56,9 +61,9 @@
+ android:src="@drawable/round_drag"
+ app:tint="@color/colorSecondaryText"/>
\ No newline at end of file
diff --git a/app/src/main/res/layout/glance_provider_settings_layout.xml b/app/src/main/res/layout/glance_provider_settings_layout.xml
index a2dbc95..668be7d 100644
--- a/app/src/main/res/layout/glance_provider_settings_layout.xml
+++ b/app/src/main/res/layout/glance_provider_settings_layout.xml
@@ -44,9 +44,13 @@
android:id="@+id/subtitle"
android:text=""/>
-
diff --git a/app/src/main/res/layout/inapp_product_layout.xml b/app/src/main/res/layout/inapp_product_layout.xml
index 138e865..0ef58b2 100644
--- a/app/src/main/res/layout/inapp_product_layout.xml
+++ b/app/src/main/res/layout/inapp_product_layout.xml
@@ -33,7 +33,7 @@
android:layout_height="30dp"
app:cardCornerRadius="15dp"
app:cardElevation="0dp"
- app:cardBackgroundColor="@color/colorAccent_op30"
+ app:cardBackgroundColor="@color/colorAccent_op10"
app:cardPreventCornerOverlap="true">
-
\ No newline at end of file
+ android:focusable="true"
+ app:cardElevation="0dp"
+ android:id="@+id/item"
+ app:strokeWidth="1dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="4dp"
+ android:layout_marginLeft="12dp"
+ android:layout_marginRight="12dp"
+ app:strokeColor="@color/cardBorder"
+ android:foreground="?android:attr/selectableItemBackground"
+ app:cardBackgroundColor="@color/colorPrimaryDark"
+ app:cardCornerRadius="8dp">
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/settings_menu_item.xml b/app/src/main/res/layout/settings_menu_item.xml
index fbbfd47..ffc8dd2 100644
--- a/app/src/main/res/layout/settings_menu_item.xml
+++ b/app/src/main/res/layout/settings_menu_item.xml
@@ -1,8 +1,8 @@
-
-
diff --git a/app/src/main/res/navigation/settings_nav_graph.xml b/app/src/main/res/navigation/settings_nav_graph.xml
index f03f184..106951e 100644
--- a/app/src/main/res/navigation/settings_nav_graph.xml
+++ b/app/src/main/res/navigation/settings_nav_graph.xml
@@ -42,5 +42,12 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml
index b7b1e47..471fc4c 100644
--- a/app/src/main/res/values-night/colors.xml
+++ b/app/src/main/res/values-night/colors.xml
@@ -26,4 +26,5 @@
#33000000
#202020
#252525
+ #202020
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 0e48593..c0adcc8 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -35,5 +35,5 @@
#43A047
#efefef
#DADADA
-
+ #EAEAEA
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c81498e..726e66d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -22,14 +22,14 @@
Alpha
Transparent
Show text dividers
- First row
- Second row
+ Primary Text
+ Secondary Text
Widget
Capitalize the date
Date format
Widget background
Margin
- Custom font...
+ Custom font…
Thin
Light
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index ad04336..cd72c67 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -9,6 +9,7 @@
- @bool/is_not_dark_theme
- true
- @color/colorAccent
+ - @color/black_10
- true
@@ -72,10 +73,15 @@
@@ -158,8 +166,20 @@
- rounded
- 0dp
- 0dp
- - 24dp
- - 24dp
+ - 20dp
+ - 20dp
+
+
+
+
+
\ No newline at end of file