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