feat: move key import to key manager UI
This commit is contained in:
parent
10b502fb0a
commit
84b9839635
2 changed files with 11 additions and 9 deletions
|
@ -6,6 +6,8 @@ import androidx.activity.compose.setContent
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.FloatingActionButton
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
@ -17,6 +19,7 @@ import app.passwordstore.R
|
||||||
import app.passwordstore.ui.APSAppBar
|
import app.passwordstore.ui.APSAppBar
|
||||||
import app.passwordstore.ui.compose.theme.APSTheme
|
import app.passwordstore.ui.compose.theme.APSTheme
|
||||||
import app.passwordstore.ui.compose.theme.decideColorScheme
|
import app.passwordstore.ui.compose.theme.decideColorScheme
|
||||||
|
import app.passwordstore.util.extensions.launchActivity
|
||||||
import app.passwordstore.util.viewmodel.PGPKeyListViewModel
|
import app.passwordstore.util.viewmodel.PGPKeyListViewModel
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
|
@ -40,6 +43,14 @@ class PGPKeyListActivity : ComponentActivity() {
|
||||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
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 ->
|
) { paddingValues ->
|
||||||
PGPKeyList(viewModel = viewModel, modifier = Modifier.padding(paddingValues))
|
PGPKeyList(viewModel = viewModel, modifier = Modifier.padding(paddingValues))
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ package app.passwordstore.ui.settings
|
||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import app.passwordstore.R
|
import app.passwordstore.R
|
||||||
import app.passwordstore.ui.pgp.PGPKeyImportActivity
|
|
||||||
import app.passwordstore.ui.pgp.PGPKeyListActivity
|
import app.passwordstore.ui.pgp.PGPKeyListActivity
|
||||||
import app.passwordstore.util.extensions.launchActivity
|
import app.passwordstore.util.extensions.launchActivity
|
||||||
import app.passwordstore.util.settings.PreferenceKeys
|
import app.passwordstore.util.settings.PreferenceKeys
|
||||||
|
@ -21,14 +20,6 @@ class PGPSettings(private val activity: FragmentActivity) : SettingsProvider {
|
||||||
override fun provideSettings(builder: PreferenceScreen.Builder) {
|
override fun provideSettings(builder: PreferenceScreen.Builder) {
|
||||||
builder.apply {
|
builder.apply {
|
||||||
pref("_") {
|
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
|
titleRes = R.string.pref_pgp_key_manager_title
|
||||||
persistent = false
|
persistent = false
|
||||||
onClick {
|
onClick {
|
||||||
|
|
Loading…
Reference in a new issue