Always exclude from recents

pull/162/head
M66B 6 years ago
parent d9488e12e5
commit f7b1f3348a

@ -199,14 +199,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
@Override @Override
public void startActivity(Intent intent) { public void startActivity(Intent intent) {
try { Helper.startActivity(this, intent);
if (Helper.hasAuthentication(this))
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
super.startActivity(intent);
} catch (ActivityNotFoundException ex) {
Log.e(ex);
ToastEx.makeText(this, getString(R.string.title_no_viewer, intent.getAction()), Toast.LENGTH_LONG).show();
}
} }
@Override @Override

@ -286,7 +286,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS) Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName()) .putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName())
.putExtra(Settings.EXTRA_CHANNEL_ID, EntityAccount.getNotificationChannelId(account.id)); .putExtra(Settings.EXTRA_CHANNEL_ID, EntityAccount.getNotificationChannelId(account.id));
context.startActivity(intent); Helper.startActivity(context, intent);
} }
private void onActionCopy() { private void onActionCopy() {

@ -137,9 +137,10 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
} }
private void onActionCompose() { private void onActionCompose() {
context.startActivity(new Intent(context, ActivityCompose.class) Helper.startActivity(context,
.putExtra("action", "new") new Intent(context, ActivityCompose.class)
.putExtra("answer", answer.id)); .putExtra("action", "new")
.putExtra("answer", answer.id));
} }
private void onActionHide(boolean hide) { private void onActionHide(boolean hide) {

@ -244,7 +244,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
context.getString(R.string.title_no_viewer, attachment.type), context.getString(R.string.title_no_viewer, attachment.type),
Snackbar.LENGTH_LONG).show(); Snackbar.LENGTH_LONG).show();
else else
context.startActivity(intent); Helper.startActivity(context, intent);
} }
private void onDownload(EntityAttachment attachment) { private void onDownload(EntityAttachment attachment) {

@ -619,7 +619,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
@RequiresApi(api = Build.VERSION_CODES.O) @RequiresApi(api = Build.VERSION_CODES.O)
private void onActionCreateChannel() { private void onActionCreateChannel() {
if (!ActivityBilling.isPro(context)) { if (!ActivityBilling.isPro(context)) {
context.startActivity(new Intent(context, ActivityBilling.class)); Helper.startActivity(context, new Intent(context, ActivityBilling.class));
return; return;
} }
@ -632,7 +632,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS) Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName()) .putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName())
.putExtra(Settings.EXTRA_CHANNEL_ID, EntityFolder.getNotificationChannelId(folder.id)); .putExtra(Settings.EXTRA_CHANNEL_ID, EntityFolder.getNotificationChannelId(folder.id));
context.startActivity(intent); Helper.startActivity(context, intent);
} }
@RequiresApi(api = Build.VERSION_CODES.O) @RequiresApi(api = Build.VERSION_CODES.O)

