use of com.android.launcher3.userevent.nano.LauncherLogProto.Action in project android_packages_apps_Launcher3 by crdroidandroid.
the class DragLayer method onInterceptHoverEvent.
@Override
public boolean onInterceptHoverEvent(MotionEvent ev) {
if (mActivity == null || mActivity.getWorkspace() == null) {
return false;
}
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
if (!(topView instanceof Folder)) {
return false;
} else {
AccessibilityManager accessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
if (accessibilityManager.isTouchExplorationEnabled()) {
Folder currentFolder = (Folder) topView;
final int action = ev.getAction();
boolean isOverFolderOrSearchBar;
switch(action) {
case MotionEvent.ACTION_HOVER_ENTER:
isOverFolderOrSearchBar = isEventOverView(topView, ev) || isEventOverAccessibleDropTargetBar(ev);
if (!isOverFolderOrSearchBar) {
sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
mHoverPointClosesFolder = true;
return true;
}
mHoverPointClosesFolder = false;
break;
case MotionEvent.ACTION_HOVER_MOVE:
isOverFolderOrSearchBar = isEventOverView(topView, ev) || isEventOverAccessibleDropTargetBar(ev);
if (!isOverFolderOrSearchBar && !mHoverPointClosesFolder) {
sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
mHoverPointClosesFolder = true;
return true;
} else if (!isOverFolderOrSearchBar) {
return true;
}
mHoverPointClosesFolder = false;
}
}
}
return false;
}
use of com.android.launcher3.userevent.nano.LauncherLogProto.Action in project android_packages_apps_Launcher3 by crdroidandroid.
the class LauncherAccessibilityDelegate method performResizeAction.
private boolean performResizeAction(int action, View host, LauncherAppWidgetInfo info) {
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams();
CellLayout layout = (CellLayout) host.getParent().getParent();
layout.markCellsAsUnoccupiedForView(host);
if (action == R.string.action_increase_width) {
if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) && layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY)) || !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) {
lp.cellX--;
info.cellX--;
}
lp.cellHSpan++;
info.spanX++;
} else if (action == R.string.action_decrease_width) {
lp.cellHSpan--;
info.spanX--;
} else if (action == R.string.action_increase_height) {
if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) {
lp.cellY--;
info.cellY--;
}
lp.cellVSpan++;
info.spanY++;
} else if (action == R.string.action_decrease_height) {
lp.cellVSpan--;
info.spanY--;
}
layout.markCellsAsOccupiedForView(host);
WidgetSizes.updateWidgetSizeRanges(((LauncherAppWidgetHostView) host), mLauncher, info.spanX, info.spanY);
host.requestLayout();
mLauncher.getModelWriter().updateItemInDatabase(info);
announceConfirmation(mLauncher.getString(R.string.widget_resized, info.spanX, info.spanY));
return true;
}
use of com.android.launcher3.userevent.nano.LauncherLogProto.Action in project android_packages_apps_Launcher3 by crdroidandroid.
the class AllAppsStore method updateAllIcons.
private void updateAllIcons(Consumer<BubbleTextView> action) {
for (int i = mIconContainers.size() - 1; i >= 0; i--) {
ViewGroup parent = mIconContainers.get(i);
int childCount = parent.getChildCount();
for (int j = 0; j < childCount; j++) {
View child = parent.getChildAt(j);
if (child instanceof BubbleTextView) {
action.accept((BubbleTextView) child);
}
}
}
}
use of com.android.launcher3.userevent.nano.LauncherLogProto.Action in project android_packages_apps_Launcher3 by crdroidandroid.
the class DeveloperOptionsFragment method loadPluginPrefs.
private void loadPluginPrefs() {
if (mPluginsCategory != null) {
mPreferenceScreen.removePreference(mPluginsCategory);
}
if (!PluginManagerWrapper.hasPlugins(getActivity())) {
mPluginsCategory = null;
return;
}
mPluginsCategory = newCategory("Plugins");
PluginManagerWrapper manager = PluginManagerWrapper.INSTANCE.get(getContext());
Context prefContext = getContext();
PackageManager pm = getContext().getPackageManager();
Set<String> pluginActions = manager.getPluginActions();
ArrayMap<Pair<String, String>, ArrayList<Pair<String, ResolveInfo>>> plugins = new ArrayMap<>();
Set<String> pluginPermissionApps = pm.getPackagesHoldingPermissions(new String[] { PLUGIN_PERMISSION }, MATCH_DISABLED_COMPONENTS).stream().map(pi -> pi.packageName).collect(Collectors.toSet());
for (String action : pluginActions) {
String name = toName(action);
List<ResolveInfo> result = pm.queryIntentServices(new Intent(action), MATCH_DISABLED_COMPONENTS | GET_RESOLVED_FILTER);
for (ResolveInfo info : result) {
String packageName = info.serviceInfo.packageName;
if (!pluginPermissionApps.contains(packageName)) {
continue;
}
Pair<String, String> key = Pair.create(packageName, info.serviceInfo.processName);
if (!plugins.containsKey(key)) {
plugins.put(key, new ArrayList<>());
}
plugins.get(key).add(Pair.create(name, info));
}
}
PreferenceDataStore enabler = manager.getPluginEnabler();
plugins.forEach((key, si) -> {
String packageName = key.first;
List<ComponentName> componentNames = si.stream().map(p -> new ComponentName(packageName, p.second.serviceInfo.name)).collect(Collectors.toList());
if (!componentNames.isEmpty()) {
SwitchPreference pref = new PluginPreference(prefContext, si.get(0).second, enabler, componentNames);
pref.setSummary("Plugins: " + si.stream().map(p -> p.first).collect(Collectors.joining(", ")));
mPluginsCategory.addPreference(pref);
}
});
}
use of com.android.launcher3.userevent.nano.LauncherLogProto.Action in project android_packages_apps_Launcher3 by crdroidandroid.
the class StartLauncherViaGestureTests method runTest.
private void runTest(String... eventSequence) {
final RaceConditionReproducer eventProcessor = new RaceConditionReproducer(eventSequence);
// Destroy Launcher activity.
closeLauncherActivity();
// The test action.
eventProcessor.startIteration();
mLauncher.pressHome();
eventProcessor.finishIteration();
}
Aggregations