Remove previous search results

pull/146/head
M66B 7 years ago
parent 9508082280
commit 7aed62b8f9

@ -317,37 +317,48 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
intent.removeExtra(Intent.EXTRA_PROCESS_TEXT); intent.removeExtra(Intent.EXTRA_PROCESS_TEXT);
setIntent(intent); setIntent(intent);
Bundle args = new Bundle(); if (Helper.isPro(this)) {
args.putString("search", search); Bundle args = new Bundle();
args.putString("search", search);
new SimpleTask<Long>() {
@Override
protected Long onLoad(Context context, Bundle args) {
EntityFolder archive = DB.getInstance(context).folder().getPrimaryArchive();
if (archive == null)
throw new IllegalArgumentException(getString(R.string.title_no_archive));
return archive.id;
}
@Override new SimpleTask<Long>() {
protected void onLoaded(Bundle args, Long archive) { @Override
Bundle sargs = new Bundle(); protected Long onLoad(Context context, Bundle args) {
sargs.putLong("folder", archive); DB db = DB.getInstance(context);
sargs.putString("search", args.getString("search"));
FragmentMessages fragment = new FragmentMessages(); EntityFolder archive = db.folder().getPrimaryArchive();
fragment.setArguments(sargs); if (archive == null)
throw new IllegalArgumentException(getString(R.string.title_no_archive));
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); db.message().deleteFoundMessages();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("search");
fragmentTransaction.commit();
}
@Override return archive.id;
protected void onException(Bundle args, Throwable ex) { }
Helper.unexpectedError(ActivityView.this, ex);
} @Override
}.load(this, args); protected void onLoaded(Bundle args, Long archive) {
Bundle sargs = new Bundle();
sargs.putLong("folder", archive);
sargs.putString("search", args.getString("search"));
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(sargs);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("search");
fragmentTransaction.commit();
}
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(ActivityView.this, ex);
}
}.load(this, args);
} else {
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
fragmentTransaction.commit();
}
} }
} }

Loading…
Cancel
Save