Added accounts fragment with transparent background
This commit is contained in:
parent
f153d5b933
commit
57a95e8fd2
9 changed files with 281 additions and 4 deletions
|
@ -22,11 +22,14 @@ import android.view.SurfaceView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.animation.LinearInterpolator;
|
import android.view.animation.LinearInterpolator;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import butterknife.BindColor;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
import cy.agorise.crystalwallet.R;
|
import cy.agorise.crystalwallet.R;
|
||||||
|
import cy.agorise.crystalwallet.fragments.AccountsFragment;
|
||||||
import cy.agorise.crystalwallet.fragments.BalanceFragment;
|
import cy.agorise.crystalwallet.fragments.BalanceFragment;
|
||||||
import cy.agorise.crystalwallet.fragments.ContactsFragment;
|
import cy.agorise.crystalwallet.fragments.ContactsFragment;
|
||||||
import cy.agorise.crystalwallet.fragments.ReceiveTransactionFragment;
|
import cy.agorise.crystalwallet.fragments.ReceiveTransactionFragment;
|
||||||
|
@ -62,7 +65,11 @@ public class BoardActivity extends AppCompatActivity {
|
||||||
*/
|
*/
|
||||||
long cryptoNetAccountId;
|
long cryptoNetAccountId;
|
||||||
|
|
||||||
private SurfaceView mSurfaceView;
|
@BindView(R.id.surface_view)
|
||||||
|
public SurfaceView mSurfaceView;
|
||||||
|
|
||||||
|
@BindView(R.id.toolbar_user_img)
|
||||||
|
public ImageView userImage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -77,7 +84,6 @@ public class BoardActivity extends AppCompatActivity {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
// Appbar animation
|
// Appbar animation
|
||||||
mSurfaceView = findViewById(R.id.surface_view);
|
|
||||||
mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
mSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
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
|
* dispatch the user to the receive fragment using this account
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
9
app/src/main/res/drawable/ic_add_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_add_24dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/lightGray"
|
||||||
|
android:pathData="M18,14 h-4 v5h-4v-5H5v-4h5V5h4v5h5v4z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable/ic_settings_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_settings_24dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/darkGray"
|
||||||
|
android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
|
||||||
|
</vector>
|
144
app/src/main/res/layout/fragment_accounts.xml
Normal file
144
app/src/main/res/layout/fragment_accounts.xml
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
<android.support.constraint.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/topView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:layout_marginEnd="0dp"
|
||||||
|
android:layout_marginStart="0dp"
|
||||||
|
android:layout_marginTop="45dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<cy.agorise.crystalwallet.util.CircularImageView
|
||||||
|
android:id="@+id/user_img"
|
||||||
|
android:layout_width="90dp"
|
||||||
|
android:layout_height="90dp"
|
||||||
|
android:src="@drawable/ken_code_gravatar"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
app:srcCompat="@drawable/ic_lightning_24dp"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/user_img"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/user_img"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/user_name_placeholder"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/topView"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/topView"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/topView"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/topView"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/secondView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@color/lightGray"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/topView"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/my_accounts"
|
||||||
|
android:textColor="@color/darkGray"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/secondView"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/secondView"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/secondView"/>
|
||||||
|
|
||||||
|
<android.support.design.widget.FloatingActionButton
|
||||||
|
android:id="@+id/fabAddAccount"
|
||||||
|
android:layout_width="55dp"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
app:fabSize="normal"
|
||||||
|
app:backgroundTint="@color/colorPrimary"
|
||||||
|
app:srcCompat="@drawable/ic_add_24dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/secondView"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/thirdView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="250dp"
|
||||||
|
android:background="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/secondView"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/dont_have_multiple_accounts"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:layout_marginEnd="64dp"
|
||||||
|
android:layout_marginStart="64dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/thirdView"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/thirdView"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/thirdView"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/thirdView"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/forthView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:background="@color/lightGray"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/thirdView"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivSettings"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
app:srcCompat="@drawable/ic_settings_24dp"
|
||||||
|
android:layout_marginStart="24dp"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/forthView"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/forthView"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/forthView"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvSettings"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/settings"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/ivSettings"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/forthView"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/forthView"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvClose"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/close"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/forthView"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/forthView"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/forthView"/>
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
|
@ -146,7 +146,7 @@
|
||||||
android:layout_height="20dp"
|
android:layout_height="20dp"
|
||||||
android:layout_marginBottom="24dp"
|
android:layout_marginBottom="24dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
android:text="@string/receive_close"
|
android:text="@string/close"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<color name="colorAccent">#669900</color>
|
<color name="colorAccent">#669900</color>
|
||||||
<color name="gray">#d3d3d3</color>
|
<color name="gray">#d3d3d3</color>
|
||||||
<color name="darkGray">#686767</color>
|
<color name="darkGray">#686767</color>
|
||||||
|
<color name="lightGray">#E3E3E3</color>
|
||||||
<color name="white">#ffffff</color>
|
<color name="white">#ffffff</color>
|
||||||
<color name="pink">#f0006b</color>
|
<color name="pink">#f0006b</color>
|
||||||
<color name="transparent">#00ffffff</color>
|
<color name="transparent">#00ffffff</color>
|
||||||
|
|
|
@ -457,5 +457,9 @@
|
||||||
<string name="title_capital">Send Assets</string>
|
<string name="title_capital">Send Assets</string>
|
||||||
<string name="receive_assets">Receive Assets</string>
|
<string name="receive_assets">Receive Assets</string>
|
||||||
<string name="share_this_qr">Share this QR</string>
|
<string name="share_this_qr">Share this QR</string>
|
||||||
<string name="receive_close">CLOSE</string>
|
<string name="close">CLOSE</string>
|
||||||
|
<string name="user_name_placeholder">user_name</string>
|
||||||
|
<string name="my_accounts">My Accounts</string>
|
||||||
|
<string name="dont_have_multiple_accounts">You don\'t have multiple accounts at the moment</string>
|
||||||
|
<string name="settings">SETTINGS</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -74,4 +74,8 @@
|
||||||
<item name="android:windowEnterAnimation">@anim/receive_transaction_in</item>
|
<item name="android:windowEnterAnimation">@anim/receive_transaction_in</item>
|
||||||
<item name="android:windowExitAnimation">@anim/receive_transaction_out</item>
|
<item name="android:windowExitAnimation">@anim/receive_transaction_out</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="AccountsTheme" parent="Theme.AppCompat.DayNight.Dialog">
|
||||||
|
<item name="android:windowBackground">@color/transparent</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue