java类android.graphics.drawable.AnimationDrawable的实例源码

BGANormalRefreshViewHolder.java 文件源码 项目:GitHub 阅读 38 收藏 0 点赞 0 评论 0
@Override
public View getRefreshHeaderView() {
    if (mRefreshHeaderView == null) {
        mRefreshHeaderView = View.inflate(mContext, R.layout.view_refresh_header_normal, null);
        mRefreshHeaderView.setBackgroundColor(Color.TRANSPARENT);
        if (mRefreshViewBackgroundColorRes != -1) {
            mRefreshHeaderView.setBackgroundResource(mRefreshViewBackgroundColorRes);
        }
        if (mRefreshViewBackgroundDrawableRes != -1) {
            mRefreshHeaderView.setBackgroundResource(mRefreshViewBackgroundDrawableRes);
        }
        mHeaderStatusTv = (TextView) mRefreshHeaderView.findViewById(R.id.tv_normal_refresh_header_status);
        mHeaderArrowIv = (ImageView) mRefreshHeaderView.findViewById(R.id.iv_normal_refresh_header_arrow);
        mHeaderChrysanthemumIv = (ImageView) mRefreshHeaderView.findViewById(R.id.iv_normal_refresh_header_chrysanthemum);
        mHeaderChrysanthemumAd = (AnimationDrawable) mHeaderChrysanthemumIv.getDrawable();
        mHeaderStatusTv.setText(mPullDownRefreshText);
    }
    return mRefreshHeaderView;
}
AudioPlayerActivity.java 文件源码 项目:MobileMedia 阅读 36 收藏 0 点赞 0 评论 0
private void initViews() {
    mPlayingMatrix = (ImageView) findViewById(R.id.iv_now_playing_matrix);
    AnimationDrawable animationDrawable = (AnimationDrawable) mPlayingMatrix.getBackground();
    animationDrawable.start();
    mSongName = (TextView) findViewById(R.id.tv_now_playing_song_name);
    mArtist = (TextView) findViewById(R.id.tv_now_playing_singer);
    mCurrentPosition = (TextView) findViewById(R.id.tv_now_playing_time);
    mAudioSkb = (SeekBar) findViewById(R.id.sb_audio);
    mPlayModeBtn = (Button) findViewById(R.id.btn_audio_playmode);
    mPreBtn = (Button) findViewById(R.id.btn_audio_previous);
    mPlayPauseBtn = (Button) findViewById(R.id.btn_audio_playing_pause);
    mNextBtn = (Button) findViewById(R.id.btn_audio_next);
    mLyricBtn = (Button) findViewById(R.id.btn_audio_lyrc);
    mPlayModeBtn.setOnClickListener(mClickListener);
    mPreBtn.setOnClickListener(mClickListener);
    mPlayPauseBtn.setOnClickListener(mClickListener);
    mNextBtn.setOnClickListener(mClickListener);
    mLyricBtn.setOnClickListener(mClickListener);
    mLyricShowView = (LyricShowView) findViewById(R.id.lyric_view);
    mAudioSkb.setOnSeekBarChangeListener(new AudioSeekChangeListener());
}
TestActivity3.java 文件源码 项目:Logistics-guard 阅读 40 收藏 0 点赞 0 评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle(title);
    infoText = (TextView) findViewById(R.id.infoView);
    imgView = (ImageView) findViewById(R.id.cardbg);
    imgView.setBackgroundResource(R.drawable.myanim);
    _animation = (AnimationDrawable) imgView.getBackground();
    _animation.setOneShot(false);
    uiHandler = new MyHandler(this);

    mBluetoothReader = new BluetoothReader();
    mBluetoothReader.setOnReaderStateListener(new BluetoothReader.OnReaderStateListener() {
        @Override
        public void onReaderStateChange(String readerName, int readerState) {
            if (readerName.isEmpty() == false) {
                uiHandler.obtainMessage(READER_MESSAGE, readerState, -1, readerName).sendToTarget();
            }
        }
    });

    View scan = findViewById(R.id.btScan);
    scan.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            infoText.setText("Select bluetooth reader for connect...");
            Intent serverIntent = new Intent(TestActivity3.this, DeviceListActivity.class);
            startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE);
        }
    });
}
BaseFragment.java 文件源码 项目:GitHub 阅读 41 收藏 0 点赞 0 评论 0
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mLlProgressBar = getView(R.id.ll_progress_bar);
    ImageView img = getView(R.id.img_progress);

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

}
YunRefreshHeader.java 文件源码 项目:GitHub 阅读 41 收藏 0 点赞 0 评论 0
private void initView() {
    LayoutInflater.from(mContext).inflate(R.layout.kaws_refresh_header, this);
    ImageView img = (ImageView) findViewById(R.id.img);

    animationDrawable = (AnimationDrawable) img.getDrawable();
    if (animationDrawable.isRunning()) {
        animationDrawable.stop();
    }
    msg = (TextView) findViewById(R.id.msg);
    measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    mMeasuredHeight = getMeasuredHeight();
    setGravity(Gravity.CENTER_HORIZONTAL);
    mContainer = (LinearLayout) findViewById(R.id.container);
    mContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 0));
    this.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
