Search in sources :

Example 6 with SmartButtonView

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

the class SmartBarView method generateContextKeyLayout.

private FrameLayout generateContextKeyLayout(boolean landscape, String leftOrRight, int extraKeyWidth, int extraKeyHeight) {
    FrameLayout contextLayout = new FrameLayout(getContext());
    contextLayout.setLayoutParams(new LinearLayout.LayoutParams(landscape && !BaseNavigationBar.sIsTablet ? LayoutParams.MATCH_PARENT : extraKeyWidth, landscape && !BaseNavigationBar.sIsTablet ? extraKeyHeight : LayoutParams.MATCH_PARENT));
    contextLayout.setTag(leftOrRight);
    SmartButtonView menuKeyView = generateContextKey(landscape, Res.Softkey.MENU_BUTTON);
    contextLayout.addView(menuKeyView);
    SmartButtonView imeChanger = generateContextKey(landscape, Res.Softkey.IME_SWITCHER);
    contextLayout.addView(imeChanger);
    if (TextUtils.equals(Res.Softkey.CONTEXT_VIEW_LEFT, leftOrRight)) {
        SmartButtonView imeArrowLeft = generateContextKey(landscape, Res.Softkey.IME_ARROW_LEFT);
        contextLayout.addView(imeArrowLeft);
        SmartButtonView mediaArrowLeft = generateContextKey(landscape, Res.Softkey.MEDIA_ARROW_LEFT);
        contextLayout.addView(mediaArrowLeft);
    } else if (TextUtils.equals(Res.Softkey.CONTEXT_VIEW_RIGHT, leftOrRight)) {
        SmartButtonView imeArrowRight = generateContextKey(landscape, Res.Softkey.IME_ARROW_RIGHT);
        contextLayout.addView(imeArrowRight);
        SmartButtonView mediaArrowRight = generateContextKey(landscape, Res.Softkey.MEDIA_ARROW_RIGHT);
        contextLayout.addView(mediaArrowRight);
    }
    return contextLayout;
}
Also used : SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView) FrameLayout(android.widget.FrameLayout) LinearLayout(android.widget.LinearLayout)

Example 7 with SmartButtonView

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

the class SmartBarView method notifyScreenOn.

@Override
public void notifyScreenOn(boolean screenOn) {
    super.notifyScreenOn(screenOn);
    if (mEditor != null) {
        mEditor.notifyScreenOn(screenOn);
    }
    ViewGroup hidden = (ViewGroup) getHiddenView().findViewWithTag(Res.Common.NAV_BUTTONS);
    for (String buttonTag : mCurrentSequence) {
        SmartButtonView v = findCurrentButton(buttonTag);
        if (v != null) {
            v.onScreenStateChanged(screenOn);
        }
        v = (SmartButtonView) hidden.findViewWithTag(buttonTag);
        if (v != null) {
            v.onScreenStateChanged(screenOn);
        }
    }
    // onStopPulse may not have had time to animate alpha to proper value before screen went
    // off. Reset alpha when we come back on. we should never have pulse running when this is called
    final View currentNavButtons = getCurrentView().findViewWithTag(Res.Common.NAV_BUTTONS);
    final View hiddenNavButtons = getHiddenView().findViewWithTag(Res.Common.NAV_BUTTONS);
    final float fadeAlpha = mCustomAlpha;
    if (screenOn && (currentNavButtons.getAlpha() != fadeAlpha || hiddenNavButtons.getAlpha() != fadeAlpha)) {
        hiddenNavButtons.setAlpha(fadeAlpha);
        currentNavButtons.setAlpha(fadeAlpha);
    }
}
Also used : ViewGroup(android.view.ViewGroup) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView) ImageView(android.widget.ImageView) View(android.view.View) SmartBarView(com.android.systemui.navigation.smartbar.SmartBarView) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView)

Example 8 with SmartButtonView

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

the class SmartBarEditor method resetIcon.

