Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit 0e31fd7

Browse files
#177. Add review fixes.
1 parent 00a1b7c commit 0e31fd7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.blogspot.e_kanivets.moneytracker">
44

5-
<!-- Used only for Dropbox backup -->
65
<application
76
android:name=".MtApp"
87
android:allowBackup="true"

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/record/AddRecordActivity.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import android.app.Activity
55
import android.app.DatePickerDialog
66
import android.app.TimePickerDialog
77
import android.content.res.ColorStateList
8+
import android.graphics.Color
89
import android.support.v4.content.ContextCompat
910
import android.text.InputFilter
1011
import android.text.Spanned
@@ -107,16 +108,20 @@ class AddRecordActivity : BaseBackActivity() {
107108
tvTime.setOnClickListener { selectTime() }
108109

109110
if (type == Record.TYPE_EXPENSE) {
110-
fabDone.backgroundTintList = (ColorStateList.valueOf(ContextCompat.getColor(this, R.color.red_light)))
111+
fabDone.backgroundTintList = (getColorForFab(R.color.red_light))
111112
} else {
112-
fabDone.backgroundTintList = (ColorStateList.valueOf(ContextCompat.getColor(this, R.color.green_light)))
113+
fabDone.backgroundTintList = (getColorForFab(R.color.green_light))
113114
}
114115

115116
fabDone.setOnClickListener { tryRecord() }
116117

117118
updateDateAndTime()
118119
}
119120

121+
private fun getColorForFab(color: Int): ColorStateList {
122+
return ColorStateList.valueOf(ContextCompat.getColor(this, color))
123+
}
124+
120125
private fun initCategoryAutocomplete() {
121126
val categoryAutoCompleteAdapter = CategoryAutoCompleteAdapter(
122127
this, R.layout.view_category_item, autoCompleter)
@@ -290,8 +295,7 @@ class AddRecordActivity : BaseBackActivity() {
290295
private class SemicolonInputFilter : InputFilter {
291296

292297
override fun filter(source: CharSequence?, start: Int, end: Int, dest: Spanned, dstart: Int, dend: Int): CharSequence? {
293-
return if (source != null && ";" == source.toString()) ""
294-
else null
298+
return if (source != null && ";" == source.toString()) "" else null
295299
}
296300
}
297301

0 commit comments

Comments
 (0)