mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 01:36:55 +00:00
Fixed message view unexpectedly closing
This commit is contained in:
parent
10b5e4ab25
commit
818541bd38
1 changed files with 81 additions and 72 deletions
|
@ -35,6 +35,7 @@ import android.net.NetworkCapabilities;
|
|||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
|
@ -325,6 +326,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
if (savedInstanceState != null)
|
||||
drawerToggle.setDrawerIndicatorEnabled(savedInstanceState.getBoolean("toggle"));
|
||||
|
||||
new Handler().post(checkIntent);
|
||||
|
||||
checkFirst();
|
||||
checkCrash();
|
||||
if (!Helper.isPlayStoreInstall(this))
|
||||
|
@ -334,44 +337,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
pgpService.bindToService();
|
||||
}
|
||||
|
||||
private Runnable checkIntent = new Runnable() {
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean("toggle", drawerToggle.isDrawerIndicatorEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
drawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
||||
IntentFilter iff = new IntentFilter();
|
||||
iff.addAction(ACTION_VIEW_MESSAGES);
|
||||
iff.addAction(ACTION_VIEW_THREAD);
|
||||
iff.addAction(ACTION_VIEW_FULL);
|
||||
iff.addAction(ACTION_EDIT_FOLDER);
|
||||
iff.addAction(ACTION_EDIT_ANSWER);
|
||||
iff.addAction(ACTION_STORE_ATTACHMENT);
|
||||
iff.addAction(ACTION_DECRYPT);
|
||||
iff.addAction(ACTION_SHOW_PRO);
|
||||
iff.addAction(ACTION_SHOW_LEGEND);
|
||||
lbm.registerReceiver(receiver, iff);
|
||||
|
||||
if (!pgpService.isBound())
|
||||
pgpService.bindToService();
|
||||
|
||||
public void run() {
|
||||
Intent intent = getIntent();
|
||||
String action = intent.getAction();
|
||||
Log.i(Helper.TAG, "View intent=" + intent + " action=" + action);
|
||||
|
@ -386,7 +354,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
onDebugInfo();
|
||||
|
||||
else if (action.startsWith("thread")) {
|
||||
ViewModelMessages model = ViewModelProviders.of(this).get(ViewModelMessages.class);
|
||||
ViewModelMessages model = ViewModelProviders.of(ActivityView.this).get(ViewModelMessages.class);
|
||||
model.setMessages(null);
|
||||
|
||||
intent.putExtra("thread", action.split(":", 2)[1]);
|
||||
|
@ -400,7 +368,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
intent.removeExtra(Intent.EXTRA_PROCESS_TEXT);
|
||||
setIntent(intent);
|
||||
|
||||
if (Helper.isPro(this)) {
|
||||
if (Helper.isPro(ActivityView.this)) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString("search", search);
|
||||
|
||||
|
@ -436,7 +404,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
protected void onException(Bundle args, Throwable ex) {
|
||||
Helper.unexpectedError(ActivityView.this, ActivityView.this, ex);
|
||||
}
|
||||
}.load(this, args);
|
||||
}.load(ActivityView.this, args);
|
||||
} else {
|
||||
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
|
||||
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
|
||||
|
@ -444,6 +412,47 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean("toggle", drawerToggle.isDrawerIndicatorEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
drawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
new Handler().post(checkIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this);
|
||||
IntentFilter iff = new IntentFilter();
|
||||
iff.addAction(ACTION_VIEW_MESSAGES);
|
||||
iff.addAction(ACTION_VIEW_THREAD);
|
||||
iff.addAction(ACTION_VIEW_FULL);
|
||||
iff.addAction(ACTION_EDIT_FOLDER);
|
||||
iff.addAction(ACTION_EDIT_ANSWER);
|
||||
iff.addAction(ACTION_STORE_ATTACHMENT);
|
||||
iff.addAction(ACTION_DECRYPT);
|
||||
iff.addAction(ACTION_SHOW_PRO);
|
||||
iff.addAction(ACTION_SHOW_LEGEND);
|
||||
lbm.registerReceiver(receiver, iff);
|
||||
|
||||
if (!pgpService.isBound())
|
||||
pgpService.bindToService();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
|
|
Loading…
Reference in a new issue