From b06420eb830612898ace3ddab9c73d71d9c76cb8 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 26 May 2019 12:40:03 +0530 Subject: Improve nullability coverage (#514) * Switch to in-built RV divider * Switch getActivity calls to requireActivity This enforces non-null activity and throws a proper exception when it is null for some reason. Signed-off-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/pwgen/PasswordGenerator.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/com/zeapo/pwdstore/pwgen') diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgen/PasswordGenerator.kt b/app/src/main/java/com/zeapo/pwdstore/pwgen/PasswordGenerator.kt index 6132d2dc..dcb2c199 100644 --- a/app/src/main/java/com/zeapo/pwdstore/pwgen/PasswordGenerator.kt +++ b/app/src/main/java/com/zeapo/pwdstore/pwgen/PasswordGenerator.kt @@ -47,6 +47,7 @@ object PasswordGenerator { * @return `false` if a numerical options is invalid, * `true` otherwise */ + @JvmStatic fun setPrefs(ctx: Context, argv: ArrayList, vararg numArgv: Int): Boolean { val prefs = ctx.getSharedPreferences("PasswordGenerator", Context.MODE_PRIVATE) val editor = prefs.edit() @@ -81,7 +82,7 @@ object PasswordGenerator { * preferences file 'PasswordGenerator' * @return list of generated passwords */ - @Throws(PasswordGenerator.PasswordGeneratorExeption::class) + @JvmStatic @Throws(PasswordGenerator.PasswordGeneratorExeption::class) fun generate(ctx: Context): ArrayList { val prefs = ctx.getSharedPreferences("PasswordGenerator", Context.MODE_PRIVATE) @@ -140,6 +141,6 @@ object PasswordGenerator { return passwords } - public class PasswordGeneratorExeption(string: String) : Exception(string) + class PasswordGeneratorExeption(string: String) : Exception(string) } -- cgit v1.2.3