Codestyle cleanup

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-03-20 14:13:54 +05:30 committed by Aditya Wasan
parent 0aeb51efa4
commit 793abd690d
12 changed files with 68 additions and 61 deletions

View file

@ -148,6 +148,7 @@ class ClipboardService : Service() {
}
}
}
companion object {
private const val ACTION_CLEAR = "ACTION_CLEAR_CLIPBOARD"
private const val ACTION_START = "ACTION_START_CLIPBOARD_TIMER"

View file

@ -123,7 +123,8 @@ class UserPreference : AppCompatActivity() {
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
autoFillEnablePreference?.isChecked = callingActivity.isServiceEnabled
@ -332,12 +333,12 @@ class UserPreference : AppCompatActivity() {
val prefPwgenType = findPreference<ListPreference>("pref_key_pwgen_type")
showHideDependentPrefs(prefPwgenType?.value, prefIsCustomDict, prefCustomDictPicker)
prefPwgenType?.onPreferenceChangeListener = ChangeListener() { _, newValue ->
prefPwgenType?.onPreferenceChangeListener = ChangeListener { _, newValue ->
showHideDependentPrefs(newValue, prefIsCustomDict, prefCustomDictPicker)
true
}
prefIsCustomDict?.onPreferenceChangeListener = ChangeListener() { _, newValue ->
prefIsCustomDict?.onPreferenceChangeListener = ChangeListener { _, newValue ->
if (!(newValue as Boolean)) {
val customDictFile = File(context.filesDir, XkpwdDictionary.XKPWD_CUSTOM_DICT_FILE)
if (customDictFile.exists()) {
@ -688,7 +689,7 @@ class UserPreference : AppCompatActivity() {
@JvmStatic
private fun setCustomDictSummary(customDictPref: Preference?, uri: Uri) {
val fileName = uri.path?.substring(uri.path?.lastIndexOf(":")!! + 1)
customDictPref?.setSummary("Selected dictionary: " + fileName)
customDictPref?.summary = "Selected dictionary: " + fileName
}
}
}

View file

@ -658,6 +658,7 @@ open class GitActivity : AppCompatActivity() {
const val REQUEST_INIT = 104
const val EDIT_SERVER = 105
const val REQUEST_SYNC = 106
@Suppress("Unused")
const val REQUEST_CREATE = 107
const val EDIT_GIT_CONFIG = 108

View file

@ -34,7 +34,7 @@ class XkpwdDictionary(context: Context) {
}
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) {

View file

@ -43,7 +43,7 @@ class ShowSshKeyFragment : DialogFragment() {
b.setOnClickListener {
val clipboard = activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("public key", publicKey.text.toString())
clipboard.setPrimaryClip(clip)
clipboard.primaryClip = clip
}
}
return ad

View file

@ -87,7 +87,8 @@ abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList<P
// Replace the contents of a view (invoked by the layout manager)
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 showHidden = settings?.getBoolean("show_hidden_folders", false) ?: false
holder.name.text = pass.toString()

View file

@ -79,7 +79,7 @@ open class PasswordRepository protected constructor() {
fun isGitRepo(): Boolean {
if (repository != null) {
// Check if remote exists
return repository!!.config.getSubsections("remote").isNotEmpty() ?: false
return repository!!.config.getSubsections("remote").isNotEmpty()
}
return false
}

View file

@ -9,10 +9,13 @@ import androidx.biometric.BiometricPrompt
internal sealed class AuthenticationResult {
internal data class Success(val cryptoObject: BiometricPrompt.CryptoObject?) :
AuthenticationResult()
internal data class RecoverableError(val code: Int, val message: CharSequence) :
AuthenticationResult()
internal data class UnrecoverableError(val code: Int, val message: CharSequence) :
AuthenticationResult()
internal object Failure : AuthenticationResult()
internal object Cancelled : AuthenticationResult()
}