diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-10-26 16:26:13 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-10-27 02:44:49 +0000 |
commit | 4d49f9a8ac86ccaf5f6f3d80dd8694310b620364 (patch) | |
tree | 1b00388c891173d4d795554ae83b4d113a364248 | |
parent | 4fc994c98875b4797d3c491c8c8353c8cc6b8915 (diff) | |
download | android_packages_apps_Trebuchet-4d49f9a8ac86ccaf5f6f3d80dd8694310b620364.tar.gz android_packages_apps_Trebuchet-4d49f9a8ac86ccaf5f6f3d80dd8694310b620364.tar.bz2 android_packages_apps_Trebuchet-4d49f9a8ac86ccaf5f6f3d80dd8694310b620364.zip |
Removing animated caret drawable
> Both landscape and portrait UI will show a static drag handle
> In landscape the handle is drawn below the all-apps scrim,
while in portrait it moves with the hotseat
Change-Id: Ia6964c6f98feb8ba90517e23667d8c68bc2f6d35
-rw-r--r-- | res/drawable/all_apps_handle_landscape.xml | 37 | ||||
-rw-r--r-- | res/drawable/all_apps_handle_portrait.xml | 34 | ||||
-rw-r--r-- | res/layout-land/launcher.xml | 20 | ||||
-rw-r--r-- | res/layout/page_indicator.xml | 5 | ||||
-rw-r--r-- | res/values/dimens.xml | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsCaretController.java | 120 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsTransitionController.java | 6 | ||||
-rw-r--r-- | src/com/android/launcher3/pageindicators/CaretDrawable.java | 152 | ||||
-rw-r--r-- | src/com/android/launcher3/pageindicators/PageIndicator.java | 23 | ||||
-rw-r--r-- | src/com/android/launcher3/pageindicators/PageIndicatorLandscape.java (renamed from src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java) | 27 | ||||
-rw-r--r-- | src/com/android/launcher3/pageindicators/PageIndicatorLine.java (renamed from src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java) | 36 |
11 files changed, 108 insertions, 355 deletions
diff --git a/res/drawable/all_apps_handle_landscape.xml b/res/drawable/all_apps_handle_landscape.xml new file mode 100644 index 000000000..23826ab06 --- /dev/null +++ b/res/drawable/all_apps_handle_landscape.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2017 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. +--> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="13dp" + android:height="13dp" + android:viewportWidth="13.0" + android:viewportHeight="13.0" > + + <path + android:pathData="M2 8.5L6.5 4L11 8.5" + android:strokeColor="?attr/workspaceAmbientShadowColor" + android:strokeWidth="4" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> + + <path + android:pathData="M2 8.5L6.5 4L11 8.5" + android:strokeColor="?attr/workspaceTextColor" + android:strokeWidth="2" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> + +</vector> diff --git a/res/drawable/all_apps_handle_portrait.xml b/res/drawable/all_apps_handle_portrait.xml new file mode 100644 index 000000000..75aa44853 --- /dev/null +++ b/res/drawable/all_apps_handle_portrait.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2017 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. +--> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="16dp" + android:height="13dp" + android:viewportWidth="16.0" + android:viewportHeight="13.0" > + + <path + android:pathData="M2 6h12" + android:strokeColor="?attr/workspaceAmbientShadowColor" + android:strokeWidth="4" + android:strokeLineCap="round" /> + + <path + android:pathData="M2 6h12" + android:strokeColor="?attr/workspaceTextColor" + android:strokeWidth="2" + android:strokeLineCap="round" /> +</vector>
\ No newline at end of file diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml index 0c7999ec7..4ea32b46f 100644 --- a/res/layout-land/launcher.xml +++ b/res/layout-land/launcher.xml @@ -42,6 +42,19 @@ android:layout_gravity="center" launcher:pageIndicator="@id/page_indicator" /> + <com.android.launcher3.pageindicators.PageIndicatorLandscape + 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"> + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/all_apps_handle_landscape" + android:layout_gravity="center" /> + </com.android.launcher3.pageindicators.PageIndicatorLandscape> + <include layout="@layout/gradient_bg" /> <!-- DO NOT CHANGE THE ID --> @@ -66,13 +79,6 @@ 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> diff --git a/res/layout/page_indicator.xml b/res/layout/page_indicator.xml index 92f52d672..2df511b57 100644 --- a/res/layout/page_indicator.xml +++ b/res/layout/page_indicator.xml @@ -14,7 +14,7 @@ limitations under the License. --> -<com.android.launcher3.pageindicators.PageIndicatorLineCaret +<com.android.launcher3.pageindicators.PageIndicatorLine xmlns:android="http://schemas.android.com/apk/res/android" android:theme="@style/HomeScreenElementTheme" android:layout_width="match_parent" @@ -23,6 +23,7 @@ android:id="@+id/all_apps_handle" android:layout_width="48dp" android:layout_height="@dimen/dynamic_grid_min_page_indicator_size" + android:src="@drawable/all_apps_handle_portrait" android:layout_gravity="top|center" android:scaleType="centerInside"/> -</com.android.launcher3.pageindicators.PageIndicatorLineCaret> +</com.android.launcher3.pageindicators.PageIndicatorLine> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 481199e73..eb12dc821 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -86,9 +86,6 @@ <dimen name="all_apps_empty_search_bg_top_offset">144dp</dimen> <dimen name="all_apps_background_canvas_width">700dp</dimen> <dimen name="all_apps_background_canvas_height">475dp</dimen> - <dimen name="all_apps_caret_stroke_width">2dp</dimen> - <dimen name="all_apps_caret_shadow_spread">1dp</dimen> - <dimen name="all_apps_caret_size">13dp</dimen> <dimen name="all_apps_caret_workspace_offset">18dp</dimen> <!-- Search bar in All Apps --> diff --git a/src/com/android/launcher3/allapps/AllAppsCaretController.java b/src/com/android/launcher3/allapps/AllAppsCaretController.java deleted file mode 100644 index 81d005a70..000000000 --- a/src/com/android/launcher3/allapps/AllAppsCaretController.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ -package com.android.launcher3.allapps; - -import android.animation.ObjectAnimator; - -import com.android.launcher3.Launcher; -import com.android.launcher3.R; -import com.android.launcher3.anim.Interpolators; -import com.android.launcher3.pageindicators.CaretDrawable; -import com.android.launcher3.touch.SwipeDetector; - -public class AllAppsCaretController { - // Determines when the caret should flip. Should be accessed via getThreshold() - private static final float CARET_THRESHOLD = 0.015f; - private static final float CARET_THRESHOLD_LAND = 0.5f; - // The velocity at which the caret will peak (i.e. exhibit a 90 degree bend) - private static final float PEAK_VELOCITY = SwipeDetector.RELEASE_VELOCITY_PX_MS * .7f; - - private Launcher mLauncher; - - private ObjectAnimator mCaretAnimator; - private CaretDrawable mCaretDrawable; - private float mLastCaretProgress; - private boolean mThresholdCrossed; - - public AllAppsCaretController(CaretDrawable caret, Launcher launcher) { - mLauncher = launcher; - mCaretDrawable = caret; - - final long caretAnimationDuration = launcher.getResources().getInteger( - R.integer.config_caretAnimationDuration); - - // We will set values later - mCaretAnimator = ObjectAnimator.ofFloat(mCaretDrawable, "caretProgress", 0); - mCaretAnimator.setDuration(caretAnimationDuration); - mCaretAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); - } - - /** - * Updates the state of the caret based on the progress of the {@link AllAppsContainerView}, as - * defined by the {@link AllAppsTransitionController}. Uses the container's velocity to adjust - * angle of caret. - * - * @param containerProgress The progress of the container in the range [0..1] - * @param velocity The velocity of the container - * @param dragging {@code true} if the container is being dragged - */ - public void updateCaret(float containerProgress, float velocity, boolean dragging) { - // If we're in portrait and the shift is not 0 or 1, adjust the caret based on velocity - if (getThreshold() < containerProgress && containerProgress < 1 - getThreshold() && - !mLauncher.useVerticalBarLayout()) { - mThresholdCrossed = true; - - // How fast are we moving as a percentage of the peak velocity? - final float pctOfFlingVelocity = Math.max(-1, Math.min(velocity / PEAK_VELOCITY, 1)); - - mCaretDrawable.setCaretProgress(pctOfFlingVelocity); - - // Set the last caret progress to this progress to prevent animator cancellation - mLastCaretProgress = pctOfFlingVelocity; - // Animate to neutral. This is necessary so the caret doesn't "freeze" when the - // container stops moving (e.g., during a drag or when the threshold is reached). - animateCaretToProgress(CaretDrawable.PROGRESS_CARET_NEUTRAL); - } else if (!dragging) { - // Otherwise, if we're not dragging, match the caret to the appropriate state - if (containerProgress <= getThreshold()) { // All Apps is up - animateCaretToProgress(CaretDrawable.PROGRESS_CARET_POINTING_DOWN); - } else if (containerProgress >= 1 - getThreshold()) { // All Apps is down - animateCaretToProgress(CaretDrawable.PROGRESS_CARET_POINTING_UP); - } - } - } - - private void animateCaretToProgress(float progress) { - // If the new progress is the same as the last progress we animated to, terminate early - if (Float.compare(mLastCaretProgress, progress) == 0) { - return; - } - - if (mCaretAnimator.isRunning()) { - mCaretAnimator.cancel(); // Stop the animator in its tracks - } - - // Update the progress and start the animation - mLastCaretProgress = progress; - mCaretAnimator.setFloatValues(progress); - mCaretAnimator.start(); - } - - private float getThreshold() { - // In landscape, just return the landscape threshold. - if (mLauncher.useVerticalBarLayout()) { - return CARET_THRESHOLD_LAND; - } - - // Before the threshold is crossed, it is reported as zero. This makes the caret immediately - // responsive when a drag begins. After the threshold is crossed, we return the constant - // value. This means the caret will start its state-based adjustment sooner. That is, we - // won't have to wait until the panel is completely settled to begin animation. - return mThresholdCrossed ? CARET_THRESHOLD : 0f; - } - - public void onDragStart() { - mThresholdCrossed = false; - } -} diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 080f4dcca..a84172ddf 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -81,8 +81,6 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect private Workspace mWorkspace; private Hotseat mHotseat; - private AllAppsCaretController mCaretController; - private final Launcher mLauncher; private final SwipeDetector mDetector; private final boolean mIsDarkTheme; @@ -193,7 +191,6 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect @Override public void onDragStart(boolean start) { - mCaretController.onDragStart(); mLauncher.getStateManager().cancelAnimation(); cancelDiscoveryAnimation(); mShiftStart = mAppsView.getTranslationY(); @@ -349,7 +346,6 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect System.currentTimeMillis()); } - mCaretController.updateCaret(progress, mContainerVelocity, mDetector.isDraggingState()); updateLightStatusBar(shiftCurrent); } @@ -479,8 +475,6 @@ public class AllAppsTransitionController implements TouchController, SwipeDetect mHotseat = hotseat; mWorkspace = workspace; mHotseat.bringToFront(); - mCaretController = new AllAppsCaretController( - mWorkspace.getPageIndicator().getCaretDrawable(), mLauncher); mAppsView.getSearchUiManager().addOnScrollRangeChangeListener(this); mSpringAnimationHandler = mAppsView.getSpringAnimationHandler(); mSearchSpring = mAppsView.getSearchUiManager().getSpringForFling(); diff --git a/src/com/android/launcher3/pageindicators/CaretDrawable.java b/src/com/android/launcher3/pageindicators/CaretDrawable.java deleted file mode 100644 index 5ade49728..000000000 --- a/src/com/android/launcher3/pageindicators/CaretDrawable.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ -package com.android.launcher3.pageindicators; - -import android.content.Context; -import android.content.res.Resources; -import android.graphics.Canvas; -import android.graphics.ColorFilter; -import android.graphics.Paint; -import android.graphics.Path; -import android.graphics.PixelFormat; -import android.graphics.drawable.Drawable; - -import com.android.launcher3.R; -import com.android.launcher3.util.Themes; - -public class CaretDrawable extends Drawable { - public static final float PROGRESS_CARET_POINTING_UP = -1f; - public static final float PROGRESS_CARET_POINTING_DOWN = 1f; - public static final float PROGRESS_CARET_NEUTRAL = 0; - - private float mCaretProgress = PROGRESS_CARET_NEUTRAL; - - private Paint mShadowPaint = new Paint(); - private Paint mCaretPaint = new Paint(); - private Path mPath = new Path(); - private final int mCaretSizePx; - private final boolean mUseShadow; - - public CaretDrawable(Context context) { - final Resources res = context.getResources(); - - final int strokeWidth = res.getDimensionPixelSize(R.dimen.all_apps_caret_stroke_width); - final int shadowSpread = res.getDimensionPixelSize(R.dimen.all_apps_caret_shadow_spread); - - mCaretPaint.setColor(Themes.getAttrColor(context, R.attr.workspaceTextColor)); - mCaretPaint.setAntiAlias(true); - mCaretPaint.setStrokeWidth(strokeWidth); - mCaretPaint.setStyle(Paint.Style.STROKE); - mCaretPaint.setStrokeCap(Paint.Cap.ROUND); - mCaretPaint.setStrokeJoin(Paint.Join.ROUND); - - mShadowPaint.setColor(res.getColor(R.color.default_shadow_color_no_alpha)); - mShadowPaint.setAlpha(Themes.getAlpha(context, android.R.attr.spotShadowAlpha)); - mShadowPaint.setAntiAlias(true); - mShadowPaint.setStrokeWidth(strokeWidth + (shadowSpread * 2)); - mShadowPaint.setStyle(Paint.Style.STROKE); - mShadowPaint.setStrokeCap(Paint.Cap.ROUND); - mShadowPaint.setStrokeJoin(Paint.Join.ROUND); - - mUseShadow = !Themes.getAttrBoolean(context, R.attr.isWorkspaceDarkText); - mCaretSizePx = res.getDimensionPixelSize(R.dimen.all_apps_caret_size); - } - - @Override - public int getIntrinsicHeight() { - return mCaretSizePx; - } - - @Override - public int getIntrinsicWidth() { - return mCaretSizePx; - } - - @Override - public void draw(Canvas canvas) { - // Assumes caret paint is more important than shadow paint - if (Float.compare(mCaretPaint.getAlpha(), 0f) == 0) { - return; - } - - // Assumes shadow stroke width is larger - final float width = getBounds().width() - mShadowPaint.getStrokeWidth(); - final float height = getBounds().height() - mShadowPaint.getStrokeWidth(); - final float left = getBounds().left + (mShadowPaint.getStrokeWidth() / 2); - final float top = getBounds().top + (mShadowPaint.getStrokeWidth() / 2); - - // When the bounds are square, this will result in a caret with a right angle - final float verticalInset = (height / 4); - final float caretHeight = (height - (verticalInset * 2)); - - mPath.reset(); - mPath.moveTo(left, top + caretHeight * (1 - getNormalizedCaretProgress())); - mPath.lineTo(left + (width / 2), top + caretHeight * getNormalizedCaretProgress()); - mPath.lineTo(left + width, top + caretHeight * (1 - getNormalizedCaretProgress())); - if (mUseShadow) { - canvas.drawPath(mPath, mShadowPaint); - } - canvas.drawPath(mPath, mCaretPaint); - } - - /** - * Sets the caret progress - * - * @param progress The progress ({@value #PROGRESS_CARET_POINTING_UP} for pointing up, - * {@value #PROGRESS_CARET_POINTING_DOWN} for pointing down, {@value #PROGRESS_CARET_NEUTRAL} - * for neutral) - */ - public void setCaretProgress(float progress) { - mCaretProgress = progress; - invalidateSelf(); - } - - /** - * Returns the caret progress - * - * @return The progress - */ - public float getCaretProgress() { - return mCaretProgress; - } - - /** - * Returns the caret progress normalized to [0..1] - * - * @return The normalized progress - */ - public float getNormalizedCaretProgress() { - return (mCaretProgress - PROGRESS_CARET_POINTING_UP) / - (PROGRESS_CARET_POINTING_DOWN - PROGRESS_CARET_POINTING_UP); - } - - @Override - public int getOpacity() { - return PixelFormat.TRANSLUCENT; - } - - @Override - public void setAlpha(int alpha) { - mCaretPaint.setAlpha(alpha); - mShadowPaint.setAlpha(alpha); - invalidateSelf(); - } - - @Override - public void setColorFilter(ColorFilter cf) { - // no-op - } -} diff --git a/src/com/android/launcher3/pageindicators/PageIndicator.java b/src/com/android/launcher3/pageindicators/PageIndicator.java index d6ef5b4c8..be6bcc582 100644 --- a/src/com/android/launcher3/pageindicators/PageIndicator.java +++ b/src/com/android/launcher3/pageindicators/PageIndicator.java @@ -16,7 +16,6 @@ package com.android.launcher3.pageindicators; import android.content.Context; -import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.widget.FrameLayout; @@ -24,7 +23,6 @@ import android.widget.FrameLayout; * Base class for a page indicator. */ public abstract class PageIndicator extends FrameLayout { - private CaretDrawable mCaretDrawable; protected int mNumPages = 1; @@ -52,28 +50,7 @@ public abstract class PageIndicator extends FrameLayout { onPageCountChanged(); } - public CaretDrawable getCaretDrawable() { - return mCaretDrawable; - } - - public void setCaretDrawable(CaretDrawable caretDrawable) { - if (mCaretDrawable != null) { - mCaretDrawable.setCallback(null); - } - - mCaretDrawable = caretDrawable; - - if (mCaretDrawable != null) { - mCaretDrawable.setCallback(this); - } - } - protected void onPageCountChanged() {} public void setShouldAutoHide(boolean shouldAutoHide) {} - - @Override - protected boolean verifyDrawable(Drawable who) { - return super.verifyDrawable(who) || who == getCaretDrawable(); - } } diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java b/src/com/android/launcher3/pageindicators/PageIndicatorLandscape.java index 911be93fc..7325235db 100644 --- a/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java +++ b/src/com/android/launcher3/pageindicators/PageIndicatorLandscape.java @@ -16,49 +16,30 @@ package com.android.launcher3.pageindicators; import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Rect; import android.util.AttributeSet; import com.android.launcher3.Launcher; -import com.android.launcher3.R; /** * Simply draws the caret drawable bottom-right aligned in the view. This ensures that we can have * a view with as large an area as we want (for touching) while maintaining a caret of size * all_apps_caret_size. Used only for the landscape layout. */ -public class PageIndicatorCaretLandscape extends PageIndicator { +public class PageIndicatorLandscape extends PageIndicator { // all apps pull up handle drawable. - public PageIndicatorCaretLandscape(Context context) { + public PageIndicatorLandscape(Context context) { this(context, null); } - public PageIndicatorCaretLandscape(Context context, AttributeSet attrs) { + public PageIndicatorLandscape(Context context, AttributeSet attrs) { this(context, attrs, 0); } - public PageIndicatorCaretLandscape(Context context, AttributeSet attrs, int defStyle) { + public PageIndicatorLandscape(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); - - int caretSize = context.getResources().getDimensionPixelSize(R.dimen.all_apps_caret_size); - CaretDrawable caretDrawable = new CaretDrawable(context); - caretDrawable.setBounds(0, 0, caretSize, caretSize); - setCaretDrawable(caretDrawable); - Launcher l = Launcher.getLauncher(context); setOnClickListener(l); setOnFocusChangeListener(l.mFocusHandler); } - - @Override - protected void onDraw(Canvas canvas) { - Rect drawableBounds = getCaretDrawable().getBounds(); - int count = canvas.save(); - canvas.translate((getWidth() - drawableBounds.width()) / 2, - getHeight() - drawableBounds.height()); - getCaretDrawable().draw(canvas); - canvas.restoreToCount(count); - } } diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java b/src/com/android/launcher3/pageindicators/PageIndicatorLine.java index 5eedd92fd..09a06b0da 100644 --- a/src/com/android/launcher3/pageindicators/PageIndicatorLineCaret.java +++ b/src/com/android/launcher3/pageindicators/PageIndicatorLine.java @@ -26,7 +26,7 @@ import com.android.launcher3.dynamicui.WallpaperColorInfo; * * The fraction is 1 / number of pages and the position is based on the progress of the page scroll. */ -public class PageIndicatorLineCaret extends PageIndicator { +public class PageIndicatorLine extends PageIndicator { private static final int LINE_ANIMATE_DURATION = ViewConfiguration.getScrollBarFadeDuration(); private static final int LINE_FADE_DELAY = ViewConfiguration.getScrollDefaultDelay(); @@ -56,43 +56,43 @@ public class PageIndicatorLineCaret extends PageIndicator { private final int mLineHeight; private ImageView mAllAppsHandle; - private static final Property<PageIndicatorLineCaret, Integer> PAINT_ALPHA - = new Property<PageIndicatorLineCaret, Integer>(Integer.class, "paint_alpha") { + private static final Property<PageIndicatorLine, Integer> PAINT_ALPHA + = new Property<PageIndicatorLine, Integer>(Integer.class, "paint_alpha") { @Override - public Integer get(PageIndicatorLineCaret obj) { + public Integer get(PageIndicatorLine obj) { return obj.mLinePaint.getAlpha(); } @Override - public void set(PageIndicatorLineCaret obj, Integer alpha) { + public void set(PageIndicatorLine obj, Integer alpha) { obj.mLinePaint.setAlpha(alpha); obj.invalidate(); } }; - private static final Property<PageIndicatorLineCaret, Float> NUM_PAGES - = new Property<PageIndicatorLineCaret, Float>(Float.class, "num_pages") { + private static final Property<PageIndicatorLine, Float> NUM_PAGES + = new Property<PageIndicatorLine, Float>(Float.class, "num_pages") { @Override - public Float get(PageIndicatorLineCaret obj) { + public Float get(PageIndicatorLine obj) { return obj.mNumPagesFloat; } @Override - public void set(PageIndicatorLineCaret obj, Float numPages) { + public void set(PageIndicatorLine obj, Float numPages) { obj.mNumPagesFloat = numPages; obj.invalidate(); } }; - private static final Property<PageIndicatorLineCaret, Integer> TOTAL_SCROLL - = new Property<PageIndicatorLineCaret, Integer>(Integer.class, "total_scroll") { + private static final Property<PageIndicatorLine, Integer> TOTAL_SCROLL + = new Property<PageIndicatorLine, Integer>(Integer.class, "total_scroll") { @Override - public Integer get(PageIndicatorLineCaret obj) { + public Integer get(PageIndicatorLine obj) { return obj.mTotalScroll; } @Override - public void set(PageIndicatorLineCaret obj, Integer totalScroll) { + public void set(PageIndicatorLine obj, Integer totalScroll) { obj.mTotalScroll = totalScroll; obj.invalidate(); } @@ -105,15 +105,15 @@ public class PageIndicatorLineCaret extends PageIndicator { } }; - public PageIndicatorLineCaret(Context context) { + public PageIndicatorLine(Context context) { this(context, null); } - public PageIndicatorLineCaret(Context context, AttributeSet attrs) { + public PageIndicatorLine(Context context, AttributeSet attrs) { this(context, attrs, 0); } - public PageIndicatorLineCaret(Context context, AttributeSet attrs, int defStyle) { + public PageIndicatorLine(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); Resources res = context.getResources(); @@ -122,7 +122,6 @@ public class PageIndicatorLineCaret extends PageIndicator { mLauncher = Launcher.getLauncher(context); mLineHeight = res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_line_height); - setCaretDrawable(new CaretDrawable(context)); boolean darkText = WallpaperColorInfo.getInstance(context).supportsDarkText(); mActiveAlpha = darkText ? BLACK_ALPHA : WHITE_ALPHA; @@ -132,8 +131,7 @@ public class PageIndicatorLineCaret extends PageIndicator { @Override protected void onFinishInflate() { super.onFinishInflate(); - mAllAppsHandle = (ImageView) findViewById(R.id.all_apps_handle); - mAllAppsHandle.setImageDrawable(getCaretDrawable()); + mAllAppsHandle = findViewById(R.id.all_apps_handle); mAllAppsHandle.setOnClickListener(mLauncher); mAllAppsHandle.setOnFocusChangeListener(mLauncher.mFocusHandler); mLauncher.setAllAppsButton(mAllAppsHandle); |