UI update

This commit is contained in:
Tommaso Berlose 2021-01-05 17:53:00 +01:00
parent 2aed9e3b25
commit e12e908496
40 changed files with 1660 additions and 1206 deletions

41
.idea/navEditor.xml generated
View File

@ -108,6 +108,47 @@
<option name="y" value="216" />
</Point>
</option>
<option name="myPositions">
<map>
<entry key="action_tabSelectorFragment_to_calendarTabFragment">
<value>
<LayoutPositions />
</value>
</entry>
<entry key="action_tabSelectorFragment_to_clockTabFragment">
<value>
<LayoutPositions />
</value>
</entry>
<entry key="action_tabSelectorFragment_to_generalTabFragment">
<value>
<LayoutPositions />
</value>
</entry>
<entry key="action_tabSelectorFragment_to_glanceTabFragment">
<value>
<LayoutPositions />
</value>
</entry>
<entry key="action_tabSelectorFragment_to_weatherTabFragment">
<value>
<LayoutPositions />
</value>
</entry>
</map>
</option>
</LayoutPositions>
</value>
</entry>
<entry key="typographyTabFragment">
<value>
<LayoutPositions>
<option name="myPosition">
<Point>
<option name="x" value="470" />
<option name="y" value="-207" />
</Point>
</option>
</LayoutPositions>
</value>
</entry>

View File

@ -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()

View File

