]> git.ktnx.net Git - mobile-ledger.git/commitdiff
unified transition into/out of the new transaction activity
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 8 Dec 2018 11:36:48 +0000 (11:36 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 8 Dec 2018 11:36:48 +0000 (11:36 +0000)
special treatment of the Back and Up buttons

app/src/main/java/net/ktnx/mobileledger/AccountSummary.java
app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java
app/src/main/res/anim/dummy.xml [new file with mode: 0644]
app/src/main/res/anim/slide_in_left.xml [new file with mode: 0644]
app/src/main/res/anim/slide_in_right.xml [new file with mode: 0644]
app/src/main/res/anim/slide_out_left.xml [new file with mode: 0644]
app/src/main/res/anim/slide_out_right.xml [new file with mode: 0644]

index 0973590cfa7641a7dcd6b53c322b57dec18b21c5..7b4d25795e3bce580b013fc90e745fa5d09648d1 100644 (file)
@@ -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) {
index dca8d463263623469af193670079199f072b44c6..6ccbbd0efb1d8ee1caffec2d3d35783bfa6ea90d 100644 (file)
@@ -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 (file)
index 0000000..35c98f4
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:duration="@android:integer/config_shortAnimTime">
+    <translate
+        android:fromXDelta="0%"
+        android:toXDelta="0%" />
+</set>
\ 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 (file)
index 0000000..16787b1
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:duration="@android:integer/config_shortAnimTime">
+    <translate
+        android:fromXDelta="-100%"
+        android:toXDelta="0%" />
+</set>
\ 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 (file)
index 0000000..985c420
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:duration="@android:integer/config_shortAnimTime">
+    <translate
+        android:fromXDelta="100%"
+        android:toXDelta="0%" />
+</set>
\ 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 (file)
index 0000000..a8f0485
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:duration="@android:integer/config_shortAnimTime">
+    <translate
+        android:fromXDelta="0%"
+        android:toXDelta="-100%" />
+    <alpha
+        android:fromAlpha="1.0"
+        android:toAlpha="0.0" />
+</set>
\ 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 (file)
index 0000000..885efc0
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:duration="@android:integer/config_shortAnimTime">
+    <translate
+        android:fromXDelta="0%"
+        android:toXDelta="100%" />
+    <alpha
+        android:fromAlpha="1.0"
+        android:toAlpha="0.0" />
+</set>
\ No newline at end of file