This repository was archived by the owner on Oct 15, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +41
-1
lines changed Expand file tree Collapse file tree 6 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 5
5
6
6
package dev.msfjarvis.aps.ui.onboarding.activity
7
7
8
+ import android.content.Context
9
+ import android.content.Intent
8
10
import android.os.Bundle
9
11
import androidx.appcompat.app.AppCompatActivity
12
+ import androidx.fragment.app.commitNow
10
13
import dagger.hilt.android.AndroidEntryPoint
11
14
import dev.msfjarvis.aps.R
15
+ import dev.msfjarvis.aps.ui.onboarding.fragments.GopenpgpKeySelectionFragment
16
+ import dev.msfjarvis.aps.ui.onboarding.fragments.WelcomeFragment
12
17
13
18
@AndroidEntryPoint
14
19
class OnboardingActivity : AppCompatActivity (R .layout.activity_onboarding) {
15
20
16
21
override fun onCreate (savedInstanceState : Bundle ? ) {
17
22
super .onCreate(savedInstanceState)
18
23
supportActionBar?.hide()
24
+ val import = intent.extras?.getBoolean(KEY_IMPORT ) ? : false
25
+ supportFragmentManager.commitNow {
26
+ if (import) {
27
+ replace(R .id.fragment_first_run, GopenpgpKeySelectionFragment .newInstance())
28
+ } else {
29
+ replace(R .id.fragment_first_run, WelcomeFragment .newInstance())
30
+ }
31
+ }
19
32
}
20
33
21
34
override fun onBackPressed () {
@@ -25,4 +38,15 @@ class OnboardingActivity : AppCompatActivity(R.layout.activity_onboarding) {
25
38
super .onBackPressed()
26
39
}
27
40
}
41
+
42
+ companion object {
43
+ private const val KEY_IMPORT = " KEY_IMPORT"
44
+
45
+ fun createKeyImportIntent (context : Context ) =
46
+ Intent (
47
+ context,
48
+ OnboardingActivity ::class .java,
49
+ )
50
+ .putExtra(KEY_IMPORT , true )
51
+ }
28
52
}
Original file line number Diff line number Diff line change @@ -31,4 +31,8 @@ class WelcomeFragment : Fragment(R.layout.fragment_welcome) {
31
31
startActivity(Intent (requireContext(), SettingsActivity ::class .java))
32
32
}
33
33
}
34
+
35
+ companion object {
36
+ fun newInstance () = WelcomeFragment ()
37
+ }
34
38
}
Original file line number Diff line number Diff line change @@ -17,10 +17,12 @@ import de.Maxr1998.modernpreferences.helpers.editText
17
17
import de.Maxr1998.modernpreferences.helpers.onCheckedChange
18
18
import de.Maxr1998.modernpreferences.helpers.onClick
19
19
import de.Maxr1998.modernpreferences.helpers.onSelectionChange
20
+ import de.Maxr1998.modernpreferences.helpers.pref
20
21
import de.Maxr1998.modernpreferences.helpers.singleChoice
21
22
import de.Maxr1998.modernpreferences.preferences.CheckBoxPreference
22
23
import de.Maxr1998.modernpreferences.preferences.choice.SelectionItem
23
24
import dev.msfjarvis.aps.R
25
+ import dev.msfjarvis.aps.ui.onboarding.activity.OnboardingActivity
24
26
import dev.msfjarvis.aps.util.extensions.getString
25
27
import dev.msfjarvis.aps.util.extensions.sharedPrefs
26
28
import dev.msfjarvis.aps.util.extensions.unsafeLazy
@@ -118,6 +120,14 @@ class PasswordSettings(private val activity: FragmentActivity) : SettingsProvide
118
120
summaryRes = R .string.pref_copy_summary
119
121
defaultValue = false
120
122
}
123
+ pref(PreferenceKeys .IMPORT_GPG_KEY ) {
124
+ titleRes = R .string.pref_import_gpg_key_title
125
+ summaryRes = R .string.pref_import_gpg_key_summary
126
+ onClick {
127
+ activity.startActivity(OnboardingActivity .createKeyImportIntent(activity))
128
+ true
129
+ }
130
+ }
121
131
}
122
132
}
123
133
}
Original file line number Diff line number Diff line change @@ -82,4 +82,5 @@ object PreferenceKeys {
82
82
const val PROXY_PASSWORD = " proxy_password"
83
83
84
84
const val REBASE_ON_PULL = " rebase_on_pull"
85
+ const val IMPORT_GPG_KEY = " import_gpg_key"
85
86
}
Original file line number Diff line number Diff line change 11
11
12
12
<androidx .fragment.app.FragmentContainerView
13
13
android : id =" @+id/fragment_first_run"
14
- android : name =" dev.msfjarvis.aps.ui.onboarding.fragments.WelcomeFragment"
15
14
android : layout_width =" match_parent"
16
15
android : layout_height =" match_parent"
17
16
android : tag =" welcome_fragment" />
Original file line number Diff line number Diff line change 111
111
<string name =" pref_import_ssh_key_title" >Import SSH key</string >
112
112
<string name =" pref_ssh_keygen_title" >Generate SSH key pair</string >
113
113
<string name =" pref_ssh_see_key_title" >View generated public SSH key</string >
114
+ <string name =" pref_import_gpg_key_title" >Import GPG key</string >
115
+ <string name =" pref_import_gpg_key_summary" >Add a GPG key to the internal keyring</string >
114
116
<string name =" pref_git_delete_repo_title" >Delete repository</string >
115
117
<string name =" pref_dialog_delete_title" >Clear repository</string >
116
118
<string name =" pref_category_general_title" >General</string >
You can’t perform that action at this time.
0 commit comments