Search in sources :

Example 11 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project android_frameworks_base by ResurrectionRemix.

the class QSPanel method setAnimationTile.

private void setAnimationTile(TileRecord r) {
    ObjectAnimator animTile = null;
    int animStyle = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_STYLE, 0, UserHandle.USER_CURRENT);
    int animDuration = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_DURATION, 2000, UserHandle.USER_CURRENT);
    int interpolatorType = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_INTERPOLATOR, 0, UserHandle.USER_CURRENT);
    if (animStyle == 0) {
    //No animation
    }
    if (animStyle == 1) {
        animTile = ObjectAnimator.ofFloat(r.tileView, "rotationY", 0f, 360f);
    }
    if (animStyle == 2) {
        animTile = ObjectAnimator.ofFloat(r.tileView, "rotation", 0f, 360f);
    }
    if (animTile != null) {
        switch(interpolatorType) {
            case 0:
                animTile.setInterpolator(new LinearInterpolator());
                break;
            case 1:
                animTile.setInterpolator(new AccelerateInterpolator());
                break;
            case 2:
                animTile.setInterpolator(new DecelerateInterpolator());
                break;
            case 3:
                animTile.setInterpolator(new AccelerateDecelerateInterpolator());
                break;
            case 4:
                animTile.setInterpolator(new BounceInterpolator());
                break;
            case 5:
                animTile.setInterpolator(new OvershootInterpolator());
                break;
            case 6:
                animTile.setInterpolator(new AnticipateInterpolator());
                break;
            case 7:
                animTile.setInterpolator(new AnticipateOvershootInterpolator());
                break;
            default:
                break;
        }
        animTile.setDuration(animDuration);
        animTile.start();
    }
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) OvershootInterpolator(android.view.animation.OvershootInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) BounceInterpolator(android.view.animation.BounceInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 12 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project android_frameworks_base by DirtyUnicorns.

the class QSPanel method setAnimationTile.

private void setAnimationTile(TileRecord r) {
    ObjectAnimator animTile = null;
    int animStyle = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_STYLE, 0, UserHandle.USER_CURRENT);
    int animDuration = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_DURATION, 2000, UserHandle.USER_CURRENT);
    int interpolatorType = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_INTERPOLATOR, 0, UserHandle.USER_CURRENT);
    if (animStyle == 0) {
    //No animation
    }
    if (animStyle == 1) {
        animTile = ObjectAnimator.ofFloat(r.tileView, "rotationY", 0f, 360f);
    }
    if (animStyle == 2) {
        animTile = ObjectAnimator.ofFloat(r.tileView, "rotation", 0f, 360f);
    }
    if (animTile != null) {
        switch(interpolatorType) {
            case 0:
                animTile.setInterpolator(new LinearInterpolator());
                break;
            case 1:
                animTile.setInterpolator(new AccelerateInterpolator());
                break;
            case 2:
                animTile.setInterpolator(new DecelerateInterpolator());
                break;
            case 3:
                animTile.setInterpolator(new AccelerateDecelerateInterpolator());
                break;
            case 4:
                animTile.setInterpolator(new BounceInterpolator());
                break;
            case 5:
                animTile.setInterpolator(new OvershootInterpolator());
                break;
            case 6:
                animTile.setInterpolator(new AnticipateInterpolator());
                break;
            case 7:
                animTile.setInterpolator(new AnticipateOvershootInterpolator());
                break;
            default:
                break;
        }
        animTile.setDuration(animDuration);
        animTile.start();
    }
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) OvershootInterpolator(android.view.animation.OvershootInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) BounceInterpolator(android.view.animation.BounceInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 13 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project android_frameworks_base by crdroidandroid.

the class QSPanel method setAnimationTile.

private void setAnimationTile(TileRecord r) {
    ObjectAnimator animTile = null;
    int animStyle = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_STYLE, 0, UserHandle.USER_CURRENT);
    int animDuration = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_DURATION, 2000, UserHandle.USER_CURRENT);
    int interpolatorType = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_INTERPOLATOR, 0, UserHandle.USER_CURRENT);
    if (animStyle == 0) {
    //No animation
    }
    if (animStyle == 1) {
        animTile = ObjectAnimator.ofFloat(r.tileView, "rotationY", 0f, 360f);
    }
    if (animStyle == 2) {
        animTile = ObjectAnimator.ofFloat(r.tileView, "rotation", 0f, 360f);
    }
    if (animTile != null) {
        switch(interpolatorType) {
            case 0:
                animTile.setInterpolator(new LinearInterpolator());
                break;
            case 1:
                animTile.setInterpolator(new AccelerateInterpolator());
                break;
            case 2:
                animTile.setInterpolator(new DecelerateInterpolator());
                break;
            case 3:
                animTile.setInterpolator(new AccelerateDecelerateInterpolator());
                break;
            case 4:
                animTile.setInterpolator(new BounceInterpolator());
                break;
            case 5:
                animTile.setInterpolator(new OvershootInterpolator());
                break;
            case 6:
                animTile.setInterpolator(new AnticipateInterpolator());
                break;
            case 7:
                animTile.setInterpolator(new AnticipateOvershootInterpolator());
                break;
            default:
                break;
        }
        animTile.setDuration(animDuration);
        animTile.start();
    }
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) OvershootInterpolator(android.view.animation.OvershootInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) BounceInterpolator(android.view.animation.BounceInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 14 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project ChatExchange by HueToYou.

the class MainActivity method setup.

private void setup() {
    final FloatingActionMenu fam = findViewById(R.id.chat_slide_menu);
    FloatingActionButton floatingActionButton = findViewById(R.id.add_chat_fab);
    floatingActionButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mainActivityUtils.showAddTabDialog();
            fam.close(true);
        }
    });
    FloatingActionButton fab = findViewById(R.id.home_fab);
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            mHandler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    Log.e("POS", "DEFL");
                    fragStuff.setFragmentByTag("home");
                }
            }, getResources().getInteger(R.integer.animation_duration_ms));
            // doCloseAnimationForDrawerToggle(mDrawerButton);
            mChatroomSlidingMenu.toggle();
            fam.close(false);
        }
    });
    mRequestFactory = new RequestFactory();
    mAccountManager = AccountManager.get(this);
    AccountManagerCallback<Bundle> accountManagerCallback = new AccountManagerCallback<Bundle>() {

        @Override
        public void run(AccountManagerFuture<Bundle> accountManagerFuture) {
            Log.e("AUtH", "AAA");
            String authToken = "";
            try {
                authToken = accountManagerFuture.getResult().getString(AccountManager.KEY_AUTHTOKEN);
                Log.e("Auth", authToken);
            } catch (Exception e) {
                e.printStackTrace();
                Log.e("RI", "P");
            }
            mRequestFactory = new RequestFactory(authToken);
            mCookieString = authToken;
            Log.e("AUTHTOKEN", authToken);
            CookieSyncManager.createInstance(MainActivity.this);
            CookieManager cookieManager = CookieManager.getInstance();
            cookieManager.setAcceptCookie(true);
            if (authToken != null) {
                cookieManager.removeSessionCookie();
                cookieManager.setCookie("https://stackexchange.com", authToken);
                CookieSyncManager.getInstance().sync();
            }
            fragStuff.doFragmentStuff();
        }
    };
    Set<String> seChatsTemp = mSharedPrefs.getStringSet("SEChatIDs", new HashSet<String>());
    Set<String> soChatsTemp = mSharedPrefs.getStringSet("SOChatIDs", new HashSet<String>());
    chatDataBundle.mSOChatIDs = new HashSet<>(soChatsTemp);
    chatDataBundle.mSEChatIDs = new HashSet<>(seChatsTemp);
    if (mSharedPrefs.getBoolean("isFirstRun", true)) {
        Intent intent = new Intent(this, IntroActivity.class);
        startActivity(intent);
        finish();
    } else if (mAccountManager.getAccounts().length < 1) {
        startActivity(new Intent(this, AuthenticatorActivity.class));
        finish();
    } else {
        if (mFragmentManager.findFragmentByTag("home") == null) {
            mFragmentManager.beginTransaction().add(R.id.content_main, new HomeFragment(), "home").commit();
        }
        mAccountManager.getAuthToken(mAccountManager.getAccounts()[0], Authenticator.ACCOUNT_TYPE, null, true, accountManagerCallback, null);
    }
    mainActivityUtils.respondToNotificationClick();
    mainActivityUtils.setupACBR();
    mItemClickedListener = new RecyclerAdapter.OnItemClicked() {

        @Override
        public void onClick(View view, int position) {
            Log.e("CLICKED", position + "");
            mCurrentFragment = mWrappedAdapter.getItemAt(position).getUrl();
            // doCloseAnimationForDrawerToggle(mDrawerButton);
            getmChatroomSlidingMenu().toggle();
            mHandler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    fragStuff.setFragmentByTag(mCurrentFragment);
                }
            }, getResources().getInteger(R.integer.animation_duration_ms));
        }

        @Override
        public void onCloseClick(View view, int position) {
            mainActivityUtils.confirmClose(position);
        }
    };
    chatroomsList = findViewById(R.id.chatroomsListView);
    mSwipeManager = new RecyclerViewSwipeManager();
    mWrappedAdapter = new RecyclerAdapter(this, mItemClickedListener, mSwipeManager);
    mAdapter = mSwipeManager.createWrappedAdapter(mWrappedAdapter);
    chatroomsList.setAdapter(mAdapter);
    // disable change animations
    ((SimpleItemAnimator) chatroomsList.getItemAnimator()).setSupportsChangeAnimations(false);
    mSwipeManager.attachRecyclerView(chatroomsList);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(chatroomsList.getContext(), DividerItemDecoration.VERTICAL);
    chatroomsList.addItemDecoration(dividerItemDecoration);
    assert getSupportActionBar() != null;
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    drawable = VectorDrawableCompat.create(getResources(), R.drawable.ic_menu_black_24dp, null);
    drawable.setTintList(ColorStateList.valueOf(Color.rgb(255, 255, 255)));
    getSupportActionBar().setHomeAsUpIndicator(drawable);
    fam.hideMenuButton(false);
    mActionBar = (Toolbar) Utils.getActionBar(getWindow().getDecorView());
    assert mActionBar != null;
    Log.e("ACTIONBAR", mActionBar.getClass().toString());
    // mActionBar.removeViewAt(1);
    // mActionBar.addView(newDrawer, 1);
    mDrawerButton = (AppCompatImageButton) mActionBar.getChildAt(1);
    ObjectAnimator closeAnimator = ObjectAnimator.ofFloat(mDrawerButton, "rotation", 180f, 0f);
    mCloseAnimSet.play(closeAnimator);
    mCloseAnimSet.setInterpolator(new AnticipateInterpolator());
    mCloseAnimSet.setDuration((long) Utils.getAnimDuration(getResources().getInteger(R.integer.animation_duration_ms), MainActivity.this));
    ObjectAnimator openAnimator = ObjectAnimator.ofFloat(mDrawerButton, "rotation", -180f, 0f);
    mOpenAnimSet.play(openAnimator);
    mOpenAnimSet.setInterpolator(new OvershootInterpolator());
    mOpenAnimSet.setDuration((long) Utils.getAnimDuration(getResources().getInteger(R.integer.animation_duration_ms), MainActivity.this));
    mDrawerButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Log.e("CLICKED", "CLICKED");
            onSupportNavigateUp();
        }
    });
    mChatroomSlidingMenu.setOnCloseListener(new SlidingMenu.OnCloseListener() {

        @Override
        public void onClose() {
            fam.close(false);
            fam.hideMenuButton(false);
            doCloseAnimationForDrawerToggle(mDrawerButton);
        }
    });
    mChatroomSlidingMenu.setOnOpenListener(new SlidingMenu.OnOpenListener() {

        @Override
        public void onOpen() {
            doOpenAnimationForDrawerToggle(mDrawerButton);
            mHandler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    fam.showMenuButton(true);
                }
            }, getResources().getInteger(R.integer.animation_duration_ms) - 400);
        }
    });
    mChatroomSlidingMenu.setOnOpenedListener(new SlidingMenu.OnOpenedListener() {

        @Override
        public void onOpened() {
            TutorialStuff.showChatSliderTutorial_MainActivity(MainActivity.this);
        }
    });
    Log.e("FEATURE", String.valueOf(getWindow().hasFeature(Window.FEATURE_OPTIONS_PANEL)));
    mActionMenuView = (ActionMenuView) mActionBar.getChildAt(2);
    oncreatejustcalled = true;
    // forces options menu overflow icon to show on devices with physical menu keys
    try {
        ViewConfiguration config = ViewConfiguration.get(this);
        Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
        if (menuKeyField != null) {
            menuKeyField.setAccessible(true);
            menuKeyField.setBoolean(config, false);
        }
    } catch (Exception e) {
    // presumably, not relevant
    }
}
Also used : AccountManagerCallback(android.accounts.AccountManagerCallback) AccountManagerFuture(android.accounts.AccountManagerFuture) HomeFragment(com.huetoyou.chatexchange.ui.frags.HomeFragment) FloatingActionMenu(com.github.clans.fab.FloatingActionMenu) SlidingMenu(com.jeremyfeinstein.slidingmenu.lib.SlidingMenu) ViewConfiguration(android.view.ViewConfiguration) Field(java.lang.reflect.Field) RequestFactory(com.huetoyou.chatexchange.net.RequestFactory) FloatingActionButton(com.github.clans.fab.FloatingActionButton) CookieManager(android.webkit.CookieManager) RecyclerViewSwipeManager(com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager) SimpleItemAnimator(android.support.v7.widget.SimpleItemAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) Bundle(android.os.Bundle) ChatDataBundle(com.huetoyou.chatexchange.ui.misc.ChatDataBundle) ObjectAnimator(android.animation.ObjectAnimator) Intent(android.content.Intent) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) View(android.view.View) CustomRecyclerView(com.huetoyou.chatexchange.ui.misc.CustomRecyclerView) ActionMenuView(android.support.v7.widget.ActionMenuView) RecyclerView(android.support.v7.widget.RecyclerView) AnticipateInterpolator(android.view.animation.AnticipateInterpolator) RecyclerAdapter(com.huetoyou.chatexchange.ui.misc.RecyclerAdapter)

