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


Java AnimationDrawable.start方法代码示例

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


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

示例1: getDrawableByState

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
private Drawable getDrawableByState(Context context, int state) {
    switch (state) {
        case PlaybackStateCompat.STATE_NONE:
            Drawable pauseDrawable = ContextCompat.getDrawable(context, R.drawable.ic_play);
            DrawableCompat.setTintList(pauseDrawable, colorPlay);
            return pauseDrawable;
        case PlaybackStateCompat.STATE_PLAYING:
            AnimationDrawable animation = (AnimationDrawable) ContextCompat.getDrawable(context, R.drawable.equalizer);
            DrawableCompat.setTintList(animation, colorPlay);
            animation.start();
            return animation;
        case PlaybackStateCompat.STATE_PAUSED:
            Drawable playDrawable = ContextCompat.getDrawable(context, R.drawable.equalizer);
            DrawableCompat.setTintList(playDrawable, colorPause);
            return playDrawable;
        default:
            Drawable noneDrawable = ContextCompat.getDrawable(context, R.drawable.ic_play);
            DrawableCompat.setTintList(noneDrawable, colorPlay);
            return noneDrawable;
    }
}
 
开发者ID:dibakarece,项目名称:DMAudioStreamer,代码行数:22,代码来源:AdapterMusic.java

示例2: initLoading

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
private void initLoading() {
    //加载中
    llLoading.setStatus(LoadingLayout.Loading);
    ImageView img = (ImageView) findViewById(R.id.iv_loading_progress);
    // 加载动画
    AnimationDrawable mAnimationDrawable = (AnimationDrawable) img.getDrawable();
    // 默认进入页面就开启动画
    if (!mAnimationDrawable.isRunning()) {
        mAnimationDrawable.start();
    }
    //网络错误之类的
    if (!JUtils.isNetWorkAvilable()) {
        llLoading.setStatus(LoadingLayout.No_Network);
        return;
    }
}
 
开发者ID:zhao-mingjian,项目名称:qvod,代码行数:17,代码来源:MovieDetailsActivity.java

示例3: onWindowFocusChanged

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
public void onWindowFocusChanged(boolean hasFocus){
	if (progressDialog == null){
		return;
	}
	
    ImageView imageView = (ImageView) progressDialog.findViewById(R.id.loadingImageView);
    AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getBackground();
    animationDrawable.start();
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:10,代码来源:ShowProgressDialog.java

示例4: showLoadingOrNoNet

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
/**
 * 返回是否应该加载数据
 * 
 * @param empty 页面是否为空
 * @param showLoading 如果为空,且有网络的情况下是否显示正在加载,若为false则显示点击重新加载
 * @param 用来显示这些图片的ImageView
 **/
public static boolean showLoadingOrNoNet(boolean empty, boolean showLoading, boolean feedbackIfNoNet, ImageView imgState) {
	if (empty) {
		if (feedbackIfNoNet ? checkNetStateAndFeedbackUser() : Network.isNetConnected(get())) {
			if (showLoading) {
				imgState.setVisibility(View.VISIBLE);
				imgState.setImageResource(R.drawable.anim_list_i_pull_2_refresh_header);
				AnimationDrawable anim = (AnimationDrawable)imgState.getDrawable();
				anim.start();
				return true;
			} else {
				imgState.setVisibility(View.VISIBLE);
				imgState.setImageResource(R.drawable.img_common_click_reload);
			}
		} else {
			imgState.setVisibility(View.VISIBLE);
			imgState.setImageResource(R.drawable.img_common_no_net);
		}
	} else {
		imgState.setImageResource(0);
		imgState.setVisibility(View.GONE);
	}
	return false;
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:31,代码来源:App.java

示例5: onCreate

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_frame_anim);

    View view = findViewById(R.id.v_frame);
    view.setBackgroundResource(R.drawable.frame_anim_example);
    AnimationDrawable animationDrawable = (AnimationDrawable) view.getBackground();
    animationDrawable.start();
}
 
开发者ID:DysaniazzZ,项目名称:ArtOfAndroid,代码行数:11,代码来源:FrameAnimActivity.java

