当前位置: 首页>>代码示例>>Java>>正文


Java AnimatedVectorDrawableCompat.create方法代码示例

本文整理汇总了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;
}
 
开发者ID:lewismcgeary,项目名称:AndroidGameofLife,代码行数:22,代码来源:LifeGridFragment.java

示例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();
}
 
开发者ID:lewismcgeary,项目名称:AndroidGameofLife,代码行数:20,代码来源:MainActivity.java

示例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;
}
 
开发者ID:mattprecious,项目名称:swirl,代码行数:24,代码来源:SwirlView.java

示例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;
}
 
开发者ID:zawadz88,项目名称:AnimationShowcase,代码行数:9,代码来源:AnimatedVectorDrawableActivity.java

示例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());
}
 
开发者ID:Trumeet,项目名称:Animations,代码行数:30,代码来源:FingerprintIsloatedActivity.java

示例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);
}
 
开发者ID:kalikov,项目名称:lighthouse,代码行数:12,代码来源:RecordsAdapter.java

示例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);
}
 
开发者ID:kalikov,项目名称:lighthouse,代码行数:13,代码来源:PodcastsAdapter.java

示例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);
}
 
开发者ID:nicholasrout,项目名称:android-animated-vectors,代码行数:13,代码来源:MainActivity.java

示例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);
}
 
开发者ID:proninyaroslav,项目名称:libretorrent,代码行数:36,代码来源:TorrentListAdapter.java

示例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);
}
 
开发者ID:HueToYou,项目名称:ChatExchange-old,代码行数:62,代码来源:SpotlightView.java

示例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);
}
 
开发者ID:lewismcgeary,项目名称:AndroidGameofLife,代码行数:6,代码来源:LifeCellView.java

示例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();
}
 
开发者ID:alexjlockwood,项目名称:adp-delightful-details,代码行数:6,代码来源:DownloadingActivity.java

示例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);
}
 
开发者ID:AndroidTips,项目名称:MDVideo,代码行数:57,代码来源:MediaControlView.java

示例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);
}
 
开发者ID:wooplr,项目名称:Spotlight,代码行数:61,代码来源:SpotlightView.java

示例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);
}
 
开发者ID:stepstone-tech,项目名称:android-material-stepper,代码行数:10,代码来源:StepTab.java


注:本文中的android.support.graphics.drawable.AnimatedVectorDrawableCompat.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。