am 9d31e9fa: Shows all screens in the previews.
Merge commit '9d31e9fa3dedf7c51b407c1c5fafe5294fc3c01b' into eclair-mr2 * commit '9d31e9fa3dedf7c51b407c1c5fafe5294fc3c01b': Shows all screens in the previews.
This commit is contained in:
commit
01d540fd2f
5 files changed
+64
-36
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2009 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true" android:drawable="@drawable/preview_bg_press" />
|
||||||
|
<item android:state_focused="true" android:state_window_focused="true" android:drawable="@drawable/preview_bg_focus" />
|
||||||
|
<item android:state_focused="true" android:state_window_focused="false" android:drawable="@drawable/preview_bg" />
|
||||||
|
<item android:drawable="@drawable/preview_bg" />
|
||||||
|
</selector>
|
||||||
@@ -885,8 +885,6 @@ public final class Launcher extends Activity
|
|||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isConfigurationChange = getChangingConfigurations() != 0;
|
|
||||||
|
|
||||||
// TODO should not do this if the drawer is currently closing.
|
// TODO should not do this if the drawer is currently closing.
|
||||||
if (isAllAppsVisible()) {
|
if (isAllAppsVisible()) {
|
||||||
outState.putBoolean(RUNTIME_STATE_ALL_APPS_FOLDER, true);
|
outState.putBoolean(RUNTIME_STATE_ALL_APPS_FOLDER, true);
|
||||||
@@ -1511,23 +1509,26 @@ public final class Launcher extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
@SuppressWarnings({"unchecked"})
|
||||||
private void dismissPreview(View v) {
|
private void dismissPreview(final View v) {
|
||||||
PopupWindow window = (PopupWindow) v.getTag();
|
final PopupWindow window = (PopupWindow) v.getTag();
|
||||||
if (window != null) {
|
if (window != null) {
|
||||||
window.setOnDismissListener(null);
|
window.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||||
|
public void onDismiss() {
|
||||||
|
ViewGroup group = (ViewGroup) v.getTag(R.id.workspace);
|
||||||
|
int count = group.getChildCount();
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
((ImageView) group.getChildAt(i)).setImageDrawable(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Bitmap> bitmaps = (ArrayList<Bitmap>) v.getTag(R.id.icon);
|
||||||
|
for (Bitmap bitmap : bitmaps) bitmap.recycle();
|
||||||
|
|
||||||
|
v.setTag(R.id.workspace, null);
|
||||||
|
v.setTag(R.id.icon, null);
|
||||||
|
window.setOnDismissListener(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
window.dismiss();
|
window.dismiss();
|
||||||
|
|
||||||
ViewGroup group = (ViewGroup) v.getTag(R.id.workspace);
|
|
||||||
int count = group.getChildCount();
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
((ImageView) group.getChildAt(i)).setImageDrawable(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<Bitmap> bitmaps = (ArrayList<Bitmap>) v.getTag(R.id.icon);
|
|
||||||
for (Bitmap bitmap : bitmaps) bitmap.recycle();
|
|
||||||
|
|
||||||
v.setTag(R.id.workspace, null);
|
|
||||||
v.setTag(R.id.icon, null);
|
|
||||||
}
|
}
|
||||||
v.setTag(null);
|
v.setTag(null);
|
||||||
}
|
}
|
||||||
@@ -1536,36 +1537,26 @@ public final class Launcher extends Activity
|
|||||||
int current = mWorkspace.getCurrentScreen();
|
int current = mWorkspace.getCurrentScreen();
|
||||||
if (current <= 0) return;
|
if (current <= 0) return;
|
||||||
|
|
||||||
showPreviews(anchor, 0, current);
|
showPreviews(anchor, 0, mWorkspace.getChildCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showNextPreview(View anchor) {
|
private void showNextPreview(View anchor) {
|
||||||
int current = mWorkspace.getCurrentScreen();
|
int current = mWorkspace.getCurrentScreen();
|
||||||
if (current >= mWorkspace.getChildCount() - 1) return;
|
if (current >= mWorkspace.getChildCount() - 1) return;
|
||||||
|
|
||||||
showPreviews(anchor, current + 1, mWorkspace.getChildCount());
|
showPreviews(anchor, 0, mWorkspace.getChildCount());
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWindowFocusChanged(boolean hasFocus) {
|
|
||||||
super.onWindowFocusChanged(hasFocus);
|
|
||||||
|
|
||||||
if (!hasFocus) {
|
|
||||||
dismissPreview(mPreviousView);
|
|
||||||
dismissPreview(mNextView);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPreviews(final View anchor, int start, int end) {
|
private void showPreviews(final View anchor, int start, int end) {
|
||||||
Drawable d = getResources().getDrawable(R.drawable.preview_popup);
|
Resources resources = getResources();
|
||||||
|
|
||||||
Workspace workspace = mWorkspace;
|
Workspace workspace = mWorkspace;
|
||||||
CellLayout cell = ((CellLayout) workspace.getChildAt(start));
|
CellLayout cell = ((CellLayout) workspace.getChildAt(start));
|
||||||
|
|
||||||
float max = workspace.getChildCount() - 1;
|
float max = workspace.getChildCount();
|
||||||
|
|
||||||
Rect r = new Rect();
|
Rect r = new Rect();
|
||||||
d.getPadding(r);
|
resources.getDrawable(R.drawable.preview_background).getPadding(r);
|
||||||
int extraW = (int) ((r.left + r.right) * max);
|
int extraW = (int) ((r.left + r.right) * max);
|
||||||
int extraH = r.top + r.bottom;
|
int extraH = r.top + r.bottom;
|
||||||
|
|
||||||
@@ -1603,14 +1594,18 @@ public final class Launcher extends Activity
|
|||||||
c.translate(-cell.getLeftPadding(), -cell.getTopPadding());
|
c.translate(-cell.getLeftPadding(), -cell.getTopPadding());
|
||||||
cell.dispatchDraw(c);
|
cell.dispatchDraw(c);
|
||||||
|
|
||||||
image.setBackgroundDrawable(d);
|
image.setBackgroundDrawable(resources.getDrawable(R.drawable.preview_background));
|
||||||
image.setImageBitmap(bitmap);
|
image.setImageBitmap(bitmap);
|
||||||
image.setTag(i);
|
image.setTag(i);
|
||||||
image.setOnClickListener(handler);
|
image.setOnClickListener(handler);
|
||||||
bitmaps.add(bitmap);
|
image.setOnFocusChangeListener(handler);
|
||||||
|
image.setFocusable(true);
|
||||||
|
if (i == mWorkspace.getCurrentScreen()) image.requestFocus();
|
||||||
|
|
||||||
preview.addView(image,
|
preview.addView(image,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
|
|
||||||
|
bitmaps.add(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupWindow p = new PopupWindow(this);
|
PopupWindow p = new PopupWindow(this);
|
||||||
@@ -1619,6 +1614,7 @@ public final class Launcher extends Activity
|
|||||||
p.setHeight((int) (sHeight + extraH));
|
p.setHeight((int) (sHeight + extraH));
|
||||||
p.setAnimationStyle(R.style.AnimationPreview);
|
p.setAnimationStyle(R.style.AnimationPreview);
|
||||||
p.setOutsideTouchable(true);
|
p.setOutsideTouchable(true);
|
||||||
|
p.setFocusable(true);
|
||||||
p.setBackgroundDrawable(new ColorDrawable(0));
|
p.setBackgroundDrawable(new ColorDrawable(0));
|
||||||
p.showAsDropDown(anchor, 0, 0);
|
p.showAsDropDown(anchor, 0, 0);
|
||||||
|
|
||||||
@@ -1633,7 +1629,7 @@ public final class Launcher extends Activity
|
|||||||
anchor.setTag(R.id.icon, bitmaps);
|
anchor.setTag(R.id.icon, bitmaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PreviewTouchHandler implements View.OnClickListener {
|
class PreviewTouchHandler implements View.OnClickListener, Runnable, View.OnFocusChangeListener {
|
||||||
private final View mAnchor;
|
private final View mAnchor;
|
||||||
|
|
||||||
public PreviewTouchHandler(View anchor) {
|
public PreviewTouchHandler(View anchor) {
|
||||||
@@ -1642,8 +1638,18 @@ public final class Launcher extends Activity
|
|||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
mWorkspace.snapToScreen((Integer) v.getTag());
|
mWorkspace.snapToScreen((Integer) v.getTag());
|
||||||
|
v.post(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
dismissPreview(mAnchor);
|
dismissPreview(mAnchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
if (hasFocus) {
|
||||||
|
mWorkspace.snapToScreen((Integer) v.getTag());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
View getDrawerHandle() {
|
View getDrawerHandle() {
|
||||||
|
|||||||
Reference in new issue
Block a user