update app mobile

This commit is contained in:
GME 2019-06-13 21:34:17 +02:00
parent 5eb4242e6e
commit c8583bebe6
15 changed files with 701 additions and 59 deletions

View file

@ -44,7 +44,8 @@
<activity android:name="monnethic.mobile.search.DisplayWalletSearch" />
<activity android:name="monnethic.mobile.history.HistoryActivity" />
<activity android:name="monnethic.mobile.history.HistoryDetailsActivity" />
<activity android:name="monnethic.mobile.demoConfig.DemoConfig"></activity>
<activity android:name="monnethic.mobile.demoConfig.DemoConfig" />
<activity android:name="monnethic.mobile.settings.SettingsActivity"></activity>
</application>
</manifest>

View file

@ -130,7 +130,6 @@ public class HistoryActivity extends AppCompatActivity {
} catch (Exception e){
e.printStackTrace();
}
}
public void buttonInit(){

View file

@ -51,11 +51,20 @@ public class Config {
}
static private String getConfigBaseUrl(){
if(API==0){
return "http://5.39.76.139:10053/api/rest/demo/conf";
//return "http://10.0.2.2:10053/api/rest/demo/conf";
return "http://5.39.76.139:10053/api/rest/demo/conf/";
//return "http://10.0.2.2:10053/api/rest/demo/conf/";
//return "http://localhost:10053/api/rest/demo/conf/";
} else {
return "http://37.187.101.44:10053/api/rest/demo/conf";
return "http://37.187.101.44:10053/api/rest/demo/conf/";
}
}
static private String getSettingBaseUrl(){
if(API==0){
return "http://5.39.76.139:10053/api/rest/settings/";
//return "http://10.0.2.2:10053/api/rest/settings/";
//return "http://localhost:10053/api/rest/settings/";
} else {
return "http://37.187.101.44:10053/api/rest/settings/";
}
}
@ -66,6 +75,7 @@ public class Config {
static public String USER_GET = getBaseUrlUser()+"get";
static public String USER_APPROVAL = getBaseUrlUser()+"getApproval";
static public String USER_APPROVE = getBaseUrlUser()+"approve";
static public String UPDATE_PASSWORD = getBaseUrlUser()+"update/password";
//Search
static public String FIND_BY_EMAIL= getBaseUrlUser()+"findByEmail";
static public String FIND_BY_PHONE = getBaseUrlUser()+"findByPhone";
@ -75,11 +85,9 @@ public class Config {
static public String END_SESSION = getBaseUrlSession()+"end";
//Config
static public String CONFIG_ENVIRONMENT = getConfigBaseUrl()+"/env";
static public String CONFIG_CHAINCODE = getConfigBaseUrl()+"/chaincode";
static public String CONFIG_DB = getConfigBaseUrl()+"/db";
static public String CONFIG_ENVIRONMENT = getConfigBaseUrl()+"env";
static public String CONFIG_CHAINCODE = getConfigBaseUrl()+"chaincode";
static public String CONFIG_DB = getConfigBaseUrl()+"db";
//TRANSACTION
static public String TRANSACTION_SEND = getBaseUrlTransaction()+"send";
@ -96,6 +104,7 @@ public class Config {
static public String WALLET_DELETE = getBaseUrlWallet()+"delete";
static public String WALLET_TRANSFER = getBaseUrlWallet()+"transfer";
static public void setAPI(String newApi){ API = Integer.parseInt(newApi); }
static public String getAPI(){ return String.valueOf(API); }
}

View file

@ -0,0 +1,26 @@
package monnethic.mobile.restApi;
import org.json.JSONObject;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class SettingsApiHandler {
public String updatePassword(String[] params){
HttpCallHandler httpCallHandler = new HttpCallHandler();
try{
String url = Config.UPDATE_PASSWORD;
Map<String, String> map = new HashMap<>();
map.put("user_email",params[0]);
map.put("current_password",params[1]);
map.put("new_password",params[2]);
String responseCall = httpCallHandler.postHttp(new URL(url), map);
JSONObject jsonObject = new JSONObject(responseCall);
return jsonObject.getString("response");
}catch (Exception e){
e.printStackTrace();
return "false";
}
}
}

View file

@ -72,4 +72,23 @@ public class WalletApiHandler {
}
return null;
}
public String deleteWallet(String[] params){
HttpCallHandler httpCallHandler = new HttpCallHandler();
try{
String url = Config.WALLET_DELETE;
Map<String, String> map = new HashMap<>();
map.put("user_email",params[0]);
map.put("user_hash",params[1]);
map.put("user_password",params[2]);
map.put("wallet_hash_source",params[3]);
map.put("wallet_hash_dest",params[4]);
String responseCall = httpCallHandler.postHttp(new URL(url), map);
JSONObject jsonObject = new JSONObject(responseCall);
return jsonObject.getString("response");
} catch (Exception e){
e.printStackTrace();
return "false";
}
}
}

View file

@ -0,0 +1,435 @@
package monnethic.mobile.settings;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import com.example.monnthic.monnethicmobile.R;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import monnethic.mobile.homepage.InputController;
import monnethic.mobile.restApi.SessionApiHandler;
import monnethic.mobile.restApi.SettingsApiHandler;
import monnethic.mobile.restApi.WalletApiHandler;
import monnethic.mobile.wallet.Wallet;
public class SettingsActivity extends AppCompatActivity {
private Context context = SettingsActivity.this;
private ArrayList<Wallet> userWallets;
private String user_hash;
private String user_email;
private String user_password;
private String session_id;
private EditText currentPassword;
private EditText newPassword;
private EditText confirmedNewPassword;
private Button buttonConfirm;
private Button buttonCancel;
private Switch enableDeleteWallet;
private Switch enableChangePassword;
private Spinner walletToDelete;
private Spinner walletToTransfer;
private EditText confirmWalletToDelete;
private LinearLayout l1;
private LinearLayout l2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
Intent intent = getIntent();
user_hash = intent.getStringExtra("USER_HASH");
user_email = intent.getStringExtra("USER_EMAIL");
user_password = intent.getStringExtra("USER_PWD");
session_id = intent.getStringExtra("SESSION_ID");
initView();
}
private void initView(){
l1 = (LinearLayout) findViewById(R.id.l1);
l2 = (LinearLayout) findViewById(R.id.l2);
currentPassword = findViewById(R.id.currentPwd);
newPassword = findViewById(R.id.newPwd1);
confirmedNewPassword = findViewById(R.id.newPwd2);
currentPassword.setEnabled(false);
newPassword.setEnabled(false);
confirmedNewPassword.setEnabled(false);
walletToDelete = findViewById(R.id.spinnerWalletToDelete);
walletToTransfer = findViewById(R.id.spinnerWalletToMoveFund);
confirmWalletToDelete = findViewById(R.id.editTextConfirmDeleteWallet);
walletToTransfer.setEnabled(false);
confirmWalletToDelete.setEnabled(false);
walletToDelete.setEnabled(false);
enableChangePassword = findViewById(R.id.switchChangePassword);
enableChangePassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(enableChangePassword.isChecked()){
l1.setBackgroundResource(R.color.zxing_transparent);
currentPassword.setEnabled(true);
newPassword.setEnabled(true);
confirmedNewPassword.setEnabled(true);
}else{
l1.setBackgroundResource(R.color.darker_gray);
currentPassword.setEnabled(false);
newPassword.setEnabled(false);
confirmedNewPassword.setEnabled(false);
}
}
});
try{
String[] params = {user_hash};
userWallets = new SettingsActivity.getUserWalletTask().execute(params).get();
} catch (Exception e){
e.printStackTrace();
}
if(!userWallets.isEmpty()){
List<String> listOptions = new ArrayList<>();
for(Wallet w : userWallets){
listOptions.add(w.getType());
}
ArrayAdapter<String> adapterOptions = new ArrayAdapter<>(SettingsActivity.this,android.R.layout.simple_spinner_dropdown_item,listOptions);
adapterOptions.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
walletToDelete.setAdapter(adapterOptions);
walletToTransfer.setAdapter(adapterOptions);
if(userWallets.size()>1 && walletToDelete.getSelectedItemId()==walletToTransfer.getSelectedItemId()){
walletToTransfer.setSelection((int) walletToDelete.getSelectedItemId()+1);
}
}
walletToDelete.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
if(userWallets.size()>1 && walletToTransfer.getSelectedItemId()==(int)l){
if(walletToTransfer.getSelectedItemId()+1==userWallets.size()){
walletToTransfer.setSelection(0);
}else{
walletToTransfer.setSelection((int) walletToDelete.getSelectedItemId()+1);
}
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
enableDeleteWallet = findViewById(R.id.switchDeleteWallet);
enableDeleteWallet.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(userWallets.size()<=1){
Toast.makeText(SettingsActivity.this,"You can't delete a wallet with one or less wallet",Toast.LENGTH_LONG).show();
enableDeleteWallet.setChecked(false);
}else{
if(enableDeleteWallet.isChecked()){
l2.setBackgroundResource(R.color.zxing_transparent);
walletToTransfer.setEnabled(true);
confirmWalletToDelete.setEnabled(true);
walletToDelete.setEnabled(true);
}else{
l2.setBackgroundResource(R.color.darker_gray);
walletToTransfer.setEnabled(false);
confirmWalletToDelete.setEnabled(false);
walletToDelete.setEnabled(false);
}
}
}
});
buttonConfirm = findViewById(R.id.buttonConfirmSettings);
buttonConfirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!enableDeleteWallet.isChecked() && !enableChangePassword.isChecked()){
Intent intent2 = new Intent();
intent2.putExtra("new_password",user_password);
setResult(1,intent2);
finish();
}
else if (!enableDeleteWallet.isChecked() && enableChangePassword.isChecked()){
String newPwd = changePwd();
if(newPwd!=null){
Intent intent1 = new Intent();
intent1.putExtra("new_password",newPwd);
setResult(1,intent1);
finish();
}
}
else if (enableDeleteWallet.isChecked() && !enableChangePassword.isChecked()){
if(deleteWallet()){
Intent intent2 = new Intent();
intent2.putExtra("new_password",user_password);
setResult(1,intent2);
finish();
}
}
else {
String newPwd = changePwd();
if(newPwd!=null){
if(deleteWallet()){
Intent intent2 = new Intent();
intent2.putExtra("new_password",newPwd);
setResult(1,intent2);
finish();
}
}
}
}
});
buttonCancel = findViewById(R.id.buttonCancelSettings);
buttonCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent3 = new Intent();
intent3.putExtra("new_password",user_password);
setResult(1,intent3);
finish();
}
});
}
private String changePwd(){
if(checkInputEmptyPassword()){
if(currentPassword.getText().toString().equals(user_password)){
try{
String[] p = {user_email,user_password,newPassword.getText().toString()};
String v = new changeUserPasswordTask().execute(p).get();
if(Boolean.parseBoolean(v)){
Toast.makeText(SettingsActivity.this,"Password updated",Toast.LENGTH_SHORT).show();
return newPassword.getText().toString();
}else{
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
return null;
}
} catch (Exception e){
e.printStackTrace();
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
return null;
}
}else{
Toast.makeText(SettingsActivity.this,"Current password don't match actual password",Toast.LENGTH_SHORT).show();
return null;
}
}else{
return null;
}
}
private Boolean deleteWallet(){
if(checkInputEmptyWallet()){
try{
String[] p = {user_email,user_hash,user_password,
userWallets.get((int) walletToDelete.getSelectedItemId()).getWallet_hash(),
userWallets.get((int) walletToTransfer.getSelectedItemId()).getWallet_hash()};
String v = new deleteWalletTask(context).execute(p).get();
if(Boolean.parseBoolean(v)){
Toast.makeText(SettingsActivity.this,"Wallet has been deleted",Toast.LENGTH_SHORT).show();
return true;
}else{
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
return false;
}
}catch (Exception e){
e.printStackTrace();
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
return false;
}
}else{
return false;
}
}
private boolean checkInputEmptyPassword(){
if(InputController.isEmptyEdit(currentPassword)){
Toast.makeText(this, "You didn't enter current password", Toast.LENGTH_SHORT).show();
return false;
} else if(InputController.isEmptyEdit(newPassword)){
Toast.makeText(this, "You didn't enter new password", Toast.LENGTH_SHORT).show();
return false;
} else if(InputController.isEmptyEdit(confirmedNewPassword)){
Toast.makeText(this, "You didn't enter confirmation password", Toast.LENGTH_SHORT).show();
return false;
} else {
if(!InputController.passwordValidator(newPassword.getText().toString())){
Toast.makeText(this, "Password must contains 6 to 20 characters, one lowercase, one uppercase and one digit", Toast.LENGTH_LONG).show();
return false;
} else if (!(newPassword.getText().toString().equals(confirmedNewPassword.getText().toString()))) {
Toast.makeText(this, "New Password don't match Confirmation Password", Toast.LENGTH_SHORT).show();
return false;
} else{
return true;
}
}
}
private boolean checkInputEmptyWallet(){
if(InputController.isEmptyEdit(confirmWalletToDelete)){
Toast.makeText(this, "You didn't confirm wallet deletion", Toast.LENGTH_SHORT).show();
return false;
}else{
if(!confirmWalletToDelete.getText().toString().equals(userWallets.get((int) walletToDelete.getSelectedItemId()).getType())){
Toast.makeText(this, "Confirmation wallet don't match wallet to delete", Toast.LENGTH_SHORT).show();
return false;
} else if(walletToDelete.getSelectedItemId()==walletToTransfer.getSelectedItemId()) {
Toast.makeText(this, "Delete wallet and Wallet to transfer fund can't be the same", Toast.LENGTH_SHORT).show();
return false;
} else {
return true;
}
}
}
//AsyncTask to change userPassword
private class changeUserPasswordTask extends AsyncTask<String,String,String> {
ProgressDialog progDailog = new ProgressDialog(SettingsActivity.this);
@Override
protected void onPreExecute() {
progDailog.setMessage("Updating Password...");
progDailog.setIndeterminate(false);
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progDailog.setCancelable(true);
progDailog.show();
super.onPreExecute();
}
@Override
protected String doInBackground(String... params) {
try{
SettingsApiHandler settingsApiHandler = new SettingsApiHandler();
return settingsApiHandler.updatePassword(params);
}catch (Exception e){
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(String v) {
progDailog.dismiss();
}
}
private class deleteWalletTask extends AsyncTask<String,String,String> {
Context mContext;
ProgressDialog progDialog;
private deleteWalletTask(final Context context){
mContext = context;
progDialog = new ProgressDialog(mContext);
}
@Override
protected void onPreExecute() {
super.onPreExecute();
progDialog.setMessage("Deleting Wallet...");
progDialog.setCancelable(true);
progDialog.setIndeterminate(false);
progDialog.show();
}
@Override
protected String doInBackground(String... params) {
try{
WalletApiHandler walletApiHandler = new WalletApiHandler();
return walletApiHandler.deleteWallet(params);
}catch (Exception e){
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(String v) {
progDialog.dismiss();
}
}
//AsyncTask to get user wallets
private class getUserWalletTask extends AsyncTask<String,ArrayList<Wallet>,ArrayList<Wallet>> {
ProgressDialog progDailog = new ProgressDialog(SettingsActivity.this);
@Override
protected void onPreExecute() {
super.onPreExecute();
progDailog.setMessage("Getting wallets...");
progDailog.setIndeterminate(false);
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progDailog.setCancelable(true);
progDailog.show();
}
@Override
protected ArrayList<Wallet> doInBackground(String... params) {
ArrayList<Wallet> walletsList = new ArrayList<>();
try{
WalletApiHandler walletApiHandler = new WalletApiHandler();
walletsList = walletApiHandler.getUserWallets(params);
}catch (Exception e){
e.printStackTrace();
}
return walletsList;
}
@Override
protected void onPostExecute(ArrayList<Wallet> listWallet) {
progDailog.dismiss();
}
}
@Override
public void onBackPressed() {
Intent intent4 = new Intent();
intent4.putExtra("new_password",user_password);
setResult(1,intent4);
super.onBackPressed();
}
@Override
protected void onStop() {
super.onStop(); // Always call the superclass method first
new EndSessionTask().execute(session_id);
}
private class EndSessionTask extends AsyncTask<String,Void,Void> {
@Override
protected Void doInBackground(String... strings) {
try{
SessionApiHandler sessionApiHandler = new SessionApiHandler();
sessionApiHandler.endSession(strings[0]);
}catch (Exception e){
e.printStackTrace();
}
return null;
}
}
}

View file

@ -68,14 +68,8 @@ public class TransactionActivity extends AppCompatActivity {
} else if(InputController.isEmptyEdit(amountEditText)) {
Toast.makeText(this, "No amount", Toast.LENGTH_SHORT).show();
} else {
System.out.println("HERE");
String wallet_dest = addressDestination.getText().toString();
System.out.println("wallet_dest : "+wallet_dest);
String amount = amountEditText.getText().toString();
System.out.println("amount : "+amount);
System.out.println("user_hash : "+user_hash);
System.out.println("user_password : "+user_password);
System.out.println("wallet_hash : "+wallet_hash);
SendingTransaction sendingTransaction = new SendingTransaction(user_hash,user_password,wallet_hash,wallet_dest,amount,"gonette");
try {
String transaction_hash = new TransactionTask().execute(sendingTransaction).get();

View file

@ -13,6 +13,7 @@ import com.example.monnthic.monnethicmobile.R;
import monnethic.mobile.history.HistoryActivity;
import monnethic.mobile.restApi.SessionApiHandler;
import monnethic.mobile.restApi.WalletApiHandler;
import monnethic.mobile.settings.SettingsActivity;
import monnethic.mobile.transaction.MakePayementActivity;
import monnethic.mobile.transaction.ReceivePayementActivity;
@ -31,7 +32,7 @@ public class UserAccountActivity extends AppCompatActivity {
TextView walletHashView = findViewById(R.id.walletHash);
Button buttonPayement = findViewById(R.id.buttonPayement);
Button buttonReceive = findViewById(R.id.buttonReceive);
Button buttonSettings = findViewById(R.id.buttonSettings);
Button buttonRefresh = findViewById(R.id.buttonRefreshBalance);
Button buttonHistory = findViewById(R.id.goToHistory);
@ -58,13 +59,6 @@ public class UserAccountActivity extends AppCompatActivity {
receivePayement();
}
});
buttonSettings.setVisibility(View.INVISIBLE);
buttonSettings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
settings();
}
});
buttonRefresh.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -98,9 +92,6 @@ public class UserAccountActivity extends AppCompatActivity {
receivePayementIntent.putExtra("SESSION_ID",session_id);
UserAccountActivity.this.startActivity(receivePayementIntent);
}
public void settings(){
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
}
public void history(){
Intent historyIntent = new Intent(UserAccountActivity.this, HistoryActivity.class);

View file

@ -38,7 +38,6 @@ public class CreateWalletActivity extends AppCompatActivity {
buttonValidate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//TODO ASYNC wallet_type
Wallet wallet = new Wallet(wallet_type.getText().toString(),user_hash);
new CreateWalletTask(context).execute(wallet);
}

View file

@ -5,6 +5,7 @@ import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
@ -16,6 +17,7 @@ import org.json.JSONObject;
import monnethic.mobile.database.User;
import monnethic.mobile.restApi.SessionApiHandler;
import monnethic.mobile.restApi.UserApiHandler;
import monnethic.mobile.settings.SettingsActivity;
public class HomeWalletActivity extends AppCompatActivity {
private String user_hash;
@ -23,6 +25,7 @@ public class HomeWalletActivity extends AppCompatActivity {
private String session_id;
private String email;
private Boolean approved;
private Button buttonApproveUser;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -30,7 +33,8 @@ public class HomeWalletActivity extends AppCompatActivity {
setContentView(R.layout.activity_home_wallet);
Button buttonCreateWallet = findViewById(R.id.buttonCreateWallet);
Button buttonSelectWallet = findViewById(R.id.buttonSelectWallet);
Button buttonApproveUser = findViewById(R.id.buttonApproveUser);
buttonApproveUser = findViewById(R.id.buttonApproveUser);
Button buttonSettings = findViewById(R.id.buttonSettings);
Intent intent = getIntent();
user_hash = intent.getStringExtra("USER_HASH");
@ -46,7 +50,12 @@ public class HomeWalletActivity extends AppCompatActivity {
launchCreateWalletActivity();
}
});
buttonSettings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
settings();
}
});
buttonSelectWallet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -99,6 +108,29 @@ public class HomeWalletActivity extends AppCompatActivity {
}
}
public void settings(){
if(approved){
Intent settingsIntent = new Intent(HomeWalletActivity.this, SettingsActivity.class);
settingsIntent.putExtra("USER_HASH",user_hash);
settingsIntent.putExtra("USER_PWD",user_password);
settingsIntent.putExtra("USER_EMAIL",email);
settingsIntent.putExtra("SESSION_ID",session_id);
startActivityForResult(settingsIntent,1);
}else {
Toast.makeText(HomeWalletActivity.this,"You are not approved",Toast.LENGTH_SHORT).show();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
Log.i("RESULT","HERE");
if(requestCode==1){
user_password = data.getStringExtra("new_password");
}
Log.i("NEW_PWD",user_password);
}
public void approveUser(){
new ApproveTask().execute(user_hash,email);
}
@ -166,6 +198,7 @@ public class HomeWalletActivity extends AppCompatActivity {
@Override
protected void onPostExecute(String result) {
buttonApproveUser.setVisibility(View.INVISIBLE);
progDailog.dismiss();
}

View file

@ -7,24 +7,36 @@
tools:context="monnethic.mobile.wallet.HomeWalletActivity">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="5dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/buttonApproveUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Approve"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_width="100dp"
android:layout_height="45dp"
android:layout_alignParentStart="true"
android:layout_marginStart="20dp"
android:text="Approve" />
<Button
android:id="@+id/buttonSettings"
android:layout_width="100dp"
android:layout_height="45dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="20dp"
android:text="Settings" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -32,7 +44,7 @@
<Button
android:id="@+id/buttonCreateWallet"
android:layout_width="wrap_content"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="CREATE WALLET"
app:layout_constraintEnd_toEndOf="parent"
@ -41,7 +53,7 @@
<Button
android:id="@+id/buttonSelectWallet"
android:layout_width="wrap_content"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="SELECT WALLET"

View file

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
tools:context="monnethic.mobile.settings.SettingsActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/l1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:background="@android:color/darker_gray"
android:orientation="vertical">
<Switch
android:id="@+id/switchChangePassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change Password : "
android:textSize="18sp"
android:textStyle="bold" />
<EditText
android:id="@+id/currentPwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10"
android:hint="Current Password"
android:inputType="textPassword" />
<EditText
android:id="@+id/newPwd1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10"
android:hint="New Password"
android:inputType="textPassword" />
<EditText
android:id="@+id/newPwd2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10"
android:hint="Confirm New Password"
android:inputType="textPassword" />
</LinearLayout>
<LinearLayout
android:id="@+id/l2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:background="@android:color/darker_gray"
android:orientation="vertical">
<Switch
android:id="@+id/switchDeleteWallet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delete Wallet : "
android:textColor="@android:color/holo_red_light"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textView15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Wallet to delete :"
android:textSize="18sp"
android:textStyle="bold" />
<Spinner
android:id="@+id/spinnerWalletToDelete"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp" />
<EditText
android:id="@+id/editTextConfirmDeleteWallet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ems="10"
android:hint="Confirm wallet to delete"
android:inputType="textPersonName"
android:textColor="@android:color/holo_red_light" />
<TextView
android:id="@+id/textView17"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Wallet to transfer fund :"
android:textSize="18sp"
android:textStyle="bold" />
<Spinner
android:id="@+id/spinnerWalletToMoveFund"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/buttonCancelSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Cancel" />
<Button
android:id="@+id/buttonConfirmSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Confirm" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View file

@ -2,32 +2,17 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/buttonSettings"
android:layout_width="100dp"
android:layout_height="45dp"
android:layout_gravity="right"
android:layout_marginEnd="5dp"
android:text="Settings" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="90dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="40dp"
android:orientation="vertical">
@ -44,9 +29,9 @@
android:id="@+id/walletHash"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginStart="2dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="5dp"
android:layout_marginEnd="2dp"
android:textIsSelectable="true"
android:textSize="16sp"
android:textStyle="bold" />

View file

@ -3,4 +3,5 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="darker_gray">#aaa</color>
</resources>