本文整理汇总了Java中android.support.graphics.drawable.AnimatedVectorDrawableCompat类的典型用法代码示例。如果您正苦于以下问题:Java AnimatedVectorDrawableCompat类的具体用法?Java AnimatedVectorDrawableCompat怎么用?Java AnimatedVectorDrawableCompat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnimatedVectorDrawableCompat类属于android.support.graphics.drawable包,在下文中一共展示了AnimatedVectorDrawableCompat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invalidateAllKeys
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
@Override
public void invalidateAllKeys() {
if (getKeyboard() != null) {
boolean isDark = ColorUtils.isColorDark(color);
for (Keyboard.Key key : getKeyboard().getKeys()) {
if (key.label != null) {
key.icon = new TextDrawable(getContext(), getShiftedLabel(key.label.toString()), isDark ? Color.WHITE : Color.BLACK);
key.label = null;
} else if (key.icon != null) {
if (key.icon instanceof TextDrawable) {
key.icon = new TextDrawable(getContext(), getShiftedLabel(((TextDrawable) key.icon).getText()), isDark ? Color.WHITE : Color.BLACK);
} else {
DrawableCompat.setTint(key.icon, isDark ? Color.WHITE : Color.BLACK);
if (key.icon instanceof AnimatedVectorDrawableCompat)
((AnimatedVectorDrawableCompat) key.icon).start();
}
}
}
}
super.invalidateAllKeys();
}
示例2: onOptionsItemSelected
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_list_to_grid) {
if (!((Animatable) item.getIcon()).isRunning()) {
if (gridLayoutManager.getSpanCount() == 1) {
item.setIcon(AnimatedVectorDrawableCompat.create(MainActivity.this, R.drawable.avd_list_to_grid));
gridLayoutManager.setSpanCount(3);
} else {
item.setIcon(AnimatedVectorDrawableCompat.create(MainActivity.this, R.drawable.avd_grid_to_list));
gridLayoutManager.setSpanCount(1);
}
((Animatable) item.getIcon()).start();
simpleAdapter.notifyItemRangeChanged(0, simpleAdapter.getItemCount());
}
return true;
}
return super.onOptionsItemSelected(item);
}
示例3: onCreateView
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_life_grid, container, false);
worldGridLayout = (LifeGridLayout)view.findViewById(R.id.life_grid_layout);
worldGridLayout.setCallback(this);
listener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
setUpGrid();
}
};
//wait until layout is drawn before running setup calculations on its measurements
worldGridLayout.getViewTreeObserver().addOnGlobalLayoutListener(listener);
ImageView touchIcon = (ImageView)view.findViewById(R.id.touch_icon);
AnimatedVectorDrawableCompat touchAnimation = AnimatedVectorDrawableCompat.create(getContext(), R.drawable.hand_animated_vector);
touchIcon.setImageDrawable(touchAnimation);
touchAnimation.start();
return view;
}
示例4: initialiseButton
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
private void initialiseButton(){
startResetFab = (FloatingActionButton)findViewById(R.id.start_reset_fab);
startButtonText = getString(R.string.start_button_text);
resetButtonText = getString(R.string.reset_button_text);
playIcon = AnimatedVectorDrawableCompat.create(this, R.drawable.fab_animated_vector_reset_to_play);
resetIcon = AnimatedVectorDrawableCompat.create(this, R.drawable.fab_animated_vector_play_to_reset);
startResetFab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (startResetFab.getTag().equals(startButtonText)) {
lifeGridFragment.worldGridPresenter.passLiveCellsToModelAndStartGame();
} else {
showButtonInStartMode();
lifeGridFragment.worldGridPresenter.resetGrid();
}
}
});
showButtonInStartMode();
}
示例5: setState
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
public void setState(State state, boolean animate) {
if (state == this.state) return;
@DrawableRes int resId = getDrawable(this.state, state, animate);
if (resId == 0) {
setImageDrawable(null);
} else {
Drawable icon = null;
if (animate) {
icon = AnimatedVectorDrawableCompat.create(getContext(), resId);
}
if (icon == null) {
icon = VectorDrawableCompat.create(getResources(), resId, getContext().getTheme());
}
setImageDrawable(icon);
if (icon instanceof Animatable) {
((Animatable) icon).start();
}
}
this.state = state;
}
示例6: onClick
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
@OnClick(android.R.id.content)
public void onClick() {
AnimatedVectorDrawableCompat animatable = setDrawable();
if(!animatable.isRunning()) {
animatable.start();
}
animateForward = !animateForward;
}
示例7: setDrawable
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
private AnimatedVectorDrawableCompat setDrawable() {
int resId = animateForward
? R.drawable.avd_checkable_expandcollapse_expanded_to_collapsed
: R.drawable.avd_checkable_expandcollapse_collapsed_to_expanded;
AnimatedVectorDrawableCompat animatable = AnimatedVectorDrawableCompat.create(this, resId);
icon.setImageDrawable(animatable);
return animatable;
}
示例8: createFromXmlInner
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser parser, @NonNull AttributeSet attrs, @Nullable Theme theme) {
try {
return AnimatedVectorDrawableCompat.createFromXmlInner(context, context.getResources(), parser, attrs, theme);
} catch (Exception e) {
Log.e("AvdcInflateDelegate", "Exception while inflating <animated-vector>", e);
return null;
}
}
示例9: onCreate
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
@SuppressLint("RestrictedApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fingerprint_isloated);
final AppCompatImageView fingerprintIsolated = findViewById(R.id.fingerprint_animator);
mFingerprintAnimator = new LoopAnimatedVectorDrawableCompat(AnimatedVectorDrawableCompat.create(this,
R.drawable.enrollment_fingerprint_isolated_animation));
fingerprintIsolated.setBackgroundDrawable(AppCompatResources.getDrawable(FingerprintIsloatedActivity.this
, top.trumeet.snippet.aospanimation.library.R.drawable.fp_illustration_enrollment));
fingerprintIsolated.setSupportBackgroundTintList(ColorStateList.valueOf(getResources().getColor(top.trumeet.snippet.aospanimation.library.R.color.fingerprint_indicator_background_resting)));
CheckBox showBackground = findViewById(R.id.check_show_background);
showBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (b) {
fingerprintIsolated.setBackgroundDrawable(AppCompatResources.getDrawable(FingerprintIsloatedActivity.this
, top.trumeet.snippet.aospanimation.library.R.drawable.fp_illustration_enrollment));
fingerprintIsolated.setSupportBackgroundTintList(ColorStateList.valueOf(getResources().getColor(top.trumeet.snippet.aospanimation.library.R.color.fingerprint_indicator_background_resting)));
} else {
fingerprintIsolated.setBackgroundDrawable(null);
}
}
});
fingerprintIsolated.setImageDrawable(mFingerprintAnimator.getDrawable());
}
示例10: handleMessage
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case MESSAGE_ANIMATION_START:
final Drawable drawable = iconMenu.getDrawable();
if (drawable instanceof AnimatedVectorDrawableCompat) {
((AnimatedVectorDrawableCompat) iconMenu.getDrawable()).start();
sendEmptyMessageDelayed(MESSAGE_ANIMATION_START, 5000);
}
break;
}
}
示例11: createFromXmlInner
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
@SuppressLint("NewApi")
@Override
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser parser,
@NonNull AttributeSet attrs, @Nullable Resources.Theme theme) {
try {
return AnimatedVectorDrawableCompat
.createFromXmlInner(context, context.getResources(), parser, attrs, theme);
} catch (Exception e) {
Log.e("AvdcInflateDelegate", "Exception while inflating <animated-vector>", e);
return null;
}
}
示例12: RecordsAdapter
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
RecordsAdapter(RecordsActivity activity, Podcast podcast, List<Record> records) {
this.activity = activity;
this.podcast = podcast;
this.records = records;
footerMode = FooterMode.HIDDEN;
setHasStableIds(true);
months = activity.getString(R.string.months).split(",");
equalizerDrawable = AnimatedVectorDrawableCompat.create(activity, R.drawable.record_equalizer_animated);
}
示例13: PodcastsAdapter
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
PodcastsAdapter(LighthouseActivity activity, List<Podcast> podcasts) {
this.activity = activity;
this.podcasts = podcasts;
int size = activity.getResources().getDimensionPixelSize(R.dimen.podcast_icon_size);
Drawable micResourceDrawable = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.mic, activity.getTheme());
Bitmap micBitmap = createBitmap(micResourceDrawable, size);
micDrawable = RoundedBitmapDrawableFactory.create(activity.getResources(), micBitmap);
micDrawable.setCircular(true);
equalizerDrawable = AnimatedVectorDrawableCompat.create(activity, R.drawable.equalizer_animated);
}
示例14: instantiateAnimatedVectorDrawables
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
private void instantiateAnimatedVectorDrawables() {
mAvdAlphaScale = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_alpha_scale);
mAvdAlphaScaleReverse = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_alpha_scale_reverse);
mAvdRotate = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_rotate);
mAvdTranslate = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_translate);
mAvdColor = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_color);
mAvdColorReverse = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_color_reverse);
mAvdTrimPath = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_trim_path);
mAvdTrimPathReverse = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_trim_path_reverse);
mAvdMorph = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_morph);
mAvdMorphReverse = AnimatedVectorDrawableCompat.create(this, R.drawable.avd_morph_reverse);
}
示例15: ViewHolder
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入依赖的package包/类
public ViewHolder(View itemView, final ClickListener listener, final List<TorrentStateParcel> states)
{
super(itemView);
this.context = itemView.getContext();
this.listener = listener;
this.states = states;
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
playToPauseAnim = AnimatedVectorDrawableCompat.create(context, R.drawable.play_to_pause);
pauseToPlayAnim = AnimatedVectorDrawableCompat.create(context, R.drawable.pause_to_play);
itemTorrentList = itemView.findViewById(R.id.item_torrent_list);
name = itemView.findViewById(R.id.torrent_name);
pauseButton = itemView.findViewById(R.id.pause_torrent);
pauseButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
int position = getAdapterPosition();
if (listener != null && position >= 0) {
TorrentStateParcel state = states.get(position);
listener.onPauseButtonClicked(position, state);
}
}
});
progress = itemView.findViewById(R.id.torrent_progress);
Utils.colorizeProgressBar(context, progress);
state = itemView.findViewById(R.id.torrent_status);
downloadCounter = itemView.findViewById(R.id.torrent_download_counter);
downloadUploadSpeed = itemView.findViewById(R.id.torrent_download_upload_speed);
ETA = itemView.findViewById(R.id.torrent_ETA);
indicatorCurOpenTorrent = itemView.findViewById(R.id.indicator_cur_open_torrent);
}