- Change default profile image

- Make some visual elements, not working yet, invisible
- Put bitshares icon in balance item title
This commit is contained in:
Javier Varona 2018-05-23 21:47:19 -04:00
parent 4f8df9deaf
commit 9989fbbb74
8 changed files with 85 additions and 20 deletions

View file

@ -4,8 +4,11 @@ import android.app.Dialog;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -31,9 +34,12 @@ import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix; import com.google.zxing.common.BitMatrix;
import butterknife.OnClick; import butterknife.OnClick;
import cy.agorise.crystalwallet.util.CircularImageView;
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel; import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel;
import cy.agorise.crystalwallet.views.CryptoNetAccountAdapter; import cy.agorise.crystalwallet.views.CryptoNetAccountAdapter;
import cy.agorise.graphenej.Invoice; import cy.agorise.graphenej.Invoice;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -72,6 +78,9 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
@BindView(R.id.tvCancel) @BindView(R.id.tvCancel)
TextView tvCancel; TextView tvCancel;
@BindView(R.id.gravatar)
CircularImageView userImg;
private Button btnShareQrCode; private Button btnShareQrCode;
private Button btnClose; private Button btnClose;
@ -182,6 +191,8 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
} }
}); });
loadUserImage();
return dialog; return dialog;
} }
@ -193,6 +204,7 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
Window dialogWindow = getDialog().getWindow(); Window dialogWindow = getDialog().getWindow();
assert dialogWindow != null; assert dialogWindow != null;
dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
loadUserImage();
} }
@Override @Override
@ -207,6 +219,21 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
}, 400); }, 400);
} }
public void loadUserImage(){
//Search for a existing photo
ContextWrapper cw = new ContextWrapper(this.getActivity().getBaseContext());
File directory = cw.getDir("profile", Context.MODE_PRIVATE);
if (!directory.exists()) {
directory.mkdir();
}
File photoFile = new File(directory + File.separator + "photo.png");
if (photoFile.exists()){
Bitmap bitmap = BitmapFactory.decodeFile(photoFile.getPath());
userImg.setImageBitmap(bitmap);
}
}
@OnItemSelected(R.id.spTo) @OnItemSelected(R.id.spTo)
public void afterToSelected(Spinner spinner, int position) { public void afterToSelected(Spinner spinner, int position) {
this.receiveTransactionValidator.validate(); this.receiveTransactionValidator.validate();

View file

@ -4,8 +4,12 @@ import android.app.Dialog;
import android.arch.lifecycle.LiveData; import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.Observer; import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders; import android.arch.lifecycle.ViewModelProviders;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
@ -29,6 +33,7 @@ import android.widget.TextView;
import com.google.zxing.Result; import com.google.zxing.Result;
import java.io.File;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
@ -51,6 +56,7 @@ import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCurrency; import cy.agorise.crystalwallet.models.CryptoCurrency;
import cy.agorise.crystalwallet.models.CryptoNetAccount; import cy.agorise.crystalwallet.models.CryptoNetAccount;
import cy.agorise.crystalwallet.models.GrapheneAccount; import cy.agorise.crystalwallet.models.GrapheneAccount;
import cy.agorise.crystalwallet.util.CircularImageView;
import cy.agorise.crystalwallet.viewmodels.ContactViewModel; import cy.agorise.crystalwallet.viewmodels.ContactViewModel;
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel; import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel;
import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator; import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator;
@ -94,6 +100,9 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
ImageView ivPeople; ImageView ivPeople;
CryptoCurrencyAdapter assetAdapter; CryptoCurrencyAdapter assetAdapter;
@BindView(R.id.gravatar)
CircularImageView userImg;
Button btnScanQrCode; Button btnScanQrCode;
private long cryptoNetAccountId; private long cryptoNetAccountId;
@ -173,6 +182,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
// etFrom.setText(this.grapheneAccount.getName()); // etFrom.setText(this.grapheneAccount.getName());
} }
loadUserImage();
return builder.setView(view).create(); return builder.setView(view).create();
} }
@ -190,6 +200,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
Window dialogWindow = getDialog().getWindow(); Window dialogWindow = getDialog().getWindow();
assert dialogWindow != null; assert dialogWindow != null;
dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
loadUserImage();
} }
@Override @Override
@ -204,6 +215,21 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
}, 400); }, 400);
} }
public void loadUserImage(){
//Search for a existing photo
ContextWrapper cw = new ContextWrapper(this.getActivity().getBaseContext());
File directory = cw.getDir("profile", Context.MODE_PRIVATE);
if (!directory.exists()) {
directory.mkdir();
}
File photoFile = new File(directory + File.separator + "photo.png");
if (photoFile.exists()){
Bitmap bitmap = BitmapFactory.decodeFile(photoFile.getPath());
userImg.setImageBitmap(bitmap);
}
}
@OnItemSelected(R.id.spFrom) @OnItemSelected(R.id.spFrom)
public void afterFromSelected(Spinner spinner, int position) { public void afterFromSelected(Spinner spinner, int position) {
this.sendTransactionValidator.validate(); this.sendTransactionValidator.validate();

View file

@ -31,7 +31,7 @@
android:id="@+id/user_img" android:id="@+id/user_img"
android:layout_width="90dp" android:layout_width="90dp"
android:layout_height="90dp" android:layout_height="90dp"
android:src="@drawable/ken_code_gravatar" android:src="@drawable/gravtr"
android:transitionName="gravatarTransition" android:transitionName="gravatarTransition"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -53,6 +53,7 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" android:textStyle="bold"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/topView" app:layout_constraintBottom_toBottomOf="@id/topView"
app:layout_constraintEnd_toEndOf="@id/topView" app:layout_constraintEnd_toEndOf="@id/topView"
app:layout_constraintStart_toStartOf="@id/topView" app:layout_constraintStart_toStartOf="@id/topView"
@ -83,6 +84,7 @@
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginEnd="32dp" android:layout_marginEnd="32dp"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:visibility="gone"
app:backgroundTint="@color/colorPrimary" app:backgroundTint="@color/colorPrimary"
app:fabSize="normal" app:fabSize="normal"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -115,6 +117,7 @@
android:text="@string/dont_have_multiple_accounts" android:text="@string/dont_have_multiple_accounts"
android:textAlignment="center" android:textAlignment="center"
android:textSize="16sp" android:textSize="16sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/vAccountSeedList" app:layout_constraintBottom_toBottomOf="@id/vAccountSeedList"
app:layout_constraintEnd_toEndOf="@id/vAccountSeedList" app:layout_constraintEnd_toEndOf="@id/vAccountSeedList"
app:layout_constraintStart_toStartOf="@id/vAccountSeedList" app:layout_constraintStart_toStartOf="@id/vAccountSeedList"

View file

@ -24,14 +24,18 @@
android:id="@+id/ivCryptoNetIcon" android:id="@+id/ivCryptoNetIcon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:srcCompat="@drawable/icon_help" /> android:adjustViewBounds="true"
android:maxHeight="32dp"
android:maxWidth="32dp"
app:srcCompat="@drawable/bts" />
<TextView <TextView
android:id="@+id/tvCryptoNetName" android:id="@+id/tvCryptoNetName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ems="10" android:layout_centerVertical="true"
android:layout_toRightOf="@id/ivCryptoNetIcon" android:layout_toRightOf="@id/ivCryptoNetIcon"
android:ems="10"
android:text="unknown coin" /> android:text="unknown coin" />
<TextView <TextView
@ -39,6 +43,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="0.003€" /> android:text="0.003€" />
<Button <Button

View file

@ -65,7 +65,7 @@
android:layout_width="?attr/actionBarSize" android:layout_width="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:layout_marginEnd="32dp" android:layout_marginEnd="32dp"
android:src="@drawable/ken_code_gravatar" android:src="@drawable/gravtr"
android:transitionName="gravatarTransition" android:transitionName="gravatarTransition"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View file

@ -38,20 +38,22 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:text="@string/brainkey_description" android:text="@string/brainkey_description"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintStart_toStartOf="@id/tvBinFile" android:visibility="invisible"
app:layout_constraintEnd_toEndOf="@id/tvBinFile" app:layout_constraintEnd_toEndOf="@id/tvBinFile"
app:layout_constraintStart_toStartOf="@id/tvBinFile"
app:layout_constraintTop_toBottomOf="@id/btnBinFile" /> app:layout_constraintTop_toBottomOf="@id/btnBinFile" />
<Button <Button
android:id="@+id/btnBrainkey" android:id="@+id/btnBrainkey"
style="@style/Widget.Button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
style="@style/Widget.Button"
android:text="@string/view_and_copy"
android:textStyle="bold"
android:textColor="@color/white"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
android:text="@string/view_and_copy"
android:textColor="@color/white"
android:textStyle="bold"
android:visibility="invisible"
app:layout_constraintStart_toStartOf="@id/btnBinFile" app:layout_constraintStart_toStartOf="@id/btnBinFile"
app:layout_constraintTop_toBottomOf="@id/tvBrainkey" /> app:layout_constraintTop_toBottomOf="@id/tvBrainkey" />
@ -62,20 +64,22 @@
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:text="@string/wif_key_description" android:text="@string/wif_key_description"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintTop_toBottomOf="@id/btnBrainkey" android:visibility="invisible"
app:layout_constraintEnd_toEndOf="@id/tvBrainkey"
app:layout_constraintStart_toStartOf="@id/tvBrainkey" app:layout_constraintStart_toStartOf="@id/tvBrainkey"
app:layout_constraintEnd_toEndOf="@id/tvBrainkey" /> app:layout_constraintTop_toBottomOf="@id/btnBrainkey" />
<Button <Button
android:id="@+id/btnWIFKey" android:id="@+id/btnWIFKey"
style="@style/Widget.Button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
style="@style/Widget.Button"
android:text="@string/view_and_copy"
android:textStyle="bold"
android:textColor="@color/white"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
android:text="@string/view_and_copy"
android:textColor="@color/white"
android:textStyle="bold"
android:visibility="invisible"
app:layout_constraintStart_toStartOf="@id/btnBrainkey" app:layout_constraintStart_toStartOf="@id/btnBrainkey"
app:layout_constraintTop_toBottomOf="@id/tvWIFKey" /> app:layout_constraintTop_toBottomOf="@id/tvWIFKey" />

View file

@ -38,9 +38,9 @@
android:id="@+id/gravatar" android:id="@+id/gravatar"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:src="@drawable/ken_code_gravatar"
android:layout_marginStart="32dp" android:layout_marginStart="32dp"
android:layout_marginTop="90dp" android:layout_marginTop="90dp"
android:src="@drawable/gravtr"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />

View file

@ -38,9 +38,9 @@
android:id="@+id/gravatar" android:id="@+id/gravatar"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:src="@drawable/ken_code_gravatar"
android:layout_marginStart="32dp" android:layout_marginStart="32dp"
android:layout_marginTop="90dp" android:layout_marginTop="90dp"
android:src="@drawable/gravtr"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />