-
-
Notifications
You must be signed in to change notification settings - Fork 582
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2025 from LukeNeedham/exclude-shortcut-apps
Feature: User can select which apps can show shortcuts
- Loading branch information
Showing
11 changed files
with
306 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/src/main/java/fr/neamar/kiss/preference/ResetExcludedAppShortcutsPreference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package fr.neamar.kiss.preference; | ||
|
||
import android.content.Context; | ||
import android.content.DialogInterface; | ||
import android.preference.DialogPreference; | ||
import android.preference.PreferenceManager; | ||
import android.util.AttributeSet; | ||
import android.widget.Toast; | ||
|
||
import fr.neamar.kiss.DataHandler; | ||
import fr.neamar.kiss.KissApplication; | ||
import fr.neamar.kiss.R; | ||
|
||
public class ResetExcludedAppShortcutsPreference extends DialogPreference { | ||
|
||
public ResetExcludedAppShortcutsPreference(Context context) { | ||
super(context, null); | ||
} | ||
|
||
public ResetExcludedAppShortcutsPreference(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
@Override | ||
public void onClick(DialogInterface dialog, int which) { | ||
super.onClick(dialog, which); | ||
if (which == DialogInterface.BUTTON_POSITIVE) { | ||
PreferenceManager.getDefaultSharedPreferences(getContext()).edit() | ||
.putStringSet(DataHandler.PREF_KEY_EXCLUDED_SHORTCUT_APPS, null).apply(); | ||
DataHandler dataHandler = KissApplication.getApplication(getContext()).getDataHandler(); | ||
// Reload shortcuts to refresh the shortcuts shown in KISS | ||
dataHandler.reloadShortcuts(); | ||
// Reload apps since the `AppPojo.isExcludedShortcuts` value also needs to be refreshed | ||
dataHandler.reloadApps(); | ||
Toast.makeText(getContext(), R.string.excluded_app_list_erased, Toast.LENGTH_LONG).show(); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.