Added VPN list button

master
M66B 1 month ago
parent a5ac560154
commit 01b27ad143

@ -22,8 +22,12 @@ package eu.faircode.email;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.text.SpannableStringBuilder;
import android.text.style.RelativeSizeSpan;
@ -45,7 +49,7 @@ public class FragmentDialogVPN extends FragmentDialogBase {
ssb.append(context.getString(R.string.title_hint_dismiss));
ssb.setSpan(new RelativeSizeSpan(HtmlHelper.FONT_SMALL), start, ssb.length(), 0);
return new AlertDialog.Builder(context)
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setIcon(R.drawable.twotone_vpn_key_24)
.setTitle(R.string.title_hint_vpn_active)
.setMessage(ssb)
@ -56,7 +60,20 @@ public class FragmentDialogVPN extends FragmentDialogBase {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
prefs.edit().putBoolean("vpn_reminder", false).apply();
}
})
.create();
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
PackageManager pm = context.getPackageManager();
Intent intent = new Intent(Settings.ACTION_VPN_SETTINGS);
if (intent.resolveActivity(pm) != null)
builder.setNeutralButton(R.string.title_hint_vpn_settings, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startActivity(intent);
}
});
}
return builder.create();
}
}

@ -2377,6 +2377,7 @@
<string name="title_hint_folder_sync">To limit battery and network usage not all folders and not all messages will be synchronized by default</string>
<string name="title_hint_airplane">Airplane mode is on</string>
<string name="title_hint_vpn_active">VPN active</string>
<string name="title_hint_vpn_settings">VPN list</string>
<string name="title_hint_notifications">No notification permissions</string>
<string name="title_hint_notifications_remark">Notification permissions are required for (account) alerts too. Notifications for new messages can be turned off in the settings.</string>
<string name="title_hint_battery_optimizations">Battery optimizations still enabled</string>

Loading…
Cancel
Save