use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.
the class VideoMenu method animateFadeIn.
public void animateFadeIn(final ListView v) {
ViewPropertyAnimator vp = v.animate();
vp.alpha(1f).setDuration(ANIMATION_DURATION);
vp.start();
}
use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.
the class VideoMenu method animateFadeOut.
private void animateFadeOut(final ListView v, final int level) {
if (v == null || mPopupStatus == POPUP_IN_ANIMATION_FADE)
return;
mPopupStatus = POPUP_IN_ANIMATION_FADE;
ViewPropertyAnimator vp = v.animate();
vp.alpha(0f).setDuration(ANIMATION_DURATION);
vp.setListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (level == 1) {
mUI.dismissLevel1();
initializePopup();
mPopupStatus = POPUP_NONE;
mUI.cleanupListview();
} else if (level == 2) {
mUI.dismissLevel2();
mPopupStatus = POPUP_FIRST_LEVEL;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (level == 1) {
mUI.dismissLevel1();
initializePopup();
mPopupStatus = POPUP_NONE;
mUI.cleanupListview();
} else if (level == 2) {
mUI.dismissLevel2();
mPopupStatus = POPUP_FIRST_LEVEL;
}
}
});
vp.start();
}
use of android.view.ViewPropertyAnimator in project android_packages_apps_Snap by LineageOS.
the class VideoMenu method animateSlideOut.
private void animateSlideOut(final ListView v, final int level) {
if (v == null || mPopupStatus == POPUP_IN_ANIMATION_SLIDE)
return;
mPopupStatus = POPUP_IN_ANIMATION_SLIDE;
ViewPropertyAnimator vp = v.animate();
if (View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())) {
switch(mUI.getOrientation()) {
case 0:
vp.translationXBy(v.getWidth());
break;
case 90:
vp.translationYBy(-2 * v.getHeight());
break;
case 180:
vp.translationXBy(-2 * v.getWidth());
break;
case 270:
vp.translationYBy(v.getHeight());
break;
}
} else {
switch(mUI.getOrientation()) {
case 0:
vp.translationXBy(-v.getWidth());
break;
case 90:
vp.translationYBy(2 * v.getHeight());
break;
case 180:
vp.translationXBy(2 * v.getWidth());
break;
case 270:
vp.translationYBy(-v.getHeight());
break;
}
}
vp.setListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (level == 1) {
mUI.dismissLevel1();
initializePopup();
mPopupStatus = POPUP_NONE;
mUI.cleanupListview();
} else if (level == 2) {
mUI.dismissLevel2();
mPopupStatus = POPUP_FIRST_LEVEL;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (level == 1) {
mUI.dismissLevel1();
initializePopup();
mPopupStatus = POPUP_NONE;
mUI.cleanupListview();
} else if (level == 2) {
mUI.dismissLevel2();
mPopupStatus = POPUP_FIRST_LEVEL;
}
}
});
vp.setDuration(ANIMATION_DURATION).start();
}
use of android.view.ViewPropertyAnimator in project android_packages_apps_Gallery2 by LineageOS.
the class FilterShowActivity method loadEditorPanel.
public void loadEditorPanel(final FilterRepresentation representation) {
final int currentId = representation.getEditorId();
// show representation
if (mCurrentEditor != null) {
mCurrentEditor.detach();
}
mCurrentEditor = mEditorPlaceHolder.showEditor(currentId);
if (mCurrentEditor.showsActionBar()) {
setActionBar();
showActionBar(true);
}
if (representation.getFilterType() == FilterRepresentation.TYPE_WATERMARK_CATEGORY) {
loadWaterMarkPanel((FilterWatermarkRepresentation) representation);
return;
}
if (currentId == ImageOnlyEditor.ID) {
mCurrentEditor.reflectCurrentFilter();
return;
}
if (currentId == EditorTruePortraitImageOnly.ID) {
mCurrentEditor.reflectCurrentFilter();
setActionBarForEffects(mCurrentEditor);
return;
}
if (currentId == EditorCrop.ID) {
loadEditorCropPanel();
return;
}
if (useStraightenPanel(currentId)) {
new Runnable() {
@Override
public void run() {
StraightenPanel panel = new StraightenPanel();
Bundle bundle = new Bundle();
bundle.putInt(StraightenPanel.EDITOR_ID, currentId);
bundle.putString(StraightenPanel.EDITOR_NAME, representation.getName());
panel.setArguments(bundle);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
transaction.commit();
}
}.run();
return;
}
if (currentId == TrueScannerEditor.ID) {
new Runnable() {
@Override
public void run() {
TrueScannerPanel panel = new TrueScannerPanel();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
transaction.commit();
}
}.run();
return;
}
if (currentId == EditorTruePortraitMask.ID) {
new Runnable() {
@Override
public void run() {
setActionBarForEffects(mCurrentEditor);
TruePortraitMaskEditorPanel panel = new TruePortraitMaskEditorPanel();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
transaction.commit();
}
}.run();
return;
}
Runnable showEditor = new Runnable() {
@Override
public void run() {
EditorPanel panel = new EditorPanel();
panel.setEditor(currentId);
setActionBarForEffects(mCurrentEditor);
Fragment main = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
if (main instanceof MainPanel) {
((MainPanel) main).setEditorPanelFragment(panel);
}
}
};
Fragment main = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
boolean doAnimation = false;
if (mShowingImageStatePanel && getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
doAnimation = true;
}
if (doAnimation && main != null && main instanceof MainPanel) {
MainPanel mainPanel = (MainPanel) main;
View container = mainPanel.getView().findViewById(R.id.category_panel_container);
View bottom = mainPanel.getView().findViewById(R.id.bottom_panel);
int panelHeight = container.getHeight() + bottom.getHeight();
ViewPropertyAnimator anim = mainPanel.getView().animate();
anim.translationY(panelHeight).start();
final Handler handler = new Handler();
handler.postDelayed(showEditor, anim.getDuration());
} else {
showEditor.run();
}
}
use of android.view.ViewPropertyAnimator in project UnityModManager by xausky.
the class FabBehavior method hide.
// 隐藏时的动画
private void hide(final View view) {
ViewPropertyAnimator animator = view.animate().translationY(viewY).setInterpolator(INTERPOLATOR).setDuration(200);
animator.setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
isAnimate = true;
}
@Override
public void onAnimationEnd(Animator animator) {
view.setVisibility(View.INVISIBLE);
isAnimate = false;
}
@Override
public void onAnimationCancel(Animator animator) {
show(view);
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
animator.start();
}
Aggregations