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


Java ObjectAnimator.addListener方法代碼示例

本文整理匯總了Java中com.nineoldandroids.animation.ObjectAnimator.addListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectAnimator.addListener方法的具體用法?Java ObjectAnimator.addListener怎麽用?Java ObjectAnimator.addListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.nineoldandroids.animation.ObjectAnimator的用法示例。


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

示例1: createCircularReveal

import com.nineoldandroids.animation.ObjectAnimator; //導入方法依賴的package包/類
/**
 * Returns an Animator which can animate a clipping circle.
 * <p/>
 * Any shadow cast by the View will respect the circular clip from this animator.
 * <p/>
 * Only a single non-rectangular clip can be applied on a View at any time.
 * Views clipped by a circular reveal animation take priority over
 * {@link View#setClipToOutline(boolean) View Outline clipping}.
 * <p/>
 * Note that the animation returned here is a one-shot animation. It cannot
 * be re-used, and once started it cannot be paused or resumed.
 *
 * @param view        The View will be clipped to the animating circle.
 * @param centerX     The x coordinate of the center of the animating circle.
 * @param centerY     The y coordinate of the center of the animating circle.
 * @param startRadius The starting radius of the animating circle.
 * @param endRadius   The ending radius of the animating circle.
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static SupportAnimator createCircularReveal(View view,
                                                   int centerX, int centerY,
                                                   float startRadius, float endRadius) {

    if (!(view.getParent() instanceof RevealAnimator)) {
        throw new IllegalArgumentException("View must be inside RevealFrameLayout or RevealLinearLayout.");
    }

    RevealAnimator revealLayout = (RevealAnimator) view.getParent();
    revealLayout.attachRevealInfo(new RevealInfo(centerX, centerY, startRadius, endRadius,
            new WeakReference<>(view)));

    if (LOLLIPOP_PLUS) {
        return new SupportAnimatorLollipop(android.view.ViewAnimationUtils
                .createCircularReveal(view, centerX, centerY, startRadius, endRadius), revealLayout);
    }

    ObjectAnimator reveal = ObjectAnimator.ofFloat(revealLayout, CLIP_RADIUS,
            startRadius, endRadius);
    reveal.addListener(getRevealFinishListener(revealLayout));

    return new SupportAnimatorPreL(reveal, revealLayout);
}
 
開發者ID:SimonCherryGZ,項目名稱:JewelryUI,代碼行數:43,代碼來源:ViewAnimationUtils.java

示例2: dismissShowdown

import com.nineoldandroids.animation.ObjectAnimator; //導入方法依賴的package包/類
/**
 * 隱藏模糊背景
 */
protected void dismissShowdown() {

    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBg, "alpha", 1, 0);
    objectAnimator.setDuration(400);
    objectAnimator.start();
    objectAnimator.addListener(new SimpleAnimationListener() {

        @Override
        public void onAnimationEnd(Animator animation) {

            mParentVG.removeView(mBg);
        }


    });
}
 
開發者ID:xiangyunwan,項目名稱:AndroidSweetSheet-master,代碼行數:20,代碼來源:Delegate.java

示例3: anim

import com.nineoldandroids.animation.ObjectAnimator; //導入方法依賴的package包/類
private void anim(final View v) {

        ObjectAnimator animator = ObjectAnimator.ofFloat(v, "rotationX", 0.0F, 360.0F)
                .setDuration(200);
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {

                if (!Utils.login()) {
                    return;
                }
                switch (v.getId()) {

                    case R.id.fun_all:
                        v.getContext().startActivity(new Intent(v.getContext(), CategoryActivity.class));
                        break;
                    case R.id.fun_combo:
                        v.getContext().startActivity(new Intent(v.getContext(), CloudTcActivity.class));
                        break;
                    case R.id.fun_charge:
                        v.getContext().startActivity(new Intent(v.getContext(), PhoneChargeActivity.class));
                        break;
                    case R.id.fun_wolrdgo:
                        v.getContext().startActivity(new Intent(v.getContext(), CloudWorldGoActivity.class));
                        break;
                    case R.id.fun_cloud_p:
                        v.getContext().startActivity(new Intent(v.getContext(), CloudPointActivity.class));
                        break;
                    case R.id.fun_omyo:
                        v.getContext().startActivity(new Intent(v.getContext(), OMYOActivity.class));
                        break;
                    case R.id.fun_cloud_club:
                        v.getContext().startActivity(new Intent(v.getContext(), CloudClubActivity.class));
                        break;
                    case R.id.fun_aboutus:
                        v.getContext().startActivity(new Intent(v.getContext(), AboutUsActivity.class));
                        break;

                }

            }
        });
        animator.start();
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:45,代碼來源:ViewHolderFunc.java