private void resetIcon() {
    final String buttonFocus = getEditButtonTag();
    SmartButtonView currentButton = mHost.findCurrentButton(buttonFocus);
    SmartButtonView otherButton = (SmartButtonView) getHiddenNavButtons().findViewWithTag(buttonFocus);
    ButtonConfig currentConfig = currentButton.getButtonConfig();
    ButtonConfig otherConfig = otherButton.getButtonConfig();
    OpaLayout currentOpa = (OpaLayout) currentButton.getParent();
    OpaLayout otherOpa = (OpaLayout) otherButton.getParent();
    currentConfig.clearCustomIconIconUri();
    otherConfig.clearCustomIconIconUri();
    currentButton.setButtonConfig(currentConfig);
    otherButton.setButtonConfig(otherConfig);
    mHost.setButtonDrawable(currentButton);
    SmartBarHelper.updateButtonScalingAndPadding(currentOpa, isLandscape());
    mHost.setButtonDrawable(otherButton);
    SmartBarHelper.updateButtonScalingAndPadding(otherOpa, !isLandscape());
    onCommitChanges();
}
Also used : ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) OpaLayout(com.android.systemui.navigation.OpaLayout) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView)

Example 9 with SmartButtonView

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

the class SmartBarEditor method createPopupContainer.

private void createPopupContainer() {
    removePopupContainer();
    loadPrimaryMenuMap();
    loadTapMenuMap();
    loadIconMenuMap();
    mEditContainer = new FrameLayout(mHost.getContext());
    mHidden = new SmartButtonView(mHost.getContext());
    mEditContainer.setOnTouchListener(mEditorWindowTouchListener);
    mHidden.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    mHidden.setVisibility(View.INVISIBLE);
    mEditContainer.addView(mHidden);
    mEditContainer.setVisibility(View.GONE);
    mWindowManager.addView(mEditContainer, getEditorParams());
}
Also used : SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView) FrameLayout(android.widget.FrameLayout)

Example 10 with SmartButtonView

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

the class SmartBarEditor method onImagePicked.

protected void onImagePicked(String uri) {
    final String buttonFocus = getEditButtonTag();
    SmartButtonView currentButton = mHost.findCurrentButton(buttonFocus);
    SmartButtonView otherButton = (SmartButtonView) getHiddenNavButtons().findViewWithTag(buttonFocus);
    ButtonConfig currentConfig = currentButton.getButtonConfig();
    ButtonConfig otherConfig = otherButton.getButtonConfig();
    OpaLayout currentOpa = (OpaLayout) currentButton.getParent();
    OpaLayout otherOpa = (OpaLayout) otherButton.getParent();
    currentConfig.setCustomImageUri(Uri.parse(uri));
    otherConfig.setCustomImageUri(Uri.parse(uri));
    currentButton.setButtonConfig(currentConfig);
    otherButton.setButtonConfig(otherConfig);
    mHost.setButtonDrawable(currentButton);
    SmartBarHelper.updateButtonScalingAndPadding(currentOpa, isLandscape());
    mHost.setButtonDrawable(otherButton);
    SmartBarHelper.updateButtonScalingAndPadding(otherOpa, !isLandscape());
    onCommitChanges();
}
Also used : ButtonConfig(com.android.internal.utils.du.Config.ButtonConfig) OpaLayout(com.android.systemui.navigation.OpaLayout) SmartButtonView(com.android.systemui.navigation.smartbar.SmartButtonView)

Aggregations

SmartButtonView (com.android.systemui.navigation.smartbar.SmartButtonView)19 OpaLayout (com.android.systemui.navigation.OpaLayout)11 ButtonConfig (com.android.internal.utils.du.Config.ButtonConfig)8 ViewGroup (android.view.ViewGroup)5 FrameLayout (android.widget.FrameLayout)5 Point (android.graphics.Point)3 LinearLayout (android.widget.LinearLayout)3 ActionConfig (com.android.internal.utils.du.Config.ActionConfig)2 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 ObjectAnimator (android.animation.ObjectAnimator)1 View (android.view.View)1 OvershootInterpolator (android.view.animation.OvershootInterpolator)1 ImageView (android.widget.ImageView)1 LayoutParams (android.widget.LinearLayout.LayoutParams)1 SmartBarView (com.android.systemui.navigation.smartbar.SmartBarView)1 ArrayList (java.util.ArrayList)1