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;
}
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);
}
}
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();
}
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());
}
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();
}
Aggregations