Skip to content

Instantly share code, notes, and snippets.

📱

Angelo Moroni chemickypes

📱
Block or report user

Report or block chemickypes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chemickypes
chemickypes / CountDownTime.java
Created Apr 27, 2017
CountDownTimer suing RXJava 2
View CountDownTime.java
import java.util.concurrent.TimeUnit;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* Created by Angelo Moroni on 27/04/17.
*/
View LeftmostElementPickerLayoutManager.java
...
View newf = findFirstVisibleItem();
if(!newf.equals(f) ) {
f = newf;
for (int i = 0; i < getChildCount(); i++) {
View v = getChildAt(i);
v.setAlpha(v.equals(f)?1f:0.5f);
}
}
@chemickypes
chemickypes / HorizontalPicker.java
Last active Jun 27, 2017
Code for Article on Medium 1
View HorizontalPicker.java
...
getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
try {
getViewTreeObserver().removeGlobalOnLayoutListener(this);
int w = getWidth();
addItemDecoration(new EndOffsetDecoration(w - 50));
}catch (Exception e){
View EndOffsetDecoration.java
...
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
int dataSize = state.getItemCount();
int position = parent.getChildAdapterPosition(view);
if (dataSize > 0 && position == dataSize - 1) {
outRect.set(0, 0, mEndOffset, 0);
} else {
outRect.set(0, 0, 0, 0);
You can’t perform that action at this time.