当前位置: 首页>>代码示例>>Java>>正文


Java Animatable2类代码示例

本文整理汇总了Java中android.graphics.drawable.Animatable2的典型用法代码示例。如果您正苦于以下问题:Java Animatable2类的具体用法?Java Animatable2怎么用?Java Animatable2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Animatable2类属于android.graphics.drawable包,在下文中一共展示了Animatable2类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initUi

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.M)
private void initUi() {
    initializeToolbar();

    final AnimatedVectorDrawable avd2 = (AnimatedVectorDrawable) tvButton.getBackground();

    tvButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            tvButton.setText("Loading...");
            avd2.start();
        }
    });

    avd2.registerAnimationCallback(new Animatable2.AnimationCallback() {
        @Override
        public void onAnimationEnd(Drawable drawable) {
            tvButton.setText("Try Again");
        }
    });

}
 
开发者ID:vipulyaara,项目名称:betterHotels,代码行数:23,代码来源:NoHotelsActivity.java

示例2: beginAnimation

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
private void beginAnimation() {
    if (animId > 0) {
        anim = AnimationUtils.loadAnimation(getContext(), animId);
        startAnimation(anim);
    }
    if (animatorId > 0) {
        animator = AnimatorInflater.loadAnimator(getContext(), animatorId);
        animator.setTarget(this);
        animator.start();
    }
    Drawable drawable = getDrawable();
    if (drawable instanceof Animatable2) {
        if (callback != null) {
            ((Animatable2) drawable).registerAnimationCallback(callback);
        }
        ((Animatable2) drawable).start();
    }
}
 
开发者ID:StylingAndroid,项目名称:PresenterLite,代码行数:19,代码来源:AnimatedImageView.java

示例3: reverse

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
private void reverse() {
    Drawable current = getDrawable();
    if (current instanceof Animatable2) {
        ((Animatable2) current).unregisterAnimationCallback(callback);
    }
    if (otherDrawable instanceof Animatable2) {
        ((Animatable2) otherDrawable).registerAnimationCallback(callback);
        ((Animatable2) otherDrawable).start();
    }
    setImageDrawable(otherDrawable);
    otherDrawable = current;
}
 
开发者ID:StylingAndroid,项目名称:PresenterLite,代码行数:13,代码来源:AnimatedImageView.java

示例4: onDetachedFromWindow

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();
    Drawable drawable = getDrawable();
    if (callback != null && drawable instanceof Animatable2) {
        ((Animatable2) drawable).unregisterAnimationCallback(callback);
        ((Animatable2) drawable).stop();
    }
}
 
开发者ID:StylingAndroid,项目名称:PresenterLite,代码行数:10,代码来源:AnimatedImageView.java

示例5: onMarkerClick

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
@Override
public void onMarkerClick() {
    MovableMarker movableMarker = mMovableMarkerWeakReference.get();
    if (movableMarker != null) {
        movableMarker.morphToStaticForm();

        /* After the morph, remove the MarkerGrab */
        final MarkerGrab markerGrab = mMarkerGrabWeakReference.get();
        markerGrab.morphOut(new Animatable2.AnimationCallback() {
            @Override
            public void onAnimationEnd(Drawable drawable) {
                super.onAnimationEnd(drawable);
                if (markerGrab != null) {
                    mTileView.removeMarker(markerGrab);
                }
            }
        });

        /* The view has been moved, update the associated model object */
        MarkerGson.Marker marker = movableMarker.getMarker();
        if (mMap.getProjection() == null) {
            marker.lon = movableMarker.getRelativeX();
            marker.lat = movableMarker.getRelativeY();
        } else {
            marker.proj_x = movableMarker.getRelativeX();
            marker.proj_y = movableMarker.getRelativeY();
            double[] wgs84Coords;
            wgs84Coords = mMap.getProjection().undoProjection(marker.proj_x, marker.proj_y);
            if (wgs84Coords != null) {
                marker.lon = wgs84Coords[0];
                marker.lat = wgs84Coords[1];
            }
        }

        /* Save the changes on the markers.json file */
        MapLoader.getInstance().saveMarkers(mMap);
    }
}
 
开发者ID:peterLaurence,项目名称:TrekAdvisor,代码行数:39,代码来源:MarkerLayer.java

示例6: morphOut

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
public void morphOut(Animatable2.AnimationCallback animationEndCallback) {
    if (mCurrentDrawable == mInAnimation) {
        mCurrentDrawable = mOutAnimation;
        setImageDrawable(mOutAnimation);
        mOutAnimation.registerAnimationCallback(animationEndCallback);
        mOutAnimation.start();

    } else if (mCurrentDrawable == mOutAnimation) {
        mOutAnimation.stop();
    }

}
 
开发者ID:peterLaurence,项目名称:TrekAdvisor,代码行数:13,代码来源:MarkerGrab.java

示例7: starts

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
@CheckResult
@NonNull
@TargetApi(Build.VERSION_CODES.M)
public static Observable<Drawable> starts(Animatable2 animatable2){
    checkNotNull(animatable2, "animatable2 == null");
    return Observable.create(new Animatable2ListenerOnSubscribe(animatable2, AnimationEvent.START));
}
 
开发者ID:blipinsk,项目名称:RxAnimationBinding,代码行数:8,代码来源:RxAnimatable2.java

示例8: ends

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
@CheckResult
@NonNull
@TargetApi(Build.VERSION_CODES.M)
public static Observable<Drawable> ends(Animatable2 animatable2){
    checkNotNull(animatable2, "animatable2 == null");
    return Observable.create(new Animatable2ListenerOnSubscribe(animatable2, AnimationEvent.END));
}
 
开发者ID:blipinsk,项目名称:RxAnimationBinding,代码行数:8,代码来源:RxAnimatable2.java

示例9: addListener

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
public static void addListener(AnimatedVectorDrawable drawable, Object callback) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (callback instanceof Animatable2.AnimationCallback) {
            drawable.registerAnimationCallback((Animatable2.AnimationCallback) callback);
        } else {
            throw new IllegalArgumentException("Callback parameter must implement " + Animatable2.AnimationCallback.class.getName());
        }
    }
}
 
开发者ID:xu6148152,项目名称:binea_project_for_android,代码行数:10,代码来源:AnimatedVectorDrawableCompat.java

示例10: removeListener

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
public static boolean removeListener(AnimatedVectorDrawable drawable, Object callback) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (callback instanceof Animatable2.AnimationCallback) {
            return drawable.unregisterAnimationCallback((Animatable2.AnimationCallback) callback);
        } else {
            throw new IllegalArgumentException("Callback parameter must implement " + Animatable2.AnimationCallback.class.getName());
        }
    }
    return true;
}
 
开发者ID:xu6148152,项目名称:binea_project_for_android,代码行数:11,代码来源:AnimatedVectorDrawableCompat.java

示例11: Animatable2ListenerOnSubscribe

import android.graphics.drawable.Animatable2; //导入依赖的package包/类
Animatable2ListenerOnSubscribe(Animatable2 animatable2, int eventToCallOn) {
    this.animatable2 = animatable2;
    this.eventToCallOn = eventToCallOn;
}
 
开发者ID:blipinsk,项目名称:RxAnimationBinding,代码行数:5,代码来源:Animatable2ListenerOnSubscribe.java


注:本文中的android.graphics.drawable.Animatable2类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。