From efef66f4e9d7c281d512c6891093bbfdb1a9cc33 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Thu, 7 Dec 2017 22:59:18 -0600 Subject: [PATCH] Created ReceiveTransactionFragment layout and fixed fragment transitions --- app/build.gradle | 5 +++- .../activities/BoardActivity.java | 26 +++++++++++++++++++ .../fragments/ReceiveTransactionFragment.java | 20 +++++++++----- .../main/res/anim/receive_transaction_in.xml | 7 +++-- .../main/res/anim/receive_transaction_out.xml | 2 +- app/src/main/res/anim/send_transaction_in.xml | 7 +++-- app/src/main/res/layout/board.xml | 9 ++++--- 7 files changed, 60 insertions(+), 16 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ce4faeb..9f4e57d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,6 +15,9 @@ android { arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] } } + vectorDrawables { + useSupportLibrary true + } multiDexEnabled true } buildTypes { @@ -49,7 +52,7 @@ dependencies { compile 'org.tukaani:xz:1.6' compile 'com.jakewharton:butterknife:8.8.1' compile 'com.github.bilthon:graphenej:0.4.6-alpha1' - compile 'com.google.zxing:core:3.3.1'; + compile 'com.google.zxing:core:3.3.1' testCompile 'junit:junit:4.12' testCompile 'org.mockito:mockito-core:1.10.19' diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java index 00f4827..e22ee36 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java @@ -23,6 +23,7 @@ import butterknife.OnClick; import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.fragments.BalanceFragment; import cy.agorise.crystalwallet.fragments.ContactsFragment; +import cy.agorise.crystalwallet.fragments.ReceiveTransactionFragment; import cy.agorise.crystalwallet.fragments.SendTransactionFragment; import cy.agorise.crystalwallet.fragments.TransactionsFragment; @@ -75,6 +76,12 @@ public class BoardActivity extends AppCompatActivity { mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager)); + fabReceive.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + receiveToThisAccount(); + } + }); fabSend.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -128,6 +135,25 @@ public class BoardActivity extends AppCompatActivity { }); } + /* + * dispatch the user to the receive fragment using this account + */ + public void receiveToThisAccount(){ + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + Fragment prev = getSupportFragmentManager().findFragmentByTag("ReceiveDialog"); + if (prev != null) { + ft.remove(prev); + } + ft.addToBackStack(null); + + // Create and show the dialog. + ReceiveTransactionFragment newFragment = ReceiveTransactionFragment.newInstance(this.cryptoNetAccountId); + newFragment.show(ft, "ReceiveDialog"); + } + + /* + * dispatch the user to the send fragment using this account + */ public void sendFromThisAccount(){ FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("SendDialog"); 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 bb17cb6..3349763 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/ReceiveTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/ReceiveTransactionFragment.java @@ -26,6 +26,7 @@ import com.google.zxing.MultiFormatWriter; import com.google.zxing.WriterException; import com.google.zxing.common.BitMatrix; +import butterknife.OnClick; import cy.agorise.graphenej.Invoice; import java.util.ArrayList; import java.util.List; @@ -62,6 +63,8 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali TextView tvAssetError; @BindView(R.id.ivQrCode) ImageView ivQrCode; + @BindView(R.id.tvCancel) + TextView tvCancel; private Button btnShareQrCode; private Button btnClose; @@ -97,8 +100,8 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setTitle("Receive Assets"); + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.ReceiveTransactionTheme); + //builder.setTitle("Receive Assets"); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.receive_transaction, null); @@ -138,18 +141,18 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali builder.setView(view); - builder.setPositiveButton("Share this QR", new DialogInterface.OnClickListener() { + /*builder.setPositiveButton("Share this QR", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { shareQrCode(); } - }); - builder.setNegativeButton("Close", new DialogInterface.OnClickListener() { + });*/ + /*builder.setNegativeButton("Close", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } - }); + });*/ AlertDialog dialog = builder.create(); @@ -184,6 +187,11 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali } } + @OnClick(R.id.tvCancel) + public void cancel(){ + this.dismiss(); + } + @Override public void onValidationSucceeded(final ValidationField field) { final ReceiveTransactionFragment fragment = this; diff --git a/app/src/main/res/anim/receive_transaction_in.xml b/app/src/main/res/anim/receive_transaction_in.xml index 6f7fd90..e0b4e2f 100644 --- a/app/src/main/res/anim/receive_transaction_in.xml +++ b/app/src/main/res/anim/receive_transaction_in.xml @@ -4,9 +4,12 @@ android:interpolator="@android:anim/overshoot_interpolator" > + + android:duration="420" /> \ No newline at end of file diff --git a/app/src/main/res/anim/receive_transaction_out.xml b/app/src/main/res/anim/receive_transaction_out.xml index fbf2b97..6ac9f7d 100644 --- a/app/src/main/res/anim/receive_transaction_out.xml +++ b/app/src/main/res/anim/receive_transaction_out.xml @@ -18,7 +18,7 @@ android:shareInterpolator="true" android:interpolator="@android:anim/linear_interpolator" > + + android:duration="420" /> \ No newline at end of file diff --git a/app/src/main/res/layout/board.xml b/app/src/main/res/layout/board.xml index be66098..fc37be7 100644 --- a/app/src/main/res/layout/board.xml +++ b/app/src/main/res/layout/board.xml @@ -12,6 +12,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="@dimen/appbar_padding_top" + android:background="@color/colorPrimary" app:theme="@style/AppTheme.AppBarOverlay"> + android:text="@string/balances" /> + android:text="@string/transactions" /> + android:text="@string/contacts" />