本文整理汇总了Java中android.support.graphics.drawable.AnimatedVectorDrawableCompat.create方法的典型用法代码示例。如果您正苦于以下问题:Java AnimatedVectorDrawableCompat.create方法的具体用法?Java AnimatedVectorDrawableCompat.create怎么用?Java AnimatedVectorDrawableCompat.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.graphics.drawable.AnimatedVectorDrawableCompat
的用法示例。
在下文中一共展示了AnimatedVectorDrawableCompat.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: 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;
}
示例4: 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;
}
示例5: 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());
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
示例10: addArcAnimation
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入方法依赖的package包/类
/**
* Add arc above/below the circular target overlay.
*/
private void addArcAnimation(final Activity activity) {
AppCompatImageView mImageView = new AppCompatImageView(activity);
mImageView.setImageResource(R.drawable.ic_spotlight_arc);
LayoutParams params = new LayoutParams(2 * (circleShape.getRadius() + extraPaddingForArc),
2 * (circleShape.getRadius() + extraPaddingForArc));
if (targetView.getPoint().y > getHeight() / 2) {//bottom
if (targetView.getPoint().x > getWidth() / 2) {//Right
params.rightMargin = getWidth() - targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc;
params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc;
params.gravity = Gravity.RIGHT | Gravity.BOTTOM;
} else {
params.leftMargin = targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc;
params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc;
params.gravity = Gravity.LEFT | Gravity.BOTTOM;
}
} else {//up
mImageView.setRotation(180); //Reverse the view
if (targetView.getPoint().x > getWidth() / 2) {//Right
params.rightMargin = getWidth() - targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc;
params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc;
params.gravity = Gravity.RIGHT | Gravity.BOTTOM;
} else {
params.leftMargin = targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc;
params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc;
params.gravity = Gravity.LEFT | Gravity.BOTTOM;
}
}
mImageView.postInvalidate();
mImageView.setLayoutParams(params);
addView(mImageView);
PorterDuffColorFilter porterDuffColorFilter = new PorterDuffColorFilter(lineAndArcColor,
PorterDuff.Mode.SRC_ATOP);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
AnimatedVectorDrawable avd = (AnimatedVectorDrawable)
ContextCompat.getDrawable(activity, R.drawable.avd_spotlight_arc);
avd.setColorFilter(porterDuffColorFilter);
mImageView.setImageDrawable(avd);
avd.start();
} else {
AnimatedVectorDrawableCompat avdc =
AnimatedVectorDrawableCompat.create(activity, R.drawable.avd_spotlight_arc);
avdc.setColorFilter(porterDuffColorFilter);
mImageView.setImageDrawable(avdc);
avdc.start();
}
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
addPathAnimation(activity);
}
}, 400);
}
示例11: initialiseDrawables
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入方法依赖的package包/类
private void initialiseDrawables(Context context){
setImageResource(R.drawable.cell_vector_drawable_dead);
animatedCellDrawableBorn = AnimatedVectorDrawableCompat.create(context, R.drawable.cell_animated_vector_born);
animatedCellDrawableDie = AnimatedVectorDrawableCompat.create(context, R.drawable.cell_animated_vector_die);
}
示例12: swapAnimation
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入方法依赖的package包/类
private void swapAnimation(@DrawableRes int drawableResId) {
final Drawable avd = AnimatedVectorDrawableCompat.create(this, drawableResId);
downloadingView.setImageDrawable(avd);
((Animatable) avd).start();
}
示例13: MediaControlView
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入方法依赖的package包/类
public MediaControlView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
rewindMs = DEFAULT_REWIND_MS;
fastForwardMs = DEFAULT_FAST_FORWARD_MS;
showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS;
if (attrs != null) {
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.MediaControlView, 0, 0);
try {
rewindMs = a.getInt(R.styleable.MediaControlView_rewind_increment, rewindMs);
fastForwardMs = a.getInt(R.styleable.MediaControlView_fastforward_increment, fastForwardMs);
showTimeoutMs = a.getInt(R.styleable.MediaControlView_show_timeout, showTimeoutMs);
} finally {
a.recycle();
}
}
currentWindow = new Timeline.Window();
formatBuilder = new StringBuilder();
formatter = new Formatter(formatBuilder, Locale.getDefault());
componentListener = new ComponentListener();
LayoutInflater.from(context).inflate(R.layout.media_control_view, this);
time = (TextView) findViewById(R.id.player_time);
timeCurrent = (TextView) findViewById(R.id.player_time_current);
progressBar = (SeekBar) findViewById(R.id.player_progress);
progressBar.setOnSeekBarChangeListener(componentListener);
progressBar.setMax(PROGRESS_BAR_MAX);
playButton = (ImageButton) findViewById(R.id.player_play);
playButton.setOnClickListener(componentListener);
previousButton = findViewById(R.id.player_prev);
previousButton.setOnClickListener(componentListener);
nextButton = findViewById(R.id.player_next);
nextButton.setOnClickListener(componentListener);
rewindButton = findViewById(R.id.player_rew);
rewindButton.setOnClickListener(componentListener);
fastForwardButton = findViewById(R.id.player_ffwd);
fastForwardButton.setOnClickListener(componentListener);
topBar = findViewById(R.id.control_top);
bottomBar = findViewById(R.id.control_bottom);
mDetector = new GestureDetector(context, mGestureListener);
this.setOnTouchListener(this);
this.setLongClickable(true);
backButton = findViewById(R.id.player_exit);
backButton.setOnClickListener(componentListener);
titleView = (TextView)findViewById(R.id.player_title);
subtitleView = findViewById(R.id.player_subtitle);
subtitleView.setOnClickListener(componentListener);
menuView = findViewById(R.id.player_more);
menuView.setOnClickListener(componentListener);
compatPauseToPlay = AnimatedVectorDrawableCompat.create(context, R.drawable.ic_pause_to_play);
compatPlayToPause = AnimatedVectorDrawableCompat.create(context, R.drawable.ic_play_to_pause);
}
示例14: addArcAnimation
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入方法依赖的package包/类
/**
* Add arc above/below the circular target overlay.
*/
private void addArcAnimation(final Activity activity) {
AppCompatImageView mImageView = new AppCompatImageView(activity);
mImageView.setImageResource(R.drawable.ic_spotlight_arc);
LayoutParams params = new LayoutParams(2 * (circleShape.getRadius() + extraPaddingForArc),
2 * (circleShape.getRadius() + extraPaddingForArc));
if (targetView.getPoint().y > getHeight() / 2) {//bottom
if (targetView.getPoint().x > getWidth() / 2) {//Right
params.rightMargin = getWidth() - targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc;
params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc;
params.gravity = Gravity.RIGHT | Gravity.BOTTOM;
} else {
params.leftMargin = targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc;
params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc;
params.gravity = Gravity.LEFT | Gravity.BOTTOM;
}
} else {//up
mImageView.setRotation(180); //Reverse the view
if (targetView.getPoint().x > getWidth() / 2) {//Right
params.rightMargin = getWidth() - targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc;
params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc;
params.gravity = Gravity.RIGHT | Gravity.BOTTOM;
} else {
params.leftMargin = targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc;
params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc;
params.gravity = Gravity.LEFT | Gravity.BOTTOM;
}
}
mImageView.postInvalidate();
mImageView.setLayoutParams(params);
addView(mImageView);
PorterDuffColorFilter porterDuffColorFilter = new PorterDuffColorFilter(lineAndArcColor,
PorterDuff.Mode.SRC_ATOP);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
AnimatedVectorDrawable avd = (AnimatedVectorDrawable)
ContextCompat.getDrawable(activity, R.drawable.avd_spotlight_arc);
avd.setColorFilter(porterDuffColorFilter);
mImageView.setImageDrawable(avd);
avd.start();
} else {
AnimatedVectorDrawableCompat avdc =
AnimatedVectorDrawableCompat.create(activity, R.drawable.avd_spotlight_arc);
avdc.setColorFilter(porterDuffColorFilter);
mImageView.setImageDrawable(avdc);
avdc.start();
}
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
addPathAnimation(activity);
}
}, 400);
}
示例15: createAnimatedVectorDrawable
import android.support.graphics.drawable.AnimatedVectorDrawableCompat; //导入方法依赖的package包/类
/**
* Inflates an animated vector drawable.
*
* @param animatedVectorDrawableResId resource ID for the animated vector
* @return animated vector drawable
*/
public Drawable createAnimatedVectorDrawable(@DrawableRes int animatedVectorDrawableResId) {
return AnimatedVectorDrawableCompat.create(getContext(), animatedVectorDrawableResId);
}