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();
}
}
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();
}
}
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();
}
}
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
}
}
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);
}
Aggregations