當前位置: 首頁>>代碼示例>>Java>>正文


Java AnimatedVectorDrawable類代碼示例

本文整理匯總了Java中android.graphics.drawable.AnimatedVectorDrawable的典型用法代碼示例。如果您正苦於以下問題:Java AnimatedVectorDrawable類的具體用法?Java AnimatedVectorDrawable怎麽用?Java AnimatedVectorDrawable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AnimatedVectorDrawable類屬於android.graphics.drawable包,在下文中一共展示了AnimatedVectorDrawable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.graphics.drawable.AnimatedVectorDrawable; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_explore);
    iv = (ImageView) findViewById(R.id.search);
    text = (EditText) findViewById(R.id.text);
    searchToBar = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim_search_to_bar);
    barToSearch = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim_bar_to_search);
    interp = AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in);
    duration = getResources().getInteger(R.integer.duration_bar);
    // iv is sized to hold the search+bar so when only showing the search icon, translate the
    // whole view left by half the difference to keep it centered
    offset = -71f * (int) getResources().getDisplayMetrics().scaledDensity;
    iv.setTranslationX(offset);
    iv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            animate();
        }
    });
}
 
開發者ID:braulio94,項目名稱:Quadro,代碼行數:22,代碼來源:ExploreActivity.java

示例2: 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

示例3: initUi

import android.graphics.drawable.AnimatedVectorDrawable; //導入依賴的package包/類
@TargetApi(Build.VERSION_CODES.M)
private void initUi() {
    initializeToolbar();

    final AnimatedVectorDrawable avd2 = (AnimatedVectorDrawable) tvButton.getBackground();

    tvButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            tvButton.setText("Loading...");
            avd2.start();
        }
    });

    avd2.registerAnimationCallback(new Animatable2.AnimationCallback() {
        @Override
        public void onAnimationEnd(Drawable drawable) {
            tvButton.setText("Try Again");
        }
    });

}
 
開發者ID:vipulyaara,項目名稱:betterHotels,代碼行數:23,代碼來源:NoHotelsActivity.java

示例4: 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();
            }
        });
    }
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:18,代碼來源:SocialFragment.java

示例5: onBindViewHolder

import android.graphics.drawable.AnimatedVectorDrawable; //導入依賴的package包/類
@Override
public void onBindViewHolder(final HabitViewHolder holder, int position) {

    final Habit habit = habits.get(position);

    holder.habitName.setText(habit.name);
    holder.count.setText(String.format(Locale.getDefault(), "%d", habit.timesCompleted));
    holder.timesPerDay.setText(context.getString(R.string.times_per_day, habit.timesPerDay));

    holder.doneButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((AnimatedVectorDrawable) holder.doneButton.getDrawable()).start();
            dbHelper.incrementHabit(habit.name);
            Storage.incrementHabit(context, habit.name);
        }
    });
}
 
開發者ID:JeremySilverTongue,項目名稱:UdacityAndroidBasicsNanodegree,代碼行數:19,代碼來源:HabitAdapter.java

示例6: onCreate

import android.graphics.drawable.AnimatedVectorDrawable; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ImageView mFabView = (ImageView) findViewById(R.id.fab_view);

    // animate head to leaf
    final AnimatedVectorDrawable faceAVD = (AnimatedVectorDrawable) ContextCompat.getDrawable(this, R.drawable.face_avd);
    mFabView.setImageDrawable(faceAVD);

    findViewById(R.id.animate_btn).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            faceAVD.start();
        }
    });
}
 
開發者ID:kevalpatel2106,項目名稱:android-samples,代碼行數:19,代碼來源:MainActivity.java

示例7: 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();
    }
 
開發者ID:andremion,項目名稱:Floating-Navigation-View,代碼行數:27,代碼來源:FloatingNavigationView.java

示例8: 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();
        }
    }
}
 
開發者ID:goodev,項目名稱:materialup,代碼行數:19,代碼來源:RecyclerFragment.java

示例9: MovableMarker