BGARefreshViewHolder.java 文件源码 项目:GitHub 阅读 44 收藏 0 点赞 0 评论 0
/**
 * 获取上拉加载更多控件,如果不喜欢这种上拉刷新风格可重写该方法实现自定义LoadMoreFooterView
 *
 * @return
 */
public View getLoadMoreFooterView() {
    if (!mIsLoadingMoreEnabled) {
        return null;
    }
    if (mLoadMoreFooterView == null) {
        mLoadMoreFooterView = View.inflate(mContext, R.layout.view_normal_refresh_footer, null);
        mLoadMoreFooterView.setBackgroundColor(Color.TRANSPARENT);
        if (mLoadMoreBackgroundColorRes != -1) {
            mLoadMoreFooterView.setBackgroundResource(mLoadMoreBackgroundColorRes);
        }
        if (mLoadMoreBackgroundDrawableRes != -1) {
            mLoadMoreFooterView.setBackgroundResource(mLoadMoreBackgroundDrawableRes);
        }
        mFooterStatusTv = (TextView) mLoadMoreFooterView.findViewById(R.id.tv_normal_refresh_footer_status);
        mFooterChrysanthemumIv = (ImageView) mLoadMoreFooterView.findViewById(R.id.iv_normal_refresh_footer_chrysanthemum);
        mFooterChrysanthemumAd = (AnimationDrawable) mFooterChrysanthemumIv.getDrawable();
        mFooterStatusTv.setText(mLodingMoreText);
    }
    return mLoadMoreFooterView;
}
ImageViewAction.java 文件源码 项目:GitHub 阅读 35 收藏 0 点赞 0 评论 0
@Override public void error(Exception e) {
  ImageView target = this.target.get();
  if (target == null) {
    return;
  }
  Drawable placeholder = target.getDrawable();
  if (placeholder instanceof AnimationDrawable) {
    ((AnimationDrawable) placeholder).stop();
  }
  if (errorResId != 0) {
    target.setImageResource(errorResId);
  } else if (errorDrawable != null) {
    target.setImageDrawable(errorDrawable);
  }

  if (callback != null) {
    callback.onError(e);
  }
}
LoadingLayout.java 文件源码 项目:boohee_v5.6 阅读 36 收藏 0 点赞 0 评论 0
public final void reset() {
    if (this.mHeaderText != null) {
        this.mHeaderText.setText(this.mPullLabel);
    }
    this.mHeaderImage.setVisibility(0);
    if (this.mUseIntrinsicAnimation) {
        ((AnimationDrawable) this.mHeaderImage.getDrawable()).stop();
    } else {
        resetImpl();
    }
    if (this.mSubHeaderText == null) {
        return;
    }
    if (TextUtils.isEmpty(this.mSubHeaderText.getText())) {
        this.mSubHeaderText.setVisibility(8);
    } else {
        this.mSubHeaderText.setVisibility(0);
    }
}
App.java 文件源码 项目:QMark 阅读 38 收藏 0 点赞 0 评论 0
/**
 * 返回是否应该加载数据
 * 
 * @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;
}
MainActivity.java 文件源码 项目:FrameAnimator 阅读 40 收藏 0 点赞 0 评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button button =(Button)findViewById(R.id.button);

    view = (ImageView)findViewById(R.id.imageView);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            view.setBackgroundResource(R.drawable.face_emotion);
            AnimationDrawable frameAnimation2 = (AnimationDrawable) view.getBackground();
            frameAnimation2.stop();
            frameAnimation2.start();
        }
    });


}
CamomileSpinner.java 文件源码 项目:IOSDialog 阅读 33 收藏 0 点赞 0 评论 0
public void recreateWithParams(Context context, @ColorInt int spinnerColor, int duration, boolean clockwise) {
    boolean wasRunning = false;
    boolean oneShot = isOneShot();

    if (((AnimationDrawable)this.getBackground()).isRunning()) {
        wasRunning = true;
        stop();
    }

    AnimationDrawable newSpinner = createSpinner(context, spinnerColor, duration, clockwise);
    if (newSpinner != null) {
        if (oneShot) newSpinner.setOneShot(true);
        this.spinnerColor = spinnerColor;
        this.duration = duration;
        this.clockwise = clockwise;
        updateSpinner(newSpinner);
    }

    if (wasRunning) start();
}
MediaUtil.java 文件源码 项目:exciting-app 阅读 35 收藏 0 点赞 0 评论 0
/**
 * 结束播放音频
 */
