summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
diff options
context:
space:
mode:
authorWinson <winsonc@google.com>2016-07-18 17:18:02 -0700
committerWinson <winsonc@google.com>2016-07-20 10:17:08 -0700
commit1f06427266c0cb5de4561fc7c620ff542f625300 (patch)
tree59869923b1a0affd0521eda603a85ccb64bbea53 /src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
parent5b3ace8e56988eb493a3423f9e25b29909fa50bf (diff)
downloadandroid_packages_apps_Trebuchet-1f06427266c0cb5de4561fc7c620ff542f625300.tar.gz
android_packages_apps_Trebuchet-1f06427266c0cb5de4561fc7c620ff542f625300.tar.bz2
android_packages_apps_Trebuchet-1f06427266c0cb5de4561fc7c620ff542f625300.zip
Initial changes to tweak layout.
- Adding DeviceProfile callback for when the launcher layout changes due to insets. This is necessary since there are now different layouts depending on which side the navigation bar is on - Consolidating hotseat and other layout into the device profile launcher layout logic - Making the all apps icons match the workspace icon height - Tweaking caret drawable to draw to the bounds specified to simplify layout in each orientation - Fixing minor issue with page indicator shifting in landscape - Centering overview buttons to the workspace page Bug: 30021487 Change-Id: I1866bce00b2948f3edd06168c0f88d81207e3f13
Diffstat (limited to 'src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java')
-rw-r--r--src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java b/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
index 807520183..1eee59e0c 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorCaretLandscape.java
@@ -16,13 +16,19 @@
package com.android.launcher3.pageindicators;
import android.content.Context;
+import android.content.res.Resources;
import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
import android.util.AttributeSet;
import com.android.launcher3.Launcher;
+import com.android.launcher3.R;
/**
- * Simply draws the caret drawable in the center. Used for the landscape layout.
+ * 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 {
// all apps pull up handle drawable.
@@ -38,7 +44,11 @@ public class PageIndicatorCaretLandscape extends PageIndicator {
public PageIndicatorCaretLandscape(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- setCaretDrawable(new CaretDrawable(context));
+ 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) context;
setOnTouchListener(l.getHapticFeedbackTouchListener());
setOnClickListener(l);
@@ -46,15 +56,12 @@ public class PageIndicatorCaretLandscape extends PageIndicator {
}
@Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
- int size = bottom - top;
- int l = (right - left) / 2 - size / 2;
- getCaretDrawable().setBounds(l, 0, l + size, size);
- }
-
- @Override
protected void onDraw(Canvas canvas) {
+ Rect drawableBounds = getCaretDrawable().getBounds();
+ int count = canvas.save();
+ canvas.translate(getWidth() - drawableBounds.width(),
+ getHeight() - drawableBounds.height());
getCaretDrawable().draw(canvas);
+ canvas.restoreToCount(count);
}
}