Merge changes from topics "presubmit-am-2762060c253b4c4db3c4db805c2e5b6e", "presubmit-am-3d21c3ff86734d9ba296b2671441db03", "presubmit-am-681cf6c0b8f240f59da390f09a7ef2ed", "presubmit-am-82dac8e1bb1747dcb76dbda3f29e55c9", "presubmit-am-c01cdff8b5e44804ab8a37c5cdc295d5" into tm-dev
* changes: Fix remaining lint erros under a.i.navigationbar Fix camel-case-related lint erros under a.i.navigationbar Fix whitespace-related lint erros under a.i.navigationbar Fix modifier-related lint erros under a.i.navigationbar Fix Javadoc-related lint erros under a.i.navigationbar
This commit is contained in:
@@ -67,7 +67,7 @@ final class ButtonDispatcher {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public ButtonDispatcher(int id) {
|
ButtonDispatcher(int id) {
|
||||||
mId = id;
|
mId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,8 +125,8 @@ final class ButtonDispatcher {
|
|||||||
|
|
||||||
public void setImageDrawable(KeyButtonDrawable drawable) {
|
public void setImageDrawable(KeyButtonDrawable drawable) {
|
||||||
mImageDrawable = drawable;
|
mImageDrawable = drawable;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
if (mViews.get(i) instanceof ButtonInterface) {
|
if (mViews.get(i) instanceof ButtonInterface) {
|
||||||
((ButtonInterface) mViews.get(i)).setImageDrawable(mImageDrawable);
|
((ButtonInterface) mViews.get(i)).setImageDrawable(mImageDrawable);
|
||||||
}
|
}
|
||||||
@@ -143,8 +143,8 @@ final class ButtonDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mVisibility = visibility;
|
mVisibility = visibility;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
mViews.get(i).setVisibility(mVisibility);
|
mViews.get(i).setVisibility(mVisibility);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,8 +188,8 @@ final class ButtonDispatcher {
|
|||||||
int nextAlpha = (int) (alpha * 255);
|
int nextAlpha = (int) (alpha * 255);
|
||||||
if (prevAlpha != nextAlpha) {
|
if (prevAlpha != nextAlpha) {
|
||||||
mAlpha = nextAlpha / 255f;
|
mAlpha = nextAlpha / 255f;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
mViews.get(i).setAlpha(mAlpha);
|
mViews.get(i).setAlpha(mAlpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,8 +198,8 @@ final class ButtonDispatcher {
|
|||||||
|
|
||||||
public void setDarkIntensity(float darkIntensity) {
|
public void setDarkIntensity(float darkIntensity) {
|
||||||
mDarkIntensity = darkIntensity;
|
mDarkIntensity = darkIntensity;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
if (mViews.get(i) instanceof ButtonInterface) {
|
if (mViews.get(i) instanceof ButtonInterface) {
|
||||||
((ButtonInterface) mViews.get(i)).setDarkIntensity(darkIntensity);
|
((ButtonInterface) mViews.get(i)).setDarkIntensity(darkIntensity);
|
||||||
}
|
}
|
||||||
@@ -208,8 +208,8 @@ final class ButtonDispatcher {
|
|||||||
|
|
||||||
public void setDelayTouchFeedback(boolean delay) {
|
public void setDelayTouchFeedback(boolean delay) {
|
||||||
mDelayTouchFeedback = delay;
|
mDelayTouchFeedback = delay;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
if (mViews.get(i) instanceof ButtonInterface) {
|
if (mViews.get(i) instanceof ButtonInterface) {
|
||||||
((ButtonInterface) mViews.get(i)).setDelayTouchFeedback(delay);
|
((ButtonInterface) mViews.get(i)).setDelayTouchFeedback(delay);
|
||||||
}
|
}
|
||||||
@@ -218,55 +218,55 @@ final class ButtonDispatcher {
|
|||||||
|
|
||||||
public void setOnClickListener(View.OnClickListener clickListener) {
|
public void setOnClickListener(View.OnClickListener clickListener) {
|
||||||
mClickListener = clickListener;
|
mClickListener = clickListener;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
mViews.get(i).setOnClickListener(mClickListener);
|
mViews.get(i).setOnClickListener(mClickListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnTouchListener(View.OnTouchListener touchListener) {
|
public void setOnTouchListener(View.OnTouchListener touchListener) {
|
||||||
mTouchListener = touchListener;
|
mTouchListener = touchListener;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
mViews.get(i).setOnTouchListener(mTouchListener);
|
mViews.get(i).setOnTouchListener(mTouchListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLongClickable(boolean isLongClickable) {
|
public void setLongClickable(boolean isLongClickable) {
|
||||||
mLongClickable = isLongClickable;
|
mLongClickable = isLongClickable;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
mViews.get(i).setLongClickable(mLongClickable);
|
mViews.get(i).setLongClickable(mLongClickable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnLongClickListener(View.OnLongClickListener longClickListener) {
|
public void setOnLongClickListener(View.OnLongClickListener longClickListener) {
|
||||||
mLongClickListener = longClickListener;
|
mLongClickListener = longClickListener;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
mViews.get(i).setOnLongClickListener(mLongClickListener);
|
mViews.get(i).setOnLongClickListener(mLongClickListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnHoverListener(View.OnHoverListener hoverListener) {
|
public void setOnHoverListener(View.OnHoverListener hoverListener) {
|
||||||
mOnHoverListener = hoverListener;
|
mOnHoverListener = hoverListener;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
mViews.get(i).setOnHoverListener(mOnHoverListener);
|
mViews.get(i).setOnHoverListener(mOnHoverListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAccessibilityDelegate(AccessibilityDelegate delegate) {
|
public void setAccessibilityDelegate(AccessibilityDelegate delegate) {
|
||||||
mAccessibilityDelegate = delegate;
|
mAccessibilityDelegate = delegate;
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
mViews.get(i).setAccessibilityDelegate(delegate);
|
mViews.get(i).setAccessibilityDelegate(delegate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTranslation(int x, int y, int z) {
|
public void setTranslation(int x, int y, int z) {
|
||||||
final int N = mViews.size();
|
final int numViews = mViews.size();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numViews; i++) {
|
||||||
final View view = mViews.get(i);
|
final View view = mViews.get(i);
|
||||||
view.setTranslationX(x);
|
view.setTranslationX(x);
|
||||||
view.setTranslationY(y);
|
view.setTranslationY(y);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ final class DeadZone {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public DeadZone(NavigationBarView view) {
|
DeadZone(NavigationBarView view) {
|
||||||
mNavigationBarView = view;
|
mNavigationBarView = view;
|
||||||
onConfigurationChanged(Surface.ROTATION_0);
|
onConfigurationChanged(Surface.ROTATION_0);
|
||||||
}
|
}
|
||||||
@@ -92,13 +92,15 @@ final class DeadZone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float getSize(long now) {
|
private float getSize(long now) {
|
||||||
if (mSizeMax == 0)
|
if (mSizeMax == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
long dt = (now - mLastPokeTime);
|
long dt = (now - mLastPokeTime);
|
||||||
if (dt > mHold + mDecay)
|
if (dt > mHold + mDecay) {
|
||||||
return mSizeMin;
|
return mSizeMin;
|
||||||
if (dt < mHold)
|
} else if (dt < mHold) {
|
||||||
return mSizeMax;
|
return mSizeMax;
|
||||||
|
}
|
||||||
return (int) lerp(mSizeMax, mSizeMin, (float) (dt - mHold) / mDecay);
|
return (int) lerp(mSizeMax, mSizeMin, (float) (dt - mHold) / mDecay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,8 +179,9 @@ final class DeadZone {
|
|||||||
|
|
||||||
private void poke(MotionEvent event) {
|
private void poke(MotionEvent event) {
|
||||||
mLastPokeTime = event.getEventTime();
|
mLastPokeTime = event.getEventTime();
|
||||||
if (DEBUG)
|
if (DEBUG) {
|
||||||
Log.v(TAG, "poked! size=" + getSize(mLastPokeTime));
|
Log.v(TAG, "poked! size=" + getSize(mLastPokeTime));
|
||||||
|
}
|
||||||
if (mShouldFlash) mNavigationBarView.postInvalidate();
|
if (mShouldFlash) mNavigationBarView.postInvalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,30 +54,30 @@ import android.view.View;
|
|||||||
final class KeyButtonDrawable extends Drawable {
|
final class KeyButtonDrawable extends Drawable {
|
||||||
|
|
||||||
public static final FloatProperty<KeyButtonDrawable> KEY_DRAWABLE_ROTATE =
|
public static final FloatProperty<KeyButtonDrawable> KEY_DRAWABLE_ROTATE =
|
||||||
new FloatProperty<KeyButtonDrawable>("KeyButtonRotation") {
|
new FloatProperty<KeyButtonDrawable>("KeyButtonRotation") {
|
||||||
@Override
|
@Override
|
||||||
public void setValue(KeyButtonDrawable drawable, float degree) {
|
public void setValue(KeyButtonDrawable drawable, float degree) {
|
||||||
drawable.setRotation(degree);
|
drawable.setRotation(degree);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Float get(KeyButtonDrawable drawable) {
|
public Float get(KeyButtonDrawable drawable) {
|
||||||
return drawable.getRotation();
|
return drawable.getRotation();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final FloatProperty<KeyButtonDrawable> KEY_DRAWABLE_TRANSLATE_Y =
|
public static final FloatProperty<KeyButtonDrawable> KEY_DRAWABLE_TRANSLATE_Y =
|
||||||
new FloatProperty<KeyButtonDrawable>("KeyButtonTranslateY") {
|
new FloatProperty<KeyButtonDrawable>("KeyButtonTranslateY") {
|
||||||
@Override
|
@Override
|
||||||
public void setValue(KeyButtonDrawable drawable, float y) {
|
public void setValue(KeyButtonDrawable drawable, float y) {
|
||||||
drawable.setTranslationY(y);
|
drawable.setTranslationY(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Float get(KeyButtonDrawable drawable) {
|
public Float get(KeyButtonDrawable drawable) {
|
||||||
return drawable.getTranslationY();
|
return drawable.getTranslationY();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Paint mIconPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
|
private final Paint mIconPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
|
||||||
private final Paint mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
|
private final Paint mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
|
||||||
@@ -100,7 +100,7 @@ final class KeyButtonDrawable extends Drawable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor,
|
KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor,
|
||||||
boolean horizontalFlip, Color ovalBackgroundColor) {
|
boolean horizontalFlip, Color ovalBackgroundColor) {
|
||||||
this(d, new ShadowDrawableState(lightColor, darkColor,
|
this(d, new ShadowDrawableState(lightColor, darkColor,
|
||||||
d instanceof AnimatedVectorDrawable, horizontalFlip, ovalBackgroundColor));
|
d instanceof AnimatedVectorDrawable, horizontalFlip, ovalBackgroundColor));
|
||||||
@@ -433,8 +433,8 @@ final class KeyButtonDrawable extends Drawable {
|
|||||||
final boolean mSupportsAnimation;
|
final boolean mSupportsAnimation;
|
||||||
final Color mOvalBackgroundColor;
|
final Color mOvalBackgroundColor;
|
||||||
|
|
||||||
public ShadowDrawableState(@ColorInt int lightColor, @ColorInt int darkColor,
|
ShadowDrawableState(@ColorInt int lightColor, @ColorInt int darkColor, boolean animated,
|
||||||
boolean animated, boolean horizontalFlip, Color ovalBackgroundColor) {
|
boolean horizontalFlip, Color ovalBackgroundColor) {
|
||||||
mLightColor = lightColor;
|
mLightColor = lightColor;
|
||||||
mDarkColor = darkColor;
|
mDarkColor = darkColor;
|
||||||
mSupportsAnimation = animated;
|
mSupportsAnimation = animated;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ final class KeyButtonRipple extends Drawable {
|
|||||||
|
|
||||||
private Type mType = Type.ROUNDED_RECT;
|
private Type mType = Type.ROUNDED_RECT;
|
||||||
|
|
||||||
public KeyButtonRipple(Context ctx, View targetView, @DimenRes int maxWidthResource) {
|
KeyButtonRipple(Context ctx, View targetView, @DimenRes int maxWidthResource) {
|
||||||
mMaxWidthResource = maxWidthResource;
|
mMaxWidthResource = maxWidthResource;
|
||||||
mMaxWidth = ctx.getResources().getDimensionPixelSize(maxWidthResource);
|
mMaxWidth = ctx.getResources().getDimensionPixelSize(maxWidthResource);
|
||||||
mTargetView = targetView;
|
mTargetView = targetView;
|
||||||
@@ -126,7 +126,7 @@ final class KeyButtonRipple extends Drawable {
|
|||||||
private void drawSoftware(Canvas canvas) {
|
private void drawSoftware(Canvas canvas) {
|
||||||
if (mGlowAlpha > 0f) {
|
if (mGlowAlpha > 0f) {
|
||||||
final Paint p = getRipplePaint();
|
final Paint p = getRipplePaint();
|
||||||
p.setAlpha((int)(mGlowAlpha * 255f));
|
p.setAlpha((int) (mGlowAlpha * 255f));
|
||||||
|
|
||||||
final float w = getBounds().width();
|
final float w = getBounds().width();
|
||||||
final float h = getBounds().height();
|
final float h = getBounds().height();
|
||||||
@@ -412,7 +412,7 @@ final class KeyButtonRipple extends Drawable {
|
|||||||
mDrawingHardwareGlow = true;
|
mDrawingHardwareGlow = true;
|
||||||
setExtendStart(CanvasProperty.createFloat(getExtendSize() / 2));
|
setExtendStart(CanvasProperty.createFloat(getExtendSize() / 2));
|
||||||
final RenderNodeAnimator startAnim = new RenderNodeAnimator(getExtendStart(),
|
final RenderNodeAnimator startAnim = new RenderNodeAnimator(getExtendStart(),
|
||||||
getExtendSize()/2 - GLOW_MAX_SCALE_FACTOR * getRippleSize()/2);
|
getExtendSize() / 2 - GLOW_MAX_SCALE_FACTOR * getRippleSize() / 2);
|
||||||
startAnim.setDuration(ANIMATION_DURATION_SCALE);
|
startAnim.setDuration(ANIMATION_DURATION_SCALE);
|
||||||
startAnim.setInterpolator(mInterpolator);
|
startAnim.setInterpolator(mInterpolator);
|
||||||
startAnim.addListener(mAnimatorListener);
|
startAnim.addListener(mAnimatorListener);
|
||||||
@@ -420,7 +420,7 @@ final class KeyButtonRipple extends Drawable {
|
|||||||
|
|
||||||
setExtendEnd(CanvasProperty.createFloat(getExtendSize() / 2));
|
setExtendEnd(CanvasProperty.createFloat(getExtendSize() / 2));
|
||||||
final RenderNodeAnimator endAnim = new RenderNodeAnimator(getExtendEnd(),
|
final RenderNodeAnimator endAnim = new RenderNodeAnimator(getExtendEnd(),
|
||||||
getExtendSize()/2 + GLOW_MAX_SCALE_FACTOR * getRippleSize()/2);
|
getExtendSize() / 2 + GLOW_MAX_SCALE_FACTOR * getRippleSize() / 2);
|
||||||
endAnim.setDuration(ANIMATION_DURATION_SCALE);
|
endAnim.setDuration(ANIMATION_DURATION_SCALE);
|
||||||
endAnim.setInterpolator(mInterpolator);
|
endAnim.setInterpolator(mInterpolator);
|
||||||
endAnim.addListener(mAnimatorListener);
|
endAnim.addListener(mAnimatorListener);
|
||||||
@@ -430,13 +430,13 @@ final class KeyButtonRipple extends Drawable {
|
|||||||
if (isHorizontal()) {
|
if (isHorizontal()) {
|
||||||
mTopProp = CanvasProperty.createFloat(0f);
|
mTopProp = CanvasProperty.createFloat(0f);
|
||||||
mBottomProp = CanvasProperty.createFloat(getBounds().height());
|
mBottomProp = CanvasProperty.createFloat(getBounds().height());
|
||||||
mRxProp = CanvasProperty.createFloat(getBounds().height()/2);
|
mRxProp = CanvasProperty.createFloat(getBounds().height() / 2);
|
||||||
mRyProp = CanvasProperty.createFloat(getBounds().height()/2);
|
mRyProp = CanvasProperty.createFloat(getBounds().height() / 2);
|
||||||
} else {
|
} else {
|
||||||
mLeftProp = CanvasProperty.createFloat(0f);
|
mLeftProp = CanvasProperty.createFloat(0f);
|
||||||
mRightProp = CanvasProperty.createFloat(getBounds().width());
|
mRightProp = CanvasProperty.createFloat(getBounds().width());
|
||||||
mRxProp = CanvasProperty.createFloat(getBounds().width()/2);
|
mRxProp = CanvasProperty.createFloat(getBounds().width() / 2);
|
||||||
mRyProp = CanvasProperty.createFloat(getBounds().width()/2);
|
mRyProp = CanvasProperty.createFloat(getBounds().width() / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
mGlowScale = GLOW_MAX_SCALE_FACTOR;
|
mGlowScale = GLOW_MAX_SCALE_FACTOR;
|
||||||
|
|||||||
@@ -200,8 +200,8 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
|
|||||||
postDelayed(mCheckLongPress, ViewConfiguration.getLongPressTimeout());
|
postDelayed(mCheckLongPress, ViewConfiguration.getLongPressTimeout());
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
x = (int)ev.getRawX();
|
x = (int) ev.getRawX();
|
||||||
y = (int)ev.getRawY();
|
y = (int) ev.getRawY();
|
||||||
|
|
||||||
float slop = getQuickStepTouchSlopPx(getContext());
|
float slop = getQuickStepTouchSlopPx(getContext());
|
||||||
if (Math.abs(x - mTouchDownX) > slop || Math.abs(y - mTouchDownY) > slop) {
|
if (Math.abs(x - mTouchDownX) > slop || Math.abs(y - mTouchDownY) > slop) {
|
||||||
@@ -272,12 +272,13 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
|
|||||||
: KeyButtonRipple.Type.ROUNDED_RECT);
|
: KeyButtonRipple.Type.ROUNDED_RECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void playSoundEffect(int soundConstant) {
|
public void playSoundEffect(int soundConstant) {
|
||||||
if (!mPlaySounds) return;
|
if (!mPlaySounds) return;
|
||||||
mAudioManager.playSoundEffect(soundConstant);
|
mAudioManager.playSoundEffect(soundConstant);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendEvent(int action, int flags) {
|
private void sendEvent(int action, int flags) {
|
||||||
sendEvent(action, flags, SystemClock.uptimeMillis());
|
sendEvent(action, flags, SystemClock.uptimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,8 +310,8 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
|
|||||||
switch (action) {
|
switch (action) {
|
||||||
case KeyEvent.ACTION_DOWN:
|
case KeyEvent.ACTION_DOWN:
|
||||||
handled = ims.onKeyDown(ev.getKeyCode(), ev);
|
handled = ims.onKeyDown(ev.getKeyCode(), ev);
|
||||||
mTracking = handled && ev.getRepeatCount() == 0 &&
|
mTracking = handled && ev.getRepeatCount() == 0
|
||||||
(ev.getFlags() & KeyEvent.FLAG_START_TRACKING) != 0;
|
&& (ev.getFlags() & KeyEvent.FLAG_START_TRACKING) != 0;
|
||||||
break;
|
break;
|
||||||
case KeyEvent.ACTION_UP:
|
case KeyEvent.ACTION_UP:
|
||||||
handled = ims.onKeyUp(ev.getKeyCode(), ev);
|
handled = ims.onKeyUp(ev.getKeyCode(), ev);
|
||||||
|
|||||||
@@ -59,4 +59,4 @@ public final class NavigationBarFrame extends FrameLayout {
|
|||||||
}
|
}
|
||||||
return super.dispatchTouchEvent(event);
|
return super.dispatchTouchEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public final class NavigationBarInflaterView extends FrameLayout {
|
|||||||
return CONFIG_NAV_BAR_LAYOUT_HANDLE;
|
return CONFIG_NAV_BAR_LAYOUT_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setButtonDispatchers(SparseArray<ButtonDispatcher> buttonDispatchers) {
|
void setButtonDispatchers(SparseArray<ButtonDispatcher> buttonDispatchers) {
|
||||||
mButtonDispatchers = buttonDispatchers;
|
mButtonDispatchers = buttonDispatchers;
|
||||||
for (int i = 0; i < buttonDispatchers.size(); i++) {
|
for (int i = 0; i < buttonDispatchers.size(); i++) {
|
||||||
initiallyFill(buttonDispatchers.valueAt(i));
|
initiallyFill(buttonDispatchers.valueAt(i));
|
||||||
@@ -376,7 +376,7 @@ public final class NavigationBarInflaterView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static String extractSize(String buttonSpec) {
|
private static String extractSize(String buttonSpec) {
|
||||||
if (!buttonSpec.contains(SIZE_MOD_START)) {
|
if (!buttonSpec.contains(SIZE_MOD_START)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -384,7 +384,7 @@ public final class NavigationBarInflaterView extends FrameLayout {
|
|||||||
return buttonSpec.substring(sizeStart + 1, buttonSpec.indexOf(SIZE_MOD_END));
|
return buttonSpec.substring(sizeStart + 1, buttonSpec.indexOf(SIZE_MOD_END));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String extractButton(String buttonSpec) {
|
private static String extractButton(String buttonSpec) {
|
||||||
if (!buttonSpec.contains(SIZE_MOD_START)) {
|
if (!buttonSpec.contains(SIZE_MOD_START)) {
|
||||||
return buttonSpec;
|
return buttonSpec;
|
||||||
}
|
}
|
||||||
@@ -398,9 +398,9 @@ public final class NavigationBarInflaterView extends FrameLayout {
|
|||||||
mButtonDispatchers.valueAt(indexOfKey).addView(v);
|
mButtonDispatchers.valueAt(indexOfKey).addView(v);
|
||||||
}
|
}
|
||||||
if (v instanceof ViewGroup) {
|
if (v instanceof ViewGroup) {
|
||||||
final ViewGroup viewGroup = (ViewGroup)v;
|
final ViewGroup viewGroup = (ViewGroup) v;
|
||||||
final int N = viewGroup.getChildCount();
|
final int numChildViews = viewGroup.getChildCount();
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < numChildViews; i++) {
|
||||||
addToDispatchers(viewGroup.getChildAt(i));
|
addToDispatchers(viewGroup.getChildAt(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ import java.util.function.Consumer;
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public final class NavigationBarView extends FrameLayout {
|
public final class NavigationBarView extends FrameLayout {
|
||||||
final static boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
final static String TAG = "NavBarView";
|
private static final String TAG = "NavBarView";
|
||||||
|
|
||||||
// Copied from com.android.systemui.animation.Interpolators#FAST_OUT_SLOW_IN
|
// Copied from com.android.systemui.animation.Interpolators#FAST_OUT_SLOW_IN
|
||||||
private static final Interpolator FAST_OUT_SLOW_IN = new PathInterpolator(0.4f, 0f, 0.2f, 1f);
|
private static final Interpolator FAST_OUT_SLOW_IN = new PathInterpolator(0.4f, 0f, 0.2f, 1f);
|
||||||
@@ -139,7 +139,7 @@ public final class NavigationBarView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies {@param consumer} to each of the nav bar views.
|
* Applies {@code consumer} to each of the nav bar views.
|
||||||
*/
|
*/
|
||||||
public void forEachView(Consumer<View> consumer) {
|
public void forEachView(Consumer<View> consumer) {
|
||||||
if (mHorizontal != null) {
|
if (mHorizontal != null) {
|
||||||
@@ -181,7 +181,7 @@ public final class NavigationBarView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyButtonDrawable getBackDrawable() {
|
private KeyButtonDrawable getBackDrawable() {
|
||||||
KeyButtonDrawable drawable = getDrawable(com.android.internal.R.drawable.ic_ime_nav_back);
|
KeyButtonDrawable drawable = getDrawable(com.android.internal.R.drawable.ic_ime_nav_back);
|
||||||
orientBackButton(drawable);
|
orientBackButton(drawable);
|
||||||
return drawable;
|
return drawable;
|
||||||
@@ -211,7 +211,7 @@ public final class NavigationBarView extends FrameLayout {
|
|||||||
// Animate the back button's rotation to the new degrees and only in portrait move up the
|
// Animate the back button's rotation to the new degrees and only in portrait move up the
|
||||||
// back button to line up with the other buttons
|
// back button to line up with the other buttons
|
||||||
float targetY = useAltBack
|
float targetY = useAltBack
|
||||||
? - dpToPx(NAVBAR_BACK_BUTTON_IME_OFFSET, getResources())
|
? -dpToPx(NAVBAR_BACK_BUTTON_IME_OFFSET, getResources())
|
||||||
: 0;
|
: 0;
|
||||||
ObjectAnimator navBarAnimator = ObjectAnimator.ofPropertyValuesHolder(drawable,
|
ObjectAnimator navBarAnimator = ObjectAnimator.ofPropertyValuesHolder(drawable,
|
||||||
PropertyValuesHolder.ofFloat(KeyButtonDrawable.KEY_DRAWABLE_ROTATE, degrees),
|
PropertyValuesHolder.ofFloat(KeyButtonDrawable.KEY_DRAWABLE_ROTATE, degrees),
|
||||||
@@ -233,6 +233,11 @@ public final class NavigationBarView extends FrameLayout {
|
|||||||
super.setLayoutDirection(layoutDirection);
|
super.setLayoutDirection(layoutDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the navigation icons based on {@code hints}.
|
||||||
|
*
|
||||||
|
* @param hints bit flags defined in {@link StatusBarManager}.
|
||||||
|
*/
|
||||||
public void setNavigationIconHints(int hints) {
|
public void setNavigationIconHints(int hints) {
|
||||||
if (hints == mNavigationIconHints) return;
|
if (hints == mNavigationIconHints) return;
|
||||||
final boolean newBackAlt = (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0;
|
final boolean newBackAlt = (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0;
|
||||||
@@ -250,15 +255,7 @@ public final class NavigationBarView extends FrameLayout {
|
|||||||
updateNavButtonIcons();
|
updateNavButtonIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisabledFlags(int disabledFlags) {
|
private void updateNavButtonIcons() {
|
||||||
if (mDisabledFlags == disabledFlags) return;
|
|
||||||
|
|
||||||
mDisabledFlags = disabledFlags;
|
|
||||||
|
|
||||||
updateNavButtonIcons();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateNavButtonIcons() {
|
|
||||||
// We have to replace or restore the back and home button icons when exiting or entering
|
// We have to replace or restore the back and home button icons when exiting or entering
|
||||||
// carmode, respectively. Recents are not available in CarMode in nav bar so change
|
// carmode, respectively. Recents are not available in CarMode in nav bar so change
|
||||||
// to recent icon is not required.
|
// to recent icon is not required.
|
||||||
@@ -319,7 +316,7 @@ public final class NavigationBarView extends FrameLayout {
|
|||||||
mHorizontal.setVisibility(View.GONE);
|
mHorizontal.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reorient() {
|
private void reorient() {
|
||||||
updateCurrentView();
|
updateCurrentView();
|
||||||
|
|
||||||
final android.inputmethodservice.navigationbar.NavigationBarFrame frame =
|
final android.inputmethodservice.navigationbar.NavigationBarFrame frame =
|
||||||
@@ -372,6 +369,11 @@ public final class NavigationBarView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the dark intensity.
|
||||||
|
*
|
||||||
|
* @param intensity The intensity of darkness from {@code 0.0f} to {@code 1.0f}.
|
||||||
|
*/
|
||||||
public void setDarkIntensity(@FloatRange(from = 0.0f, to = 1.0f) float intensity) {
|
public void setDarkIntensity(@FloatRange(from = 0.0f, to = 1.0f) float intensity) {
|
||||||
for (int i = 0; i < mButtonDispatchers.size(); ++i) {
|
for (int i = 0; i < mButtonDispatchers.size(); ++i) {
|
||||||
mButtonDispatchers.valueAt(i).setDarkIntensity(intensity);
|
mButtonDispatchers.valueAt(i).setDarkIntensity(intensity);
|
||||||
|
|||||||
@@ -30,9 +30,8 @@ import java.util.ArrayList;
|
|||||||
/**
|
/**
|
||||||
* Automatically reverses the order of children as they are added.
|
* Automatically reverses the order of children as they are added.
|
||||||
* Also reverse the width and height values of layout params
|
* Also reverse the width and height values of layout params
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
public class ReverseLinearLayout extends LinearLayout {
|
class ReverseLinearLayout extends LinearLayout {
|
||||||
|
|
||||||
/** If true, the layout is reversed vs. a regular linear layout */
|
/** If true, the layout is reversed vs. a regular linear layout */
|
||||||
private boolean mIsLayoutReverse;
|
private boolean mIsLayoutReverse;
|
||||||
@@ -40,7 +39,7 @@ public class ReverseLinearLayout extends LinearLayout {
|
|||||||
/** If true, the layout is opposite to it's natural reversity from the layout direction */
|
/** If true, the layout is opposite to it's natural reversity from the layout direction */
|
||||||
private boolean mIsAlternativeOrder;
|
private boolean mIsAlternativeOrder;
|
||||||
|
|
||||||
public ReverseLinearLayout(Context context, @Nullable AttributeSet attrs) {
|
ReverseLinearLayout(Context context, @Nullable AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +128,7 @@ public class ReverseLinearLayout extends LinearLayout {
|
|||||||
|
|
||||||
public static class ReverseRelativeLayout extends RelativeLayout implements Reversible {
|
public static class ReverseRelativeLayout extends RelativeLayout implements Reversible {
|
||||||
|
|
||||||
public ReverseRelativeLayout(Context context) {
|
ReverseRelativeLayout(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user