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);
}
});
}
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);
}
}
}
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();
}
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;
}
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);
}
}
Aggregations