Cleanup filters.

This commit is contained in:
Erik C. Thauvin 2020-07-28 03:17:41 -07:00
parent 98dc25b3b9
commit 161c5ff643
2 changed files with 7 additions and 8 deletions

View file

@ -128,7 +128,7 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
val tmp: Config? = try { val tmp: Config? = try {
Gson().fromJson( Gson().fromJson(
InputStreamReader(contentResolver.openInputStream(intent.data!!)), InputStreamReader(contentResolver.openInputStream(intent.data!!)!!),
Config::class.java Config::class.java
) )
} catch (jse: JsonSyntaxException) { } catch (jse: JsonSyntaxException) {
@ -260,6 +260,7 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
// programming title // programming title
textView { textView {
topPadding = dip(10) topPadding = dip(10)
bottomPadding = dip(10)
text = getString(R.string.programming_heading) text = getString(R.string.programming_heading)
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18f) setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18f)
typeface = Typeface.DEFAULT_BOLD typeface = Typeface.DEFAULT_BOLD
@ -338,7 +339,7 @@ class MainActivity : AppCompatActivity(), AnkoLogger {
alert.show() alert.show()
} }
} }
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item!!)
} }
@SuppressLint("NeedOnRequestPermissionsResult") @SuppressLint("NeedOnRequestPermissionsResult")

View file

@ -51,17 +51,15 @@ class MinMaxFilter(
if (zeros) { if (zeros) {
if (size > 1 && len != size) { if (size > 1 && len != size) {
i = if (i == 0) { if (i == 0) {
return true return true
} else { } else {
s.padEnd(size, '0').toInt() i = s.padEnd(size, '0').toInt()
} }
} }
} else { } else if (len > 1 && s.startsWith("0")) {
if (len > 1 && s.startsWith("0")) {
return false return false
} }
}
return i in IntRange(min, max) return i in IntRange(min, max)
} catch (nfe: NumberFormatException) { } catch (nfe: NumberFormatException) {