Minor fixes to Launcher

- Tweaking the AllApps tab padding
- Fixing issue where the cling punch out might be in the wrong location
- Removing unused dragging code related to drop/scroll area overlap
- Tweaking padding so that picking up an icon on the top row does not automatically hover over delete (Bug 5636264)
- Fixing issue where multiple bgs in AllApps tab bar line makes it look blurry (Bug 5523822)

Change-Id: I707397c231188a9feee8c0856374e0483cf37296
This commit is contained in:
Winson Chung 2011-11-17 14:58:51 -08:00
parent b0736fac73
commit 3f4e142380
11 changed files with 64 additions and 49 deletions

View File

@ -16,7 +16,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_holo" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_holo" />
<!-- Focused states -->

View File

@ -19,8 +19,8 @@
style="@style/MarketButton"
android:onClick="onClickAppMarketButton"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:drawablePadding="10dp"
android:text="@string/market"
android:contentDescription="@string/market"
@ -32,6 +32,5 @@
android:shadowDx="0.0"
android:shadowDy="0.0"
android:shadowRadius="2.0"
android:background="@drawable/tab_widget_indicator_selector"
android:focusable="true"
android:clickable="true" />

View File

@ -19,13 +19,12 @@
style="@style/MarketButton"
android:onClick="onClickAppMarketButton"
android:gravity="center"
android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
android:paddingRight="@dimen/toolbar_button_horizontal_padding"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:contentDescription="@string/market"
android:shadowColor="@color/workspace_all_apps_and_delete_zone_text_shadow_color"
android:shadowDx="0.0"
android:shadowDy="0.0"
android:shadowRadius="2.0"
android:background="@drawable/tab_widget_indicator_selector"
android:focusable="true"
android:clickable="true" />

View File

@ -65,10 +65,5 @@
<item name="android:shadowDy">1.0</item>
<item name="android:shadowRadius">4.0</item>
</style>
<style name="TabIndicator.AppsCustomize">
<item name="android:paddingTop">5dp</item>
<item name="android:paddingBottom">10dp</item>
</style>
</resources>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->
<resources>
<!-- Drag padding to add to the bottom of drop targets -->
<dimen name="drop_target_drag_padding">20dp</dimen>
</resources>

View File

@ -79,10 +79,8 @@
<item name="android:textSize">13sp</item>
</style>
<style name="TabIndicator.AppsCustomize">
<item name="android:paddingTop">16dp</item>
<item name="android:paddingBottom">20dp</item>
<item name="android:paddingLeft">48dp</item>
<item name="android:paddingRight">48dp</item>
<item name="android:paddingLeft">32dp</item>
<item name="android:paddingRight">32dp</item>
<item name="android:textSize">14sp</item>
</style>
@ -124,8 +122,8 @@
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center_vertical</item>
<item name="android:drawablePadding">7.5dp</item>
<item name="android:paddingLeft">25dp</item>
<item name="android:paddingRight">25dp</item>
<item name="android:paddingLeft">60dp</item>
<item name="android:paddingRight">60dp</item>
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:textSize">16sp</item>
<item name="android:shadowColor">#393939</item>

View File

@ -79,9 +79,6 @@
<dimen name="button_bar_width_right_padding">0dp</dimen>
<dimen name="button_bar_height_plus_padding">70dp</dimen>
<!-- Drag padding to add to the drop targets -->
<dimen name="drop_target_drag_padding">40dp</dimen>
<!-- extra horizontal spacing between mini screen thumbnails ie. in all
apps and in customization mode -->
<dimen name="smallScreenExtraSpacing">0dip</dimen>
@ -91,6 +88,9 @@
<dimen name="allAppsSmallScreenVerticalMarginLandscape">30dip</dimen>
<dimen name="allAppsSmallScreenVerticalMarginPortrait">60dip</dimen>
<!-- Drag padding to add to the bottom of drop targets -->
<dimen name="drop_target_drag_padding">14dp</dimen>
<!-- padding between the delete zone drawable and text -->
<dimen name="delete_zone_drawable_padding">8dip</dimen>

View File

@ -161,8 +161,8 @@
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:gravity">center</item>
<item name="android:paddingLeft">30dp</item>
<item name="android:paddingRight">30dp</item>
<item name="android:paddingLeft">24dp</item>
<item name="android:paddingRight">24dp</item>
<item name="android:background">@drawable/tab_widget_indicator_selector</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">12sp</item>

