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
... | |
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); | |
} | |
} |
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
... | |
@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); |
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
... | |
getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { | |
@Override | |
public void onGlobalLayout() { | |
try { | |
getViewTreeObserver().removeGlobalOnLayoutListener(this); | |
int w = getWidth(); | |
addItemDecoration(new EndOffsetDecoration(w - 50)); | |
}catch (Exception e){ |
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
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. | |
*/ |