Skip to content

Instantly share code, notes, and snippets.


JPARDOGO jpardogo

Block or report user

Report or block jpardogo

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
jpardogo / ViewModelBinder.kt
Last active Aug 20, 2018
ViewModelBinder utility class for Kodein DI
View ViewModelBinder.kt
inline fun <reified ViewModelT : ViewModel> BindActivity.viewModelBinder() = lazy {
activitybBinder<ViewModelT>(bindActivity = this)
inline fun <reified ViewModelT : ViewModel> BindFragment.viewModelBinder() = lazy {
jpardogo / build.gradle
Created Apr 11, 2018
Gradle DependecyResolution
View build.gradle
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
boolean isMultidex ='multidex')
if ( == '' && !isMultidex){
}else if(isMultidex){
details.useVersion lib_versions.multidex
public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener {
private OnItemClickListener mListener;
private GestureDetector mGestureDetector;
public interface OnItemClickListener {
void onItemClick(View view, int position);
public RecyclerItemClickListener(Context context, OnItemClickListener listener) {
mListener = listener;
jpardogo /
Last active Jun 14, 2018
Java classes to create a common base adapter strategy that acts as base for common adapters and multiple view types adapters in an android app
public abstract class BaseAllAdapters<T> extends BaseAdapter {
protected Context mContext;
protected LongSparseArray<DelegateAdapter> mDelegateAdapterSparseArray;
private int mViewLayoutId = 0;
private List<ListItem<T>> mItems;
/*Constructor if we dont use mutiple view types in the list*/
public BaseAllAdapters(Context context, int viewLayoutId) {
mContext = context;
jpardogo /
Created May 28, 2014
Demostration of the implementation of an auto-scroll ListView in Android. This gist is a reference for the blog post How to autoscroll a ListView at
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
jpardogo /
Last active Aug 29, 2015
Method to load a WebView that will receive the real 100% progress of the WebView avoiding fake 100% progress due redirections
private void loadPage() {
WebSettings seetings = mWebView.getSettings();
mWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return super.shouldOverrideUrlLoading(view, url);
jpardogo /
Last active Dec 19, 2018
Resize a bitmap respecting the aspect radio. I use a custom transformations with Picasso library. This transformation calculate the new dimension of the bitmap scaling it to fit a specific width or height that we pass as a parameter (usually the biggest size of the imageView where we wanna set the bitmap).
public class ScaleToFitWidthHeightTransform implements Transformation {
private int mSize;
private boolean isHeightScale;
public ScaleToFitWidthHeightTransform(int size, boolean isHeightScale){
mSize =size;
this.isHeightScale = isHeightScale;
You can’t perform that action at this time.