Skip to content

Commit

Permalink
fix search filters, remove SendManager runtimeexception when address …
Browse files Browse the repository at this point in the history
…is empty, show dialog
  • Loading branch information
MIPPL committed Oct 31, 2019
1 parent 804d0ae commit 97638ad
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 14 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file modified .idea/caches/gradle_models.ser
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId = 'com.wagerrwallet'
minSdkVersion 23
targetSdkVersion 28
versionCode 244
versionName "244"
versionCode 245
versionName "245"
multiDexEnabled true

// Similar to other properties in the defaultConfig block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public class EventsActivity extends BRActivity implements InternetManager.Connec
private static EventsActivity app;

private InternetManager mConnectionReceiver;

private TestLogger logger;
public boolean isSearchBarVisible = false;

public static EventsActivity getApp() {
return app;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public class WalletActivity extends BRActivity implements InternetManager.Connec
private static WalletActivity app;

private InternetManager mConnectionReceiver;

private TestLogger logger;
public boolean isSearchBarVisible = false;

public static WalletActivity getApp() {
return app;
Expand Down Expand Up @@ -229,11 +229,7 @@ public void onClick(View v) {
}

public boolean isSearchActive() {
boolean ret = false;
if ( searchBar!=null && searchBar.isShown() ) {
ret = true;
}
return ret;
return isSearchBarVisible;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class BREventSearchBar extends android.support.v7.widget.Toolbar {
private LinearLayout barLayout;
private LinearLayout betbarLayout;

public long[] filterSwitches = new long[4];
public long[] filterSwitches = new long[2];

public BREventSearchBar(Context context) {
super(context);
Expand Down Expand Up @@ -156,7 +156,7 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (EventTxManager.getInstance().adapter != null)
EventTxManager.getInstance().adapter.filterBy(s.toString(), filterSwitches);
EventTxManager.getInstance().adapter.filterBy(s.toString());
}

@Override
Expand Down Expand Up @@ -246,6 +246,7 @@ public void run() {
EventTxManager.getInstance().adapter.resetFilter();
}
}
breadActivity.isSearchBarVisible = b;
}

public String getSearchQuery() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ public void run() {
TxManager.getInstance().adapter.resetFilter();
}
}
breadActivity.isSearchBarVisible = b;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ private void showTransactionFailed(EventHolder holder, EventTxUiHolder tx, boole

}

public void filterBy(String query, long[] switches) {
filter(switches, true, query);
public void filterBy(String query) {
filter(filterSwitches, true, query);
}

public void resetFilter() {
Expand All @@ -241,6 +241,7 @@ public void filter(final long[] switches, boolean bNotify, String query) {
long start = System.currentTimeMillis();
int switchesON = 0;
for (long i : switches) if (i>=0) switchesON++;
filterSwitches = switches;

final List<EventTxUiHolder> filteredList = new ArrayList<>();
String lowerQuery = query.toLowerCase().trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,15 @@ public void onClick(BRDialogView brDialogView) {
}
}, null, null, 0);
} else {
if (Utils.isNullOrEmpty(item.address)) throw new RuntimeException("can't happen");
if (Utils.isNullOrEmpty(item.address)) {
BRDialog.showCustomDialog(app, app.getString(R.string.Alerts_sendFailure), "Error while obtaining destination address, please report case if it persists.", app.getString(R.string.Button_ok), null, new BRDialogView.BROnClickListener() {
@Override
public void onClick(BRDialogView brDialogView) {
brDialogView.dismissWithAnimation();
}
}, null, null, 0);
return;
}
final BRCoreTransaction tx = wm.getWallet().createTransaction(maxAmountDouble, new BRCoreAddress(item.address));
if (tx == null) {
BRDialog.showCustomDialog(app, app.getString(R.string.Alerts_sendFailure), "Insufficient amount for transaction fee", app.getString(R.string.Button_ok), null, new BRDialogView.BROnClickListener() {
Expand Down

0 comments on commit 97638ad

Please sign in to comment.