use of android.view.animation.AccelerateDecelerateInterpolator in project Tapad by berict.
the class MainActivity method closeSettings.
private void closeSettings() {
Log.d("closeSettings", "triggered");
if (isToolbarVisible && !isSettingsFromMenu) {
anim.circularRevealInPx(R.id.placeholder, coord[2], coord[3], (int) Math.hypot(coord[2], coord[3]) + 200, 0, new AccelerateDecelerateInterpolator(), circularRevealDuration, fadeAnimDuration, a);
anim.fadeIn(R.id.placeholder, 0, fadeAnimDuration, "settingOut", a);
} else {
w.getView(R.id.fragment_settings_container, a).setVisibility(View.GONE);
isSettingsFromMenu = false;
}
color = prefs.getInt("color", R.color.cyan_400);
clearToggleButton();
setSettingVisible(false);
Handler closeSettings = new Handler();
closeSettings.postDelayed(new Runnable() {
@Override
public void run() {
if (isAboutVisible) {
// about visible set taskdesc
w.setRecentColor(R.string.about, 0, themeColor, a);
} else {
setPresetInfo();
}
w.getView(R.id.fragment_settings_container, a).setVisibility(View.GONE);
}
}, fadeAnimDuration);
// reset the touch coords
coord[2] = 0;
coord[3] = 0;
}
use of android.view.animation.AccelerateDecelerateInterpolator in project Tapad by berict.
the class MainActivity method closeAbout.
private void closeAbout() {
Log.d("closeAbout", "triggered");
anim.circularRevealInPx(R.id.placeholder, coord[0], coord[1], (int) Math.hypot(coord[0], coord[1]) + 200, 0, new AccelerateDecelerateInterpolator(), circularRevealDuration, fadeAnimDuration, a);
anim.fadeIn(R.id.placeholder, 0, fadeAnimDuration, "aboutOut", a);
setAboutVisible(false);
Handler closeAbout = new Handler();
closeAbout.postDelayed(new Runnable() {
@Override
public void run() {
setPresetInfo();
w.getView(R.id.fragment_about_container, a).setVisibility(View.GONE);
}
}, fadeAnimDuration);
// Firstrun tutorial
if (prefs.getInt(qs, 0) == 8) {
promptPreset = new MaterialTapTargetPrompt.Builder(a).setTarget(a.findViewById(R.id.toolbar_preset)).setPrimaryText(R.string.dialog_tap_target_preset_primary).setSecondaryText(R.string.dialog_tap_target_preset_secondary).setAnimationInterpolator(new FastOutSlowInInterpolator()).setFocalColourFromRes(R.color.blue_500).setAutoDismiss(false).setAutoFinish(false).setCaptureTouchEventOutsidePrompt(true).setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() {
@Override
public void onHidePrompt(MotionEvent event, boolean tappedTarget) {
if (tappedTarget) {
promptPreset.finish();
promptPreset = null;
prefs.edit().putInt(qs, 9).apply();
Log.i("sharedPrefs", "quickstart edited to 9");
}
}
@Override
public void onHidePromptComplete() {
// idk why is this here
//isTutorialVisible = false;
}
}).show();
}
// reset the touch coords
coord[0] = 0;
coord[1] = 0;
}
use of android.view.animation.AccelerateDecelerateInterpolator in project Tapad by berict.
the class AboutFragment method setPresetInfo.
public void setPresetInfo() {
toolbar.setActionBar(a, v);
toolbar.setActionBarTitle(R.string.about);
toolbar.setActionBarPadding(a, v);
toolbar.setActionBarDisplayHomeAsUp(true);
if (currentPreset != null) {
// Cardview
w.getView(R.id.cardview_music_layout, a).setVisibility(View.VISIBLE);
Picasso.with(a).load("file:" + currentPreset.getAbout().getImage()).placeholder(R.drawable.ic_image_album_placeholder).error(R.drawable.ic_image_album_error).into(w.getImageView(R.id.cardview_music_image, v));
w.getTextView(R.id.cardview_music_song, v).setText(currentPreset.getAbout().getTitle());
w.getTextView(R.id.cardview_music_explore, v).setTextColor(currentPreset.getAbout().getActionbarColor());
w.getTextView(R.id.cardview_music_change, v).setTextColor(currentPreset.getAbout().getActionbarColor());
toolbar.setActionBarColor(currentPreset.getAbout().getActionbarColor(), a);
} else {
w.getView(R.id.cardview_music_layout, a).setVisibility(View.GONE);
toolbar.setActionBarColor(R.color.colorPrimary, a);
}
// artist
w.getView(R.id.cardview_music, v).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.intentSharedElementWithExtra(a, "activity.AboutActivity", R.id.cardview_music_image, "transition", "about", "now_playing", 0, v);
}
});
w.getView(R.id.cardview_music_explore, v).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.intentSharedElementWithExtra(a, "activity.AboutActivity", R.id.cardview_music_image, "transition", "about", "now_playing", 0, v);
}
});
w.getView(R.id.cardview_music_change, v).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (isPresetVisible == false) {
intent.intent(a, "activity.PresetStoreActivity");
}
}
});
// preset store
w.getView(R.id.cardview_preset_store, v).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.intentSharedElementWithExtra(a, "activity.PresetStoreActivity", R.id.cardview_preset_store_image, "transition", "about", "now_playing", 0, v);
}
});
w.getView(R.id.cardview_preset_store_explore, v).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.intentSharedElementWithExtra(a, "activity.PresetStoreActivity", R.id.cardview_preset_store_image, "transition", "about", "now_playing", 0, v);
}
});
// tapad
w.getView(R.id.cardview_about, v).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.intentSharedElementWithExtra(a, "activity.AboutActivity", R.id.cardview_about_image, "transition", "about", "tapad", 0, v);
}
});
w.getView(R.id.cardview_about_explore, v).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.intentSharedElementWithExtra(a, "activity.AboutActivity", R.id.cardview_about_image, "transition", "about", "tapad", 0, v);
}
});
w.getView(R.id.cardview_about_settings, v).setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
coord[2] = (int) event.getRawX();
coord[3] = (int) event.getRawY();
return false;
}
});
w.getView(R.id.cardview_about_settings, v).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (isSettingVisible == false) {
anim.circularRevealInPx(R.id.placeholder, coord[2], coord[3], 0, (int) Math.hypot(coord[2], coord[3]) + 200, new AccelerateDecelerateInterpolator(), circularRevealDuration, 0, a);
Handler about = new Handler();
about.postDelayed(new Runnable() {
@Override
public void run() {
showSettingsFragment(a);
}
}, circularRevealDuration);
anim.fadeOut(R.id.placeholder, circularRevealDuration, fadeAnimDuration, a);
setSettingVisible(true);
}
}
});
// developer
w.getView(R.id.cardview_dev, v).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.intentSharedElementWithExtra(a, "activity.AboutActivity", R.id.cardview_dev_image, "transition", "about", "dev", 0, v);
}
});
w.getView(R.id.cardview_dev_explore, v).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent.intentSharedElementWithExtra(a, "activity.AboutActivity", R.id.cardview_dev_image, "transition", "about", "dev", 0, v);
}
});
// Blank ads
if (ad.isConnected(a)) {
// connected to internet, check ad is working
ad.getNativeAdView(R.id.adView_about, a).setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
// Ad loaded
Log.d("AdView", "Loaded");
anim.fadeOut(R.id.cardview_ad_loading, 0, 400, v, a);
w.getView(R.id.cardview_ad_failed, v).setVisibility(View.GONE);
super.onAdLoaded();
}
@Override
public void onAdFailedToLoad(int i) {
// Ad failed to load
Log.d("AdView", "Failed to load");
anim.fadeOut(R.id.cardview_ad_loading, 0, 400, v, a);
anim.fadeIn(R.id.cardview_ad_failed, 400, 400, "adFailFadeIn", v, a);
super.onAdFailedToLoad(i);
}
});
} else {
// not connected to internet
Log.d("AdView", "Failed to connect to the internet");
w.getView(R.id.cardview_ad, v).setVisibility(View.GONE);
}
}
use of android.view.animation.AccelerateDecelerateInterpolator in project Tapad by berict.
the class AnimateHelper method scaleIn.
public void scaleIn(final int id, int touchX, int touchY, final int delay, final long duration, String handlerName, Activity activity) {
final View view = (View) activity.findViewById(id);
float x = touchX / window.getWindowWidthPx(activity);
float y = touchY / window.getWindowHeightPx(activity);
final ScaleAnimation scaleOut = new ScaleAnimation(0, 1, 0, 1, Animation.ABSOLUTE, x, Animation.ABSOLUTE, y);
scaleOut.setInterpolator(new AccelerateDecelerateInterpolator());
Map<String, Handler> handlerCreator = new HashMap<>();
handlerCreator.put(handlerName, new Handler());
if (delay > 0) {
handlerCreator.get(handlerName).postDelayed(new Runnable() {
@Override
public void run() {
view.setVisibility(View.VISIBLE);
scaleOut.setDuration(duration);
view.startAnimation(scaleOut);
Log.i("AnimateHelper", "scale IN effect for " + String.valueOf(duration) + "ms with " + String.valueOf(delay) + "ms delay");
}
}, delay);
} else {
view.setVisibility(View.VISIBLE);
scaleOut.setDuration(duration);
view.startAnimation(scaleOut);
Log.i("AnimateHelper", "scale IN effect for " + String.valueOf(duration) + "ms with " + String.valueOf(delay) + "ms delay");
}
handlerCreator.get(handlerName).postDelayed(new Runnable() {
@Override
public void run() {
view.setVisibility(View.GONE);
}
}, delay + 10);
}
use of android.view.animation.AccelerateDecelerateInterpolator in project Tapad by berict.
the class AnimateHelper method scaleIn.
public void scaleIn(final View view, final int delay, final long duration, String handlerName) {
final ScaleAnimation scaleIn = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
view.setVisibility(View.INVISIBLE);
scaleIn.setInterpolator(new AccelerateDecelerateInterpolator());
if (delay > 0) {
Map<String, Handler> handlerCreator = new HashMap<>();
handlerCreator.put(handlerName, new Handler());
handlerCreator.get(handlerName).postDelayed(new Runnable() {
@Override
public void run() {
scaleIn.setDuration(duration);
view.startAnimation(scaleIn);
view.setVisibility(View.VISIBLE);
Log.i("AnimateHelper", "scale IN effect for " + String.valueOf(duration) + "ms with " + String.valueOf(delay) + "ms delay");
}
}, delay);
} else {
scaleIn.setDuration(duration);
view.startAnimation(scaleIn);
view.setVisibility(View.VISIBLE);
Log.i("AnimateHelper", "scale IN effect for " + String.valueOf(duration) + "ms with " + String.valueOf(delay) + "ms delay");
}
}
Aggregations