From da290acddc603ec94d53fa972a88961d0c84cb82 Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 13 Sep 2018 21:56:06 -0500 Subject: [PATCH] Button send transaction get better animation --- .../fragments/SendTransactionFragment.java | 54 +- ...tsharesAccountMnemonicValidationField.java | 2 +- app/src/main/res/layout/send_transaction.xml | 491 +++++++++--------- app/src/main/res/values/styles.xml | 5 + 4 files changed, 313 insertions(+), 239 deletions(-) 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 6b87b37..5d7a0fc 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java @@ -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); /* diff --git a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/BitsharesAccountMnemonicValidationField.java b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/BitsharesAccountMnemonicValidationField.java index cbbbe72..8187320 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/BitsharesAccountMnemonicValidationField.java +++ b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/BitsharesAccountMnemonicValidationField.java @@ -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() { diff --git a/app/src/main/res/layout/send_transaction.xml b/app/src/main/res/layout/send_transaction.xml index 49794d1..82c801f 100644 --- a/app/src/main/res/layout/send_transaction.xml +++ b/app/src/main/res/layout/send_transaction.xml @@ -1,254 +1,271 @@ - + android:layout_height="match_parent" + android:theme="@style/ActivityDialog"> - + android:layout_margin="20dp" + android:background="@color/white" + android:id="@+id/scrollMain"> - - - + android:paddingBottom="24dp"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="24dp" + android:layout_marginTop="24dp" + android:text="@string/title_capital" + android:textColor="@color/white" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - \ No newline at end of file + + + + + + + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 4205156..81d3258 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -11,6 +11,11 @@ true + +