Added enabled state to browser selection

pull/208/head
M66B 3 years ago
parent 38077ea9fe
commit f3ec913e8d

@ -551,7 +551,12 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
} }
if (icon != null) if (icon != null)
icon.setBounds(0, 0, dp24, dp24); icon.setBounds(0, 0, dp24, dp24);
pkgs.add(new Package(icon, label, ri.activityInfo.packageName, false)); pkgs.add(new Package(
icon,
label,
ri.activityInfo.packageName,
false,
ri.activityInfo.applicationInfo.enabled));
try { try {
Intent serviceIntent = new Intent(); Intent serviceIntent = new Intent();
@ -560,7 +565,12 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
boolean tabs = (pm.resolveService(serviceIntent, 0) != null); boolean tabs = (pm.resolveService(serviceIntent, 0) != null);
Log.i("Open with pkg=" + ri.activityInfo.packageName + " tabs=" + tabs); Log.i("Open with pkg=" + ri.activityInfo.packageName + " tabs=" + tabs);
if (tabs) if (tabs)
pkgs.add(new Package(icon, label, ri.activityInfo.packageName, true)); pkgs.add(new Package(
icon,
label,
ri.activityInfo.packageName,
true,
ri.activityInfo.applicationInfo.enabled));
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
} }
@ -714,12 +724,14 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
private CharSequence title; private CharSequence title;
private String name; private String name;
private boolean tabs; private boolean tabs;
private boolean enabled;
public Package(Drawable icon, CharSequence title, String name, boolean tabs) { public Package(Drawable icon, CharSequence title, String name, boolean tabs, boolean enabled) {
this.icon = icon; this.icon = icon;
this.title = title; this.title = title;
this.name = name; this.name = name;
this.tabs = tabs; this.tabs = tabs;
this.enabled = enabled;
} }
} }
@ -758,6 +770,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
Package pkg = pkgs.get(position); Package pkg = pkgs.get(position);
if (pkg != null) { if (pkg != null) {
view.setAlpha(pkg.enabled ? 1f : Helper.LOW_LIGHT);
text1.setText(pkg.title == null ? pkg.name : pkg.title.toString()); text1.setText(pkg.title == null ? pkg.name : pkg.title.toString());
text1.setCompoundDrawablesRelative( text1.setCompoundDrawablesRelative(
pkg.icon == null ? browser : pkg.icon, pkg.icon == null ? browser : pkg.icon,

Loading…
Cancel
Save