From 57a95e8fd2d793e96d05cef010dc58aeb70c92c7 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Thu, 21 Dec 2017 23:34:43 -0600 Subject: [PATCH] Added accounts fragment with transparent background --- .../activities/BoardActivity.java | 27 +++- .../fragments/AccountsFragment.java | 83 ++++++++++ app/src/main/res/drawable/ic_add_24dp.xml | 9 ++ .../main/res/drawable/ic_settings_24dp.xml | 9 ++ app/src/main/res/layout/fragment_accounts.xml | 144 ++++++++++++++++++ .../main/res/layout/receive_transaction.xml | 2 +- app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/strings.xml | 6 +- app/src/main/res/values/styles.xml | 4 + 9 files changed, 281 insertions(+), 4 deletions(-) create mode 100644 app/src/main/java/cy/agorise/crystalwallet/fragments/AccountsFragment.java create mode 100644 app/src/main/res/drawable/ic_add_24dp.xml create mode 100644 app/src/main/res/drawable/ic_settings_24dp.xml create mode 100644 app/src/main/res/layout/fragment_accounts.xml 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 83ea5ff..f8f9eab 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java @@ -22,11 +22,14 @@ import android.view.SurfaceView; import android.view.View; import android.view.animation.LinearInterpolator; import android.widget.ImageButton; +import android.widget.ImageView; +import butterknife.BindColor; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import cy.agorise.crystalwallet.R; +import cy.agorise.crystalwallet.fragments.AccountsFragment; import cy.agorise.crystalwallet.fragments.BalanceFragment; import cy.agorise.crystalwallet.fragments.ContactsFragment; import cy.agorise.crystalwallet.fragments.ReceiveTransactionFragment; @@ -62,7 +65,11 @@ public class BoardActivity extends AppCompatActivity { */ long cryptoNetAccountId; - private SurfaceView mSurfaceView; + @BindView(R.id.surface_view) + public SurfaceView mSurfaceView; + + @BindView(R.id.toolbar_user_img) + public ImageView userImage; @Override protected void onCreate(Bundle savedInstanceState) { @@ -77,7 +84,6 @@ public class BoardActivity extends AppCompatActivity { setSupportActionBar(toolbar); // Appbar animation - mSurfaceView = findViewById(R.id.surface_view); mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder surfaceHolder) { @@ -166,6 +172,23 @@ public class BoardActivity extends AppCompatActivity { }); } + /* + * dispatch the user to the accounts fragment + */ + @OnClick(R.id.toolbar_user_img) + public void accounts() { + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + Fragment prev = getSupportFragmentManager().findFragmentByTag("AccountsDialog"); + if (prev != null) { + ft.remove(prev); + } + ft.addToBackStack(null); + + // Create and show the dialog. + AccountsFragment newFragment = AccountsFragment.newInstance(this.cryptoNetAccountId); + newFragment.show(ft, "AccountsDialog"); + } + /* * dispatch the user to the receive fragment using this account */ diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/AccountsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/AccountsFragment.java new file mode 100644 index 0000000..58c9e11 --- /dev/null +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/AccountsFragment.java @@ -0,0 +1,83 @@ +package cy.agorise.crystalwallet.fragments; + +import android.app.Dialog; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.app.DialogFragment; +import android.support.v7.app.AlertDialog; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; +import cy.agorise.crystalwallet.R; + +public class AccountsFragment extends DialogFragment { + + @BindView(R.id.tvClose) + TextView tvClose; + + public AccountsFragment() { + // Required empty public constructor + } + + public static AccountsFragment newInstance(long cryptoNetAccountId) { + AccountsFragment f = new AccountsFragment(); + + // Supply num input as an argument. + Bundle args = new Bundle(); + args.putLong("CRYPTO_NET_ACCOUNT_ID", cryptoNetAccountId); + f.setArguments(args); + + return f; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + /*@Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View view = inflater.inflate(R.layout.fragment_accounts, container, false); + ButterKnife.bind(this, view); + + return view; + }*/ + + @NonNull + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AccountsTheme); + + LayoutInflater inflater = getActivity().getLayoutInflater(); + View view = inflater.inflate(R.layout.fragment_accounts, null); + ButterKnife.bind(this, view); + + builder.setView(view); + Dialog dialog = builder.create(); + + return dialog; + + } + + @Override + public void onResume() { + super.onResume(); + + // Force dialog fragment to use the full width of the screen + getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + } + + @OnClick(R.id.tvClose) + public void cancel(){ + this.dismiss(); + } +} diff --git a/app/src/main/res/drawable/ic_add_24dp.xml b/app/src/main/res/drawable/ic_add_24dp.xml new file mode 100644 index 0000000..0ca2ede --- /dev/null +++ b/app/src/main/res/drawable/ic_add_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_settings_24dp.xml b/app/src/main/res/drawable/ic_settings_24dp.xml new file mode 100644 index 0000000..d4255f1 --- /dev/null +++ b/app/src/main/res/drawable/ic_settings_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/fragment_accounts.xml b/app/src/main/res/layout/fragment_accounts.xml new file mode 100644 index 0000000..25dc617 --- /dev/null +++ b/app/src/main/res/layout/fragment_accounts.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/receive_transaction.xml b/app/src/main/res/layout/receive_transaction.xml index ed2916e..37dda20 100644 --- a/app/src/main/res/layout/receive_transaction.xml +++ b/app/src/main/res/layout/receive_transaction.xml @@ -146,7 +146,7 @@ android:layout_height="20dp" android:layout_marginBottom="24dp" android:layout_marginEnd="24dp" - android:text="@string/receive_close" + android:text="@string/close" android:textSize="18sp" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index c3aa5bd..dad7b53 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -5,6 +5,7 @@ #669900 #d3d3d3 #686767 + #E3E3E3 #ffffff #f0006b #00ffffff diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 523017f..2ad9eb9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -457,5 +457,9 @@ Send Assets Receive Assets Share this QR - CLOSE + CLOSE + user_name + My Accounts + You don\'t have multiple accounts at the moment + SETTINGS diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 8c96582..689dd46 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -74,4 +74,8 @@ @anim/receive_transaction_in @anim/receive_transaction_out + +