Button send transaction get better animation

This commit is contained in:
dtvv 2018-09-13 21:56:06 -05:00
parent b7235db5f2
commit da290acddc
4 changed files with 313 additions and 239 deletions

View file

@ -24,15 +24,18 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
import com.google.zxing.Result;
import com.jaredrummler.materialspinner.MaterialSpinner;
import com.vincent.filepicker.ToastUtil;
import java.io.File;
import java.math.RoundingMode;
@ -79,12 +82,16 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
TextView tvFromError;
@BindView(R.id.etTo)
EditText etTo;
@BindView(R.id.viewSend)
View viewSend;
@BindView(R.id.tvToError)
TextView tvToError;
@BindView(R.id.spAsset)
Spinner spAsset;
@BindView(R.id.tvAssetError)
TextView tvAssetError;
@BindView(R.id.scrollMain)
ScrollView scrollMain;
@BindView(R.id.etAmount)
EditText etAmount;
@BindView(R.id.tvAmountError)
@ -136,13 +143,58 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
fabSend.hide();
//AlertDialog.Builder
builder = new AlertDialog.Builder(getActivity(), R.style.SendTransactionTheme);
builder = new AlertDialog.Builder(getActivity(), R.style.dialog_theme_full);
//builder.setTitle("Send");
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.send_transaction, null);
ButterKnife.bind(this, view);
/*
* Detet scroll changes
* */
scrollMain.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
View view = scrollMain.getChildAt(scrollMain.getChildCount() - 1);
int diff = (view.getBottom() - (scrollMain.getHeight() + scrollMain.getScrollY()));
float traslationY = btnSend.getTranslationY();
if(diff<=266 && diff>128){
//btnSend.setTranslationY(0);
//viewSend.setTranslationY(0);
btnSend.animate().y(880);
viewSend.animate().y(800);
}
else if(diff<=128 && diff>10){
//btnSend.setTranslationY(-130);
//viewSend.setTranslationY(-130);
btnSend.animate().y(880);
viewSend.animate().y(800);
}
else if(diff<=10 && diff>0){
//btnSend.setTranslationY(-170);
//viewSend.setTranslationY(-170);
btnSend.animate().y(680);
viewSend.animate().y(600);
}
else if(diff==0){
//btnSend.setTranslationY(-190);
//viewSend.setTranslationY(-190);
btnSend.animate().y(680);
viewSend.animate().y(600);
}
}
});
this.cryptoNetAccountId = getArguments().getLong("CRYPTO_NET_ACCOUNT_ID",-1);
/*

View file

@ -31,7 +31,7 @@ public class BitsharesAccountMnemonicValidationField extends ValidationField {
this.startValidating();
final ValidationField field = this;
final ValidateImportBitsharesAccountRequest request = new ValidateImportBitsharesAccountRequest(newAccountNameValue,newMnemonicValue);
final ValidateImportBitsharesAccountRequest request = new ValidateImportBitsharesAccountRequest(newAccountNameValue,newMnemonicValue,accountNameField.getContext());
request.setListener(new CryptoNetInfoRequestListener() {
@Override
public void onCarryOut() {

View file

@ -1,10 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent"
android:theme="@style/ActivityDialog">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:background="@color/white"
android:id="@+id/scrollMain">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
@ -209,24 +218,6 @@
app:layout_constraintBottom_toBottomOf="@+id/ivCamera"
app:layout_constraintStart_toStartOf="@+id/ivCamera" />
<View
android:id="@+id/viewSend"
android:layout_width="120dp"
android:layout_height="140dp"
android:layout_marginEnd="0dp"
android:background="@drawable/send_transaction_send_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/ivCamera" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/btnSend"
android:layout_width="90dp"
android:layout_height="90dp"
app:backgroundTint="@color/send_strong_orange"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/ic_arrow_forward"
tools:layout_editor_absoluteY="471dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -252,3 +243,29 @@
</android.support.constraint.ConstraintLayout>
</ScrollView>
<View
android:id="@+id/viewSend"
android:layout_width="120dp"
android:layout_height="140dp"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginTop="400dp"
android:background="@drawable/send_transaction_send_view" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/btnSend"
android:layout_width="90dp"
android:scaleX="1.7"
android:scaleY="1.7"
app:fabSize="normal"
android:layout_height="90dp"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginRight="30dp"
android:layout_marginTop="441dp"
android:scaleType="center"
app:backgroundTint="@color/send_strong_orange"
app:srcCompat="@drawable/ic_arrow_forward"/>
</RelativeLayout>

View file

@ -11,6 +11,11 @@
<item name="android:windowContentTransitions">true</item>
</style>
<style name="dialog_theme_full" parent="android:Theme" >
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
</style>
<style name="ActivityDialog" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>