summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/AppWidgetResizeFrame.java28
-rw-r--r--src/com/android/launcher3/LauncherFiles.java10
-rw-r--r--src/com/android/launcher3/Workspace.java3
-rw-r--r--src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java36
-rw-r--r--src/com/android/launcher3/allapps/AlphabeticalAppsList.java8
-rw-r--r--src/com/android/launcher3/allapps/FloatingHeaderView.java8
-rw-r--r--src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java2
-rw-r--r--src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java1
-rw-r--r--src/com/android/launcher3/config/FeatureFlags.java2
-rw-r--r--src/com/android/launcher3/touch/WorkspaceTouchListener.java19
10 files changed, 65 insertions, 52 deletions
diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java
index bc4a5c343f..38ce740ff3 100644
--- a/src/com/android/launcher3/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher3/AppWidgetResizeFrame.java
@@ -15,7 +15,6 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
-import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -221,23 +220,6 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
mWidgetPadding = getDefaultPaddingForWidget(getContext(),
widgetView.getAppWidgetInfo().provider, null);
- // Only show resize handles for the directions in which resizing is possible.
- InvariantDeviceProfile idp = LauncherAppState.getIDP(cellLayout.getContext());
- mVerticalResizeActive = (info.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0
- && mMinVSpan < idp.numRows && mMaxVSpan > 1
- && mMinVSpan < mMaxVSpan;
- if (!mVerticalResizeActive) {
- mDragHandles[INDEX_TOP].setVisibility(GONE);
- mDragHandles[INDEX_BOTTOM].setVisibility(GONE);
- }
- mHorizontalResizeActive = (info.resizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0
- && mMinHSpan < idp.numColumns && mMaxHSpan > 1
- && mMinHSpan < mMaxHSpan;
- if (!mHorizontalResizeActive) {
- mDragHandles[INDEX_LEFT].setVisibility(GONE);
- mDragHandles[INDEX_RIGHT].setVisibility(GONE);
- }
-
mReconfigureButton = (ImageButton) findViewById(R.id.widget_reconfigure_button);
if (info.isReconfigurable()) {
mReconfigureButton.setVisibility(VISIBLE);
@@ -293,12 +275,10 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
}
public boolean beginResizeIfPointInRegion(int x, int y) {
- mLeftBorderActive = (x < mTouchTargetWidth) && mHorizontalResizeActive;
- mRightBorderActive = (x > getWidth() - mTouchTargetWidth) && mHorizontalResizeActive;
- mTopBorderActive = (y < mTouchTargetWidth + mTopTouchRegionAdjustment)
- && mVerticalResizeActive;
- mBottomBorderActive = (y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment)
- && mVerticalResizeActive;
+ mLeftBorderActive = x < mTouchTargetWidth;
+ mRightBorderActive = x > getWidth() - mTouchTargetWidth;
+ mTopBorderActive = y < mTouchTargetWidth + mTopTouchRegionAdjustment;
+ mBottomBorderActive = y > getHeight() - mTouchTargetWidth + mBottomTouchRegionAdjustment;
boolean anyBordersActive = mLeftBorderActive || mRightBorderActive
|| mTopBorderActive || mBottomBorderActive;
diff --git a/src/com/android/launcher3/LauncherFiles.java b/src/com/android/launcher3/LauncherFiles.java
index e59eac8dd2..583640eddc 100644
--- a/src/com/android/launcher3/LauncherFiles.java
+++ b/src/com/android/launcher3/LauncherFiles.java
@@ -17,10 +17,8 @@ public class LauncherFiles {
public static final String LAUNCHER_DB = "launcher.db";
public static final String LAUNCHER_6_BY_5_DB = "launcher_6_by_5.db";
+ public static final String LAUNCHER_5_BY_6_DB = "launcher_5_by_6.db";
public static final String LAUNCHER_4_BY_5_DB = "launcher_4_by_5.db";
- public static final String LAUNCHER_4_BY_4_DB = "launcher_4_by_4.db";
- public static final String LAUNCHER_3_BY_3_DB = "launcher_3_by_3.db";
- public static final String LAUNCHER_2_BY_2_DB = "launcher_2_by_2.db";
public static final String BACKUP_DB = "backup.db";
public static final String SHARED_PREFERENCES_KEY = "com.android.launcher3.prefs";
public static final String MANAGED_USER_PREFERENCES_KEY =
@@ -34,10 +32,8 @@ public class LauncherFiles {
public static final List<String> GRID_DB_FILES = Collections.unmodifiableList(Arrays.asList(
LAUNCHER_DB,
LAUNCHER_6_BY_5_DB,
- LAUNCHER_4_BY_5_DB,
- LAUNCHER_4_BY_4_DB,
- LAUNCHER_3_BY_3_DB,
- LAUNCHER_2_BY_2_DB));
+ LAUNCHER_5_BY_6_DB,
+ LAUNCHER_4_BY_5_DB));
public static final List<String> OTHER_FILES = Collections.unmodifiableList(Arrays.asList(
BACKUP_DB,
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index ba492d57e2..482a1c5e35 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2150,8 +2150,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
private Runnable getWidgetResizeFrameRunnable(DragOptions options,
LauncherAppWidgetHostView hostView, CellLayout cellLayout) {
AppWidgetProviderInfo pInfo = hostView.getAppWidgetInfo();
- if (pInfo != null && pInfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE
- && !options.isAccessibleDrag) {
+ if (pInfo != null && !options.isAccessibleDrag) {
return () -> {
if (!isPageInTransition()) {
AppWidgetResizeFrame.showForWidget(hostView, cellLayout);
diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
index bc8c23e310..fe914dc028 100644
--- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
@@ -103,7 +103,8 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
public static final float PULL_MULTIPLIER = .02f;
public static final float FLING_VELOCITY_MULTIPLIER = 1200f;
protected static final String BUNDLE_KEY_CURRENT_PAGE = "launcher.allapps.current_page";
- private static final long DEFAULT_SEARCH_TRANSITION_DURATION_MS = 300;
+ // As of this writing, search transition does not seem to work properly, so set duration to 0.
+ private static final long DEFAULT_SEARCH_TRANSITION_DURATION_MS = 0;
// Render the header protection at all times to debug clipping issues.
private static final boolean DEBUG_HEADER_PROTECTION = false;
/** Context of an activity or window that is inflating this container. */
@@ -332,6 +333,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
// If exiting search, revert predictive back scale on all apps
mAllAppsTransitionController.animateAllAppsToNoScale();
}
+ setScrollbarVisibility(!goingToSearch);
mSearchTransitionController.animateToSearchState(goingToSearch, durationMs,
/* onEndRunnable = */ () -> {
mIsSearching = goingToSearch;
@@ -595,13 +597,22 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
tabsHidden);
int padding = mHeader.getMaxTranslation();
- mAH.forEach(adapterHolder -> {
- adapterHolder.mPadding.top = padding;
+ for (int i = 0; i < mAH.size(); i++) {
+ final AdapterHolder adapterHolder = mAH.get(i);
+ // Search and other adapters need to be handled a bit differently; otherwise, when
+ // when leaving search, the All Apps view may be noticeably shifted downward because
+ // its padding was unnecessarily impacted, and never restored, upon entering search.
+ if (i != AdapterHolder.SEARCH && !tabsHidden && mHeader.getFloatingRowsHeight() == 0) {
+ // Only the Search adapter needs padding when there are tabs but no floating rows.
+ adapterHolder.mPadding.top = 0;
+ } else {
+ adapterHolder.mPadding.top = padding;
+ }
adapterHolder.applyPadding();
if (adapterHolder.mRecyclerView != null) {
adapterHolder.mRecyclerView.scrollToTop();
}
- });
+ }
removeCustomRules(mHeader);
if (!isSearchSupported()) {
@@ -625,6 +636,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
mTabsProtectionAlpha = tabsAlpha;
invalidateHeader();
}
+ getSearchView().setBackgroundResource(R.drawable.bg_all_apps_searchbox);
if (mSearchUiManager.getEditText() == null) {
return;
}
@@ -664,13 +676,15 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
}
RelativeLayout.LayoutParams layoutParams = (LayoutParams) v.getLayoutParams();
- layoutParams.addRule(RelativeLayout.ALIGN_TOP, R.id.search_container_all_apps);
+ layoutParams.addRule(RelativeLayout.BELOW, R.id.search_container_all_apps);
int topMargin = getContext().getResources().getDimensionPixelSize(
- R.dimen.all_apps_header_top_margin);
+ R.dimen.all_apps_search_bar_bottom_adjustment);
if (includeTabsMargin) {
topMargin += getContext().getResources().getDimensionPixelSize(
- R.dimen.all_apps_header_pill_height);
+ R.dimen.all_apps_header_pill_height)
+ + getContext().getResources().getDimensionPixelSize(
+ R.dimen.all_apps_tabs_margin_top);
}
layoutParams.topMargin = topMargin;
}
@@ -707,6 +721,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
layoutParams.removeRule(RelativeLayout.ABOVE);
layoutParams.removeRule(RelativeLayout.ALIGN_TOP);
layoutParams.removeRule(RelativeLayout.ALIGN_PARENT_TOP);
+ layoutParams.removeRule(RelativeLayout.BELOW);
}
protected BaseAllAppsAdapter<T> createAdapter(AlphabeticalAppsList<T> appsList) {
@@ -1001,6 +1016,13 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
}
}
+ protected void setScrollbarVisibility(boolean visible) {
+ AllAppsRecyclerView rv = getActiveRecyclerView();
+ if (rv != null && rv.getScrollbar() != null) {
+ rv.getScrollbar().setVisibility(visible ? VISIBLE : GONE);
+ }
+ }
+
protected void updateSearchResultsVisibility() {
if (isSearching()) {
getSearchRecyclerView().setVisibility(VISIBLE);
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index 29767bf465..2567fab1d6 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -20,6 +20,7 @@ import android.content.Context;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DiffUtil;
+import com.android.launcher3.R;
import com.android.launcher3.allapps.BaseAllAppsAdapter.AdapterItem;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
@@ -28,7 +29,6 @@ import com.android.launcher3.views.ActivityContext;
import java.util.ArrayList;
import java.util.List;
-import java.util.Locale;
import java.util.Objects;
import java.util.TreeMap;
import java.util.function.Predicate;
@@ -85,6 +85,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
private final int mNumAppsPerRowAllApps;
private int mNumAppRowsInAdapter;
private Predicate<ItemInfo> mItemFilter;
+ private final boolean mSortSections;
public AlphabeticalAppsList(Context context, @Nullable AllAppsStore appsStore,
WorkProfileManager workProfileManager) {
@@ -96,6 +97,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
if (mAllAppsStore != null) {
mAllAppsStore.addUpdateListener(this);
}
+ mSortSections = context.getResources().getBoolean(R.bool.config_appsListSortSections);
}
public void updateItemFilter(Predicate<ItemInfo> itemFilter) {
@@ -201,9 +203,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
// As a special case for some languages (currently only Simplified Chinese), we may need to
// coalesce sections
- Locale curLocale = mActivityContext.getResources().getConfiguration().locale;
- boolean localeRequiresSectionSorting = curLocale.equals(Locale.SIMPLIFIED_CHINESE);
- if (localeRequiresSectionSorting) {
+ if (mSortSections) {
// Compute the section headers. We use a TreeMap with the section name comparator to
// ensure that the sections are ordered when we iterate over it later
appSteam = appSteam.collect(Collectors.groupingBy(
diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java
index b3ea3ab225..050e8101d0 100644
--- a/src/com/android/launcher3/allapps/FloatingHeaderView.java
+++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java
@@ -225,7 +225,6 @@ public class FloatingHeaderView extends LinearLayout implements
for (FloatingHeaderRow row : mAllRows) {
row.setup(this, mAllRows, tabsHidden);
}
- updateExpectedHeight();
mTabsHidden = tabsHidden;
mTabLayout.setVisibility(tabsHidden ? View.GONE : View.VISIBLE);
@@ -250,6 +249,8 @@ public class FloatingHeaderView extends LinearLayout implements
rvType == AdapterHolder.MAIN ? mMainRV
: rvType == AdapterHolder.WORK ? mWorkRV : mSearchRV;
mCurrentRV.addOnScrollListener(mOnScrollListener);
+
+ updateExpectedHeight();
}
private void updateExpectedHeight() {
@@ -259,10 +260,7 @@ public class FloatingHeaderView extends LinearLayout implements
return;
}
mMaxTranslation += mFloatingRowsHeight;
- if (!mTabsHidden) {
- mMaxTranslation += mTabsAdditionalPaddingBottom
- + getResources().getDimensionPixelSize(R.dimen.all_apps_tabs_margin_top);
- }
+ // No need for mMaxTranslation to be any taller now that we align below the header.
}
int getMaxTranslation() {
diff --git a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
index 4427a49dab..f94658c404 100644
--- a/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
+++ b/src/com/android/launcher3/allapps/search/AllAppsSearchBarController.java
@@ -132,7 +132,7 @@ public class AllAppsSearchBarController
public boolean onBackKey() {
// Only hide the search field if there is no query
String query = Utilities.trim(mInput.getEditableText().toString());
- if (query.isEmpty()) {
+ if (!query.isEmpty()) {
reset();
return true;
}
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index 78c305b2eb..d83efd6c16 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -77,7 +77,6 @@ public class AppsSearchContainerLayout extends ExtendedEditText
mSearchQueryBuilder = new SpannableStringBuilder();
Selection.setSelection(mSearchQueryBuilder, 0);
- setHint(prefixTextWithIcon(getContext(), R.drawable.ic_allapps_search, getHint()));
mContentOverlap =
getResources().getDimensionPixelSize(R.dimen.all_apps_search_bar_content_overlap);
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index b7e6378047..832cb31eb4 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -192,7 +192,7 @@ public final class FeatureFlags {
"Uses two panel on home screen. Only applicable on large screen devices.");
public static final BooleanFlag ENABLE_SCRIM_FOR_APP_LAUNCH = getDebugFlag(270393276,
- "ENABLE_SCRIM_FOR_APP_LAUNCH", false,
+ "ENABLE_SCRIM_FOR_APP_LAUNCH", true,
"Enables scrim during app launch animation.");
public static final BooleanFlag ENABLE_ENFORCED_ROUNDED_CORNERS = getReleaseFlag(270393258,
diff --git a/src/com/android/launcher3/touch/WorkspaceTouchListener.java b/src/com/android/launcher3/touch/WorkspaceTouchListener.java
index 96ae4a32fd..9fcb4d9156 100644
--- a/src/com/android/launcher3/touch/WorkspaceTouchListener.java
+++ b/src/com/android/launcher3/touch/WorkspaceTouchListener.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.touch;
+import static android.provider.Settings.Secure.DOUBLE_TAP_SLEEP_GESTURE;
+
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_MOVE;
@@ -26,8 +28,12 @@ import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_CLOSE_TAP_OUTSIDE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORKSPACE_LONGPRESS;
+import android.content.ContentResolver;
+import android.content.Context;
import android.graphics.PointF;
import android.graphics.Rect;
+import android.os.PowerManager;
+import android.provider.Settings;
import android.view.GestureDetector;
import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
@@ -71,15 +77,21 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe
private int mLongPressState = STATE_CANCELLED;
+ private final PowerManager mPm;
+
private final GestureDetector mGestureDetector;
+ private final ContentResolver mContentResolver;
+
public WorkspaceTouchListener(Launcher launcher, Workspace<?> workspace) {
mLauncher = launcher;
mWorkspace = workspace;
// Use twice the touch slop as we are looking for long press which is more
// likely to cause movement.
mTouchSlop = 2 * ViewConfiguration.get(launcher).getScaledTouchSlop();
+ mPm = (PowerManager) workspace.getContext().getSystemService(Context.POWER_SERVICE);
mGestureDetector = new GestureDetector(workspace.getContext(), this);
+ mContentResolver = workspace.getContext().getContentResolver();
}
@Override
@@ -210,4 +222,11 @@ public class WorkspaceTouchListener extends GestureDetector.SimpleOnGestureListe
}
}
}
+
+ @Override
+ public boolean onDoubleTap(MotionEvent event) {
+ if (Settings.Secure.getInt(mContentResolver, DOUBLE_TAP_SLEEP_GESTURE, 0) == 1)
+ mPm.goToSleep(event.getEventTime());
+ return true;
+ }
}