Merge branch 'develop' of https://github.com/Agorise/crystal-wallet-android into develop-local

This commit is contained in:
hvarona 2018-11-28 22:16:55 -04:00
commit 1514d32457
28 changed files with 121 additions and 212 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -31,7 +31,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
@ -133,12 +132,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
@BindView(R.id.viewCamera)
View viewCamera;
/*
* Flag to control when the camera is visible and when is hide
* */
private boolean cameraVisible = true;
Button btnScanQrCode;
/* Flag to control when the camera is visible and when is hidden */
private boolean cameraVisible = false;
private long cryptoNetAccountId;
private CryptoNetAccount cryptoNetAccount;
@ -233,41 +228,9 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
loadUserImage();
/*
* Check for CAMERA permission
* */
if (Build.VERSION.SDK_INT >= 23) {
if (checkPermission()) {
// Code for above or equal 23 API Oriented Device
// Your Permission granted already .Do next code
/*
* Init the camera
* */
try {
beginScanQrCode();
}catch(Exception e){
e.printStackTrace();
}
} else {
requestPermission(); // Code for permission
}
}
else {
// Code for Below 23 API Oriented Device
// Do next code
/*
* Init the camera
* */
try {
beginScanQrCode();
}catch(Exception e){
e.printStackTrace();
}
}
/* Check for CAMERA permission */
if (Build.VERSION.SDK_INT >= 23 && !checkCameraPermission())
requestCameraPermission();
return builder.setView(view).create();
}
@ -325,38 +288,24 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
}
}
private void requestPermission() {
private boolean checkCameraPermission() {
int result = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA);
return result == PackageManager.PERMISSION_GRANTED;
}
private void requestCameraPermission() {
if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.CAMERA)) {
Toast.makeText(getActivity(), getActivity().getString(R.string.permission_denied_camera), Toast.LENGTH_LONG).show();
/*
* Disable the button of the camera visibility
* */
disableVisibilityCamera();
/* Disable the button of the camera visibility */
btnCloseCamera.setVisibility(View.INVISIBLE);
} else {
requestPermissions(new String[] {android.Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION);
}
}
private void disableVisibilityCamera(){
/*
* Hide the button, the user can not modify the visibility
* */
btnCloseCamera.setVisibility(View.INVISIBLE);
}
private boolean checkPermission() {
int result = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA);
if (result == PackageManager.PERMISSION_GRANTED) {
return true;
} else {
return false;
}
}
@Override
@ -374,15 +323,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
}
});
/*
* Init the camera
* */
try {
beginScanQrCode();
}catch(Exception e){
e.printStackTrace();
}
} else {
Log.e("value", "Permission Denied, You cannot use the camera.");
@ -401,12 +341,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
super.onResume();
mScannerView.setResultHandler(this);
mScannerView.startCamera();
/*builder.setNeutralButton("Scan QR Code", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
beginScanQrCode();
}
});*/
// Force dialog fragment to use the full width of the screen
Window dialogWindow = getDialog().getWindow();
@ -475,67 +409,44 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
@OnClick(R.id.fabCloseCamera)
public void onClicCloseCamera(){
mScannerView.stopCamera();
/*
* Hide the camera or show it
* */
if(cameraVisible){
public void onClickCloseCamera(){
if(cameraVisible)
hideCamera();
}
else{
else
showCamera();
}
}
/*
* Show the camera and hide the black background
/**
* Shows the camera and hide the black background
* */
private void showCamera(){
/*
* Change visibilities of views
* */
/* Change visibilities of views */
viewCamera.setVisibility(View.GONE);
mScannerView.setVisibility(View.VISIBLE);
/*
* Change icon
* */
/* Change icon */
btnCloseCamera.setImageDrawable(getResources().getDrawable(R.drawable.ic_close));
/*
* Reset variable
* */
/* Reset variable */
cameraVisible = true;
/*
* Star the camera again
* */
/* Star the camera again */
beginScanQrCode();
}
/*
* Hide the camera and show the black background
/**
* Hides the camera and show the black background
* */
private void hideCamera(){
/*
* Change visibilities of views
* */
/* Change visibilities of views */
viewCamera.setVisibility(View.VISIBLE);
mScannerView.setVisibility(View.INVISIBLE);
/*
* Change icon
* */
/* Change icon */
btnCloseCamera.setImageDrawable(getResources().getDrawable(R.drawable.ok));
/*
* Reset variable
* */
/* Reset variable */
cameraVisible = false;
}

View file

@ -1,33 +0,0 @@
package cy.agorise.crystalwallet.util;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;
/**
* Created by xd on 1/24/18.
* ImageView which adjusts its size to always create a square
*/
public class SquaredImageView extends AppCompatImageView {
public SquaredImageView(Context context) {
super(context);
}
public SquaredImageView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public SquaredImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int size = Math.min(getMeasuredWidth(), getMeasuredHeight());
setMeasuredDimension(size, size);
}
}

View file

@ -0,0 +1,6 @@
<vector android:height="125dp" android:viewportHeight="344"
android:viewportWidth="1381" android:width="500dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FEFEFE" android:pathData="M204,82l72,90l-72,90l-73,-90z"/>
<path android:fillColor="#FEFEFE" android:pathData="M138,0l61,76l-76,96l76,95l-61,77l-138,-172z"/>
<path android:fillColor="#FEFEFE" android:fillType="nonZero" android:pathData="M498,112c-13,-10 -29,-16 -47,-16 -42,0 -76,34 -76,76 0,42 34,76 76,76 19,0 36,-7 49,-18l-19,-21c-28,21 -73,4 -73,-37 0,-40 43,-57 71,-38l19,-22zM617,127c8,0 15,7 15,15 0,1 0,12 0,13 -1,7 -7,13 -15,13l-28,0 17,29 27,48 31,0 -28,-52c14,-6 25,-14 25,-31 0,-1 0,-30 0,-31 0,-24 -20,-33 -44,-33l-58,0 0,147 30,0 0,-118 28,0zM792,98l-30,55 -30,-55 -33,0 48,93 0,54 30,0 0,-54 48,-93 -33,0zM900,183l1,0c15,5 24,13 24,21 0,4 -4,15 -16,15 -7,0 -24,0 -40,-17l-21,20c10,11 22,18 35,23 11,3 19,3 26,3 13,0 25,-5 34,-15 7,-8 11,-19 11,-29 0,-11 -4,-21 -11,-29 -8,-8 -19,-15 -33,-19 -1,-1 -2,-1 -4,-2 -13,-3 -19,-7 -19,-15 0,-5 1,-7 3,-8 4,-4 11,-6 13,-6 13,0 19,4 28,10l5,4 16,-25 -5,-3c-11,-7 -23,-15 -44,-15 -8,0 -24,3 -34,14 -8,8 -12,19 -11,30 0,14 7,26 19,34 8,5 17,8 22,9l1,0zM994,98l0,29 41,0 0,118 29,0 0,-118 41,0 0,-29 -111,0zM1185,98l-75,147 33,0 45,-89 42,89 33,0 -69,-147 -9,0zM1326,98l-29,0 0,147 84,0 0,-29 -55,0 0,-118z"/>
</vector>

View file

@ -2,7 +2,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#13547a"
android:endColor="#80d0c7"
android:angle="45"/>
android:type="linear"
android:startColor="#43E8D8"
android:centerColor="@color/colorPrimary"
android:endColor="@color/colorPrimaryDark"
android:angle="0"/>
</shape>

View file

@ -31,8 +31,9 @@
android:id="@+id/ivLogo"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:padding="16dp"
android:contentDescription="@string/crystal_logo"
android:src="@drawable/crystal_logo"
android:src="@drawable/crystal_logo_white"
tools:layout_editor_absoluteY="114dp"
app:layout_constraintTop_toTopOf="@id/ivAnimation"
app:layout_constraintBottom_toBottomOf="@id/ivAnimation"/>

View file

@ -53,8 +53,9 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:padding="8dp"
android:adjustViewBounds="true"
android:src="@drawable/crystal_logo"
android:src="@drawable/crystal_logo_white"
android:contentDescription="@string/crystal_logo"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View file

@ -5,20 +5,28 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="24dp">
<android.support.constraint.Guideline
android:id="@+id/centeredVerticalGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5"/>
<View
android:id="@+id/topView"
android:layout_width="match_parent"
android:background="@drawable/receive_transaction_top_view"
android:layout_height="120dp"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:layout_alignParentTop="true"/>
android:background="@drawable/receive_transaction_top_view"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/txtTittle"
@ -30,93 +38,105 @@
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"
android:layout_alignParentTop="true" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<cy.agorise.crystalwallet.util.CircularImageView
android:id="@+id/gravatar"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="@+id/txtTittle"
android:layout_marginStart="32dp"
android:layout_marginTop="30dp"
android:src="@drawable/avatar_placeholder" />
android:src="@drawable/avatar_placeholder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/txtTittle" />
<Spinner
android:id="@+id/spTo"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_marginTop="30dp"
android:layout_below="@+id/txtTittle"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"/>
android:layout_marginEnd="20dp"
app:layout_constraintTop_toBottomOf="@+id/txtTittle"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/tvFromError"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/red"
android:layout_below="@+id/gravatar"
android:layout_marginTop="10dp"/>
app:layout_constraintTop_toBottomOf="@+id/spTo"
app:layout_constraintStart_toStartOf="@id/spTo"
app:layout_constraintEnd_toEndOf="@id/spTo" />
<EditText
android:id="@+id/etAmount"
android:layout_width="150dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@+id/tvFromError"
android:layout_marginStart="24dp"
android:layout_marginTop="10dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="12dp"
android:hint="@string/amount"
android:inputType="numberDecimal"
android:textSize="20sp" />
android:textSize="20sp"
app:layout_constraintTop_toBottomOf="@+id/tvFromError"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/centeredVerticalGuideline"/>
<TextView
android:id="@+id/tvAmountError"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/red"
android:layout_below="@+id/etAmount"/>
app:layout_constraintTop_toBottomOf="@+id/etAmount"
app:layout_constraintStart_toStartOf="@id/etAmount"
app:layout_constraintEnd_toEndOf="@id/etAmount"/>
<Spinner
android:id="@+id/spAsset"
android:layout_width="150dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="24dp"
android:layout_marginTop="25dp"
android:gravity="top"
android:layout_marginBottom="4dp"
android:inputType="textMultiLine"
android:layout_below="@+id/tvFromError"
android:textColor="@color/white"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"/>
app:layout_constraintStart_toEndOf="@id/centeredVerticalGuideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/viewSpinner"/>
<View
android:id="@+id/viewSpinner"
android:layout_width="0dp"
android:layout_height="3dp"
android:layout_marginTop="5dp"
android:background="@color/gray" />
android:layout_height="1dp"
android:layout_marginBottom="8dp"
android:background="@color/gray"
app:layout_constraintBottom_toBottomOf="@id/etAmount"
app:layout_constraintStart_toStartOf="@id/spAsset"
app:layout_constraintEnd_toEndOf="@id/spAsset"/>
<TextView
android:id="@+id/tvAssetError"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/red"
android:layout_below="@+id/spAsset"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/spAsset" />
<cy.agorise.crystalwallet.util.SquaredImageView
<ImageView
android:id="@+id/ivQrCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="5dp"
android:layout_marginRight="24dp"
android:adjustViewBounds="true"
android:contentDescription="@string/qr_code"
android:src="@color/gray"
android:layout_below="@+id/tvAmountError"
android:layout_centerHorizontal="true"/>
app:layout_constraintDimensionRatio="w,1:1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvAmountError" />
<ProgressBar
android:id="@+id/pbQrCode"
@ -144,7 +164,8 @@
android:text="@string/share_this_qr"
android:textSize="18sp"
android:textStyle="bold"
android:layout_below="@+id/ivQrCode" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivQrCode" />
<TextView
android:id="@+id/tvCancel"
@ -155,9 +176,9 @@
android:text="@string/close"
android:textSize="18sp"
android:textStyle="bold"
android:layout_below="@+id/ivQrCode"
android:layout_alignParentRight="true"/>
app:layout_constraintTop_toBottomOf="@+id/ivQrCode"
app:layout_constraintRight_toRightOf="parent" />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
</ScrollView>

View file

@ -120,15 +120,17 @@
<EditText
android:id="@+id/etAmount"
android:layout_width="150dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="12dp"
android:inputType="numberDecimal"
android:textSize="20sp"
android:hint="@string/amount"
app:layout_constraintTop_toBottomOf="@+id/tvToError"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvToError" />
app:layout_constraintEnd_toStartOf="@id/centeredVerticalGuideline"/>
<TextView
android:id="@+id/tvAmountError"
@ -141,15 +143,15 @@
<Spinner
android:id="@+id/spAsset"
android:layout_width="150dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:layout_marginStart="12dp"
android:gravity="top"
android:inputType="textMultiLine"
android:textColor="@color/white"
app:layout_constraintTop_toTopOf="@+id/etAmount"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/etAmount" />
app:layout_constraintStart_toEndOf="@id/centeredVerticalGuideline"/>
<View
android:id="@+id/viewSpinner"
@ -212,7 +214,7 @@
app:fabSize="mini"
app:layout_constraintStart_toEndOf="@id/centeredVerticalGuideline"
app:layout_constraintTop_toBottomOf="@+id/tvScan"
app:srcCompat="@drawable/ic_close" />
app:srcCompat="@drawable/ok" />
<me.dm7.barcodescanner.zxing.ZXingScannerView
android:id="@+id/ivCamera"
@ -232,10 +234,7 @@
android:background="@color/black"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:visibility="gone"
android:visibility="visible"
android:src="#666"
app:layout_constraintTop_toTopOf="@id/ivCamera"
app:layout_constraintStart_toStartOf="@id/ivCamera"

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/white"/>
<background android:drawable="@color/colorPrimary"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/white"/>
<background android:drawable="@color/colorPrimary"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#0099d6</color>
<color name="colorPrimaryDark">#006fd6</color>
<color name="colorAccent">#0099d6</color>
<color name="colorPrimary">#3BD6C6</color>
<color name="colorPrimaryDark">#12A394</color>
<color name="colorAccent">#3BD6C6</color>
<color name="gray">#808080</color>
<color name="darkGray">#686767</color>
<color name="lightGray">#e0e0e0</color>
<color name="white">#ffffff</color>
<color name="pink">#f0006b</color>
<color name="transparent">#00ffffff</color>
<color name="colorPrimaryTransparent">#330099d6</color>
<color name="colorPrimaryTransparent">#443BD6C6</color>
<color name="semiTransparentWhite">#8fff</color>
<color name="green">#147b00</color>

View file

@ -14,6 +14,7 @@
<style name="dialog_theme_full" parent="android:Theme" >
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowAnimationStyle">@style/SendTransactionAnimation.Window</item>
</style>
<style name="ActivityDialog" parent="Theme.AppCompat.Light.NoActionBar">