View File

@ -193,6 +193,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
private ArrayList<Object> mWidgets;
// Cling
private boolean mHasShownAllAppsCling;
private int mClingFocusedX;
private int mClingFocusedY;
@ -396,14 +397,33 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int page = getPageForComponent(mSaveInstanceStateItemIndex);
invalidatePageData(Math.max(0, page));
// Calculate the position for the cling punch through
int[] offset = new int[2];
int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY);
mLauncher.getDragLayer().getLocationInDragLayer(this, offset);
pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 + offset[0];
pos[1] += (getMeasuredHeight() - mWidgetSpacingLayout.getMeasuredHeight()) / 2 + offset[1];
mLauncher.showFirstRunAllAppsCling(pos);
// Show All Apps cling if we are finished transitioning, otherwise, we will try again when
// the transition completes in AppsCustomizeTabHost (otherwise the wrong offsets will be
// returned while animating)
AppsCustomizeTabHost host = (AppsCustomizeTabHost) getTabHost();
if (!host.isTransitioning()) {
post(new Runnable() {
@Override
public void run() {
showAllAppsCling();
}
});
}
}
void showAllAppsCling() {
if (!mHasShownAllAppsCling && isDataReady() && testDataReady()) {
mHasShownAllAppsCling = true;
// Calculate the position for the cling punch through
int[] offset = new int[2];
int[] pos = mWidgetSpacingLayout.estimateCellPosition(mClingFocusedX, mClingFocusedY);
mLauncher.getDragLayer().getLocationInDragLayer(this, offset);
// PagedViews are centered horizontally but top aligned
pos[0] += (getMeasuredWidth() - mWidgetSpacingLayout.getMeasuredWidth()) / 2 +
offset[0];
pos[1] += offset[1];
mLauncher.showFirstRunAllAppsCling(pos);
}
}
@Override

View File

@ -388,8 +388,9 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
}
if (!toWorkspace) {
// Dismiss the cling if necessary
// Dismiss the workspace cling and show the all apps cling (if not already shown)
l.dismissWorkspaceCling(null);
mAppsCustomizePane.showAllAppsCling();
if (!LauncherApplication.isScreenLarge()) {
mAppsCustomizePane.hideScrollingIndicator(false);

View File

@ -101,7 +101,6 @@ public class DragController {
private int mScrollState = SCROLL_OUTSIDE_ZONE;
private ScrollRunnable mScrollRunnable = new ScrollRunnable();
private RectF mDeleteRegion;
private DropTarget mLastDropTarget;
private InputMethodManager mInputMethodManager;
@ -486,12 +485,6 @@ public class DragController {
}
mLastDropTarget = dropTarget;
// Scroll, maybe, but not if we're in the delete region.
boolean inDeleteRegion = false;
if (mDeleteRegion != null) {
inDeleteRegion = mDeleteRegion.contains(x, y);
}
// After a scroll, the touch point will still be in the scroll region.
// Rather than scrolling immediately, require a bit of twiddling to scroll again
final int slop = ViewConfiguration.get(mLauncher).getScaledWindowTouchSlop();
@ -500,7 +493,7 @@ public class DragController {
mLastTouch[0] = x;
mLastTouch[1] = y;
if (!inDeleteRegion && x < mScrollZone) {
if (x < mScrollZone) {
if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) {
mScrollState = SCROLL_WAITING_IN_ZONE;
if (mDragScroller.onEnterScrollArea(x, y, SCROLL_LEFT)) {
@ -508,7 +501,7 @@ public class DragController {
mHandler.postDelayed(mScrollRunnable, SCROLL_DELAY);
}
}
} else if (!inDeleteRegion && x > mScrollView.getWidth() - mScrollZone) {
} else if (x > mScrollView.getWidth() - mScrollZone) {
if (mScrollState == SCROLL_OUTSIDE_ZONE && mDistanceSinceScroll > slop) {
mScrollState = SCROLL_WAITING_IN_ZONE;
if (mDragScroller.onEnterScrollArea(x, y, SCROLL_RIGHT)) {
@ -669,15 +662,6 @@ public class DragController {
mScrollView = v;
}
/**
* Specifies the delete region. We won't scroll on touch events over the delete region.
*
* @param region The rectangle in DragLayer coordinates of the delete region.
*/
void setDeleteRegion(RectF region) {
mDeleteRegion = region;
}
DragView getDragView() {
return mDragObject.dragView;
}