Back to safety!

pull/194/merge
M66B 3 years ago
parent 6447c83a24
commit 547449b38b

@ -156,7 +156,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
static final String ACTION_MANAGE_LOCAL_CONTACTS = BuildConfig.APPLICATION_ID + ".MANAGE_LOCAL_CONTACTS";
static final String ACTION_MANAGE_CERTIFICATES = BuildConfig.APPLICATION_ID + ".MANAGE_CERTIFICATES";
static final String ACTION_IMPORT_CERTIFICATE = BuildConfig.APPLICATION_ID + ".IMPORT_CERTIFICATE";
static final String ACTION_SETUP_ADVANCED = BuildConfig.APPLICATION_ID + ".SETUP_ADVANCED";
static final String ACTION_SETUP_MORE = BuildConfig.APPLICATION_ID + ".SETUP_MORE";
@Override
@ -389,7 +388,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
iff.addAction(ACTION_MANAGE_LOCAL_CONTACTS);
iff.addAction(ACTION_MANAGE_CERTIFICATES);
iff.addAction(ACTION_IMPORT_CERTIFICATE);
iff.addAction(ACTION_SETUP_ADVANCED);
iff.addAction(ACTION_SETUP_MORE);
lbm.registerReceiver(receiver, iff);
}
@ -1618,14 +1616,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
startActivityForResult(Helper.getChooser(this, open), REQUEST_IMPORT_CERTIFICATE);
}
private void onSetupAdvanced(Intent intent) {
View dview = LayoutInflater.from(this).inflate(R.layout.dialog_advanced, null);
new AlertDialog.Builder(this)
.setView(dview)
.setPositiveButton(android.R.string.ok, null)
.show();
}
private void onSetupMore(Intent intent) {
drawerLayout.openDrawer(GravityCompat.START);
}
@ -1796,8 +1786,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
onManageCertificates(intent);
else if (ACTION_IMPORT_CERTIFICATE.equals(action))
onImportCertificate(intent);
else if (ACTION_SETUP_ADVANCED.equals(action))
onSetupAdvanced(intent);
else if (ACTION_SETUP_MORE.equals(action))
onSetupMore(intent);
}

@ -21,6 +21,7 @@ package eu.faircode.email;
import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@ -53,7 +54,6 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.lifecycle.Lifecycle;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager;
import androidx.viewpager.widget.ViewPager;
@ -176,12 +176,28 @@ public class FragmentOptions extends FragmentBase {
@Override
public void onPageSelected(int position) {
if (position > 0) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
final Context context = getContext();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean setup_advanced = prefs.getBoolean("setup_advanced", false);
if (!setup_advanced) {
prefs.edit().putBoolean("setup_advanced", true).apply();
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_SETUP_ADVANCED));
View dview = LayoutInflater.from(context).inflate(R.layout.dialog_advanced, null);
new AlertDialog.Builder(context)
.setView(dview)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
prefs.edit().putBoolean("setup_advanced", true).apply();
}
})
.setNegativeButton(android.R.string.cancel, null)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (!prefs.getBoolean("setup_advanced", false))
pager.setCurrentItem(0);
}
})
.show();
}
}
}
@ -205,7 +221,6 @@ public class FragmentOptions extends FragmentBase {
return true;
} else
return false;
}
});

@ -16,7 +16,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:drawableStart="@drawable/twotone_info_24"
android:drawableStart="@drawable/twotone_warning_24"
android:drawablePadding="6dp"
android:text="@string/title_advanced_hint_title"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"

Loading…
Cancel
Save