Revert "Always exclude from recents"

This reverts commit f7b1f3348a.
This commit is contained in:
M66B 2019-09-09 14:58:31 +02:00
parent f7b1f3348a
commit 93e20b7228
14 changed files with 64 additions and 62 deletions

View File

@ -199,7 +199,14 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
@Override
public void startActivity(Intent intent) {
Helper.startActivity(this, intent);
try {
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -64,7 +64,14 @@ public class FragmentBase extends Fragment {
@Override
public void startActivity(Intent intent) {
Helper.startActivity(getContext(), intent);
try {
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -189,7 +189,7 @@ public class Helper {
if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme()))
view(context, intent.getData(), false);
else
startActivity(context, intent);
context.startActivity(intent);
}
static void view(Context context, Uri uri, boolean browse) {
@ -197,7 +197,7 @@ public class Helper {
if (browse || !hasCustomTabs(context, uri)) {
Intent view = new Intent(Intent.ACTION_VIEW, uri);
startActivity(context, getChooser(context, view));
context.startActivity(getChooser(context, view));
} else {
// https://developer.chrome.com/multidevice/android/customtabs
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
@ -250,17 +250,6 @@ public class Helper {
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
static int dp2pixels(Context context, int dp) {
@ -506,10 +495,9 @@ public class Helper {
@Override
protected void onExecuted(Bundle args, Long id) {
Helper.startActivity(context,
new Intent(context, ActivityCompose.class)
.putExtra("action", "edit")
.putExtra("id", id));
context.startActivity(new Intent(context, ActivityCompose.class)
.putExtra("action", "edit")
.putExtra("id", id));
}
@Override
@ -837,7 +825,7 @@ public class Helper {
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Helper.startActivity(tv.getContext(), new Intent(tv.getContext(), ActivityBilling.class));
tv.getContext().startActivity(new Intent(tv.getContext(), ActivityBilling.class));
}
});
}