update appMobile
This commit is contained in:
parent
c8583bebe6
commit
259df4c00b
.idea/caches
app
Binary file not shown.
|
@ -5,7 +5,7 @@ android {
|
|||
defaultConfig {
|
||||
applicationId 'com.monnethic.appmobile'
|
||||
multiDexEnabled true
|
||||
minSdkVersion 19
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 27
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package monnethic.mobile.history;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
|
@ -7,6 +8,8 @@ import android.os.AsyncTask;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
|
@ -14,6 +17,7 @@ import android.widget.CompoundButton;
|
|||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Switch;
|
||||
import android.widget.Toast;
|
||||
|
@ -137,6 +141,9 @@ public class HistoryActivity extends AppCompatActivity {
|
|||
btnSearchTransactions.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) HistoryActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(HistoryActivity.this.getCurrentFocus().getWindowToken(),0);
|
||||
|
||||
if(!aSwitch.isChecked()){
|
||||
switch (String.valueOf(spinner.getSelectedItem())){
|
||||
case "All":
|
||||
|
@ -198,14 +205,13 @@ public class HistoryActivity extends AppCompatActivity {
|
|||
|
||||
public void listViewHandler(String function){
|
||||
listView = findViewById(R.id.listViewTransactions);
|
||||
ArrayList<Transaction> transactions = new ArrayList<>();
|
||||
//function, wallet_hash, size, start_date, end_date
|
||||
try{
|
||||
String size = inputSize.getText().toString();
|
||||
if(Integer.parseInt(function)==0){
|
||||
transactions = new getTransactionTask().execute(function,wallet_hash).get();
|
||||
new getTransactionTask().execute(function,wallet_hash);
|
||||
} else if(Integer.parseInt(function)==1 || Integer.parseInt(function)==2 || Integer.parseInt(function)==3){
|
||||
transactions = new getTransactionTask().execute(function,wallet_hash,size).get();
|
||||
new getTransactionTask().execute(function,wallet_hash,size);
|
||||
} else {
|
||||
String myFormat = "dd-MM-yyyy";
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE);
|
||||
|
@ -213,46 +219,53 @@ public class HistoryActivity extends AppCompatActivity {
|
|||
String start_date = String.valueOf(start_d.getTime());
|
||||
Date end_d = sdf.parse(toDate.getText().toString());
|
||||
String end_date = String.valueOf(end_d.getTime());
|
||||
transactions = new getTransactionTask().execute(function,wallet_hash,size,start_date,end_date).get();
|
||||
new getTransactionTask().execute(function,wallet_hash,size,start_date,end_date);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
TransactionAdapter adapter = new TransactionAdapter(this,transactions,wallet_hash);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
Transaction t = (Transaction) listView.getItemAtPosition(i);
|
||||
Intent transactionDetailsIntent = new Intent(HistoryActivity.this, HistoryDetailsActivity.class);
|
||||
transactionDetailsIntent.putExtra("USER_HASH",user_hash);
|
||||
transactionDetailsIntent.putExtra("USER_PWD",user_password);
|
||||
transactionDetailsIntent.putExtra("SESSION_ID",session_id);
|
||||
transactionDetailsIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
transactionDetailsIntent.putExtra("TRANSACTION",t);
|
||||
HistoryActivity.this.startActivity(transactionDetailsIntent);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private class getTransactionTask extends AsyncTask<String,ArrayList<Transaction>,ArrayList<Transaction>> {
|
||||
ProgressDialog progDailog = new ProgressDialog(HistoryActivity.this);
|
||||
RelativeLayout progress = findViewById(R.id.progressLayout);
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Searching...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
btnSearchTransactions.setEnabled(false);
|
||||
inputSize.setEnabled(false);
|
||||
spinner.setEnabled(false);
|
||||
aSwitch.setEnabled(false);
|
||||
listView.setEnabled(false);
|
||||
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<Transaction> t) {
|
||||
progDailog.dismiss();
|
||||
TransactionAdapter adapter = new TransactionAdapter(HistoryActivity.this,t,wallet_hash);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
Transaction t = (Transaction) listView.getItemAtPosition(i);
|
||||
Intent transactionDetailsIntent = new Intent(HistoryActivity.this, HistoryDetailsActivity.class);
|
||||
transactionDetailsIntent.putExtra("USER_HASH",user_hash);
|
||||
transactionDetailsIntent.putExtra("USER_PWD",user_password);
|
||||
transactionDetailsIntent.putExtra("SESSION_ID",session_id);
|
||||
transactionDetailsIntent.putExtra("WALLET_HASH",wallet_hash);
|
||||
transactionDetailsIntent.putExtra("TRANSACTION",t);
|
||||
HistoryActivity.this.startActivity(transactionDetailsIntent);
|
||||
}
|
||||
});
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
btnSearchTransactions.setEnabled(true);
|
||||
inputSize.setEnabled(true);
|
||||
spinner.setEnabled(true);
|
||||
aSwitch.setEnabled(true);
|
||||
listView.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
package monnethic.mobile.homepage;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
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.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import monnethic.mobile.database.User;
|
||||
import monnethic.mobile.restApi.UserApiHandler;
|
||||
import monnethic.mobile.wallet.HomeWalletActivity;
|
||||
|
@ -23,6 +22,8 @@ import monnethic.mobile.wallet.HomeWalletActivity;
|
|||
public class LoginActivity extends AppCompatActivity {
|
||||
private EditText email;
|
||||
private EditText password;
|
||||
private Button buttonCancel;
|
||||
private Button buttonOk;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -30,8 +31,8 @@ public class LoginActivity extends AppCompatActivity {
|
|||
setContentView(R.layout.activity_login);
|
||||
email = findViewById(R.id.editTextEmail);
|
||||
password = findViewById(R.id.editTextPassword);
|
||||
Button buttonCancel = findViewById(R.id.buttonCancel);
|
||||
Button buttonOk = findViewById(R.id.buttonOkLogin);
|
||||
buttonCancel = findViewById(R.id.buttonCancel);
|
||||
buttonOk = findViewById(R.id.buttonOkLogin);
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -55,7 +56,10 @@ public class LoginActivity extends AppCompatActivity {
|
|||
Toast.makeText(this, "Forget email", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
*/
|
||||
|
||||
private void validateInput(){
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(),0);
|
||||
if(InputController.isEmptyEdit(email)){
|
||||
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
|
||||
} else if(!InputController.validEmail(email.getText().toString())){
|
||||
|
@ -71,7 +75,7 @@ public class LoginActivity extends AppCompatActivity {
|
|||
//AsyncTask for login
|
||||
private class UserLoggerTask extends AsyncTask<User,String,JSONObject> {
|
||||
Context mContext;
|
||||
ProgressDialog progDailog = new ProgressDialog(LoginActivity.this);
|
||||
RelativeLayout progress = findViewById(R.id.progressLayout);
|
||||
private UserLoggerTask(final Context context){
|
||||
mContext = context;
|
||||
}
|
||||
|
@ -79,11 +83,12 @@ public class LoginActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Login...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
email.setEnabled(false);
|
||||
password.setEnabled(false);
|
||||
buttonCancel.setEnabled(false);
|
||||
buttonOk.setEnabled(false);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,10 +97,22 @@ public class LoginActivity extends AppCompatActivity {
|
|||
if(jsonObject!=null){
|
||||
if(jsonObject.getInt("status")==404){
|
||||
Toast.makeText(mContext, "User Not Found", Toast.LENGTH_SHORT).show();
|
||||
progDailog.dismiss();
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
email.setEnabled(true);
|
||||
password.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
} else if(jsonObject.getInt("status")==403){
|
||||
Toast.makeText(mContext, "Wrong authentication", Toast.LENGTH_SHORT).show();
|
||||
progDailog.dismiss();
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
email.setEnabled(true);
|
||||
password.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
} else if(jsonObject.getInt("status")==200){
|
||||
Intent walletHomeIntent = new Intent(LoginActivity.this, HomeWalletActivity.class);
|
||||
walletHomeIntent.putExtra("USER_HASH", jsonObject.getString("user_hash"));
|
||||
|
@ -104,21 +121,48 @@ public class LoginActivity extends AppCompatActivity {
|
|||
walletHomeIntent.putExtra("email",email.getText().toString());
|
||||
Boolean approved = new CheckApprovalTask().execute(jsonObject.getString("user_hash"),email.getText().toString()).get();
|
||||
walletHomeIntent.putExtra("approved", approved.toString());
|
||||
progDailog.dismiss();
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
email.setEnabled(true);
|
||||
password.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
|
||||
LoginActivity.this.startActivity(walletHomeIntent);
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
||||
progDailog.dismiss();
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
email.setEnabled(true);
|
||||
password.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
}
|
||||
}else{
|
||||
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
||||
progDailog.dismiss();
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
email.setEnabled(true);
|
||||
password.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
email.setEnabled(true);
|
||||
password.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject doInBackground(User... u) {
|
||||
try{
|
||||
|
|
|
@ -8,8 +8,10 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
import org.json.JSONObject;
|
||||
|
@ -25,6 +27,8 @@ public class RegisterActivity extends AppCompatActivity {
|
|||
private EditText password;
|
||||
private EditText confirmPassword;
|
||||
private EditText phone;
|
||||
private Button buttonCancel;
|
||||
private Button buttonOk;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -38,8 +42,8 @@ public class RegisterActivity extends AppCompatActivity {
|
|||
password = findViewById(R.id.inputPassword);
|
||||
confirmPassword = findViewById(R.id.inputConfPassword);
|
||||
phone = findViewById(R.id.inputPhone);
|
||||
Button buttonCancel = findViewById(R.id.buttonCancel);
|
||||
Button buttonOk = findViewById(R.id.buttonOk);
|
||||
buttonCancel = findViewById(R.id.buttonCancel);
|
||||
buttonOk = findViewById(R.id.buttonOk);
|
||||
|
||||
buttonCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -116,17 +120,23 @@ public class RegisterActivity extends AppCompatActivity {
|
|||
|
||||
private class UserRegisterTask extends AsyncTask<User,Void,JSONObject> {
|
||||
Context mContext;
|
||||
ProgressDialog progDailog = new ProgressDialog(RegisterActivity.this);
|
||||
private UserRegisterTask(final Context context){mContext=context;}
|
||||
RelativeLayout progress = findViewById(R.id.progressLayout);
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Register...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
name.setEnabled(false);
|
||||
firstname.setEnabled(false);
|
||||
email.setEnabled(false);
|
||||
confirmEmail.setEnabled(false);
|
||||
phone.setEnabled(false);
|
||||
password.setEnabled(false);
|
||||
confirmPassword.setEnabled(false);
|
||||
buttonCancel.setEnabled(false);
|
||||
buttonOk.setEnabled(false);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,16 +149,28 @@ public class RegisterActivity extends AppCompatActivity {
|
|||
walletHomeIntent.putExtra("SESSION_ID",jsonObject.getString("session_id"));
|
||||
walletHomeIntent.putExtra("email",email.getText().toString());
|
||||
walletHomeIntent.putExtra("approved","false");
|
||||
progDailog.dismiss();
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
name.setEnabled(true);
|
||||
firstname.setEnabled(true);
|
||||
email.setEnabled(true);
|
||||
confirmEmail.setEnabled(true);
|
||||
phone.setEnabled(true);
|
||||
password.setEnabled(true);
|
||||
confirmPassword.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
|
||||
RegisterActivity.this.startActivity(walletHomeIntent);
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
||||
progDailog.dismiss();
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
progDailog.dismiss();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package monnethic.mobile.search;
|
||||
|
||||
public class DisplayWallet {
|
||||
import java.io.Serializable;
|
||||
|
||||
public class DisplayWallet implements Serializable {
|
||||
private String user_name;
|
||||
private String user_firstname;
|
||||
private String wallet_hash;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package monnethic.mobile.search;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -11,11 +10,9 @@ import android.widget.ListView;
|
|||
import com.example.monnthic.monnethicmobile.R;
|
||||
import java.util.ArrayList;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.WalletApiHandler;
|
||||
import monnethic.mobile.wallet.Wallet;
|
||||
|
||||
public class DisplayWalletSearch extends AppCompatActivity {
|
||||
private ArrayList<Wallet> userWallets;
|
||||
private ArrayList<DisplayWallet> displayWallets;
|
||||
private String session_id;
|
||||
|
||||
@Override
|
||||
|
@ -25,21 +22,14 @@ public class DisplayWalletSearch extends AppCompatActivity {
|
|||
|
||||
ListView listView = (ListView) findViewById(R.id.listViewWalletSearch);
|
||||
Intent intent = getIntent();
|
||||
String user_name = intent.getStringExtra("user_name");
|
||||
String user_firstname = intent.getStringExtra("user_firstname");
|
||||
String user_hash = intent.getStringExtra("user_hash");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
|
||||
try {
|
||||
userWallets = new SearchWalletTask().execute(user_hash).get();
|
||||
displayWallets = (ArrayList<DisplayWallet>) intent.getSerializableExtra("data");
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ArrayList<DisplayWallet> displayWallets = new ArrayList<>();
|
||||
for(Wallet w : userWallets){
|
||||
displayWallets.add(new DisplayWallet(user_name,user_firstname,w.getWallet_hash(),w.getType()));
|
||||
}
|
||||
DisplayWalletAdapter adapter = new DisplayWalletAdapter(this,displayWallets);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
|
@ -56,6 +46,7 @@ public class DisplayWalletSearch extends AppCompatActivity {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
private class SearchWalletTask extends AsyncTask<String,String,ArrayList<Wallet>> {
|
||||
ProgressDialog progDailog = new ProgressDialog(DisplayWalletSearch.this);
|
||||
|
||||
|
@ -86,6 +77,7 @@ public class DisplayWalletSearch extends AppCompatActivity {
|
|||
return walletsList;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package monnethic.mobile.search;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -7,14 +8,22 @@ import android.os.AsyncTask;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import monnethic.mobile.database.User;
|
||||
import monnethic.mobile.homepage.InputController;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.UserApiHandler;
|
||||
import monnethic.mobile.restApi.WalletApiHandler;
|
||||
import monnethic.mobile.wallet.Wallet;
|
||||
|
||||
public class SearchUser extends AppCompatActivity {
|
||||
EditText emailAddress;
|
||||
|
@ -25,6 +34,10 @@ public class SearchUser extends AppCompatActivity {
|
|||
private String user_hash;
|
||||
private String user_password;
|
||||
|
||||
private String u_dest_n;
|
||||
private String u_dest_fn;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -61,73 +74,106 @@ public class SearchUser extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private void search(){
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) SearchUser.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(SearchUser.this.getCurrentFocus().getWindowToken(),0);
|
||||
|
||||
String uEmail = emailAddress.getText().toString();
|
||||
String uPhone = phoneNumber.getText().toString();
|
||||
|
||||
if(InputController.isEmptyEdit(emailAddress) && InputController.isEmptyEdit(phoneNumber)){
|
||||
Toast.makeText(this, "Enter an email or phone number", Toast.LENGTH_SHORT).show();
|
||||
} else if(InputController.isEmptyEdit(emailAddress)){
|
||||
new SearchUserTask(this).execute(null,uPhone);
|
||||
new SearchUserTask().execute(null,uPhone);
|
||||
} else if(InputController.isEmptyEdit(phoneNumber)){
|
||||
new SearchUserTask(this).execute(uEmail,null);
|
||||
new SearchUserTask().execute(uEmail,null);
|
||||
} else {
|
||||
new SearchUserTask(this).execute(uEmail,uPhone);
|
||||
new SearchUserTask().execute(uEmail,uPhone);
|
||||
}
|
||||
}
|
||||
|
||||
private class SearchUserTask extends AsyncTask<String,Void,User> {
|
||||
Context mContext;
|
||||
private SearchUserTask(final Context context){mContext=context;}
|
||||
ProgressDialog progDailog = new ProgressDialog(SearchUser.this);
|
||||
private class SearchUserTask extends AsyncTask<String,Void,ArrayList<Wallet>> {
|
||||
RelativeLayout progress = findViewById(R.id.progressLayout);
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Searching user...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
emailAddress.setEnabled(false);
|
||||
phoneNumber.setEnabled(false);
|
||||
buttonCancel.setEnabled(false);
|
||||
buttonOk.setEnabled(false);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(User user) {
|
||||
protected void onPostExecute(ArrayList<Wallet> wallets) {
|
||||
try{
|
||||
if(user!=null){
|
||||
if(wallets!=null){
|
||||
ArrayList<DisplayWallet> displayWallets = new ArrayList<>();
|
||||
for(Wallet w : wallets){
|
||||
displayWallets.add(new DisplayWallet(u_dest_n,u_dest_fn,w.getWallet_hash(),w.getType()));
|
||||
}
|
||||
|
||||
Intent displayWalletIntent = new Intent(SearchUser.this, DisplayWalletSearch.class);
|
||||
displayWalletIntent.putExtra("user_name",user.getName());
|
||||
displayWalletIntent.putExtra("user_firstname",user.getFirstname());
|
||||
displayWalletIntent.putExtra("user_hash",user.getUser_hash());
|
||||
displayWalletIntent.putExtra("data",displayWallets);
|
||||
displayWalletIntent.putExtra("SESSION_ID",session_id);
|
||||
displayWalletIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
|
||||
emailAddress.setEnabled(true);
|
||||
phoneNumber.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
|
||||
SearchUser.this.startActivity(displayWalletIntent);
|
||||
progDailog.dismiss();
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(mContext,"User dosen't exist",Toast.LENGTH_SHORT).show();
|
||||
progDailog.dismiss();
|
||||
Toast.makeText(SearchUser.this,"User dosen't exist",Toast.LENGTH_SHORT).show();
|
||||
emailAddress.setEnabled(true);
|
||||
phoneNumber.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
emailAddress.setEnabled(true);
|
||||
phoneNumber.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected User doInBackground(String... strings) {
|
||||
protected ArrayList<Wallet> doInBackground(String... strings) {
|
||||
WalletApiHandler walletApiHandler = new WalletApiHandler();
|
||||
ArrayList<Wallet> walletsList = new ArrayList<>();
|
||||
try {
|
||||
UserApiHandler userApiHandler = new UserApiHandler();
|
||||
User u = new User();
|
||||
User u;
|
||||
if(strings[0]!=null && strings[1]==null){
|
||||
u = userApiHandler.getUser(1,strings[0],null);
|
||||
u_dest_n = u.getName();
|
||||
u_dest_fn = u.getFirstname();
|
||||
walletsList = walletApiHandler.getUserWallets(new String[]{u.getUser_hash()});
|
||||
} else if(strings[0]==null && strings[1]!=null){
|
||||
u = userApiHandler.getUser(2,null,strings[1]);
|
||||
u_dest_n = u.getName();
|
||||
u_dest_fn = u.getFirstname();
|
||||
walletsList = walletApiHandler.getUserWallets(new String[]{u.getUser_hash()});
|
||||
} else {
|
||||
u = userApiHandler.getUser(3,strings[0],strings[1]);
|
||||
u_dest_n = u.getName();
|
||||
u_dest_fn = u.getFirstname();
|
||||
walletsList = walletApiHandler.getUserWallets(new String[]{u.getUser_hash()});
|
||||
}
|
||||
return u;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
return walletsList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package monnethic.mobile.settings;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -8,12 +8,15 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import com.example.monnthic.monnethicmobile.R;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
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.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Switch;
|
||||
import android.widget.Toast;
|
||||
|
@ -56,7 +59,12 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
user_email = intent.getStringExtra("USER_EMAIL");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
|
||||
try{
|
||||
userWallets = (ArrayList<Wallet>) intent.getSerializableExtra("data");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
userWallets=null;
|
||||
}
|
||||
initView();
|
||||
}
|
||||
|
||||
|
@ -95,12 +103,6 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
|
||||
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<>();
|
||||
|
@ -163,38 +165,25 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
if(!enableDeleteWallet.isChecked() && !enableChangePassword.isChecked()){
|
||||
Intent intent2 = new Intent();
|
||||
intent2.putExtra("new_password",user_password);
|
||||
setResult(1,intent2);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("new_password",user_password);
|
||||
setResult(1,intent);
|
||||
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();
|
||||
}
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) SettingsActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(SettingsActivity.this.getCurrentFocus().getWindowToken(),0);
|
||||
changePwd();
|
||||
}
|
||||
else if (enableDeleteWallet.isChecked() && !enableChangePassword.isChecked()){
|
||||
if(deleteWallet()){
|
||||
Intent intent2 = new Intent();
|
||||
intent2.putExtra("new_password",user_password);
|
||||
setResult(1,intent2);
|
||||
finish();
|
||||
}
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) SettingsActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(SettingsActivity.this.getCurrentFocus().getWindowToken(),0);
|
||||
deleteWallet();
|
||||
}
|
||||
else {
|
||||
String newPwd = changePwd();
|
||||
if(newPwd!=null){
|
||||
if(deleteWallet()){
|
||||
Intent intent2 = new Intent();
|
||||
intent2.putExtra("new_password",newPwd);
|
||||
setResult(1,intent2);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) SettingsActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(SettingsActivity.this.getCurrentFocus().getWindowToken(),0);
|
||||
changePwdAndDeleteWallet();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -210,56 +199,38 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
|
||||
private String changePwd(){
|
||||
private void 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;
|
||||
}
|
||||
String[] p = {user_email,user_password,newPassword.getText().toString()};
|
||||
new changeUserPasswordTask().execute(p);
|
||||
}else{
|
||||
Toast.makeText(SettingsActivity.this,"Current password don't match actual password",Toast.LENGTH_SHORT).show();
|
||||
return null;
|
||||
}
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Boolean deleteWallet(){
|
||||
private void 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[] p = {user_email,user_hash,user_password,
|
||||
userWallets.get((int) walletToDelete.getSelectedItemId()).getWallet_hash(),
|
||||
userWallets.get((int) walletToTransfer.getSelectedItemId()).getWallet_hash()};
|
||||
new deleteWalletTask().execute(p);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
private void changePwdAndDeleteWallet(){
|
||||
if(checkInputEmptyPassword()){
|
||||
if(!currentPassword.getText().toString().equals(user_password)){
|
||||
Toast.makeText(SettingsActivity.this,"Current password don't match actual password",Toast.LENGTH_SHORT).show();
|
||||
}else{
|
||||
if(checkInputEmptyWallet()){
|
||||
String[] p = {user_email,user_password,newPassword.getText().toString(),user_hash,
|
||||
userWallets.get((int) walletToDelete.getSelectedItemId()).getWallet_hash(),
|
||||
userWallets.get((int) walletToTransfer.getSelectedItemId()).getWallet_hash()};
|
||||
new updatePwdAndDeleteWalletTask().execute(p);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,19 +276,25 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//AsyncTask to change userPassword
|
||||
private class changeUserPasswordTask extends AsyncTask<String,String,String> {
|
||||
ProgressDialog progDailog = new ProgressDialog(SettingsActivity.this);
|
||||
RelativeLayout progress = findViewById(R.id.progressLayout);
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progDailog.setMessage("Updating Password...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
super.onPreExecute();
|
||||
currentPassword.setEnabled(false);
|
||||
newPassword.setEnabled(false);
|
||||
confirmedNewPassword.setEnabled(false);
|
||||
walletToTransfer.setEnabled(false);
|
||||
confirmWalletToDelete.setEnabled(false);
|
||||
walletToDelete.setEnabled(false);
|
||||
buttonCancel.setEnabled(false);
|
||||
buttonConfirm.setEnabled(false);
|
||||
enableChangePassword.setEnabled(false);
|
||||
enableDeleteWallet.setEnabled(false);
|
||||
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -333,26 +310,50 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(String v) {
|
||||
progDailog.dismiss();
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
|
||||
currentPassword.setEnabled(true);
|
||||
newPassword.setEnabled(true);
|
||||
confirmedNewPassword.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonConfirm.setEnabled(true);
|
||||
enableChangePassword.setEnabled(true);
|
||||
enableChangePassword.setChecked(false);
|
||||
|
||||
if(Boolean.parseBoolean(v)){
|
||||
Toast.makeText(SettingsActivity.this,"Password updated",Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("new_password",newPassword.getText().toString());
|
||||
setResult(1,intent);
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class deleteWalletTask extends AsyncTask<String,String,String> {
|
||||
Context mContext;
|
||||
ProgressDialog progDialog;
|
||||
private deleteWalletTask(final Context context){
|
||||
mContext = context;
|
||||
progDialog = new ProgressDialog(mContext);
|
||||
}
|
||||
RelativeLayout progress = findViewById(R.id.progressLayout);
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDialog.setMessage("Deleting Wallet...");
|
||||
progDialog.setCancelable(true);
|
||||
progDialog.setIndeterminate(false);
|
||||
progDialog.show();
|
||||
currentPassword.setEnabled(false);
|
||||
newPassword.setEnabled(false);
|
||||
confirmedNewPassword.setEnabled(false);
|
||||
walletToTransfer.setEnabled(false);
|
||||
confirmWalletToDelete.setEnabled(false);
|
||||
walletToDelete.setEnabled(false);
|
||||
buttonCancel.setEnabled(false);
|
||||
buttonConfirm.setEnabled(false);
|
||||
enableChangePassword.setEnabled(false);
|
||||
enableDeleteWallet.setEnabled(false);
|
||||
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -368,48 +369,107 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(String v) {
|
||||
progDialog.dismiss();
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
|
||||
walletToDelete.setEnabled(true);
|
||||
walletToTransfer.setEnabled(true);
|
||||
confirmWalletToDelete.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonConfirm.setEnabled(true);
|
||||
enableDeleteWallet.setEnabled(true);
|
||||
enableDeleteWallet.setChecked(false);
|
||||
|
||||
if(Boolean.parseBoolean(v)){
|
||||
Toast.makeText(SettingsActivity.this,"Wallet has been deleted",Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("new_password",user_password);
|
||||
setResult(1,intent);
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private class updatePwdAndDeleteWalletTask extends AsyncTask<String,String,String>{
|
||||
RelativeLayout progress = findViewById(R.id.progressLayout);
|
||||
|
||||
//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();
|
||||
currentPassword.setEnabled(false);
|
||||
newPassword.setEnabled(false);
|
||||
confirmedNewPassword.setEnabled(false);
|
||||
walletToTransfer.setEnabled(false);
|
||||
confirmWalletToDelete.setEnabled(false);
|
||||
walletToDelete.setEnabled(false);
|
||||
buttonCancel.setEnabled(false);
|
||||
buttonConfirm.setEnabled(false);
|
||||
enableChangePassword.setEnabled(false);
|
||||
enableDeleteWallet.setEnabled(false);
|
||||
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ArrayList<Wallet> doInBackground(String... params) {
|
||||
ArrayList<Wallet> walletsList = new ArrayList<>();
|
||||
protected String doInBackground(String... params) {
|
||||
try{
|
||||
SettingsApiHandler settingsApiHandler = new SettingsApiHandler();
|
||||
WalletApiHandler walletApiHandler = new WalletApiHandler();
|
||||
walletsList = walletApiHandler.getUserWallets(params);
|
||||
if(Boolean.parseBoolean(settingsApiHandler.updatePassword(new String[]{params[0],params[1],params[2]}))){
|
||||
if(Boolean.parseBoolean(walletApiHandler.deleteWallet(new String[]{params[0],params[3],params[2],params[4],params[5]}))){
|
||||
return "true";
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return walletsList;
|
||||
return "false";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<Wallet> listWallet) {
|
||||
progDailog.dismiss();
|
||||
}
|
||||
}
|
||||
protected void onPostExecute(String v) {
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
|
||||
currentPassword.setEnabled(true);
|
||||
newPassword.setEnabled(true);
|
||||
confirmedNewPassword.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonConfirm.setEnabled(true);
|
||||
enableChangePassword.setEnabled(true);
|
||||
enableChangePassword.setChecked(false);
|
||||
|
||||
walletToDelete.setEnabled(true);
|
||||
walletToTransfer.setEnabled(true);
|
||||
confirmWalletToDelete.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonConfirm.setEnabled(true);
|
||||
enableDeleteWallet.setEnabled(true);
|
||||
enableDeleteWallet.setChecked(false);
|
||||
|
||||
if(Boolean.parseBoolean(v)){
|
||||
Toast.makeText(SettingsActivity.this,"Password updated & Wallet deleted",Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("new_password",user_password);
|
||||
setResult(1,intent);
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(SettingsActivity.this,"An error occured",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Intent intent4 = new Intent();
|
||||
intent4.putExtra("new_password",user_password);
|
||||
setResult(1,intent4);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("new_password",user_password);
|
||||
setResult(1,intent);
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@ import android.os.AsyncTask;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
@ -71,39 +73,48 @@ public class ApprovePayementActivity extends AppCompatActivity {
|
|||
public void sendTransaction(){
|
||||
SendingTransaction sendingTransaction = new SendingTransaction(user_hash,user_password,wallet_hash,wallet_dest,amount,"gonette");
|
||||
try {
|
||||
|
||||
String transaction_hash = new TransactionTask().execute(sendingTransaction).get();
|
||||
if(transaction_hash!=null){
|
||||
Toast.makeText(this, "transaction id : "+transaction_hash, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(this, "couldn't get transaction id", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
new TransactionTask().execute(sendingTransaction);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
private class TransactionTask extends AsyncTask<SendingTransaction,String,String> {
|
||||
ProgressDialog progDailog = new ProgressDialog(ApprovePayementActivity.this);
|
||||
RelativeLayout progress = findViewById(R.id.progressLayout);
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Sending transaction...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
buttonCancel.setEnabled(false);
|
||||
buttonVal.setEnabled(false);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String s) {
|
||||
if(s!=null){
|
||||
Toast.makeText(ApprovePayementActivity.this, "TxID : "+s, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(ApprovePayementActivity.this, "Couldn't get transaction id", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonVal.setEnabled(true);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(SendingTransaction... sendingTransactions) {
|
||||
try{
|
||||
TransactionApiHandler transactionApiHandler = new TransactionApiHandler();
|
||||
progDailog.dismiss();
|
||||
return transactionApiHandler.doTransaction(sendingTransactions[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonVal.setEnabled(true);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -31,10 +31,12 @@ public class MakePayementActivity extends AppCompatActivity {
|
|||
wallet_hash = intent.getStringExtra("WALLET_HASH");
|
||||
|
||||
|
||||
/*
|
||||
Log.i("UserAccountActivity", "user_hash : "+user_hash);
|
||||
Log.i("UserAccountActivity", "user_password : "+user_password);
|
||||
Log.i("UserAccountActivity", "session_id : "+session_id);
|
||||
Log.i("UserAccountActivity", "wallet_hash : "+wallet_hash);
|
||||
*/
|
||||
|
||||
initViews();
|
||||
}
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
package monnethic.mobile.transaction;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import monnethic.mobile.database.Transaction;
|
||||
import monnethic.mobile.homepage.InputController;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.TransactionApiHandler;
|
||||
|
@ -22,6 +28,9 @@ public class TransactionActivity extends AppCompatActivity {
|
|||
private String session_id;
|
||||
private EditText addressDestination;
|
||||
private EditText amountEditText;
|
||||
private Button buttonCancel;
|
||||
private Button buttonOk;
|
||||
private Button buttonSearch;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -29,9 +38,9 @@ public class TransactionActivity extends AppCompatActivity {
|
|||
setContentView(R.layout.activity_transaction);
|
||||
addressDestination = findViewById(R.id.destination_address);
|
||||
amountEditText = findViewById(R.id.amount);
|
||||
Button buttonCancel = findViewById(R.id.btn_cancel);
|
||||
Button buttonOk = findViewById(R.id.btn_send);
|
||||
Button buttonSearch = findViewById(R.id.buttonSearch);
|
||||
buttonCancel = findViewById(R.id.btn_cancel);
|
||||
buttonOk = findViewById(R.id.btn_send);
|
||||
buttonSearch = findViewById(R.id.buttonSearch);
|
||||
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
|
@ -49,6 +58,8 @@ public class TransactionActivity extends AppCompatActivity {
|
|||
buttonOk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) TransactionActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(TransactionActivity.this.getCurrentFocus().getWindowToken(),0);
|
||||
sendTransaction();
|
||||
}
|
||||
});
|
||||
|
@ -56,6 +67,8 @@ public class TransactionActivity extends AppCompatActivity {
|
|||
buttonSearch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) TransactionActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(TransactionActivity.this.getCurrentFocus().getWindowToken(),0);
|
||||
launchSearchActivity();
|
||||
}
|
||||
});
|
||||
|
@ -72,13 +85,7 @@ public class TransactionActivity extends AppCompatActivity {
|
|||
String amount = amountEditText.getText().toString();
|
||||
SendingTransaction sendingTransaction = new SendingTransaction(user_hash,user_password,wallet_hash,wallet_dest,amount,"gonette");
|
||||
try {
|
||||
String transaction_hash = new TransactionTask().execute(sendingTransaction).get();
|
||||
if(transaction_hash!=null){
|
||||
Toast.makeText(this, "transaction id : "+transaction_hash, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(this, "couldn't get transaction id", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
finish();
|
||||
new TransactionTask().execute(sendingTransaction);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -103,31 +110,51 @@ public class TransactionActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
private class TransactionTask extends AsyncTask<SendingTransaction,String,String> {
|
||||
ProgressDialog progDailog = new ProgressDialog(TransactionActivity.this);
|
||||
RelativeLayout progress = findViewById(R.id.progressLayout);
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Sending transaction...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
buttonCancel.setEnabled(false);
|
||||
buttonOk.setEnabled(false);
|
||||
buttonSearch.setEnabled(false);
|
||||
amountEditText.setEnabled(false);
|
||||
addressDestination.setEnabled(false);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(SendingTransaction... sendingTransactions) {
|
||||
try{
|
||||
TransactionApiHandler transactionApiHandler = new TransactionApiHandler();
|
||||
progDailog.dismiss();
|
||||
return transactionApiHandler.doTransaction(sendingTransactions[0]);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String s) {
|
||||
if(s!=null){
|
||||
Toast.makeText(TransactionActivity.this, "TxID : "+s, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(TransactionActivity.this, "Couldn't get transaction id", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
buttonCancel.setEnabled(true);
|
||||
buttonOk.setEnabled(true);
|
||||
buttonSearch.setEnabled(true);
|
||||
amountEditText.setEnabled(true);
|
||||
addressDestination.setEnabled(true);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package monnethic.mobile.wallet;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -7,8 +8,12 @@ import android.os.AsyncTask;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
|
@ -19,15 +24,18 @@ public class CreateWalletActivity extends AppCompatActivity {
|
|||
private String user_hash;
|
||||
private String user_password;
|
||||
private String session_id;
|
||||
private Button buttonValidate;
|
||||
private Button buttonCancel;
|
||||
private EditText wallet_type;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_create_wallet);
|
||||
|
||||
EditText wallet_type = findViewById(R.id.editTextWalletType);
|
||||
Button buttonValidate = findViewById(R.id.buttonValidate);
|
||||
Button buttonCancel = findViewById(R.id.buttonCancel);
|
||||
wallet_type = findViewById(R.id.editTextWalletType);
|
||||
buttonValidate = findViewById(R.id.buttonValidate);
|
||||
buttonCancel = findViewById(R.id.buttonCancel);
|
||||
|
||||
Context context = this;
|
||||
Intent intent = getIntent();
|
||||
|
@ -38,6 +46,8 @@ public class CreateWalletActivity extends AppCompatActivity {
|
|||
buttonValidate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
InputMethodManager inputMethodManager = (InputMethodManager) CreateWalletActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(CreateWalletActivity.this.getCurrentFocus().getWindowToken(),0);
|
||||
Wallet wallet = new Wallet(wallet_type.getText().toString(),user_hash);
|
||||
new CreateWalletTask(context).execute(wallet);
|
||||
}
|
||||
|
@ -57,16 +67,16 @@ public class CreateWalletActivity extends AppCompatActivity {
|
|||
private CreateWalletTask(final Context context){
|
||||
mContext = context;
|
||||
}
|
||||
RelativeLayout progress = findViewById(R.id.progressLayout);
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
ProgressDialog progDailog = new ProgressDialog(CreateWalletActivity.this);
|
||||
progDailog.setMessage("Creating...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
buttonValidate.setEnabled(false);
|
||||
buttonCancel.setEnabled(false);
|
||||
wallet_type.setEnabled(false);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,10 +89,23 @@ public class CreateWalletActivity extends AppCompatActivity {
|
|||
accountIntent.putExtra("WALLET_HASH",w.getWallet_hash());
|
||||
accountIntent.putExtra("WALLET_BALANCE",String.valueOf(w.getBalance()));
|
||||
accountIntent.putExtra("WALLET_TYPE",w.getType());
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
buttonValidate.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
wallet_type.setEnabled(true);
|
||||
|
||||
CreateWalletActivity.this.startActivity(accountIntent);
|
||||
finish();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
buttonValidate.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
wallet_type.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,16 +7,21 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.monnthic.monnethicmobile.R;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import monnethic.mobile.database.User;
|
||||
import monnethic.mobile.restApi.SessionApiHandler;
|
||||
import monnethic.mobile.restApi.UserApiHandler;
|
||||
import monnethic.mobile.restApi.WalletApiHandler;
|
||||
import monnethic.mobile.settings.SettingsActivity;
|
||||
|
||||
public class HomeWalletActivity extends AppCompatActivity {
|
||||
|
@ -26,15 +31,20 @@ public class HomeWalletActivity extends AppCompatActivity {
|
|||
private String email;
|
||||
private Boolean approved;
|
||||
private Button buttonApproveUser;
|
||||
private Button buttonCreateWallet;
|
||||
private Button buttonSelectWallet;
|
||||
private Button buttonSettings;
|
||||
private RelativeLayout progress;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_home_wallet);
|
||||
Button buttonCreateWallet = findViewById(R.id.buttonCreateWallet);
|
||||
Button buttonSelectWallet = findViewById(R.id.buttonSelectWallet);
|
||||
buttonCreateWallet = findViewById(R.id.buttonCreateWallet);
|
||||
buttonSelectWallet = findViewById(R.id.buttonSelectWallet);
|
||||
buttonApproveUser = findViewById(R.id.buttonApproveUser);
|
||||
Button buttonSettings = findViewById(R.id.buttonSettings);
|
||||
buttonSettings = findViewById(R.id.buttonSettings);
|
||||
|
||||
|
||||
Intent intent = getIntent();
|
||||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
|
@ -80,6 +90,7 @@ public class HomeWalletActivity extends AppCompatActivity {
|
|||
try{
|
||||
if(approved){
|
||||
Intent createWalletIntent = new Intent(HomeWalletActivity.this, CreateWalletActivity.class);
|
||||
createWalletIntent.putExtra("USER_EMAIL",email);
|
||||
createWalletIntent.putExtra("USER_HASH",user_hash);
|
||||
createWalletIntent.putExtra("USER_PWD",user_password);
|
||||
createWalletIntent.putExtra("SESSION_ID",session_id);
|
||||
|
@ -95,11 +106,8 @@ public class HomeWalletActivity extends AppCompatActivity {
|
|||
public void launchSelectWalletActivity() {
|
||||
try{
|
||||
if(approved){
|
||||
Intent selectWalletIntent = new Intent(HomeWalletActivity.this, SelectWalletActivity.class);
|
||||
selectWalletIntent.putExtra("USER_HASH",user_hash);
|
||||
selectWalletIntent.putExtra("USER_PWD",user_password);
|
||||
selectWalletIntent.putExtra("SESSION_ID",session_id);
|
||||
HomeWalletActivity.this.startActivity(selectWalletIntent);
|
||||
String[] params = {user_hash};
|
||||
new getUserWalletTaskA().execute(params);
|
||||
}else {
|
||||
Toast.makeText(HomeWalletActivity.this,"You are not approved",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
@ -109,32 +117,195 @@ 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();
|
||||
try{
|
||||
if(approved){
|
||||
String[] params = {user_hash};
|
||||
new getUserWalletTaskB().execute(params);
|
||||
}else {
|
||||
Toast.makeText(HomeWalletActivity.this,"You are not approved",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data){
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
Log.i("RESULT","HERE");
|
||||
System.out.println("HERE");
|
||||
if(requestCode==1){
|
||||
user_password = data.getStringExtra("new_password");
|
||||
}
|
||||
Log.i("NEW_PWD",user_password);
|
||||
System.out.println("NEW_PWD "+user_password);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
buttonCreateWallet.setEnabled(true);
|
||||
buttonSelectWallet.setEnabled(true);
|
||||
buttonSettings.setEnabled(true);
|
||||
buttonApproveUser.setEnabled(true);
|
||||
}
|
||||
|
||||
public void approveUser(){
|
||||
new ApproveTask().execute(user_hash,email);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
buttonCreateWallet.setEnabled(true);
|
||||
buttonSelectWallet.setEnabled(true);
|
||||
buttonSettings.setEnabled(true);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
}
|
||||
|
||||
|
||||
//AsyncTask to get user wallets
|
||||
private class getUserWalletTaskA extends AsyncTask<String,ArrayList<Wallet>,ArrayList<Wallet>> {
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progress = findViewById(R.id.progressLayoutSelect);
|
||||
buttonCreateWallet.setEnabled(false);
|
||||
buttonSelectWallet.setEnabled(false);
|
||||
buttonSettings.setEnabled(false);
|
||||
buttonApproveUser.setEnabled(false);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@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();
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
buttonCreateWallet.setEnabled(true);
|
||||
buttonSelectWallet.setEnabled(true);
|
||||
buttonSettings.setEnabled(true);
|
||||
buttonApproveUser.setEnabled(true);
|
||||
}
|
||||
return walletsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<Wallet> listWallet) {
|
||||
if(listWallet!=null && !listWallet.isEmpty()){
|
||||
Intent selectWalletIntent = new Intent(HomeWalletActivity.this, SelectWalletActivity.class);
|
||||
selectWalletIntent.putExtra("USER_HASH",user_hash);
|
||||
selectWalletIntent.putExtra("USER_EMAIL",email);
|
||||
selectWalletIntent.putExtra("USER_PWD",user_password);
|
||||
selectWalletIntent.putExtra("SESSION_ID",session_id);
|
||||
selectWalletIntent.putExtra("data",listWallet);
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
buttonCreateWallet.setEnabled(true);
|
||||
buttonSelectWallet.setEnabled(true);
|
||||
buttonSettings.setEnabled(true);
|
||||
buttonApproveUser.setEnabled(true);
|
||||
|
||||
HomeWalletActivity.this.startActivity(selectWalletIntent);
|
||||
}else {
|
||||
Toast.makeText(HomeWalletActivity.this,"You don't have wallets",Toast.LENGTH_SHORT).show();
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
buttonCreateWallet.setEnabled(true);
|
||||
buttonSelectWallet.setEnabled(true);
|
||||
buttonSettings.setEnabled(true);
|
||||
buttonApproveUser.setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
private class getUserWalletTaskB extends AsyncTask<String,ArrayList<Wallet>,ArrayList<Wallet>> {
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progress = findViewById(R.id.progressLayoutSettings);
|
||||
buttonCreateWallet.setEnabled(false);
|
||||
buttonSelectWallet.setEnabled(false);
|
||||
buttonSettings.setEnabled(false);
|
||||
buttonApproveUser.setEnabled(false);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@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();
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
buttonCreateWallet.setEnabled(true);
|
||||
buttonSelectWallet.setEnabled(true);
|
||||
buttonSettings.setEnabled(true);
|
||||
buttonApproveUser.setEnabled(true);
|
||||
}
|
||||
return walletsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(ArrayList<Wallet> listWallet) {
|
||||
Intent settingsIntent = new Intent(HomeWalletActivity.this, SettingsActivity.class);
|
||||
settingsIntent.putExtra("USER_HASH",user_hash);
|
||||
settingsIntent.putExtra("USER_EMAIL",email);
|
||||
settingsIntent.putExtra("USER_PWD",user_password);
|
||||
settingsIntent.putExtra("SESSION_ID",session_id);
|
||||
settingsIntent.putExtra("data",listWallet);
|
||||
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
buttonCreateWallet.setEnabled(true);
|
||||
buttonSelectWallet.setEnabled(true);
|
||||
buttonSettings.setEnabled(true);
|
||||
buttonApproveUser.setEnabled(true);
|
||||
|
||||
HomeWalletActivity.this.startActivityForResult(settingsIntent,1);
|
||||
}
|
||||
}
|
||||
private class ApproveTask extends AsyncTask<String,String,String>{
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progress = findViewById(R.id.progressLayoutSettings);
|
||||
buttonCreateWallet.setEnabled(false);
|
||||
buttonSelectWallet.setEnabled(false);
|
||||
buttonSettings.setEnabled(false);
|
||||
buttonApproveUser.setEnabled(false);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
buttonApproveUser.setVisibility(View.INVISIBLE);
|
||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
|
||||
progress.setVisibility(View.GONE);
|
||||
buttonCreateWallet.setEnabled(true);
|
||||
buttonSelectWallet.setEnabled(true);
|
||||
buttonSettings.setEnabled(true);
|
||||
buttonApproveUser.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... strings) {
|
||||
try{
|
||||
UserApiHandler userApiHandler = new UserApiHandler();
|
||||
userApiHandler.approveUser(strings[0],strings[1]);
|
||||
return null;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop(); // Always call the superclass method first
|
||||
|
@ -184,34 +355,5 @@ public class HomeWalletActivity extends AppCompatActivity {
|
|||
}
|
||||
*/
|
||||
|
||||
private class ApproveTask extends AsyncTask<String,String,String>{
|
||||
ProgressDialog progDailog = new ProgressDialog(HomeWalletActivity.this);
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Loading...");
|
||||
progDailog.setIndeterminate(false);
|
||||
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progDailog.setCancelable(true);
|
||||
progDailog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
buttonApproveUser.setVisibility(View.INVISIBLE);
|
||||
progDailog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... strings) {
|
||||
try{
|
||||
UserApiHandler userApiHandler = new UserApiHandler();
|
||||
userApiHandler.approveUser(strings[0],strings[1]);
|
||||
return null;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,18 +29,17 @@ public class SelectWalletActivity extends AppCompatActivity {
|
|||
user_hash = intent.getStringExtra("USER_HASH");
|
||||
user_password = intent.getStringExtra("USER_PWD");
|
||||
session_id = intent.getStringExtra("SESSION_ID");
|
||||
try{
|
||||
userWallets = (ArrayList<Wallet>) intent.getSerializableExtra("data");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
userWallets=null;
|
||||
}
|
||||
setupWallet();
|
||||
}
|
||||
|
||||
public void setupWallet(){
|
||||
ListView listView = (ListView) findViewById(R.id.listViewWallet);
|
||||
String[] params = {user_hash};
|
||||
try {
|
||||
userWallets = new getUserWalletTask().execute(params).get();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
WalletAdapter adapter = new WalletAdapter(this,userWallets);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
|
@ -64,37 +63,6 @@ public class SelectWalletActivity extends AppCompatActivity {
|
|||
SelectWalletActivity.this.startActivity(accountIntent);
|
||||
}
|
||||
|
||||
//AsyncTask to get user wallets
|
||||
private class getUserWalletTask extends AsyncTask<String,ArrayList<Wallet>,ArrayList<Wallet>> {
|
||||
ProgressDialog progDailog = new ProgressDialog(SelectWalletActivity.this);
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
progDailog.setMessage("Searching...");
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private class EndSessionTask extends AsyncTask<String,Void,Void> {
|
||||
@Override
|
||||
protected Void doInBackground(String... strings) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package monnethic.mobile.wallet;
|
||||
|
||||
public class Wallet {
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Wallet implements Serializable {
|
||||
private int wallet_id;
|
||||
private String wallet_hash;
|
||||
private String user_hash;
|
||||
|
|
|
@ -6,6 +6,38 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.transaction.ApprovePayementActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progressLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/gray_transparent"
|
||||
android:gravity="center"
|
||||
android:elevation="1dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_toEndOf="@+id/progressBar"
|
||||
android:text="Sending transaction..."
|
||||
android:textSize="20dp"
|
||||
android:textColor="@android:color/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -3,6 +3,39 @@
|
|||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progressLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:background="@color/gray_transparent"
|
||||
android:elevation="1dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_toEndOf="@+id/progressBar"
|
||||
android:text="Creating wallet..."
|
||||
android:textSize="20dp"
|
||||
android:textColor="@android:color/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -29,7 +62,7 @@
|
|||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginBottom="20dp">
|
||||
|
||||
<Button
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -7,11 +8,46 @@
|
|||
tools:context="monnethic.mobile.history.HistoryActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progressLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:background="@color/gray_transparent"
|
||||
android:elevation="1dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="5dp"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_toEndOf="@+id/progressBar"
|
||||
android:text="Please wait, Collecting history..."
|
||||
android:textSize="18dp"
|
||||
android:textColor="@android:color/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginRight="3dp">
|
||||
android:layout_marginTop="2dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switchDate"
|
||||
|
@ -53,10 +89,13 @@
|
|||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginRight="3dp">
|
||||
android:layout_marginTop="2dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/relativeLayout2">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
|
@ -90,10 +129,13 @@
|
|||
|
||||
<ListView
|
||||
android:id="@+id/listViewTransactions"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginRight="3dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:dividerHeight="5dp" />
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:dividerHeight="5dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/relativeLayout" />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
|
@ -6,6 +6,72 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context="monnethic.mobile.wallet.HomeWalletActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progressLayoutSelect"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:background="@color/gray_transparent"
|
||||
android:elevation="1dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="5dp"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_toEndOf="@+id/progressBar"
|
||||
android:text="Please wait, searching your wallets..."
|
||||
android:textSize="18dp"
|
||||
android:textColor="@android:color/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progressLayoutSettings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:background="@color/gray_transparent"
|
||||
android:elevation="1dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBarSetting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="5dp"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_toEndOf="@+id/progressBarSetting"
|
||||
android:text="Please wait, this may take a moment..."
|
||||
android:textSize="18dp"
|
||||
android:textColor="@android:color/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -1,8 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progressLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/gray_transparent"
|
||||
android:gravity="center"
|
||||
android:elevation="1dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@+id/progressBar"
|
||||
android:text="Login..."
|
||||
android:textSize="20dp"
|
||||
android:textColor="@android:color/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -3,6 +3,38 @@
|
|||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progressLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/gray_transparent"
|
||||
android:gravity="center"
|
||||
android:elevation="1dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_toEndOf="@+id/progressBar"
|
||||
android:text="Searching user..."
|
||||
android:textSize="20dp"
|
||||
android:textColor="@android:color/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -1,22 +1,50 @@
|
|||
<?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"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
tools:context="monnethic.mobile.settings.SettingsActivity">
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/progressLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/gray_transparent"
|
||||
android:gravity="center"
|
||||
android:elevation="1dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_toEndOf="@+id/progressBar"
|
||||
android:text="Please wait, this may take a moment..."
|
||||
android:textSize="18dp"
|
||||
android:textColor="@android:color/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/l1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="90dp"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -56,11 +84,15 @@
|
|||
android:inputType="textPassword" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/l2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_below="@+id/l1"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@android:color/darker_gray"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
@ -117,6 +149,10 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/l2"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginTop="25dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
|
@ -133,6 +169,4 @@
|
|||
android:layout_weight="1"
|
||||
android:text="Confirm" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -3,6 +3,39 @@
|
|||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progressLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="0dp"
|
||||
android:background="@color/gray_transparent"
|
||||
android:elevation="1dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_toEndOf="@+id/progressBar"
|
||||
android:text="Creating account..."
|
||||
android:textSize="20dp"
|
||||
android:textColor="@android:color/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -5,6 +5,38 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/progressLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/gray_transparent"
|
||||
android:gravity="center"
|
||||
android:elevation="1dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="10dp"
|
||||
android:indeterminate="true"
|
||||
android:max="100"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_toEndOf="@+id/progressBar"
|
||||
android:text="Sending transaction..."
|
||||
android:textSize="20dp"
|
||||
android:textColor="@android:color/black" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
28
app/src/main/res/layout/layout_loading_dialog.xml
Normal file
28
app/src/main/res/layout/layout_loading_dialog.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" 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="horizontal"
|
||||
android:padding="20dp">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/indeterminateBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewLoading"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="4"
|
||||
android:gravity="center"
|
||||
android:text="Please wait! This may take a moment..." />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -4,4 +4,5 @@
|
|||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="darker_gray">#aaa</color>
|
||||
<color name="gray_transparent">#D2616161</color>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue