From 2f17f66ba99b8730426344b1611165b120966b00 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 8 Dec 2018 11:36:48 +0000 Subject: [PATCH] unified transition into/out of the new transaction activity special treatment of the Back and Up buttons --- .../net/ktnx/mobileledger/AccountSummary.java | 1 + .../mobileledger/NewTransactionActivity.java | 16 ++++++++++++++++ app/src/main/res/anim/dummy.xml | 7 +++++++ app/src/main/res/anim/slide_in_left.xml | 7 +++++++ app/src/main/res/anim/slide_in_right.xml | 7 +++++++ app/src/main/res/anim/slide_out_left.xml | 10 ++++++++++ app/src/main/res/anim/slide_out_right.xml | 10 ++++++++++ 7 files changed, 58 insertions(+) create mode 100644 app/src/main/res/anim/dummy.xml create mode 100644 app/src/main/res/anim/slide_in_left.xml create mode 100644 app/src/main/res/anim/slide_in_right.xml create mode 100644 app/src/main/res/anim/slide_out_left.xml create mode 100644 app/src/main/res/anim/slide_out_right.xml diff --git a/app/src/main/java/net/ktnx/mobileledger/AccountSummary.java b/app/src/main/java/net/ktnx/mobileledger/AccountSummary.java index 0973590c..7b4d2579 100644 --- a/app/src/main/java/net/ktnx/mobileledger/AccountSummary.java +++ b/app/src/main/java/net/ktnx/mobileledger/AccountSummary.java @@ -87,6 +87,7 @@ public class AccountSummary extends AppCompatActivity { public void fab_new_transaction_clicked(View view) { Intent intent = new Intent(this, NewTransactionActivity.class); startActivity(intent); + overridePendingTransition(R.anim.slide_in_right, R.anim.dummy); } public void nav_exit_clicked(View view) { diff --git a/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java b/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java index dca8d463..6ccbbd0e 100644 --- a/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java @@ -87,6 +87,22 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal } } + @Override + public void finish() { + super.finish(); + overridePendingTransition(R.anim.dummy, R.anim.slide_out_right); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + public void save_transaction() { mSave.setVisible(false); toggle_all_editing(false); diff --git a/app/src/main/res/anim/dummy.xml b/app/src/main/res/anim/dummy.xml new file mode 100644 index 00000000..35c98f4b --- /dev/null +++ b/app/src/main/res/anim/dummy.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/slide_in_left.xml b/app/src/main/res/anim/slide_in_left.xml new file mode 100644 index 00000000..16787b13 --- /dev/null +++ b/app/src/main/res/anim/slide_in_left.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/slide_in_right.xml b/app/src/main/res/anim/slide_in_right.xml new file mode 100644 index 00000000..985c4204 --- /dev/null +++ b/app/src/main/res/anim/slide_in_right.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/slide_out_left.xml b/app/src/main/res/anim/slide_out_left.xml new file mode 100644 index 00000000..a8f04857 --- /dev/null +++ b/app/src/main/res/anim/slide_out_left.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/slide_out_right.xml b/app/src/main/res/anim/slide_out_right.xml new file mode 100644 index 00000000..885efc06 --- /dev/null +++ b/app/src/main/res/anim/slide_out_right.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file -- 2.39.5