Skip to content

Instantly share code, notes, and snippets.

IntEvaluator evaluator = new IntEvaluator();
float fraction = 0; // 0 to 1
int leftCurvePointX = evaluator.evaluate(fraction, greatLeftStartX, goodLeftPointX);
public class SliderImageView extends View {
public SliderImageView(Context context) {
super(context);
}
public SliderImageView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public SliderImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawBitmap(mBitmapImage, mSrcBounds, mDrawBounds, mBitmapPaint);
}
public class SliderImageView extends View {
private static final String TAG = "SliderImageView";
private Bitmap mBitmapImage;
private float mAnimateFactor = 0f;
private Rect mSrcBounds = new Rect();
private Rect mDrawBounds = new Rect();
private Paint mBitmapPaint = new Paint();
public static class MenuViewHolder extends RecyclerView.ViewHolder {
public TextView content;
public CardView contentView;
public SliderImageView imageCard;
public MenuViewHolder(View itemView) {
super(itemView);
content = (TextView) itemView.findViewById(R.id.content);
contentView = (CardView) itemView.findViewById(R.id.contentView);
imageCard = (SliderImageView) itemView.findViewById(R.id.sliderImageView);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int count = mRecyclerView.getChildCount();
@sujithkanna
sujithkanna / LetsEncrypt.md
Created May 14, 2018 07:04 — forked from davestevens/LetsEncrypt.md
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
public class RotatableImageView extends android.support.v7.widget.AppCompatImageView {
private float angle = 0f;
public RotatableImageView(Context context) {
super(context);
// To evaluate value between x and y base on fraction(0 - 1)
private IntEvaluator mIntEvaluator = new IntEvaluator();
// Interpolator just for curvy animations.
private Interpolator mInterpolator = new AccelerateDecelerateInterpolator();
public void invalidateSlider(MenuViewHolder holder) {
SliderImageView imageCard = holder.imageCard;
// top defines the pixel position of the item in the screen
float top = holder.itemView.getTop() + holder.itemView.getMeasuredHeight();
float height = App.getInstance().getResources().getDisplayMetrics().heightPixels