aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-11-18 12:31:19 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2022-11-18 12:31:19 +0530
commit84b9839635cd4046e3fdbf50a187a94f58a6a84f (patch)
treeea05b7ab9a73f593b24e7ac20d832028a2bc5ed0
parent10b502fb0a9a028878720e75b38e6cfc17910c31 (diff)
feat: move key import to key manager UI
-rw-r--r--app/src/main/java/app/passwordstore/ui/pgp/PGPKeyListActivity.kt11
-rw-r--r--app/src/main/java/app/passwordstore/ui/settings/PGPSettings.kt9
2 files changed, 11 insertions, 9 deletions
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 {