Search in sources :

Example 21 with AnimationDrawable

use of android.graphics.drawable.AnimationDrawable in project NiceMusic by lizixian18.

the class ArtistSongAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(ArtistHolder holder, int position) {
    SongInfo info = mSongInfoList.get(position);
    holder.mMusicNum.setText(String.valueOf(position + 1));
    holder.mMusicName.setText(info.getSongName());
    AnimationDrawable animationDrawable = (AnimationDrawable) holder.mImageAnim.getDrawable();
    if (MusicManager.isCurrMusicIsPlayingMusic(info)) {
        holder.mMusicNum.setVisibility(View.GONE);
        holder.mImageAnim.setVisibility(View.VISIBLE);
        if (MusicManager.isPlaying()) {
            animationDrawable.start();
        } else {
            animationDrawable.stop();
        }
    } else {
        animationDrawable.stop();
        holder.mMusicNum.setVisibility(View.VISIBLE);
        holder.mImageAnim.setVisibility(View.GONE);
    }
    holder.itemView.setOnClickListener(view -> {
        if (mOnItemClickListener != null) {
            mOnItemClickListener.onItemClick(info, position);
        }
    });
}
Also used : AnimationDrawable(android.graphics.drawable.AnimationDrawable) SongInfo(com.lzx.musiclibrary.aidl.model.SongInfo)

Example 22 with AnimationDrawable

use of android.graphics.drawable.AnimationDrawable in project android_packages_apps_OmniClock by omnirom.

the class AddCityDialog method requestLocation.

private void requestLocation() {
    Looper looper = mContext.getMainLooper();
    mHandler.postDelayed(mLocationTimeout, LOCATION_REQUEST_TIMEOUT);
    mLocationRequesting = true;
    mCityName.setEnabled(false);
    mCityName.setText(org.omnirom.deskclock.R.string.cities_add_searching);
    mTimeZones.setEnabled(false);
    mGps.setImageResource(org.omnirom.deskclock.R.drawable.ic_gps_anim);
    try {
        ((AnimationDrawable) mGps.getDrawable()).start();
    } catch (Exception ex) {
    // Ignore
    }
    if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        Location location = mLocationMgr.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
        if (location != null && location.getAccuracy() > LOCATION_ACCURACY_THRESHOLD_METERS) {
            location = null;
        }
        // If lastKnownLocation is not present (because none of the apps in the
        // device has requested the current location to the system yet) or outdated,
        // then try to get the current location use the provider that best matches the criteria.
        boolean needsUpdate = location == null;
        if (location != null) {
            long delta = System.currentTimeMillis() - location.getTime();
            needsUpdate = delta > OUTDATED_LOCATION_THRESHOLD_MILLIS;
        }
        if (needsUpdate) {
            String locationProvider = mLocationMgr.getBestProvider(sLocationCriteria, true);
            if (locationProvider != null) {
                LocationProvider lp = mLocationMgr.getProvider(locationProvider);
                if (lp != null) {
                    mLocationMgr.requestSingleUpdate(locationProvider, this, looper);
                }
            }
        } else {
            onLocationChanged(location);
        }
    }
}
Also used : Looper(android.os.Looper) LocationProvider(android.location.LocationProvider) AnimationDrawable(android.graphics.drawable.AnimationDrawable) Location(android.location.Location)

Example 23 with AnimationDrawable

use of android.graphics.drawable.AnimationDrawable in project BaseProject by feer921.

the class CommonItemView method itemLoading.

public void itemLoading() {
    CommonLog.e("info", "----------------> itemLoading()..." + ivItemLoading);
    if (ivItemLoading == null) {
        return;
    }
    tvItemExtraDesc.setVisibility(View.INVISIBLE);
    ivItemLoading.setVisibility(View.VISIBLE);
    AnimationDrawable drawable = (AnimationDrawable) ivItemLoading.getDrawable();
    drawable.run();
}
Also used : AnimationDrawable(android.graphics.drawable.AnimationDrawable)

Example 24 with AnimationDrawable

use of android.graphics.drawable.AnimationDrawable in project BaseProject by fly803.

the class AnimationUtils method initAnimationDrawable.

public static AnimationDrawable initAnimationDrawable(Context context, int[] drawableIds, int durationTime, boolean isOneShot) {
    AnimationDrawable mAnimationDrawable = new AnimationDrawable();
    for (int i = 0; i < drawableIds.length; i++) {
        int id = drawableIds[i];
        mAnimationDrawable.addFrame(context.getResources().getDrawable(id), durationTime);
    }
    mAnimationDrawable.setOneShot(isOneShot);
    return mAnimationDrawable;
}
Also used : AnimationDrawable(android.graphics.drawable.AnimationDrawable)

Example 25 with AnimationDrawable

use of android.graphics.drawable.AnimationDrawable in project AndroidChromium by JackyAndroid.

the class ListUrlsActivity method startRefresh.

private void startRefresh(boolean isUserInitiated, boolean isSwipeInitiated) {
    if (mIsRefreshing) {
        return;
    }
    mIsRefreshing = true;
    mIsRefreshUserInitiated = isUserInitiated;
    // Clear the list adapter to trigger the empty list display.
    mAdapter.clear();
    Collection<UrlInfo> urls = UrlManager.getInstance().getUrls(true);
    // the activity without checking the preference state.
    if (urls.isEmpty() || !PhysicalWeb.isPhysicalWebPreferenceEnabled()) {
        finishRefresh();
    } else {
        // Show the swipe-to-refresh busy indicator for refreshes initiated by a swipe.
        if (isSwipeInitiated) {
            mSwipeRefreshWidget.setRefreshing(true);
        }
        // Update the empty list view to show a scanning animation.
        mEmptyListText.setText(R.string.physical_web_empty_list_scanning);
        mScanningImageView.setImageResource(R.drawable.physical_web_scanning_animation);
        mScanningImageView.setColorFilter(null);
        AnimationDrawable animationDrawable = (AnimationDrawable) mScanningImageView.getDrawable();
        animationDrawable.start();
        mPwsResults.clear();
        resolve(urls, isUserInitiated);
    }
}
Also used : AnimationDrawable(android.graphics.drawable.AnimationDrawable)

Aggregations

AnimationDrawable (android.graphics.drawable.AnimationDrawable)70 BitmapDrawable (android.graphics.drawable.BitmapDrawable)32 Drawable (android.graphics.drawable.Drawable)31 ClipDrawable (android.graphics.drawable.ClipDrawable)19 LayerDrawable (android.graphics.drawable.LayerDrawable)19 ShapeDrawable (android.graphics.drawable.ShapeDrawable)14 View (android.view.View)11 StateListDrawable (android.graphics.drawable.StateListDrawable)9 ImageView (android.widget.ImageView)9 SuppressLint (android.annotation.SuppressLint)5 TypedArray (android.content.res.TypedArray)5 XmlResourceParser (android.content.res.XmlResourceParser)5 VectorDrawable (android.graphics.drawable.VectorDrawable)5 Button (android.widget.Button)5 TextView (android.widget.TextView)5 Intent (android.content.Intent)3 Paint (android.graphics.Paint)3 RecyclerView (android.support.v7.widget.RecyclerView)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 DividerItemDecoration (com.jakewharton.u2020.ui.misc.DividerItemDecoration)2