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