mirror of
https://github.com/binwiederhier/ntfy-android.git
synced 2024-05-17 11:02:36 +12:00
Merge f9232c6857
into c15efff72c
This commit is contained in:
commit
10ad0076d2
|
@ -1,6 +1,7 @@
|
|||
package io.heckel.ntfy.app
|
||||
|
||||
import android.app.Application
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import io.heckel.ntfy.db.Repository
|
||||
import io.heckel.ntfy.util.Log
|
||||
|
||||
|
@ -12,4 +13,9 @@ class Application : Application() {
|
|||
}
|
||||
repository
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||
super.onCreate()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.os.Build
|
|||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import io.heckel.ntfy.R
|
||||
import io.heckel.ntfy.db.*
|
||||
import io.heckel.ntfy.db.Notification
|
||||
|
@ -95,7 +94,7 @@ class NotificationService(val context: Context) {
|
|||
(repository.getInsistentMaxPriorityEnabled() || subscription.insistent == Repository.INSISTENT_MAX_PRIORITY_ENABLED)
|
||||
val builder = NotificationCompat.Builder(context, channelId)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setColor(ContextCompat.getColor(context, Colors.notificationIcon(context)))
|
||||
.setColor(Colors.notificationIcon(context))
|
||||
.setContentTitle(title)
|
||||
.setOnlyAlertOnce(true) // Do not vibrate or play sound if already showing (updates!)
|
||||
.setAutoCancel(true) // Cancel when notification is clicked
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.os.IBinder
|
|||
import android.os.PowerManager
|
||||
import android.os.SystemClock
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import io.heckel.ntfy.BuildConfig
|
||||
import io.heckel.ntfy.R
|
||||
import io.heckel.ntfy.app.Application
|
||||
|
@ -291,7 +290,7 @@ class SubscriberService : Service() {
|
|||
}
|
||||
return NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
|
||||
.setSmallIcon(R.drawable.ic_notification_instant)
|
||||
.setColor(ContextCompat.getColor(this, Colors.notificationIcon(this)))
|
||||
.setColor(Colors.notificationIcon(this))
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setContentIntent(pendingIntent)
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.view.inputmethod.InputMethodManager
|
|||
import android.widget.*
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import io.heckel.ntfy.BuildConfig
|
||||
|
@ -144,7 +145,7 @@ class AddFragment : DialogFragment() {
|
|||
loginPasswordText.addTextChangedListener(loginTextWatcher)
|
||||
|
||||
// Build dialog
|
||||
val dialog = AlertDialog.Builder(activity)
|
||||
val dialog = MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(view)
|
||||
.setPositiveButton(R.string.add_dialog_button_subscribe) { _, _ ->
|
||||
// This will be overridden below to avoid closing the dialog immediately
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package io.heckel.ntfy.ui
|
||||
|
||||
import androidx.preference.EditTextPreference
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import io.heckel.ntfy.R
|
||||
|
||||
abstract class BasePreferenceFragment : PreferenceFragmentCompat() {
|
||||
/**
|
||||
* Show [ListPreference] and [EditTextPreference] dialog by [MaterialAlertDialogBuilder]
|
||||
*/
|
||||
override fun onDisplayPreferenceDialog(preference: Preference) {
|
||||
when (preference) {
|
||||
is ListPreference -> {
|
||||
val prefIndex = preference.entryValues.indexOf(preference.value)
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(preference.title)
|
||||
.setSingleChoiceItems(preference.entries, prefIndex) { dialog, index ->
|
||||
val newValue = preference.entryValues[index].toString()
|
||||
if (preference.callChangeListener(newValue)) {
|
||||
preference.value = newValue
|
||||
}
|
||||
dialog.dismiss()
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show()
|
||||
}
|
||||
is EditTextPreference -> {
|
||||
val view = layoutInflater.inflate(R.layout.dialog_edit_text_preference, null)
|
||||
val editText = view.findViewById<TextInputEditText>(R.id.editText)
|
||||
editText.setText(preference.text.toString())
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(preference.title)
|
||||
.setView(view)
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
val newValue = editText.text.toString()
|
||||
if (preference.callChangeListener(newValue)) {
|
||||
preference.text = newValue
|
||||
}
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show()
|
||||
}
|
||||
else -> super.onDisplayPreferenceDialog(preference)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,48 +1,45 @@
|
|||
package io.heckel.ntfy.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.google.android.material.color.MaterialColors
|
||||
import com.google.android.material.elevation.SurfaceColors
|
||||
import io.heckel.ntfy.R
|
||||
import io.heckel.ntfy.util.isDarkThemeOn
|
||||
|
||||
class Colors {
|
||||
companion object {
|
||||
const val refreshProgressIndicator = R.color.teal
|
||||
|
||||
fun notificationIcon(context: Context): Int {
|
||||
return if (isDarkThemeOn(context)) R.color.teal_light else R.color.teal
|
||||
return MaterialColors.getColor(context, R.attr.colorPrimary, Color.GREEN)
|
||||
}
|
||||
|
||||
fun itemSelectedBackground(context: Context): Int {
|
||||
return if (isDarkThemeOn(context)) R.color.black_800b else R.color.gray_400
|
||||
}
|
||||
|
||||
fun cardBackground(context: Context): Int {
|
||||
return if (isDarkThemeOn(context)) R.color.black_800b else R.color.white
|
||||
}
|
||||
|
||||
fun cardSelectedBackground(context: Context): Int {
|
||||
return if (isDarkThemeOn(context)) R.color.black_700b else R.color.gray_500
|
||||
return SurfaceColors.getColorForElevation(context, 10f)
|
||||
}
|
||||
|
||||
fun cardBackgroundColor(context: Context): Int {
|
||||
return ContextCompat.getColor(context, cardBackground(context))
|
||||
return SurfaceColors.getColorForElevation(context, 5f)
|
||||
}
|
||||
|
||||
fun cardSelectedBackgroundColor(context: Context): Int {
|
||||
return ContextCompat.getColor(context, cardSelectedBackground(context))
|
||||
return SurfaceColors.getColorForElevation(context, 20f)
|
||||
}
|
||||
|
||||
fun statusBarNormal(context: Context): Int {
|
||||
return if (isDarkThemeOn(context)) R.color.black_900 else R.color.teal
|
||||
return MaterialColors.getColor(context, R.attr.backgroundColor, Color.BLACK)
|
||||
}
|
||||
|
||||
fun statusBarActionMode(context: Context): Int {
|
||||
return if (isDarkThemeOn(context)) R.color.black_900 else R.color.teal_dark
|
||||
return MaterialColors.getColor(context, R.attr.backgroundColor, Color.BLACK)
|
||||
}
|
||||
|
||||
fun dangerText(context: Context): Int {
|
||||
return if (isDarkThemeOn(context)) R.color.red_light else R.color.red_dark
|
||||
return MaterialColors.getColor(context, R.attr.colorError, Color.RED)
|
||||
}
|
||||
|
||||
fun swipeToRefreshColor(context: Context): Int {
|
||||
return MaterialColors.getColor(context, R.attr.colorPrimary, Color.GREEN)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import androidx.lifecycle.lifecycleScope
|
|||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import io.heckel.ntfy.BuildConfig
|
||||
import io.heckel.ntfy.R
|
||||
|
@ -190,7 +191,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra
|
|||
// Swipe to refresh
|
||||
mainListContainer = findViewById(R.id.detail_notification_list_container)
|
||||
mainListContainer.setOnRefreshListener { refresh() }
|
||||
mainListContainer.setColorSchemeResources(Colors.refreshProgressIndicator)
|
||||
mainListContainer.setColorSchemeColors(Colors.swipeToRefreshColor(this))
|
||||
|
||||
// Update main list based on viewModel (& its datasource/livedata)
|
||||
val noEntriesText: View = findViewById(R.id.detail_no_notifications)
|
||||
|
@ -568,8 +569,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra
|
|||
private fun onClearClick() {
|
||||
Log.d(TAG, "Clearing all notifications for ${topicShortUrl(subscriptionBaseUrl, subscriptionTopic)}")
|
||||
|
||||
val builder = AlertDialog.Builder(this)
|
||||
val dialog = builder
|
||||
val dialog = MaterialAlertDialogBuilder(this)
|
||||
.setMessage(R.string.detail_clear_dialog_message)
|
||||
.setPositiveButton(R.string.detail_clear_dialog_permanently_delete) { _, _ ->
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
|
@ -600,8 +600,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra
|
|||
private fun onDeleteClick() {
|
||||
Log.d(TAG, "Deleting subscription ${topicShortUrl(subscriptionBaseUrl, subscriptionTopic)}")
|
||||
|
||||
val builder = AlertDialog.Builder(this)
|
||||
val dialog = builder
|
||||
val dialog = MaterialAlertDialogBuilder(this)
|
||||
.setMessage(R.string.detail_delete_dialog_message)
|
||||
.setPositiveButton(R.string.detail_delete_dialog_permanently_delete) { _, _ ->
|
||||
Log.d(TAG, "Deleting subscription with subscription ID $subscriptionId (topic: $subscriptionTopic)")
|
||||
|
@ -716,8 +715,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra
|
|||
private fun onMultiDeleteClick() {
|
||||
Log.d(TAG, "Showing multi-delete dialog for selected items")
|
||||
|
||||
val builder = AlertDialog.Builder(this)
|
||||
val dialog = builder
|
||||
val dialog = MaterialAlertDialogBuilder(this)
|
||||
.setMessage(R.string.detail_action_mode_delete_dialog_message)
|
||||
.setPositiveButton(R.string.detail_action_mode_delete_dialog_permanently_delete) { _, _ ->
|
||||
adapter.selected.map { notificationId -> viewModel.markAsDeleted(notificationId) }
|
||||
|
@ -744,9 +742,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra
|
|||
adapter.toggleSelection(notification.id)
|
||||
|
||||
// Fade status bar color
|
||||
val fromColor = ContextCompat.getColor(this, Colors.statusBarNormal(this))
|
||||
val toColor = ContextCompat.getColor(this, Colors.statusBarActionMode(this))
|
||||
fadeStatusBarColor(window, fromColor, toColor)
|
||||
fadeStatusBarColor(window, Colors.statusBarNormal(this), Colors.statusBarActionMode(this))
|
||||
}
|
||||
|
||||
private fun finishActionMode() {
|
||||
|
@ -760,9 +756,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra
|
|||
adapter.notifyItemRangeChanged(0, adapter.currentList.size)
|
||||
|
||||
// Fade status bar color
|
||||
val fromColor = ContextCompat.getColor(this, Colors.statusBarActionMode(this))
|
||||
val toColor = ContextCompat.getColor(this, Colors.statusBarNormal(this))
|
||||
fadeStatusBarColor(window, fromColor, toColor)
|
||||
fadeStatusBarColor(window, Colors.statusBarActionMode(this), Colors.statusBarNormal(this))
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -137,7 +137,7 @@ class DetailSettingsActivity : AppCompatActivity() {
|
|||
private fun loadInstantPref() {
|
||||
val appBaseUrl = getString(R.string.app_base_url)
|
||||
val prefId = context?.getString(R.string.detail_settings_notifications_instant_key) ?: return
|
||||
val pref: SwitchPreference? = findPreference(prefId)
|
||||
val pref: SwitchPreferenceCompat? = findPreference(prefId)
|
||||
pref?.isVisible = BuildConfig.FIREBASE_AVAILABLE && subscription.baseUrl == appBaseUrl
|
||||
pref?.isChecked = subscription.instant
|
||||
pref?.preferenceDataStore = object : PreferenceDataStore() {
|
||||
|
@ -148,7 +148,7 @@ class DetailSettingsActivity : AppCompatActivity() {
|
|||
return subscription.instant
|
||||
}
|
||||
}
|
||||
pref?.summaryProvider = Preference.SummaryProvider<SwitchPreference> { preference ->
|
||||
pref?.summaryProvider = Preference.SummaryProvider<SwitchPreferenceCompat> { preference ->
|
||||
if (preference.isChecked) {
|
||||
getString(R.string.detail_settings_notifications_instant_summary_on)
|
||||
} else {
|
||||
|
@ -159,7 +159,7 @@ class DetailSettingsActivity : AppCompatActivity() {
|
|||
|
||||
private fun loadDedicatedChannelsPrefs() {
|
||||
val prefId = context?.getString(R.string.detail_settings_notifications_dedicated_channels_key) ?: return
|
||||
val pref: SwitchPreference? = findPreference(prefId)
|
||||
val pref: SwitchPreferenceCompat? = findPreference(prefId)
|
||||
pref?.isVisible = true
|
||||
pref?.isChecked = subscription.dedicatedChannels
|
||||
pref?.preferenceDataStore = object : PreferenceDataStore() {
|
||||
|
@ -176,7 +176,7 @@ class DetailSettingsActivity : AppCompatActivity() {
|
|||
return subscription.dedicatedChannels
|
||||
}
|
||||
}
|
||||
pref?.summaryProvider = Preference.SummaryProvider<SwitchPreference> { preference ->
|
||||
pref?.summaryProvider = Preference.SummaryProvider<SwitchPreferenceCompat> { preference ->
|
||||
if (preference.isChecked) {
|
||||
getString(R.string.detail_settings_notifications_dedicated_channels_summary_on)
|
||||
} else {
|
||||
|
|
|
@ -28,6 +28,7 @@ import androidx.lifecycle.lifecycleScope
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import androidx.work.*
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
import io.heckel.ntfy.BuildConfig
|
||||
import io.heckel.ntfy.R
|
||||
|
@ -96,7 +97,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc
|
|||
// Swipe to refresh
|
||||
mainListContainer = findViewById(R.id.main_subscriptions_list_container)
|
||||
mainListContainer.setOnRefreshListener { refreshAllSubscriptions() }
|
||||
mainListContainer.setColorSchemeResources(Colors.refreshProgressIndicator)
|
||||
mainListContainer.setColorSchemeColors(Colors.swipeToRefreshColor(this))
|
||||
|
||||
// Update main list based on viewModel (& its datasource/livedata)
|
||||
val noEntries: View = findViewById(R.id.main_no_subscriptions)
|
||||
|
@ -608,8 +609,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc
|
|||
private fun onMultiDeleteClick() {
|
||||
Log.d(DetailActivity.TAG, "Showing multi-delete dialog for selected items")
|
||||
|
||||
val builder = AlertDialog.Builder(this)
|
||||
val dialog = builder
|
||||
val dialog = MaterialAlertDialogBuilder(this)
|
||||
.setMessage(R.string.main_action_mode_delete_dialog_message)
|
||||
.setPositiveButton(R.string.main_action_mode_delete_dialog_permanently_delete) { _, _ ->
|
||||
adapter.selected.map { subscriptionId -> viewModel.remove(this, subscriptionId) }
|
||||
|
@ -648,9 +648,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc
|
|||
})
|
||||
|
||||
// Fade status bar color
|
||||
val fromColor = ContextCompat.getColor(this, Colors.statusBarNormal(this))
|
||||
val toColor = ContextCompat.getColor(this, Colors.statusBarActionMode(this))
|
||||
fadeStatusBarColor(window, fromColor, toColor)
|
||||
fadeStatusBarColor(window, Colors.statusBarNormal(this), Colors.statusBarActionMode(this))
|
||||
}
|
||||
|
||||
private fun finishActionMode() {
|
||||
|
@ -677,9 +675,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc
|
|||
})
|
||||
|
||||
// Fade status bar color
|
||||
val fromColor = ContextCompat.getColor(this, Colors.statusBarActionMode(this))
|
||||
val toColor = ContextCompat.getColor(this, Colors.statusBarNormal(this))
|
||||
fadeStatusBarColor(window, fromColor, toColor)
|
||||
fadeStatusBarColor(window, Colors.statusBarActionMode(this), Colors.statusBarNormal(this))
|
||||
}
|
||||
|
||||
private fun redrawList() {
|
||||
|
|
|
@ -115,7 +115,7 @@ class MainAdapter(private val repository: Repository, private val onClick: (Subs
|
|||
itemView.setOnClickListener { onClick(subscription) }
|
||||
itemView.setOnLongClickListener { onLongClick(subscription); true }
|
||||
if (selected.contains(subscription.id)) {
|
||||
itemView.setBackgroundResource(Colors.itemSelectedBackground(context))
|
||||
itemView.setBackgroundColor(Colors.itemSelectedBackground(context))
|
||||
} else {
|
||||
itemView.setBackgroundColor(Color.TRANSPARENT)
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.os.Bundle
|
|||
import android.widget.RadioButton
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import io.heckel.ntfy.R
|
||||
import io.heckel.ntfy.db.Repository
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -74,7 +75,7 @@ class NotificationFragment : DialogFragment() {
|
|||
muteForeverButton = view.findViewById(R.id.notification_dialog_forever)
|
||||
muteForeverButton.setOnClickListener{ onClick(Repository.MUTED_UNTIL_FOREVER) }
|
||||
|
||||
return AlertDialog.Builder(activity)
|
||||
return MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(view)
|
||||
.create()
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import androidx.fragment.app.DialogFragment
|
|||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.*
|
||||
import androidx.preference.Preference.OnPreferenceClickListener
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.gson.Gson
|
||||
import io.heckel.ntfy.BuildConfig
|
||||
import io.heckel.ntfy.R
|
||||
|
@ -119,7 +120,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
return true
|
||||
}
|
||||
|
||||
class SettingsFragment : PreferenceFragmentCompat() {
|
||||
class SettingsFragment : BasePreferenceFragment() {
|
||||
private lateinit var repository: Repository
|
||||
private lateinit var serviceManager: SubscriberServiceManager
|
||||
private var autoDownloadSelection = AUTO_DOWNLOAD_SELECTION_NOT_SET
|
||||
|
@ -202,7 +203,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
|
||||
// Keep alerting for max priority
|
||||
val insistentMaxPriorityPrefId = context?.getString(R.string.settings_notifications_insistent_max_priority_key) ?: return
|
||||
val insistentMaxPriority: SwitchPreference? = findPreference(insistentMaxPriorityPrefId)
|
||||
val insistentMaxPriority: SwitchPreferenceCompat? = findPreference(insistentMaxPriorityPrefId)
|
||||
insistentMaxPriority?.isChecked = repository.getInsistentMaxPriorityEnabled()
|
||||
insistentMaxPriority?.preferenceDataStore = object : PreferenceDataStore() {
|
||||
override fun putBoolean(key: String?, value: Boolean) {
|
||||
|
@ -212,7 +213,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
return repository.getInsistentMaxPriorityEnabled()
|
||||
}
|
||||
}
|
||||
insistentMaxPriority?.summaryProvider = Preference.SummaryProvider<SwitchPreference> { pref ->
|
||||
insistentMaxPriority?.summaryProvider = Preference.SummaryProvider<SwitchPreferenceCompat> { pref ->
|
||||
if (pref.isChecked) {
|
||||
getString(R.string.settings_notifications_insistent_max_priority_summary_enabled)
|
||||
} else {
|
||||
|
@ -346,7 +347,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
|
||||
// Broadcast enabled
|
||||
val broadcastEnabledPrefId = context?.getString(R.string.settings_advanced_broadcast_key) ?: return
|
||||
val broadcastEnabled: SwitchPreference? = findPreference(broadcastEnabledPrefId)
|
||||
val broadcastEnabled: SwitchPreferenceCompat? = findPreference(broadcastEnabledPrefId)
|
||||
broadcastEnabled?.isChecked = repository.getBroadcastEnabled()
|
||||
broadcastEnabled?.preferenceDataStore = object : PreferenceDataStore() {
|
||||
override fun putBoolean(key: String?, value: Boolean) {
|
||||
|
@ -356,7 +357,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
return repository.getBroadcastEnabled()
|
||||
}
|
||||
}
|
||||
broadcastEnabled?.summaryProvider = Preference.SummaryProvider<SwitchPreference> { pref ->
|
||||
broadcastEnabled?.summaryProvider = Preference.SummaryProvider<SwitchPreferenceCompat> { pref ->
|
||||
if (pref.isChecked) {
|
||||
getString(R.string.settings_advanced_broadcast_summary_enabled)
|
||||
} else {
|
||||
|
@ -366,7 +367,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
|
||||
// Enable UnifiedPush
|
||||
val unifiedPushEnabledPrefId = context?.getString(R.string.settings_advanced_unifiedpush_key) ?: return
|
||||
val unifiedPushEnabled: SwitchPreference? = findPreference(unifiedPushEnabledPrefId)
|
||||
val unifiedPushEnabled: SwitchPreferenceCompat? = findPreference(unifiedPushEnabledPrefId)
|
||||
unifiedPushEnabled?.isChecked = repository.getUnifiedPushEnabled()
|
||||
unifiedPushEnabled?.preferenceDataStore = object : PreferenceDataStore() {
|
||||
override fun putBoolean(key: String?, value: Boolean) {
|
||||
|
@ -376,7 +377,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
return repository.getUnifiedPushEnabled()
|
||||
}
|
||||
}
|
||||
unifiedPushEnabled?.summaryProvider = Preference.SummaryProvider<SwitchPreference> { pref ->
|
||||
unifiedPushEnabled?.summaryProvider = Preference.SummaryProvider<SwitchPreferenceCompat> { pref ->
|
||||
if (pref.isChecked) {
|
||||
getString(R.string.settings_advanced_unifiedpush_summary_enabled)
|
||||
} else {
|
||||
|
@ -411,7 +412,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
|
||||
// Record logs
|
||||
val recordLogsPrefId = context?.getString(R.string.settings_advanced_record_logs_key) ?: return
|
||||
val recordLogsEnabled: SwitchPreference? = findPreference(recordLogsPrefId)
|
||||
val recordLogsEnabled: SwitchPreferenceCompat? = findPreference(recordLogsPrefId)
|
||||
recordLogsEnabled?.isChecked = Log.getRecord()
|
||||
recordLogsEnabled?.preferenceDataStore = object : PreferenceDataStore() {
|
||||
override fun putBoolean(key: String?, value: Boolean) {
|
||||
|
@ -424,7 +425,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
return Log.getRecord()
|
||||
}
|
||||
}
|
||||
recordLogsEnabled?.summaryProvider = Preference.SummaryProvider<SwitchPreference> { pref ->
|
||||
recordLogsEnabled?.summaryProvider = Preference.SummaryProvider<SwitchPreferenceCompat> { pref ->
|
||||
if (pref.isChecked) {
|
||||
getString(R.string.settings_advanced_record_logs_summary_enabled)
|
||||
} else {
|
||||
|
@ -658,7 +659,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
} else {
|
||||
getString(R.string.settings_advanced_export_logs_scrub_dialog_empty)
|
||||
}
|
||||
val dialog = AlertDialog.Builder(activity)
|
||||
val dialog = MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(title)
|
||||
.setMessage(scrubbedText)
|
||||
.setPositiveButton(R.string.settings_advanced_export_logs_scrub_dialog_button_ok) { _, _ -> /* Nothing */ }
|
||||
|
@ -682,7 +683,7 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
data class NopasteResponse(val url: String)
|
||||
}
|
||||
|
||||
class UserSettingsFragment : PreferenceFragmentCompat() {
|
||||
class UserSettingsFragment : BasePreferenceFragment() {
|
||||
private lateinit var repository: Repository
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.view.WindowManager
|
|||
import android.widget.Button
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import io.heckel.ntfy.R
|
||||
import io.heckel.ntfy.db.User
|
||||
|
@ -75,7 +76,7 @@ class UserFragment : DialogFragment() {
|
|||
}
|
||||
|
||||
// Build dialog
|
||||
val builder = AlertDialog.Builder(activity)
|
||||
val builder = MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(view)
|
||||
.setPositiveButton(positiveButtonTextResId) { _, _ ->
|
||||
saveClicked()
|
||||
|
|
|
@ -501,7 +501,7 @@ fun Button.dangerButton(context: Context) {
|
|||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
setTextAppearance(R.style.DangerText)
|
||||
} else {
|
||||
setTextColor(ContextCompat.getColor(context, Colors.dangerText(context)))
|
||||
setTextColor(Colors.dangerText(context))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:hint="@string/share_content_text_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="?attr/colorPrimary"
|
||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
|
||||
android:lines="10" android:gravity="start|top" app:layout_constraintTop_toBottomOf="@id/share_content_image" android:minLines="1" android:layout_marginTop="5dp"/>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
@ -86,6 +87,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:hint="@string/add_dialog_topic_name_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="?attr/colorPrimary"
|
||||
android:maxLines="1" android:inputType="text|textNoSuggestions" android:maxLength="64"
|
||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/share_topic_title" android:layout_marginStart="-3dp"/>
|
||||
|
|
19
app/src/main/res/layout/dialog_edit_text_preference.xml
Normal file
19
app/src/main/res/layout/dialog_edit_text_preference.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="?dialogPreferredPadding">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="?dialogPreferredPadding">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -47,6 +47,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:hint="@string/add_dialog_topic_name_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="?attr/colorPrimary"
|
||||
android:maxLines="1" android:inputType="text" android:maxLength="64"
|
||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/add_dialog_subscribe_description"/>
|
||||
|
@ -187,6 +188,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:hint="@string/add_dialog_login_username_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="?attr/colorPrimary"
|
||||
android:maxLines="1" android:inputType="text" android:maxLength="64"
|
||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="10dp" app:layout_constraintTop_toBottomOf="@+id/add_dialog_login_description"/>
|
||||
|
@ -195,6 +197,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:hint="@string/add_dialog_login_password_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="?attr/colorPrimary"
|
||||
android:maxLines="1" android:inputType="textPassword" app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/add_dialog_login_username"/>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:hint="@string/user_dialog_base_url_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="?attr/colorPrimary"
|
||||
android:maxLines="1" android:inputType="text"
|
||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="6dp" app:layout_constraintTop_toBottomOf="@id/user_dialog_description"/>
|
||||
|
@ -40,6 +41,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:hint="@string/user_dialog_username_hint"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="?attr/colorPrimary"
|
||||
android:maxLines="1" android:inputType="text"
|
||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="6dp" app:layout_constraintTop_toBottomOf="@id/user_dialog_base_url"/>
|
||||
|
@ -48,6 +50,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" android:hint="@string/user_dialog_password_hint_add"
|
||||
android:importantForAutofill="no"
|
||||
android:backgroundTint="?attr/colorPrimary"
|
||||
android:maxLines="1" android:inputType="textPassword"
|
||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="6dp" app:layout_constraintTop_toBottomOf="@id/user_dialog_username"/>
|
||||
|
|
5
app/src/main/res/layout/view_preference_switch.xml
Normal file
5
app/src/main/res/layout/view_preference_switch.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.materialswitch.MaterialSwitch xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/switchWidget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
33
app/src/main/res/values-night/colors.xml
Normal file
33
app/src/main/res/values-night/colors.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="md_theme_primary">#5ADBC0</color>
|
||||
<color name="md_theme_onPrimary">#00382E</color>
|
||||
<color name="md_theme_primaryContainer">#005144</color>
|
||||
<color name="md_theme_onPrimaryContainer">#79F8DC</color>
|
||||
<color name="md_theme_secondary">#B1CCC4</color>
|
||||
<color name="md_theme_onSecondary">#1D352F</color>
|
||||
<color name="md_theme_secondaryContainer">#334B45</color>
|
||||
<color name="md_theme_onSecondaryContainer">#CDE8DF</color>
|
||||
<color name="md_theme_tertiary">#AACBE4</color>
|
||||
<color name="md_theme_onTertiary">#113447</color>
|
||||
<color name="md_theme_tertiaryContainer">#2A4A5F</color>
|
||||
<color name="md_theme_onTertiaryContainer">#C8E6FF</color>
|
||||
<color name="md_theme_error">#FFB4AB</color>
|
||||
<color name="md_theme_errorContainer">#93000A</color>
|
||||
<color name="md_theme_onError">#690005</color>
|
||||
<color name="md_theme_onErrorContainer">#FFDAD6</color>
|
||||
<color name="md_theme_background">#191C1B</color>
|
||||
<color name="md_theme_onBackground">#E0E3E1</color>
|
||||
<color name="md_theme_surface">#191C1B</color>
|
||||
<color name="md_theme_onSurface">#E0E3E1</color>
|
||||
<color name="md_theme_surfaceVariant">#3F4946</color>
|
||||
<color name="md_theme_onSurfaceVariant">#BFC9C4</color>
|
||||
<color name="md_theme_outline">#89938F</color>
|
||||
<color name="md_theme_inverseOnSurface">#191C1B</color>
|
||||
<color name="md_theme_inverseSurface">#E0E3E1</color>
|
||||
<color name="md_theme_inversePrimary">#006B5B</color>
|
||||
<color name="md_theme_shadow">#000000</color>
|
||||
<color name="md_theme_surfaceTint">#5ADBC0</color>
|
||||
<color name="md_theme_outlineVariant">#3F4946</color>
|
||||
<color name="md_theme_scrim">#000000</color>
|
||||
</resources>
|
|
@ -1,4 +1,4 @@
|
|||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!--
|
||||
This file contains only overrides for the dark theme.
|
||||
Also see "ui/Colors.kt" for colors that have to be defined in code.
|
||||
|
@ -10,32 +10,7 @@
|
|||
- https://developer.android.com/guide/topics/ui/look-and-feel/themes
|
||||
-->
|
||||
|
||||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<item name="colorPrimary">@color/teal_light</item>
|
||||
<item name="colorAccent">@color/teal_light</item> <!-- checkboxes, text fields -->
|
||||
<item name="android:colorBackground">@color/black_900</item> <!-- background -->
|
||||
<item name="android:statusBarColor">@color/black_900</item>
|
||||
<item name="actionModeBackground">@color/black_900</item>
|
||||
|
||||
<!-- Action bar background & text color -->
|
||||
<item name="colorSurface">@color/black_800b</item>
|
||||
<item name="colorOnSurface">@color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="DangerText" parent="@android:style/TextAppearance">
|
||||
<item name="android:textColor">@color/red_light</item>
|
||||
</style>
|
||||
|
||||
<style name="FloatingActionButton" parent="@style/Widget.MaterialComponents.FloatingActionButton">
|
||||
<item name="tint">@color/black_900</item>
|
||||
<item name="backgroundTint">@color/teal_light</item>
|
||||
</style>
|
||||
|
||||
<style name="CardView" parent="@style/Widget.MaterialComponents.CardView">
|
||||
<item name="cardBackgroundColor">@color/black_800b</item>
|
||||
</style>
|
||||
|
||||
<style name="CardViewBackground">
|
||||
<item name="android:background">@color/black_900</item>
|
||||
<style name="AppTheme" parent="BaseTheme">
|
||||
<item name="android:windowLightStatusBar" tools:ignore="NewApi">false</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
@ -1,17 +1,34 @@
|
|||
<!--?xml version="1.0" encoding="UTF-8"?-->
|
||||
<resources>
|
||||
<color name="black">#ff000000</color>
|
||||
<color name="black_900">#121212</color> <!-- Main dark mode surface color, as per style guide -->
|
||||
<color name="black_800b">#1b2023</color> <!-- Action bar & item selection (dark mode); this has a touch of blue! -->
|
||||
<color name="black_700b">#282F33</color> <!-- Card selection (dark mode); this has a touch of blue! -->
|
||||
<color name="gray_500">#dddddd</color> <!-- Card selection (light mode) -->
|
||||
<color name="gray_400">#eeeeee</color> <!-- Item selection (light mode) -->
|
||||
<color name="white">#ffffffff</color>
|
||||
|
||||
<color name="teal">#338574</color> <!-- Primary color (light mode) -->
|
||||
<color name="teal_light">#65b5a3</color> <!-- Primary color (dark mode) -->
|
||||
<color name="teal_dark">#2a6e60</color> <!-- Action bar background in action mode (light mode) -->
|
||||
<color name="red_light">#fe4d2e</color> <!-- Danger text (dark mode) -->
|
||||
<color name="red_dark">#c30000</color> <!-- Danger text (light mode) -->
|
||||
<color name="md_theme_primary">#006B5B</color>
|
||||
<color name="md_theme_onPrimary">#FFFFFF</color>
|
||||
<color name="md_theme_primaryContainer">#79F8DC</color>
|
||||
<color name="md_theme_onPrimaryContainer">#00201A</color>
|
||||
<color name="md_theme_secondary">#4B635C</color>
|
||||
<color name="md_theme_onSecondary">#FFFFFF</color>
|
||||
<color name="md_theme_secondaryContainer">#CDE8DF</color>
|
||||
<color name="md_theme_onSecondaryContainer">#06201A</color>
|
||||
<color name="md_theme_tertiary">#436278</color>
|
||||
<color name="md_theme_onTertiary">#FFFFFF</color>
|
||||
<color name="md_theme_tertiaryContainer">#C8E6FF</color>
|
||||
<color name="md_theme_onTertiaryContainer">#001E2E</color>
|
||||
<color name="md_theme_error">#BA1A1A</color>
|
||||
<color name="md_theme_errorContainer">#FFDAD6</color>
|
||||
<color name="md_theme_onError">#FFFFFF</color>
|
||||
<color name="md_theme_onErrorContainer">#410002</color>
|
||||
<color name="md_theme_background">#FAFDFA</color>
|
||||
<color name="md_theme_onBackground">#191C1B</color>
|
||||
<color name="md_theme_surface">#FAFDFA</color>
|
||||
<color name="md_theme_onSurface">#191C1B</color>
|
||||
<color name="md_theme_surfaceVariant">#DBE5E0</color>
|
||||
<color name="md_theme_onSurfaceVariant">#3F4946</color>
|
||||
<color name="md_theme_outline">#6F7976</color>
|
||||
<color name="md_theme_inverseOnSurface">#EFF1EF</color>
|
||||
<color name="md_theme_inverseSurface">#2E3130</color>
|
||||
<color name="md_theme_inversePrimary">#5ADBC0</color>
|
||||
<color name="md_theme_shadow">#000000</color>
|
||||
<color name="md_theme_surfaceTint">#006B5B</color>
|
||||
<color name="md_theme_outlineVariant">#BFC9C4</color>
|
||||
<color name="md_theme_scrim">#000000</color>
|
||||
</resources>
|
||||
|
||||
|
|
|
@ -1,33 +1,67 @@
|
|||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Main app theme; dark theme styles see values-night/styles.xml -->
|
||||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<item name="colorPrimary">@color/teal</item>
|
||||
<item name="colorAccent">@color/teal</item> <!-- checkboxes, text fields -->
|
||||
<item name="android:colorBackground">@color/white</item> <!-- background -->
|
||||
<item name="android:statusBarColor">@color/teal</item>
|
||||
<item name="actionModeBackground">@color/teal_dark</item>
|
||||
<style name="BaseTheme" parent="Theme.Material3.DayNight">
|
||||
<item name="colorPrimary">@color/md_theme_primary</item>
|
||||
<item name="colorOnPrimary">@color/md_theme_onPrimary</item>
|
||||
<item name="colorPrimaryContainer">@color/md_theme_primaryContainer</item>
|
||||
<item name="colorOnPrimaryContainer">@color/md_theme_onPrimaryContainer</item>
|
||||
<item name="colorSecondary">@color/md_theme_secondary</item>
|
||||
<item name="colorOnSecondary">@color/md_theme_onSecondary</item>
|
||||
<item name="colorSecondaryContainer">@color/md_theme_secondaryContainer</item>
|
||||
<item name="colorOnSecondaryContainer">@color/md_theme_onSecondaryContainer</item>
|
||||
<item name="colorTertiary">@color/md_theme_tertiary</item>
|
||||
<item name="colorOnTertiary">@color/md_theme_onTertiary</item>
|
||||
<item name="colorTertiaryContainer">@color/md_theme_tertiaryContainer</item>
|
||||
<item name="colorOnTertiaryContainer">@color/md_theme_onTertiaryContainer</item>
|
||||
<item name="colorError">@color/md_theme_error</item>
|
||||
<item name="colorErrorContainer">@color/md_theme_errorContainer</item>
|
||||
<item name="colorOnError">@color/md_theme_onError</item>
|
||||
<item name="colorOnErrorContainer">@color/md_theme_onErrorContainer</item>
|
||||
<item name="android:colorBackground">@color/md_theme_background</item>
|
||||
<item name="colorOnBackground">@color/md_theme_onBackground</item>
|
||||
<item name="colorSurface">@color/md_theme_surface</item>
|
||||
<item name="colorOnSurface">@color/md_theme_onSurface</item>
|
||||
<item name="colorSurfaceVariant">@color/md_theme_surfaceVariant</item>
|
||||
<item name="colorOnSurfaceVariant">@color/md_theme_onSurfaceVariant</item>
|
||||
<item name="colorOutline">@color/md_theme_outline</item>
|
||||
<item name="colorOnSurfaceInverse">@color/md_theme_inverseOnSurface</item>
|
||||
<item name="colorSurfaceInverse">@color/md_theme_inverseSurface</item>
|
||||
<item name="colorPrimaryInverse">@color/md_theme_inversePrimary</item>
|
||||
|
||||
<item name="switchPreferenceCompatStyle">@style/MaterialSwitch</item>
|
||||
<item name="android:statusBarColor">?colorPrimaryInverse</item>
|
||||
<item name="actionModeBackground">?backgroundColor</item>
|
||||
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
|
||||
<item name="actionBarStyle">@style/ActionBarStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme" parent="BaseTheme">
|
||||
<item name="android:windowLightStatusBar" tools:ignore="NewApi">true</item>
|
||||
</style>
|
||||
|
||||
<style name="DangerText" parent="@android:style/TextAppearance">
|
||||
<item name="android:textColor">@color/red_dark</item>
|
||||
<item name="android:textColor">?attr/colorError</item>
|
||||
</style>
|
||||
|
||||
<style name="FloatingActionButton" parent="@style/Widget.MaterialComponents.FloatingActionButton">
|
||||
<item name="tint">@color/white</item>
|
||||
<item name="backgroundTint">@color/teal</item>
|
||||
</style>
|
||||
<style name="FloatingActionButton" parent="@style/Widget.Material3.FloatingActionButton.Primary" />
|
||||
|
||||
<style name="CardView" parent="@style/Widget.MaterialComponents.CardView">
|
||||
<item name="cardBackgroundColor">@color/white</item>
|
||||
</style>
|
||||
<style name="CardView" parent="@style/Widget.Material3.CardView.Elevated" />
|
||||
|
||||
<style name="CardViewBackground">
|
||||
<item name="android:background">@color/gray_400</item>
|
||||
</style>
|
||||
<style name="CardViewBackground" />
|
||||
|
||||
<!-- Rounded corners in images, see https://stackoverflow.com/a/61960983/1440785 -->
|
||||
<style name="roundedCornersImageView" parent="">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">5dp</item>
|
||||
</style>
|
||||
|
||||
<!-- Material Design 3 switches in the preferences -->
|
||||
<style name="MaterialSwitch" parent="@style/Preference.SwitchPreferenceCompat.Material">
|
||||
<item name="widgetLayout">@layout/view_preference_switch</item>
|
||||
</style>
|
||||
|
||||
<!-- Action bar with custom background color -->
|
||||
<style name="ActionBarStyle" parent="@style/Widget.Material3.ActionBar.Solid">
|
||||
<item name="background">?colorPrimaryInverse</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<PreferenceCategory
|
||||
app:key="@string/detail_settings_notifications_header_key"
|
||||
app:title="@string/settings_notifications_header">
|
||||
<SwitchPreference
|
||||
<SwitchPreferenceCompat
|
||||
app:key="@string/detail_settings_notifications_instant_key"
|
||||
app:title="@string/detail_settings_notifications_instant_title"
|
||||
app:isPreferenceVisible="false"/>
|
||||
|
@ -35,7 +35,7 @@
|
|||
app:entryValues="@array/detail_settings_notifications_insistent_max_priority_values"
|
||||
app:defaultValue="-1"
|
||||
app:isPreferenceVisible="false"/> <!-- Same as Repository.INSISTENT_MAX_PRIORITY_USE_GLOBAL -->
|
||||
<SwitchPreference
|
||||
<SwitchPreferenceCompat
|
||||
app:key="@string/detail_settings_notifications_dedicated_channels_key"
|
||||
app:title="@string/detail_settings_notifications_dedicated_channels_title"
|
||||
app:isPreferenceVisible="false"/>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
app:entries="@array/settings_notifications_auto_delete_entries"
|
||||
app:entryValues="@array/settings_notifications_auto_delete_values"
|
||||
app:defaultValue="2592000"/>
|
||||
<SwitchPreference
|
||||
<SwitchPreferenceCompat
|
||||
app:key="@string/settings_notifications_insistent_max_priority_key"
|
||||
app:title="@string/settings_notifications_insistent_max_priority_title"
|
||||
app:defaultValue="false"/>
|
||||
|
@ -72,15 +72,15 @@
|
|||
app:entries="@array/settings_advanced_connection_protocol_entries"
|
||||
app:entryValues="@array/settings_advanced_connection_protocol_values"
|
||||
app:defaultValue="jsonhttp"/>
|
||||
<SwitchPreference
|
||||
<SwitchPreferenceCompat
|
||||
app:key="@string/settings_advanced_broadcast_key"
|
||||
app:title="@string/settings_advanced_broadcast_title"
|
||||
app:enabled="true"/>
|
||||
<SwitchPreference
|
||||
<SwitchPreferenceCompat
|
||||
app:key="@string/settings_advanced_unifiedpush_key"
|
||||
app:title="@string/settings_advanced_unifiedpush_title"
|
||||
app:enabled="true"/>
|
||||
<SwitchPreference
|
||||
<SwitchPreferenceCompat
|
||||
app:key="@string/settings_advanced_record_logs_key"
|
||||
app:title="@string/settings_advanced_record_logs_title"
|
||||
app:enabled="true"/>
|
||||
|
|
Loading…
Reference in a new issue