Make landscape all apps caret clickable when in all apps as well as workspace

-> Also increase the touch target size of the caret
-> Center the asset horizontally within the view (but keep it bottom
   asligned)

issue 63681599
issue 63682248

Change-Id: I64efdfb9f84b82cc21d82c10d9301a99fed3353a
This commit is contained in:
Adam Cohen 2017-07-14 14:22:05 -07:00
parent 5dcd5027ca
commit 5441a9d30a
4 changed files with 28 additions and 11 deletions

View File

@ -60,13 +60,6 @@
android:id="@+id/overview_panel"
android:visibility="gone" />
<com.android.launcher3.pageindicators.PageIndicatorCaretLandscape
android:id="@+id/page_indicator"
android:theme="@style/HomeScreenElementTheme"
android:layout_width="@dimen/dynamic_grid_min_page_indicator_size"
android:layout_height="@dimen/dynamic_grid_min_page_indicator_size"
android:layout_gravity="bottom|left"/>
<include layout="@layout/widgets_view"
android:id="@+id/widgets_view"
android:layout_width="match_parent"
@ -79,6 +72,13 @@
android:layout_height="match_parent"
android:visibility="invisible" />
<com.android.launcher3.pageindicators.PageIndicatorCaretLandscape
android:id="@+id/page_indicator"
android:theme="@style/HomeScreenElementTheme"
android:layout_width="@dimen/dynamic_grid_min_page_indicator_size"
android:layout_height="@dimen/dynamic_grid_min_page_indicator_size"
android:layout_gravity="bottom|left"/>
</com.android.launcher3.dragndrop.DragLayer>
</com.android.launcher3.LauncherRootView>

View File

@ -26,7 +26,7 @@
<!-- Dynamic grid -->
<dimen name="dynamic_grid_overview_bar_item_width">120dp</dimen>
<dimen name="dynamic_grid_min_page_indicator_size">24dp</dimen>
<dimen name="dynamic_grid_min_page_indicator_size">48dp</dimen>
<dimen name="folder_preview_padding">5dp</dimen>
<!-- Hotseat -->

View File

@ -2256,8 +2256,9 @@ public class Launcher extends BaseActivity
if (v instanceof FolderIcon) {
onClickFolderIcon(v);
}
} else if ((FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && v instanceof PageIndicator) ||
(v == mAllAppsButton && mAllAppsButton != null)) {
} else if ((FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && v instanceof PageIndicator)) {
onClickAllAppsCaret(v);
} else if (v == mAllAppsButton && mAllAppsButton != null) {
onClickAllAppsButton(v);
} else if (tag instanceof AppInfo) {
startAppShortcutOrInfoActivity(v);
@ -2322,6 +2323,22 @@ public class Launcher extends BaseActivity
}
}
/**
* Event handler for the swipe up caret
*
* @param v The view that was clicked.
*/
protected void onClickAllAppsCaret(View v) {
if (LOGD) Log.d(TAG, "onClickAllAppsCaret");
if (!isAppsViewVisible()) {
getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.ALL_APPS_BUTTON);
showAppsView(true /* animated */, true /* updatePredictedApps */);
} else {
showWorkspace(true);
}
}
private void onClickPendingAppItem(final View v, final String packageName,
boolean downloadStarted) {
if (downloadStarted) {

View File

@ -57,7 +57,7 @@ public class PageIndicatorCaretLandscape extends PageIndicator {
protected void onDraw(Canvas canvas) {
Rect drawableBounds = getCaretDrawable().getBounds();
int count = canvas.save();
canvas.translate(getWidth() - drawableBounds.width(),
canvas.translate((getWidth() - drawableBounds.width()) / 2,
getHeight() - drawableBounds.height());
getCaretDrawable().draw(canvas);
canvas.restoreToCount(count);