Search in sources :

Example 11 with OpaLayout

use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.

the class SmartBarView method setDisabledFlags.

@Override
public void setDisabledFlags(int disabledFlags, boolean force) {
    super.setDisabledFlags(disabledFlags, force);
    if (mEditor != null) {
        mEditor.changeEditMode(BaseEditor.MODE_OFF);
    }
    final boolean disableHome = ((disabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0);
    final boolean disableRecent = ((disabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0);
    final boolean disableBack = ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0) && ((mNavigationIconHints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) == 0);
    OpaLayout opaBack = (OpaLayout) getBackButton().getParent();
    opaBack.setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
    OpaLayout opaHome = (OpaLayout) getHomeButton().getParent();
    opaHome.setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
    // to disable custom buttons as well
    for (String buttonTag : mCurrentSequence) {
        SmartButtonView v = findCurrentButton(buttonTag);
        OpaLayout opa = (OpaLayout) v.getParent();
        if (v != null && v != getBackButton() && v != getHomeButton()) {
            if (disableHome || disableBack || disableRecent) {
                opa.setVisibility(View.INVISIBLE);
            } else {
                opa.setVisibility(View.VISIBLE);
            }
        }
    }
}
Also used : OpaLayout(com.android.systemui.navigation.OpaLayout) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView)

Example 12 with OpaLayout

use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.

the class SmartBarEditor method setButtonsEditMode.

private void setButtonsEditMode(boolean isInEditMode) {
    for (String buttonTag : mHost.getCurrentSequence()) {
        SmartButtonView v = mHost.findCurrentButton(buttonTag);
        if (v != null) {
            v.setEditMode(isInEditMode);
            OpaLayout opa = (OpaLayout) v.getParent();
            opa.setOnTouchListener(isInEditMode ? this : null);
        }
    }
}
Also used : OpaLayout(com.android.systemui.navigation.OpaLayout) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView)

Example 13 with OpaLayout

use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.

the class SmartBarEditor method onActionPicked.

@Override
protected void onActionPicked(String action, ActionConfig actionConfig) {
    final String buttonFocus = getEditButtonTag();
    final int tapFocus = mTapHasFocusTag;
    SmartButtonView currentButton = mHost.findCurrentButton(buttonFocus);
    SmartButtonView otherButton = (SmartButtonView) getHiddenNavButtons().findViewWithTag(buttonFocus);
    ActionConfig currentAction = new ActionConfig(mContext, action);
    ActionConfig otherAction = new ActionConfig(mContext, action);
    ButtonConfig currentConfig = currentButton.getButtonConfig();
    ButtonConfig otherConfig = otherButton.getButtonConfig();
    OpaLayout currentOpa = (OpaLayout) currentButton.getParent();
    OpaLayout otherOpa = (OpaLayout) otherButton.getParent();
    currentConfig.setActionConfig(currentAction, tapFocus);
    otherConfig.setActionConfig(otherAction, tapFocus);
    currentButton.setButtonConfig(currentConfig);
    otherButton.setButtonConfig(otherConfig);
    if (tapFocus == ActionConfig.PRIMARY) {
        // update icon for single tap only
        mHost.setButtonDrawable(currentButton);
        SmartBarHelper.updateButtonScalingAndPadding(currentOpa, isLandscape());
        mHost.setButtonDrawable(otherButton);
        SmartBarHelper.updateButtonScalingAndPadding(otherOpa, !isLandscape());
    }
    onCommitChanges();
}
Also used : ActionConfig(com.android.internal.utils.du.Config.ActionConfig) ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) OpaLayout(com.android.systemui.navigation.OpaLayout) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView) Point(android.graphics.Point)

Example 14 with OpaLayout

use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.

the class SmartButtonView method onTouchEvent.

public boolean onTouchEvent(MotionEvent ev) {
    OpaLayout opa = null;
    if (getParent() != null && getParent() instanceof OpaLayout) {
        opa = (OpaLayout) getParent();
    }
    if (mInEditMode) {
        return false;
    }
    final int action = ev.getAction();
    switch(action) {
        case MotionEvent.ACTION_DOWN:
            setPressed(true);
            if (opa != null) {
                opa.startDownAction();
            }
            checkAndDoFlipAnim();
            if (mSpring != null) {
                mSpring.setEndValue(1f);
            }
            performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
            playSoundEffect(SoundEffectConstants.CLICK);
            if (isDoubleTapPending) {
                isDoubleTapPending = false;
                wasConsumed = true;
                removeCallbacks(mDoubleTapTimeout);
                doDoubleTap();
            } else {
                wasConsumed = false;
                if (hasRecentAction()) {
                    ActionHandler.preloadRecentApps();
                }
                if (hasLongAction() || mScreenPinningEnabled) {
                    removeCallbacks(mCheckLongPress);
                    postDelayed(mCheckLongPress, sLongPressTimeout);
                }
            }
            break;
        case MotionEvent.ACTION_CANCEL:
            if (hasLongAction() || mScreenPinningEnabled) {
                removeCallbacks(mCheckLongPress);
            }
            removeCallbacks(mDoubleTapTimeout);
            wasConsumed = true;
            isDoubleTapPending = false;
            setPressed(false);
            if (opa != null) {
                opa.startCancelAction();
            }
            if (mSpring != null) {
                mSpring.setEndValue(0f);
            }
            break;
        case MotionEvent.ACTION_UP:
            setPressed(false);
            checkAndDoFlipAnim();
            if (opa != null) {
                opa.startCancelAction();
            }
            if (mSpring != null) {
                mSpring.setEndValue(0f);
            }
            if (hasLongAction() || mScreenPinningEnabled) {
                removeCallbacks(mCheckLongPress);
            }
            if (hasDoubleAction()) {
                if (wasConsumed) {
                    wasConsumed = false;
                    return true;
                }
                isDoubleTapPending = true;
                postDelayed(mDoubleTapTimeout, sDoubleTapTimeout);
            } else {
                if (!wasConsumed && hasSingleAction()) {
                    doSinglePress();
                }
            }
            break;
    }
    return true;
}
Also used : OpaLayout(com.android.systemui.navigation.OpaLayout)

Example 15 with OpaLayout

use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.

the class SmartBarView method setOpaLandscape.

private void setOpaLandscape(boolean landscape) {
    for (String buttonTag : mCurrentSequence) {
        SmartButtonView v = findCurrentButton(buttonTag);
        OpaLayout opa = (OpaLayout) v.getParent();
        opa.setLandscape(landscape);
    }
}
Also used : OpaLayout(com.android.systemui.navigation.OpaLayout) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView)

Aggregations

OpaLayout (com.android.systemui.navigation.OpaLayout)15 SmartButtonView (com.android.systemui.navigation.smartbar.SmartButtonView)11 ButtonConfig (com.android.internal.utils.du.Config.ButtonConfig)5 Point (android.graphics.Point)2 ViewGroup (android.view.ViewGroup)2 FrameLayout (android.widget.FrameLayout)2 LinearLayout (android.widget.LinearLayout)2 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 ObjectAnimator (android.animation.ObjectAnimator)1 OvershootInterpolator (android.view.animation.OvershootInterpolator)1 LayoutParams (android.widget.LinearLayout.LayoutParams)1 ActionConfig (com.android.internal.utils.du.Config.ActionConfig)1