use of android.view.animation.OvershootInterpolator in project ENViews by codeestX.
the class ENDownloadView method start.
public void start() {
if (mCurrentState != STATE_PRE) {
return;
}
mCurrentState = STATE_PRE;
ValueAnimator preAnim = ValueAnimator.ofFloat(1.f, 100.f);
preAnim.setDuration(1500);
preAnim.setInterpolator(new OvershootInterpolator());
preAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = valueAnimator.getAnimatedFraction();
invalidate();
}
});
preAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mCurrentState = STATE_DOWNLOADING;
downloadAnim();
}
});
preAnim.start();
}
use of android.view.animation.OvershootInterpolator in project NotificationPeekPort by lzanita09.
the class SwipeHelper method snapChild.
public void snapChild(final View view, float velocity) {
final View animView = mCallback.getChildContentView(view);
final boolean canAnimViewBeDismissed = mCallback.canChildBeDismissed(animView);
ObjectAnimator anim = createTranslationAnimation(animView, 0);
anim.setInterpolator(new OvershootInterpolator(2.5f));
int duration = OVERSHOOT_DURATION;
anim.setDuration(duration);
anim.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
updateAlphaFromOffset(animView, canAnimViewBeDismissed);
}
});
anim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator animator) {
updateAlphaFromOffset(animView, canAnimViewBeDismissed);
}
});
anim.start();
}
use of android.view.animation.OvershootInterpolator 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.OvershootInterpolator in project MusicDNA by harjot-oberai.
the class ViewAlbumFragment method onResume.
@Override
public void onResume() {
super.onResume();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
fab.animate().scaleX(1.0f).scaleY(1.0f).setDuration(300).setInterpolator(new OvershootInterpolator());
}
}, 500);
}
use of android.view.animation.OvershootInterpolator 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