示例4: toggleNoTextInput

import com.nineoldandroids.animation.ObjectAnimator; //導入方法依賴的package包/類
protected void toggleNoTextInput(InputType type) {
    mPanelLayout.setVisibility(View.VISIBLE);
    if (type != null && type != InputType.Text) {
        View dropView = getCurrentNoTextInput();
        mInputType = type;
        View popUpView = null;
        switch (type) {
            case Voice:
                checkBoxEmoji.setChecked(false);
                popUpView = voiceLayout;
                if (!mEnterLayoutStatus) {
                    voiceLayout.setVisibility(View.VISIBLE);
                    emojiKeyboardLayout.setVisibility(View.GONE);
                }
                break;
            case Emoji:
                checkBoxEmoji.setChecked(true);
                popUpView = emojiKeyboardLayout;
                if (!mEnterLayoutStatus) {
                    emojiKeyboardLayout.setVisibility(View.VISIBLE);
                    voiceLayout.setVisibility(View.GONE);
                }
                break;
        }
        mEnterLayoutStatus = mEnterLayoutAnimSupportContainer.isPanelLauoutOpen();
        if (mEnterLayoutStatus) {
            final View dropTarget = dropView;
            final View popUpTarget = popUpView;
            ViewHelper.setTranslationY(popUpView, panelHeight);
            ObjectAnimator drop = ObjectAnimator.ofFloat(dropView, "translationY", 0, panelHeight);
            drop.setDuration(180);
            drop.setInterpolator(new AccelerateInterpolator());
            drop.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    dropTarget.setVisibility(View.GONE);
                    popUpTarget.setVisibility(View.VISIBLE);
                    ObjectAnimator popUp = ObjectAnimator.ofFloat(popUpTarget, "translationY", panelHeight, 0);
                    popUp.setDuration(180);
                    popUp.setInterpolator(new DecelerateInterpolator());
                    popUp.start();
                }
            });
            drop.start();
        } else {
            popUpView.setVisibility(View.VISIBLE);
            animEnterLayoutStatusChanaged(true);
        }
    }
}
 
開發者ID:huang303513,項目名稱:Coding-Android,代碼行數:51,代碼來源:EnterEmojiLayout.java

示例5: initView

import com.nineoldandroids.animation.ObjectAnimator; //導入方法依賴的package包/類
@Override
public void initView() {
  /*set it to be no title*/
    // requestWindowFeature(Window.FEATURE_NO_TITLE);
   /*set it to be full screen*/
    /*全屏顯示*/
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);


    //mReBg = (RelativeLayout) findViewById(R.id.activity_splash);

    View target = findViewById(R.id.activity_splash);

    //請求數據
    OkGo.post(splash_img_url)
            .execute(new BitmapCallback(){

                @Override
                public void onSuccess(Bitmap bitmap, Call call, Response response) {
                    target.setBackgroundDrawable(new BitmapDrawable(bitmap));
                }
            });

    requestBitmap();

    ObjectAnimator animator = ObjectAnimator.ofFloat(target,"alpha",0.0f,1.0f);
    animator.setDuration(2000);//動畫執行的時間

    animator.start();

    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            SharedPreferences sp = getPreferences(MODE_PRIVATE);
            boolean isFirst = sp.getBoolean(Contants.IS_FIRST_RUNNING, true);

            String username = PreferencesUtils.getString(SplashActivity.this
                    , Contants.USER_NAME);
            String password = PreferencesUtils.getString(SplashActivity.this,
                    Contants.USER_PASSWORD);

            //感覺不是最好的辦法,Bmob官網說有個getCurrentUser()方法
            //來判斷是否之前登錄過,但是我嘗試了,獲取到的User對象都是為空,就想到這個方法進行彌補
            //這個方法也是可以進行登錄的,但是貌似對其他登錄有點影響,這個後期遇到更好的辦法就在去優化
            BmobUser.loginByAccount(username, password, new LogInListener<MyUser>() {

                @Override
                public void done(MyUser user, BmobException e) {
                    if(user!=null){
                        Log.i("smile","用戶登陸成功");
                        EventBus.getDefault().post(new LoginEvent(user));
                        PreferencesUtils.putBoolean(SplashActivity.this
                        ,Contants.IS_LOGIN,true);
                    }
                }
            });


            Intent intent = new Intent();
            if (isFirst) {
                sp.edit().putBoolean(Contants.IS_FIRST_RUNNING, false).commit();
                intent.setClass(SplashActivity.this, GuideActivity.class);
            } else {
                intent.setClass(SplashActivity.this, MainActivityDrawerLayout.class);
            }

            startActivity(intent);

            finish();
        }
    });

}
 
