Skip to content

Commit

Permalink
PROCESS_TEXT: link activity state to "open special documents" settings
Browse files Browse the repository at this point in the history
It's now disabled by default.
  • Loading branch information
ConcurrentCrab committed Dec 5, 2023
1 parent a1803fe commit 4f6a7e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@
android:label="@string/app_name"
android:exported="true"
android:targetActivity=".activity.DocumentActivity"
android:enabled="true">
android:enabled="false">

<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public <T extends GsContextUtils> T applySpecialLaunchersVisibility(final Contex
setLauncherActivityEnabled(context, OpenEditorQuickNoteActivity.class, extraLaunchersEnabled);
setLauncherActivityEnabled(context, OpenEditorTodoActivity.class, extraLaunchersEnabled);
setLauncherActivityEnabled(context, OpenShareIntoActivity.class, extraLaunchersEnabled);
setLauncherActivityEnabledFromString(context, "net.gsantner.markor.AliasDocumentProcessText", extraLaunchersEnabled);
return thisp();
}

Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,15 @@ public <T extends GsContextUtils> T setLauncherActivityEnabled(final Context con
return thisp();
}

public <T extends GsContextUtils> T setLauncherActivityEnabledFromString(final Context context, String activityClass, boolean enable) {
try {
ComponentName component = new ComponentName(context, activityClass);
context.getPackageManager().setComponentEnabledSetting(component, enable ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
} catch (Exception ignored) {
}
return thisp();
}

/**
* Try to create a new desktop shortcut on the launcher. Add permissions:
* <uses-permission android:name="android.permission.INSTALL_SHORTCUT" />
Expand Down

0 comments on commit 4f6a7e9

Please sign in to comment.