Codestyle cleanup
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
0aeb51efa4
commit
793abd690d
12 changed files with 68 additions and 61 deletions
|
@ -148,6 +148,7 @@ class ClipboardService : Service() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val ACTION_CLEAR = "ACTION_CLEAR_CLIPBOARD"
|
private const val ACTION_CLEAR = "ACTION_CLEAR_CLIPBOARD"
|
||||||
private const val ACTION_START = "ACTION_START_CLIPBOARD_TIMER"
|
private const val ACTION_START = "ACTION_START_CLIPBOARD_TIMER"
|
||||||
|
|
|
@ -123,7 +123,8 @@ class UserPreference : AppCompatActivity() {
|
||||||
OpenPgpUtils.convertKeyIdToHex(java.lang.Long.valueOf(s))
|
OpenPgpUtils.convertKeyIdToHex(java.lang.Long.valueOf(s))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
openkeystoreIdPreference?.isVisible = sharedPreferences.getString("ssh_openkeystore_keyid", null)?.isNotEmpty() ?: false
|
openkeystoreIdPreference?.isVisible = sharedPreferences.getString("ssh_openkeystore_keyid", null)?.isNotEmpty()
|
||||||
|
?: false
|
||||||
|
|
||||||
// see if the autofill service is enabled and check the preference accordingly
|
// see if the autofill service is enabled and check the preference accordingly
|
||||||
autoFillEnablePreference?.isChecked = callingActivity.isServiceEnabled
|
autoFillEnablePreference?.isChecked = callingActivity.isServiceEnabled
|
||||||
|
@ -332,12 +333,12 @@ class UserPreference : AppCompatActivity() {
|
||||||
val prefPwgenType = findPreference<ListPreference>("pref_key_pwgen_type")
|
val prefPwgenType = findPreference<ListPreference>("pref_key_pwgen_type")
|
||||||
showHideDependentPrefs(prefPwgenType?.value, prefIsCustomDict, prefCustomDictPicker)
|
showHideDependentPrefs(prefPwgenType?.value, prefIsCustomDict, prefCustomDictPicker)
|
||||||
|
|
||||||
prefPwgenType?.onPreferenceChangeListener = ChangeListener() { _, newValue ->
|
prefPwgenType?.onPreferenceChangeListener = ChangeListener { _, newValue ->
|
||||||
showHideDependentPrefs(newValue, prefIsCustomDict, prefCustomDictPicker)
|
showHideDependentPrefs(newValue, prefIsCustomDict, prefCustomDictPicker)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
prefIsCustomDict?.onPreferenceChangeListener = ChangeListener() { _, newValue ->
|
prefIsCustomDict?.onPreferenceChangeListener = ChangeListener { _, newValue ->
|
||||||
if (!(newValue as Boolean)) {
|
if (!(newValue as Boolean)) {
|
||||||
val customDictFile = File(context.filesDir, XkpwdDictionary.XKPWD_CUSTOM_DICT_FILE)
|
val customDictFile = File(context.filesDir, XkpwdDictionary.XKPWD_CUSTOM_DICT_FILE)
|
||||||
if (customDictFile.exists()) {
|
if (customDictFile.exists()) {
|
||||||
|
@ -688,7 +689,7 @@ class UserPreference : AppCompatActivity() {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
private fun setCustomDictSummary(customDictPref: Preference?, uri: Uri) {
|
private fun setCustomDictSummary(customDictPref: Preference?, uri: Uri) {
|
||||||
val fileName = uri.path?.substring(uri.path?.lastIndexOf(":")!! + 1)
|
val fileName = uri.path?.substring(uri.path?.lastIndexOf(":")!! + 1)
|
||||||
customDictPref?.setSummary("Selected dictionary: " + fileName)
|
customDictPref?.summary = "Selected dictionary: " + fileName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -658,6 +658,7 @@ open class GitActivity : AppCompatActivity() {
|
||||||
const val REQUEST_INIT = 104
|
const val REQUEST_INIT = 104
|
||||||
const val EDIT_SERVER = 105
|
const val EDIT_SERVER = 105
|
||||||
const val REQUEST_SYNC = 106
|
const val REQUEST_SYNC = 106
|
||||||
|
|
||||||
@Suppress("Unused")
|
@Suppress("Unused")
|
||||||
const val REQUEST_CREATE = 107
|
const val REQUEST_CREATE = 107
|
||||||
const val EDIT_GIT_CONFIG = 108
|
const val EDIT_GIT_CONFIG = 108
|
||||||
|
|
|
@ -34,7 +34,7 @@ class XkpwdDictionary(context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lines.isEmpty()) {
|
if (lines.isEmpty()) {
|
||||||
lines = context.getResources().openRawResource(R.raw.xkpwdict).bufferedReader().readLines()
|
lines = context.resources.openRawResource(R.raw.xkpwdict).bufferedReader().readLines()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (word in lines) {
|
for (word in lines) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ShowSshKeyFragment : DialogFragment() {
|
||||||
b.setOnClickListener {
|
b.setOnClickListener {
|
||||||
val clipboard = activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
val clipboard = activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
val clip = ClipData.newPlainText("public key", publicKey.text.toString())
|
val clip = ClipData.newPlainText("public key", publicKey.text.toString())
|
||||||
clipboard.setPrimaryClip(clip)
|
clipboard.primaryClip = clip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ad
|
return ad
|
||||||
|
|
|
@ -87,7 +87,8 @@ abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList<P
|
||||||
|
|
||||||
// Replace the contents of a view (invoked by the layout manager)
|
// Replace the contents of a view (invoked by the layout manager)
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
settings = settings ?: PreferenceManager.getDefaultSharedPreferences(holder.view.context.applicationContext)
|
settings = settings
|
||||||
|
?: PreferenceManager.getDefaultSharedPreferences(holder.view.context.applicationContext)
|
||||||
val pass = values[position]
|
val pass = values[position]
|
||||||
val showHidden = settings?.getBoolean("show_hidden_folders", false) ?: false
|
val showHidden = settings?.getBoolean("show_hidden_folders", false) ?: false
|
||||||
holder.name.text = pass.toString()
|
holder.name.text = pass.toString()
|
||||||
|
|
|
@ -79,7 +79,7 @@ open class PasswordRepository protected constructor() {
|
||||||
fun isGitRepo(): Boolean {
|
fun isGitRepo(): Boolean {
|
||||||
if (repository != null) {
|
if (repository != null) {
|
||||||
// Check if remote exists
|
// Check if remote exists
|
||||||
return repository!!.config.getSubsections("remote").isNotEmpty() ?: false
|
return repository!!.config.getSubsections("remote").isNotEmpty()
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,13 @@ import androidx.biometric.BiometricPrompt
|
||||||
internal sealed class AuthenticationResult {
|
internal sealed class AuthenticationResult {
|
||||||
internal data class Success(val cryptoObject: BiometricPrompt.CryptoObject?) :
|
internal data class Success(val cryptoObject: BiometricPrompt.CryptoObject?) :
|
||||||
AuthenticationResult()
|
AuthenticationResult()
|
||||||
|
|
||||||
internal data class RecoverableError(val code: Int, val message: CharSequence) :
|
internal data class RecoverableError(val code: Int, val message: CharSequence) :
|
||||||
AuthenticationResult()
|
AuthenticationResult()
|
||||||
|
|
||||||
internal data class UnrecoverableError(val code: Int, val message: CharSequence) :
|
internal data class UnrecoverableError(val code: Int, val message: CharSequence) :
|
||||||
AuthenticationResult()
|
AuthenticationResult()
|
||||||
|
|
||||||
internal object Failure : AuthenticationResult()
|
internal object Failure : AuthenticationResult()
|
||||||
internal object Cancelled : AuthenticationResult()
|
internal object Cancelled : AuthenticationResult()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue