mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-23 22:51:02 +00:00
Prevent crash
This commit is contained in:
parent
1ac542eebe
commit
6e15db6004
2 changed files with 17 additions and 4 deletions
|
@ -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_ACCOUNT = BuildConfig.APPLICATION_ID + ".EDIT_ACCOUNT";
|
||||||
static final String ACTION_EDIT_IDENTITY = BuildConfig.APPLICATION_ID + ".EDIT_IDENTITY";
|
static final String ACTION_EDIT_IDENTITY = BuildConfig.APPLICATION_ID + ".EDIT_IDENTITY";
|
||||||
|
static final String ACTION_SHOW_PRO = BuildConfig.APPLICATION_ID + ".SHOW_PRO";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -302,6 +303,7 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
|
||||||
IntentFilter iff = new IntentFilter();
|
IntentFilter iff = new IntentFilter();
|
||||||
iff.addAction(ACTION_EDIT_ACCOUNT);
|
iff.addAction(ACTION_EDIT_ACCOUNT);
|
||||||
iff.addAction(ACTION_EDIT_IDENTITY);
|
iff.addAction(ACTION_EDIT_IDENTITY);
|
||||||
|
iff.addAction(ACTION_SHOW_PRO);
|
||||||
lbm.registerReceiver(receiver, iff);
|
lbm.registerReceiver(receiver, iff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -906,6 +908,15 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
|
||||||
fragmentTransaction.commit();
|
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() {
|
BroadcastReceiver receiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
@ -913,6 +924,8 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
|
||||||
onEditAccount(intent);
|
onEditAccount(intent);
|
||||||
else if (ACTION_EDIT_IDENTITY.equals(intent.getAction()))
|
else if (ACTION_EDIT_IDENTITY.equals(intent.getAction()))
|
||||||
onEditIdentity(intent);
|
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.Dialog;
|
||||||
import android.app.TimePickerDialog;
|
import android.app.TimePickerDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
|
@ -38,7 +39,7 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -116,9 +117,8 @@ public class FragmentOptionsGeneral extends FragmentBase implements SharedPrefer
|
||||||
ServiceSynchronize.reschedule(getContext());
|
ServiceSynchronize.reschedule(getContext());
|
||||||
} else {
|
} else {
|
||||||
swSchedule.setChecked(false);
|
swSchedule.setChecked(false);
|
||||||
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
||||||
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
|
lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_PRO));
|
||||||
fragmentTransaction.commit();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
prefs.edit().putBoolean("schedule", false).apply();
|
prefs.edit().putBoolean("schedule", false).apply();
|
||||||
|
|
Loading…
Reference in a new issue