use of android.graphics.drawable.AnimatedVectorDrawable in project animate by hitherejoe.
the class AnimatedVectorDrawablesActivity method onAddRemoveImageClick.
@OnClick(R.id.image_add_remove)
public void onAddRemoveImageClick() {
AnimatedVectorDrawable drawable = mIsAddState ? mRemoveToAddDrawable : mAddToRemoveDrawable;
mAddRemoveImage.setImageDrawable(drawable);
drawable.start();
mIsAddState = !mIsAddState;
}
use of android.graphics.drawable.AnimatedVectorDrawable in project Music-Player by andremion.
the class PlayButtonTransition method createAnimator.
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
if (endValues == null || !(endValues.view instanceof FloatingActionButton)) {
return null;
}
FloatingActionButton fabView = (FloatingActionButton) endValues.view;
Context context = fabView.getContext();
AnimatedVectorDrawable drawable;
if (mMode == MODE_PLAY) {
drawable = (AnimatedVectorDrawable) context.getDrawable(R.drawable.ic_play_animatable);
} else {
drawable = (AnimatedVectorDrawable) context.getDrawable(R.drawable.ic_pause_animatable);
}
fabView.setImageDrawable(drawable);
return new AnimatedVectorDrawableWrapper(drawable);
}
use of android.graphics.drawable.AnimatedVectorDrawable in project platform_frameworks_base by android.
the class VolumeDialog method updateExpandButtonH.
private void updateExpandButtonH() {
if (D.BUG)
Log.d(TAG, "updateExpandButtonH");
mExpandButton.setClickable(!mExpandButtonAnimationRunning);
if (!(mExpandButtonAnimationRunning && isAttached())) {
final int res = mExpanded ? R.drawable.ic_volume_collapse_animation : R.drawable.ic_volume_expand_animation;
if (hasTouchFeature()) {
mExpandButton.setImageResource(res);
} else {
// if there is no touch feature, show the volume ringer instead
mExpandButton.setImageResource(R.drawable.ic_volume_ringer);
// remove gray background emphasis
mExpandButton.setBackgroundResource(0);
}
mExpandButton.setContentDescription(mContext.getString(mExpanded ? R.string.accessibility_volume_collapse : R.string.accessibility_volume_expand));
}
if (mExpandButtonAnimationRunning) {
final Drawable d = mExpandButton.getDrawable();
if (d instanceof AnimatedVectorDrawable) {
// workaround to reset drawable
final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) d.getConstantState().newDrawable();
mExpandButton.setImageDrawable(avd);
avd.start();
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mExpandButtonAnimationRunning = false;
updateExpandButtonH();
rescheduleTimeoutH();
}
}, mExpandButtonAnimationDuration);
}
}
}
use of android.graphics.drawable.AnimatedVectorDrawable in project plaid by nickbutcher.
the class HomeActivity method checkConnectivity.
private void checkConnectivity() {
final ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
final NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
connected = activeNetworkInfo != null && activeNetworkInfo.isConnected();
if (!connected) {
loading.setVisibility(View.GONE);
if (noConnection == null) {
final ViewStub stub = (ViewStub) findViewById(R.id.stub_no_connection);
noConnection = (ImageView) stub.inflate();
}
final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getDrawable(R.drawable.avd_no_connection);
if (noConnection != null && avd != null) {
noConnection.setImageDrawable(avd);
avd.start();
}
connectivityManager.registerNetworkCallback(new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(), connectivityCallback);
monitoringConnectivity = true;
}
}
use of android.graphics.drawable.AnimatedVectorDrawable in project platform_frameworks_base by android.
the class PageIndicator method playAnimation.
private void playAnimation(ImageView imageView, int res) {
final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getContext().getDrawable(res);
imageView.setImageDrawable(avd);
avd.forceAnimationOnUI();
avd.start();
// TODO: Figure out how to user an AVD animation callback instead, which doesn't
// seem to be working right now...
postDelayed(mAnimationDone, ANIMATION_DURATION);
}
Aggregations