// Path: rxuploader-sample/src/main/java/com/jagsaund/rxuploader/sample/model/UploadPhotoList.java
// public class UploadPhotoList extends SortedList<DataModel> {
//     public UploadPhotoList(@NonNull final RecyclerView.Adapter adapter) {
//         super(DataModel.class, new SortedList.Callback<DataModel>() {
// 
//             @Override
//             public void onInserted(int position, int count) {
//                 adapter.notifyItemRangeInserted(position, count);
//             }
// 
//             @Override
//             public void onRemoved(int position, int count) {
//                 adapter.notifyItemRangeRemoved(position, count);
//             }
// 
//             @Override
//             public void onMoved(int fromPosition, int toPosition) {
//                 adapter.notifyItemMoved(fromPosition, toPosition);
//             }
// 
//             @Override
//             public int compare(@NonNull DataModel o1, @NonNull DataModel o2) {
//                 // upload jobs are ordered first
//                 if (o1.type() != o2.type()) {
//                     if (o1.type() == DataModelType.UPLOAD) {
//                         return -1;
//                     } else {
//                         return 1;
//                     }
//                 }
//                 return o1.id().compareTo(o2.id());
//             }
// 
//             @Override
//             public void onChanged(int position, int count) {
//                 adapter.notifyItemRangeChanged(position, count);
//             }
// 
//             @Override
//             public boolean areContentsTheSame(@NonNull DataModel oldItem,
//                     @NonNull DataModel newItem) {
//                 return oldItem.hashCode() == newItem.hashCode();
//             }
// 
//             @Override
//             public boolean areItemsTheSame(@NonNull DataModel item1, @NonNull DataModel item2) {
//                 return item1.type() == item2.type() && item1.id().equals(item2.id());
//             }
//         });
//     }
// }
// 
// Path: rxuploader-sample/src/main/java/com/jagsaund/rxuploader/sample/model/data/DataModel.java
// public interface DataModel {
//     @DataModelType
//     int type();
// 
//     @NonNull
//     String id();
// 
//     @NonNull
//     Status getStatus();
// }


import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.jagsaund.rxuploader.sample.model.UploadPhotoList;
import com.jagsaund.rxuploader.sample.model.data.DataModel;
import java.util.List;
            return RecyclerView.INVALID_TYPE;
        }
        return m.type();
    }

    @Override
    public long getItemId(int position) {
        final DataModel m = getItemAt(position);
        if (m == null) {
            return RecyclerView.NO_ID;
        }
        return m.id().hashCode();
    }

    @Nullable
    public DataModel getItemAt(int position) {
        if (position == RecyclerView.NO_POSITION || position < 0 || position >= getItemCount()) {
            return null;
        }
        return photoList.get(position);
    }

    public void addAll(@NonNull List<DataModel> data) {
        photoList.addAll(data);
    }

    public void add(@NonNull DataModel data) {
        photoList.add(data);
    }

// Path: rxuploader-sample/src/main/java/com/jagsaund/rxuploader/sample/model/UploadPhotoList.java
// public class UploadPhotoList extends SortedList<DataModel> {
//     public UploadPhotoList(@NonNull final RecyclerView.Adapter adapter) {
//         super(DataModel.class, new SortedList.Callback<DataModel>() {
// 
//             @Override
//             public void onInserted(int position, int count) {
//                 adapter.notifyItemRangeInserted(position, count);
//             }
// 
//             @Override
//             public void onRemoved(int position, int count) {
//                 adapter.notifyItemRangeRemoved(position, count);
//             }
// 
//             @Override
//             public void onMoved(int fromPosition, int toPosition) {
//                 adapter.notifyItemMoved(fromPosition, toPosition);
//             }
// 
//             @Override
//             public int compare(@NonNull DataModel o1, @NonNull DataModel o2) {
//                 // upload jobs are ordered first
//                 if (o1.type() != o2.type()) {
//                     if (o1.type() == DataModelType.UPLOAD) {
//                         return -1;
//                     } else {
//                         return 1;
//                     }
//                 }
//                 return o1.id().compareTo(o2.id());
//             }
// 
//             @Override
//             public void onChanged(int position, int count) {
//                 adapter.notifyItemRangeChanged(position, count);
//             }
// 
//             @Override
//             public boolean areContentsTheSame(@NonNull DataModel oldItem,
//                     @NonNull DataModel newItem) {
//                 return oldItem.hashCode() == newItem.hashCode();
//             }
// 
//             @Override
//             public boolean areItemsTheSame(@NonNull DataModel item1, @NonNull DataModel item2) {
//                 return item1.type() == item2.type() && item1.id().equals(item2.id());
//             }
//         });
//     }
// }
// 
// Path: rxuploader-sample/src/main/java/com/jagsaund/rxuploader/sample/model/data/DataModel.java
// public interface DataModel {
//     @DataModelType
//     int type();
// 
//     @NonNull
//     String id();
// 
//     @NonNull
//     Status getStatus();
// }


// Path: rxuploader-sample/src/main/java/com/jagsaund/rxuploader/sample/UploadRecyclerAdapter.java
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.jagsaund.rxuploader.sample.model.UploadPhotoList;
import com.jagsaund.rxuploader.sample.model.data.DataModel;
import java.util.List;

            return RecyclerView.INVALID_TYPE;
        }
        return m.type();
    }

    @Override
    public long getItemId(int position) {
        final DataModel m = getItemAt(position);
        if (m == null) {
            return RecyclerView.NO_ID;
        }
        return m.id().hashCode();
    }

    @Nullable
    public DataModel getItemAt(int position) {
        if (position == RecyclerView.NO_POSITION || position < 0 || position >= getItemCount()) {
            return null;
        }
        return photoList.get(position);
    }

    public void addAll(@NonNull List<DataModel> data) {
        photoList.addAll(data);
    }

    public void add(@NonNull DataModel data) {
        photoList.add(data);
    }

    public void remove(@NonNull DataModel data) {