mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix warnings
This commit is contained in:
@@ -157,7 +157,7 @@ class OpenFileHelper {
|
|||||||
val browserDialogFragment = BrowserDialogFragment()
|
val browserDialogFragment = BrowserDialogFragment()
|
||||||
if (fragment != null && fragment!!.fragmentManager != null)
|
if (fragment != null && fragment!!.fragmentManager != null)
|
||||||
browserDialogFragment.show(fragment!!.fragmentManager!!, "browserDialog")
|
browserDialogFragment.show(fragment!!.fragmentManager!!, "browserDialog")
|
||||||
else if ((activity as FragmentActivity).supportFragmentManager != null)
|
else
|
||||||
browserDialogFragment.show((activity as FragmentActivity).supportFragmentManager, "browserDialog")
|
browserDialogFragment.show((activity as FragmentActivity).supportFragmentManager, "browserDialog")
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(TAG, "Can't open BrowserDialog", e)
|
Log.e(TAG, "Can't open BrowserDialog", e)
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class ProtectedBinary : Parcelable {
|
|||||||
var result = 0
|
var result = 0
|
||||||
result = 31 * result + if (isProtected) 1 else 0
|
result = 31 * result + if (isProtected) 1 else 0
|
||||||
result = 31 * result + dataFile!!.hashCode()
|
result = 31 * result + dataFile!!.hashCode()
|
||||||
result = 31 * result + Integer.valueOf(size)!!.hashCode()
|
result = 31 * result + Integer.valueOf(size).hashCode()
|
||||||
result = 31 * result + Arrays.hashCode(data)
|
result = 31 * result + Arrays.hashCode(data)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,22 +26,22 @@ class ProtectedString : Parcelable {
|
|||||||
|
|
||||||
var isProtected: Boolean = false
|
var isProtected: Boolean = false
|
||||||
private set
|
private set
|
||||||
private var string: String = ""
|
private var stringValue: String = ""
|
||||||
|
|
||||||
constructor(toCopy: ProtectedString) {
|
constructor(toCopy: ProtectedString) {
|
||||||
this.isProtected = toCopy.isProtected
|
this.isProtected = toCopy.isProtected
|
||||||
this.string = toCopy.string
|
this.stringValue = toCopy.stringValue
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
constructor(enableProtection: Boolean = false, string: String = "") {
|
constructor(enableProtection: Boolean = false, string: String = "") {
|
||||||
this.isProtected = enableProtection
|
this.isProtected = enableProtection
|
||||||
this.string = string
|
this.stringValue = string
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(parcel: Parcel) {
|
constructor(parcel: Parcel) {
|
||||||
isProtected = parcel.readByte().toInt() != 0
|
isProtected = parcel.readByte().toInt() != 0
|
||||||
string = parcel.readString()
|
stringValue = parcel.readString() ?: stringValue
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun describeContents(): Int {
|
override fun describeContents(): Int {
|
||||||
@@ -50,15 +50,15 @@ class ProtectedString : Parcelable {
|
|||||||
|
|
||||||
override fun writeToParcel(dest: Parcel, flags: Int) {
|
override fun writeToParcel(dest: Parcel, flags: Int) {
|
||||||
dest.writeByte((if (isProtected) 1 else 0).toByte())
|
dest.writeByte((if (isProtected) 1 else 0).toByte())
|
||||||
dest.writeString(string)
|
dest.writeString(stringValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun length(): Int {
|
fun length(): Int {
|
||||||
return string.length
|
return stringValue.length
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return string
|
return stringValue
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -821,7 +821,7 @@ class ImporterV4(private val streamDir: File) : Importer<PwDatabaseV4>() {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
utcDate = PwDatabaseV4XML.dateFormatter.get().parse(sDate)
|
utcDate = PwDatabaseV4XML.dateFormatter.get()?.parse(sDate)
|
||||||
} catch (e: ParseException) {
|
} catch (e: ParseException) {
|
||||||
// Catch with null test below
|
// Catch with null test below
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,9 +126,9 @@ class PwDbV3Output(private val mDatabaseV3: PwDatabaseV3, os: OutputStream) : Pw
|
|||||||
setIVs(header)
|
setIVs(header)
|
||||||
|
|
||||||
// Content checksum
|
// Content checksum
|
||||||
var md: MessageDigest? = null
|
val messageDigest: MessageDigest?
|
||||||
try {
|
try {
|
||||||
md = MessageDigest.getInstance("SHA-256")
|
messageDigest = MessageDigest.getInstance("SHA-256")
|
||||||
} catch (e: NoSuchAlgorithmException) {
|
} catch (e: NoSuchAlgorithmException) {
|
||||||
throw PwDbOutputException("SHA-256 not implemented here.", e)
|
throw PwDbOutputException("SHA-256 not implemented here.", e)
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ class PwDbV3Output(private val mDatabaseV3: PwDatabaseV3, os: OutputStream) : Pw
|
|||||||
|
|
||||||
// Output database for the purpose of calculating the content checksum
|
// Output database for the purpose of calculating the content checksum
|
||||||
nos = NullOutputStream()
|
nos = NullOutputStream()
|
||||||
val dos = DigestOutputStream(nos, md)
|
val dos = DigestOutputStream(nos, messageDigest)
|
||||||
val bos = BufferedOutputStream(dos)
|
val bos = BufferedOutputStream(dos)
|
||||||
try {
|
try {
|
||||||
outputPlanGroupAndEntries(bos)
|
outputPlanGroupAndEntries(bos)
|
||||||
@@ -169,7 +169,7 @@ class PwDbV3Output(private val mDatabaseV3: PwDatabaseV3, os: OutputStream) : Pw
|
|||||||
throw PwDbOutputException("Failed to generate checksum.", e)
|
throw PwDbOutputException("Failed to generate checksum.", e)
|
||||||
}
|
}
|
||||||
|
|
||||||
header.contentsHash = md!!.digest()
|
header.contentsHash = messageDigest!!.digest()
|
||||||
|
|
||||||
// Output header for real output, containing content hash
|
// Output header for real output, containing content hash
|
||||||
pho = PwDbHeaderOutputV3(header, outputStream)
|
pho = PwDbHeaderOutputV3(header, outputStream)
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ object PreferencesUtil {
|
|||||||
return try {
|
return try {
|
||||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
java.lang.Long.parseLong(prefs.getString(context.getString(R.string.app_timeout_key),
|
java.lang.Long.parseLong(prefs.getString(context.getString(R.string.app_timeout_key),
|
||||||
context.getString(R.string.clipboard_timeout_default)))
|
context.getString(R.string.clipboard_timeout_default)) ?: "60000")
|
||||||
} catch (e: NumberFormatException) {
|
} catch (e: NumberFormatException) {
|
||||||
TimeoutHelper.DEFAULT_TIMEOUT
|
TimeoutHelper.DEFAULT_TIMEOUT
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class InputNumberPreference @JvmOverloads constructor(context: Context,
|
|||||||
if (!restorePersistedValue) {
|
if (!restorePersistedValue) {
|
||||||
numberValue = 100000
|
numberValue = 100000
|
||||||
if (defaultValue is String) {
|
if (defaultValue is String) {
|
||||||
numberValue = java.lang.Long.parseLong(defaultValue as String?)
|
numberValue = java.lang.Long.parseLong(defaultValue)
|
||||||
}
|
}
|
||||||
if (defaultValue is Int) {
|
if (defaultValue is Int) {
|
||||||
numberValue = defaultValue.toLong()
|
numberValue = defaultValue.toLong()
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class ClipboardHelper(private val context: Context) {
|
|||||||
val sClipClear = prefs.getString(context.getString(R.string.clipboard_timeout_key),
|
val sClipClear = prefs.getString(context.getString(R.string.clipboard_timeout_key),
|
||||||
context.getString(R.string.clipboard_timeout_default))
|
context.getString(R.string.clipboard_timeout_default))
|
||||||
|
|
||||||
val clipClearTime = java.lang.Long.parseLong(sClipClear)
|
val clipClearTime = java.lang.Long.parseLong(sClipClear ?: "60000")
|
||||||
|
|
||||||
if (clipClearTime > 0) {
|
if (clipClearTime > 0) {
|
||||||
mTimer.schedule(ClearClipboardTask(context, text), clipClearTime)
|
mTimer.schedule(ClearClipboardTask(context, text), clipClearTime)
|
||||||
|
|||||||
Reference in New Issue
Block a user