use of fr.neamar.kiss.dataprovider.AppProvider in project KISS by Neamar.
the class LocaleChangedReceiver method onReceive.
@Override
public void onReceive(Context ctx, Intent intent) {
// If new locale, then reset tags to load the correct aliases
KissApplication.getDataHandler(ctx).resetTagsHandler();
// Reload application list
final AppProvider provider = KissApplication.getDataHandler(ctx).getAppProvider();
if (provider != null) {
provider.reload();
}
}
use of fr.neamar.kiss.dataprovider.AppProvider in project KISS by Neamar.
the class SettingsActivity method onSharedPreferenceChanged.
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equalsIgnoreCase("icons-pack")) {
KissApplication.getIconsHandler(this).loadIconsPack(sharedPreferences.getString(key, "default"));
}
if (key.equalsIgnoreCase("sort-apps")) {
// Reload application list
final AppProvider provider = KissApplication.getDataHandler(this).getAppProvider();
if (provider != null) {
provider.reload();
}
}
if (requireRestartSettings.contains(key)) {
requireFullRestart = true;
}
if (requireInstantRestart.contains(key)) {
requireFullRestart = true;
finish();
return;
}
if ("enable-sms-history".equals(key) || "enable-phone-history".equals(key)) {
if ("enable-sms-history".equals(key)) {
PackageManagerUtils.enableComponent(this, IncomingSmsHandler.class, sharedPreferences.getBoolean(key, false));
} else {
PackageManagerUtils.enableComponent(this, IncomingCallHandler.class, sharedPreferences.getBoolean(key, false));
}
}
}
use of fr.neamar.kiss.dataprovider.AppProvider in project KISS by Neamar.
the class PackageAddedRemovedHandler method handleEvent.
public static void handleEvent(Context ctx, String action, String packageName, UserHandle user, boolean replacing) {
if (PreferenceManager.getDefaultSharedPreferences(ctx).getBoolean("enable-app-history", true)) {
// Insert into history new packages (not updated ones)
if ("android.intent.action.PACKAGE_ADDED".equals(action) && !replacing) {
// Add new package to history
Intent launchIntent = ctx.getPackageManager().getLaunchIntentForPackage(packageName);
if (launchIntent == null) {
//for some plugin app
return;
}
String className = launchIntent.getComponent().getClassName();
if (className != null) {
String pojoID = user.addUserSuffixToString("app://" + packageName + "/" + className, '/');
KissApplication.getDataHandler(ctx).addToHistory(pojoID);
}
}
}
if ("android.intent.action.PACKAGE_REMOVED".equals(action) && !replacing) {
// Removed all installed shortcuts
KissApplication.getDataHandler(ctx).removeShortcuts(packageName);
KissApplication.getDataHandler(ctx).removeFromExcluded(packageName, user);
}
KissApplication.resetIconsHandler(ctx);
// Reload application list
final AppProvider provider = KissApplication.getDataHandler(ctx).getAppProvider();
if (provider != null) {
provider.reload();
}
}
use of fr.neamar.kiss.dataprovider.AppProvider in project KISS by Neamar.
the class MainActivity method onResume.
/**
* Restart if required,
* Hide the kissbar by default
*/
@SuppressLint("CommitPrefEdits")
protected void onResume() {
Log.i(TAG, "Resuming KISS");
if (prefs.getBoolean("require-layout-update", false)) {
super.onResume();
Log.i(TAG, "Restarting app after setting changes");
// Restart current activity to refresh view, since some preferences
// may require using a new UI
prefs.edit().putBoolean("require-layout-update", false).apply();
this.recreate();
return;
}
if (kissBar.getVisibility() != View.VISIBLE) {
updateRecords(searchEditText.getText().toString());
displayClearOnInput();
} else {
displayKissBar(false);
}
//Show favorites above search field ONLY if AppProvider is already loaded
//Otherwise this will get triggered by the broadcastreceiver in the onCreate
AppProvider appProvider = KissApplication.getDataHandler(this).getAppProvider();
if (appProvider != null && appProvider.isLoaded())
// Favorites needs to be displayed again if the quickfavorite bar is active,
// Not sure why exactly, but without the "true" the favorites drawable will disappear
// (not their intent) after moving to another activity and switching back to KISS.
displayQuickFavoritesBar(true, searchEditText.getText().toString().length() > 0);
// we may want to display it if the setting is set
if (prefs.getBoolean("display-keyboard", false)) {
// Display keyboard
showKeyboard();
new Handler().postDelayed(displayKeyboardRunnable, 10);
// For some weird reasons, keyboard may be hidden by the system
// So we have to run this multiple time at different time
// See https://github.com/Neamar/KISS/issues/119
new Handler().postDelayed(displayKeyboardRunnable, 100);
new Handler().postDelayed(displayKeyboardRunnable, 500);
} else {
// Not used (thanks windowSoftInputMode)
// unless coming back from KISS settings
hideKeyboard();
}
super.onResume();
}
Aggregations