@ -142,7 +142,7 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
return; return;
} }
context.startActivity(intent); Helper.startActivity(context, intent);
} else { } else {
if (attachment.progress == null) { if (attachment.progress == null) {
Bundle args = new Bundle(); Bundle args = new Bundle();

@ -1368,7 +1368,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private void onActionCalendar(TupleMessageEx message, int action) { private void onActionCalendar(TupleMessageEx message, int action) {
if (!ActivityBilling.isPro(context)) { if (!ActivityBilling.isPro(context)) {
context.startActivity(new Intent(context, ActivityBilling.class)); Helper.startActivity(context, new Intent(context, ActivityBilling.class));
return; return;
} }
@ -1457,7 +1457,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.putExtra("reference", args.getLong("id")) .putExtra("reference", args.getLong("id"))
.putExtra("ics", ics) .putExtra("ics", ics)
.putExtra("status", status); .putExtra("status", status);
context.startActivity(reply); Helper.startActivity(context, reply);
} }
@Override @Override
@ -1563,7 +1563,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
if (EntityFolder.DRAFTS.equals(message.folderType) && message.visible == 1) if (EntityFolder.DRAFTS.equals(message.folderType) && message.visible == 1)
context.startActivity( Helper.startActivity(context,
new Intent(context, ActivityCompose.class) new Intent(context, ActivityCompose.class)
.putExtra("action", "edit") .putExtra("action", "edit")
.putExtra("id", message.id)); .putExtra("id", message.id));
@ -1862,7 +1862,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@TargetApi(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O)
private void onActionCreateChannel() { private void onActionCreateChannel() {
if (!ActivityBilling.isPro(context)) { if (!ActivityBilling.isPro(context)) {
context.startActivity(new Intent(context, ActivityBilling.class)); Helper.startActivity(context, new Intent(context, ActivityBilling.class));
return; return;
} }
@ -1881,7 +1881,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS) Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName()) .putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName())
.putExtra(Settings.EXTRA_CHANNEL_ID, channelId); .putExtra(Settings.EXTRA_CHANNEL_ID, channelId);
context.startActivity(intent); Helper.startActivity(context, intent);
} }
private void onActionDeleteChannel() { private void onActionDeleteChannel() {
@ -1936,13 +1936,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Snackbar.make(parentFragment.getView(), Snackbar.make(parentFragment.getView(),
R.string.title_no_contacts, Snackbar.LENGTH_LONG).show(); R.string.title_no_contacts, Snackbar.LENGTH_LONG).show();
else else
context.startActivity(edit); Helper.startActivity(context, edit);
} }
} }
private void onToggleMessage(TupleMessageEx message) { private void onToggleMessage(TupleMessageEx message) {
if (EntityFolder.DRAFTS.equals(message.folderType)) if (EntityFolder.DRAFTS.equals(message.folderType))
context.startActivity( Helper.startActivity(context,
new Intent(context, ActivityCompose.class) new Intent(context, ActivityCompose.class)
.putExtra("action", "edit") .putExtra("action", "edit")
.putExtra("id", message.id)); .putExtra("id", message.id));
@ -2207,7 +2207,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Intent reply = new Intent(context, ActivityCompose.class) Intent reply = new Intent(context, ActivityCompose.class)
.putExtra("action", action) .putExtra("action", action)
.putExtra("reference", message.id); .putExtra("reference", message.id);
context.startActivity(reply); Helper.startActivity(context, reply);
} }
private void onMenuAnswer(TupleMessageEx message) { private void onMenuAnswer(TupleMessageEx message) {
@ -2244,14 +2244,15 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override @Override
public boolean onMenuItemClick(MenuItem target) { public boolean onMenuItemClick(MenuItem target) {
if (!ActivityBilling.isPro(context)) { if (!ActivityBilling.isPro(context)) {
context.startActivity(new Intent(context, ActivityBilling.class)); Helper.startActivity(context, new Intent(context, ActivityBilling.class));
return true; return true;
} }
context.startActivity(new Intent(context, ActivityCompose.class) Helper.startActivity(context,
.putExtra("action", "reply") new Intent(context, ActivityCompose.class)
.putExtra("reference", message.id) .putExtra("action", "reply")
.putExtra("answer", (long) target.getItemId())); .putExtra("reference", message.id)
.putExtra("answer", (long) target.getItemId()));
return true; return true;
} }
}); });
@ -2747,7 +2748,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Intent asnew = new Intent(context, ActivityCompose.class) Intent asnew = new Intent(context, ActivityCompose.class)
.putExtra("action", "editasnew") .putExtra("action", "editasnew")
.putExtra("reference", message.id); .putExtra("reference", message.id);
context.startActivity(asnew); Helper.startActivity(context, asnew);
} }
private void onMenuUnseen(final TupleMessageEx message) { private void onMenuUnseen(final TupleMessageEx message) {
@ -2974,7 +2975,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Snackbar.make(parentFragment.getView(), Snackbar.make(parentFragment.getView(),
R.string.title_no_viewer, Snackbar.LENGTH_LONG).show(); R.string.title_no_viewer, Snackbar.LENGTH_LONG).show();
else else
context.startActivity(share); Helper.startActivity(context, share);
} }
@Override @Override
@ -3099,7 +3100,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Intent send = new Intent(Intent.ACTION_SEND); Intent send = new Intent(Intent.ACTION_SEND);
send.putExtra(Intent.EXTRA_STREAM, uri); send.putExtra(Intent.EXTRA_STREAM, uri);
send.setType("message/rfc822"); send.setType("message/rfc822");
context.startActivity(send); Helper.startActivity(context, send);
} }
ItemDetailsLookup.ItemDetails<Long> getItemDetails(@NonNull MotionEvent motionEvent) { ItemDetailsLookup.ItemDetails<Long> getItemDetails(@NonNull MotionEvent motionEvent) {
@ -4081,7 +4082,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (!ActivityBilling.isPro(getContext())) { if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;
} }
@ -4157,7 +4158,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (!ActivityBilling.isPro(getContext())) { if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;
} }

