Loading app/src/main/AndroidManifest.xml +13 −6 Original line number Diff line number Diff line Loading @@ -19,11 +19,6 @@ <activity android:name=".MainActivity_" android:theme="@style/Theme.Cyanea.Light.DarkActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> Loading Loading @@ -72,7 +67,19 @@ <data android:scheme="content" /> <data android:mimeType="application/pdf" /> </intent-filter> </activity> <!-- About --> </activity> <!-- Alias to allow the user to hide the app from launcher --> <activity-alias android:name=".LauncherAlias" android:enabled="true" android:targetActivity=".MainActivity_"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity-alias> <activity android:name=".AboutActivity" android:label="About" Loading app/src/main/java/com/gsnathan/pdfviewer/SettingsActivity.java +24 −0 Original line number Diff line number Diff line package com.gsnathan.pdfviewer; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; Loading @@ -15,6 +16,10 @@ import android.view.MenuItem; import androidx.core.app.NavUtils; import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED; import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED; import static android.content.pm.PackageManager.DONT_KILL_APP; /** * A {@link PreferenceActivity} that presents a set of application settings. On * handset devices, settings are presented as a single list. On tablets, Loading Loading @@ -76,6 +81,25 @@ public class SettingsActivity extends AppCompatPreferenceActivity { } }); findPreference("show_in_launcher").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { try { setLauncherAliasState((boolean) newValue); return true; } catch (Exception ignored) { return false; } } }); } private void setLauncherAliasState(boolean enableAlias) { getPackageManager().setComponentEnabledSetting( new ComponentName(this, "com.gsnathan.pdfviewer.LauncherAlias"), enableAlias ? COMPONENT_ENABLED_STATE_ENABLED : COMPONENT_ENABLED_STATE_DISABLED, DONT_KILL_APP ); } private void setupActionBar() { Loading app/src/main/res/values/strings.xml +2 −1 Original line number Diff line number Diff line Loading @@ -112,5 +112,6 @@ <string name="reload">Reload PDF</string> <string name="reload_sum">In order to make changes, the PDF must be reloaded.</string> <string name="buttonLog">Continue</string> <string name="show_in_launcher">Show app in launcher</string> <string name="show_in_launcher_summary">You may need to restart your launcher for this option to take effect</string> </resources> No newline at end of file app/src/main/res/xml/preferences.xml +5 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,11 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <SwitchPreference android:defaultValue="true" android:title="@string/show_in_launcher" android:summary="@string/show_in_launcher_summary" android:key="show_in_launcher"/> <PreferenceCategory android:title="@string/qualitysettings"> Loading Loading
app/src/main/AndroidManifest.xml +13 −6 Original line number Diff line number Diff line Loading @@ -19,11 +19,6 @@ <activity android:name=".MainActivity_" android:theme="@style/Theme.Cyanea.Light.DarkActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> Loading Loading @@ -72,7 +67,19 @@ <data android:scheme="content" /> <data android:mimeType="application/pdf" /> </intent-filter> </activity> <!-- About --> </activity> <!-- Alias to allow the user to hide the app from launcher --> <activity-alias android:name=".LauncherAlias" android:enabled="true" android:targetActivity=".MainActivity_"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity-alias> <activity android:name=".AboutActivity" android:label="About" Loading
app/src/main/java/com/gsnathan/pdfviewer/SettingsActivity.java +24 −0 Original line number Diff line number Diff line package com.gsnathan.pdfviewer; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; Loading @@ -15,6 +16,10 @@ import android.view.MenuItem; import androidx.core.app.NavUtils; import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED; import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED; import static android.content.pm.PackageManager.DONT_KILL_APP; /** * A {@link PreferenceActivity} that presents a set of application settings. On * handset devices, settings are presented as a single list. On tablets, Loading Loading @@ -76,6 +81,25 @@ public class SettingsActivity extends AppCompatPreferenceActivity { } }); findPreference("show_in_launcher").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { try { setLauncherAliasState((boolean) newValue); return true; } catch (Exception ignored) { return false; } } }); } private void setLauncherAliasState(boolean enableAlias) { getPackageManager().setComponentEnabledSetting( new ComponentName(this, "com.gsnathan.pdfviewer.LauncherAlias"), enableAlias ? COMPONENT_ENABLED_STATE_ENABLED : COMPONENT_ENABLED_STATE_DISABLED, DONT_KILL_APP ); } private void setupActionBar() { Loading
app/src/main/res/values/strings.xml +2 −1 Original line number Diff line number Diff line Loading @@ -112,5 +112,6 @@ <string name="reload">Reload PDF</string> <string name="reload_sum">In order to make changes, the PDF must be reloaded.</string> <string name="buttonLog">Continue</string> <string name="show_in_launcher">Show app in launcher</string> <string name="show_in_launcher_summary">You may need to restart your launcher for this option to take effect</string> </resources> No newline at end of file
app/src/main/res/xml/preferences.xml +5 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,11 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <SwitchPreference android:defaultValue="true" android:title="@string/show_in_launcher" android:summary="@string/show_in_launcher_summary" android:key="show_in_launcher"/> <PreferenceCategory android:title="@string/qualitysettings"> Loading