Added option to browse links when confirming links is disabled

pull/178/head
M66B 5 years ago
parent 173260b2c9
commit 0dc8419952

@ -3731,8 +3731,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
FragmentDialogLink fragment = new FragmentDialogLink();
fragment.setArguments(args);
fragment.show(parentFragment.getParentFragmentManager(), "open:link");
} else
Helper.view(context, uri, false);
} else {
boolean browse_links = prefs.getBoolean("browse_links", false);
Helper.view(context, uri, browse_links);
}
}
return true;

@ -56,6 +56,7 @@ import androidx.preference.PreferenceManager;
public class FragmentOptionsPrivacy extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private SwitchCompat swConfirmLinks;
private SwitchCompat swBrowseLinks;
private SwitchCompat swConfirmImages;
private SwitchCompat swConfirmHtml;
private SwitchCompat swDisableTracking;
@ -70,7 +71,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
private Group grpSafeBrowsing;
private final static String[] RESET_OPTIONS = new String[]{
"confirm_links", "confirm_images", "confirm_html", "disable_tracking",
"confirm_links", "browse_links", "confirm_images", "confirm_html", "disable_tracking",
"biometrics", "pin", "biometrics_timeout",
"display_hidden", "secure", "safe_browsing"
};
@ -87,6 +88,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
// Get controls
swConfirmLinks = view.findViewById(R.id.swConfirmLinks);
swBrowseLinks = view.findViewById(R.id.swBrowseLinks);
swConfirmImages = view.findViewById(R.id.swConfirmImages);
swConfirmHtml = view.findViewById(R.id.swConfirmHtml);
swDisableTracking = view.findViewById(R.id.swDisableTracking);
@ -110,6 +112,14 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("confirm_links", checked).apply();
swBrowseLinks.setEnabled(!checked);
}
});
swBrowseLinks.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("browse_links", checked).apply();
}
});
@ -263,6 +273,8 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
swConfirmLinks.setChecked(prefs.getBoolean("confirm_links", true));
swBrowseLinks.setChecked(prefs.getBoolean("browse_links", false));
swBrowseLinks.setEnabled(!swConfirmLinks.isChecked());
swConfirmImages.setChecked(prefs.getBoolean("confirm_images", true));
swConfirmHtml.setChecked(prefs.getBoolean("confirm_html", true));
swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true));

@ -53,6 +53,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swConfirmLinks" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBrowseLinks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_browse_links"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvConfirmLinksHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swConfirmImages"
android:layout_width="0dp"
@ -62,7 +73,7 @@
android:text="@string/title_advanced_confirm_images"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvConfirmLinksHint"
app:layout_constraintTop_toBottomOf="@+id/swBrowseLinks"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

@ -409,6 +409,7 @@
<string name="title_advanced_caption_smime" translatable="false">S/MIME</string>
<string name="title_advanced_confirm_links">Confirm opening links</string>
<string name="title_advanced_browse_links">Delegate opening links to Android</string>
<string name="title_advanced_confirm_images">Confirm showing images</string>
<string name="title_advanced_confirm_html">Show reformatted messages by default</string>
<string name="title_advanced_tracking">Automatically recognize and disable tracking images</string>

Loading…
Cancel
Save