feat: move key import to key manager UI

This commit is contained in:
Harsh Shandilya 2022-11-18 12:31:19 +05:30
parent 10b502fb0a
commit 84b9839635
No known key found for this signature in database
2 changed files with 11 additions and 9 deletions

View file

@ -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))
}

View file

@ -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 {