use of com.saggitt.omega.predictions.AppTargetCompat in project Neo-Launcher by NeoApplications.
the class PredictionAppTracker method onStartApp.
@Override
@UiThread
public void onStartApp(ComponentName cn, UserHandle user, String container) {
if (cn != null) {
AppTargetCompat target = new AppTargetCompat.Builder(new AppTargetIdCompat("app:" + cn), cn.getPackageName(), user).setClassName(cn.getClassName()).build();
sendLaunch(target, container);
// Relay onStartApp to every connected plugin.
mAppLaunchEventsPluginsList.forEach(plugin -> plugin.onStartApp(cn, user, container != null ? container : CONTAINER_DEFAULT));
}
}
use of com.saggitt.omega.predictions.AppTargetCompat in project Neo-Launcher by NeoApplications.
the class PredictionUiStateManager method parseLastState.
private PredictionState parseLastState() {
PredictionState state = new PredictionState();
state.isEnabled = mGettingValidPredictionResults;
if (!state.isEnabled) {
state.apps = Collections.EMPTY_LIST;
return state;
}
state.apps = new ArrayList<>();
List<AppTargetCompat> appTargets = mPredictionServicePredictions[mActiveClient.ordinal()];
if (!appTargets.isEmpty()) {
for (AppTargetCompat appTarget : appTargets) {
ComponentKey key;
if (appTarget.getShortcutInfo() != null) {
key = ShortcutKey.fromInfo(appTarget.getShortcutInfo());
} else {
key = new ComponentKey(new ComponentName(appTarget.getPackageName(), appTarget.getClassName()), appTarget.getUser());
}
state.apps.add(new ComponentKeyMapper(mContext, key, mDynamicItemCache));
}
}
updateDependencies(state);
return state;
}
use of com.saggitt.omega.predictions.AppTargetCompat in project Neo-Launcher by NeoApplications.
the class PredictionAppTracker method onDismissApp.
@Override
@UiThread
public void onDismissApp(ComponentName cn, UserHandle user, String container) {
if (cn == null)
return;
AppTargetCompat target = new AppTargetCompat.Builder(new AppTargetIdCompat("app: " + cn), cn.getPackageName(), user).setClassName(cn.getClassName()).build();
sendDismiss(target, container);
// Relay onDismissApp to every connected plugin.
mAppLaunchEventsPluginsList.forEach(plugin -> plugin.onDismissApp(cn, user, container != null ? container : CONTAINER_DEFAULT));
}
use of com.saggitt.omega.predictions.AppTargetCompat in project Neo-Launcher by NeoApplications.
the class PredictionAppTracker method onStartShortcut.
@Override
@UiThread
public void onStartShortcut(String packageName, String shortcutId, UserHandle user, String container) {
// TODO: Use the full shortcut info
AppTargetCompat target = new AppTargetCompat.Builder(new AppTargetIdCompat("shortcut:" + shortcutId), packageName, user).setClassName(shortcutId).build();
sendLaunch(target, container);
// Relay onStartShortcut info to every connected plugin.
mAppLaunchEventsPluginsList.forEach(plugin -> plugin.onStartShortcut(packageName, shortcutId, user, container != null ? container : CONTAINER_DEFAULT));
}
Aggregations