use of com.android.systemui.navigation.OpaLayout 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.OpaLayout 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();
}
use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartBarEditor method findInterceptingView.
/**
* Find intersecting view in mButtonViews
*
* @param pos - pointer location
* @param v - view being dragged
* @return intersecting view or null
*/
private View findInterceptingView(float pos, View v) {
for (String buttonTag : mHost.getCurrentSequence()) {
SmartButtonView otherButton = mHost.findCurrentButton(buttonTag);
OpaLayout otherOpa = (OpaLayout) otherButton.getParent();
if (otherOpa == v) {
continue;
}
if (mSquatters.contains(otherOpa)) {
continue;
}
otherOpa.getLocationOnScreen(sLocation);
float otherPos = sLocation[mHost.isVertical() ? 1 : 0];
float otherDimension = mHost.isVertical() ? v.getHeight() : v.getWidth();
if (pos > (otherPos + otherDimension / 4) && pos < (otherPos + otherDimension)) {
mSquatters.add(otherOpa);
return otherOpa;
}
}
return null;
}
use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartBarEditor method switchId.
/**
* Switches positions of two views and updates their mButtonViews entry
*
* @param targetView - view to be replaced animate out
* @param view - view being dragged
*/
private void switchId(View replaceView, View dragView) {
final OpaLayout squatter = (OpaLayout) replaceView;
final OpaLayout dragger = (OpaLayout) dragView;
final boolean vertical = mHost.isVertical();
ViewGroup parent = (ViewGroup) replaceView.getParent();
float slideTo = vertical ? mDragOrigin - parent.getTop() : mDragOrigin - parent.getLeft();
replaceView.getLocationOnScreen(sLocation);
mDragOrigin = sLocation[vertical ? 1 : 0];
final int targetIndex = mHost.getCurrentSequence().indexOf(squatter.getButton().getTag());
final int draggedIndex = mHost.getCurrentSequence().indexOf(dragger.getButton().getTag());
Collections.swap(mHost.getCurrentSequence(), draggedIndex, targetIndex);
SmartButtonView hidden1 = (SmartButtonView) getHiddenNavButtons().findViewWithTag(squatter.getButton().getTag());
SmartButtonView hidden2 = (SmartButtonView) getHiddenNavButtons().findViewWithTag(dragger.getButton().getTag());
OpaLayout hidden1Opa = (OpaLayout) hidden1.getParent();
OpaLayout hidden2Opa = (OpaLayout) hidden2.getParent();
swapConfigs(hidden1Opa, hidden2Opa);
Animator anim = getButtonSlideAnimator(squatter, vertical, slideTo);
anim.setInterpolator(new OvershootInterpolator());
anim.setDuration(250);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mSquatters.remove(squatter);
}
});
anim.start();
}
use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartBarEditor method onIconPicked.
@Override
protected void onIconPicked(String type, String packageName, String iconName) {
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.setCustomIconUri(type, packageName, iconName);
otherConfig.setCustomIconUri(type, packageName, iconName);
currentButton.setButtonConfig(currentConfig);
otherButton.setButtonConfig(otherConfig);
mHost.setButtonDrawable(currentButton);
SmartBarHelper.updateButtonScalingAndPadding(currentOpa, isLandscape());
mHost.setButtonDrawable(otherButton);
SmartBarHelper.updateButtonScalingAndPadding(otherOpa, !isLandscape());
onCommitChanges();
}
Aggregations