@ -64,14 +64,7 @@ public class FragmentBase extends Fragment {
@Override @Override
public void startActivity(Intent intent) { public void startActivity(Intent intent) {
try { Helper.startActivity(getContext(), intent);
if (Helper.hasAuthentication(getContext()))
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
super.startActivity(intent);
} catch (ActivityNotFoundException ex) {
Log.e(ex);
ToastEx.makeText(getContext(), getString(R.string.title_no_viewer, intent.getAction()), Toast.LENGTH_LONG).show();
}
} }
@Override @Override

@ -940,7 +940,7 @@ public class FragmentCompose extends FragmentBase {
private void onMenuAnswer() { private void onMenuAnswer() {
if (!ActivityBilling.isPro(getContext())) { if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;
} }
@ -1586,7 +1586,7 @@ public class FragmentCompose extends FragmentBase {
private void onSendAfter(long time) { private void onSendAfter(long time) {
if (!ActivityBilling.isPro(getContext())) { if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;
} }

@ -97,9 +97,7 @@ public class FragmentDialogEx extends DialogFragment {
@Override @Override
public void startActivity(Intent intent) { public void startActivity(Intent intent) {
if (Helper.hasAuthentication(getContext())) Helper.startActivity(getContext(), intent);
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
super.startActivity(intent);
} }
@Override @Override

@ -356,7 +356,7 @@ public class FragmentFolders extends FragmentBase {
snackbar.setAction(R.string.title_fix, new View.OnClickListener() { snackbar.setAction(R.string.title_fix, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
getContext().startActivity( startActivity(
new Intent(getContext(), ActivitySetup.class) new Intent(getContext(), ActivitySetup.class)
.putExtra("tab", "connection")); .putExtra("tab", "connection"));
} }

@ -396,7 +396,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
tvSupport.setOnClickListener(new View.OnClickListener() { tvSupport.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
} }
}); });
@ -1169,7 +1169,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
snackbar.setAction(R.string.title_fix, new View.OnClickListener() { snackbar.setAction(R.string.title_fix, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
getContext().startActivity( startActivity(
new Intent(getContext(), ActivitySetup.class) new Intent(getContext(), ActivitySetup.class)
.putExtra("tab", "connection")); .putExtra("tab", "connection"));
} }
@ -2900,7 +2900,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
snackbar.setAction(R.string.title_fix, new View.OnClickListener() { snackbar.setAction(R.string.title_fix, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
getContext().startActivity( startActivity(
new Intent(getContext(), ActivitySetup.class) new Intent(getContext(), ActivitySetup.class)
.putExtra("tab", "connection")); .putExtra("tab", "connection"));
} }
@ -3609,7 +3609,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
case REQUEST_MESSAGES_COLOR: case REQUEST_MESSAGES_COLOR:
if (resultCode == RESULT_OK && data != null) { if (resultCode == RESULT_OK && data != null) {
if (!ActivityBilling.isPro(getContext())) { if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;
} }
@ -4209,7 +4209,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private void onColor(long id, int color) { private void onColor(long id, int color) {
if (!ActivityBilling.isPro(getContext())) { if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;
} }
@ -4246,7 +4246,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private void onSnooze(Bundle args) { private void onSnooze(Bundle args) {
if (!ActivityBilling.isPro(getContext())) { if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;
} }
@ -4299,7 +4299,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private void onSnoozeSelection(Bundle args) { private void onSnoozeSelection(Bundle args) {
if (!ActivityBilling.isPro(getContext())) { if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;
} }
@ -4562,7 +4562,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
final Context context, final LifecycleOwner owner, final FragmentManager manager, final Context context, final LifecycleOwner owner, final FragmentManager manager,
long folder, boolean server, String query) { long folder, boolean server, String query) {
if (server && !ActivityBilling.isPro(context)) { if (server && !ActivityBilling.isPro(context)) {
context.startActivity(new Intent(context, ActivityBilling.class)); Helper.startActivity(context, new Intent(context, ActivityBilling.class));
return; return;
} }

@ -492,7 +492,7 @@ public class FragmentRule extends FragmentBase {
case REQUEST_COLOR: case REQUEST_COLOR:
if (resultCode == RESULT_OK && data != null) { if (resultCode == RESULT_OK && data != null) {
if (!ActivityBilling.isPro(getContext())) { if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;
} }
@ -771,7 +771,7 @@ public class FragmentRule extends FragmentBase {
private void onActionSave() { private void onActionSave() {
if (!ActivityBilling.isPro(getContext())) { if (!ActivityBilling.isPro(getContext())) {
getContext().startActivity(new Intent(getContext(), ActivityBilling.class)); startActivity(new Intent(getContext(), ActivityBilling.class));
return; return;
} }

@ -189,7 +189,7 @@ public class Helper {
if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme())) if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme()))
view(context, intent.getData(), false); view(context, intent.getData(), false);
else else
context.startActivity(intent); startActivity(context, intent);
} }
static void view(Context context, Uri uri, boolean browse) { static void view(Context context, Uri uri, boolean browse) {
@ -197,7 +197,7 @@ public class Helper {
if (browse || !hasCustomTabs(context, uri)) { if (browse || !hasCustomTabs(context, uri)) {
Intent view = new Intent(Intent.ACTION_VIEW, uri); Intent view = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(getChooser(context, view)); startActivity(context, getChooser(context, view));
} else { } else {
// https://developer.chrome.com/multidevice/android/customtabs // https://developer.chrome.com/multidevice/android/customtabs
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
@ -250,6 +250,17 @@ public class Helper {
return new Intent(Intent.ACTION_VIEW, Uri.parse(XDA_URI)); return new Intent(Intent.ACTION_VIEW, Uri.parse(XDA_URI));
} }
static void startActivity(Context context, Intent intent) {
try {
if (Helper.hasAuthentication(context))
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
context.startActivity(intent);
} catch (ActivityNotFoundException ex) {
Log.e(ex);
ToastEx.makeText(context, context.getString(R.string.title_no_viewer, intent.getAction()), Toast.LENGTH_LONG).show();
}
}
// Graphics // Graphics
static int dp2pixels(Context context, int dp) { static int dp2pixels(Context context, int dp) {
@ -495,9 +506,10 @@ public class Helper {
@Override @Override
protected void onExecuted(Bundle args, Long id) { protected void onExecuted(Bundle args, Long id) {
context.startActivity(new Intent(context, ActivityCompose.class) Helper.startActivity(context,
.putExtra("action", "edit") new Intent(context, ActivityCompose.class)
.putExtra("id", id)); .putExtra("action", "edit")
.putExtra("id", id));
} }
@Override @Override
@ -825,7 +837,7 @@ public class Helper {
tv.setOnClickListener(new View.OnClickListener() { tv.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
tv.getContext().startActivity(new Intent(tv.getContext(), ActivityBilling.class)); Helper.startActivity(tv.getContext(), new Intent(tv.getContext(), ActivityBilling.class));
} }
}); });
} }

Loading…
Cancel
Save