import android.graphics.drawable.AnimatedVectorDrawable; //導入依賴的package包/類
/**
 * The {@code mRounded} drawable is just the end state of the {@code mStaticToDynamic}
 * {@link AnimatedVectorDrawable}.
 * The {@code mStatic} drawable is the end state of the {@code mDynamicToStatic}
 * {@link AnimatedVectorDrawable}. <br>
 *
 */
public MovableMarker(Context context, boolean staticForm, MarkerGson.Marker marker) {
    super(context);

    mRounded = (AnimatedVectorDrawable) context.getDrawable(R.drawable.avd_marker_rounded);
    mStatic = context.getDrawable(R.drawable.vd_marker_location_rounded);
    mStaticToDynamic = (AnimatedVectorDrawable) context.getDrawable(R.drawable.avd_marker_location_rounded);
    mDynamicToStatic = (AnimatedVectorDrawable) context.getDrawable(R.drawable.avd_marker_rounded_location);

    /* Keep a reference on the model object */
    mMarker = marker;

    /* Init the drawable */
    if (staticForm) {
        initStatic();
    } else {
        initRounded();
    }
}
 
開發者ID:peterLaurence,項目名稱:TrekAdvisor,代碼行數:26,代碼來源:MovableMarker.java

示例10: 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;
    }
}
 
開發者ID:liulinbo,項目名稱:Amumu,代碼行數:24,代碼來源:HomeActivity.java

示例11: 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();
    }
}
 
開發者ID:yongjhih,項目名稱:android-proguards,代碼行數:17,代碼來源:HomeActivity.java

示例12: 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;
    }
}
 
開發者ID:yongjhih,項目名稱:android-proguards,代碼行數:26,代碼來源:HomeActivity.java

示例13: 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;
    }
}
 
開發者ID:Rashwan,項目名稱:Reactive-Popular-Movies,代碼行數:17,代碼來源:MovieDetailsActivity.java

示例14: showNonFavoriteMovie

import android.graphics.drawable.AnimatedVectorDrawable; //導入依賴的package包/類
@Override
public void showNonFavoriteMovie() {
    if (isFavorite) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

            AnimatedVectorDrawable fullHeart = (AnimatedVectorDrawable)
                    fullHeartConstantState.newDrawable();
            fab.setImageDrawable(fullHeart);
            fullHeart.start();

        } else {
            fab.setImageResource(R.drawable.fab_heart_empty);
        }
        isFavorite = false;
    }
}
 
開發者ID:Rashwan,項目名稱:Reactive-Popular-Movies,代碼行數:17,代碼來源:MovieDetailsActivity.java

示例15: AnimatedPinDrawable

import android.graphics.drawable.AnimatedVectorDrawable; //導入依賴的package包/類
public AnimatedPinDrawable(Context context) {
	super();
	Drawable collapsed = context.getDrawable(R.drawable.pin_collapsed);
	Drawable expanded = context.getDrawable(R.drawable.pin_expanded);
	AnimatedVectorDrawable expanding = (AnimatedVectorDrawable) context
		.getDrawable(R.drawable.pin_collapsed_to_expanded_animation);
	AnimatedVectorDrawable collapsing = (AnimatedVectorDrawable) context
		.getDrawable(R.drawable.pin_expanded_to_collapsed_animation);

	addState(STATE_SET_PRESSED, expanded, STATE_EXPANDED_ID);
	addState(STATE_SET_UNPRESSED, collapsed, STATE_COLLAPSED_ID);
	addTransition(STATE_COLLAPSED_ID, STATE_EXPANDED_ID, expanding, false);
	addTransition(STATE_EXPANDED_ID, STATE_COLLAPSED_ID, collapsing, false);

	paint.setColor(Color.BLUE);
	paint.setTextSize(24f);
	paint.setTextAlign(Paint.Align.CENTER);
	paint.setAntiAlias(true);
	duration = context.getResources().getInteger(android.R.integer.config_mediumAnimTime);
}
 
開發者ID:dgmltn,項目名稱:multi-seek-bar,代碼行數:21,代碼來源:AnimatedPinDrawable.java


注:本文中的android.graphics.drawable.AnimatedVectorDrawable類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。