This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.design.widget.CoordinatorLayout | |
android:id="@+id/activity_container" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<!--This will be the one we'll cover--> | |
<FrameLayout | |
android:id="@+id/list_fragment_container" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AlertDialogHelper { | |
public static void showMyDialog(final Context context) { | |
final AlertDialog dialog = new AlertDialog.Builder(context) | |
.setTitle("My dialog") | |
.setMessage("This is your dialog, where you explain why the user needs to press the \"yes\" here.") | |
.setNeutralButton("Yes", new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
dialog.dismiss(); | |
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AnimationUtils { | |
public interface AnimationFinishedListener { | |
void onAnimationFinished(); | |
} | |
public static int getMediumDuration(Context context) { | |
int duration; | |
if (isAnimationEnabled()) { | |
duration = context.getResources().getInteger(android.R.integer.config_mediumAnimTime); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DetailFragment extends Fragment implements Dismissible, ... { | |
public static final String ARG_REVEAL_SETTINGS = "ARG_REVEAL_SETTINGS"; | |
//... | |
@Override | |
public void dismiss(OnDismissedListener listener) { | |
AnimationUtils.startCircularRevealExitAnimation(getContext(), getView(), (RevealAnimationSetting) getArguments().getParcelable(ARG_REVEAL_SETTINGS), getColor(R.color.white), getColor(R.color.prezi_blue), new AnimationFinishedListener() { | |
@Override | |
public void onAnimationFinished() { | |
listener.onDismissed(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AnimationUtils { | |
//... | |
public static void startCircularExitAnimation(final Context context, final View view, final RevealAnimationSetting revealSettings, final int startColor, final int endColor, final Dismissible.OnDismissedListener listener) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
int cx = revealSettings.getCenterX(); | |
int cy = revealSettings.getCenterY(); | |
int width = revealSettings.getWidth(); | |
int height = revealSettings.getHeight(); | |
int duration = context.getResources().getInteger(android.R.integer.config_mediumAnimTime); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
//Won't show the events fully, only "peek" into it | |
final float maxX = getResources().getDimensionPixelSize(R.dimen.share_link_swipe_action_size) * 0.75f; | |
final ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f); | |
animator.setInterpolator(new CycleInterpolator(1)); | |
animator.setDuration(1000); | |
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { | |
@Override | |
public void onAnimationUpdate(ValueAnimator animation) { | |
float value = animation.getAnimatedFraction() * maxX; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class ViewHolder extends RecyclerView.ViewHolder { | |
private Interpolator interpolator = new DecelerateInterpolator(2f); | |
private TextView nameTextView; | |
private View leftImage; | |
private View rightImage; | |
private View view; | |
public ViewHolder(View view) { | |
super(view); | |
this.view = view; |
NewerOlder