mirror of https://github.com/M66B/FairEmail.git
Prevent crash
This commit is contained in:
parent
1ac542eebe
commit
6e15db6004
|
@ -109,6 +109,7 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
|
|||
|
||||
static final String ACTION_EDIT_ACCOUNT = BuildConfig.APPLICATION_ID + ".EDIT_ACCOUNT";
|
||||
static final String ACTION_EDIT_IDENTITY = BuildConfig.APPLICATION_ID + ".EDIT_IDENTITY";
|
||||
static final String ACTION_SHOW_PRO = BuildConfig.APPLICATION_ID + ".SHOW_PRO";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -302,6 +303,7 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
|
|||
IntentFilter iff = new IntentFilter();
|
||||
iff.addAction(ACTION_EDIT_ACCOUNT);
|
||||
iff.addAction(ACTION_EDIT_IDENTITY);
|
||||
iff.addAction(ACTION_SHOW_PRO);
|
||||
lbm.registerReceiver(receiver, iff);
|
||||
}
|
||||
|
||||
|
@ -906,6 +908,15 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
|
|||
fragmentTransaction.commit();
|
||||
}
|
||||
|
||||
private void onShowPro(Intent intent) {
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
|
||||
getSupportFragmentManager().popBackStack("pro", FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
|
||||
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
|
||||
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
|
||||
BroadcastReceiver receiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
@ -913,6 +924,8 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
|
|||
onEditAccount(intent);
|
||||
else if (ACTION_EDIT_IDENTITY.equals(intent.getAction()))
|
||||
onEditIdentity(intent);
|
||||
else if (ACTION_SHOW_PRO.equals(intent.getAction()))
|
||||
onShowPro(intent);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ package eu.faircode.email;
|
|||
import android.app.Dialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.text.format.DateFormat;
|
||||
|
@ -38,7 +39,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -116,9 +117,8 @@ public class FragmentOptionsGeneral extends FragmentBase implements SharedPrefer
|
|||
ServiceSynchronize.reschedule(getContext());
|
||||
} else {
|
||||
swSchedule.setChecked(false);
|
||||
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
||||
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
|
||||
fragmentTransaction.commit();
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||
lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO));
|
||||
}
|
||||
} else {
|
||||
prefs.edit().putBoolean("schedule", false).apply();
|
||||
|
|
Loading…
Reference in New Issue