Example 15 with AnticipateInterpolator

use of android.view.animation.AnticipateInterpolator in project smartmodule by carozhu.

the class AnimationController method setEffect.

private void setEffect(Animation animation, int interpolatorType, long durationMillis, long delayMillis) {
    switch(interpolatorType) {
        case 0:
            animation.setInterpolator(new LinearInterpolator());
            break;
        case 1:
            animation.setInterpolator(new AccelerateInterpolator());
            break;
        case 2:
            animation.setInterpolator(new DecelerateInterpolator());
            break;
        case 3:
            animation.setInterpolator(new AccelerateDecelerateInterpolator());
            break;
        case 4:
            animation.setInterpolator(new BounceInterpolator());
            break;
        case 5:
            animation.setInterpolator(new OvershootInterpolator());
            break;
        case 6:
            animation.setInterpolator(new AnticipateInterpolator());
            break;
        case 7:
            animation.setInterpolator(new AnticipateOvershootInterpolator());
            break;
        default:
            break;
    }
    animation.setDuration(durationMillis);
    animation.setStartOffset(delayMillis);
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) OvershootInterpolator(android.view.animation.OvershootInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) BounceInterpolator(android.view.animation.BounceInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Aggregations

AnticipateInterpolator (android.view.animation.AnticipateInterpolator)17 OvershootInterpolator (android.view.animation.OvershootInterpolator)8 ObjectAnimator (android.animation.ObjectAnimator)6 ValueAnimator (android.animation.ValueAnimator)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)4 AnticipateOvershootInterpolator (android.view.animation.AnticipateOvershootInterpolator)4 BounceInterpolator (android.view.animation.BounceInterpolator)4 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)4 LinearInterpolator (android.view.animation.LinearInterpolator)4 TypedArray (android.content.res.TypedArray)3 ContextThemeWrapper (android.view.ContextThemeWrapper)3 Animation (android.view.animation.Animation)2 ScaleAnimation (android.view.animation.ScaleAnimation)2 AccountManagerCallback (android.accounts.AccountManagerCallback)1 AccountManagerFuture (android.accounts.AccountManagerFuture)1 Intent (android.content.Intent)1 Resources (android.content.res.Resources)1 Bundle (android.os.Bundle)1 ActionMenuView (android.support.v7.widget.ActionMenuView)1