From eaaf6303b17d253dd2dbb3d748969ef319c00d46 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Sat, 23 Dec 2017 19:52:37 -0600 Subject: [PATCH] Improved ReceiveTransactionFragment in and out animations --- .../fragments/ReceiveTransactionFragment.java | 18 ++++++++++++++++++ .../fragments/SendTransactionFragment.java | 4 ++-- .../main/res/anim/receive_transaction_in.xml | 3 ++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/ReceiveTransactionFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/ReceiveTransactionFragment.java index 3349763..d2e00f5 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/ReceiveTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/ReceiveTransactionFragment.java @@ -7,8 +7,10 @@ import android.arch.lifecycle.Observer; import android.content.DialogInterface; import android.graphics.Bitmap; import android.os.Bundle; +import android.os.Handler; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.design.widget.FloatingActionButton; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import android.text.Editable; @@ -78,6 +80,8 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali private Invoice invoice; private ArrayList invoiceItems; + private FloatingActionButton fabReceive; + public static ReceiveTransactionFragment newInstance(long cryptoNetAccountId) { ReceiveTransactionFragment f = new ReceiveTransactionFragment(); @@ -100,6 +104,8 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { + fabReceive = getActivity().findViewById(R.id.fabReceive); + fabReceive.hide(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.ReceiveTransactionTheme); //builder.setTitle("Receive Assets"); @@ -169,6 +175,18 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali return dialog; } + @Override + public void onDestroy() { + super.onDestroy(); + + Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + public void run() { + fabReceive.show(); + } + }, 400); + } + @OnTextChanged(value = R.id.etAmount, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED) void afterAmountChanged(Editable editable) { diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java index 8bbe4e2..ac6d16d 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java @@ -152,8 +152,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat } @Override - public void onDetach() { - super.onDetach(); + public void onDestroy() { + super.onDestroy(); Handler handler = new Handler(); handler.postDelayed(new Runnable() { diff --git a/app/src/main/res/anim/receive_transaction_in.xml b/app/src/main/res/anim/receive_transaction_in.xml index e0b4e2f..0f925b5 100644 --- a/app/src/main/res/anim/receive_transaction_in.xml +++ b/app/src/main/res/anim/receive_transaction_in.xml @@ -1,7 +1,8 @@ + android:interpolator="@android:anim/overshoot_interpolator" + android:startOffset="400">