From 5d07cc8d732374fbd65f8382b3e766b586c874a4 Mon Sep 17 00:00:00 2001 From: Tommaso Berlose Date: Fri, 7 May 2021 17:19:23 +0200 Subject: [PATCH] Added color copy/paste, better size and color text selection --- app/build.gradle | 4 +- .../components/BottomSheetColorPicker.kt | 64 +++++++---- .../components/BottomSheetMenu.kt | 1 + .../components/BottomSheetPicker.kt | 108 ++++++++++++++++++ .../anotherwidget/global/Preferences.kt | 1 + .../anotherwidget/helpers/ColorHelper.kt | 46 ++++++++ .../helpers/MediaPlayerHelper.kt | 28 +++-- .../activities/tabs/CustomLocationActivity.kt | 4 +- .../ui/fragments/tabs/CalendarFragment.kt | 15 +++ .../ui/fragments/tabs/TypographyFragment.kt | 24 ++-- .../ui/viewmodels/MainViewModel.kt | 2 + .../anotherwidget/ui/widgets/AlignedWidget.kt | 60 +++++++--- .../ui/widgets/StandardWidget.kt | 58 ++++++++-- .../anotherwidget/utils/Extensions.kt | 8 ++ .../round_subtitles_white_18.png | Bin 0 -> 224 bytes .../round_subtitles_white_20.png | Bin 0 -> 195 bytes .../round_subtitles_white_24.png | Bin 0 -> 170 bytes .../round_subtitles_white_36.png | Bin 0 -> 290 bytes .../round_subtitles_white_48.png | Bin 0 -> 267 bytes .../round_subtitles_white_18.png | Bin 0 -> 160 bytes .../round_subtitles_white_20.png | Bin 0 -> 141 bytes .../round_subtitles_white_24.png | Bin 0 -> 123 bytes .../round_subtitles_white_36.png | Bin 0 -> 170 bytes .../round_subtitles_white_48.png | Bin 0 -> 191 bytes .../round_subtitles_24.png | Bin 0 -> 178 bytes .../round_subtitles_24.png | Bin 0 -> 124 bytes .../round_subtitles_24.png | Bin 0 -> 205 bytes .../round_subtitles_24.png | Bin 0 -> 288 bytes .../round_subtitles_24.png | Bin 0 -> 352 bytes .../round_subtitles_white_18.png | Bin 0 -> 170 bytes .../round_subtitles_white_20.png | Bin 0 -> 183 bytes .../round_subtitles_white_24.png | Bin 0 -> 191 bytes .../round_subtitles_white_36.png | Bin 0 -> 267 bytes .../round_subtitles_white_48.png | Bin 0 -> 344 bytes .../round_subtitles_white_18.png | Bin 0 -> 290 bytes .../round_subtitles_white_20.png | Bin 0 -> 288 bytes .../round_subtitles_white_24.png | Bin 0 -> 267 bytes .../round_subtitles_white_36.png | Bin 0 -> 398 bytes .../round_subtitles_white_48.png | Bin 0 -> 518 bytes .../round_subtitles_white_18.png | Bin 0 -> 267 bytes .../round_subtitles_white_20.png | Bin 0 -> 312 bytes .../round_subtitles_white_24.png | Bin 0 -> 344 bytes .../round_subtitles_white_36.png | Bin 0 -> 518 bytes .../round_subtitles_white_48.png | Bin 0 -> 674 bytes app/src/main/res/drawable/menu_background.xml | 2 +- .../main/res/drawable/round_subtitles_20.xml | 10 ++ .../main/res/drawable/round_subtitles_24.xml | 10 ++ .../main/res/layout/bottom_sheet_menu_hor.xml | 32 +++++- .../res/layout/bottom_sheet_menu_item.xml | 1 + .../main/res/layout/fragment_tab_calendar.xml | 49 ++++++++ .../main/res/layout/left_aligned_widget.xml | 3 +- app/src/main/res/values/strings.xml | 5 + 52 files changed, 460 insertions(+), 75 deletions(-) create mode 100644 app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetPicker.kt create mode 100644 app/src/main/res/drawable-hdpi/round_subtitles_white_18.png create mode 100644 app/src/main/res/drawable-hdpi/round_subtitles_white_20.png create mode 100644 app/src/main/res/drawable-hdpi/round_subtitles_white_24.png create mode 100644 app/src/main/res/drawable-hdpi/round_subtitles_white_36.png create mode 100644 app/src/main/res/drawable-hdpi/round_subtitles_white_48.png create mode 100644 app/src/main/res/drawable-mdpi/round_subtitles_white_18.png create mode 100644 app/src/main/res/drawable-mdpi/round_subtitles_white_20.png create mode 100644 app/src/main/res/drawable-mdpi/round_subtitles_white_24.png create mode 100644 app/src/main/res/drawable-mdpi/round_subtitles_white_36.png create mode 100644 app/src/main/res/drawable-mdpi/round_subtitles_white_48.png create mode 100644 app/src/main/res/drawable-night-hdpi/round_subtitles_24.png create mode 100644 app/src/main/res/drawable-night-mdpi/round_subtitles_24.png create mode 100644 app/src/main/res/drawable-night-xhdpi/round_subtitles_24.png create mode 100644 app/src/main/res/drawable-night-xxhdpi/round_subtitles_24.png create mode 100644 app/src/main/res/drawable-night-xxxhdpi/round_subtitles_24.png create mode 100644 app/src/main/res/drawable-xhdpi/round_subtitles_white_18.png create mode 100644 app/src/main/res/drawable-xhdpi/round_subtitles_white_20.png create mode 100644 app/src/main/res/drawable-xhdpi/round_subtitles_white_24.png create mode 100644 app/src/main/res/drawable-xhdpi/round_subtitles_white_36.png create mode 100644 app/src/main/res/drawable-xhdpi/round_subtitles_white_48.png create mode 100644 app/src/main/res/drawable-xxhdpi/round_subtitles_white_18.png create mode 100644 app/src/main/res/drawable-xxhdpi/round_subtitles_white_20.png create mode 100644 app/src/main/res/drawable-xxhdpi/round_subtitles_white_24.png create mode 100644 app/src/main/res/drawable-xxhdpi/round_subtitles_white_36.png create mode 100644 app/src/main/res/drawable-xxhdpi/round_subtitles_white_48.png create mode 100644 app/src/main/res/drawable-xxxhdpi/round_subtitles_white_18.png create mode 100644 app/src/main/res/drawable-xxxhdpi/round_subtitles_white_20.png create mode 100644 app/src/main/res/drawable-xxxhdpi/round_subtitles_white_24.png create mode 100644 app/src/main/res/drawable-xxxhdpi/round_subtitles_white_36.png create mode 100644 app/src/main/res/drawable-xxxhdpi/round_subtitles_white_48.png create mode 100644 app/src/main/res/drawable/round_subtitles_20.xml create mode 100644 app/src/main/res/drawable/round_subtitles_24.xml diff --git a/app/build.gradle b/app/build.gradle index 56c5a2d..dba079f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,8 +22,8 @@ android { applicationId "com.tommasoberlose.anotherwidget" minSdkVersion 23 targetSdkVersion 30 - versionCode 135 - versionName "2.3.1" + versionCode 136 + versionName "2.3.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField("String", "GOOGLE_API_KEY", apikeyProperties['GOOGLE_API_KEY']) diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetColorPicker.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetColorPicker.kt index 740c1cb..26570f3 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetColorPicker.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetColorPicker.kt @@ -3,40 +3,30 @@ package com.tommasoberlose.anotherwidget.components import android.content.Context import android.content.res.ColorStateList import android.graphics.Color -import android.text.Editable -import android.text.TextWatcher -import android.util.Log import android.view.LayoutInflater import android.view.View -import android.widget.GridLayout -import android.widget.ImageView -import android.widget.SeekBar -import androidx.annotation.ColorInt +import android.widget.FrameLayout import androidx.appcompat.widget.AppCompatImageView import androidx.core.content.ContextCompat import androidx.core.view.isVisible -import androidx.core.widget.addTextChangedListener import androidx.recyclerview.widget.GridLayoutManager -import androidx.recyclerview.widget.RecyclerView import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.card.MaterialCardView import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.databinding.BottomSheetMenuHorBinding import com.tommasoberlose.anotherwidget.databinding.BottomSheetMenuListBinding -import com.tommasoberlose.anotherwidget.helpers.ColorHelper +import com.tommasoberlose.anotherwidget.helpers.ColorHelper.copyToClipboard +import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isClipboardColor import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isColorDark -import com.tommasoberlose.anotherwidget.utils.expand +import com.tommasoberlose.anotherwidget.helpers.ColorHelper.pasteFromClipboard +import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toIntValue import com.tommasoberlose.anotherwidget.utils.isDarkTheme -import com.tommasoberlose.anotherwidget.utils.reveal -import com.tommasoberlose.anotherwidget.utils.toPixel import com.warkiz.widget.IndicatorSeekBar import com.warkiz.widget.OnSeekChangeListener import com.warkiz.widget.SeekParams import kotlinx.coroutines.* import net.idik.lib.slimadapter.SlimAdapter -import java.lang.Exception -import java.util.prefs.Preferences class BottomSheetColorPicker( context: Context, @@ -46,20 +36,45 @@ class BottomSheetColorPicker( private val onColorSelected: ((selectedValue: Int) -> Unit)? = null, private val showAlphaSelector: Boolean = false, private val alpha: Int = 0, - private val onAlphaChangeListener: ((alpha: Int) -> Unit)? = null + private val onAlphaChangeListener: ((alpha: Int) -> Unit)? = null, + private val hideCopyPaste: Boolean = false, ) : BottomSheetDialog(context, R.style.BottomSheetDialogTheme) { private var loadingJobs: ArrayList = ArrayList() private lateinit var adapter: SlimAdapter + private var alphaDebouncing: Job? = null private var binding: BottomSheetMenuHorBinding = BottomSheetMenuHorBinding.inflate(LayoutInflater.from(context)) private var listBinding: BottomSheetMenuListBinding = BottomSheetMenuListBinding.inflate(LayoutInflater.from(context)) override fun show() { + window?.setDimAmount(0f) + // Header binding.header.isVisible = header != null binding.headerText.text = header ?: "" + if (hideCopyPaste) { + binding.actionContainer.isVisible = false + } else { + binding.actionContainer.isVisible = true + binding.actionCopy.setOnClickListener { + context.copyToClipboard(getSelected?.invoke(), alpha) + } + binding.actionPaste.setOnClickListener { + context.pasteFromClipboard { color, alpha -> + binding.alphaSelector.setProgress(alpha.toIntValue().toFloat()) + + adapter.notifyItemChanged(adapter.data.indexOf(getSelected?.invoke())) + onColorSelected?.invoke(Color.parseColor(color)) + val idx = colors.toList().indexOf(getSelected?.invoke()) + adapter.notifyItemChanged(idx) + (listBinding.root.layoutManager as GridLayoutManager).scrollToPositionWithOffset(idx,0) + } + } + binding.actionPaste.isVisible = context.isClipboardColor() + } + // Alpha binding.alphaSelectorContainer.isVisible = showAlphaSelector binding.alphaSelector.setProgress(alpha.toFloat()) @@ -67,8 +82,15 @@ class BottomSheetColorPicker( binding.alphaSelector.onSeekChangeListener = object : OnSeekChangeListener { override fun onSeeking(seekParams: SeekParams?) { seekParams?.let { - binding.textAlpha.text = "%s: %s%%".format(context.getString(R.string.alpha), it.progress) - onAlphaChangeListener?.invoke(it.progress) + binding.textAlpha.text = + "%s: %s%%".format(context.getString(R.string.alpha), it.progress) + alphaDebouncing?.cancel() + alphaDebouncing = GlobalScope.launch(Dispatchers.IO) { + delay(150) + withContext(Dispatchers.Main) { + onAlphaChangeListener?.invoke(it.progress) + } + } } } override fun onStartTrackingTouch(seekBar: IndicatorSeekBar?) { @@ -78,7 +100,6 @@ class BottomSheetColorPicker( } // List - adapter = SlimAdapter.create() loadingJobs.add(GlobalScope.launch(Dispatchers.IO) { @@ -120,10 +141,13 @@ class BottomSheetColorPicker( adapter.updateData(colors.toList()) withContext(Dispatchers.Main) { - binding.colorLoader.isVisible = false + binding.loader.isVisible = false binding.listContainer.addView(listBinding.root) this@BottomSheetColorPicker.behavior.state = BottomSheetBehavior.STATE_EXPANDED binding.listContainer.isVisible = true + + val idx = colors.toList().indexOf(getSelected?.invoke()) + (listBinding.root.layoutManager as GridLayoutManager).scrollToPositionWithOffset(idx,0) } }) diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetMenu.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetMenu.kt index 84619bf..7d69f30 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetMenu.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetMenu.kt @@ -6,6 +6,7 @@ import android.view.View import android.widget.TextView import androidx.core.content.ContextCompat import androidx.core.view.isVisible +import androidx.recyclerview.widget.GridLayoutManager import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.tommasoberlose.anotherwidget.R diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetPicker.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetPicker.kt new file mode 100644 index 0000000..8c1a358 --- /dev/null +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/components/BottomSheetPicker.kt @@ -0,0 +1,108 @@ +package com.tommasoberlose.anotherwidget.components + +import android.content.Context +import android.content.res.ColorStateList +import android.graphics.Color +import android.view.LayoutInflater +import android.view.View +import android.widget.TextView +import androidx.appcompat.widget.AppCompatImageView +import androidx.core.content.ContextCompat +import androidx.core.view.isVisible +import androidx.recyclerview.widget.LinearLayoutManager +import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetDialog +import com.google.android.material.card.MaterialCardView +import com.tommasoberlose.anotherwidget.R +import com.tommasoberlose.anotherwidget.databinding.BottomSheetMenuHorBinding +import com.tommasoberlose.anotherwidget.databinding.BottomSheetMenuListBinding +import com.tommasoberlose.anotherwidget.helpers.ColorHelper.copyToClipboard +import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isClipboardColor +import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isColorDark +import com.tommasoberlose.anotherwidget.helpers.ColorHelper.pasteFromClipboard +import com.tommasoberlose.anotherwidget.helpers.ColorHelper.toIntValue +import com.tommasoberlose.anotherwidget.utils.isDarkTheme +import com.warkiz.widget.IndicatorSeekBar +import com.warkiz.widget.OnSeekChangeListener +import com.warkiz.widget.SeekParams +import kotlinx.coroutines.* +import net.idik.lib.slimadapter.SlimAdapter + +class BottomSheetPicker( + context: Context, + private val items: List> = arrayListOf(), + private val getSelected: (() -> T)? = null, + private val header: String? = null, + private val onItemSelected: ((selectedValue: T?) -> Unit)? = null, +) : BottomSheetDialog(context, R.style.BottomSheetDialogTheme) { + + private var loadingJobs: ArrayList = ArrayList() + private lateinit var adapter: SlimAdapter + + private var binding: BottomSheetMenuHorBinding = BottomSheetMenuHorBinding.inflate( + LayoutInflater.from(context)) + private var listBinding: BottomSheetMenuListBinding = BottomSheetMenuListBinding.inflate( + LayoutInflater.from(context)) + + override fun show() { + window?.setDimAmount(0f) + + // Header + binding.header.isVisible = header != null + binding.headerText.text = header ?: "" + + // Alpha + binding.alphaSelectorContainer.isVisible = false + binding.actionContainer.isVisible = false + + // List + adapter = SlimAdapter.create() + + loadingJobs.add(GlobalScope.launch(Dispatchers.IO) { + listBinding.root.setHasFixedSize(true) + val mLayoutManager = LinearLayoutManager(context) + listBinding.root.layoutManager = mLayoutManager + + adapter + .register(R.layout.bottom_sheet_menu_item) { position, injector -> + val item = items[position] + val isSelected = item.value == getSelected?.invoke() + injector + .text(R.id.label, item.title) + .textColor(R.id.label, ContextCompat.getColor(context, if (isSelected) R.color.colorAccent else R.color.colorSecondaryText)) + .selected(R.id.item, isSelected) + .clicked(R.id.item) { + val oldIdx = items.toList().indexOfFirst { it.value == getSelected?.invoke() } + onItemSelected?.invoke(item.value) + adapter.notifyItemChanged(position) + adapter.notifyItemChanged(oldIdx) + (listBinding.root.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(position,0) + } + } + .attachTo(listBinding.root) + + adapter.updateData((items.indices).toList()) + + withContext(Dispatchers.Main) { + binding.loader.isVisible = false + binding.listContainer.addView(listBinding.root) + this@BottomSheetPicker.behavior.state = BottomSheetBehavior.STATE_EXPANDED + binding.listContainer.isVisible = true + + val idx = items.toList().indexOfFirst { it.value == getSelected?.invoke() } + (listBinding.root.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(idx,0) + } + }) + + setContentView(binding.root) + super.show() + } + + override fun onStop() { + loadingJobs.forEach { it.cancel() } + super.onStop() + } + + class MenuItem(val title: String, val value: T? = null) + +} \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/global/Preferences.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/global/Preferences.kt index 05cc5bd..3c2c304 100755 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/global/Preferences.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/global/Preferences.kt @@ -110,6 +110,7 @@ object Preferences : KotprefModel() { var customFontName by stringPref(default = "") var customFontVariant by stringPref(default = "regular") var showNextEvent by booleanPref(key = "PREF_SHOW_NEXT_EVENT", default = true) + var showNextEventOnMultipleLines by booleanPref(default = false) var showDividers by booleanPref(default = true) diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/ColorHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/ColorHelper.kt index 36af820..a53af77 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/ColorHelper.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/ColorHelper.kt @@ -1,10 +1,20 @@ package com.tommasoberlose.anotherwidget.helpers import android.annotation.SuppressLint +import android.content.ClipData +import android.content.ClipboardManager +import android.content.Context +import android.content.Context.CLIPBOARD_SERVICE import android.graphics.Color +import android.util.Log +import androidx.core.content.ContextCompat +import com.tommasoberlose.anotherwidget.R import com.tommasoberlose.anotherwidget.global.Preferences +import com.tommasoberlose.anotherwidget.utils.isDarkTheme +import com.tommasoberlose.anotherwidget.utils.toast import kotlin.math.roundToInt + object ColorHelper { fun getFontColor(isDark: Boolean): Int { return try { @@ -144,4 +154,40 @@ object ColorHelper { false } } + + @SuppressLint("DefaultLocale") + fun Context.copyToClipboard(color: Int?, alpha: Int) { + if (color == null) return toast(getString(R.string.error_copy_color)) + with(getSystemService(CLIPBOARD_SERVICE) as ClipboardManager) { + try { + val colorString = Integer.toHexString(color) + val clip = "#%s%s".format( + alpha.toHexValue(), + if (colorString.length > 6) colorString.substring(2) else colorString + ).toUpperCase() + setPrimaryClip(ClipData.newPlainText(clip, clip)) + toast(getString(R.string.color_copied)) + } catch (ex: Exception) { + ex.printStackTrace() + toast(getString(R.string.error_copy_color)) + } + } + } + + fun Context.isClipboardColor(): Boolean { + with(getSystemService(CLIPBOARD_SERVICE) as ClipboardManager) { + return primaryClip?.getItemAt(0)?.text?.toString()?.isColor() ?: false + } + } + + fun Context.pasteFromClipboard(pasteColor: (color: String, alpha: String) -> Unit) { + with(getSystemService(CLIPBOARD_SERVICE) as ClipboardManager) { + primaryClip?.let { + val item = it.getItemAt(0).text.toString().replace("#", "") + val color = if (item.length > 6) item.substring(2) else item + val alpha = if (item.length > 6) item.substring(0, 2) else "00" + pasteColor("#$color", alpha) + } + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/MediaPlayerHelper.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/MediaPlayerHelper.kt index 5d20eac..ea6b54f 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/MediaPlayerHelper.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/helpers/MediaPlayerHelper.kt @@ -12,6 +12,7 @@ import com.chibatching.kotpref.bulk import com.tommasoberlose.anotherwidget.global.Preferences import com.tommasoberlose.anotherwidget.receivers.NotificationListener import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget +import com.tommasoberlose.anotherwidget.utils.ignoreExceptions import java.lang.Exception object MediaPlayerHelper { @@ -69,15 +70,24 @@ object MediaPlayerHelper { isSomeonePlaying = true if (metadata != null) { Preferences.bulk { - mediaPlayerTitle = - metadata.getText(MediaMetadata.METADATA_KEY_TITLE)?.toString() - ?: "" - mediaPlayerArtist = - metadata.getText(MediaMetadata.METADATA_KEY_ARTIST)?.toString() - ?: "" - mediaPlayerAlbum = - metadata.getText(MediaMetadata.METADATA_KEY_ALBUM)?.toString() - ?: "" + ignoreExceptions { + mediaPlayerTitle = + metadata.getText(MediaMetadata.METADATA_KEY_TITLE) + ?.toString() + ?: "" + } + ignoreExceptions { + mediaPlayerArtist = + metadata.getText(MediaMetadata.METADATA_KEY_ARTIST) + ?.toString() + ?: "" + } + ignoreExceptions { + mediaPlayerAlbum = + metadata.getText(MediaMetadata.METADATA_KEY_ALBUM) + ?.toString() + ?: "" + } } } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/tabs/CustomLocationActivity.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/tabs/CustomLocationActivity.kt index 9f46e34..3e510ff 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/tabs/CustomLocationActivity.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/activities/tabs/CustomLocationActivity.kt @@ -53,12 +53,12 @@ class CustomLocationActivity : AppCompatActivity() { } } .register
(R.layout.custom_location_item) { item, injector -> - injector.text(R.id.text, item.getAddressLine(0)) + injector.text(R.id.text, item.getAddressLine(0) ?: "") injector.clicked(R.id.item) { Preferences.bulk { customLocationLat = item.latitude.toString() customLocationLon = item.longitude.toString() - customLocationAdd = item.getAddressLine(0) + customLocationAdd = item.getAddressLine(0) ?: "" setResult(Activity.RESULT_OK) finish() } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/tabs/CalendarFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/tabs/CalendarFragment.kt index 1b0ac73..d6d3018 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/tabs/CalendarFragment.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/tabs/CalendarFragment.kt @@ -63,6 +63,7 @@ class CalendarFragment : Fragment() { binding.showAllDayToggle.setCheckedImmediatelyNoEvent(Preferences.calendarAllDay) binding.showOnlyBusyEventsToggle.setCheckedImmediatelyNoEvent(Preferences.showOnlyBusyEvents) binding.showDiffTimeToggle.setCheckedImmediatelyNoEvent(Preferences.showDiffTime) + binding.showNextEventOnMultipleLinesToggle.setCheckedImmediatelyNoEvent(Preferences.showNextEventOnMultipleLines) setupListener() @@ -90,6 +91,12 @@ class CalendarFragment : Fragment() { } } + viewModel.showNextEventOnMultipleLines.observe(viewLifecycleOwner) { + maintainScrollPosition { + binding.showNextEventOnMultipleLinesLabel.text = if (it) getString(R.string.settings_enabled) else getString(R.string.settings_disabled) + } + } + viewModel.showDiffTime.observe(viewLifecycleOwner) { maintainScrollPosition { binding.showDiffTimeLabel.text = if (it) getString(R.string.settings_visible) else getString(R.string.settings_not_visible) @@ -231,6 +238,14 @@ class CalendarFragment : Fragment() { Preferences.showDiffTime = isChecked } + binding.actionShowNextEventOnMultipleLines.setOnClickListener { + binding.showNextEventOnMultipleLinesToggle.isChecked = !binding.showNextEventOnMultipleLinesToggle.isChecked + } + + binding.showNextEventOnMultipleLinesToggle.setOnCheckedChangeListener { _, isChecked -> + Preferences.showNextEventOnMultipleLines = isChecked + } + binding.actionWidgetUpdateFrequency.setOnClickListener { if (Preferences.showEvents && Preferences.showDiffTime) { BottomSheetMenu(requireContext(), header = getString(R.string.settings_widget_update_frequency_title), message = getString(R.string.settings_widget_update_frequency_subtitle)).setSelectedValue(Preferences.widgetUpdateFrequency) diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/tabs/TypographyFragment.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/tabs/TypographyFragment.kt index a4e23ac..a681b1c 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/tabs/TypographyFragment.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/fragments/tabs/TypographyFragment.kt @@ -15,6 +15,7 @@ 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.components.BottomSheetPicker import com.tommasoberlose.anotherwidget.databinding.FragmentTabTypographyBinding import com.tommasoberlose.anotherwidget.global.Constants import com.tommasoberlose.anotherwidget.global.Preferences @@ -167,20 +168,21 @@ class TypographyFragment : Fragment() { private fun setupListener() { binding.actionMainTextSize.setOnClickListener { - val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.title_main_text_size)).setSelectedValue( - Preferences.textMainSize) - (40 downTo 10).filter { it % 2 == 0 }.forEach { - dialog.addItem("${it}sp", it.toFloat()) - } - dialog.addOnSelectItemListener { value -> - Preferences.textMainSize = value - }.show() + BottomSheetPicker( + requireContext(), + items = (40 downTo 10).map { BottomSheetPicker.MenuItem("${it}sp", it.toFloat()) }, + getSelected = { Preferences.textMainSize }, + header = getString(R.string.title_main_text_size), + onItemSelected = {value -> + if (value != null) Preferences.textMainSize = value + } + ).show() } binding.actionSecondTextSize.setOnClickListener { val dialog = BottomSheetMenu(requireContext(), header = getString(R.string.title_second_text_size)).setSelectedValue( Preferences.textSecondSize) - (40 downTo 10).filter { it % 2 == 0 }.forEach { + (40 downTo 10).forEach { dialog.addItem("${it}sp", it.toFloat()) } dialog.addOnSelectItemListener { value -> @@ -209,7 +211,7 @@ class TypographyFragment : Fragment() { } else { Preferences.textGlobalAlpha = alpha.toHexValue() } - } + }, ).show() } @@ -236,7 +238,7 @@ class TypographyFragment : Fragment() { } else { Preferences.textSecondaryAlpha = alpha.toHexValue() } - } + }, ).show() } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt index 96faf54..0930d2e 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/viewmodels/MainViewModel.kt @@ -57,6 +57,7 @@ class MainViewModel(context: Application) : AndroidViewModel(context) { val showUntil = Preferences.asLiveData(Preferences::showUntil) val showDiffTime = Preferences.asLiveData(Preferences::showDiffTime) val showNextEvent = Preferences.asLiveData(Preferences::showNextEvent) + val showNextEventOnMultipleLines = Preferences.asLiveData(Preferences::showNextEventOnMultipleLines) val openEventDetails = Preferences.asLiveData(Preferences::openEventDetails) val calendarAppName = Preferences.asLiveData(Preferences::calendarAppName) val widgetUpdateFrequency = Preferences.asLiveData(Preferences::widgetUpdateFrequency) @@ -144,6 +145,7 @@ class MainViewModel(context: Application) : AndroidViewModel(context) { addSource(Preferences.asLiveData(Preferences::calendarAllDay)) { value = true } addSource(Preferences.asLiveData(Preferences::showDiffTime)) { value = true } addSource(Preferences.asLiveData(Preferences::showNextEvent)) { value = true } + addSource(Preferences.asLiveData(Preferences::showNextEventOnMultipleLines)) { value = true } addSource(Preferences.asLiveData(Preferences::showDeclinedEvents)) { value = true } addSource(Preferences.asLiveData(Preferences::showInvitedEvents)) { value = true } addSource(Preferences.asLiveData(Preferences::showAcceptedEvents)) { value = true } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/AlignedWidget.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/AlignedWidget.kt index 586fcb8..43b3f02 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/AlignedWidget.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/AlignedWidget.kt @@ -107,12 +107,12 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) { views.setImageViewBitmap( R.id.weather_rect, - BitmapHelper.getBitmapFromView(bindingView.weatherDateLine, draw = false) + BitmapHelper.getBitmapFromView(bindingView.weatherDateLine, draw = false, width = bindingView.weatherDateLine.width, height = bindingView.weatherDateLine.height) ) views.setImageViewBitmap( R.id.weather_sub_line_rect, - BitmapHelper.getBitmapFromView(bindingView.weatherSubLine, draw = false) + BitmapHelper.getBitmapFromView(bindingView.weatherSubLine, draw = false, width = bindingView.weatherSubLine.width, height = bindingView.weatherSubLine.height) ) } else { views.setViewVisibility(R.id.weather_rect, View.GONE) @@ -123,7 +123,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) { // Calendar views.setImageViewBitmap( R.id.date_rect, - BitmapHelper.getBitmapFromView(bindingView.date, draw = false) + BitmapHelper.getBitmapFromView(bindingView.date, draw = false, width = bindingView.date.width, height = bindingView.date.height) ) val calPIntent = PendingIntent.getActivity( @@ -157,7 +157,7 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) { // Action next event views.setImageViewBitmap( R.id.action_next_rect, - BitmapHelper.getBitmapFromView(bindingView.actionNext, draw = false) + BitmapHelper.getBitmapFromView(bindingView.actionNext, draw = false, width = bindingView.actionNext.width, height = bindingView.actionNext.height) ) views.setViewVisibility(R.id.action_next_rect, View.VISIBLE) views.setOnClickPendingIntent( @@ -186,6 +186,10 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) { PendingIntent.FLAG_UPDATE_CURRENT ) views.setOnClickPendingIntent(R.id.next_event_rect, eventIntent) + views.setImageViewBitmap( + R.id.next_event_rect, + BitmapHelper.getBitmapFromView(bindingView.nextEvent, draw = false, width = bindingView.nextEvent.width, height = bindingView.nextEvent.height) + ) views.setViewVisibility(R.id.next_event_rect, View.VISIBLE) // Event time difference @@ -194,12 +198,18 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) { R.id.next_event_difference_time_rect, BitmapHelper.getBitmapFromView( bindingView.nextEventDifferenceTime, - draw = false + draw = false, + width = bindingView.nextEventDifferenceTime.width, + height = bindingView.nextEventDifferenceTime.height ) ) views.setOnClickPendingIntent(R.id.next_event_difference_time_rect, eventIntent) - views.setViewVisibility(R.id.next_event_difference_time_rect, View.VISIBLE) + if (!Preferences.showNextEventOnMultipleLines) { + views.setViewVisibility(R.id.next_event_difference_time_rect, View.VISIBLE) + } else { + views.setViewVisibility(R.id.next_event_difference_time_rect, View.GONE) + } } else { views.setViewVisibility(R.id.next_event_difference_time_rect, View.GONE) } @@ -227,12 +237,6 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) { views.setOnClickPendingIntent(R.id.sub_line_rect, pIntentDetail) } - views.setImageViewBitmap( - R.id.next_event_rect, - BitmapHelper.getBitmapFromView(bindingView.nextEvent, draw = false) - ) - views.setViewVisibility(R.id.calendar_layout_rect, View.VISIBLE) - views.setViewVisibility(R.id.calendar_layout_rect, View.VISIBLE) views.setViewVisibility(R.id.sub_line_rect, View.VISIBLE) views.setViewVisibility(R.id.weather_sub_line_rect, View.VISIBLE) @@ -374,12 +378,23 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) { views.setViewVisibility(R.id.sub_line_top_margin_medium_sans, View.GONE) views.setViewVisibility(R.id.sub_line_top_margin_large_sans, View.GONE) } + } else { + views.setViewVisibility(R.id.first_line_rect, View.VISIBLE) + views.setViewVisibility(R.id.weather_rect, View.VISIBLE) + + views.setViewVisibility(R.id.calendar_layout_rect, View.GONE) + views.setViewVisibility(R.id.sub_line_rect, View.GONE) + views.setViewVisibility(R.id.weather_sub_line_rect, View.GONE) + // Spacing + views.setViewVisibility(R.id.sub_line_top_margin_small_sans, View.GONE) + views.setViewVisibility(R.id.sub_line_top_margin_medium_sans, View.GONE) + views.setViewVisibility(R.id.sub_line_top_margin_large_sans, View.GONE) } // Second row views.setImageViewBitmap( R.id.sub_line_rect, - BitmapHelper.getBitmapFromView(bindingView.subLine, draw = false) + BitmapHelper.getBitmapFromView(bindingView.subLine, draw = false, width = bindingView.subLine.width, height = bindingView.subLine.height) ) } catch (ex: Exception) { ex.printStackTrace() @@ -455,8 +470,16 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) { bindingView.nextEvent.text = nextEvent.title + if (Preferences.showNextEventOnMultipleLines) { + bindingView.nextEvent.apply { + isSingleLine = false + maxLines = 3 + gravity = if (rightAligned) Gravity.END else Gravity.START + } + } + if (Preferences.showDiffTime && now.timeInMillis < nextEvent.startDate) { - bindingView.nextEventDifferenceTime.text = if (!nextEvent.allDay) { + val diffTime = if (!nextEvent.allDay) { SettingsStringHelper.getDifferenceText( context, now.timeInMillis, @@ -470,7 +493,14 @@ class AlignedWidget(val context: Context, val rightAligned: Boolean = false) { nextEvent.startDate ).toLowerCase(Locale.getDefault()) } - bindingView.nextEventDifferenceTime.isVisible = true + bindingView.nextEventDifferenceTime.text = diffTime + + if (!Preferences.showNextEventOnMultipleLines) { + bindingView.nextEventDifferenceTime.isVisible = true + } else { + bindingView.nextEvent.text = context.getString(R.string.events_glance_provider_format).format(nextEvent.title, diffTime) + bindingView.nextEventDifferenceTime.isVisible = false + } } else { bindingView.nextEventDifferenceTime.isVisible = false } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/StandardWidget.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/StandardWidget.kt index 918d88c..1c9e013 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/StandardWidget.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/ui/widgets/StandardWidget.kt @@ -10,6 +10,7 @@ import android.graphics.Typeface import android.text.format.DateUtils import android.util.Log import android.util.TypedValue +import android.view.Gravity import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -109,12 +110,12 @@ class StandardWidget(val context: Context) { views.setImageViewBitmap( R.id.weather_rect, - BitmapHelper.getBitmapFromView(bindingView.weatherDateLine, draw = false) + BitmapHelper.getBitmapFromView(bindingView.weatherDateLine, draw = false, width = bindingView.weatherDateLine.width, height = bindingView.weatherDateLine.height) ) views.setImageViewBitmap( R.id.weather_sub_line_rect, - BitmapHelper.getBitmapFromView(bindingView.weatherSubLine, draw = false) + BitmapHelper.getBitmapFromView(bindingView.weatherSubLine, draw = false, width = bindingView.weatherSubLine.width, height = bindingView.weatherSubLine.height) ) } else { views.setViewVisibility(R.id.weather_rect, View.GONE) @@ -125,7 +126,7 @@ class StandardWidget(val context: Context) { // Calendar views.setImageViewBitmap( R.id.date_rect, - BitmapHelper.getBitmapFromView(bindingView.date, draw = false) + BitmapHelper.getBitmapFromView(bindingView.date, draw = false, width = bindingView.date.width, height = bindingView.date.height) ) val calPIntent = PendingIntent.getActivity( @@ -140,7 +141,7 @@ class StandardWidget(val context: Context) { // Second row views.setImageViewBitmap( R.id.sub_line_rect, - BitmapHelper.getBitmapFromView(bindingView.subLine, draw = false) + BitmapHelper.getBitmapFromView(bindingView.subLine, draw = false, width = bindingView.subLine.width, height = bindingView.subLine.height) ) val nextAlarm = AlarmHelper.getNextAlarm(context) @@ -165,7 +166,7 @@ class StandardWidget(val context: Context) { // Action next event views.setImageViewBitmap( R.id.action_next_rect, - BitmapHelper.getBitmapFromView(bindingView.actionNext, draw = false) + BitmapHelper.getBitmapFromView(bindingView.actionNext, draw = false, width = bindingView.actionNext.width, height = bindingView.actionNext.height) ) views.setViewVisibility(R.id.action_next_rect, View.VISIBLE) views.setOnClickPendingIntent( @@ -184,7 +185,7 @@ class StandardWidget(val context: Context) { // Action previous event views.setImageViewBitmap( R.id.action_previous_rect, - BitmapHelper.getBitmapFromView(bindingView.actionPrevious, draw = false) + BitmapHelper.getBitmapFromView(bindingView.actionPrevious, draw = false, width = bindingView.actionPrevious.width, height = bindingView.actionPrevious.height) ) views.setViewVisibility(R.id.action_previous_rect, View.VISIBLE) views.setOnClickPendingIntent( @@ -223,11 +224,18 @@ class StandardWidget(val context: Context) { R.id.next_event_difference_time_rect, BitmapHelper.getBitmapFromView( bindingView.nextEventDifferenceTime, - draw = false + draw = false, + width = bindingView.nextEventDifferenceTime.width, + height = bindingView.nextEventDifferenceTime.height ) ) - views.setViewVisibility(R.id.next_event_difference_time_rect, View.VISIBLE) + views.setOnClickPendingIntent(R.id.next_event_difference_time_rect, eventIntent) + if (!Preferences.showNextEventOnMultipleLines) { + views.setViewVisibility(R.id.next_event_difference_time_rect, View.VISIBLE) + } else { + views.setViewVisibility(R.id.next_event_difference_time_rect, View.GONE) + } } else { views.setViewVisibility(R.id.next_event_difference_time_rect, View.GONE) } @@ -257,7 +265,7 @@ class StandardWidget(val context: Context) { views.setImageViewBitmap( R.id.next_event_rect, - BitmapHelper.getBitmapFromView(bindingView.nextEvent, draw = false) + BitmapHelper.getBitmapFromView(bindingView.nextEvent, draw = false, width = bindingView.nextEvent.width, height = bindingView.nextEvent.height) ) views.setViewVisibility(R.id.calendar_layout_rect, View.VISIBLE) views.setViewVisibility(R.id.sub_line_rect, View.VISIBLE) @@ -388,7 +396,7 @@ class StandardWidget(val context: Context) { if (showSomething) { views.setImageViewBitmap( R.id.sub_line_rect, - BitmapHelper.getBitmapFromView(bindingView.subLine, draw = false) + BitmapHelper.getBitmapFromView(bindingView.subLine, draw = false, width = bindingView.subLine.width, height = bindingView.subLine.height) ) views.setViewVisibility(R.id.first_line_rect, View.VISIBLE) @@ -402,6 +410,17 @@ class StandardWidget(val context: Context) { views.setViewVisibility(R.id.sub_line_top_margin_medium_sans, View.GONE) views.setViewVisibility(R.id.sub_line_top_margin_large_sans, View.GONE) } + } else { + views.setViewVisibility(R.id.first_line_rect, View.VISIBLE) + views.setViewVisibility(R.id.weather_rect, View.VISIBLE) + + views.setViewVisibility(R.id.calendar_layout_rect, View.GONE) + views.setViewVisibility(R.id.sub_line_rect, View.GONE) + views.setViewVisibility(R.id.weather_sub_line_rect, View.GONE) + // Spacing + views.setViewVisibility(R.id.sub_line_top_margin_small_sans, View.GONE) + views.setViewVisibility(R.id.sub_line_top_margin_medium_sans, View.GONE) + views.setViewVisibility(R.id.sub_line_top_margin_large_sans, View.GONE) } } catch (ex: Exception) { ex.printStackTrace() @@ -480,8 +499,16 @@ class StandardWidget(val context: Context) { bindingView.nextEvent.text = nextEvent.title + if (Preferences.showNextEventOnMultipleLines) { + bindingView.nextEvent.apply { + isSingleLine = false + maxLines = 3 + gravity = Gravity.CENTER + } + } + if (Preferences.showDiffTime && now.timeInMillis < nextEvent.startDate) { - bindingView.nextEventDifferenceTime.text = if (!nextEvent.allDay) { + val diffTime = if (!nextEvent.allDay) { SettingsStringHelper.getDifferenceText( context, now.timeInMillis, @@ -495,7 +522,14 @@ class StandardWidget(val context: Context) { nextEvent.startDate ).toLowerCase(Locale.getDefault()) } - bindingView.nextEventDifferenceTime.isVisible = true + bindingView.nextEventDifferenceTime.text = diffTime + + if (!Preferences.showNextEventOnMultipleLines) { + bindingView.nextEventDifferenceTime.isVisible = true + } else { + bindingView.nextEvent.text = context.getString(R.string.events_glance_provider_format).format(nextEvent.title, diffTime) + bindingView.nextEventDifferenceTime.isVisible = false + } } else { bindingView.nextEventDifferenceTime.isVisible = false } diff --git a/app/src/main/java/com/tommasoberlose/anotherwidget/utils/Extensions.kt b/app/src/main/java/com/tommasoberlose/anotherwidget/utils/Extensions.kt index 8d7fc41..4023d1b 100644 --- a/app/src/main/java/com/tommasoberlose/anotherwidget/utils/Extensions.kt +++ b/app/src/main/java/com/tommasoberlose/anotherwidget/utils/Extensions.kt @@ -265,3 +265,11 @@ fun View.setOnSingleClickListener(l: View.OnClickListener) { fun View.setOnSingleClickListener(l: (View) -> Unit) { setOnClickListener(OnSingleClickListener(l)) } + +fun ignoreExceptions(function: () -> Unit) = run { + try { + function.invoke() + } catch (ex: Exception) { + ex.printStackTrace() + } +} diff --git a/app/src/main/res/drawable-hdpi/round_subtitles_white_18.png b/app/src/main/res/drawable-hdpi/round_subtitles_white_18.png new file mode 100644 index 0000000000000000000000000000000000000000..3cb37374fac64cea108f4a9a977246e053df2304 GIT binary patch literal 224 zcmV<603ZK}P)iBeJ`JYB03*L)rXbZT?u(Qa`4)+yA})I{;xjSlgEWPGBA~^aiRK;2_!epBuw3 zO#eH;O1;25Zg6m+X`7EV5aPkw6rjBMsM;Vo;1p0hDm?iA2UzA6n0E?22auQF$jsft a6aWBEP1q?`N-6pP00009Q75R21qr)=bHP!MpPdvF8q zYJ(>3fV+IhmL>>%PI@)IrPyJ1_;Ofg6fzZu*W zpQ<@+>8bcrdaCRW3qsQ`zTD(_lEGjO&!&q{I}|ts8#?Wt{_VEc)%l(59q`IV`^^G= uuep=fr-X37nmNVlul4Z<7bRE4q%#(nq{}Vb^tc1)Dh5wiKbLh*2~7ZO!c8Oq literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/round_subtitles_white_24.png b/app/src/main/res/drawable-hdpi/round_subtitles_white_24.png new file mode 100644 index 0000000000000000000000000000000000000000..6306abf76da231b8ea7c051160de7507ca4a829b GIT binary patch literal 170 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K8p{I*uh{y5d1PNAWu|Mg5?|=J$ zvp(pc@dCZDkmg(eCv)ElcZWQ^2MiYQW#;WcZn zcvurxBB9Kz{K!n`SHY^ TGbH8$Eobm_^>bP0l+XkKE0{jg literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/round_subtitles_white_36.png b/app/src/main/res/drawable-hdpi/round_subtitles_white_36.png new file mode 100644 index 0000000000000000000000000000000000000000..2c80094285eaf1ae290a96c0615846e20816a7a2 GIT binary patch literal 290 zcmV+-0p0$IP)cCm_9h#JM-~J2$<#`5C`jr+imuY zF7U30lcWD9MNOQy5*iyL3Q~%i1dfa-NGWO()-$3YrKri2m>E%E>F2j&6>b-xs3asU7T07*qoM6N<$f~ui&tN;K2 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/round_subtitles_white_48.png b/app/src/main/res/drawable-hdpi/round_subtitles_white_48.png new file mode 100644 index 0000000000000000000000000000000000000000..640012417ab72bee6def9d63d5ded7fae59331e2 GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhawE_u2*hGg7(JJXi0*?`AwrUmmU z(ZqJ)LoDqlk9{d!cdH@z%8>=%!*sq(k&oUun~j0tLE?(53nBymt7TnV@Xbd(BiPfd z_3_on&{Rn$f-as9MJuQhCO^sg8Hz20zL p)Q$alzaeLJCtpF*;(`gx3_q7fues|kvJq%LgQu&X%Q~loCIG~`HJbnc literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/round_subtitles_white_24.png b/app/src/main/res/drawable-mdpi/round_subtitles_white_24.png new file mode 100644 index 0000000000000000000000000000000000000000..744195333c5232c39ed3e95ae9f0a2e8e03405ec GIT binary patch literal 123 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*1Cr=m05R22v2@+}#_8|k0wldT1B8K8p{I*uh{y5d1PNAWu|Mg5?|=J$ zvp(pc@dCZDkmg(eCv)ElcZWQ^2MiYQW#;WcZn zcvurxBB9Kz{K!n`SHY^ TGbH8$Eobm_^>bP0l+XkKE0{jg literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/round_subtitles_white_48.png b/app/src/main/res/drawable-mdpi/round_subtitles_white_48.png new file mode 100644 index 0000000000000000000000000000000000000000..3ee6b150d8a6a072f8c14f1252f0c1209e14f12d GIT binary patch literal 191 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}b0DHcuDFkch)?ryb-xpdi5V)>-$y z)EbZYZySEHHkZ3xP@E`jb6|FNV&IYoz^2prq9YrzWr6~#?x0$P1>~Ved(2~zY7n% p={Uo#|M}v@svoBE_c?zWihsPG!udnYX)@4744$rjF6*2UngHp4NX`HN literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-night-hdpi/round_subtitles_24.png b/app/src/main/res/drawable-night-hdpi/round_subtitles_24.png new file mode 100644 index 0000000000000000000000000000000000000000..5909f42406ae665863d05d517afb6fc6b0b6a734 GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K8rKgKyNX4zUQ!jEJFyL_cJn`Zk z4ZaCCjY7E^UxzcV%vES=4S4_0Meb2!+k;zS9SR1Y7723{vRpKJV$`b;)?C4ox>xpz zf_8u-GlR*LXxCNWZ5sRTg}J(}sx!FAA2d71bP0l+XkKY=uH< literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-night-mdpi/round_subtitles_24.png b/app/src/main/res/drawable-night-mdpi/round_subtitles_24.png new file mode 100644 index 0000000000000000000000000000000000000000..7011f518609a95bd2cb3f29aeb5a24e11060fc89 GIT binary patch literal 124 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*1XHOT$kcwN$2@+}#_P_eS=szz@ z!o~W~7PdpD4n_$`Np&gTe~DWM4f5o#)D literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-night-xhdpi/round_subtitles_24.png b/app/src/main/res/drawable-night-xhdpi/round_subtitles_24.png new file mode 100644 index 0000000000000000000000000000000000000000..460aa35867f2e41a65f55feee21fb92fec8c317d GIT binary patch literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}b0DDV{ElAr-gYP7CB}P!MpjZk)b( zw#JXwi8cxI5*GD4Tv9zK+WhS8{3~`FIMZ%(D6$%C_|Vb(I3e-Y>%$*DRXaI1#^(Mt z-6mEM+PI!Iuv}w70~1#p3#X(xd(h{YMHO*kPmXK9Esoq6XYjX6;&T39c3JsgF4ugY z_{SPYs}?5Q5`8JAAI|;e%`1!De^y;B*S}KkRCk8ce9iTVFBUQR0o}*o>FVdQ&MBb@ E0B$x>C;$Ke literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-night-xxhdpi/round_subtitles_24.png b/app/src/main/res/drawable-night-xxhdpi/round_subtitles_24.png new file mode 100644 index 0000000000000000000000000000000000000000..fc54dc0a390e4bf238c08b7cfd5462f65045b25a GIT binary patch literal 288 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xZ3?!EyURMI7)B}7%T!Hj|BEULZFH4|Oo{}KH zU+)5DPnA!4(;ar!2Y0lDx7LFB6ArmV! z=sci189ZJ6T-G@yGywo|jdc_N literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-night-xxxhdpi/round_subtitles_24.png b/app/src/main/res/drawable-night-xxxhdpi/round_subtitles_24.png new file mode 100644 index 0000000000000000000000000000000000000000..0433c88f1cc0452d4ba60e0f830fdcc57cd7d31f GIT binary patch literal 352 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeE3?v1%WpM*3-2k5uS0MeLXt2;@^=zO9{*oZS zUelZ*O+72<{M2JoNYH&%o3B z)wb#!N-kr|G7@`eD$Q$}+5KT&Z{MsE-51I)ySgE{{Sk=6)?~>h`-}f1XoPIEUl{fIU$~{~R^d5t!tDnm{ Hr-UW|?d_nG literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/round_subtitles_white_18.png b/app/src/main/res/drawable-xhdpi/round_subtitles_white_18.png new file mode 100644 index 0000000000000000000000000000000000000000..6306abf76da231b8ea7c051160de7507ca4a829b GIT binary patch literal 170 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K8p{I*uh{y5d1PNAWu|Mg5?|=J$ zvp(pc@dCZDkmg(eCv)ElcZWQ^2MiYQW#;WcZn zcvurxBB9Kz{K!n`SHY^ TGbH8$Eobm_^>bP0l+XkKE0{jg literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/round_subtitles_white_20.png b/app/src/main/res/drawable-xhdpi/round_subtitles_white_20.png new file mode 100644 index 0000000000000000000000000000000000000000..1da5d4813b48ecf8a1a8f559948bc56afc9f4010 GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU0wmSG7d!(}b)GJcAs)xyPBr9fP~dU3HoVDP z;b-P1`(RN)@B0Ov%u)`sRxHea_2trsOuLDTYB(e+RBRLv9)5DDLC#69C-%?`ZtK8@ z?_0FfbdJB#vwK^|u`cd}%Y)*5J9XEIM=3>|-$y z)EbZYZySEHHkZ3xP@E`jb6|FNV&IYoz^2prq9YrzWr6~#?x0$P1>~Ved(2~zY7n% p={Uo#|M}v@svoBE_c?zWihsPG!udnYX)@4744$rjF6*2UngHp4NX`HN literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/round_subtitles_white_36.png b/app/src/main/res/drawable-xhdpi/round_subtitles_white_36.png new file mode 100644 index 0000000000000000000000000000000000000000..640012417ab72bee6def9d63d5ded7fae59331e2 GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhawE_u2*hGg7(JJXi0*?`AwrUmmU z(ZqJ)LoDqlk9{d!cdH@z%8>=%!*sq(k&oUun~j0tLE?(53nBymt7TnV@Xbd(BiPfd z_3_on&{+P)5yv+sztUCi3 z#a%c{o-CWNK;~5g*NcYDOQ%;K%4hZ5V^AD-Q|{#a_8U6PK-~-s70z3wdS`vjPwUMJ zxh*z-b#RE6OX;b8{r%xxU)V*jXocQNuC`ax7T}-5YU(vJEk3~`D&dCsjLBj%zOxFk zGqMOcFrX2Q^ErLEwCrDbvHErw>s*`t-+xU{zW9ugHP^(rgLAITRuwz8oxA1itAy3& z+AW`%uBMfyt~Tcm;rMai=^g*Z-`P{9OMpylc;BdR=X0(7(!w#q^`?rJgDQ|X@BJ1y1?(e{_mpC-7)`LnZLW_{*S8WYsufw-Z#(K&kpip agZl@j9)1^@vJ$lt5Z}|)&t;ucLK6Vv|Ag}Z literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/round_subtitles_white_18.png b/app/src/main/res/drawable-xxhdpi/round_subtitles_white_18.png new file mode 100644 index 0000000000000000000000000000000000000000..2c80094285eaf1ae290a96c0615846e20816a7a2 GIT binary patch literal 290 zcmV+-0p0$IP)cCm_9h#JM-~J2$<#`5C`jr+imuY zF7U30lcWD9MNOQy5*iyL3Q~%i1dfa-NGWO()-$3YrKri2m>E%E>F2j&6>b-xs3asU7T07*qoM6N<$f~ui&tN;K2 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/round_subtitles_white_20.png b/app/src/main/res/drawable-xxhdpi/round_subtitles_white_20.png new file mode 100644 index 0000000000000000000000000000000000000000..1849c4a5b1878392cf604d43d7959803c04f3cd2 GIT binary patch literal 288 zcmV+*0pI?KP)|1<=i-LFeL&1}asS?Q+klwo;xJA?%yS{f35a0000=%!*sq(k&oUun~j0tLE?(53nBymt7TnV@Xbd(BiPfd z_3_on&{s^?Znu)1wqcuJ1ph5F*=whQbG2S;1`(m6rukd|y!_*q(e-C%B+3@jm zcg|I*>Hah0fAs%MIQzyYd8W~&Sv4E7%9d^NkxUG=i?Fl~j#}2UVUqT@{of;Q#2?*o z-f&t7#QYh{WlR2M=jYGOyY0DVoBZkRn>W4v8+P0A`EBmo zWv^p4*6%!i=${r_Wnb&x>Z%*etcm>%F1A~Qzs(4J&|H|8+ULQ06eAs&9=VS|>r-r;o-^XP!FffLCx;TbZFuuKgv9HNMz~Q1} zDg&$NgirtLcdehTBU~nTYvW1V^SwI-7no$S#$R-3w{NR5pV;rJyWrHe zZ*uVWcCjxzPInewTD0urlm9cfYlv#IO`F*yq&D_QC5fE&cHVR3 z(=~zoja#G^iFUIob|^G)D1ivA9vDk$1qV_hjmy?_HHs6#lth}CT_S)F|^R6>#x-3TPPUrkv zdMU0x;E!te{*{mAfA5O#`55f}=h!K(ZS&l6&#g`WU37)*ebu%D?(#w_9!R+Uah&{P lvBg)}urB*^te^nu_`=NB@=%!*sq(k&oUun~j0tLE?(53nBymt7TnV@Xbd(BiPfd z_3_on&{w-zxoQMfYKz;^QAxIf1$v4oKfxamly0 z&UNu@tz5gS+Ft^A-SwZwk& z-5Y1>=9OLvi_(bcSCz+@OyY==cWvN1RK2nC7nO2?YfOgQu&X%Q~lo FCICobeUShF literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/round_subtitles_white_24.png b/app/src/main/res/drawable-xxxhdpi/round_subtitles_white_24.png new file mode 100644 index 0000000000000000000000000000000000000000..08f29a07115290cfa1b62817976e70cd4be21a35 GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD0wg^q?%&M7z$owO;uunK>+P)5yv+sztUCi3 z#a%c{o-CWNK;~5g*NcYDOQ%;K%4hZ5V^AD-Q|{#a_8U6PK-~-s70z3wdS`vjPwUMJ zxh*z-b#RE6OX;b8{r%xxU)V*jXocQNuC`ax7T}-5YU(vJEk3~`D&dCsjLBj%zOxFk zGqMOcFrX2Q^ErLEwCrDbvHErw>s*`t-+xU{zW9ugHP^(rgLAITRuwz8oxA1itAy3& z+AW`%uBMfyt~Tcm;rMai=^g*Z-`P{9OMpylc;BdR=X0(7(!w#q^`?rJgDQ|X@BJ1y1?(e{_mpC-7)`LnZLW_{*S8WYsufw-Z#(K&kpip agZl@j9)1^@vJ$lt5Z}|)&t;ucLK6Vv|Ag}Z literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/round_subtitles_white_36.png b/app/src/main/res/drawable-xxxhdpi/round_subtitles_white_36.png new file mode 100644 index 0000000000000000000000000000000000000000..dfe315def874c6b464486dcefdc85e1891112af6 GIT binary patch literal 518 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q8Ax83A=Cw=JOX?|T!Hj|YJlez6&rwNNt6Wn z1v5xzY`*pBzr>8+ULQ06eAs&9=VS|>r-r;o-^XP!FffLCx;TbZFuuKgv9HNMz~Q1} zDg&$NgirtLcdehTBU~nTYvW1V^SwI-7no$S#$R-3w{NR5pV;rJyWrHe zZ*uVWcCjxzPInewTD0urlm9cfYlv#IO`F*yq&D_QC5fE&cHVR3 z(=~zoja#G^iFUIob|^G)D1ivA9vDk$1qV_hjmy?_HHs6#lth}CT_S)F|^R6>#x-3TPPUrkv zdMU0x;E!te{*{mAfA5O#`55f}=h!K(ZS&l6&#g`WU37)*ebu%D?(#w_9!R+Uah&{P lvBg)}urB*^te^nu_`=NB@c4QjjM%PJil_8f94fv^YRD>%wk|*Jn8A;7*fIb z=KS`?BL)I22Nxb{hBmnDmKnaD zUFpfEs=L|l#OlM5n^)!TX1-+}dTO`xt<9^>tZt4i&^6iDZsWyCX15dub5I0q&eOkz)2OI(l4h;;9Of2{rACAwPxtf9JutCY2 zdy0GS$o&65`L6G3SC+sD&)gq4@*SV29kA{1i8~wfRTDeaCtXu#J*R!|;*N7?oaETo z`*YlRZNBFo_k+$QUo{)MUhGPk=lhh^OTmik*-e*)tWw9MpZqk5T9CXad7j^LR<>j8 z&tCFyuh>3;f8#Hyug+@vsxfE&Zk_Y3{|uAZh6Yxh1V-+N13>117JjaX`hPVI96y@4 zo-u2<2q&DYY2eE{%<+ub!bRD~Kz>1VtFN{EgV|eSZR8I;y#4Vo(<|L4&TIC${hiS1 z%_&~|UwirdvUd$Ez@T=x@c;T-j*^b=3NPbB?oQrNe|cN~r*EMTjl2Jp&;4)kHU8Sa q%Ma>r+jMOHU;5L&|Nr;DkoaL-U->-Z<15jZAg-sYpUXO@geCy-$ypu% literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/menu_background.xml b/app/src/main/res/drawable/menu_background.xml index aab2489..0b6083d 100644 --- a/app/src/main/res/drawable/menu_background.xml +++ b/app/src/main/res/drawable/menu_background.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/round_subtitles_20.xml b/app/src/main/res/drawable/round_subtitles_20.xml new file mode 100644 index 0000000..5a300cd --- /dev/null +++ b/app/src/main/res/drawable/round_subtitles_20.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/round_subtitles_24.xml b/app/src/main/res/drawable/round_subtitles_24.xml new file mode 100644 index 0000000..e785953 --- /dev/null +++ b/app/src/main/res/drawable/round_subtitles_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/bottom_sheet_menu_hor.xml b/app/src/main/res/layout/bottom_sheet_menu_hor.xml index 1c7e136..f152f16 100644 --- a/app/src/main/res/layout/bottom_sheet_menu_hor.xml +++ b/app/src/main/res/layout/bottom_sheet_menu_hor.xml @@ -41,6 +41,35 @@ android:id="@+id/header_text" android:text="@string/settings_font_color_title" android:textColor="@color/colorPrimaryText"/> + + + + + android:id="@+id/loader" /> \ No newline at end of file diff --git a/app/src/main/res/layout/bottom_sheet_menu_item.xml b/app/src/main/res/layout/bottom_sheet_menu_item.xml index 786ba3f..20b42f3 100644 --- a/app/src/main/res/layout/bottom_sheet_menu_item.xml +++ b/app/src/main/res/layout/bottom_sheet_menu_item.xml @@ -9,6 +9,7 @@ app:cardCornerRadius="8dp" android:clickable="true" android:focusable="true" + android:id="@+id/item" android:layout_height="wrap_content"> + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 77404ea..4752837 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -112,6 +112,7 @@ Events sync service Service used to synchronize the calendar events. Syncing calendar events… + Show title on multiple lines Weather @@ -368,4 +369,8 @@ Smart content Spacing None, the widget will be refreshed + Disabled + Enabled + Color copied into the clipboard. + The color cannot be copied.