Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#177. Redesign AddRecordActivity.
  • Loading branch information
bogdan-evtushenko committed Sep 13, 2019
commit 00a1b7cddd5e15e5287089d8a201e8e1aea460f0
18 changes: 9 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
package="com.blogspot.e_kanivets.moneytracker">

<!-- Used only for Dropbox backup -->
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".MtApp"
android:allowBackup="true"
Expand Down Expand Up @@ -32,7 +30,7 @@
android:name=".activity.record.AddRecordActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Default"
android:windowSoftInputMode="stateVisible" />
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".activity.account.AddAccountActivity"
android:label="@string/title_add_account"
Expand Down Expand Up @@ -98,15 +96,19 @@
android:launchMode="singleTask"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<data android:scheme="db-5lqugcckdy9y6lj" />

<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.BROWSABLE" />

<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="db-5lqugcckdy9y6lj" />
</intent-filter>
</activity>

<meta-data
android:name="io.fabric.ApiKey"
android:value="955ae4864ae2a833aeda5b62631512524288adf8" />

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.blogspot.e_kanivets.moneytracker"
Expand All @@ -117,10 +119,8 @@
android:resource="@xml/file_paths" />
</provider>

<meta-data
android:name="io.fabric.ApiKey"
android:value="955ae4864ae2a833aeda5b62631512524288adf8" />

</application>

<uses-permission android:name="android.permission.INTERNET" />

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.annotation.SuppressLint
import android.app.Activity
import android.app.DatePickerDialog
import android.app.TimePickerDialog
import android.content.res.ColorStateList
import android.support.v4.content.ContextCompat
import android.text.InputFilter
import android.text.Spanned
import android.text.format.DateFormat
Expand All @@ -29,6 +31,7 @@ import com.blogspot.e_kanivets.moneytracker.util.AnswersProxy
import com.blogspot.e_kanivets.moneytracker.util.CategoryAutoCompleter
import com.blogspot.e_kanivets.moneytracker.util.validator.IValidator
import com.blogspot.e_kanivets.moneytracker.util.validator.RecordValidator
import kotlinx.android.synthetic.main.activity_add_record.*
import kotlinx.android.synthetic.main.content_add_record.*
import java.util.*
import javax.inject.Inject
Expand Down Expand Up @@ -103,6 +106,14 @@ class AddRecordActivity : BaseBackActivity() {
tvDate.setOnClickListener { selectDate() }
tvTime.setOnClickListener { selectTime() }

if (type == Record.TYPE_EXPENSE) {
fabDone.backgroundTintList = (ColorStateList.valueOf(ContextCompat.getColor(this, R.color.red_light)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ColorStateList.valueOf(ContextCompat.getColor(this, is duplicated, so presumably can be extracted.

} else {
fabDone.backgroundTintList = (ColorStateList.valueOf(ContextCompat.getColor(this, R.color.green_light)))
}

fabDone.setOnClickListener { tryRecord() }

updateDateAndTime()
}

Expand Down Expand Up @@ -145,21 +156,16 @@ class AddRecordActivity : BaseBackActivity() {
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.action_done -> {
tryRecord()
return true
}

return when (item.itemId) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

R.id.action_delete -> {
if (recordController.delete(record)) {
setResult(Activity.RESULT_OK)
finish()
}
return true
true
}

else -> return super.onOptionsItemSelected(item)
else -> super.onOptionsItemSelected(item)
}
}

Expand Down
10 changes: 9 additions & 1 deletion app/src/main/res/layout/activity_add_record.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activity.record.AddRecordActivity">

<android.support.design.widget.AppBarLayout
Expand All @@ -20,6 +21,13 @@

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_add_record" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabDone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_done"
android:layout_margin="@dimen/normal_margin" />

<include layout="@layout/content_add_record" />
</android.support.design.widget.CoordinatorLayout>
6 changes: 0 additions & 6 deletions app/src/main/res/menu/menu_add_record.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,4 @@
android:title="@string/delete"
tools:showAsAction="ifRoom" />

<item
android:id="@+id/action_done"
android:icon="@drawable/ic_done"
android:title="@string/add"
tools:showAsAction="ifRoom" />

</menu>