- Change default profile image
- Make some visual elements, not working yet, invisible - Put bitshares icon in balance item title
This commit is contained in:
parent
4f8df9deaf
commit
9989fbbb74
8 changed files with 85 additions and 20 deletions
|
@ -4,8 +4,11 @@ import android.app.Dialog;
|
|||
import android.arch.lifecycle.LiveData;
|
||||
import android.arch.lifecycle.Observer;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
|
@ -31,9 +34,12 @@ import com.google.zxing.WriterException;
|
|||
import com.google.zxing.common.BitMatrix;
|
||||
|
||||
import butterknife.OnClick;
|
||||
import cy.agorise.crystalwallet.util.CircularImageView;
|
||||
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel;
|
||||
import cy.agorise.crystalwallet.views.CryptoNetAccountAdapter;
|
||||
import cy.agorise.graphenej.Invoice;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -72,6 +78,9 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
|
|||
@BindView(R.id.tvCancel)
|
||||
TextView tvCancel;
|
||||
|
||||
@BindView(R.id.gravatar)
|
||||
CircularImageView userImg;
|
||||
|
||||
private Button btnShareQrCode;
|
||||
private Button btnClose;
|
||||
|
||||
|
@ -182,6 +191,8 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
loadUserImage();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
|
@ -193,6 +204,7 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
|
|||
Window dialogWindow = getDialog().getWindow();
|
||||
assert dialogWindow != null;
|
||||
dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
loadUserImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -207,6 +219,21 @@ public class ReceiveTransactionFragment extends DialogFragment implements UIVali
|
|||
}, 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)
|
||||
public void afterToSelected(Spinner spinner, int position) {
|
||||
this.receiveTransactionValidator.validate();
|
||||
|
|
|
@ -4,8 +4,12 @@ import android.app.Dialog;
|
|||
import android.arch.lifecycle.LiveData;
|
||||
import android.arch.lifecycle.Observer;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.NonNull;
|
||||
|
@ -29,6 +33,7 @@ import android.widget.TextView;
|
|||
|
||||
import com.google.zxing.Result;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
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.CryptoNetAccount;
|
||||
import cy.agorise.crystalwallet.models.GrapheneAccount;
|
||||
import cy.agorise.crystalwallet.util.CircularImageView;
|
||||
import cy.agorise.crystalwallet.viewmodels.ContactViewModel;
|
||||
import cy.agorise.crystalwallet.viewmodels.CryptoNetAccountListViewModel;
|
||||
import cy.agorise.crystalwallet.viewmodels.validators.SendTransactionValidator;
|
||||
|
@ -94,6 +100,9 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
|||
ImageView ivPeople;
|
||||
CryptoCurrencyAdapter assetAdapter;
|
||||
|
||||
@BindView(R.id.gravatar)
|
||||
CircularImageView userImg;
|
||||
|
||||
Button btnScanQrCode;
|
||||
|
||||
private long cryptoNetAccountId;
|
||||
|
@ -173,6 +182,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
|||
// etFrom.setText(this.grapheneAccount.getName());
|
||||
}
|
||||
|
||||
loadUserImage();
|
||||
return builder.setView(view).create();
|
||||
}
|
||||
|
||||
|
@ -190,6 +200,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
|||
Window dialogWindow = getDialog().getWindow();
|
||||
assert dialogWindow != null;
|
||||
dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
loadUserImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -204,6 +215,21 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
|||
}, 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)
|
||||
public void afterFromSelected(Spinner spinner, int position) {
|
||||
this.sendTransactionValidator.validate();
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
android:id="@+id/user_img"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:src="@drawable/ken_code_gravatar"
|
||||
android:src="@drawable/gravtr"
|
||||
android:transitionName="gravatarTransition"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -53,6 +53,7 @@
|
|||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/topView"
|
||||
app:layout_constraintEnd_toEndOf="@id/topView"
|
||||
app:layout_constraintStart_toStartOf="@id/topView"
|
||||
|
@ -83,6 +84,7 @@
|
|||
android:layout_height="55dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:visibility="gone"
|
||||
app:backgroundTint="@color/colorPrimary"
|
||||
app:fabSize="normal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -115,6 +117,7 @@
|
|||
android:text="@string/dont_have_multiple_accounts"
|
||||
android:textAlignment="center"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/vAccountSeedList"
|
||||
app:layout_constraintEnd_toEndOf="@id/vAccountSeedList"
|
||||
app:layout_constraintStart_toStartOf="@id/vAccountSeedList"
|
||||
|
|
|
@ -24,14 +24,18 @@
|
|||
android:id="@+id/ivCryptoNetIcon"
|
||||
android:layout_width="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
|
||||
android:id="@+id/tvCryptoNetName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/ivCryptoNetIcon"
|
||||
android:ems="10"
|
||||
android:text="unknown coin" />
|
||||
|
||||
<TextView
|
||||
|
@ -39,6 +43,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="0.003€" />
|
||||
|
||||
<Button
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
android:layout_width="?attr/actionBarSize"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:src="@drawable/ken_code_gravatar"
|
||||
android:src="@drawable/gravtr"
|
||||
android:transitionName="gravatarTransition"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -38,22 +38,24 @@
|
|||
android:layout_marginTop="24dp"
|
||||
android:text="@string/brainkey_description"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintStart_toStartOf="@id/tvBinFile"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintEnd_toEndOf="@id/tvBinFile"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnBinFile"/>
|
||||
app:layout_constraintStart_toStartOf="@id/tvBinFile"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnBinFile" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnBrainkey"
|
||||
style="@style/Widget.Button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
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:text="@string/view_and_copy"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintStart_toStartOf="@id/btnBinFile"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvBrainkey"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/tvBrainkey" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvWIFKey"
|
||||
|
@ -62,21 +64,23 @@
|
|||
android:layout_marginTop="24dp"
|
||||
android:text="@string/wif_key_description"
|
||||
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_constraintEnd_toEndOf="@id/tvBrainkey" />
|
||||
app:layout_constraintTop_toBottomOf="@id/btnBrainkey" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnWIFKey"
|
||||
style="@style/Widget.Button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
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:text="@string/view_and_copy"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintStart_toStartOf="@id/btnBrainkey"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvWIFKey"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/tvWIFKey" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -38,9 +38,9 @@
|
|||
android:id="@+id/gravatar"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:src="@drawable/ken_code_gravatar"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="90dp"
|
||||
android:src="@drawable/gravtr"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
android:id="@+id/gravatar"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:src="@drawable/ken_code_gravatar"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="90dp"
|
||||
android:src="@drawable/gravtr"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
|
Loading…
Reference in a new issue