update ui
1
.idea/codeStyles/Project.xml
generated
@ -17,7 +17,6 @@
|
||||
<package name="" alias="true" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="ALLOW_TRAILING_COMMA" value="true" />
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
|
@ -56,8 +56,6 @@ class BottomSheetColorPicker(
|
||||
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 ?: ""
|
||||
|
@ -111,8 +111,6 @@ object Preferences : KotprefModel() {
|
||||
|
||||
// Settings
|
||||
var showWallpaper by booleanPref(default = true)
|
||||
var showBigClockWarning by booleanPref(default = true)
|
||||
var showWeatherWarning by booleanPref(default = true)
|
||||
var showPreview by booleanPref(default = true)
|
||||
var showXiaomiWarning by booleanPref(default = true)
|
||||
|
||||
|
@ -2,14 +2,16 @@ package com.tommasoberlose.anotherwidget.helpers
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import android.util.Log
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
object ColorHelper {
|
||||
fun getFontColor(isDark: Boolean): Int {
|
||||
return try {
|
||||
Color.parseColor("#%s%s".format(if (!isDark) Preferences.textGlobalAlpha else Preferences.textGlobalAlphaDark, (if (!isDark) Preferences.textGlobalColor else Preferences.textGlobalColorDark).replace("#", "")))
|
||||
Color.parseColor("#%s%s".format(if (!isDark) Preferences.textGlobalAlpha else Preferences.textGlobalAlphaDark,
|
||||
(if (!isDark) Preferences.textGlobalColor else Preferences.textGlobalColorDark).replace(
|
||||
"#",
|
||||
"")))
|
||||
} catch (e: Exception) {
|
||||
Color.parseColor("#FFFFFFFF")
|
||||
}
|
||||
@ -33,7 +35,10 @@ object ColorHelper {
|
||||
|
||||
fun getSecondaryFontColor(isDark: Boolean): Int {
|
||||
return try {
|
||||
Color.parseColor("#%s%s".format((if (!isDark) Preferences.textSecondaryAlpha else Preferences.textSecondaryAlphaDark), (if (!isDark) Preferences.textSecondaryColor else Preferences.textSecondaryColorDark).replace("#", "")))
|
||||
Color.parseColor("#%s%s".format((if (!isDark) Preferences.textSecondaryAlpha else Preferences.textSecondaryAlphaDark),
|
||||
(if (!isDark) Preferences.textSecondaryColor else Preferences.textSecondaryColorDark).replace(
|
||||
"#",
|
||||
"")))
|
||||
} catch (e: Exception) {
|
||||
Color.parseColor("#FFFFFFFF")
|
||||
}
|
||||
@ -57,7 +62,10 @@ object ColorHelper {
|
||||
|
||||
fun getClockFontColor(isDark: Boolean): Int {
|
||||
return try {
|
||||
Color.parseColor("#%s%s".format((if (!isDark) Preferences.clockTextAlpha else Preferences.clockTextAlphaDark), (if (!isDark) Preferences.clockTextColor else Preferences.clockTextColorDark).replace("#", "")))
|
||||
Color.parseColor("#%s%s".format((if (!isDark) Preferences.clockTextAlpha else Preferences.clockTextAlphaDark),
|
||||
(if (!isDark) Preferences.clockTextColor else Preferences.clockTextColorDark).replace(
|
||||
"#",
|
||||
"")))
|
||||
} catch (e: Exception) {
|
||||
Color.parseColor("#FFFFFFFF")
|
||||
}
|
||||
@ -81,7 +89,10 @@ object ColorHelper {
|
||||
|
||||
fun getBackgroundColor(isDark: Boolean): Int {
|
||||
return try {
|
||||
Color.parseColor("#%s%s".format((if (!isDark) Preferences.backgroundCardAlpha else Preferences.backgroundCardAlphaDark), (if (!isDark) Preferences.backgroundCardColor else Preferences.backgroundCardColorDark).replace("#", "")))
|
||||
Color.parseColor("#%s%s".format((if (!isDark) Preferences.backgroundCardAlpha else Preferences.backgroundCardAlphaDark),
|
||||
(if (!isDark) Preferences.backgroundCardColor else Preferences.backgroundCardColorDark).replace(
|
||||
"#",
|
||||
"")))
|
||||
} catch (e: Exception) {
|
||||
Color.parseColor("#00000000")
|
||||
}
|
||||
@ -123,4 +134,14 @@ object ColorHelper {
|
||||
val hexValue = this.toInt(16).toDouble()
|
||||
return (hexValue * 100 / 255).roundToInt()
|
||||
}
|
||||
|
||||
fun String.isColor(): Boolean {
|
||||
return try {
|
||||
Color.parseColor(this)
|
||||
true
|
||||
} catch (iae: IllegalArgumentException) {
|
||||
iae.printStackTrace()
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ object ImageHelper {
|
||||
canvas.drawColor(Color.TRANSPARENT)
|
||||
canvas.save()
|
||||
val rect = Rect()
|
||||
val bounds = originalView.drawable.copyBounds()
|
||||
// val bounds = originalView.drawable.copyBounds()
|
||||
canvas.getClipBounds(rect)
|
||||
rect.inset(-2 * getBlurRadius(context, cElevation).toInt(), -2 * getBlurRadius(context, cElevation).toInt())
|
||||
canvas.save()
|
||||
|
@ -25,9 +25,8 @@ object WidgetHelper {
|
||||
) {
|
||||
|
||||
fun getWidgetsSize(widgetId: Int): Pair<Int, Int> {
|
||||
val isPortrait = context.resources.configuration.orientation == ORIENTATION_PORTRAIT
|
||||
val width = getWidgetWidth(isPortrait, widgetId)
|
||||
val height = getWidgetHeight(isPortrait, widgetId)
|
||||
val width = getWidgetWidth(widgetId)
|
||||
val height = getWidgetHeight(widgetId)
|
||||
val widthInPx = context.dip(width)
|
||||
val heightInPx = context.dip(height)
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("widthInPx", widthInPx)
|
||||
@ -35,9 +34,9 @@ object WidgetHelper {
|
||||
return widthInPx to heightInPx
|
||||
}
|
||||
|
||||
private fun getWidgetWidth(isPortrait: Boolean, widgetId: Int): Int = getWidgetSizeInDp(widgetId, AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH)
|
||||
private fun getWidgetWidth(widgetId: Int): Int = getWidgetSizeInDp(widgetId, AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH)
|
||||
|
||||
private fun getWidgetHeight(isPortrait: Boolean, widgetId: Int): Int = getWidgetSizeInDp(widgetId, AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT)
|
||||
private fun getWidgetHeight(widgetId: Int): Int = getWidgetSizeInDp(widgetId, AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT)
|
||||
|
||||
private fun getWidgetSizeInDp(widgetId: Int, key: String): Int =
|
||||
appWidgetManager.getAppWidgetOptions(widgetId).getInt(key, 0)
|
||||
|
@ -344,7 +344,7 @@ class WeatherNetworkApi(val context: Context) {
|
||||
|
||||
private suspend fun useAccuweatherProvider(context: Context) {
|
||||
if (Preferences.weatherProviderApiAccuweather != "") {
|
||||
val repository = AccuweatherRepository()
|
||||
// val repository = AccuweatherRepository()
|
||||
|
||||
// when (val response = repository.getWeather()) {
|
||||
// is NetworkResponse.Success -> {
|
||||
|
@ -138,10 +138,8 @@ class ActivityDetectionReceiver : BroadcastReceiver() {
|
||||
val endTime: Long = cal.timeInMillis
|
||||
|
||||
val readRequest = DataReadRequest.Builder()
|
||||
.aggregate(
|
||||
DataType.TYPE_STEP_COUNT_DELTA,
|
||||
DataType.AGGREGATE_STEP_COUNT_DELTA
|
||||
)
|
||||
.aggregate(DataType.TYPE_STEP_COUNT_DELTA)
|
||||
.aggregate(DataType.AGGREGATE_STEP_COUNT_DELTA)
|
||||
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
|
||||
.bucketByTime(1, TimeUnit.DAYS)
|
||||
.build()
|
||||
|
@ -41,6 +41,7 @@ class NotificationListener : NotificationListenerService() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
Preferences.lastNotificationIcon = sbn.notification.smallIcon.resId
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
Preferences.lastNotificationIcon = sbn.notification.icon
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
|
@ -2,12 +2,11 @@ package com.tommasoberlose.anotherwidget.ui.activities.settings
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivityIntegrationsBinding
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.IntegrationsViewModel
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.settings.IntegrationsViewModel
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
|
||||
class IntegrationsActivity : AppCompatActivity() {
|
||||
|
@ -4,7 +4,6 @@ import android.os.Bundle
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@ -13,7 +12,7 @@ import com.android.billingclient.api.BillingClient.BillingResponseCode.OK
|
||||
import com.android.billingclient.api.BillingClient.BillingResponseCode.USER_CANCELED
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivitySupportDevBinding
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.SupportDevViewModel
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.settings.SupportDevViewModel
|
||||
import com.tommasoberlose.anotherwidget.utils.toast
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
|
||||
|
@ -6,7 +6,6 @@ import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@ -16,7 +15,7 @@ import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivityAppNotificationsFilterBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import com.tommasoberlose.anotherwidget.helpers.ActiveNotificationsHelper
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.AppNotificationsViewModel
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.AppNotificationsViewModel
|
||||
import kotlinx.coroutines.*
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
|
||||
|
@ -10,7 +10,6 @@ import android.widget.ImageView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@ -18,7 +17,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.bumptech.glide.Glide
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivityChooseApplicationBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Constants
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.ChooseApplicationViewModel
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.ChooseApplicationViewModel
|
||||
import kotlinx.coroutines.*
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
import net.idik.lib.slimadapter.SlimAdapterEx
|
||||
@ -90,15 +89,15 @@ class ChooseApplicationActivity : AppCompatActivity() {
|
||||
binding.viewModel = viewModel
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
viewModel.appList.observe(this, Observer {
|
||||
viewModel.appList.observe(this) {
|
||||
updateList(list = it)
|
||||
binding.loader.visibility = View.INVISIBLE
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.searchInput.observe(this, Observer { search ->
|
||||
viewModel.searchInput.observe(this) { search ->
|
||||
updateList(search = search)
|
||||
binding.clearSearch.isVisible = search.isNotBlank()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateList(list: List<ResolveInfo>? = viewModel.appList.value, search: String? = viewModel.searchInput.value) {
|
||||
|
@ -4,7 +4,6 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@ -13,7 +12,7 @@ import com.chibatching.kotpref.blockingBulk
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivityCustomDateBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.CustomDateViewModel
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.CustomDateViewModel
|
||||
import com.tommasoberlose.anotherwidget.utils.getCapWordString
|
||||
import com.tommasoberlose.anotherwidget.utils.openURI
|
||||
import com.tommasoberlose.anotherwidget.utils.toast
|
||||
|
@ -13,7 +13,6 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.provider.FontRequest
|
||||
import androidx.core.provider.FontsContractCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@ -26,7 +25,7 @@ import com.tommasoberlose.anotherwidget.databinding.ActivityCustomFontBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Constants
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import com.tommasoberlose.anotherwidget.helpers.SettingsStringHelper
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.CustomFontViewModel
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.CustomFontViewModel
|
||||
import kotlinx.coroutines.*
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
import net.idik.lib.slimadapter.diff.DefaultDiffCallback
|
||||
|
@ -9,7 +9,6 @@ import com.tommasoberlose.anotherwidget.R
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@ -22,7 +21,7 @@ import com.karumi.dexter.listener.PermissionRequest
|
||||
import com.karumi.dexter.listener.multi.MultiplePermissionsListener
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivityCustomLocationBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.CustomLocationViewModel
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.CustomLocationViewModel
|
||||
import kotlinx.coroutines.*
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
|
||||
|
@ -7,7 +7,6 @@ import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@ -16,7 +15,7 @@ import com.bumptech.glide.Glide
|
||||
import com.tommasoberlose.anotherwidget.databinding.ActivityMusicPlayersFilterBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import com.tommasoberlose.anotherwidget.helpers.MediaPlayerHelper
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.MusicPlayersFilterViewModel
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.MusicPlayersFilterViewModel
|
||||
import kotlinx.coroutines.*
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
|
||||
@ -76,20 +75,20 @@ class MusicPlayersFilterActivity : AppCompatActivity() {
|
||||
binding.viewModel = viewModel
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
viewModel.appList.observe(this, Observer {
|
||||
viewModel.appList.observe(this) {
|
||||
updateList(list = it)
|
||||
binding.loader.visibility = View.INVISIBLE
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.searchInput.observe(this, Observer { search ->
|
||||
viewModel.searchInput.observe(this) { search ->
|
||||
updateList(search = search)
|
||||
binding.clearSearch.isVisible = search.isNotBlank()
|
||||
})
|
||||
}
|
||||
|
||||
viewModel.musicPlayersFilter.observe(this, {
|
||||
viewModel.musicPlayersFilter.observe(this) {
|
||||
updateList()
|
||||
binding.clearSelection.isVisible = Preferences.musicPlayersFilter != ""
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateList(list: List<ResolveInfo>? = viewModel.appList.value, search: String? = viewModel.searchInput.value) {
|
||||
|
@ -18,7 +18,7 @@ import com.tommasoberlose.anotherwidget.global.Constants
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import com.tommasoberlose.anotherwidget.helpers.WeatherHelper
|
||||
import com.tommasoberlose.anotherwidget.ui.fragments.MainFragment
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.WeatherProviderViewModel
|
||||
import com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.WeatherProviderViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
@ -119,100 +119,6 @@ class MainFragment : Fragment() {
|
||||
binding.actionBack to "action_back"
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
private var uiJob: Job? = null
|
||||
|
||||
private fun updateUI() {
|
||||
uiJob?.cancel()
|
||||
|
||||
if (Preferences.showPreview) {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val bgColor: Int = ContextCompat.getColor(
|
||||
requireContext(),
|
||||
if (ColorHelper.getFontColor(requireActivity().isDarkTheme())
|
||||
.isColorDark()
|
||||
) android.R.color.white else R.color.colorAccent
|
||||
)
|
||||
|
||||
val wallpaperDrawable = BitmapHelper.getTintedDrawable(
|
||||
requireContext(),
|
||||
R.drawable.card_background,
|
||||
ColorHelper.getBackgroundColor(requireActivity().isDarkTheme())
|
||||
)
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
binding.preview.setCardBackgroundColor(bgColor)
|
||||
binding.widgetDetail.widgetShapeBackground.setImageDrawable(wallpaperDrawable)
|
||||
}
|
||||
}
|
||||
|
||||
WidgetHelper.runWithCustomTypeface(requireContext()) { typeface ->
|
||||
uiJob = lifecycleScope.launch(Dispatchers.IO) {
|
||||
val generatedView = MainWidget.generateWidgetView(requireContext(), typeface).root
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
generatedView.measure(0, 0)
|
||||
binding.preview.measure(0, 0)
|
||||
}
|
||||
|
||||
val bitmap = BitmapHelper.getBitmapFromView(
|
||||
generatedView,
|
||||
if (binding.preview.width > 0) binding.preview.width else generatedView.measuredWidth,
|
||||
generatedView.measuredHeight
|
||||
)
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
binding.widget.animate().alpha(0f).start()
|
||||
binding.widgetLoader.animate().scaleX(1f).scaleY(1f).alpha(1f)
|
||||
|
||||
.setDuration(200L).start()
|
||||
binding.widgetDetail.bitmapContainer.apply {
|
||||
setImageBitmap(bitmap)
|
||||
}
|
||||
|
||||
binding.widgetLoader.animate().scaleX(0f).scaleY(0f).alpha(0f)
|
||||
.setDuration(200L).start()
|
||||
binding.widget.animate().alpha(1f).start()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
binding.preview.layoutParams = binding.preview.layoutParams.apply {
|
||||
height = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateClock() {
|
||||
// Clock
|
||||
binding.widgetDetail.time.setTextColor(ColorHelper.getClockFontColor(requireActivity().isDarkTheme()))
|
||||
binding.widgetDetail.timeAmPm.setTextColor(ColorHelper.getClockFontColor(requireActivity().isDarkTheme()))
|
||||
binding.widgetDetail.time.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_SP,
|
||||
Preferences.clockTextSize.toPixel(requireContext())
|
||||
)
|
||||
binding.widgetDetail.timeAmPm.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_SP,
|
||||
Preferences.clockTextSize.toPixel(requireContext()) / 5 * 2
|
||||
)
|
||||
binding.widgetDetail.timeAmPm.isVisible = Preferences.showAMPMIndicator
|
||||
|
||||
// Clock bottom margin
|
||||
binding.widgetDetail.clockBottomMarginNone.isVisible =
|
||||
Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.NONE.value
|
||||
binding.widgetDetail.clockBottomMarginSmall.isVisible =
|
||||
Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.SMALL.value
|
||||
binding.widgetDetail.clockBottomMarginMedium.isVisible =
|
||||
Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.MEDIUM.value
|
||||
binding.widgetDetail.clockBottomMarginLarge.isVisible =
|
||||
Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.LARGE.value
|
||||
|
||||
if (Preferences.showClock) {
|
||||
binding.widgetDetail.timeContainer.expand()
|
||||
} else {
|
||||
binding.widgetDetail.timeContainer.collapse()
|
||||
}
|
||||
|
||||
binding.preview.layoutParams = binding.preview.layoutParams.apply {
|
||||
height = PREVIEW_BASE_HEIGHT.toPixel(requireContext()) + if (Preferences.showClock) 100.toPixel(
|
||||
@ -272,6 +178,120 @@ class MainFragment : Fragment() {
|
||||
viewModel.widgetPreferencesUpdate.observe(viewLifecycleOwner) {
|
||||
onUpdateUiEvent(null)
|
||||
}
|
||||
|
||||
viewModel.showClock.observe(viewLifecycleOwner) {
|
||||
updateClockVisibility(it)
|
||||
}
|
||||
}
|
||||
|
||||
private var uiJob: Job? = null
|
||||
|
||||
private fun updateUI() {
|
||||
uiJob?.cancel()
|
||||
|
||||
if (Preferences.showPreview) {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val bgColor: Int = ContextCompat.getColor(
|
||||
requireContext(),
|
||||
if (ColorHelper.getFontColor(requireActivity().isDarkTheme())
|
||||
.isColorDark()
|
||||
) android.R.color.white else R.color.colorAccent
|
||||
)
|
||||
|
||||
val wallpaperDrawable = BitmapHelper.getTintedDrawable(
|
||||
requireContext(),
|
||||
R.drawable.card_background,
|
||||
ColorHelper.getBackgroundColor(requireActivity().isDarkTheme())
|
||||
)
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
binding.preview.setCardBackgroundColor(bgColor)
|
||||
binding.widgetDetail.widgetShapeBackground.setImageDrawable(wallpaperDrawable)
|
||||
}
|
||||
}
|
||||
|
||||
WidgetHelper.runWithCustomTypeface(requireContext()) { typeface ->
|
||||
uiJob = lifecycleScope.launch(Dispatchers.IO) {
|
||||
val generatedView = MainWidget.generateWidgetView(requireContext(), typeface).root
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
generatedView.measure(0, 0)
|
||||
binding.preview.measure(0, 0)
|
||||
}
|
||||
|
||||
val bitmap = BitmapHelper.getBitmapFromView(
|
||||
generatedView,
|
||||
if (binding.preview.width > 0) binding.preview.width else generatedView.measuredWidth,
|
||||
generatedView.measuredHeight
|
||||
)
|
||||
|
||||
withContext(Dispatchers.Main) {
|
||||
binding.widgetDetail.bitmapContainer.apply {
|
||||
setImageBitmap(bitmap)
|
||||
}
|
||||
|
||||
binding.widgetLoader.animate().scaleX(0f).scaleY(0f).alpha(0f)
|
||||
.setDuration(200L).start()
|
||||
binding.widget.animate().alpha(1f).start()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
binding.preview.layoutParams = binding.preview.layoutParams.apply {
|
||||
height = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateClock() {
|
||||
// Clock
|
||||
binding.widgetDetail.time.setTextColor(ColorHelper.getClockFontColor(requireActivity().isDarkTheme()))
|
||||
binding.widgetDetail.timeAmPm.setTextColor(ColorHelper.getClockFontColor(requireActivity().isDarkTheme()))
|
||||
binding.widgetDetail.time.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_SP,
|
||||
Preferences.clockTextSize.toPixel(requireContext())
|
||||
)
|
||||
binding.widgetDetail.timeAmPm.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_SP,
|
||||
Preferences.clockTextSize.toPixel(requireContext()) / 5 * 2
|
||||
)
|
||||
binding.widgetDetail.timeAmPm.isVisible = Preferences.showAMPMIndicator
|
||||
|
||||
// Clock bottom margin
|
||||
binding.widgetDetail.clockBottomMarginNone.isVisible =
|
||||
Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.NONE.value
|
||||
binding.widgetDetail.clockBottomMarginSmall.isVisible =
|
||||
Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.SMALL.value
|
||||
binding.widgetDetail.clockBottomMarginMedium.isVisible =
|
||||
Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.MEDIUM.value
|
||||
binding.widgetDetail.clockBottomMarginLarge.isVisible =
|
||||
Preferences.showClock && Preferences.clockBottomMargin == Constants.ClockBottomMargin.LARGE.value
|
||||
|
||||
}
|
||||
|
||||
private fun updateClockVisibility(showClock: Boolean) {
|
||||
binding.preview.animation?.cancel()
|
||||
|
||||
val clockInitialHeight = binding.widgetDetail.timeContainer.measuredHeight.toFloat()
|
||||
ValueAnimator.ofFloat(
|
||||
if (Preferences.showClock) 0f else 1f,
|
||||
if (Preferences.showClock) 1f else 0f
|
||||
).apply {
|
||||
this.duration = 500L
|
||||
addUpdateListener {
|
||||
val animatedValue = animatedValue as Float
|
||||
|
||||
binding.preview.layoutParams = binding.preview.layoutParams.apply {
|
||||
height = (PREVIEW_BASE_HEIGHT.toPixel(requireContext()) + 100.toPixel(requireContext()) * animatedValue).toInt()
|
||||
}
|
||||
|
||||
binding.widgetDetail.timeContainer.layoutParams = binding.widgetDetail.timeContainer.layoutParams.apply {
|
||||
height = (clockInitialHeight * animatedValue).toInt()
|
||||
}
|
||||
binding.widgetDetail.timeContainer.translationY = (clockInitialHeight * animatedValue - clockInitialHeight)
|
||||
binding.widgetDetail.timeContainer.alpha = animatedValue
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
@ -85,7 +85,7 @@ class CalendarFragment : Fragment() {
|
||||
viewModel: MainViewModel
|
||||
) {
|
||||
binding.isCalendarEnabled = Preferences.showEvents
|
||||
binding.isDiffEnabled = Preferences.showDiffTime || !Preferences.showEvents
|
||||
binding.isDiffEnabled = Preferences.showDiffTime
|
||||
|
||||
viewModel.calendarAllDay.observe(viewLifecycleOwner) {
|
||||
maintainScrollPosition {
|
||||
@ -122,7 +122,6 @@ class CalendarFragment : Fragment() {
|
||||
maintainScrollPosition {
|
||||
binding.showUntilLabel.text = getString(SettingsStringHelper.getShowUntilString(it))
|
||||
}
|
||||
updateCalendar()
|
||||
}
|
||||
|
||||
}
|
||||
@ -136,7 +135,7 @@ class CalendarFragment : Fragment() {
|
||||
it.displayName,
|
||||
it.accountName
|
||||
)
|
||||
}.sortedWith(Comparator { cal1, cal2 ->
|
||||
}.sortedWith { cal1, cal2 ->
|
||||
when {
|
||||
cal1.accountName != cal2.accountName -> {
|
||||
cal1.accountName.compareTo(cal2.accountName)
|
||||
@ -151,7 +150,7 @@ class CalendarFragment : Fragment() {
|
||||
cal1.name.compareTo(cal2.name)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (calendarSelectorList.isNotEmpty()) {
|
||||
val filteredCalendarIds = CalendarHelper.getFilteredCalendarIdList()
|
||||
@ -271,6 +270,7 @@ class CalendarFragment : Fragment() {
|
||||
}
|
||||
dialog.addOnSelectItemListener { value ->
|
||||
Preferences.showUntil = value
|
||||
updateCalendar()
|
||||
}.show()
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,11 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.view.animation.LayoutAnimationController
|
||||
import android.widget.ImageView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@ -45,8 +46,9 @@ 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 com.tommasoberlose.anotherwidget.utils.expand
|
||||
import com.tommasoberlose.anotherwidget.utils.reveal
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
|
||||
|
||||
@ -78,8 +80,6 @@ class GlanceTabFragment : Fragment() {
|
||||
viewModel = ViewModelProvider(activity as MainActivity).get(MainViewModel::class.java)
|
||||
binding = FragmentTabGlanceBinding.inflate(inflater)
|
||||
|
||||
subscribeUi(viewModel)
|
||||
|
||||
binding.lifecycleOwner = this
|
||||
binding.viewModel = viewModel
|
||||
|
||||
@ -90,16 +90,12 @@ class GlanceTabFragment : Fragment() {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
|
||||
// List
|
||||
binding.providersList.setHasFixedSize(true)
|
||||
binding.providersList.hasFixedSize()
|
||||
val mLayoutManager = LinearLayoutManager(context)
|
||||
binding.providersList.layoutManager = mLayoutManager
|
||||
|
||||
adapter = SlimAdapter.create()
|
||||
adapter
|
||||
.register<String>(R.layout.glance_providers_list_ornament) { item, injector ->
|
||||
injector.visibility(R.id.footer, if(item == "footer") View.VISIBLE else View.GONE)
|
||||
injector.visibility(R.id.header, if(item == "header") View.VISIBLE else View.GONE)
|
||||
}
|
||||
.register<GlanceProvider>(R.layout.glance_provider_item) { item, injector ->
|
||||
val provider = Constants.GlanceProviderId.from(item.id)!!
|
||||
injector
|
||||
@ -130,9 +126,12 @@ class GlanceTabFragment : Fragment() {
|
||||
MediaPlayerHelper.updatePlayingMediaInfo(requireContext())
|
||||
injector.visibility(R.id.error_icon, View.GONE)
|
||||
injector.visibility(R.id.info_icon, View.VISIBLE)
|
||||
injector.text(R.id.label,
|
||||
injector.text(
|
||||
R.id.label,
|
||||
if (Preferences.showMusic) getString(R.string.settings_visible) else getString(
|
||||
R.string.settings_not_visible))
|
||||
R.string.settings_not_visible
|
||||
)
|
||||
)
|
||||
isVisible = Preferences.showMusic
|
||||
}
|
||||
Preferences.showMusic -> {
|
||||
@ -150,26 +149,40 @@ class GlanceTabFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
Constants.GlanceProviderId.NEXT_CLOCK_ALARM -> {
|
||||
injector.text(R.id.label,
|
||||
injector.text(
|
||||
R.id.label,
|
||||
if (Preferences.showNextAlarm && !AlarmHelper.isAlarmProbablyWrong(
|
||||
requireContext())
|
||||
requireContext()
|
||||
)
|
||||
) getString(R.string.settings_visible) else getString(
|
||||
R.string.settings_not_visible))
|
||||
injector.visibility(R.id.error_icon,
|
||||
R.string.settings_not_visible
|
||||
)
|
||||
)
|
||||
injector.visibility(
|
||||
R.id.error_icon,
|
||||
if (Preferences.showNextAlarm && AlarmHelper.isAlarmProbablyWrong(
|
||||
requireContext())
|
||||
) View.VISIBLE else View.GONE)
|
||||
injector.visibility(R.id.info_icon,
|
||||
requireContext()
|
||||
)
|
||||
) View.VISIBLE else View.GONE
|
||||
)
|
||||
injector.visibility(
|
||||
R.id.info_icon,
|
||||
if (!(Preferences.showNextAlarm && AlarmHelper.isAlarmProbablyWrong(
|
||||
requireContext()))
|
||||
) View.VISIBLE else View.GONE)
|
||||
requireContext()
|
||||
))
|
||||
) View.VISIBLE else View.GONE
|
||||
)
|
||||
isVisible = !(Preferences.showNextAlarm && AlarmHelper.isAlarmProbablyWrong(
|
||||
requireContext()))
|
||||
requireContext()
|
||||
))
|
||||
}
|
||||
Constants.GlanceProviderId.BATTERY_LEVEL_LOW -> {
|
||||
injector.text(R.id.label,
|
||||
injector.text(
|
||||
R.id.label,
|
||||
if (Preferences.showBatteryCharging) getString(R.string.settings_visible) else getString(
|
||||
R.string.settings_not_visible))
|
||||
R.string.settings_not_visible
|
||||
)
|
||||
)
|
||||
injector.visibility(R.id.error_icon, View.GONE)
|
||||
injector.visibility(R.id.info_icon, View.VISIBLE)
|
||||
isVisible = Preferences.showBatteryCharging
|
||||
@ -179,9 +192,12 @@ class GlanceTabFragment : Fragment() {
|
||||
ActiveNotificationsHelper.checkNotificationAccess(requireContext()) -> {
|
||||
injector.visibility(R.id.error_icon, View.GONE)
|
||||
injector.visibility(R.id.info_icon, View.VISIBLE)
|
||||
injector.text(R.id.label,
|
||||
injector.text(
|
||||
R.id.label,
|
||||
if (Preferences.showNotifications) getString(
|
||||
R.string.settings_visible) else getString(R.string.settings_not_visible))
|
||||
R.string.settings_visible
|
||||
) else getString(R.string.settings_not_visible)
|
||||
)
|
||||
isVisible = Preferences.showNotifications
|
||||
}
|
||||
Preferences.showNotifications -> {
|
||||
@ -199,29 +215,44 @@ class GlanceTabFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
Constants.GlanceProviderId.GREETINGS -> {
|
||||
injector.text(R.id.label,
|
||||
injector.text(
|
||||
R.id.label,
|
||||
if (Preferences.showGreetings) getString(R.string.settings_visible) else getString(
|
||||
R.string.settings_not_visible))
|
||||
R.string.settings_not_visible
|
||||
)
|
||||
)
|
||||
injector.visibility(R.id.error_icon, View.GONE)
|
||||
injector.visibility(R.id.info_icon, View.VISIBLE)
|
||||
isVisible = Preferences.showGreetings
|
||||
}
|
||||
Constants.GlanceProviderId.CUSTOM_INFO -> {
|
||||
injector.text(R.id.label,
|
||||
injector.text(
|
||||
R.id.label,
|
||||
if (Preferences.customNotes != "") getString(R.string.settings_visible) else getString(
|
||||
R.string.settings_not_visible))
|
||||
R.string.settings_not_visible
|
||||
)
|
||||
)
|
||||
injector.visibility(R.id.error_icon, View.GONE)
|
||||
injector.visibility(R.id.info_icon, View.VISIBLE)
|
||||
isVisible = Preferences.customNotes != ""
|
||||
}
|
||||
Constants.GlanceProviderId.GOOGLE_FIT_STEPS -> {
|
||||
val account: GoogleSignInAccount? = GoogleSignIn.getLastSignedInAccount(context)
|
||||
if (GoogleSignIn.hasPermissions(account, FITNESS_OPTIONS) && (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || requireActivity().checkGrantedPermission(
|
||||
Manifest.permission.ACTIVITY_RECOGNITION))
|
||||
val account: GoogleSignInAccount? = GoogleSignIn.getLastSignedInAccount(
|
||||
context
|
||||
)
|
||||
if (GoogleSignIn.hasPermissions(
|
||||
account,
|
||||
FITNESS_OPTIONS
|
||||
) && (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q || requireActivity().checkGrantedPermission(
|
||||
Manifest.permission.ACTIVITY_RECOGNITION
|
||||
))
|
||||
) {
|
||||
injector.text(R.id.label,
|
||||
injector.text(
|
||||
R.id.label,
|
||||
if (Preferences.showDailySteps) getString(R.string.settings_visible) else getString(
|
||||
R.string.settings_not_visible))
|
||||
R.string.settings_not_visible
|
||||
)
|
||||
)
|
||||
injector.visibility(R.id.error_icon, View.GONE)
|
||||
injector.visibility(R.id.info_icon, View.VISIBLE)
|
||||
isVisible = Preferences.showDailySteps
|
||||
@ -240,12 +271,24 @@ class GlanceTabFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
Constants.GlanceProviderId.EVENTS -> {
|
||||
isVisible = Preferences.showEventsAsGlanceProvider && Preferences.showEvents && requireContext().checkGrantedPermission(Manifest.permission.READ_CALENDAR)
|
||||
injector.text(R.id.label,
|
||||
isVisible =
|
||||
Preferences.showEventsAsGlanceProvider && Preferences.showEvents && requireContext().checkGrantedPermission(
|
||||
Manifest.permission.READ_CALENDAR
|
||||
)
|
||||
injector.text(
|
||||
R.id.label,
|
||||
if (isVisible) getString(R.string.settings_visible) else getString(
|
||||
R.string.settings_not_visible))
|
||||
injector.visibility(R.id.error_icon, if (isVisible) View.GONE else View.VISIBLE)
|
||||
injector.visibility(R.id.info_icon, if (isVisible) View.VISIBLE else View.GONE)
|
||||
R.string.settings_not_visible
|
||||
)
|
||||
)
|
||||
injector.visibility(
|
||||
R.id.error_icon,
|
||||
if (isVisible) View.GONE else View.VISIBLE
|
||||
)
|
||||
injector.visibility(
|
||||
R.id.info_icon,
|
||||
if (isVisible) View.VISIBLE else View.GONE
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,7 +343,12 @@ class GlanceTabFragment : Fragment() {
|
||||
GlanceProviderHelper.saveGlanceProviderOrder(
|
||||
list
|
||||
)
|
||||
adapter.updateData(listOf("header") + list.mapNotNull { GlanceProviderHelper.getGlanceProviderById(requireContext(), it) } + listOf("footer"))
|
||||
adapter.updateData(listOf("header") + list.mapNotNull {
|
||||
GlanceProviderHelper.getGlanceProviderById(
|
||||
requireContext(),
|
||||
it
|
||||
)
|
||||
} + listOf("footer"))
|
||||
}
|
||||
|
||||
override fun onChildDraw(
|
||||
@ -315,23 +363,37 @@ class GlanceTabFragment : Fragment() {
|
||||
val view = viewHolder.itemView as MaterialCardView
|
||||
if (isCurrentlyActive) {
|
||||
ViewCompat.setElevation(view, 8f.convertDpToPixel(requireContext()))
|
||||
view.setCardBackgroundColor(ContextCompat.getColor(requireContext(),
|
||||
R.color.cardBorder))
|
||||
view.setCardBackgroundColor(
|
||||
ContextCompat.getColor(
|
||||
requireContext(),
|
||||
R.color.cardBorder
|
||||
)
|
||||
)
|
||||
} else {
|
||||
ViewCompat.setElevation(view, 0f)
|
||||
view.setCardBackgroundColor(ContextCompat.getColor(requireContext(),
|
||||
R.color.colorPrimary))
|
||||
view.setCardBackgroundColor(
|
||||
ContextCompat.getColor(
|
||||
requireContext(),
|
||||
R.color.colorPrimary
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
val topEdge = if ((view.top == 0 && dY < 0) || ((view.top + view.height >= recyclerView.height - 32f.convertDpToPixel(requireContext())) && dY > 0)) 0f else dY
|
||||
val topEdge =
|
||||
if ((view.top == 0 && dY < 0) || ((view.top + view.height >= recyclerView.height - 32f.convertDpToPixel(
|
||||
requireContext()
|
||||
)) && dY > 0)
|
||||
) 0f else dY
|
||||
|
||||
super.onChildDraw(c,
|
||||
super.onChildDraw(
|
||||
c,
|
||||
recyclerView,
|
||||
viewHolder,
|
||||
dX,
|
||||
topEdge,
|
||||
actionState,
|
||||
isCurrentlyActive)
|
||||
isCurrentlyActive
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSwiped(
|
||||
@ -343,7 +405,6 @@ class GlanceTabFragment : Fragment() {
|
||||
})
|
||||
|
||||
mIth.attachToRecyclerView(binding.providersList)
|
||||
binding.providersList.isNestedScrollingEnabled = false
|
||||
|
||||
setupListener()
|
||||
|
||||
@ -351,13 +412,16 @@ class GlanceTabFragment : Fragment() {
|
||||
viewModel.fragmentScrollY.value = binding.scrollView.scrollY
|
||||
}
|
||||
|
||||
|
||||
adapter.updateData(listOf("header") + list.mapNotNull { GlanceProviderHelper.getGlanceProviderById(requireContext(), it) } + listOf("footer"))
|
||||
}
|
||||
|
||||
private fun subscribeUi(
|
||||
viewModel: MainViewModel,
|
||||
) {
|
||||
adapter.updateData(emptyList<Constants.GlanceProviderId>())
|
||||
lifecycleScope.launchWhenResumed {
|
||||
delay(800)
|
||||
val l = list.mapNotNull { GlanceProviderHelper.getGlanceProviderById(
|
||||
requireContext(),
|
||||
it
|
||||
) }
|
||||
adapter.updateData(l)
|
||||
binding.listContainer.expand()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupListener() {
|
||||
@ -371,8 +435,10 @@ class GlanceTabFragment : Fragment() {
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
requireActivity().registerReceiver(nextAlarmChangeBroadcastReceiver,
|
||||
IntentFilter(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED))
|
||||
requireActivity().registerReceiver(
|
||||
nextAlarmChangeBroadcastReceiver,
|
||||
IntentFilter(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED)
|
||||
)
|
||||
if (dialog != null) {
|
||||
dialog?.show()
|
||||
}
|
||||
@ -403,13 +469,15 @@ class GlanceTabFragment : Fragment() {
|
||||
2 -> {
|
||||
try {
|
||||
val account: GoogleSignInAccount? = GoogleSignIn.getSignedInAccountFromIntent(
|
||||
data).getResult(ApiException::class.java)
|
||||
data
|
||||
).getResult(ApiException::class.java)
|
||||
if (!GoogleSignIn.hasPermissions(account, FITNESS_OPTIONS)) {
|
||||
GoogleSignIn.requestPermissions(
|
||||
requireActivity(),
|
||||
1,
|
||||
account,
|
||||
FITNESS_OPTIONS)
|
||||
FITNESS_OPTIONS
|
||||
)
|
||||
} else {
|
||||
adapter.notifyItemRangeChanged(0, adapter.data.size)
|
||||
}
|
||||
@ -425,18 +493,9 @@ class GlanceTabFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun maintainScrollPosition(callback: () -> Unit) {
|
||||
binding.scrollView.isScrollable = false
|
||||
callback.invoke()
|
||||
lifecycleScope.launch {
|
||||
delay(200)
|
||||
binding.scrollView.isScrollable = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
adapter.notifyItemRangeChanged(0, adapter.data?.size ?: 0)
|
||||
adapter.notifyItemRangeChanged(1, adapter.data?.size ?: 0)
|
||||
if (dialog != null) {
|
||||
dialog?.show()
|
||||
}
|
||||
|
@ -124,17 +124,6 @@ class LayoutFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.backgroundCardColorDark.observe(viewLifecycleOwner) {
|
||||
maintainScrollPosition {
|
||||
if (Preferences.backgroundCardAlphaDark == "00") {
|
||||
binding.backgroundColorLabel.text = getString(R.string.transparent)
|
||||
} else {
|
||||
binding.backgroundColorLabel.text =
|
||||
"#%s".format(Integer.toHexString(ColorHelper.getBackgroundColor(requireActivity().isDarkTheme()))).toUpperCase()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.showDividers.observe(viewLifecycleOwner) {
|
||||
maintainScrollPosition {
|
||||
binding.showDividersLabel.text =
|
||||
|
@ -94,9 +94,6 @@ class PreferencesFragment : Fragment() {
|
||||
viewModel.showWeather.observe(viewLifecycleOwner) {
|
||||
checkWeatherProviderConfig()
|
||||
}
|
||||
|
||||
viewModel.showClock.observe(viewLifecycleOwner) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupListener() {
|
||||
@ -115,9 +112,6 @@ class PreferencesFragment : Fragment() {
|
||||
|
||||
binding.showEventsSwitch.setOnCheckedChangeListener { _, enabled: Boolean ->
|
||||
if (enabled) {
|
||||
if (!requireActivity().checkGrantedPermission(Manifest.permission.READ_CALENDAR)) {
|
||||
binding.showEventsSwitch.setCheckedImmediatelyNoEvent(false)
|
||||
}
|
||||
requireCalendarPermission()
|
||||
} else {
|
||||
Preferences.showEvents = enabled
|
||||
@ -196,6 +190,11 @@ class PreferencesFragment : Fragment() {
|
||||
binding.weatherProviderLocationError.text = Preferences.weatherProviderLocationError
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
binding.showEventsSwitch.setCheckedNoEvent(Preferences.showEvents && requireActivity().checkGrantedPermission(Manifest.permission.READ_CALENDAR))
|
||||
}
|
||||
|
||||
private fun maintainScrollPosition(callback: () -> Unit) {
|
||||
binding.scrollView.isScrollable = false
|
||||
callback.invoke()
|
||||
|
@ -116,17 +116,6 @@ class TypographyFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.textGlobalColorDark.observe(viewLifecycleOwner) {
|
||||
maintainScrollPosition {
|
||||
if (Preferences.textGlobalAlphaDark == "00") {
|
||||
binding.fontColorLabelDark.text = getString(R.string.transparent)
|
||||
} else {
|
||||
binding.fontColorLabelDark.text =
|
||||
"#%s".format(Integer.toHexString(ColorHelper.getFontColor(requireActivity().isDarkTheme()))).toUpperCase()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.textSecondaryColor.observe(viewLifecycleOwner) {
|
||||
maintainScrollPosition {
|
||||
if (Preferences.textSecondaryAlpha == "00") {
|
||||
@ -138,20 +127,18 @@ class TypographyFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.textSecondaryColorDark.observe(viewLifecycleOwner) {
|
||||
viewModel.textShadow.observe(viewLifecycleOwner) {
|
||||
maintainScrollPosition {
|
||||
if (Preferences.textSecondaryAlphaDark == "00") {
|
||||
binding.secondaryFontColorLabelDark.text = getString(R.string.transparent)
|
||||
} else {
|
||||
binding.secondaryFontColorLabelDark.text =
|
||||
"#%s".format(Integer.toHexString(ColorHelper.getSecondaryFontColor(requireActivity().isDarkTheme()))).toUpperCase()
|
||||
if (requireActivity().isDarkTheme()) {
|
||||
binding.textShadowLabel.text =
|
||||
getString(SettingsStringHelper.getTextShadowString(it))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.textShadow.observe(viewLifecycleOwner) {
|
||||
maintainScrollPosition {
|
||||
if (activity?.isDarkTheme() != true) {
|
||||
if (!requireActivity().isDarkTheme()) {
|
||||
binding.textShadowLabel.text =
|
||||
getString(SettingsStringHelper.getTextShadowString(it))
|
||||
}
|
||||
@ -161,7 +148,7 @@ class TypographyFragment : Fragment() {
|
||||
viewModel.textShadowDark.observe(viewLifecycleOwner) {
|
||||
maintainScrollPosition {
|
||||
if (requireActivity().isDarkTheme()) {
|
||||
binding.textShadowLabelDark.text =
|
||||
binding.textShadowLabel.text =
|
||||
getString(SettingsStringHelper.getTextShadowString(it))
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +1,40 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
|
||||
import android.app.Application
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import androidx.core.os.ConfigurationCompat
|
||||
import androidx.lifecycle.*
|
||||
import com.chibatching.kotpref.livedata.asLiveData
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.global.Constants
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import com.tommasoberlose.anotherwidget.helpers.ColorHelper.isColor
|
||||
import com.tommasoberlose.anotherwidget.utils.isMetric
|
||||
|
||||
class MainViewModel : ViewModel() {
|
||||
class MainViewModel(context: Application) : AndroidViewModel(context) {
|
||||
|
||||
// General Settings
|
||||
val textGlobalColor = MediatorLiveData<Boolean>().apply {
|
||||
addSource(Preferences.asLiveData(Preferences::textGlobalColor)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::textGlobalAlpha)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::textGlobalColorDark)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::textGlobalAlphaDark)) { value = true }
|
||||
}
|
||||
val textSecondaryColor = MediatorLiveData<Boolean>().apply {
|
||||
addSource(Preferences.asLiveData(Preferences::textSecondaryColor)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::textSecondaryAlpha)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::textSecondaryColorDark)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::textSecondaryAlphaDark)) { value = true }
|
||||
}
|
||||
val backgroundCardColor = MediatorLiveData<Boolean>().apply {
|
||||
addSource(Preferences.asLiveData(Preferences::backgroundCardColor)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::backgroundCardAlpha)) { value = true }
|
||||
}
|
||||
val textGlobalColorDark = MediatorLiveData<Boolean>().apply {
|
||||
addSource(Preferences.asLiveData(Preferences::textGlobalColorDark)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::textGlobalAlphaDark)) { value = true }
|
||||
}
|
||||
val textSecondaryColorDark = MediatorLiveData<Boolean>().apply {
|
||||
addSource(Preferences.asLiveData(Preferences::textSecondaryColorDark)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::textSecondaryAlphaDark)) { value = true }
|
||||
}
|
||||
val backgroundCardColorDark = MediatorLiveData<Boolean>().apply {
|
||||
addSource(Preferences.asLiveData(Preferences::backgroundCardColorDark)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::backgroundCardAlphaDark)) { value = true }
|
||||
}
|
||||
|
||||
val textMainSize = Preferences.asLiveData(Preferences::textMainSize)
|
||||
val textSecondSize = Preferences.asLiveData(Preferences::textSecondSize)
|
||||
val textShadow = Preferences.asLiveData(Preferences::textShadow)
|
||||
@ -92,11 +96,11 @@ class MainViewModel : ViewModel() {
|
||||
val showWallpaper = Preferences.asLiveData(Preferences::showWallpaper)
|
||||
val showPreview = Preferences.asLiveData(Preferences::showPreview)
|
||||
val installedIntegrations = Preferences.asLiveData(Preferences::installedIntegrations)
|
||||
var colorClipboard: ArrayList<String> = ArrayList()
|
||||
|
||||
// UI
|
||||
val fragmentScrollY = MutableLiveData<Int>()
|
||||
val clockPreferencesUpdate = MediatorLiveData<Boolean>().apply {
|
||||
addSource(Preferences.asLiveData(Preferences::showClock)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::clockTextSize)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::clockTextColor)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::clockTextAlpha)) { value = true }
|
||||
@ -130,14 +134,57 @@ class MainViewModel : ViewModel() {
|
||||
addSource(Preferences.asLiveData(Preferences::secondRowInformation)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showDividers)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::secondRowTopMargin)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::isDateCapitalize)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::isDateUppercase)) { value = true }
|
||||
|
||||
addSource(Preferences.asLiveData(Preferences::showEvents)) { value = true }
|
||||
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::showDeclinedEvents)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showInvitedEvents)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showAcceptedEvents)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showOnlyBusyEvents)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::secondRowInformation)) { value = true }
|
||||
|
||||
addSource(Preferences.asLiveData(Preferences::showWeather)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::weatherTempUnit)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::weatherIconPack)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::customLocationLat)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::customLocationLon)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::customLocationAdd)) { value = true }
|
||||
|
||||
addSource(Preferences.asLiveData(Preferences::showPreview)) { value = true }
|
||||
|
||||
|
||||
addSource(Preferences.asLiveData(Preferences::enabledGlanceProviderOrder)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::customNotes)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showNextAlarm)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showBatteryCharging)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showDailySteps)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showGreetings)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showNotifications)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showMusic)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::mediaInfoFormat)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::musicPlayersFilter)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::appNotificationsFilter)) { value = true }
|
||||
addSource(Preferences.asLiveData(Preferences::showEventsAsGlanceProvider)) { value = true }
|
||||
|
||||
addSource(Preferences.asLiveData(Preferences::installedIntegrations)) { value = true }
|
||||
}
|
||||
|
||||
init {
|
||||
with(context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager) {
|
||||
if (hasPrimaryClip()) {
|
||||
(0..primaryClip!!.itemCount).forEach {
|
||||
try {
|
||||
val color = primaryClip!!.getItemAt(it).text.toString()
|
||||
if (color.isColor()) {
|
||||
colorClipboard.add(color)
|
||||
}
|
||||
} catch (ex: Exception) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels.settings
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
@ -1,4 +1,4 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels.settings
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
@ -1,4 +1,4 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels.tabs
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
@ -1,11 +1,9 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels.tabs
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.ResolveInfo
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
@ -1,4 +1,4 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels.tabs
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
@ -1,4 +1,4 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels.tabs
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
@ -1,4 +1,4 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels.tabs
|
||||
|
||||
import android.app.Application
|
||||
import android.content.pm.ApplicationInfo
|
@ -1,11 +1,9 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels.tabs
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.ResolveInfo
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.*
|
||||
import com.chibatching.kotpref.livedata.asLiveData
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
@ -1,4 +1,4 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels.tabs
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
After Width: | Height: | Size: 135 B |
After Width: | Height: | Size: 135 B |
BIN
app/src/main/res/drawable-night-hdpi/round_switch_left_24.png
Normal file
After Width: | Height: | Size: 249 B |
After Width: | Height: | Size: 100 B |
After Width: | Height: | Size: 100 B |
BIN
app/src/main/res/drawable-night-mdpi/round_switch_left_24.png
Normal file
After Width: | Height: | Size: 186 B |
After Width: | Height: | Size: 144 B |
After Width: | Height: | Size: 144 B |
BIN
app/src/main/res/drawable-night-xhdpi/round_switch_left_24.png
Normal file
After Width: | Height: | Size: 307 B |
After Width: | Height: | Size: 219 B |
After Width: | Height: | Size: 219 B |
BIN
app/src/main/res/drawable-night-xxhdpi/round_switch_left_24.png
Normal file
After Width: | Height: | Size: 398 B |
After Width: | Height: | Size: 275 B |
After Width: | Height: | Size: 275 B |
BIN
app/src/main/res/drawable-night-xxxhdpi/round_switch_left_24.png
Normal file
After Width: | Height: | Size: 524 B |
10
app/src/main/res/drawable/round_android_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71s-0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z"/>
|
||||
</vector>
|
10
app/src/main/res/drawable/round_horizontal_split_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M4,19h16c0.55,0 1,-0.45 1,-1v-4c0,-0.55 -0.45,-1 -1,-1L4,13c-0.55,0 -1,0.45 -1,1v4c0,0.55 0.45,1 1,1zM4,11h16c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L4,9c-0.55,0 -1,0.45 -1,1s0.45,1 1,1zM3,6c0,0.55 0.45,1 1,1h16c0.55,0 1,-0.45 1,-1s-0.45,-1 -1,-1L4,5c-0.55,0 -1,0.45 -1,1z"/>
|
||||
</vector>
|
10
app/src/main/res/drawable/round_switch_left_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M8.5,8.62v6.76L5.12,12L8.5,8.62M3.71,11.29c-0.39,0.39 -0.39,1.02 0,1.41l4.59,4.59C8.92,17.92 10,17.48 10,16.59V7.41c0,-0.89 -1.08,-1.34 -1.71,-0.71L3.71,11.29zM14,7.41v9.17c0,0.89 1.08,1.34 1.71,0.71l4.59,-4.59c0.39,-0.39 0.39,-1.02 0,-1.41l-4.59,-4.59C15.08,6.08 14,6.52 14,7.41z"/>
|
||||
</vector>
|
@ -3,7 +3,7 @@
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.AppNotificationsViewModel" />
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.AppNotificationsViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -3,7 +3,7 @@
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.ChooseApplicationViewModel" />
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.ChooseApplicationViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -4,7 +4,7 @@
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.CustomDateViewModel" />
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.CustomDateViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -3,7 +3,7 @@
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.CustomFontViewModel" />
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.CustomFontViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -3,7 +3,7 @@
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.CustomLocationViewModel" />
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.CustomLocationViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -3,7 +3,7 @@
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.IntegrationsViewModel" />
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.settings.IntegrationsViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -3,7 +3,7 @@
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.MusicPlayersFilterViewModel" />
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.MusicPlayersFilterViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -4,7 +4,7 @@
|
||||
<data>
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.CustomLocationViewModel" />
|
||||
type="com.tommasoberlose.anotherwidget.ui.viewmodels.tabs.CustomLocationViewModel" />
|
||||
</data>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
@ -119,10 +119,10 @@
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="4dp"
|
||||
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
|
||||
app:cardCornerRadius="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:cardBackgroundColor="@color/colorPrimary"
|
||||
app:cardBackgroundColor="@color/cardBorder"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:cardElevation="0dp">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@ -132,8 +132,8 @@
|
||||
android:textSize="12sp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Button"
|
||||
android:text="@string/settings_subtitle_dark_theme_dark"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
@ -145,6 +145,7 @@
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:visibility="@{is24Format ? View.GONE : View.VISIBLE, default=visible}"
|
||||
android:textAppearance="@style/AnotherWidget.Settings.Header" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -47,8 +47,8 @@
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/round_code_24"
|
||||
android:padding="11dp"
|
||||
android:src="@drawable/round_switch_left_24"
|
||||
app:tint="@color/colorPrimaryText"/>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
|
@ -15,15 +15,77 @@
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/scrollView"
|
||||
android:scrollbarThumbVertical="@color/colorPrimary">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="48dp"
|
||||
android:layoutAnimation="@anim/layout_animation_fall_down"
|
||||
android:id="@+id/providers_list" />
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/header"
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/providers"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:textAppearance="@style/AnotherWidget.Settings.Header" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="@string/settings_sort_glance_providers_subtitle"
|
||||
android:textAppearance="@style/AnotherWidget.Settings.SubHeader"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:alpha="0"
|
||||
android:id="@+id/list_container"
|
||||
android:orientation="vertical">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:id="@+id/providers_list" />
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/footer"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/outline_info_24"
|
||||
app:tint="@color/colorSecondaryText"/>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:duplicateParentState="true"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:text="@string/glance_info"
|
||||
android:textColor="@color/colorSecondaryText"
|
||||
android:letterSpacing="0"
|
||||
android:fontFamily="@font/google_sans"
|
||||
android:textAppearance="@style/AnotherWidget.Settings.Subtitle"
|
||||
app:textAllCaps="false" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</com.tommasoberlose.anotherwidget.components.FixedFocusScrollView>
|
||||
</layout>
|
@ -46,7 +46,7 @@
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/round_format_line_spacing"
|
||||
android:src="@drawable/round_horizontal_split_24"
|
||||
app:tint="@color/colorPrimaryText" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -201,10 +201,10 @@
|
||||
<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}"
|
||||
app:cardCornerRadius="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:cardBackgroundColor="@color/cardBorder"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:cardElevation="0dp">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@ -214,8 +214,8 @@
|
||||
android:textSize="12sp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Button"
|
||||
android:text="@string/settings_subtitle_dark_theme_dark"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
@ -149,44 +149,27 @@
|
||||
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"
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
|
||||
app:cardCornerRadius="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:cardBackgroundColor="@color/cardBorder"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:cardElevation="0dp">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
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>
|
||||
android:textColor="@color/colorPrimaryText"
|
||||
android:textSize="12sp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Button"
|
||||
android:text="@string/settings_subtitle_dark_theme_dark"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
@ -270,44 +253,27 @@
|
||||
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"
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
|
||||
app:cardCornerRadius="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:cardBackgroundColor="@color/cardBorder"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:cardElevation="0dp">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
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>
|
||||
android:textColor="@color/colorPrimaryText"
|
||||
android:textSize="12sp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Button"
|
||||
android:text="@string/settings_subtitle_dark_theme_dark"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
@ -354,45 +320,27 @@
|
||||
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:visibility="invisible"
|
||||
android:src="@drawable/round_texture_24"
|
||||
app:tint="@color/colorPrimaryText"/>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:visibility="@{isDarkModeEnabled ? View.VISIBLE : View.GONE}"
|
||||
app:cardCornerRadius="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:cardBackgroundColor="@color/cardBorder"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:cardElevation="0dp">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
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>
|
||||
android:textColor="@color/colorPrimaryText"
|
||||
android:textSize="12sp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
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"
|
||||
|
@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/header"
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/providers"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:textAppearance="@style/AnotherWidget.Settings.Header" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="@string/settings_sort_glance_providers_subtitle"
|
||||
android:textAppearance="@style/AnotherWidget.Settings.SubHeader"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/footer"
|
||||
android:padding="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/outline_info_24"
|
||||
app:tint="@color/colorSecondaryText"/>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:duplicateParentState="true"
|
||||
android:layout_marginTop="8dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:text="@string/glance_info"
|
||||
android:textColor="@color/colorSecondaryText"
|
||||
android:letterSpacing="0"
|
||||
android:fontFamily="@font/google_sans"
|
||||
android:textAppearance="@style/AnotherWidget.Settings.Subtitle"
|
||||
app:textAllCaps="false" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|