From b57666dff535a626c975884eabb7a714f85aa302 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Sat, 23 Dec 2017 19:39:01 -0600 Subject: [PATCH] Improved SendTransactionFragment in and out animations --- .../fragments/SendTransactionFragment.java | 17 +++++++++++++++++ app/src/main/res/anim/send_transaction_in.xml | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) 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 db1b799..8bbe4e2 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java @@ -5,6 +5,7 @@ import android.arch.lifecycle.LiveData; import android.arch.lifecycle.Observer; import android.content.DialogInterface; import android.os.Bundle; +import android.os.Handler; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; @@ -75,6 +76,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat private CryptoNetAccount cryptoNetAccount; private GrapheneAccount grapheneAccount; private CrystalDatabase db; + private FloatingActionButton fabSend; public static SendTransactionFragment newInstance(long cryptoNetAccountId) { SendTransactionFragment f = new SendTransactionFragment(); @@ -95,6 +97,9 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { + fabSend = getActivity().findViewById(R.id.fabSend); + fabSend.hide(); + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.SendTransactionTheme); //builder.setTitle("Send"); @@ -146,6 +151,18 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } + @Override + public void onDetach() { + super.onDetach(); + + Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + public void run() { + fabSend.show(); + } + }, 400); + } + @OnItemSelected(R.id.spFrom) public void afterFromSelected(Spinner spinner, int position) { this.sendTransactionValidator.validate(); diff --git a/app/src/main/res/anim/send_transaction_in.xml b/app/src/main/res/anim/send_transaction_in.xml index 2cd3797..ef3a508 100644 --- a/app/src/main/res/anim/send_transaction_in.xml +++ b/app/src/main/res/anim/send_transaction_in.xml @@ -1,7 +1,8 @@ + android:interpolator="@android:anim/overshoot_interpolator" + android:startOffset="400">