// It can be any number >0. The view is resized using scaleX and scaleY.
static final int DEFAULT_LAYOUT_SIZE = 100;
+
private static final float MIN_VISIBLE_ALPHA = 0.2f;
private static final long ANIM_DURATION = 150;
private View mLastFocusedView;
private boolean mInitiated;
+ private final OnFocusChangeListener mHideIndicatorOnFocusListener;
private Pair<View, Boolean> mPendingCall;
super(context, attrs);
setAlpha(0);
setBackgroundColor(getResources().getColor(R.color.focused_background));
+
+ mHideIndicatorOnFocusListener = new OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (hasFocus) {
+ endCurrentAnimation();
+ setAlpha(0);
+ }
+ }
+ };
}
@Override
}
}
+ /**
+ * Sets the alpha of this FocusIndicatorView to 0 when a view with this listener receives focus.
+ */
+ public View.OnFocusChangeListener getHideIndicatorOnFocusListener() {
+ return mHideIndicatorOnFocusListener;
+ }
+
@Override
public void onFocusChange(View v, boolean hasFocus) {
mPendingCall = null;
customScreen.removeAllViews();
customContent.setFocusable(true);
customContent.setOnKeyListener(new FullscreenKeyEventListener());
+ customContent.setOnFocusChangeListener(mLauncher.mFocusHandler
+ .getHideIndicatorOnFocusListener());
customScreen.addViewToCellLayout(customContent, 0, 0, lp, true);
mCustomContentDescription = description;