summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/trebuchet/Launcher.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/Launcher.java')
-rw-r--r--src/com/cyanogenmod/trebuchet/Launcher.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/com/cyanogenmod/trebuchet/Launcher.java b/src/com/cyanogenmod/trebuchet/Launcher.java
index f90a1eb7e..c82c8fe2d 100644
--- a/src/com/cyanogenmod/trebuchet/Launcher.java
+++ b/src/com/cyanogenmod/trebuchet/Launcher.java
@@ -134,7 +134,8 @@ public final class Launcher extends Activity
private static final int MENU_GROUP_WALLPAPER = 1;
private static final int MENU_WALLPAPER_SETTINGS = Menu.FIRST + 1;
- private static final int MENU_MANAGE_APPS = MENU_WALLPAPER_SETTINGS + 1;
+ private static final int MENU_LOCK_WORKSPACE = MENU_WALLPAPER_SETTINGS + 1;
+ private static final int MENU_MANAGE_APPS = MENU_LOCK_WORKSPACE + 1;
private static final int MENU_PREFERENCES = MENU_MANAGE_APPS + 1;
private static final int MENU_SYSTEM_SETTINGS = MENU_PREFERENCES + 1;
private static final int MENU_HELP = MENU_SYSTEM_SETTINGS + 1;
@@ -319,6 +320,7 @@ public final class Launcher extends Activity
private boolean mShowDockDivider;
private boolean mHideIconLabels;
private boolean mAutoRotate;
+ private boolean mLockWorkspace;
private boolean mFullscreenMode;
private boolean mWallpaperVisible;
@@ -403,6 +405,7 @@ public final class Launcher extends Activity
mShowDockDivider = PreferencesProvider.Interface.Dock.getShowDivider() && mShowHotseat;
mHideIconLabels = PreferencesProvider.Interface.Homescreen.getHideIconLabels();
mAutoRotate = PreferencesProvider.Interface.General.getAutoRotate(getResources().getBoolean(R.bool.allow_rotation));
+ mLockWorkspace = PreferencesProvider.Interface.General.getLockWorkspace(getResources().getBoolean(R.bool.lock_workspace));
mFullscreenMode = PreferencesProvider.Interface.General.getFullscreenMode();
if (PROFILE_STARTUP) {
@@ -1775,6 +1778,8 @@ public final class Launcher extends Activity
menu.add(MENU_GROUP_WALLPAPER, MENU_WALLPAPER_SETTINGS, 0, R.string.menu_wallpaper)
.setIcon(android.R.drawable.ic_menu_gallery)
.setAlphabeticShortcut('W');
+ menu.add(0, MENU_LOCK_WORKSPACE, 0, !mLockWorkspace ? R.string.menu_lock_workspace : R.string.menu_unlock_workspace)
+ .setAlphabeticShortcut('L');
menu.add(0, MENU_MANAGE_APPS, 0, R.string.menu_manage_apps)
.setIcon(android.R.drawable.ic_menu_manage)
.setIntent(manageApps)
@@ -1808,6 +1813,8 @@ public final class Launcher extends Activity
boolean allAppsVisible = (mAppsCustomizeTabHost.getVisibility() == View.VISIBLE);
menu.setGroupVisible(MENU_GROUP_WALLPAPER, !allAppsVisible);
+ menu.findItem(MENU_LOCK_WORKSPACE).setTitle(!mLockWorkspace ? R.string.menu_lock_workspace : R.string.menu_unlock_workspace);
+
Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
launcherIntent.addCategory(Intent.CATEGORY_HOME);
launcherIntent.addCategory(Intent.CATEGORY_DEFAULT);
@@ -1823,11 +1830,18 @@ public final class Launcher extends Activity
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
- case MENU_WALLPAPER_SETTINGS:
- startWallpaper();
- return true;
+ case MENU_WALLPAPER_SETTINGS:
+ startWallpaper();
+ return true;
+ case MENU_LOCK_WORKSPACE:
+ mLockWorkspace = !mLockWorkspace;
+ SharedPreferences.Editor editor = mSharedPrefs.edit();
+ editor.putBoolean("ui_general_lock_workspace", mLockWorkspace);
+ editor.commit();
+ return true;
}
+
return super.onOptionsItemSelected(item);
}
@@ -2548,7 +2562,11 @@ public final class Launcher extends Activity
startWallpaper();
} else {
if (!(itemUnderLongClick instanceof Folder)) {
- // User long pressed on an item
+ // User long pressed on an item (only if workspace is not locked)
+ if (mLockWorkspace) {
+ Toast.makeText(this, getString(R.string.workspace_locked), Toast.LENGTH_SHORT).show();
+ return false;
+ }
mWorkspace.startDrag(longClickCellInfo);
}
}
@@ -2567,6 +2585,10 @@ public final class Launcher extends Activity
return mSearchDropTargetBar;
}
+ boolean getLockWorkspace() {
+ return mLockWorkspace;
+ }
+
/**
* Returns the CellLayout of the specified container at the specified screen.
*/