diff options
author | Winson Chung <winsonc@google.com> | 2011-09-19 11:49:12 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-09-19 16:06:37 -0700 |
commit | 9d9d74f2b0927b9b28ac70d453c046d48788b57b (patch) | |
tree | ad6f4bd1a576f0e1a71a42ddffe7cf8c18e3b332 | |
parent | ff648b5512d1af9f5863aa97677a7a3e108ad1dd (diff) | |
download | android_packages_apps_Trebuchet-9d9d74f2b0927b9b28ac70d453c046d48788b57b.tar.gz android_packages_apps_Trebuchet-9d9d74f2b0927b9b28ac70d453c046d48788b57b.tar.bz2 android_packages_apps_Trebuchet-9d9d74f2b0927b9b28ac70d453c046d48788b57b.zip |
Launcher tweaks.
- Updating search bar bg
- Removing clings from the layout if they are already dismissed
- Tweaking cling description paddings for languages that are more verbase
- Tweaking wallpaper picker gallery spacing
Change-Id: I801cdf4b1d0cc49a53113318d7b9075f6fa218bd
-rw-r--r-- | res/drawable-hdpi/grid_focused.9.png | bin | 200 -> 196 bytes | |||
-rw-r--r-- | res/drawable-hdpi/grid_pressed.9.png | bin | 184 -> 200 bytes | |||
-rw-r--r-- | res/drawable-hdpi/grid_selected.9.png | bin | 202 -> 204 bytes | |||
-rw-r--r-- | res/drawable-hdpi/search_bg_panel.9.png | bin | 219 -> 177 bytes | |||
-rw-r--r-- | res/drawable-mdpi/grid_focused.9.png | bin | 170 -> 176 bytes | |||
-rw-r--r-- | res/drawable-mdpi/grid_pressed.9.png | bin | 165 -> 170 bytes | |||
-rw-r--r-- | res/drawable-mdpi/grid_selected.9.png | bin | 165 -> 169 bytes | |||
-rw-r--r-- | res/drawable-mdpi/search_bg_panel.9.png | bin | 196 -> 162 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/grid_focused.9.png | bin | 193 -> 196 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/grid_pressed.9.png | bin | 190 -> 193 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/grid_selected.9.png | bin | 199 -> 193 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/search_bg_panel.9.png | bin | 255 -> 198 bytes | |||
-rw-r--r-- | res/layout-port/workspace_cling.xml | 3 | ||||
-rw-r--r-- | res/layout/wallpaper_chooser.xml | 2 | ||||
-rw-r--r-- | src/com/android/launcher2/Cling.java | 15 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 37 |
16 files changed, 31 insertions, 26 deletions
diff --git a/res/drawable-hdpi/grid_focused.9.png b/res/drawable-hdpi/grid_focused.9.png Binary files differindex cb5aea89a..f6ae2672a 100644 --- a/res/drawable-hdpi/grid_focused.9.png +++ b/res/drawable-hdpi/grid_focused.9.png diff --git a/res/drawable-hdpi/grid_pressed.9.png b/res/drawable-hdpi/grid_pressed.9.png Binary files differindex 548accef6..cb5aea89a 100644 --- a/res/drawable-hdpi/grid_pressed.9.png +++ b/res/drawable-hdpi/grid_pressed.9.png diff --git a/res/drawable-hdpi/grid_selected.9.png b/res/drawable-hdpi/grid_selected.9.png Binary files differindex 02ab90253..add46a73b 100644 --- a/res/drawable-hdpi/grid_selected.9.png +++ b/res/drawable-hdpi/grid_selected.9.png diff --git a/res/drawable-hdpi/search_bg_panel.9.png b/res/drawable-hdpi/search_bg_panel.9.png Binary files differindex c868b2fc9..0c00d364a 100644 --- a/res/drawable-hdpi/search_bg_panel.9.png +++ b/res/drawable-hdpi/search_bg_panel.9.png diff --git a/res/drawable-mdpi/grid_focused.9.png b/res/drawable-mdpi/grid_focused.9.png Binary files differindex c7e6b06da..6660a8c18 100644 --- a/res/drawable-mdpi/grid_focused.9.png +++ b/res/drawable-mdpi/grid_focused.9.png diff --git a/res/drawable-mdpi/grid_pressed.9.png b/res/drawable-mdpi/grid_pressed.9.png Binary files differindex 09a7e3fbe..c7e6b06da 100644 --- a/res/drawable-mdpi/grid_pressed.9.png +++ b/res/drawable-mdpi/grid_pressed.9.png diff --git a/res/drawable-mdpi/grid_selected.9.png b/res/drawable-mdpi/grid_selected.9.png Binary files differindex a40b05826..e2732b770 100644 --- a/res/drawable-mdpi/grid_selected.9.png +++ b/res/drawable-mdpi/grid_selected.9.png diff --git a/res/drawable-mdpi/search_bg_panel.9.png b/res/drawable-mdpi/search_bg_panel.9.png Binary files differindex 81f01ceba..0fadc7754 100644 --- a/res/drawable-mdpi/search_bg_panel.9.png +++ b/res/drawable-mdpi/search_bg_panel.9.png diff --git a/res/drawable-xhdpi/grid_focused.9.png b/res/drawable-xhdpi/grid_focused.9.png Binary files differindex 20d4647df..37228b341 100644 --- a/res/drawable-xhdpi/grid_focused.9.png +++ b/res/drawable-xhdpi/grid_focused.9.png diff --git a/res/drawable-xhdpi/grid_pressed.9.png b/res/drawable-xhdpi/grid_pressed.9.png Binary files differindex 73a784b60..20d4647df 100644 --- a/res/drawable-xhdpi/grid_pressed.9.png +++ b/res/drawable-xhdpi/grid_pressed.9.png diff --git a/res/drawable-xhdpi/grid_selected.9.png b/res/drawable-xhdpi/grid_selected.9.png Binary files differindex eb0f3dc2f..c8b9b6b2c 100644 --- a/res/drawable-xhdpi/grid_selected.9.png +++ b/res/drawable-xhdpi/grid_selected.9.png diff --git a/res/drawable-xhdpi/search_bg_panel.9.png b/res/drawable-xhdpi/search_bg_panel.9.png Binary files differindex 3cd534f95..963cb7ff4 100644 --- a/res/drawable-xhdpi/search_bg_panel.9.png +++ b/res/drawable-xhdpi/search_bg_panel.9.png diff --git a/res/layout-port/workspace_cling.xml b/res/layout-port/workspace_cling.xml index d5aff8af8..6b05c2705 100644 --- a/res/layout-port/workspace_cling.xml +++ b/res/layout-port/workspace_cling.xml @@ -21,6 +21,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginLeft="20dp" + android:layout_marginRight="20dp" android:layout_marginTop="90dp"> <LinearLayout android:layout_width="match_parent" @@ -43,6 +44,8 @@ android:id="@+id/workspace_cling_open_all_apps" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginLeft="20dp" + android:layout_marginRight="20dp" android:layout_marginBottom="130dp" android:layout_gravity="bottom" android:gravity="center" diff --git a/res/layout/wallpaper_chooser.xml b/res/layout/wallpaper_chooser.xml index 60d971907..49930769c 100644 --- a/res/layout/wallpaper_chooser.xml +++ b/res/layout/wallpaper_chooser.xml @@ -32,7 +32,7 @@ <Gallery android:id="@+id/gallery" android:layout_width="match_parent" android:layout_height="wrap_content" - android:spacing="0dp" /> + android:spacing="-4dp" /> <Button android:id="@+id/set" android:layout_width="wrap_content" diff --git a/src/com/android/launcher2/Cling.java b/src/com/android/launcher2/Cling.java index 4f37cb9e0..09c5062ae 100644 --- a/src/com/android/launcher2/Cling.java +++ b/src/com/android/launcher2/Cling.java @@ -62,10 +62,6 @@ public class Cling extends FrameLayout { private Paint mErasePaint; - private View mWorkspaceDesc1; - private View mWorkspaceDesc2; - private View mAllAppsDesc; - public Cling(Context context) { this(context, null, 0); } @@ -98,10 +94,6 @@ public class Cling extends FrameLayout { r.getDimensionPixelSize(R.dimen.toolbar_button_horizontal_padding); mButtonBarHeight = r.getDimensionPixelSize(R.dimen.button_bar_height); - mWorkspaceDesc1 = findViewById(R.id.workspace_cling_move_item); - mWorkspaceDesc2 = findViewById(R.id.workspace_cling_open_all_apps); - mAllAppsDesc = findViewById(R.id.all_apps_cling_add_item); - mErasePaint = new Paint(); mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY)); mErasePaint.setColor(0xFFFFFF); @@ -140,11 +132,6 @@ public class Cling extends FrameLayout { double diff = Math.sqrt(Math.pow(event.getX() - pos[0], 2) + Math.pow(event.getY() - pos[1], 2)); if (diff < mRevealRadius) { - if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) { - // Do nothing - } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT)) { - // Do nothing - } return false; } } else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) || @@ -167,7 +154,7 @@ public class Cling extends FrameLayout { DisplayMetrics metrics = new DisplayMetrics(); mLauncher.getWindowManager().getDefaultDisplay().getMetrics(metrics); - // Draw the background + // Initialize the draw buffer (to allow punching through) Bitmap b = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 318601d0b..3c2c3daea 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -77,10 +77,10 @@ import android.view.Surface; import android.view.View; import android.view.View.OnLongClickListener; import android.view.ViewGroup; +import android.view.ViewParent; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.animation.AccelerateDecelerateInterpolator; -import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.inputmethod.InputMethodManager; import android.widget.Advanceable; @@ -3130,41 +3130,56 @@ public final class Launcher extends Activity anim.start(); } } + private void removeCling(int id) { + final View cling = findViewById(id); + if (cling != null) { + final ViewGroup parent = (ViewGroup) cling.getParent(); + parent.post(new Runnable() { + @Override + public void run() { + parent.removeView(cling); + } + }); + } + } public void showFirstRunWorkspaceCling() { - if (!isClingsEnabled()) return; - // Enable the clings only if they have not been dismissed before SharedPreferences prefs = getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE); - if (!prefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) { + if (isClingsEnabled() && !prefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) { initCling(R.id.workspace_cling, null, false, 0); + } else { + removeCling(R.id.workspace_cling); } } public void showFirstRunAllAppsCling(int[] position) { - if (!isClingsEnabled()) return; - // Enable the clings only if they have not been dismissed before SharedPreferences prefs = getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE); - if (!prefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) { + if (isClingsEnabled() && !prefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) { initCling(R.id.all_apps_cling, position, true, 0); + } else { + removeCling(R.id.all_apps_cling); } } public Cling showFirstRunFoldersCling() { - if (!isClingsEnabled()) return null; - // Enable the clings only if they have not been dismissed before SharedPreferences prefs = getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE); Cling cling = null; - if (!prefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) { + if (isClingsEnabled() && !prefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) { cling = initCling(R.id.folder_cling, null, true, 0); + } else { + removeCling(R.id.folder_cling); } return cling; } public boolean isFolderClingVisible() { Cling cling = (Cling) findViewById(R.id.folder_cling); - return cling.getVisibility() == View.VISIBLE; + if (cling != null) { + return cling.getVisibility() == View.VISIBLE; + } + return false; } public void dismissWorkspaceCling(View v) { Cling cling = (Cling) findViewById(R.id.workspace_cling); |