public static void stopPlayVoice() {
    if (player != null && player.isPlaying()) {
        player.release();
        player = null;
    }
    if (v_playVoice != null) {
        try {
            ((AnimationDrawable) v_playVoice.getBackground()).stop();
            ((AnimationDrawable) v_playVoice.getBackground())
                    .selectDrawable(0);
            v_playVoice = null;
        } catch (Exception e) {
            e.printStackTrace();
        }
        // 注意
        // :此处try\catch用来修复BUG——播放语音时,滑动观看交流信息再点击语音会卡死。若是播放时,来回滑动过多,也有几率造成卡死。
    }
}
CompareActivity.java 文件源码 项目:Veggietizer 阅读 30 收藏 0 点赞 0 评论 0
@Override
public void onWindowFocusChanged(boolean hasFocus) {
    ImageView imageViewAnimTop = (ImageView) findViewById(R.id.imageView_animation_top);
    ImageView imageViewAnimBottom = (ImageView) findViewById(R.id.imageView_animation_bottom);

    AnimationDrawable animTop = (AnimationDrawable) imageViewAnimTop.getBackground();
    AnimationDrawable animBottom = (AnimationDrawable) imageViewAnimBottom.getBackground();

    animTop.start();
    animBottom.start();

    super.onWindowFocusChanged(hasFocus);
}
PointViewAnimObject.java 文件源码 项目:DragPointView 阅读 58 收藏 0 点赞 0 评论 0
public boolean isRunning() {
    if (object == null)
        return false;
    if (object instanceof AnimationDrawable) {
        return ((AnimationDrawable) object).isRunning();
    } else if (object instanceof Animator) {
        return ((Animator) object).isRunning();
    } else if (object instanceof Animation) {
        if (((Animation) object).hasStarted()) {
            return !((Animation) object).hasEnded();
        } else {
            return false;
        }
    }
    return false;
}
TextToSpeechFragment.java 文件源码 项目:CustomAndroidOneSheeld 阅读 52 收藏 0 点赞 0 评论 0
@Override
public void doOnViewCreated(View v, @Nullable Bundle savedInstanceState) {
    speakerLevel = (ImageView) v
            .findViewById(R.id.speaker_shield_imageview);
    femaleBtn = (Button) v.findViewById(R.id.increaseBtn);
    maleBtn = (Button) v.findViewById(R.id.decreaseBtn);
    ttsText = (OneSheeldTextView) v.findViewById(R.id.ttsText);
    ttsText.setMovementMethod(new ScrollingMovementMethod());
    animation = (AnimationDrawable) speakerLevel.getBackground();
}
LoadingLayout.java 文件源码 项目:CustomListView 阅读 41 收藏 0 点赞 0 评论 0
public final void refreshing() {
    if (null != mHeaderText) {
        mHeaderText.setText(mRefreshingLabel);
    }

    if (mUseIntrinsicAnimation) {
        ((AnimationDrawable) mHeaderImage.getDrawable()).start();
    } else {
        // Now call the callback
        refreshingImpl();
    }

    if (null != mSubHeaderText) {
        mSubHeaderText.setVisibility(View.GONE);
    }
}
TextToSpeechFragment.java 文件源码 项目:CustomAndroidOneSheeld 阅读 38 收藏 0 点赞 0 评论 0
@Override
public void onSpeek(final String txt) {
    uiHandler.post(new Runnable() {

        @Override
        public void run() {
            if (canChangeUI()) {
                speakerLevel
                        .setBackgroundResource(R.anim.tts_animation);
                ttsText.setText(txt);
                animation = (AnimationDrawable) speakerLevel
                        .getBackground();
                speakerLevel.post(runAnimation);
            }
        }
    });
}
OnboardingFragment.java 文件源码 项目:chilly 阅读 61 收藏 0 点赞 0 评论 0
@Override
protected void onPageChanged(final int newPage, int previousPage) {
    if (mContentAnimator != null) {
        mContentAnimator.end();
    }
    ArrayList<Animator> animators = new ArrayList<>();
    Animator fadeOut = createFadeOutAnimator(mContentView);

    fadeOut.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mContentView.setImageDrawable(getResources().getDrawable(pageImages[newPage]));
            ((AnimationDrawable) mContentView.getDrawable()).start();
        }
    });
    animators.add(fadeOut);
    animators.add(createFadeInAnimator(mContentView));
    AnimatorSet set = new AnimatorSet();
    set.playSequentially(animators);
    set.start();
    mContentAnimator = set;
}
AppCompatProgressBarHelper.java 文件源码 项目:boohee_v5.6 阅读 39 收藏 0 点赞 0 评论 0
private Drawable tileifyIndeterminate(Drawable drawable) {
    if (!(drawable instanceof AnimationDrawable)) {
        return drawable;
    }
    AnimationDrawable background = (AnimationDrawable) drawable;
    int N = background.getNumberOfFrames();
    Drawable newBg = new AnimationDrawable();
    newBg.setOneShot(background.isOneShot());
    for (int i = 0; i < N; i++) {
        Drawable frame = tileify(background.getFrame(i), true);
        frame.setLevel(10000);
        newBg.addFrame(frame, background.getDuration(i));
    }
    newBg.setLevel(10000);
    return newBg;
}
TweetDetailActivity.java 文件源码 项目:OSchina_resources_android 阅读 77 收藏 0 点赞 0 评论 0
private void resolveVoice() {
    if (tweet == null || tweet.getAudio() == null || tweet.getAudio().length == 0) return;
    mRecordLayout.setVisibility(View.VISIBLE);
    final AnimationDrawable drawable = (AnimationDrawable) mImgRecord.getBackground();
    mRecordLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (tweet == null) return;
            getRecordUtil().startPlay(tweet.getAudio()[0].getHref(), mSecondRecord);
        }
    });
    getRecordUtil().setOnPlayListener(new RecordButtonUtil.OnPlayListener() {
        @Override
        public void stopPlay() {
            drawable.stop();
            mImgRecord.setBackgroundDrawable(drawable.getFrame(0));
        }

        @Override
        public void starPlay() {
            drawable.start();
            mImgRecord.setBackgroundDrawable(drawable);
        }
    });
}
SkinCompatProgressBarHelper.java 文件源码 项目:AndroidSkinAnimator 阅读 40 收藏 0 点赞 0 评论 0
/**
 * Convert a AnimationDrawable for use as a barberpole animation.
 * Each frame of the animation is wrapped in a ClipDrawable and
 * given a tiling BitmapShader.
 */
