Checkpoint launcher2 - all apps is in a 2nd window.
Lots is still broken.
This commit is contained in:
parent
a5902524d4
commit
7404ee4a16
|
@ -0,0 +1,41 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2007 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.android.launcher2.AllAppsGridView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher2"
|
||||||
|
|
||||||
|
android:id="@+id/all_apps"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
|
||||||
|
launcher:texture="@drawable/pattern_carbon_fiber_dark"
|
||||||
|
|
||||||
|
android:scrollbarStyle="outsideInset"
|
||||||
|
android:drawSelectorOnTop="false"
|
||||||
|
android:listSelector="@drawable/grid_selector"
|
||||||
|
|
||||||
|
android:verticalSpacing="10dip"
|
||||||
|
android:numColumns="5" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
android:nextFocusLeft="@id/all_apps"
|
||||||
|
android:nextFocusDown="@id/content"
|
||||||
|
android:nextFocusUp="@id/content"
|
||||||
|
android:nextFocusRight="@id/content"
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
|
@ -36,51 +36,20 @@
|
||||||
|
|
||||||
</com.android.launcher2.Workspace>
|
</com.android.launcher2.Workspace>
|
||||||
|
|
||||||
<SlidingDrawer
|
<com.android.launcher2.HandleView
|
||||||
android:id="@+id/drawer"
|
android:id="@id/all_apps"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="56dip"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
|
|
||||||
android:orientation="horizontal"
|
android:background="@drawable/handle"
|
||||||
android:bottomOffset="7dip"
|
|
||||||
android:handle="@+id/all_apps"
|
|
||||||
android:content="@+id/content">
|
|
||||||
|
|
||||||
<com.android.launcher2.HandleView
|
|
||||||
android:id="@id/all_apps"
|
|
||||||
android:layout_width="56dip"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
|
|
||||||
android:background="@drawable/handle"
|
android:focusable="true"
|
||||||
|
android:clickable="true"
|
||||||
|
|
||||||
android:focusable="true"
|
android:scaleType="center"
|
||||||
android:clickable="true"
|
android:src="@drawable/handle_icon"
|
||||||
|
|
||||||
android:scaleType="center"
|
launcher:direction="vertical" />
|
||||||
android:src="@drawable/handle_icon"
|
|
||||||
|
|
||||||
launcher:direction="vertical" />
|
|
||||||
|
|
||||||
<com.android.launcher2.AllAppsGridView
|
|
||||||
android:id="@id/content"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
|
|
||||||
launcher:texture="@drawable/pattern_carbon_fiber_dark"
|
|
||||||
|
|
||||||
android:scrollbarStyle="outsideInset"
|
|
||||||
android:drawSelectorOnTop="false"
|
|
||||||
android:listSelector="@drawable/grid_selector"
|
|
||||||
|
|
||||||
android:nextFocusLeft="@id/all_apps"
|
|
||||||
android:nextFocusDown="@id/content"
|
|
||||||
android:nextFocusUp="@id/content"
|
|
||||||
android:nextFocusRight="@id/content"
|
|
||||||
|
|
||||||
android:verticalSpacing="10dip"
|
|
||||||
android:numColumns="5" />
|
|
||||||
|
|
||||||
</SlidingDrawer>
|
|
||||||
|
|
||||||
<com.android.launcher2.DeleteZone
|
<com.android.launcher2.DeleteZone
|
||||||
android:id="@+id/delete_zone"
|
android:id="@+id/delete_zone"
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<GridView
|
<GridView
|
||||||
android:id="@id/content"
|
android:id="@+id/content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<GridView
|
<GridView
|
||||||
android:id="@id/content"
|
android:id="@+id/content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2007 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.android.launcher2.AllAppsGridView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher2"
|
||||||
|
|
||||||
|
android:id="@+id/all_apps"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
|
||||||
|
launcher:texture="@drawable/pattern_carbon_fiber_dark"
|
||||||
|
|
||||||
|
android:scrollbarStyle="outsideInset"
|
||||||
|
android:drawSelectorOnTop="false"
|
||||||
|
android:listSelector="@drawable/grid_selector"
|
||||||
|
|
||||||
|
android:verticalSpacing="10dip"
|
||||||
|
android:numColumns="4" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
android:nextFocusLeft="@id/content"
|
||||||
|
android:nextFocusDown="@id/content"
|
||||||
|
android:nextFocusUp="@id/all_apps"
|
||||||
|
android:nextFocusRight="@id/content"
|
||||||
|
-->
|
|
@ -36,51 +36,21 @@
|
||||||
|
|
||||||
</com.android.launcher2.Workspace>
|
</com.android.launcher2.Workspace>
|
||||||
|
|
||||||
<SlidingDrawer
|
<com.android.launcher2.HandleView
|
||||||
android:id="@+id/drawer"
|
android:id="@id/all_apps"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="56dip"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
|
||||||
android:topOffset="5dip"
|
android:background="@drawable/handle"
|
||||||
android:bottomOffset="7dip"
|
|
||||||
android:handle="@+id/all_apps"
|
|
||||||
android:content="@+id/content">
|
|
||||||
|
|
||||||
<com.android.launcher2.HandleView
|
android:focusable="true"
|
||||||
android:id="@id/all_apps"
|
android:clickable="true"
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="56dip"
|
|
||||||
|
|
||||||
android:background="@drawable/handle"
|
android:scaleType="center"
|
||||||
|
android:src="@drawable/handle_icon"
|
||||||
|
|
||||||
android:focusable="true"
|
launcher:direction="horizontal" />
|
||||||
android:clickable="true"
|
|
||||||
|
|
||||||
android:scaleType="center"
|
|
||||||
android:src="@drawable/handle_icon"
|
|
||||||
|
|
||||||
launcher:direction="horizontal" />
|
|
||||||
|
|
||||||
<com.android.launcher2.AllAppsGridView
|
|
||||||
android:id="@id/content"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
|
|
||||||
launcher:texture="@drawable/pattern_carbon_fiber_dark"
|
|
||||||
|
|
||||||
android:scrollbarStyle="outsideInset"
|
|
||||||
android:drawSelectorOnTop="false"
|
|
||||||
android:listSelector="@drawable/grid_selector"
|
|
||||||
|
|
||||||
android:nextFocusLeft="@id/content"
|
|
||||||
android:nextFocusDown="@id/content"
|
|
||||||
android:nextFocusUp="@id/all_apps"
|
|
||||||
android:nextFocusRight="@id/content"
|
|
||||||
|
|
||||||
android:verticalSpacing="10dip"
|
|
||||||
android:numColumns="4" />
|
|
||||||
|
|
||||||
</SlidingDrawer>
|
|
||||||
|
|
||||||
<com.android.launcher2.DeleteZone
|
<com.android.launcher2.DeleteZone
|
||||||
android:id="@+id/delete_zone"
|
android:id="@+id/delete_zone"
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@id/content"
|
android:id="@+id/content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
|
|
@ -62,9 +62,11 @@ public class HandleView extends ImageView {
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
final boolean handled = super.onKeyDown(keyCode, event);
|
final boolean handled = super.onKeyDown(keyCode, event);
|
||||||
|
|
||||||
|
/* TODO
|
||||||
if (!handled && !mLauncher.isDrawerDown() && !isDirectionKey(keyCode)) {
|
if (!handled && !mLauncher.isDrawerDown() && !isDirectionKey(keyCode)) {
|
||||||
return mLauncher.getApplicationsGrid().onKeyDown(keyCode, event);
|
return mLauncher.getApplicationsGrid().onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
@ -73,9 +75,11 @@ public class HandleView extends ImageView {
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||||
final boolean handled = super.onKeyUp(keyCode, event);
|
final boolean handled = super.onKeyUp(keyCode, event);
|
||||||
|
|
||||||
|
/* TODO
|
||||||
if (!handled && !mLauncher.isDrawerDown() && !isDirectionKey(keyCode)) {
|
if (!handled && !mLauncher.isDrawerDown() && !isDirectionKey(keyCode)) {
|
||||||
return mLauncher.getApplicationsGrid().onKeyUp(keyCode, event);
|
return mLauncher.getApplicationsGrid().onKeyUp(keyCode, event);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ import android.view.View.OnLongClickListener;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.GridView;
|
import android.widget.GridView;
|
||||||
import android.widget.SlidingDrawer;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.appwidget.AppWidgetManager;
|
import android.appwidget.AppWidgetManager;
|
||||||
|
@ -123,8 +123,9 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
static final int NUMBER_CELLS_X = 4;
|
static final int NUMBER_CELLS_X = 4;
|
||||||
static final int NUMBER_CELLS_Y = 4;
|
static final int NUMBER_CELLS_Y = 4;
|
||||||
|
|
||||||
private static final int DIALOG_CREATE_SHORTCUT = 1;
|
static final int DIALOG_ALL_APPS = 1;
|
||||||
static final int DIALOG_RENAME_FOLDER = 2;
|
static final int DIALOG_CREATE_SHORTCUT = 2;
|
||||||
|
static final int DIALOG_RENAME_FOLDER = 3;
|
||||||
|
|
||||||
private static final String PREFERENCES = "launcher.preferences";
|
private static final String PREFERENCES = "launcher.preferences";
|
||||||
|
|
||||||
|
@ -182,10 +183,10 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
private final int[] mCellCoordinates = new int[2];
|
private final int[] mCellCoordinates = new int[2];
|
||||||
private FolderInfo mFolderInfo;
|
private FolderInfo mFolderInfo;
|
||||||
|
|
||||||
private SlidingDrawer mDrawer;
|
private AllAppsDialog mAllAppsDialog;
|
||||||
private TransitionDrawable mHandleIcon;
|
private TransitionDrawable mHandleIcon;
|
||||||
private HandleView mHandleView;
|
private HandleView mHandleView;
|
||||||
private AllAppsGridView mAllAppsGrid;
|
private AllAppsGridView mAllAppsGrid; // TODO: put this into AllAppsDialog
|
||||||
|
|
||||||
private boolean mDesktopLocked = true;
|
private boolean mDesktopLocked = true;
|
||||||
private Bundle mSavedState;
|
private Bundle mSavedState;
|
||||||
|
@ -227,6 +228,9 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
setContentView(R.layout.launcher);
|
setContentView(R.layout.launcher);
|
||||||
setupViews();
|
setupViews();
|
||||||
|
|
||||||
|
mAllAppsDialog = new AllAppsDialog(this);
|
||||||
|
mAllAppsDialog.lock();
|
||||||
|
|
||||||
registerIntentReceivers();
|
registerIntentReceivers();
|
||||||
registerContentObservers();
|
registerContentObservers();
|
||||||
|
|
||||||
|
@ -538,29 +542,14 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
mWorkspace = (Workspace) dragLayer.findViewById(R.id.workspace);
|
mWorkspace = (Workspace) dragLayer.findViewById(R.id.workspace);
|
||||||
final Workspace workspace = mWorkspace;
|
final Workspace workspace = mWorkspace;
|
||||||
|
|
||||||
mDrawer = (SlidingDrawer) dragLayer.findViewById(R.id.drawer);
|
|
||||||
final SlidingDrawer drawer = mDrawer;
|
|
||||||
|
|
||||||
mAllAppsGrid = (AllAppsGridView) drawer.getContent();
|
|
||||||
final AllAppsGridView grid = mAllAppsGrid;
|
|
||||||
|
|
||||||
final DeleteZone deleteZone = (DeleteZone) dragLayer.findViewById(R.id.delete_zone);
|
final DeleteZone deleteZone = (DeleteZone) dragLayer.findViewById(R.id.delete_zone);
|
||||||
|
|
||||||
mHandleView = (HandleView) drawer.findViewById(R.id.all_apps);
|
mHandleView = (HandleView) findViewById(R.id.all_apps);
|
||||||
mHandleView.setLauncher(this);
|
mHandleView.setLauncher(this);
|
||||||
|
mHandleView.setOnClickListener(this);
|
||||||
mHandleIcon = (TransitionDrawable) mHandleView.getDrawable();
|
mHandleIcon = (TransitionDrawable) mHandleView.getDrawable();
|
||||||
mHandleIcon.setCrossFadeEnabled(true);
|
mHandleIcon.setCrossFadeEnabled(true);
|
||||||
|
|
||||||
drawer.lock();
|
|
||||||
final DrawerManager drawerManager = new DrawerManager();
|
|
||||||
drawer.setOnDrawerOpenListener(drawerManager);
|
|
||||||
drawer.setOnDrawerCloseListener(drawerManager);
|
|
||||||
drawer.setOnDrawerScrollListener(drawerManager);
|
|
||||||
|
|
||||||
grid.setTextFilterEnabled(false);
|
|
||||||
grid.setDragger(dragLayer);
|
|
||||||
grid.setLauncher(this);
|
|
||||||
|
|
||||||
workspace.setOnLongClickListener(this);
|
workspace.setOnLongClickListener(this);
|
||||||
workspace.setDragger(dragLayer);
|
workspace.setDragger(dragLayer);
|
||||||
workspace.setLauncher(this);
|
workspace.setLauncher(this);
|
||||||
|
@ -570,7 +559,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
deleteZone.setDragController(dragLayer);
|
deleteZone.setDragController(dragLayer);
|
||||||
deleteZone.setHandle(mHandleView);
|
deleteZone.setHandle(mHandleView);
|
||||||
|
|
||||||
dragLayer.setIgnoredDropTarget(grid);
|
// TODO dragLayer.setIgnoredDropTarget(grid);
|
||||||
dragLayer.setDragScoller(workspace);
|
dragLayer.setDragScoller(workspace);
|
||||||
dragLayer.setDragListener(deleteZone);
|
dragLayer.setDragListener(deleteZone);
|
||||||
}
|
}
|
||||||
|
@ -868,7 +857,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
|
|
||||||
// When the drawer is opened and we are saving the state because of a
|
// When the drawer is opened and we are saving the state because of a
|
||||||
// configuration change
|
// configuration change
|
||||||
if (mDrawer.isOpened() && isConfigurationChange) {
|
if (mAllAppsDialog.isOpen && isConfigurationChange) {
|
||||||
outState.putBoolean(RUNTIME_STATE_ALL_APPS_FOLDER, true);
|
outState.putBoolean(RUNTIME_STATE_ALL_APPS_FOLDER, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1331,7 +1320,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
case KeyEvent.KEYCODE_BACK:
|
case KeyEvent.KEYCODE_BACK:
|
||||||
if (!event.isCanceled()) {
|
if (!event.isCanceled()) {
|
||||||
mWorkspace.dispatchKeyEvent(event);
|
mWorkspace.dispatchKeyEvent(event);
|
||||||
if (mDrawer.isOpened()) {
|
if (mAllAppsDialog.isOpen) {
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
} else {
|
} else {
|
||||||
closeFolder();
|
closeFolder();
|
||||||
|
@ -1353,13 +1342,14 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeDrawer(boolean animated) {
|
private void closeDrawer(boolean animated) {
|
||||||
if (mDrawer.isOpened()) {
|
if (mAllAppsDialog.isOpen) {
|
||||||
if (animated) {
|
if (animated) {
|
||||||
mDrawer.animateClose();
|
// TODO mDrawer.animateClose();
|
||||||
|
mAllAppsDialog.dismiss();
|
||||||
} else {
|
} else {
|
||||||
mDrawer.close();
|
mAllAppsDialog.dismiss();
|
||||||
}
|
}
|
||||||
if (mDrawer.hasFocus()) {
|
if (false /* TODO mDrawer.hasFocus() */) {
|
||||||
mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus();
|
mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1387,7 +1377,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
*/
|
*/
|
||||||
private void onFavoritesChanged() {
|
private void onFavoritesChanged() {
|
||||||
mDesktopLocked = true;
|
mDesktopLocked = true;
|
||||||
mDrawer.lock();
|
mAllAppsDialog.lock();
|
||||||
sModel.loadUserItems(false, this, false, false);
|
sModel.loadUserItems(false, this, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1515,7 +1505,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
|
|
||||||
final boolean allApps = mSavedState.getBoolean(RUNTIME_STATE_ALL_APPS_FOLDER, false);
|
final boolean allApps = mSavedState.getBoolean(RUNTIME_STATE_ALL_APPS_FOLDER, false);
|
||||||
if (allApps) {
|
if (allApps) {
|
||||||
mDrawer.open();
|
showDialog(DIALOG_ALL_APPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
mSavedState = null;
|
mSavedState = null;
|
||||||
|
@ -1526,12 +1516,14 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
mSavedInstanceState = null;
|
mSavedInstanceState = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDrawer.isOpened() && !mDrawer.hasFocus()) {
|
/* TODO
|
||||||
|
if (mAllAppsDialog.isOpen && !mDrawer.hasFocus()) {
|
||||||
mDrawer.requestFocus();
|
mDrawer.requestFocus();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
mDesktopLocked = false;
|
mDesktopLocked = false;
|
||||||
mDrawer.unlock();
|
mAllAppsDialog.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindDrawer(Launcher.DesktopBinder binder,
|
private void bindDrawer(Launcher.DesktopBinder binder,
|
||||||
|
@ -1590,6 +1582,12 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
startActivitySafely(intent);
|
startActivitySafely(intent);
|
||||||
} else if (tag instanceof FolderInfo) {
|
} else if (tag instanceof FolderInfo) {
|
||||||
handleFolderClick((FolderInfo) tag);
|
handleFolderClick((FolderInfo) tag);
|
||||||
|
} else if (v == mHandleView) {
|
||||||
|
if (mAllAppsDialog.isOpen) {
|
||||||
|
// TODO how can we be here?
|
||||||
|
} else {
|
||||||
|
showDialog(DIALOG_ALL_APPS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1635,7 +1633,12 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
// The first time the application is started, we load the wallpaper from
|
// The first time the application is started, we load the wallpaper from
|
||||||
// the ApplicationContext
|
// the ApplicationContext
|
||||||
if (sWallpaper == null) {
|
if (sWallpaper == null) {
|
||||||
final Drawable drawable = getWallpaper();
|
final Drawable drawable;
|
||||||
|
if (false) {
|
||||||
|
drawable = getWallpaper();
|
||||||
|
} else {
|
||||||
|
drawable = getResources().getDrawable(R.drawable.wallpaper_path);
|
||||||
|
}
|
||||||
if (drawable instanceof BitmapDrawable) {
|
if (drawable instanceof BitmapDrawable) {
|
||||||
sWallpaper = ((BitmapDrawable) drawable).getBitmap();
|
sWallpaper = ((BitmapDrawable) drawable).getBitmap();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1721,7 +1724,8 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeAllApplications() {
|
void closeAllApplications() {
|
||||||
mDrawer.close();
|
// TODO mDrawer.close();
|
||||||
|
mAllAppsDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
View getDrawerHandle() {
|
View getDrawerHandle() {
|
||||||
|
@ -1729,28 +1733,32 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isDrawerDown() {
|
boolean isDrawerDown() {
|
||||||
return !mDrawer.isMoving() && !mDrawer.isOpened();
|
return /* TODO !mDrawer.isMoving() && */ !mAllAppsDialog.isOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isDrawerUp() {
|
boolean isDrawerUp() {
|
||||||
return mDrawer.isOpened() && !mDrawer.isMoving();
|
return mAllAppsDialog.isOpen; /* TODO && !mDrawer.isMoving();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isDrawerMoving() {
|
boolean isDrawerMoving() {
|
||||||
return mDrawer.isMoving();
|
return false; // TODO mDrawer.isMoving();
|
||||||
}
|
}
|
||||||
|
|
||||||
Workspace getWorkspace() {
|
Workspace getWorkspace() {
|
||||||
return mWorkspace;
|
return mWorkspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO
|
||||||
GridView getApplicationsGrid() {
|
GridView getApplicationsGrid() {
|
||||||
return mAllAppsGrid;
|
return mAllAppsGrid;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Dialog onCreateDialog(int id) {
|
protected Dialog onCreateDialog(int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
case DIALOG_ALL_APPS:
|
||||||
|
return mAllAppsDialog;
|
||||||
case DIALOG_CREATE_SHORTCUT:
|
case DIALOG_CREATE_SHORTCUT:
|
||||||
return new CreateShortcut().createDialog();
|
return new CreateShortcut().createDialog();
|
||||||
case DIALOG_RENAME_FOLDER:
|
case DIALOG_RENAME_FOLDER:
|
||||||
|
@ -1763,6 +1771,9 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
@Override
|
@Override
|
||||||
protected void onPrepareDialog(int id, Dialog dialog) {
|
protected void onPrepareDialog(int id, Dialog dialog) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
case DIALOG_ALL_APPS:
|
||||||
|
mAllAppsDialog.isOpen = true;
|
||||||
|
break;
|
||||||
case DIALOG_CREATE_SHORTCUT:
|
case DIALOG_CREATE_SHORTCUT:
|
||||||
break;
|
break;
|
||||||
case DIALOG_RENAME_FOLDER:
|
case DIALOG_RENAME_FOLDER:
|
||||||
|
@ -1860,7 +1871,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
LauncherModel.updateItemInDatabase(Launcher.this, mFolderInfo);
|
LauncherModel.updateItemInDatabase(Launcher.this, mFolderInfo);
|
||||||
|
|
||||||
if (mDesktopLocked) {
|
if (mDesktopLocked) {
|
||||||
mDrawer.lock();
|
mAllAppsDialog.lock();
|
||||||
sModel.loadUserItems(false, Launcher.this, false, false);
|
sModel.loadUserItems(false, Launcher.this, false, false);
|
||||||
} else {
|
} else {
|
||||||
final FolderIcon folderIcon = (FolderIcon)
|
final FolderIcon folderIcon = (FolderIcon)
|
||||||
|
@ -1870,7 +1881,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
getWorkspace().requestLayout();
|
getWorkspace().requestLayout();
|
||||||
} else {
|
} else {
|
||||||
mDesktopLocked = true;
|
mDesktopLocked = true;
|
||||||
mDrawer.lock();
|
mAllAppsDialog.lock();
|
||||||
sModel.loadUserItems(false, Launcher.this, false, false);
|
sModel.loadUserItems(false, Launcher.this, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1886,6 +1897,53 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the 3d all apps view.
|
||||||
|
*/
|
||||||
|
private class AllAppsDialog extends Dialog implements DialogInterface.OnCancelListener,
|
||||||
|
DialogInterface.OnDismissListener, DialogInterface.OnShowListener {
|
||||||
|
|
||||||
|
boolean isOpen;
|
||||||
|
|
||||||
|
AllAppsDialog(Context context) {
|
||||||
|
super(context, android.R.style.Theme_Translucent_NoTitleBar);
|
||||||
|
|
||||||
|
setOnCancelListener(this);
|
||||||
|
setOnDismissListener(this);
|
||||||
|
setOnShowListener(this);
|
||||||
|
|
||||||
|
setContentView(R.layout.all_apps);
|
||||||
|
AllAppsGridView grid = mAllAppsGrid = (AllAppsGridView)findViewById(R.id.all_apps);
|
||||||
|
|
||||||
|
grid.setTextFilterEnabled(false);
|
||||||
|
// TODO grid.setDragger(dragLayer);
|
||||||
|
grid.setLauncher(Launcher.this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCancel(DialogInterface dialog) {
|
||||||
|
onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onShow(DialogInterface dialog) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onDestroy() {
|
||||||
|
this.isOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lock() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void unlock() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the shortcut creation dialog and launches, if necessary, the
|
* Displays the shortcut creation dialog and launches, if necessary, the
|
||||||
* appropriate activity.
|
* appropriate activity.
|
||||||
|
@ -2108,57 +2166,6 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DrawerManager implements SlidingDrawer.OnDrawerOpenListener,
|
|
||||||
SlidingDrawer.OnDrawerCloseListener, SlidingDrawer.OnDrawerScrollListener {
|
|
||||||
private boolean mOpen;
|
|
||||||
|
|
||||||
public void onDrawerOpened() {
|
|
||||||
if (!mOpen) {
|
|
||||||
mHandleIcon.reverseTransition(150);
|
|
||||||
|
|
||||||
final Rect bounds = mWorkspace.mDrawerBounds;
|
|
||||||
offsetBoundsToDragLayer(bounds, mAllAppsGrid);
|
|
||||||
|
|
||||||
mOpen = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void offsetBoundsToDragLayer(Rect bounds, View view) {
|
|
||||||
view.getDrawingRect(bounds);
|
|
||||||
|
|
||||||
while (view != mDragLayer) {
|
|
||||||
bounds.offset(view.getLeft(), view.getTop());
|
|
||||||
view = (View) view.getParent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDrawerClosed() {
|
|
||||||
if (mOpen) {
|
|
||||||
mHandleIcon.reverseTransition(150);
|
|
||||||
mWorkspace.mDrawerBounds.setEmpty();
|
|
||||||
mOpen = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mAllAppsGrid.setSelection(0);
|
|
||||||
mAllAppsGrid.clearTextFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onScrollStarted() {
|
|
||||||
if (PROFILE_DRAWER) {
|
|
||||||
android.os.Debug.startMethodTracing("/sdcard/launcher-drawer");
|
|
||||||
}
|
|
||||||
|
|
||||||
mWorkspace.mDrawerContentWidth = mAllAppsGrid.getWidth();
|
|
||||||
mWorkspace.mDrawerContentHeight = mAllAppsGrid.getHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onScrollEnded() {
|
|
||||||
if (PROFILE_DRAWER) {
|
|
||||||
android.os.Debug.stopMethodTracing();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class DesktopBinder extends Handler implements MessageQueue.IdleHandler {
|
private static class DesktopBinder extends Handler implements MessageQueue.IdleHandler {
|
||||||
static final int MESSAGE_BIND_ITEMS = 0x1;
|
static final int MESSAGE_BIND_ITEMS = 0x1;
|
||||||
static final int MESSAGE_BIND_APPWIDGETS = 0x2;
|
static final int MESSAGE_BIND_APPWIDGETS = 0x2;
|
||||||
|
|
Loading…
Reference in New Issue