示例6: onClick

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
@Override
public void onClick(final View v) {

    if (currentLookForWid.getText().equals(" ")) {
        v.startAnimation(notItAnim);
        return;
    }

    String symv = (String)v.getTag();

    TextView wid2 = activeSyms.get(current);
    if (wid2==null) return;

    String symw = (String)wid2.getTag();

    if (symv.equals(symw)) {

        Log.d("Doda", "Found " + symv.codePointAt(0));
        v.setAlpha(.6f);
        v.startAnimation(wasItAnim);


        final ImageView blow = new ImageView(this);
        blow.setBackgroundResource(R.drawable.explosion);

        Point location = symPoints.get((TextView)v);
        float fac = 1.25f;

        score += Math.max(100, 5000 - (System.currentTimeMillis() - findTime)) * (backgroundImage?1.5:1);

        int msize = spToPx((int)(mMode.getMaxIconSize(bsize)*fac));
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(msize, msize);
        lp.setMargins(location.x - (int)(mMode.getMaxIconSize(bsize)*fac/2), location.y - (int)(mMode.getMaxIconSize(bsize)*fac/2), 0, 0);
        lp.gravity = Gravity.START | Gravity.TOP;


        blow.setLayoutParams(lp);
        mSoundEffects.playPlode();

        v.clearAnimation();

        mMainScreen.removeView(v);
        activeSyms.set(current, null);
        mMainScreen.addView(blow);

        AnimationDrawable ad = ((AnimationDrawable) blow.getBackground());
        int time = ad.getNumberOfFrames() * ad.getDuration(0);
        ad.start();
        showNext(false);

        mMainScreen.postDelayed(new Runnable() {
            @Override
            public void run() {
                mMainScreen.removeView(blow);
            }
        }, time + 20);

    } else {

        v.startAnimation(notItAnim);
        if (mMode.isTimed()) {
            startTime -= 5000;
            showMessage(getString(R.string.miss_penalty));
        }

    }

}
 
开发者ID:quaap,项目名称:DodaTheExploda,代码行数:69,代码来源:MainActivity.java

示例7: createLoadingView

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
private View createLoadingView() {
    loadingView = LayoutInflater.from(mContext).inflate(R.layout.basefragment_state_loading, null);
    img = (ImageView) loadingView.getRootView().findViewById(R.id.img_progress);
    // 加载动画 这边也可以直接用progressbar 可以看看topnews页下拉刷新就是只用用progressbar控制动画
    mAnimationDrawable = (AnimationDrawable) img.getDrawable();
    // 默认进入页面就开启动画
    if (!mAnimationDrawable.isRunning()) {
        mAnimationDrawable.start();
    }
    return loadingView;
}
 
开发者ID:paterWang,项目名称:EasyReader,代码行数:12,代码来源:LoadingPage.java

