use of android.appwidget.AppWidgetHostView in project Neo-Launcher by NeoApplications.
the class SecondaryDropTarget method supportsAccessibilityDrop.
@Override
public boolean supportsAccessibilityDrop(ItemInfo info, View view) {
if (view instanceof AppWidgetHostView) {
if (getReconfigurableWidgetId(view) != INVALID_APPWIDGET_ID) {
setupUi(RECONFIGURE);
return true;
} else if (getWidgetCustomizeIntent(view) != null) {
setupUi(CUSTOMIZE);
return true;
}
return false;
}
setupUi(UNINSTALL);
Boolean uninstallDisabled = mUninstallDisabledCache.get(info.user);
if (uninstallDisabled == null) {
UserManager userManager = (UserManager) getContext().getSystemService(Context.USER_SERVICE);
Bundle restrictions = userManager.getUserRestrictions(info.user);
uninstallDisabled = restrictions.getBoolean(UserManager.DISALLOW_APPS_CONTROL, false) || restrictions.getBoolean(UserManager.DISALLOW_UNINSTALL_APPS, false);
mUninstallDisabledCache.put(info.user, uninstallDisabled);
}
// Cancel any pending alarm and set cache expiry after some time
mCacheExpireAlarm.setAlarm(CACHE_EXPIRE_TIMEOUT);
if (uninstallDisabled) {
return false;
}
if (info instanceof ItemInfoWithIcon) {
ItemInfoWithIcon iconInfo = (ItemInfoWithIcon) info;
if ((iconInfo.runtimeStatusFlags & FLAG_SYSTEM_MASK) != 0) {
return (iconInfo.runtimeStatusFlags & FLAG_SYSTEM_NO) != 0;
}
}
return getUninstallTarget(info) != null;
}
use of android.appwidget.AppWidgetHostView in project Neo-Launcher by NeoApplications.
the class SecondaryDropTarget method getReconfigurableWidgetId.
/**
* Verifies that the view is an reconfigurable widget and returns the corresponding widget Id,
* otherwise return {@code INVALID_APPWIDGET_ID}
*/
private int getReconfigurableWidgetId(View view) {
if (!(view instanceof AppWidgetHostView)) {
return INVALID_APPWIDGET_ID;
}
AppWidgetHostView hostView = (AppWidgetHostView) view;
AppWidgetProviderInfo widgetInfo = hostView.getAppWidgetInfo();
if (widgetInfo == null || widgetInfo.configure == null) {
return INVALID_APPWIDGET_ID;
}
if ((LauncherAppWidgetProviderInfo.fromProviderInfo(getContext(), widgetInfo).getWidgetFeatures() & WIDGET_FEATURE_RECONFIGURABLE) == 0) {
return INVALID_APPWIDGET_ID;
}
return hostView.getAppWidgetId();
}
Aggregations