Improved SendTransactionFragment in and out animations

This commit is contained in:
Severiano Jaramillo 2017-12-23 19:39:01 -06:00
parent 5ee1782454
commit b57666dff5
2 changed files with 19 additions and 1 deletions

View file

@ -5,6 +5,7 @@ import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
@ -75,6 +76,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
private CryptoNetAccount cryptoNetAccount; private CryptoNetAccount cryptoNetAccount;
private GrapheneAccount grapheneAccount; private GrapheneAccount grapheneAccount;
private CrystalDatabase db; private CrystalDatabase db;
private FloatingActionButton fabSend;
public static SendTransactionFragment newInstance(long cryptoNetAccountId) { public static SendTransactionFragment newInstance(long cryptoNetAccountId) {
SendTransactionFragment f = new SendTransactionFragment(); SendTransactionFragment f = new SendTransactionFragment();
@ -95,6 +97,9 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
@NonNull @NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
fabSend = getActivity().findViewById(R.id.fabSend);
fabSend.hide();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.SendTransactionTheme); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.SendTransactionTheme);
//builder.setTitle("Send"); //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); 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) @OnItemSelected(R.id.spFrom)
public void afterFromSelected(Spinner spinner, int position) { public void afterFromSelected(Spinner spinner, int position) {
this.sendTransactionValidator.validate(); this.sendTransactionValidator.validate();

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set <set
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/overshoot_interpolator" > android:interpolator="@android:anim/overshoot_interpolator"
android:startOffset="400">
<translate <translate
android:fromXDelta="150%" android:fromXDelta="150%"
android:toXDelta="0%" android:toXDelta="0%"