示例8: endOfSpeech

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
private void endOfSpeech() {
    if (null == imgMic) return;
    imgMic.setImageResource(R.drawable.rc_anim_speech_end);
    animEnd = (AnimationDrawable) imgMic.getDrawable();
    imgMic.clearAnimation();
    animEnd.start();
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:8,代码来源:Recognizer.java

示例9: showLoadingView

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
/**
 * 显示加载中提示界面
 * showLoadingView
 *
 * @param parent
 * @param tipStr
 * @since 1.0
 */
public static void showLoadingView(ViewGroup parent, String tipStr) {
    if (parent == null) return;
    AnimationDrawable drawable = (AnimationDrawable) parent.getResources().getDrawable(R.drawable.ic_page_load_anim);
    View loadingView = getNoticeView(parent, drawable, tipStr, ID_LOADING_VIEW);

    drawable.start();
    showLoadingView(parent, loadingView);
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:17,代码来源:UIUtils.java

示例10: changeToReleaseRefresh

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
public void changeToReleaseRefresh() {
    mReleaseRefreshingView.setImageResource(mChangeToReleaseRefreshAnimResId);
    mChangeToReleaseRefreshAd = (AnimationDrawable) mReleaseRefreshingView.getDrawable();

    mReleaseRefreshingView.setVisibility(VISIBLE);
    mPullDownView.setVisibility(INVISIBLE);

    mChangeToReleaseRefreshAd.start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:BGAMeiTuanRefreshView.java

示例11: beginOfSpeech

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
private void beginOfSpeech() {
    if (null == imgMic) return;
    imgMic.setImageResource(R.drawable.rc_anim_speech_start);
    animStart = (AnimationDrawable) imgMic.getDrawable();
    imgMic.clearAnimation();
    animStart.start();
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:8,代码来源:Recognizer.java

示例12: showAnimation

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
private void showAnimation() {
	// play voice, and start animation
	if (message.direct() == EMMessage.Direct.RECEIVE) {
		voiceIconView.setImageResource(R.anim.voice_from_icon);
	} else {
		voiceIconView.setImageResource(R.anim.voice_to_icon);
	}
	voiceAnimation = (AnimationDrawable) voiceIconView.getDrawable();
	voiceAnimation.start();
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:11,代码来源:EaseChatRowVoicePlayClickListener.java

示例13: startAnimationImages

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
/**
 * 开始帧动画(目前只支持本地动画)
 *
 * @param images
 * @param duration
 * @return
 */
public UDImageView startAnimationImages(String[] images, int duration, boolean repeat) {
    final T view = getView();
    if (view != null) {
        Drawable[] frames = null;
        if (images != null && images.length > 0) {
            if (getLuaResourceFinder() != null) {
                frames = new Drawable[images.length];
                for (int i = 0; i < images.length; i++) {
                    frames[i] = getLuaResourceFinder().findDrawable(images[i]);
                }
            }
            if (frames != null && frames.length > 0) {
                mFrameAnimation = new AnimationDrawable();
                try {
                    for (Drawable frame : frames) {
                        mFrameAnimation.addFrame(frame, duration);
                    }
                } catch (Throwable e) {
                    e.printStackTrace();
                    LogUtil.e("[LuaView-Error] UDImageView.startAnimationImages failed!");
                }
                mFrameAnimation.setOneShot(!repeat);
                LuaViewUtil.setBackground(view, mFrameAnimation);
                mFrameAnimation.setVisible(true, true);
                mFrameAnimation.start();
            }
        }
    }
    return this;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:38,代码来源:UDImageView.java

示例14: showAnimation

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
private void showAnimation() {
	// play voice, and start animation
	if (message.direct() == EMMessage.Direct.RECEIVE) {
		voiceIconView.setImageResource(R.drawable.voice_from_icon);
	} else {
		voiceIconView.setImageResource(R.drawable.voice_to_icon);
	}
	voiceAnimation = (AnimationDrawable) voiceIconView.getDrawable();
	voiceAnimation.start();
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:11,代码来源:EaseChatRowVoicePlayClickListener.java

示例15: setContentView

import android.graphics.drawable.AnimationDrawable; //导入方法依赖的package包/类
@Override
public void setContentView(@LayoutRes int layoutResID) {
    View ll = getLayoutInflater().inflate(R.layout.activity_header_base, null);

    // 内容
    bindingContentView = DataBindingUtil.inflate(getLayoutInflater(), layoutResID, null, false);
    // 头部
    bindingHeaderView = DataBindingUtil.inflate(getLayoutInflater(), setHeaderLayout(), null, false);
    // 标题
    bindingTitleView = DataBindingUtil.inflate(getLayoutInflater(), R.layout.base_header_title_bar, null, false);

    // title (如自定义很强可以拿出去)
    RelativeLayout.LayoutParams titleParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    bindingTitleView.getRoot().setLayoutParams(titleParams);
    RelativeLayout mTitleContainer = (RelativeLayout) ll.findViewById(R.id.title_container);
    mTitleContainer.addView(bindingTitleView.getRoot());
    getWindow().setContentView(ll);

    // header
    RelativeLayout.LayoutParams headerParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    bindingHeaderView.getRoot().setLayoutParams(headerParams);
    RelativeLayout mHeaderContainer = (RelativeLayout) ll.findViewById(R.id.header_container);
    mHeaderContainer.addView(bindingHeaderView.getRoot());
    getWindow().setContentView(ll);

    // content
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    bindingContentView.getRoot().setLayoutParams(params);
    RelativeLayout mContainer = (RelativeLayout) ll.findViewById(R.id.container);
    mContainer.addView(bindingContentView.getRoot());
    getWindow().setContentView(ll);

    llProgressBar = getView(R.id.ll_progress_bar);
    refresh = getView(R.id.ll_error_refresh);

    // 设置自定义元素共享切换动画
    setMotion(setHeaderPicView(),false);

    // 初始化滑动渐变
    initSlideShapeTheme(setHeaderImgUrl(), setHeaderImageView());

    // 设置toolbar
    setToolBar();

    ImageView img = getView(R.id.img_progress);

    // 加载动画
    mAnimationDrawable = (AnimationDrawable) img.getDrawable();
    // 默认进入页面就开启动画
    if (!mAnimationDrawable.isRunning()) {
        mAnimationDrawable.start();
    }
    // 点击加载失败布局
    refresh.setOnClickListener(new PerfectClickListener() {
        @Override
        protected void onNoDoubleClick(View v) {
            showLoading();
            onRefresh();
        }
    });
    bindingContentView.getRoot().setVisibility(View.GONE);

}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:64,代码来源:BaseHeaderActivity.java


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