Files
keepass-fidelity/app/src/main/java/net/helcel/fidelity/tools/ErrorToaster.kt
2024-03-23 13:21:24 +01:00

24 lines
647 B
Kotlin

package net.helcel.fidelity.tools
import android.content.Context
import android.widget.Toast
object ErrorToaster {
private fun helper(activity: Context?, message: String, length: Int) {
if (activity != null)
Toast.makeText(activity, message, length).show()
}
fun noKP2AFound(activity: Context?) {
helper(activity, "KeePass2Android Not Installed", Toast.LENGTH_LONG)
}
fun formIncomplete(activity: Context?) {
helper(activity, "Form Incomplete", Toast.LENGTH_SHORT)
}
fun invalidFormat(activity: Context?) {
helper(activity, "Invalid Format", Toast.LENGTH_SHORT)
}
}