super.onLayout(changed, l, t, r, b);
if (!isDataReady()) {
- if ((LauncherAppState.isDisableAllApps() || !mApps.isEmpty()) && !mWidgets.isEmpty()) {
+ if ((!mApps.isEmpty()) && !mWidgets.isEmpty()) {
post(new Runnable() {
// This code triggers requestLayout so must be posted outside of the
// layout pass.
}
public void setApps(ArrayList<AppInfo> list) {
- if (!LauncherAppState.isDisableAllApps()) {
- mApps = list;
- Collections.sort(mApps, LauncherModel.getAppNameComparator());
- updatePageCountsAndInvalidateData();
- }
+ mApps = list;
+ Collections.sort(mApps, LauncherModel.getAppNameComparator());
+ updatePageCountsAndInvalidateData();
}
public ArrayList<AppInfo> getApps() {
}
}
public void addApps(ArrayList<AppInfo> list) {
- if (!LauncherAppState.isDisableAllApps()) {
- addAppsWithoutInvalidate(list);
- updatePageCountsAndInvalidateData();
- }
+ addAppsWithoutInvalidate(list);
+ updatePageCountsAndInvalidateData();
}
private int findAppByComponent(List<AppInfo> list, AppInfo item) {
ComponentName removeComponent = item.intent.getComponent();
}
}
public void removeApps(ArrayList<AppInfo> appInfos) {
- if (!LauncherAppState.isDisableAllApps()) {
- removeAppsWithoutInvalidate(appInfos);
- updatePageCountsAndInvalidateData();
- }
+ removeAppsWithoutInvalidate(appInfos);
+ updatePageCountsAndInvalidateData();
}
public void updateApps(ArrayList<AppInfo> list) {
// We remove and re-add the updated applications list because it's properties may have
// changed (ie. the title), and this will ensure that the items will be in their proper
// place in the list.
- if (!LauncherAppState.isDisableAllApps()) {
- removeAppsWithoutInvalidate(list);
- addAppsWithoutInvalidate(list);
- updatePageCountsAndInvalidateData();
- }
+ removeAppsWithoutInvalidate(list);
+ addAppsWithoutInvalidate(list);
+ updatePageCountsAndInvalidateData();
}
public void reset() {
return true;
}
- if (!LauncherAppState.isDisableAllApps() &&
- item.itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER) {
+ if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER) {
return true;
}
- if (!LauncherAppState.isDisableAllApps() &&
- item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION &&
+ if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION &&
item instanceof AppInfo) {
AppInfo appInfo = (AppInfo) info;
return (appInfo.flags & AppInfo.DOWNLOADED_FLAG) != 0;
if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION &&
item instanceof ShortcutInfo) {
- if (LauncherAppState.isDisableAllApps()) {
- ShortcutInfo shortcutInfo = (ShortcutInfo) info;
- return (shortcutInfo.flags & AppInfo.DOWNLOADED_FLAG) != 0;
- } else {
- return true;
- }
+ return true;
}
}
return false;
@Override
public void onDragStart(DragSource source, Object info, int dragAction) {
boolean isVisible = true;
- boolean useUninstallLabel = !LauncherAppState.isDisableAllApps() &&
- isAllAppsApplication(source, info);
+ boolean useUninstallLabel = isAllAppsApplication(source, info);
boolean useDeleteLabel = !useUninstallLabel && source.supportsDeleteDropTarget();
// If we are dragging an application from AppsCustomize, only show the control if we can
}
private boolean isUninstallFromWorkspace(DragObject d) {
- if (LauncherAppState.isDisableAllApps() && isDragSourceWorkspaceOrFolder(d)
- && (d.dragInfo instanceof ShortcutInfo)) {
- ShortcutInfo shortcut = (ShortcutInfo) d.dragInfo;
- // Only allow manifest shortcuts to initiate an un-install.
- return !InstallShortcutReceiver.isValidShortcutLaunchIntent(shortcut.intent);
- }
return false;
}
DeviceProfile(String n, float w, float h, float r, float c,
float is, float its, float hs, float his, int dlId) {
// Ensure that we have an odd number of hotseat items (since we need to place all apps)
- if (!LauncherAppState.isDisableAllApps() && hs % 2 == 0) {
+ if (hs % 2 == 0) {
throw new RuntimeException("All Device Profiles must have an odd number of hotseat spaces");
}
DisplayMetrics dm = resources.getDisplayMetrics();
ArrayList<DeviceProfile> deviceProfiles =
new ArrayList<DeviceProfile>();
- boolean hasAA = !LauncherAppState.isDisableAllApps();
DEFAULT_ICON_SIZE_PX = pxFromDp(DEFAULT_ICON_SIZE_DP, dm);
// Our phone profiles include the bar sizes in each orientation
deviceProfiles.add(new DeviceProfile("Super Short Stubby",
- 255, 300, 2, 3, 48, 13, (hasAA ? 3 : 5), 48, R.xml.default_workspace_4x4));
+ 255, 300, 2, 3, 48, 13, 3, 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Shorter Stubby",
- 255, 400, 3, 3, 48, 13, (hasAA ? 3 : 5), 48, R.xml.default_workspace_4x4));
+ 255, 400, 3, 3, 48, 13, 3, 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Short Stubby",
- 275, 420, 3, 4, 48, 13, (hasAA ? 5 : 5), 48, R.xml.default_workspace_4x4));
+ 275, 420, 3, 4, 48, 13, 5, 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Stubby",
- 255, 450, 3, 4, 48, 13, (hasAA ? 5 : 5), 48, R.xml.default_workspace_4x4));
+ 255, 450, 3, 4, 48, 13, 5, 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Nexus S",
- 296, 491.33f, 4, 4, 48, 13, (hasAA ? 5 : 5), 48, R.xml.default_workspace_4x4));
+ 296, 491.33f, 4, 4, 48, 13, 5, 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Nexus 4",
- 335, 567, 4, 4, DEFAULT_ICON_SIZE_DP, 13, (hasAA ? 5 : 5), 56, R.xml.default_workspace_4x4));
+ 335, 567, 4, 4, DEFAULT_ICON_SIZE_DP, 13, 5, 56, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Nexus 5",
- 359, 567, 4, 4, DEFAULT_ICON_SIZE_DP, 13, (hasAA ? 5 : 5), 56, R.xml.default_workspace_4x4));
+ 359, 567, 4, 4, DEFAULT_ICON_SIZE_DP, 13, 5, 56, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Large Phone",
406, 694, 5, 5, 64, 14.4f, 5, 56, R.xml.default_workspace_5x5));
// The tablet profile is odd in that the landscape orientation
Resources res = getResources();
mMaxCountX = (int) grid.numColumns;
- // Allow scrolling folders when DISABLE_ALL_APPS is true.
- if (LauncherAppState.isDisableAllApps()) {
- mMaxCountY = mMaxNumItems = Integer.MAX_VALUE;
- } else {
- mMaxCountY = (int) grid.numRows;
- mMaxNumItems = mMaxCountX * mMaxCountY;
- }
+ mMaxCountY = (int) grid.numRows;
+ mMaxNumItems = mMaxCountX * mMaxCountY;
mInputMethodManager = (InputMethodManager)
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
int contentAreaHeightSpec = MeasureSpec.makeMeasureSpec(getContentAreaHeight(),
MeasureSpec.EXACTLY);
- if (LauncherAppState.isDisableAllApps()) {
- // Don't cap the height of the content to allow scrolling.
- mContent.setFixedSize(getContentAreaWidth(), mContent.getDesiredHeight());
- } else {
- mContent.setFixedSize(getContentAreaWidth(), getContentAreaHeight());
- }
-
+ mContent.setFixedSize(getContentAreaWidth(), getContentAreaHeight());
mScrollView.measure(contentAreaWidthSpec, contentAreaHeightSpec);
mFolderName.measure(contentAreaWidthSpec,
MeasureSpec.makeMeasureSpec(mFolderNameHeight, MeasureSpec.EXACTLY));
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
-import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
-import java.util.ArrayList;
-
public class Hotseat extends FrameLayout {
private CellLayout mContent;
}
public int getAllAppsButtonRank() {
- if (LauncherAppState.isDisableAllApps()) {
- return -1;
- } else {
- return mAllAppsButtonRank;
- }
+ return mAllAppsButtonRank;
}
public boolean isAllAppsButtonRank(int rank) {
- if (LauncherAppState.isDisableAllApps()) {
- return false;
- } else {
- return rank == mAllAppsButtonRank;
- }
+ return rank == mAllAppsButtonRank;
}
/** This returns the coordinates of an app in a given cell, relative to the DragLayer */
void resetLayout() {
mContent.removeAllViewsInLayout();
- if (!LauncherAppState.isDisableAllApps()) {
- // Add the Apps button
- Context context = getContext();
-
- LayoutInflater inflater = LayoutInflater.from(context);
- TextView allAppsButton = (TextView)
- inflater.inflate(R.layout.all_apps_button, mContent, false);
- Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);
-
- Utilities.resizeIconDrawable(d);
- allAppsButton.setCompoundDrawables(null, d, null, null);
-
- allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
- allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener());
- if (mLauncher != null) {
- allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
- mLauncher.setAllAppsButton(allAppsButton);
- allAppsButton.setOnClickListener(mLauncher);
- allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler);
- }
-
- // Note: We do this to ensure that the hotseat is always laid out in the orientation of
- // the hotseat in order regardless of which orientation they were added
- int x = getCellXFromOrder(mAllAppsButtonRank);
- int y = getCellYFromOrder(mAllAppsButtonRank);
- CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1);
- lp.canReorder = false;
- mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
+ // Add the Apps button
+ Context context = getContext();
+
+ LayoutInflater inflater = LayoutInflater.from(context);
+ TextView allAppsButton = (TextView)
+ inflater.inflate(R.layout.all_apps_button, mContent, false);
+ Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);
+
+ Utilities.resizeIconDrawable(d);
+ allAppsButton.setCompoundDrawables(null, d, null, null);
+
+ allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
+ allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener());
+ if (mLauncher != null) {
+ allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
+ mLauncher.setAllAppsButton(allAppsButton);
+ allAppsButton.setOnClickListener(mLauncher);
+ allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler);
}
+
+ // Note: We do this to ensure that the hotseat is always laid out in the orientation of
+ // the hotseat in order regardless of which orientation they were added
+ int x = getCellXFromOrder(mAllAppsButtonRank);
+ int y = getCellYFromOrder(mAllAppsButtonRank);
+ CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1);
+ lp.canReorder = false;
+ mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
}
@Override
}
return false;
}
-
- void addAppsToAllAppsFolder(ArrayList<AppInfo> apps) {
- if (LauncherAppState.isDisableAllApps()) {
- View v = mContent.getChildAt(getCellXFromOrder(mAllAppsButtonRank), getCellYFromOrder(mAllAppsButtonRank));
- FolderIcon fi = null;
-
- if (v instanceof FolderIcon) {
- fi = (FolderIcon) v;
- } else {
- return;
- }
-
- FolderInfo info = fi.getFolderInfo();
- for (AppInfo a: apps) {
- ShortcutInfo si = a.makeShortcut();
- info.add(si);
- }
- }
- }
}
final PendingInstallShortcutInfo pendingInfo = iter.next();
final Intent intent = pendingInfo.launchIntent;
- if (LauncherAppState.isDisableAllApps() && !isValidShortcutLaunchIntent(intent)) {
- if (DBG) Log.d(TAG, "Ignoring shortcut with launchIntent:" + intent);
- continue;
- }
-
// If the intent specifies a package, make sure the package exists
String packageName = pendingInfo.getTargetPackage();
if (!TextUtils.isEmpty(packageName)) {
// To turn on these properties, type
// adb shell setprop log.tag.PROPERTY_NAME [VERBOSE | SUPPRESS]
static final String DUMP_STATE_PROPERTY = "launcher_dump_state";
- static final String DISABLE_ALL_APPS_PROPERTY = "launcher_noallapps";
// The Intent extra that defines whether to ignore the launch animation
static final String INTENT_EXTRA_IGNORE_LAUNCH_ANIMATION =
Workspace.State.OVERVIEW_HIDDEN : Workspace.State.NORMAL_HIDDEN;
Animator workspaceAnim =
mWorkspace.getChangeStateAnimation(workspaceState, animated, layerViews);
- if (!LauncherAppState.isDisableAllApps()
- || contentType == AppsCustomizePagedView.ContentType.Widgets) {
+ if (contentType == AppsCustomizePagedView.ContentType.Widgets) {
// Set the content type for the all apps/widgets space
mAppsCustomizeTabHost.setContentTypeImmediate(contentType);
}
// Remove the extra empty screen
mWorkspace.removeExtraEmptyScreen(false, false);
- if (!LauncherAppState.isDisableAllApps() &&
- addedApps != null && mAppsCustomizeContent != null) {
+ if (addedApps != null && mAppsCustomizeContent != null) {
mAppsCustomizeContent.addApps(addedApps);
}
}
* Implementation of the method from LauncherModel.Callbacks.
*/
public void bindAllApplications(final ArrayList<AppInfo> apps) {
- if (LauncherAppState.isDisableAllApps()) {
- if (mAppsCustomizeContent != null) {
- mAppsCustomizeContent.onPackagesUpdated(
- LauncherModel.getSortedWidgetsAndShortcuts(this));
- }
- } else {
- if (mAppsCustomizeContent != null) {
- mAppsCustomizeContent.setApps(apps);
- mAppsCustomizeContent.onPackagesUpdated(
- LauncherModel.getSortedWidgetsAndShortcuts(this));
- }
+ if (mAppsCustomizeContent != null) {
+ mAppsCustomizeContent.setApps(apps);
+ mAppsCustomizeContent.onPackagesUpdated(
+ LauncherModel.getSortedWidgetsAndShortcuts(this));
}
if (mLauncherCallbacks != null) {
mLauncherCallbacks.bindAllApplications(apps);
return;
}
- if (!LauncherAppState.isDisableAllApps() &&
- mAppsCustomizeContent != null) {
+ if (mAppsCustomizeContent != null) {
mAppsCustomizeContent.updateApps(apps);
}
}
}
// Update AllApps
- if (!LauncherAppState.isDisableAllApps() &&
- mAppsCustomizeContent != null) {
+ if (mAppsCustomizeContent != null) {
mAppsCustomizeContent.removeApps(appInfos);
}
}
import java.util.ArrayList;
public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
- private static final String TAG = "LauncherAppState";
-
- private static final boolean DEBUG = false;
private final AppFilter mAppFilter;
private final BuildInfo mBuildInfo;
Utilities.setIconSize(grid.iconSizePx);
}
- public static boolean isDisableAllApps() {
- // Returns false on non-dogfood builds.
- return getInstance().mBuildInfo.isDogfoodBuild() &&
- Utilities.isPropertyEnabled(Launcher.DISABLE_ALL_APPS_PROPERTY);
- }
-
public static boolean isDogfoodBuild() {
return getInstance().mBuildInfo.isDogfoodBuild();
}
sBgDbIconCache.clear();
}
- if (LauncherAppState.isDisableAllApps()) {
- // Ensure that all the applications that are in the system are
- // represented on the home screen.
- verifyApplications();
- }
-
// Clear out this reference, otherwise we end up holding it until all of the
// callback runnables are done.
mContext = null;
}
}
- private void verifyApplications() {
- final Context context = mApp.getContext();
-
- // Cross reference all the applications in our apps list with items in the workspace
- ArrayList<ItemInfo> tmpInfos;
- ArrayList<ItemInfo> added = new ArrayList<ItemInfo>();
- synchronized (sBgLock) {
- for (AppInfo app : mBgAllAppsList.data) {
- tmpInfos = getItemInfoForComponentName(app.componentName, app.user);
- if (tmpInfos.isEmpty()) {
- // We are missing an application icon, so add this to the workspace
- added.add(app);
- // This is a rare event, so lets log it
- Log.e(TAG, "Missing Application on load: " + app);
- }
- }
- }
- if (!added.isEmpty()) {
- addAndBindAddedWorkspaceApps(context, added);
- }
- }
-
// check & update map of what's occupied; used to discard overlapping/invalid items
private boolean checkItemPlacement(HashMap<Long, ItemInfo[][]> occupied, ItemInfo item) {
LauncherAppState app = LauncherAppState.getInstance();
new HashMap<ComponentName, AppInfo>();
if (added != null) {
- // Ensure that we add all the workspace applications to the db
- if (LauncherAppState.isDisableAllApps()) {
- final ArrayList<ItemInfo> addedInfos = new ArrayList<ItemInfo>(added);
- addAndBindAddedWorkspaceApps(context, addedInfos);
- } else {
- addAppsToAllApps(context, added);
- }
+ addAppsToAllApps(context, added);
for (AppInfo ai : added) {
addedOrUpdatedApps.put(ai.componentName, ai);
}