Fix major bug - crash when search
This commit is contained in:
parent
32f5d4c99b
commit
6340e3b5b8
|
@ -45,8 +45,8 @@ public class HistoryActivity extends AppCompatActivity {
|
|||
final Calendar calendar2 = Calendar.getInstance();
|
||||
private Button btnSearchTransactions;
|
||||
private EditText inputSize;
|
||||
private EditText fromDate;
|
||||
private EditText toDate;
|
||||
private Button fromDate;
|
||||
private Button toDate;
|
||||
private Spinner spinner;
|
||||
private Switch aSwitch;
|
||||
private ListView listView;
|
||||
|
|
|
@ -81,11 +81,15 @@ public class SearchUser extends AppCompatActivity {
|
|||
String uPhone = phoneNumber.getText().toString();
|
||||
|
||||
if(InputController.isEmptyEdit(emailAddress) && InputController.isEmptyEdit(phoneNumber)){
|
||||
Toast.makeText(this, "Enter an email or phone number", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, "Enter an email or a phone number", Toast.LENGTH_SHORT).show();
|
||||
} else if(InputController.isEmptyEdit(emailAddress)){
|
||||
new SearchUserTask().execute(null,uPhone);
|
||||
} else if(InputController.isEmptyEdit(phoneNumber)){
|
||||
new SearchUserTask().execute(uEmail,null);
|
||||
if(!InputController.validEmail(emailAddress.getText().toString())){
|
||||
Toast.makeText(SearchUser.this, "Invalid format for email", Toast.LENGTH_SHORT).show();
|
||||
}else{
|
||||
new SearchUserTask().execute(uEmail,null);
|
||||
}
|
||||
} else {
|
||||
new SearchUserTask().execute(uEmail,uPhone);
|
||||
}
|
||||
|
@ -107,7 +111,7 @@ public class SearchUser extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onPostExecute(ArrayList<Wallet> wallets) {
|
||||
try{
|
||||
if(wallets!=null){
|
||||
if(wallets!=null && !wallets.isEmpty()){
|
||||
ArrayList<DisplayWallet> displayWallets = new ArrayList<>();
|
||||
for(Wallet w : wallets){
|
||||
displayWallets.add(new DisplayWallet(u_dest_n,u_dest_fn,w.getWallet_hash(),w.getType()));
|
||||
|
@ -119,7 +123,7 @@ public class SearchUser extends AppCompatActivity {
|
|||
SearchUser.this.startActivity(displayWalletIntent);
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(SearchUser.this,"User dosen't exist",Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(SearchUser.this,"User doesn't exist or don't have a wallet",Toast.LENGTH_SHORT).show();
|
||||
emailAddress.setEnabled(true);
|
||||
phoneNumber.setEnabled(true);
|
||||
buttonCancel.setEnabled(true);
|
||||
|
|
|
@ -51,27 +51,26 @@
|
|||
|
||||
<Switch
|
||||
android:id="@+id/switchDate"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="35dp" />
|
||||
|
||||
<EditText
|
||||
<Button
|
||||
android:id="@+id/fromDate"
|
||||
android:layout_width="130dp"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_toEndOf="@+id/switchDate"
|
||||
android:clickable="true"
|
||||
android:editable="false"
|
||||
android:ems="10"
|
||||
android:hint="From"
|
||||
android:inputType="none"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<EditText
|
||||
<Button
|
||||
android:id="@+id/toDate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
|
@ -80,8 +79,6 @@
|
|||
android:layout_marginEnd="25dp"
|
||||
android:layout_toEndOf="@+id/fromDate"
|
||||
android:clickable="true"
|
||||
android:editable="false"
|
||||
android:ems="10"
|
||||
android:hint="To"
|
||||
android:inputType="none"
|
||||
android:textSize="14sp" />
|
||||
|
@ -99,6 +96,7 @@
|
|||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="40dp" />
|
||||
|
||||
|
|
Loading…
Reference in a new issue