@ -68,7 +68,7 @@ class CustomLocationActivity : AppCompatActivity() {
.register<String>(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<Address>(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()

View File

@ -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<Int>().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<Int>(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<Int>().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<Int>(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<Int>(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<Int>(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<Int>(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<Int>(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<Boolean>(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<Boolean>(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 {

View File

@ -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<Float>(
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<Float>(
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<Int>(
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<Int>(
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
)
}
}

View File

@ -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<Float>(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<Float>(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<Int>(
@ -474,49 +263,6 @@ class GeneralTabFragment : Fragment() {
).show()
}
action_text_shadow.setOnClickListener {
val dialog = BottomSheetMenu<Int>(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<Int>(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
}

View File

@ -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(

View File

@ -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"))
}
}

View File

@ -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<FragmentSettingsBinding>(inflater, R.layout.fragment_settings, container, false)
val binding = DataBindingUtil.inflate<FragmentSettingsBinding>(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<Int>(requireContext(), header = getString(R.string.settings_theme_title))
BottomSheetMenu<Int>(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<PermissionRequest>?,
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.

View File

@ -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)
}

View File

@ -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<FragmentTypographyTabBinding>(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<Float>(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<Float>(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<Int>(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<Int>(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
}
}
}

View File

@ -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<String>(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<String>(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<Int>(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<Int>(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
)
}
}

View File

@ -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<Int>()
}

View File

@ -63,7 +63,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="2dp"
style="@style/CustomCardViewStyle"
app:cardBackgroundColor="@color/colorPrimary">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"

View File

@ -115,6 +115,9 @@
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:clipToPadding="false"
android:id="@+id/list_view" />
</RelativeLayout>
</LinearLayout>

View File

@ -104,6 +104,9 @@
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:clipToPadding="false"
android:id="@+id/list_view" />
</RelativeLayout>
</LinearLayout>

View File

@ -103,6 +103,9 @@
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:clipToPadding="false"
android:id="@+id/list_view" />
</RelativeLayout>
</LinearLayout>

View File

@ -62,6 +62,9 @@
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:clipToPadding="false"
android:id="@+id/list_view" />
</RelativeLayout>
</LinearLayout>

View File

@ -116,6 +116,9 @@
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:clipToPadding="false"
android:id="@+id/list_view" />
</RelativeLayout>
</LinearLayout>

View File

@ -1,54 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="64dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/selectableItemBackground"
android:focusable="true"
android:layout_height="wrap_content"
android:clickable="true"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:orientation="horizontal"
android:focusable="true"
app:cardElevation="0dp"
android:id="@+id/item"
android:gravity="center_vertical|start">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:src="@mipmap/ic_launcher_foreground"
android:contentDescription="icon"
android:id="@+id/icon"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center_vertical|start"
android:paddingEnd="24dp"
android:lines="1"
android:textAlignment="viewStart"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/colorPrimaryText"
style="@style/AnotherWidget.Settings.Title"/>
<com.google.android.material.checkbox.MaterialCheckBox
android:layout_width="wrap_content"
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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/checkBox"
android:visibility="gone"
android:layout_gravity="center_vertical" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_check_circle_outline_24"
android:visibility="gone"
app:tint="@color/colorPrimaryText"
android:id="@+id/selected_icon" />
</LinearLayout>
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:orientation="horizontal"
android:gravity="center_vertical|start">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:src="@mipmap/ic_launcher_foreground"
android:contentDescription="icon"
android:id="@+id/icon"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center_vertical|start"
android:paddingEnd="24dp"
android:paddingStart="0dp"
android:lines="1"
android:textAlignment="viewStart"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/colorPrimaryText"
style="@style/AnotherWidget.Settings.Title"/>
<com.google.android.material.checkbox.MaterialCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/checkBox"
android:visibility="gone"
android:layout_gravity="center_vertical" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_check_circle_outline_24"
android:visibility="gone"
app:tint="@color/colorPrimaryText"
android:id="@+id/selected_icon" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -1,16 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text"
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="56dp"
android:gravity="center_vertical|start"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingEnd="32dp"
android:paddingStart="32dp"
android:focusable="true"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:clickable="true"
android:textAlignment="viewStart"
android:background="?attr/selectableItemBackground"
android:textColor="@color/colorPrimaryText"
style="@style/AnotherWidget.Settings.Title"/>
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">
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="56dp"
android:gravity="center_vertical|start"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingEnd="16dp"
android:paddingStart="16dp"
android:focusable="true"
android:clickable="true"
android:textAlignment="viewStart"
android:background="?attr/selectableItemBackground"
android:textColor="@color/colorPrimaryText"
style="@style/AnotherWidget.Settings.Title"/>
</com.google.android.material.card.MaterialCardView>

View File

@ -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">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:cardElevation="2dp"
app:cardElevation="0dp"
app:cardCornerRadius="0dp"
android:id="@+id/toolbar"
android:transitionName="@string/toolbar_transition_name"
style="@style/CustomCardViewStyle"
app:cardBackgroundColor="@color/colorPrimary">
<LinearLayout
android:layout_width="match_parent"
@ -29,12 +29,16 @@
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/ic_splash_logo"
android:layout_alignParentBottom="true"
android:layout_marginBottom="3dp"
android:visibility="gone"
android:padding="10dp"
android:src="@drawable/round_arrow_back_24"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackgroundBorderless"
app:tint="@color/colorPrimaryText"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:id="@+id/logo"/>
android:visibility="gone"
android:id="@+id/action_back"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -46,6 +50,8 @@
android:text="@string/app_name"
android:gravity="center"
android:textStyle="bold"
android:transitionName="title"
android:id="@+id/fragment_title"
android:layout_marginBottom="1dp"
style="@style/AnotherWidget.Main.Title"/>
</LinearLayout>
@ -63,7 +69,6 @@
android:layout_alignParentRight="true"
android:id="@+id/action_settings"/>
</RelativeLayout>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="140dp"
@ -111,19 +116,22 @@
android:id="@+id/bottom_padding" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<LinearLayout
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@+id/toolbar"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@color/colorPrimaryDark"
app:cardElevation="0dp"
app:cardPreventCornerOverlap="true"
app:cardCornerRadius="0dp"
app:cardBackgroundColor="@color/colorPrimaryDark"
android:orientation="vertical">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/settings_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
app:defaultNavHost="true"
app:defaultNavHost="false"
app:navGraph="@navigation/settings_nav_graph"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
android:layout_height="match_parent" />
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -116,9 +116,13 @@
android:id="@+id/all_day_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:layout_marginEnd="16dp"
android:id="@+id/show_all_day_toggle"
android:buttonTint="@color/colorAccent" />
@ -197,9 +201,13 @@
style="@style/AnotherWidget.Settings.Subtitle"
android:text="@string/settings_busy_events_subtitle"/>
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:layout_marginEnd="16dp"
android:id="@+id/show_only_busy_events_toggle"
android:buttonTint="@color/colorAccent" />
@ -289,9 +297,13 @@
android:id="@+id/show_diff_time_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:layout_marginEnd="16dp"
android:id="@+id/show_diff_time_toggle"
android:buttonTint="@color/colorAccent" />
@ -419,9 +431,13 @@
android:id="@+id/show_multiple_events_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:layout_marginEnd="16dp"
android:id="@+id/show_multiple_events_toggle"
android:buttonTint="@color/colorAccent" />

View File

@ -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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -231,9 +231,13 @@
android:id="@+id/ampm_indicator_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:layout_marginEnd="16dp"
android:id="@+id/ampm_indicator_toggle"
android:buttonTint="@color/colorAccent" />

View File

@ -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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -25,109 +25,14 @@
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/first_row_header"
android:paddingTop="16dp"
android:text="@string/preferences_header"
android:textAlignment="viewStart"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textColor="@color/colorAccent"
android:textAppearance="@style/AnotherWidget.Settings.Header"
app:textAllCaps="false" />
<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_main_text_size"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_text_fields_24"
app:tint="@color/colorAccent"/>
<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/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>
</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_font_color"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_palette_24"
app:tint="@color/colorAccent"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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_font_color_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/font_color_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="4dp"
android:layout_gravity="center_vertical"
app:cardBackgroundColor="@color/colorPrimary"
android:layout_marginEnd="8dp"
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
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
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -146,7 +51,7 @@
android:layout_height="48dp"
android:padding="10dp"
android:src="@drawable/round_text_format_24"
app:tint="@color/colorAccent"/>
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -165,112 +70,6 @@
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:text="@string/second_row_header"
android:textAlignment="viewStart"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textAppearance="@style/AnotherWidget.Settings.Header"
app:textAllCaps="false" />
<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_second_text_size"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_text_fields_24"
app:tint="@color/colorAccent"/>
<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/title_second_text_size"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/second_text_size_label"
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_secondary_font_color"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_palette_24"
app:tint="@color/colorAccent"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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_secondary_font_color_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/secondary_font_color_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="4dp"
android:layout_gravity="center_vertical"
app:cardBackgroundColor="@color/colorPrimary"
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
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
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -289,7 +88,7 @@
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_format_line_spacing"
app:tint="@color/colorAccent"/>
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -308,112 +107,6 @@
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:text="@string/preferences_header"
android:textAlignment="viewStart"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textAppearance="@style/AnotherWidget.Settings.Header"
app:textAllCaps="false" />
<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_text_shadow"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_texture_24"
app:tint="@color/colorAccent"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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/title_text_shadow"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_shadow_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="4dp"
android:layout_gravity="center_vertical"
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
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
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/colorAccent"/>
<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_custom_font_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>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -432,8 +125,7 @@
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_vertical_align_center_24"
android:rotation="90"
app:tint="@color/colorAccent"/>
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
@ -452,9 +144,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:layout_marginEnd="16dp"
android:id="@+id/show_dividers_toggle"
android:buttonTint="@color/colorAccent" />
@ -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"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"

View File

@ -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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -16,7 +16,7 @@
android:layout_width="match_parent"
android:layout_height="56dp"
app:cardBackgroundColor="@color/colorPrimary"
app:cardElevation="2dp"
app:cardElevation="0dp"
app:cardCornerRadius="0dp"
android:background="@color/colorPrimary"
android:transitionName="@string/toolbar_transition_name"
@ -46,6 +46,7 @@
android:text="@string/settings_title"
android:textColor="@color/colorPrimaryText"
android:gravity="center"
android:transitionName="settings_title"
android:textAppearance="@style/AnotherWidget.Main.Title"
tools:ignore="RelativeOverlap" />
</RelativeLayout>
@ -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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -145,9 +148,13 @@
android:id="@+id/show_widget_preview_label"
style="@style/AnotherWidget.Settings.Subtitle" />
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:layout_marginEnd="16dp"
android:id="@+id/show_widget_preview_toggle"
android:buttonTint="@color/colorAccent" />
@ -189,9 +196,13 @@
android:id="@+id/show_wallpaper_label"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:layout_marginEnd="16dp"
android:id="@+id/show_wallpaper_toggle"
android:buttonTint="@color/colorAccent" />

View File

@ -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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingBottom="32dp"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Apperances"
android:text="Look &amp; feel"
android:paddingTop="16dp"
android:textAlignment="viewStart"
android:paddingLeft="20dp"
@ -48,53 +48,104 @@
app:cardElevation="0dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="4dp"
app:strokeColor="@color/cardBorder"
app:strokeWidth="1dp"
app:cardBackgroundColor="@color/colorPrimaryDark"
app:cardBackgroundColor="@color/colorPrimary"
app:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="8dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_general_settings"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="8dp"
android:src="@drawable/round_palette_24"
app:tint="@color/colorPrimaryText"/>
android:orientation="vertical">
<LinearLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="10dp"
android:paddingEnd="0dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_typography"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="8dp"
android:src="@drawable/round_text_fields_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="Look &amp; feel"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change the widget design"
style="@style/AnotherWidget.Settings.Subtitle"/>
android:layout_weight="1"
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="Typography"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change the text design"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="8dp"
android:src="@drawable/round_chevron_right_24"
app:tint="@color/colorPrimaryText"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="10dp"
android:paddingEnd="0dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_general_settings"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="8dp"
android:src="@drawable/round_palette_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
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/appearance_header"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change the widget design"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="8dp"
android:src="@drawable/round_chevron_right_24"
app:tint="@color/colorPrimaryText"/>
</LinearLayout>
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="8dp"
android:src="@drawable/round_chevron_right_24"
app:tint="@color/colorPrimaryText"/>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<androidx.appcompat.widget.AppCompatTextView
@ -114,267 +165,273 @@
app:cardElevation="0dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="4dp"
app:strokeColor="@color/cardBorder"
app:strokeWidth="1dp"
app:cardBackgroundColor="@color/colorPrimaryDark"
app:cardBackgroundColor="@color/colorPrimary"
app:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="8dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_show_events"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_today_24"/>
android:orientation="vertical">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="vertical">
<TextView
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="10dp"
android:paddingEnd="0dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:id="@+id/action_show_events">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_today_24"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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="Calendar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change the widget design"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/cardBorder"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:alpha="0.6" />
</LinearLayout>
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="Calendar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change the widget design"
style="@style/AnotherWidget.Settings.Subtitle"/>
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" />
</LinearLayout>
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/cardBorder"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:alpha="0.6" />
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:checked="@{isCalendarEnabled}"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:id="@+id/show_events_switch"
android:buttonTint="@color/colorAccent" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="0dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
app:strokeColor="@color/cardBorder"
app:strokeWidth="1dp"
app:cardBackgroundColor="@color/colorPrimaryDark"
app:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="8dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_show_weather"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:id="@+id/weather_icon_pack"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_brightness_5_24"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="vertical">
<TextView
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="10dp"
android:paddingEnd="0dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:id="@+id/action_show_weather">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:id="@+id/weather_icon_pack"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_brightness_5_24"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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="Weather"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change the widget design"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/cardBorder"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:alpha="0.6" />
</LinearLayout>
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="Weather"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change the widget design"
style="@style/AnotherWidget.Settings.Subtitle"/>
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" />
</LinearLayout>
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/cardBorder"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:alpha="0.6" />
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:checked="@{isWeatherVisible}"
android:id="@+id/show_weather_switch"
android:buttonTint="@color/colorAccent" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="0dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
app:strokeColor="@color/cardBorder"
app:strokeWidth="1dp"
app:cardBackgroundColor="@color/colorPrimaryDark"
app:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="8dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_show_clock"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_schedule_24"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="vertical">
<TextView
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="10dp"
android:paddingEnd="0dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:id="@+id/action_show_clock">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_schedule_24"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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="Clock"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change the clock "
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/cardBorder"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:alpha="0.6" />
</LinearLayout>
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="Clock"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change the clock "
style="@style/AnotherWidget.Settings.Subtitle"/>
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" />
</LinearLayout>
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/cardBorder"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:alpha="0.6" />
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:checked="@{isClockVisible}"
android:id="@+id/show_clock_switch"
android:buttonTint="@color/colorAccent" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="0dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
app:strokeColor="@color/cardBorder"
app:strokeWidth="1dp"
app:cardBackgroundColor="@color/colorPrimaryDark"
app:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="8dp"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:id="@+id/action_show_glance"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_pageview"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:orientation="vertical">
<TextView
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="10dp"
android:paddingEnd="0dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:id="@+id/action_show_glance">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_pageview"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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="Glance"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change glace info"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/cardBorder"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:alpha="0.6" />
</LinearLayout>
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AnotherWidget.Settings.Title"
android:text="Glance"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change glace info"
style="@style/AnotherWidget.Settings.Subtitle"/>
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" />
</LinearLayout>
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/cardBorder"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:alpha="0.6" />
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:checked="@{isGlanceVisible}"
android:id="@+id/show_glance_switch"
android:buttonTint="@color/colorAccent" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>

View File

@ -0,0 +1,382 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel" />
<variable
name="isDarkModeEnabled"
type="Boolean" />
<import type="android.view.View" />
</data>
<com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:background="@color/colorPrimary"
android:scrollbarThumbVertical="@color/colorPrimaryDark">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/first_row_header"
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_main_text_size"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_text_fields_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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/title_main_text_size"/>
</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"
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_font_color"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_palette_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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_font_color_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/font_color_label"
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_font_color_dark"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_palette_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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_font_color_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/font_color_label_dark"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/second_row_header"
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_second_text_size"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_text_fields_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/title_second_text_size"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/second_text_size_label"
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_secondary_font_color"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_palette_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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_secondary_font_color_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/secondary_font_color_label"
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_secondary_font_color_dark"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_palette_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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_secondary_font_color_title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/secondary_font_color_label_dark"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/preferences_header"
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_text_shadow"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_texture_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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/title_text_shadow"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_shadow_label"
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_text_shadow_dark"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="12dp"
android:src="@drawable/round_texture_24"
app:tint="@color/colorPrimaryText"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
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/title_text_shadow"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_shadow_label_dark"
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_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/settings_custom_font_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>
</LinearLayout>
</com.tommasoberlose.anotherwidget.components.FixedFocusScrollView>
</layout>

View File

@ -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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -8,22 +8,27 @@
android:focusable="true"
app:cardElevation="0dp"
android:id="@+id/item"
app:strokeWidth="1dp"
android:layout_marginTop="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
app:strokeColor="@color/cardBorder"
android:foreground="?android:attr/selectableItemBackground"
app:cardBackgroundColor="@color/colorPrimaryDark"
app:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="11dp"
android:padding="12dp"
android:id="@+id/icon"
android:src="@drawable/round_music_note_24"
app:tint="@color/colorPrimaryText"/>
@ -56,9 +61,9 @@
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="11dp"
android:padding="12dp"
android:id="@+id/info_icon"
android:src="@drawable/round_drag_handle_24"
app:tint="@color/colorPrimaryText"/>
android:src="@drawable/round_drag"
app:tint="@color/colorSecondaryText"/>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@ -44,9 +44,13 @@
android:id="@+id/subtitle"
android:text=""/>
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_height="wrap_content"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:id="@+id/provider_switch" />
</LinearLayout>
<LinearLayout
@ -135,7 +139,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:text="@string/settings_music_players_filter_subtitle"
android:text="@string/settings_show_next_alarm_app_subtitle_correct"
android:id="@+id/alarm_set_by_subtitle"
style="@style/AnotherWidget.Settings.Subtitle"/>
</LinearLayout>

View File

@ -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">
<TextView
android:layout_width="wrap_content"

View File

@ -1,16 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text"
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="56dp"
android:gravity="center_vertical|start"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingEnd="32dp"
android:paddingStart="32dp"
android:focusable="true"
android:layout_height="wrap_content"
android:clickable="true"
android:textAlignment="viewStart"
android:background="?attr/selectableItemBackground"
android:textColor="@color/colorPrimaryText"
style="@style/AnotherWidget.Settings.Title"/>
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">
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="56dp"
android:gravity="center_vertical|start"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingEnd="16dp"
android:paddingStart="16dp"
android:focusable="true"
android:clickable="true"
android:textAlignment="viewStart"
android:background="?attr/selectableItemBackground"
android:textColor="@color/colorPrimaryText"
style="@style/AnotherWidget.Settings.Title"/>
</com.google.android.material.card.MaterialCardView>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingLeft="8dp"
@ -52,9 +52,13 @@
android:textColor="@color/errorColorText"
android:text="@string/action_grant_permission"/>
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
<com.kyleduo.switchbutton.SwitchButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:kswThumbWidth="16sp"
app:kswThumbHeight="16sp"
app:kswBackRadius="16dp"
app:kswTintColor="@color/colorAccent"
android:layout_marginEnd="16dp"
android:id="@+id/toggle"
android:buttonTint="@color/colorAccent" />

View File

@ -42,5 +42,12 @@
<action
android:id="@+id/action_tabSelectorFragment_to_clockTabFragment"
app:destination="@id/clockTabFragment" />
<action
android:id="@+id/action_tabSelectorFragment_to_typographyTabFragment"
app:destination="@id/typographyTabFragment" />
</fragment>
<fragment
android:id="@+id/typographyTabFragment"
android:name="com.tommasoberlose.anotherwidget.ui.fragments.TypographyTabFragment"
android:label="TypographyTabFragment" />
</navigation>

View File

@ -26,4 +26,5 @@
<color name="disabledButtonBackground">#33000000</color>
<color name="badgeBackground">#202020</color>
<color name="cardBorder">#252525</color>
<color name="rippleColor">#202020</color>
</resources>

View File

@ -35,5 +35,5 @@
<color name="success">#43A047</color>
<color name="badgeBackground">#efefef</color>
<color name="cardBorder">#DADADA</color>
<color name="rippleColor">#EAEAEA</color>
</resources>

View File

@ -22,14 +22,14 @@
<string name="alpha">Alpha</string>
<string name="transparent">Transparent</string>
<string name="settings_show_dividers_title">Show text dividers</string>
<string name="first_row_header">First row</string>
<string name="second_row_header">Second row</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="action_custom_font_to_search">Custom font...</string>
<string name="action_custom_font_to_search">Custom font</string>
<string name="font_100" translatable="false">Thin</string>
<string name="font_200" translatable="false">Light</string>

View File

@ -9,6 +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="android:windowActivityTransitions">true</item>
</style>
@ -72,10 +73,15 @@
</style>
<style name="AnotherWidget.Settings.Header" parent="TextAppearance.AppCompat.Medium">
<item name="android:textColor">@color/colorSecondaryText</item>
<item name="android:textColor">@color/colorAccent</item>
<item name="android:textSize">15sp</item>
<item name="android:textStyle">bold</item>
<item name="android:fontFamily">@font/google_sans</item>
<item name="android:paddingTop">16dp</item>
<item name="android:textAllCaps">false</item>
<item name="android:textAlignment">viewStart</item>
<item name="android:paddingLeft">20dp</item>
<item name="android:paddingRight">20dp</item>
</style>
<style name="AnotherWidget.Settings.Title" parent="TextAppearance.AppCompat.Medium">
@ -137,6 +143,7 @@
<style name="BottomSheet" parent="@style/Widget.Design.BottomSheet.Modal">
<item name="android:background">@drawable/bg_bottom_sheet_dialog</item>
<item name="colorControlHighlight">@color/badgeBackground</item>
</style>
<style name="BaseBottomSheetDialog" parent="@style/Theme.Design.Light.BottomSheetDialog">
@ -146,6 +153,7 @@
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowSoftInputMode">adjustResize</item>
<item name="android:fontFamily">@font/google_sans</item>
<item name="colorControlHighlight">@color/badgeBackground</item>
</style>
<style name="BottomSheetDialogTheme" parent="BaseBottomSheetDialog" />
@ -158,8 +166,20 @@
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopRight">0dp</item>
<item name="cornerSizeTopLeft">0dp</item>
<item name="cornerSizeBottomRight">24dp</item>
<item name="cornerSizeBottomLeft">24dp</item>
<item name="cornerSizeBottomRight">20dp</item>
<item name="cornerSizeBottomLeft">20dp</item>
</style>
<style name="SecondaryCustomCardViewStyle" parent="@style/Widget.MaterialComponents.CardView">
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.MaterialCardView.Cut.Alt</item>
</style>
<style name="ShapeAppearanceOverlay.MaterialCardView.Cut.Alt" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopRight">24dp</item>
<item name="cornerSizeTopLeft">24dp</item>
<item name="cornerSizeBottomRight">0dp</item>
<item name="cornerSizeBottomLeft">0dp</item>
</style>
</resources>