private Drawable tileifyIndeterminate(Drawable drawable) {
    if (drawable instanceof AnimationDrawable) {
        AnimationDrawable background = (AnimationDrawable) drawable;
        final int N = background.getNumberOfFrames();
        AnimationDrawable newBg = new AnimationDrawable();
        newBg.setOneShot(background.isOneShot());

        for (int i = 0; i < N; i++) {
            Drawable frame = tileify(background.getFrame(i), true);
            frame.setLevel(10000);
            newBg.addFrame(frame, background.getDuration(i));
        }
        newBg.setLevel(10000);
        drawable = newBg;
    }
    return drawable;
}
SkinCompatProgressBarHelper.java 文件源码 项目:Android-skin-support 阅读 35 收藏 0 点赞 0 评论 0
/**
 * Convert a AnimationDrawable for use as a barberpole animation.
 * Each frame of the animation is wrapped in a ClipDrawable and
 * given a tiling BitmapShader.
 */
private Drawable tileifyIndeterminate(Drawable drawable) {
    if (drawable instanceof AnimationDrawable) {
        AnimationDrawable background = (AnimationDrawable) drawable;
        final int N = background.getNumberOfFrames();
        AnimationDrawable newBg = new AnimationDrawable();
        newBg.setOneShot(background.isOneShot());

        for (int i = 0; i < N; i++) {
            Drawable frame = tileify(background.getFrame(i), true);
            frame.setLevel(10000);
            newBg.addFrame(frame, background.getDuration(i));
        }
        newBg.setLevel(10000);
        drawable = newBg;
    }
    return drawable;
}
CustomProgressDialog.java 文件源码 项目:MyLife 阅读 40 收藏 0 点赞 0 评论 0
private void initData() {

        mImageView.setBackgroundResource(mResid);
        // 通过ImageView对象拿到背景显示的AnimationDrawable
        mAnimation = (AnimationDrawable) mImageView.getBackground();
        // 为了防止在onCreate方法中只显示第一帧的解决方案之一
        mImageView.post(new Runnable() {
            @TargetApi(Build.VERSION_CODES.HONEYCOMB)
            @Override
            public void run() {
                mAnimation.start();

            }
        });
        mLoadingTv.setText(mLoadingTip);

    }
