Merge pull request #699 from theimpulson/material3

Material3
This commit is contained in:
Torsten Grote 2024-07-26 15:06:24 -03:00 committed by GitHub
commit a07ab64469
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 164 additions and 82 deletions

View file

@ -105,7 +105,6 @@
<activity
android:name=".ui.storage.StorageActivity"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize" />
<activity
@ -115,15 +114,13 @@
<activity
android:name=".ui.recoverycode.RecoveryCodeActivity"
android:label="@string/recovery_code_title"
android:theme="@style/AppTheme.NoActionBar" />
android:label="@string/recovery_code_title" />
<activity
android:name=".restore.RestoreActivity"
android:exported="true"
android:label="@string/restore_title"
android:permission="com.stevesoltys.seedvault.RESTORE_BACKUP"
android:theme="@style/AppTheme.NoActionBar">
android:permission="com.stevesoltys.seedvault.RESTORE_BACKUP">
<intent-filter>
<action android:name="com.stevesoltys.seedvault.RESTORE_BACKUP" />
<category android:name="android.intent.category.DEFAULT" />

View file

@ -20,6 +20,7 @@ import android.os.UserManager
import android.provider.Settings
import androidx.work.ExistingPeriodicWorkPolicy.UPDATE
import androidx.work.WorkManager
import com.google.android.material.color.DynamicColors
import com.stevesoltys.seedvault.crypto.cryptoModule
import com.stevesoltys.seedvault.header.headerModule
import com.stevesoltys.seedvault.metadata.MetadataManager
@ -114,6 +115,7 @@ open class App : Application() {
override fun onCreate() {
super.onCreate()
DynamicColors.applyToActivitiesIfAvailable(this)
startKoin()
if (isDebugBuild()) {
StrictMode.setThreadPolicy(

View file

@ -14,12 +14,12 @@ import android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
import android.widget.Button
import android.widget.ProgressBar
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat.getColor
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.ui.AppBackupState.FAILED_NOT_INSTALLED
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
@ -99,7 +99,7 @@ class RestoreProgressFragment : Fragment() {
// check if any restore failed, because the app is not installed
val failed = viewModel.restoreProgress.value?.any { it.state == FAILED_NOT_INSTALLED }
if (failed != true) return // nothing left to do if there's no failures due to not installed
AlertDialog.Builder(requireContext())
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.restore_restoring_error_title)
.setMessage(R.string.restore_restoring_error_message)
.setPositiveButton(android.R.string.ok) { dialog, _ ->

View file

@ -19,11 +19,11 @@ import android.widget.TextView
import android.widget.Toast
import android.widget.Toast.LENGTH_LONG
import androidx.activity.result.contract.ActivityResultContract
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.restore.RestoreViewModel
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
@ -96,7 +96,7 @@ class InstallProgressFragment : Fragment(), InstallItemListener {
adapter.setFinished()
button.isEnabled = true
if (!hasShownFailDialog && installResult.hasFailed) {
AlertDialog.Builder(requireContext())
MaterialAlertDialogBuilder(requireContext())
.setIcon(R.drawable.ic_warning)
.setTitle(R.string.restore_installing_error_title)
.setMessage(R.string.restore_installing_error_message)

View file

@ -8,6 +8,8 @@ package com.stevesoltys.seedvault.settings
import android.content.SharedPreferences
import android.os.Bundle
import android.view.View
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceManager
@ -16,6 +18,7 @@ import androidx.work.ExistingPeriodicWorkPolicy.UPDATE
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.permitDiskReads
import com.stevesoltys.seedvault.plugins.StoragePluginManager
import com.stevesoltys.seedvault.settings.preference.M3ListPreference
import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
@ -42,6 +45,21 @@ class SchedulingFragment : PreferenceFragmentCompat(),
}
}
override fun onDisplayPreferenceDialog(preference: Preference?) {
when (preference) {
is ListPreference -> {
val dialogFragment = M3ListPreference.newInstance(preference.getKey())
dialogFragment.setTargetFragment(this, 0)
dialogFragment.show(
parentFragmentManager,
M3ListPreference.PREFERENCE_DIALOG_FRAGMENT_TAG
)
}
else -> super.onDisplayPreferenceDialog(preference)
}
}
override fun onStart() {
super.onStart()

View file

@ -34,6 +34,7 @@ class SettingsActivity : RequireProvisioningActivity(), OnPreferenceStartFragmen
setContentView(R.layout.activity_fragment_container)
setSupportActionBar(requireViewById(R.id.toolbar))
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
// always start with settings fragment as a base (when fresh start)

View file

@ -19,12 +19,12 @@ import android.view.MenuItem
import android.view.View
import android.widget.Toast
import android.widget.Toast.LENGTH_LONG
import androidx.appcompat.app.AlertDialog
import androidx.preference.Preference
import androidx.preference.Preference.OnPreferenceChangeListener
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.TwoStatePreference
import androidx.work.WorkInfo
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.permitDiskReads
import com.stevesoltys.seedvault.plugins.StoragePluginManager
@ -77,7 +77,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
when (enabled) {
true -> return@OnPreferenceChangeListener trySetBackupEnabled(true)
false -> {
AlertDialog.Builder(requireContext())
MaterialAlertDialogBuilder(requireContext())
.setIcon(R.drawable.ic_warning)
.setTitle(R.string.settings_backup_dialog_title)
.setMessage(R.string.settings_backup_dialog_message)
@ -123,7 +123,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
apkBackup.onPreferenceChangeListener = OnPreferenceChangeListener { _, newValue ->
val enable = newValue as Boolean
if (enable) return@OnPreferenceChangeListener true
AlertDialog.Builder(requireContext())
MaterialAlertDialogBuilder(requireContext())
.setIcon(R.drawable.ic_warning)
.setTitle(R.string.settings_backup_apk_dialog_title)
.setMessage(R.string.settings_backup_apk_dialog_message)
@ -313,7 +313,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
}
private fun onEnablingStorageBackup() {
AlertDialog.Builder(requireContext())
MaterialAlertDialogBuilder(requireContext())
.setIcon(R.drawable.ic_warning)
.setTitle(R.string.settings_backup_storage_dialog_title)
.setMessage(R.string.settings_backup_storage_dialog_message)
@ -341,7 +341,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
}
private fun showCodeRegenerationNeededDialog() {
AlertDialog.Builder(requireContext())
MaterialAlertDialogBuilder(requireContext())
.setIcon(R.drawable.ic_vpn_key)
.setTitle(R.string.settings_backup_new_code_dialog_title)
.setMessage(R.string.settings_backup_new_code_dialog_message)

View file

@ -0,0 +1,45 @@
/*
* SPDX-FileCopyrightText: 2024 The Calyx Institute
* SPDX-License-Identifier: Apache-2.0
*/
package com.stevesoltys.seedvault.settings.preference
import android.app.Dialog
import android.os.Bundle
import androidx.preference.ListPreferenceDialogFragmentCompat
import com.google.android.material.dialog.MaterialAlertDialogBuilder
class M3ListPreference : ListPreferenceDialogFragmentCompat() {
companion object {
const val PREFERENCE_DIALOG_FRAGMENT_TAG = "androidx.preference.PreferenceFragment.DIALOG"
fun newInstance(key: String?): M3ListPreference {
val fragment = M3ListPreference()
val bundle = Bundle(1)
bundle.putString(ARG_KEY, key)
fragment.arguments = bundle
return fragment
}
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val builder = MaterialAlertDialogBuilder(requireContext())
.setTitle(preference.dialogTitle)
.setIcon(preference.dialogIcon)
.setPositiveButton(preference.positiveButtonText, this)
.setNegativeButton(preference.negativeButtonText, this)
val contentView = onCreateDialogView(requireContext())
if (contentView != null) {
onBindDialogView(contentView)
builder.setView(contentView)
} else {
builder.setMessage(preference.dialogMessage)
}
onPrepareDialogBuilder(builder)
return builder.create()
}
}

View file

@ -21,20 +21,20 @@ import android.view.View.VISIBLE
import android.view.ViewGroup
import android.view.WindowManager.LayoutParams.FLAG_SECURE
import android.widget.ArrayAdapter
import android.widget.AutoCompleteTextView
import android.widget.Button
import android.widget.TextView
import android.widget.Toast
import android.widget.Toast.LENGTH_LONG
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
import androidx.appcompat.app.AlertDialog
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat.getMainExecutor
import androidx.fragment.app.Fragment
import cash.z.ecc.android.bip39.Mnemonics
import cash.z.ecc.android.bip39.Mnemonics.ChecksumException
import cash.z.ecc.android.bip39.Mnemonics.InvalidWordException
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.textfield.MaterialAutoCompleteTextView
import com.google.android.material.textfield.TextInputLayout
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.isDebugBuild
@ -118,7 +118,7 @@ class RecoveryCodeInputFragment : Fragment() {
for (i in 0 until WORD_NUM) {
val wordLayout = getWordLayout(i)
val editText = wordLayout.editText as AutoCompleteTextView
val editText = wordLayout.editText as MaterialAutoCompleteTextView
editText.onFocusChangeListener = OnFocusChangeListener { _, focus ->
if (!focus) wordLayout.isErrorEnabled = false
}
@ -207,7 +207,7 @@ class RecoveryCodeInputFragment : Fragment() {
}
private fun onExistingCodeChecked(verified: Boolean) {
AlertDialog.Builder(requireContext()).apply {
MaterialAlertDialogBuilder(requireContext()).apply {
if (verified) {
setTitle(R.string.recovery_code_verification_ok_title)
setMessage(R.string.recovery_code_verification_ok_message)
@ -237,7 +237,7 @@ class RecoveryCodeInputFragment : Fragment() {
}
private fun generateNewCode() {
AlertDialog.Builder(requireContext())
MaterialAlertDialogBuilder(requireContext())
.setIcon(R.drawable.ic_warning)
.setTitle(R.string.recovery_code_verification_new_dialog_title)
.setMessage(R.string.recovery_code_verification_new_dialog_message)

View file

@ -16,7 +16,7 @@ import android.net.Uri
import android.os.Bundle
import androidx.activity.result.contract.ActivityResultContracts.OpenDocumentTree
import androidx.annotation.CallSuper
import androidx.appcompat.app.AlertDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.plugins.saf.StorageRootResolver
import com.stevesoltys.seedvault.ui.BackupActivity
@ -89,7 +89,7 @@ class StorageActivity : BackupActivity() {
private fun onInvalidLocation(errorMsg: String) {
if (viewModel.isRestoreOperation) {
val dialog = AlertDialog.Builder(this)
val dialog = MaterialAlertDialogBuilder(this)
.setTitle(getString(R.string.restore_invalid_location_title))
.setMessage(errorMsg)
.setPositiveButton(android.R.string.ok) { dialog, _ -> dialog.dismiss() }

View file

@ -15,9 +15,9 @@ import android.view.View.VISIBLE
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.recyclerview.widget.RecyclerView.Adapter
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.stevesoltys.seedvault.R
import com.stevesoltys.seedvault.ui.storage.StorageOption.SafOption
import com.stevesoltys.seedvault.ui.storage.StorageOptionAdapter.StorageOptionViewHolder
@ -91,7 +91,7 @@ internal class StorageOptionAdapter(
}
private fun showWarningDialog(context: Context, item: StorageOption) {
AlertDialog.Builder(context)
MaterialAlertDialogBuilder(context)
.setTitle(R.string.storage_internal_warning_title)
.setMessage(R.string.storage_internal_warning_message)
.setPositiveButton(R.string.storage_internal_warning_choose_other) { dialog, _ ->

View file

@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:tint="@color/accent_primary"
android:viewportWidth="24"
android:viewportHeight="24">

View file

@ -6,7 +6,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:tint="@color/accent_primary"
android:viewportWidth="24"
android:viewportHeight="24">
<path

View file

@ -6,7 +6,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:tint="@color/accent_primary"
android:viewportWidth="24"
android:viewportHeight="24">
<path

View file

@ -6,7 +6,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:tint="@color/accent_primary"
android:viewportWidth="24"
android:viewportHeight="24">
<path

View file

@ -6,7 +6,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:tint="@color/accent_primary"
android:viewportWidth="24"
android:viewportHeight="24">
<path

View file

@ -3,7 +3,21 @@
SPDX-FileCopyrightText: 2020 The Calyx Institute
SPDX-License-Identifier: Apache-2.0
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme" />
<FrameLayout
android:id="@+id/fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>

View file

@ -16,7 +16,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:background="@color/background">
<ImageView
android:id="@+id/imageView"

View file

@ -0,0 +1,8 @@
<?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"
android:background="@null"
android:clickable="false"
android:focusable="false" />

View file

@ -23,8 +23,9 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput1"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -45,8 +46,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout1">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput3"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -67,8 +69,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout3">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput5"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -89,8 +92,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout5">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput7"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -111,8 +115,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout7">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput9"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -133,8 +138,9 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/wordLayout9">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput11"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -156,8 +162,9 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput2"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -178,8 +185,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout2">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput4"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -200,8 +208,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout4">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput6"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -222,8 +231,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout6">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput8"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -244,8 +254,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout8">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput10"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
@ -266,8 +277,9 @@
app:layout_constraintStart_toEndOf="@+id/wordLayout1"
app:layout_constraintTop_toBottomOf="@+id/wordLayout10">
<androidx.appcompat.widget.AppCompatAutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/wordInput12"
style="@style/Widget.Material3.AutoCompleteTextView.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"

View file

@ -6,9 +6,7 @@
<resources>
<!-- AOSP colors -->
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#36 -->
<color name="accent">@android:color/system_accent1_100</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#22 -->
<color name="primary">@android:color/system_neutral1_900</color>
<color name="accent_primary">@android:color/system_accent1_100</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#51 -->
<color name="background">@android:color/system_neutral1_900</color>
</resources>

View file

@ -6,22 +6,14 @@
<resources>
<!-- AOSP colors -->
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#35 -->
<color name="accent">@android:color/system_accent1_600</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#23 -->
<color name="primary">@android:color/system_neutral1_50</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#27 -->
<color name="primaryDark">@color/primary</color>
<color name="accent_primary">@android:color/system_accent1_600</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#52 -->
<color name="background">@android:color/system_neutral1_50</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#21 -->
<color name="actionBarPrimary">@color/primary</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#23 -->
<color name="statusBarColor">@color/primary</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#69 -->
<!-- private resource, access it from colorError attribute instead -->
<color name="red">@*android:color/error_color_device_default_dark</color>
<!-- private resource, access it directly -->
<color name="red">#ff7043</color>
<!-- https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r1/core/res/res/values/colors_device_defaults.xml#35 -->
<color name="ic_launcher_background">@color/accent</color>
<color name="ic_launcher_background">@color/accent_primary</color>
<!-- Custom colors -->
<color name="divider">#20ffffff</color>

View file

@ -2,30 +2,19 @@
SPDX-FileCopyrightText: 2020 The Calyx Institute
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="@style/Theme.AppCompat.DayNight">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primaryDark</item>
<item name="colorAccent">@color/accent</item>
<style name="AppTheme" parent="@style/Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/accent_primary</item>
<item name="colorAccent">@color/accent_primary</item>
<item name="colorError">@color/red</item>
<item name="android:windowBackground">@color/background</item>
<item name="fontFamily">@*android:string/config_bodyFontFamily</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="android:windowLightStatusBar">@bool/isLight</item>
<item name="android:statusBarColor">@color/statusBarColor</item>
<item name="actionBarTheme">@style/Theme.ActionBar</item>
<item name="android:statusBarColor">@color/background</item>
<item name="android:windowLightNavigationBar">@bool/isLight</item>
<item name="android:navigationBarColor">@color/primary</item>
</style>
<style name="Theme.ActionBar" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/actionBarPrimary</item>
</style>
<style name="AppTheme.NoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:navigationBarColor">@color/background</item>
</style>
<!-- Copied from Settings -->
@ -85,7 +74,7 @@
<item name="android:textAlignment">gravity</item>
</style>
<style name="SudPrimaryButton" parent="Widget.AppCompat.Button.Colored">
<style name="SudPrimaryButton" parent="Widget.Material3.Button.UnelevatedButton">
<item name="android:buttonStyle">@style/SudPrimaryButton</item>
<item name="android:theme">@style/SudPrimaryButton</item>
<item name="buttonStyle">@style/SudPrimaryButton</item>
@ -100,7 +89,7 @@
<item name="textAllCaps">false</item>
</style>
<style name="SudSecondaryButton" parent="Widget.AppCompat.Button.Borderless.Colored">
<style name="SudSecondaryButton" parent="Widget.Material3.Button.TextButton">
<item name="android:buttonStyle">@style/SudSecondaryButton</item>
<item name="android:theme">@style/SudSecondaryButton</item>
<item name="buttonStyle">@style/SudSecondaryButton</item>
@ -111,4 +100,8 @@
<item name="android:minHeight">56dp</item>
<item name="textAllCaps">false</item>
</style>
<style name="Preference.SwitchPreferenceCompat" parent="@style/Preference.SwitchPreferenceCompat.Material" tools:ignore="ResourceCycle">
<item name="widgetLayout">@layout/preference_switch</item>
</style>
</resources>

View file

@ -19,6 +19,7 @@ import android.widget.Toast
import android.widget.Toast.LENGTH_SHORT
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.activityViewModels
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import de.grobox.storagebackuptester.MainViewModel
import de.grobox.storagebackuptester.R
import de.grobox.storagebackuptester.restore.DemoSnapshotFragment
@ -133,7 +134,7 @@ class SettingsFragment : BackupContentFragment() {
}
private fun onRestoreClicked() {
AlertDialog.Builder(requireContext())
MaterialAlertDialogBuilder(requireContext())
.setIcon(android.R.drawable.stat_sys_warning)
.setTitle("Warning")
.setMessage("This will override data and should only be used on a clean phone. Not the one you just made the backup on.")

View file

@ -12,9 +12,9 @@ import android.view.ViewGroup
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.widget.SwitchCompat
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.Adapter
import com.google.android.material.materialswitch.MaterialSwitch
import org.calyxos.backup.storage.R
import org.calyxos.backup.storage.api.EXTERNAL_STORAGE_PROVIDER_AUTHORITY
@ -65,7 +65,7 @@ internal class BackupContentAdapter(private val listener: ContentClickListener)
}
internal inner class MediaHolder(view: View) : ViewHolder(view) {
private val switch: SwitchCompat = view.findViewById(R.id.switchView)
private val switch: MaterialSwitch = view.findViewById(R.id.switchView)
override fun bind(item: BackupContentItem) {
super.bind(item)

View file

@ -42,7 +42,7 @@
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/content_videos" />
<androidx.appcompat.widget.SwitchCompat
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switchView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"