1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-22 15:55:57 +00:00

Select browser on confirmation

This commit is contained in:
M66B 2022-07-03 11:14:38 +02:00
parent 8ea89a918b
commit 90e8e4f13d

View file

@ -328,25 +328,6 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
}
});
spOpenWith.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Package pkg = (Package) parent.getAdapter().getItem(position);
prefs.edit()
.putString("open_with_pkg", pkg.name)
.putBoolean("open_with_tabs", pkg.tabs)
.apply();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
prefs.edit()
.remove("open_with_pkg")
.remove("open_with_tabs")
.apply();
}
});
View.OnClickListener onMore = new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -634,9 +615,18 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
@Override
public void onClick(DialogInterface dialog, int which) {
Uri uri = Uri.parse(etLink.getText().toString());
boolean tabs = prefs.getBoolean("open_with_tabs", true);
Package pkg = (Package) spOpenWith.getSelectedItem();
Log.i("Open link uri=" + uri + " with=" + pkg);
boolean tabs = (pkg != null && pkg.tabs);
if (pkg != null) {
tabs = pkg.tabs;
prefs.edit()
.putString("open_with_pkg", pkg.name)
.putBoolean("open_with_tabs", pkg.tabs)
.apply();
}
Helper.view(context, uri, !tabs, !tabs);
}
})