開發者ID:wuyinlei,項目名稱:MyHearts,代碼行數:75,代碼來源:SplashActivity.java

示例6: initView

import com.nineoldandroids.animation.ObjectAnimator; //導入方法依賴的package包/類
@Override
    public void initView() {
      /*set it to be no title*/
        // requestWindowFeature(Window.FEATURE_NO_TITLE);
       /*set it to be full screen*/
        /*全屏顯示*/
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        location();


        //mReBg = (RelativeLayout) findViewById(R.id.activity_splash);

        View target = findViewById(R.id.activity_splash);

        //請求數據
        OkGo.post(splash_img_url)
                .execute(new BitmapCallback() {

                    @Override
                    public void onSuccess(Bitmap bitmap, Call call, Response response) {
                        // target.setBackgroundDrawable(new BitmapDrawable(bitmap));
                    }
                });

        requestBitmap();

        ObjectAnimator animator = ObjectAnimator.ofFloat(target, "alpha", 0.0f, 1.0f);
        animator.setDuration(2000);//動畫執行的時間

        animator.start();

        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                SharedPreferences sp = getPreferences(MODE_PRIVATE);
                boolean isFirst = sp.getBoolean(Contants.IS_FIRST_RUNNING, true);

                String username = PreferencesUtils.getString(SplashActivity.this
                        , Contants.USER_NAME);
                String password = PreferencesUtils.getString(SplashActivity.this,
                        Contants.USER_PASSWORD);

                //感覺不是最好的辦法,Bmob官網說有個getCurrentUser()方法
                //來判斷是否之前登錄過,但是我嘗試了,獲取到的User對象都是為空,就想到這個方法進行彌補
                //這個方法也是可以進行登錄的,但是貌似對其他登錄有點影響,這個後期遇到更好的辦法就在去優化
//                BmobUser.loginByAccount(username, password, new LogInListener<MyUser>() {
//
//                    @Override
//                    public void done(MyUser user, BmobException e) {
//                        if (user != null) {
//                            Log.i("smile", "用戶登陸成功");
//                            EventBus.getDefault().post(new LoginEvent(user));
//                            PreferencesUtils.putBoolean(SplashActivity.this
//                                    , Contants.IS_LOGIN, true);
//                        }
//                    }
//                });

                Intent intent = new Intent();
                if (isFirst) {
                    sp.edit().putBoolean(Contants.IS_FIRST_RUNNING, false).commit();
                    intent.setClass(SplashActivity.this, GuideActivity.class);
                } else {
                    intent.setClass(SplashActivity.this, MainActivity.class);
                    intent.putExtra("cityname",cityName);
                    intent.putExtra("latitude",latitude);
                    intent.putExtra("longitude",longitude);
                }

                startActivity(intent);

                finish();
            }
        });

    }
 
開發者ID:wuyinlei,項目名稱:TravelAround,代碼行數:79,代碼來源:SplashActivity.java


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