ShowProgressDialog.java 文件源码 项目:Hotspot-master-devp 阅读 37 收藏 0 点赞 0 评论 0
public void onWindowFocusChanged(boolean hasFocus){
    if (progressDialog == null){
        return;
    }

    ImageView imageView = (ImageView) progressDialog.findViewById(R.id.loadingImageView);
    AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getBackground();
    animationDrawable.start();
}
LoadingLayout.java 文件源码 项目:sctalk 阅读 41 收藏 0 点赞 0 评论 0
public final void reset() {
    if (null != mHeaderText) {
        mHeaderText.setText(mPullLabel);
        // mSubHeaderText.setText(mLastRefresh+sdf.format(date));
        date = new Date();
    }
    mHeaderImage.setVisibility(View.VISIBLE);

    if (mUseIntrinsicAnimation) {
        ((AnimationDrawable) mHeaderImage.getDrawable()).stop();
    } else {
        // Now call the callback
        resetImpl();
    }

    // if (null != mSubHeaderText) {
    // if (TextUtils.isEmpty(mSubHeaderText.getText())) {
    // mSubHeaderText.setVisibility(View.GONE);
    // } else {
    // mSubHeaderText.setVisibility(View.VISIBLE);
    // }
    // }
}
AdapterMusic.java 文件源码 项目:DMAudioStreamer 阅读 41 收藏 0 点赞 0 评论 0
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;
    }
}
MainActivity.java 文件源码 项目:MeteorView 阅读 47 收藏 0 点赞 0 评论 0
private void initView() {
    Picasso.with(this).load(R.drawable.star).resize(900, 1600).centerCrop().into(imgBackgroundStar, new Callback() {
        @Override
        public void onSuccess() {
            AnimationDrawable frameAnimation = (AnimationDrawable) imgBackgroundFire.getDrawable();
            frameAnimation.start();

            showButtonStartChat();
        }

        @Override
        public void onError() {

        }
    });
    Picasso.with(this).load(R.drawable.icon_light_moon).resize(100, 100).centerCrop().into(imgBackgroundMoon);
    Picasso.with(this).load(R.drawable.background_main_back).resize(500, 322).centerCrop().into(imgBackgroundTree);
    Picasso.with(this).load(R.drawable.icon_meteor).into(imgMeteor0);
    Picasso.with(this).load(R.drawable.icon_meteor).into(imgMeteor1);
    Picasso.with(this).load(R.drawable.icon_meteor).into(imgMeteor2);
    Picasso.with(this).load(R.drawable.icon_meteor).into(imgMeteor3);

}
LoadingLayout.java 文件源码 项目:Tribe 阅读 44 收藏 0 点赞 0 评论 0
public final void refreshing() {
    if (null != mHeaderText) {
        mHeaderText.setText(mRefreshingLabel);
    }

    if (mUseIntrinsicAnimation) {
        ((AnimationDrawable) mHeaderImage.getDrawable()).start();
    } else {
        // Now call the callback
        refreshingImpl();
    }

    if (null != mSubHeaderText) {
        mSubHeaderText.setVisibility(View.GONE);
    }
}
LoadingLayout.java 文件源码 项目:sctalk 阅读 42 收藏 0 点赞 0 评论 0
public final void refreshing() {
    if (null != mHeaderText) {
        mHeaderText.setText(mRefreshingLabel);
        // mSubHeaderText.setText(mLastRefresh+sdf.format(date));
    }

    if (mUseIntrinsicAnimation) {
        ((AnimationDrawable) mHeaderImage.getDrawable()).start();
    } else {
        // Now call the callback
        refreshingImpl();
    }

    // if (null != mSubHeaderText) {
    // mSubHeaderText.setVisibility(View.GONE);
    // }
}
TestAnimationActivity.java 文件源码 项目:AndroidUiKit 阅读 31 收藏 0 点赞 0 评论 0
@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        View animView = findViewById(R.id.tv_view);
        animView.setBackgroundResource(R.drawable.test_frame_anim);
        ((AnimationDrawable) animView.getBackground()).start();
//经过运行查看内存比较。传统用法,一次性加载所有帧,内存消耗高,容易溢出导致奔溃。 FrameAnimDrawable 只加载当前动画帧,用完即释放,内存消耗少,动画质量媲美AnimationDrawable。
//        int[] RES_IDS = new int[]{
//          R.drawable.test_pic_01,
//          R.drawable.test_pic_02,
//          R.drawable.test_pic_03,
//          R.drawable.test_pic_04,
//          R.drawable.test_pic_05,
//          R.drawable.test_pic_06,
//          R.drawable.test_pic_07,
//          R.drawable.test_pic_08,
//          R.drawable.test_pic_09,
//          R.drawable.test_pic_10,
//        };

//        FrameAnimDrawable drawable = new FrameAnimDrawable(5, RES_IDS, getResources());
//        animView.setBackgroundDrawable(drawable);
//        drawable.start();
    }


问题


面经


文章

微信
公众号

扫码关注公众号