本文整理匯總了Java中android.graphics.drawable.AnimatedVectorDrawable.start方法的典型用法代碼示例。如果您正苦於以下問題:Java AnimatedVectorDrawable.start方法的具體用法?Java AnimatedVectorDrawable.start怎麽用?Java AnimatedVectorDrawable.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.drawable.AnimatedVectorDrawable
的用法示例。
在下文中一共展示了AnimatedVectorDrawable.start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_open_on_phone_animation);
AmbientMode.attachAmbientSupport(this);
mAnimationCallback =
new AnimationCallback() {
@Override
public void onAnimationEnd(Drawable drawable) {
super.onAnimationEnd(drawable);
// Go back to main Dialogs screen after animation.
finish();
}
};
// Play 'swipe left' animation only once.
ImageView phoneImage = findViewById(R.id.open_on_phone_animation_image);
mAnimatedVectorDrawablePhone = (AnimatedVectorDrawable) phoneImage.getDrawable();
mAnimatedVectorDrawablePhone.registerAnimationCallback(mAnimationCallback);
mAnimatedVectorDrawablePhone.start();
}
開發者ID:googlesamples,項目名稱:android-WearAccessibilityApp,代碼行數:24,代碼來源:OpenOnPhoneAnimationActivity.java
示例2: setupLogoAnim
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
@TargetApi(21)
private void setupLogoAnim() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final ImageView iv = (ImageView) getActivity().findViewById(R.id.io_logo);
final AnimatedVectorDrawable logoAnim =
(AnimatedVectorDrawable) getActivity().getDrawable(
R.drawable.io_logo_social_anim);
iv.setImageDrawable(logoAnim);
logoAnim.start();
iv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
logoAnim.start();
}
});
}
}
示例3: showFavoriteMovie
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
@Override
public void showFavoriteMovie() {
if (!isFavorite) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
AnimatedVectorDrawable emptyHeart = (AnimatedVectorDrawable)
emptyHeartConstantState.newDrawable();
fab.setImageDrawable(emptyHeart);
emptyHeart.start();
} else {
fab.setImageResource(R.drawable.heart_fill);
}
isFavorite = true;
}
}
示例4: startOpenAnimations
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
private void startOpenAnimations() {
// Icon
AnimatedVectorDrawable menuIcon = (AnimatedVectorDrawable) ContextCompat.getDrawable(getContext(),
R.drawable.ic_menu_animated);
mFabView.setImageDrawable(menuIcon);
menuIcon.start();
// Reveal
int centerX = mFabRect.centerX();
int centerY = mFabRect.centerY();
float startRadius = getMinRadius();
float endRadius = getMaxRadius();
Animator reveal = ViewAnimationUtils
.createCircularReveal(mNavigationView,
centerX, centerY, startRadius, endRadius);
// Fade in
mNavigationMenuView.setAlpha(0);
Animator fade = ObjectAnimator.ofFloat(mNavigationMenuView, View.ALPHA, 0, 1);
// Animations
AnimatorSet set = new AnimatorSet();
set.playSequentially(reveal, fade);
set.start();
}
示例5: checkConnectivity
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
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);
noConnection.setImageDrawable(avd);
avd.start();
connectivityManager.registerNetworkCallback(
new NetworkRequest.Builder()
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(),
connectivityCallback);
monitoringConnectivity = true;
}
}
示例6: checkEmptyOrConnection
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
public void checkEmptyOrConnection() {
if (!Utils.hasInternet(getActivity())) {
if (getAdapter().getItemCount() == 0) {
mEmpty.setVisibility(View.GONE);
mEmptyImage.setVisibility(View.VISIBLE);
if (UI.isLollipop()) {
final AnimatedVectorDrawable avd =
(AnimatedVectorDrawable) ContextCompat.getDrawable(getActivity(), R.drawable.avd_no_connection);
mEmptyImage.setImageDrawable(avd);
avd.start();
} else {
mEmptyImage.setImageResource(R.drawable.no_connection);
}
} else {
Toast.makeText(getActivity(), R.string.check_network, Toast.LENGTH_SHORT).show();
}
}
}
示例7: revealPostingProgress
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
void revealPostingProgress() {
Animator reveal = ViewAnimationUtils.createCircularReveal(fabPosting,
(int) fabPosting.getPivotX(),
(int) fabPosting.getPivotY(),
0f,
fabPosting.getWidth() / 2)
.setDuration(600L);
reveal.setInterpolator(AnimUtils.getFastOutLinearInInterpolator(this));
reveal.start();
AnimatedVectorDrawable uploading =
(AnimatedVectorDrawable) getDrawable(R.drawable.avd_uploading);
if (uploading != null) {
fabPosting.setImageDrawable(uploading);
uploading.start();
}
}
示例8: checkConnectivity
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
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;
}
}
示例9: launchAnimBackup
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
/**
* Launch the animation on the currentAnimatedVectorDrawable
*/
private void launchAnimBackup(){
if(!backupRoundTripFirstLaunched) {
if (backupRoundTrip.getLevel() == 1) {
//then reverse
backupRoundTrip.setLevel(0);
} else {
//then reverse
backupRoundTrip.setLevel(1);
}
}else{
backupRoundTripFirstLaunched=false;
}
//find the current AnimatedVectorDrawable displayed
currentBackupDrawable = (AnimatedVectorDrawable) backupRoundTrip.getCurrent();
//start the animation
currentBackupDrawable.start();
}
示例10: onViewCreated
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mLoadingSwitcher = (ViewSwitcher) view.findViewById(R.id.loading_switcher);
mLoadingView = (LottieAnimationView) view.findViewById(R.id.loading_anim);
mRecyclerView = (RecyclerView) view.findViewById(android.R.id.list);
mRecyclerView.addItemDecoration(new DividerDecoration(getContext()));
mAdapter = new MyIOAdapter(getContext(), this);
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setLayoutManager(
new StickyHeadersLinearLayoutManager<MyIOAdapter>(getContext()));
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
mScrolled = true;
recyclerView.removeOnScrollListener(this);
}
});
View header = view.findViewById(R.id.header_anim);
if (header instanceof ImageView) {
AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ContextCompat.getDrawable(
getContext(), R.drawable.avd_header_my_io);
((ImageView) header).setImageDrawable(avd);
avd.start();
}
}
示例11: showInSchedule
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
private void showInSchedule(boolean isInSchedule, boolean animate) {
mAddScheduleFab.setChecked(isInSchedule);
mAddScheduleFab.setContentDescription(getString(isInSchedule
? R.string.remove_from_schedule
: R.string.add_to_schedule));
if (!animate) return;
AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ContextCompat.getDrawable(
getContext(), isInSchedule ? R.drawable.avd_bookmark : R.drawable.avd_unbookmark);
mAddScheduleFab.setImageDrawable(avd);
ObjectAnimator backgroundColor = ObjectAnimator.ofArgb(
mAddScheduleFab,
UIUtils.BACKGROUND_TINT,
isInSchedule ? Color.WHITE
: ContextCompat.getColor(getContext(), R.color.lightish_blue));
backgroundColor.setDuration(400L);
backgroundColor.setInterpolator(AnimationUtils.loadInterpolator(getContext(),
android.R.interpolator.fast_out_slow_in));
backgroundColor.start();
avd.start();
}
示例12: onCreateView
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.feed_fragment, container, false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.feed_recycler_view);
mRecyclerView.setHasFixedSize(true);
mFeedAdapter = new FeedAdapter(getContext());
mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(), VERTICAL));
mRecyclerView.setAdapter(mFeedAdapter);
View header = view.findViewById(R.id.header_anim);
if (header instanceof ImageView) {
AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ContextCompat.getDrawable(
getContext(), R.drawable.avd_header_feed);
((ImageView) header).setImageDrawable(avd);
avd.start();
}
return view;
}
示例13: togglePlayToPause
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
private void togglePlayToPause() {
controlToggle.displayQuick(pauseButton);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
AnimatedVectorDrawable playToPauseDrawable = (AnimatedVectorDrawable)getContext().getDrawable(R.drawable.play_to_pause_animation);
pauseButton.setImageDrawable(playToPauseDrawable);
playToPauseDrawable.start();
}
}
示例14: togglePauseToPlay
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
private void togglePauseToPlay() {
controlToggle.displayQuick(playButton);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
AnimatedVectorDrawable pauseToPlayDrawable = (AnimatedVectorDrawable)getContext().getDrawable(R.drawable.pause_to_play_animation);
playButton.setImageDrawable(pauseToPlayDrawable);
pauseToPlayDrawable.start();
}
}
示例15: animatePlayPause
import android.graphics.drawable.AnimatedVectorDrawable; //導入方法依賴的package包/類
public void animatePlayPause(View w)
{
if(game.clocks[game.activeTime].getMode().equals("timer") && !game.clocks[game.activeTime].isRunning() && game.clocks[game.activeTime].getTimeRemaining()==0)
{
//nicht starten
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("You can't start the timer because it is already 00:00.");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
} });
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
else
{
toggleWatches();
AnimatedVectorDrawable drawable = play ? playToPause : pauseToPlay;
playPause[game.activeTime].setImageDrawable(drawable);
drawable.start();
play = !play;
}
}