From 84b9839635cd4046e3fdbf50a187a94f58a6a84f Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 18 Nov 2022 12:31:19 +0530 Subject: feat: move key import to key manager UI --- .../main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt | 11 +++++++++++ .../main/java/app/passwordstore/ui/settings/PGPSettings.kt | 9 --------- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'app') diff --git a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt index 4394cff6..43fba086 100644 --- a/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt @@ -6,6 +6,8 @@ import androidx.activity.compose.setContent import androidx.activity.viewModels import androidx.compose.foundation.layout.padding import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.FloatingActionButton +import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable @@ -17,6 +19,7 @@ import app.passwordstore.R import app.passwordstore.ui.APSAppBar import app.passwordstore.ui.compose.theme.APSTheme import app.passwordstore.ui.compose.theme.decideColorScheme +import app.passwordstore.util.extensions.launchActivity import app.passwordstore.util.viewmodel.PGPKeyListViewModel import dagger.hilt.android.AndroidEntryPoint @@ -40,6 +43,14 @@ class PGPKeyListActivity : ComponentActivity() { backgroundColor = MaterialTheme.colorScheme.surface, ) }, + floatingActionButton = { + FloatingActionButton(onClick = { launchActivity(PGPKeyImportActivity::class.java) }) { + Icon( + painter = painterResource(R.drawable.ic_add_48dp), + stringResource(R.string.pref_import_pgp_key_title) + ) + } + } ) { paddingValues -> PGPKeyList(viewModel = viewModel, modifier = Modifier.padding(paddingValues)) } diff --git a/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt b/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt index 8a3048ba..a704b7a4 100644 --- a/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt +++ b/app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt @@ -7,7 +7,6 @@ package app.passwordstore.ui.settings import androidx.fragment.app.FragmentActivity import app.passwordstore.R -import app.passwordstore.ui.pgp.PGPKeyImportActivity import app.passwordstore.ui.pgp.PGPKeyListActivity import app.passwordstore.util.extensions.launchActivity import app.passwordstore.util.settings.PreferenceKeys @@ -21,14 +20,6 @@ class PGPSettings(private val activity: FragmentActivity) : SettingsProvider { override fun provideSettings(builder: PreferenceScreen.Builder) { builder.apply { pref("_") { - titleRes = R.string.pref_import_pgp_key_title - persistent = false - onClick { - activity.launchActivity(PGPKeyImportActivity::class.java) - false - } - } - pref("__") { titleRes = R.string.pref_pgp_key_manager_title persistent = false onClick { -- cgit v1.2.3