Select browser on confirmation

pull/209/head
M66B 3 years ago
parent 8ea89a918b
commit 90e8e4f13d

@ -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);
}
})

Loading…
Cancel
Save