use of android.view.ViewPropertyAnimator in project apps-android-wikipedia by wikimedia.
the class FeedItemAnimator method animateRemoveImpl.
private void animateRemoveImpl(final ViewHolder holder) {
final View view = holder.itemView;
final ViewPropertyAnimator animation = view.animate();
mRemoveAnimations.add(holder);
animation.setDuration(getRemoveDuration()).alpha(0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animator) {
dispatchRemoveStarting(holder);
}
@Override
public void onAnimationEnd(Animator animator) {
animation.setListener(null);
view.setAlpha(1);
dispatchRemoveFinished(holder);
mRemoveAnimations.remove(holder);
dispatchFinishedWhenDone();
}
}).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);
} else {
// showActionBar(false);
}
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 animate by hitherejoe.
the class ViewPropertyAnimatorActivity method buildAndStartAnimation.
private void buildAndStartAnimation(View view) {
ViewPropertyAnimator animator = view.animate();
if (mAnimateAlphaCheck.isChecked() || view.getAlpha() == 0f) {
float animationValue = view.getAlpha() == 0f ? 1f : 0f;
animator.alpha(animationValue);
}
if (mAnimateScaleCheck.isChecked()) {
float animationValue = view.getScaleY() == 0f ? 1f : 0f;
animator.scaleX(animationValue).scaleY(animationValue);
}
if (mAnimateZCheck.isChecked()) {
float animationValue = view.getTranslationZ() != 25f ? 25f : 2f;
animator.translationZ(animationValue);
}
if (mAnimationDurationCheck.isChecked()) {
animator.setDuration(500l);
}
if (mAnimationDelayCheck.isChecked()) {
animator.setStartDelay(500l);
}
animator.setInterpolator(getSelectedInterpolator());
animator.start();
}
use of android.view.ViewPropertyAnimator in project Material-Movies by saulmm.
the class GUIUtils method startScaleAnimationFromPivotY.
public static void startScaleAnimationFromPivotY(int pivotX, int pivotY, final View v, final AnimatorListener animatorListener) {
final AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator();
v.setScaleY(SCALE_START_ANCHOR);
v.setPivotX(pivotX);
v.setPivotY(pivotY);
v.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
v.getViewTreeObserver().removeOnPreDrawListener(this);
ViewPropertyAnimator viewPropertyAnimator = v.animate().setInterpolator(interpolator).scaleY(1).setDuration(SCALE_DELAY);
if (animatorListener != null)
viewPropertyAnimator.setListener(animatorListener);
viewPropertyAnimator.start();
return true;
}
});
}
use of android.view.ViewPropertyAnimator in project Material-Movies by saulmm.
the class GUIUtils method hideScaleAnimationFromPivot.
public static void hideScaleAnimationFromPivot(View v, AnimatorListener animatorListener) {
ViewPropertyAnimator viewPropertyAnimator = v.animate().setInterpolator(new AccelerateDecelerateInterpolator()).scaleY(SCALE_START_ANCHOR).setDuration(SCALE_DELAY);
if (animatorListener != null)
viewPropertyAnimator.setListener(animatorListener);
viewPropertyAnimator.start();
}
Aggregations