├── .gitignore ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── me │ │ └── saket │ │ └── rxdiffutils │ │ ├── App.java │ │ ├── Intents.java │ │ ├── MainActivity.java │ │ ├── MinistryOfMagic.java │ │ ├── RxDiffUtil.java │ │ ├── SimpleDiffUtilCallbacks.java │ │ ├── Wizard.java │ │ ├── WizardDiffCallbacks.java │ │ └── WizardsAdapter.java │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ ├── activity_main.xml │ └── list_item_wizard.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── colors_material.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | build/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio stuff 31 | .idea/ 32 | .navigation/ 33 | captures/ 34 | *.iml 35 | 36 | ### Android Patch ### 37 | gen-external-apklibs 38 | 39 | # OS specific ignores 40 | .DS_Store 41 | *~ 42 | *.swp 43 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | ext.versions = [ 4 | minSdk : 24, 5 | compileSdk : 26, 6 | androidTools : '26.0.2', 7 | supportLib : '27.0.2', 8 | autoValue : '1.4', 9 | autoValueMoshi: '0.4.3', 10 | retrofit : '2.2.0', 11 | rxBindings : '2.0.0', 12 | dagger : '2.10', 13 | butterKnife : '8.8.1', 14 | timber : '4.6.0', 15 | ] 16 | 17 | android { 18 | compileSdkVersion versions.compileSdk 19 | 20 | defaultConfig { 21 | applicationId "me.saket.rxdiffutils" 22 | minSdkVersion versions.minSdk 23 | targetSdkVersion versions.compileSdk 24 | versionCode 1 25 | versionName "1.0" 26 | } 27 | 28 | buildTypes { 29 | release { 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | 35 | compileOptions { 36 | targetCompatibility 1.8 37 | sourceCompatibility 1.8 38 | } 39 | } 40 | 41 | dependencies { 42 | implementation "com.android.support:appcompat-v7:$versions.supportLib" 43 | implementation "com.android.support:recyclerview-v7:$versions.supportLib" 44 | annotationProcessor "com.google.auto.value:auto-value:$versions.autoValue" 45 | provided "com.jakewharton.auto.value:auto-value-annotations:$versions.autoValue" 46 | implementation "com.jakewharton.timber:timber:$versions.timber" 47 | implementation "com.jakewharton:butterknife:$versions.butterKnife" 48 | annotationProcessor "com.jakewharton:butterknife-compiler:$versions.butterKnife" 49 | implementation 'io.reactivex.rxjava2:rxjava:2.1.7' 50 | implementation 'io.reactivex.rxjava2:rxandroid:2.0.1' 51 | implementation "com.jakewharton.rxbinding2:rxbinding:$versions.rxBindings" 52 | implementation "com.jakewharton.rxrelay2:rxrelay:2.0.0" 53 | implementation "com.mikepenz:itemanimators:1.0.1@aar" 54 | } 55 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/me/saket/rxdiffutils/App.java: -------------------------------------------------------------------------------- 1 | package me.saket.rxdiffutils; 2 | 3 | import android.app.Application; 4 | import timber.log.Timber; 5 | import timber.log.Timber.DebugTree; 6 | 7 | public class App extends Application { 8 | 9 | @Override 10 | public void onCreate() { 11 | super.onCreate(); 12 | Timber.plant(new DebugTree()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/me/saket/rxdiffutils/Intents.java: -------------------------------------------------------------------------------- 1 | package me.saket.rxdiffutils; 2 | 3 | import android.content.Intent; 4 | import android.net.Uri; 5 | 6 | public class Intents { 7 | 8 | public static Intent forGoogleSearch(String query) { 9 | return new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://www.google.com/search?q=" + query)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/me/saket/rxdiffutils/MainActivity.java: -------------------------------------------------------------------------------- 1 | package me.saket.rxdiffutils; 2 | 3 | import static io.reactivex.android.schedulers.AndroidSchedulers.mainThread; 4 | import static io.reactivex.schedulers.Schedulers.io; 5 | 6 | import android.os.Bundle; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.support.v7.widget.LinearLayoutManager; 9 | import android.support.v7.widget.RecyclerView; 10 | import android.widget.EditText; 11 | 12 | import com.jakewharton.rxbinding2.internal.Notification; 13 | import com.jakewharton.rxbinding2.widget.RxTextView; 14 | import com.jakewharton.rxrelay2.PublishRelay; 15 | import com.jakewharton.rxrelay2.Relay; 16 | import com.mikepenz.itemanimators.SlideDownAlphaAnimator; 17 | 18 | import java.util.List; 19 | 20 | import butterknife.BindView; 21 | import butterknife.ButterKnife; 22 | import io.reactivex.Observable; 23 | 24 | public class MainActivity extends AppCompatActivity { 25 | 26 | @BindView(R.id.searchquery) EditText searchQueryField; 27 | @BindView(R.id.recyclerview) RecyclerView recyclerView; 28 | 29 | private final Relay onDestroys = PublishRelay.create(); 30 | 31 | @Override 32 | protected void onCreate(Bundle savedInstanceState) { 33 | super.onCreate(savedInstanceState); 34 | setContentView(R.layout.activity_main); 35 | ButterKnife.bind(this); 36 | 37 | MinistryOfMagic ministryOfMagic = new MinistryOfMagic(); 38 | Observable> searchResults = RxTextView.textChanges(searchQueryField) 39 | .map(CharSequence::toString) 40 | .switchMapSingle(ministryOfMagic::search); 41 | 42 | WizardsAdapter wizardsAdapter = new WizardsAdapter(); 43 | searchResults 44 | .observeOn(io()) 45 | .compose(RxDiffUtil.calculateDiff(WizardDiffCallbacks::create)) 46 | .observeOn(mainThread()) 47 | .takeUntil(onDestroys) 48 | .subscribe(wizardsAdapter); 49 | 50 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 51 | recyclerView.setItemAnimator(new SlideDownAlphaAnimator()); 52 | recyclerView.setAdapter(wizardsAdapter); 53 | 54 | wizardsAdapter.itemClicks() 55 | .takeUntil(onDestroys) 56 | .subscribe(wizard -> startActivity(Intents.forGoogleSearch(wizard.name()))); 57 | } 58 | 59 | @Override 60 | protected void onDestroy() { 61 | onDestroys.accept(Notification.INSTANCE); 62 | super.onDestroy(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/me/saket/rxdiffutils/MinistryOfMagic.java: -------------------------------------------------------------------------------- 1 | package me.saket.rxdiffutils; 2 | 3 | import io.reactivex.Single; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | import java.util.Locale; 7 | import java.util.stream.Collectors; 8 | 9 | public class MinistryOfMagic { 10 | 11 | private static final List STUDENTS = new ArrayList() {{ 12 | add(Wizard.create(1, "Hannah Abbott", "Hufflepuff")); 13 | add(Wizard.create(2, "Sirius Black", "Gryffindor")); 14 | add(Wizard.create(3, "Lavender Brown", "Gryffindor")); 15 | add(Wizard.create(4, "Millicent Bulstrode", "Slytherin")); 16 | add(Wizard.create(5, "Dennis Creevey", "Gryffindor")); 17 | add(Wizard.create(6, "Roger Davies", "Ravenclaw")); 18 | add(Wizard.create(7, "Cedric Diggory", "Hufflepuff")); 19 | add(Wizard.create(8, "Justin Finch-Fletchley", "Hufflepuff")); 20 | add(Wizard.create(9, "Ernie Macmillan", "Hufflepuff")); 21 | add(Wizard.create(10, "Zacharias Smith", "Hufflepuff")); 22 | add(Wizard.create(11, "Vincent Crabbe", "Slytherin")); 23 | add(Wizard.create(12, "Marcus Flint", "Slytherin")); 24 | add(Wizard.create(13, "Gregory Goyle", "Slytherin")); 25 | add(Wizard.create(14, "Draco Malfoy", "Slytherin")); 26 | add(Wizard.create(15, "Graham Montague", "Slytherin")); 27 | add(Wizard.create(16, "Pansy Parkinson", "Slytherin")); 28 | add(Wizard.create(17, "Alicia Spinnet", "Gryffindor")); 29 | add(Wizard.create(18, "Dean Thomas", "Gryffindor")); 30 | add(Wizard.create(19, "Ron Weasley", "Gryffindor")); 31 | add(Wizard.create(20, "Ginny Weasley", "Gryffindor")); 32 | add(Wizard.create(21, "Katie Bell", "Gryffindor")); 33 | add(Wizard.create(22, "Colin Creevey", "Gryffindor")); 34 | add(Wizard.create(23, "Seamus Finnigan", "Gryffindor")); 35 | add(Wizard.create(24, "Hermione Granger", "Gryffindor")); 36 | add(Wizard.create(25, "Harry Potter", "Gryffindor")); 37 | }}; 38 | 39 | Single> search(String query) { 40 | if (query.isEmpty()) { 41 | return Single.just(STUDENTS); 42 | } 43 | 44 | return Single.fromCallable(() -> STUDENTS.stream() 45 | .filter(wizard -> wizard.name().toLowerCase(Locale.ENGLISH).startsWith(query.toLowerCase(Locale.ENGLISH))) 46 | .collect(Collectors.toList())); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/me/saket/rxdiffutils/RxDiffUtil.java: -------------------------------------------------------------------------------- 1 | package me.saket.rxdiffutils; 2 | 3 | import android.support.v7.util.DiffUtil; 4 | import android.support.v7.util.DiffUtil.DiffResult; 5 | import android.util.Pair; 6 | 7 | import java.util.Collections; 8 | import java.util.List; 9 | 10 | import io.reactivex.ObservableTransformer; 11 | import io.reactivex.functions.BiFunction; 12 | 13 | public class RxDiffUtil { 14 | 15 | public static ObservableTransformer, Pair, DiffResult>> calculateDiff( 16 | BiFunction, List, DiffUtil.Callback> diffCallbacks) 17 | { 18 | Pair, DiffUtil.DiffResult> initialPair = Pair.create(Collections.emptyList(), null); 19 | return upstream -> upstream 20 | .scan(initialPair, (latestPair, nextItems) -> { 21 | DiffUtil.Callback callback = diffCallbacks.apply(latestPair.first, nextItems); 22 | DiffUtil.DiffResult result = DiffUtil.calculateDiff(callback, true); 23 | return Pair.create(nextItems, result); 24 | }) 25 | .skip(1); // downstream shouldn't receive seedPair. 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/me/saket/rxdiffutils/SimpleDiffUtilCallbacks.java: -------------------------------------------------------------------------------- 1 | package me.saket.rxdiffutils; 2 | 3 | import android.support.v7.util.DiffUtil; 4 | import java.util.List; 5 | 6 | /** 7 | * DIffUtils.Callback + generics. 8 | */ 9 | public abstract class SimpleDiffUtilCallbacks extends DiffUtil.Callback { 10 | 11 | private final List oldItems; 12 | private final List newItems; 13 | 14 | public SimpleDiffUtilCallbacks(List oldItems, List newItems) { 15 | this.oldItems = oldItems; 16 | this.newItems = newItems; 17 | } 18 | 19 | public abstract boolean areItemsTheSame(T oldItem, T newItem); 20 | 21 | protected abstract boolean areContentsTheSame(T oldItem, T newItem); 22 | 23 | @Override 24 | public final int getOldListSize() { 25 | return oldItems.size(); 26 | } 27 | 28 | @Override 29 | public final int getNewListSize() { 30 | return newItems.size(); 31 | } 32 | 33 | @Override 34 | public final boolean areItemsTheSame(int oldItemPosition, int newItemPosition) { 35 | T oldItem = oldItems.get(oldItemPosition); 36 | T newItem = newItems.get(newItemPosition); 37 | return areItemsTheSame(oldItem, newItem); 38 | } 39 | 40 | @Override 41 | public final boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { 42 | T oldItem = oldItems.get(oldItemPosition); 43 | T newItem = newItems.get(newItemPosition); 44 | return areContentsTheSame(oldItem, newItem); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/me/saket/rxdiffutils/Wizard.java: -------------------------------------------------------------------------------- 1 | package me.saket.rxdiffutils; 2 | 3 | import com.google.auto.value.AutoValue; 4 | 5 | @AutoValue 6 | public abstract class Wizard { 7 | 8 | public abstract long id(); 9 | 10 | public abstract String name(); 11 | 12 | public abstract String house(); 13 | 14 | public static Wizard create(long id, String name, String house) { 15 | return new AutoValue_Wizard(id, name, house); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/me/saket/rxdiffutils/WizardDiffCallbacks.java: -------------------------------------------------------------------------------- 1 | package me.saket.rxdiffutils; 2 | 3 | import java.util.List; 4 | 5 | public class WizardDiffCallbacks extends SimpleDiffUtilCallbacks { 6 | 7 | public static WizardDiffCallbacks create(List oldItems, List newItems) { 8 | return new WizardDiffCallbacks(oldItems, newItems); 9 | } 10 | 11 | private WizardDiffCallbacks(List oldItems, List newItems) { 12 | super(oldItems, newItems); 13 | } 14 | 15 | @Override 16 | public boolean areItemsTheSame(Wizard oldItem, Wizard newItem) { 17 | return oldItem.id() == newItem.id(); 18 | } 19 | 20 | @Override 21 | protected boolean areContentsTheSame(Wizard oldItem, Wizard newItem) { 22 | return oldItem.equals(newItem); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/me/saket/rxdiffutils/WizardsAdapter.java: -------------------------------------------------------------------------------- 1 | package me.saket.rxdiffutils; 2 | 3 | import android.support.v7.util.DiffUtil.DiffResult; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.util.Pair; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.TextView; 10 | import butterknife.BindView; 11 | import butterknife.ButterKnife; 12 | import com.jakewharton.rxrelay2.PublishRelay; 13 | import com.jakewharton.rxrelay2.Relay; 14 | import io.reactivex.Observable; 15 | import io.reactivex.functions.Consumer; 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | public class WizardsAdapter extends RecyclerView.Adapter 20 | implements Consumer, DiffResult>> 21 | { 22 | 23 | private List wizards = new ArrayList<>(); 24 | private Relay itemClicks = PublishRelay.create(); 25 | 26 | public WizardsAdapter() { 27 | setHasStableIds(true); 28 | } 29 | 30 | public Observable itemClicks() { 31 | return itemClicks; 32 | } 33 | 34 | @Override 35 | public void accept(Pair, DiffResult> pair) throws Exception { 36 | wizards = pair.first; 37 | pair.second.dispatchUpdatesTo(this); 38 | } 39 | 40 | @Override 41 | public WizardVH onCreateViewHolder(ViewGroup parent, int viewType) { 42 | WizardVH holder = WizardVH.create(LayoutInflater.from(parent.getContext()), parent); 43 | holder.itemView.setOnClickListener(o -> itemClicks.accept(holder.item)); 44 | return holder; 45 | } 46 | 47 | @Override 48 | public void onBindViewHolder(WizardVH holder, int position) { 49 | holder.setItem(wizards.get(position)); 50 | holder.render(); 51 | } 52 | 53 | @Override 54 | public long getItemId(int position) { 55 | return wizards.get(position).id(); 56 | } 57 | 58 | @Override 59 | public int getItemCount() { 60 | return wizards == null ? 0 : wizards.size(); 61 | } 62 | 63 | public static class WizardVH extends RecyclerView.ViewHolder { 64 | 65 | @BindView(R.id.wizard_name) TextView nameView; 66 | @BindView(R.id.wizard_house) TextView houseView; 67 | 68 | private Wizard item; 69 | 70 | public static WizardVH create(LayoutInflater inflater, ViewGroup parent) { 71 | return new WizardVH(inflater.inflate(R.layout.list_item_wizard, parent, false)); 72 | } 73 | 74 | public WizardVH(View itemView) { 75 | super(itemView); 76 | ButterKnife.bind(this, itemView); 77 | } 78 | 79 | public void setItem(Wizard wizard) { 80 | this.item = wizard; 81 | } 82 | 83 | public void render() { 84 | nameView.setText(item.name()); 85 | houseView.setText(item.house()); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 20 | 21 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_wizard.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | 25 | 26 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | @color/white 4 | @color/gray_100 5 | @color/teal_A700 6 | @color/white 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 25 | 26 | @android:color/transparent 27 | #06FFFFFF 28 | #0CFFFFFF 29 | #33FFFFFF 30 | #4CFFFFFF 31 | #66FFFFFF 32 | #80FFFFFF 33 | #99FFFFFF 34 | #CCFFFFFF 35 | #E6FFFFFF 36 | 37 | #0C000000 38 | #1A000000 39 | #33000000 40 | #4C000000 41 | #66000000 42 | #80000000 43 | #99000000 44 | #C4000000 45 | #E6000000 46 | 47 | 48 | #FFEBEE 49 | #FFCDD2 50 | #EF9A9A 51 | #E57373 52 | #EF5350 53 | #F44336 54 | #E53935 55 | #D32F2F 56 | #C62828 57 | #B71C1C 58 | #FF8A80 59 | #FF5252 60 | #FF1744 61 | #D50000 62 | 63 | 64 | #FCE4EC 65 | #F8BBD0 66 | #F48FB1 67 | #F06292 68 | #EC407A 69 | #E91E63 70 | #D81B60 71 | #C2185B 72 | #AD1457 73 | #880E4F 74 | #FF80AB 75 | #FF4081 76 | #F50057 77 | #C51162 78 | 79 | #F040FB 80 | 81 | 82 | #F3E5F5 83 | #E1BEE7 84 | #CE93D8 85 | #BA68C8 86 | #AB47BC 87 | #9C27B0 88 | #8E24AA 89 | #7B1FA2 90 | #6A1B9A 91 | #4A148C 92 | #EA80FC 93 | #E040FB 94 | #D500F9 95 | #AA00FF 96 | 97 | 98 | #EDE7F6 99 | #D1C4E9 100 | #B39DDB 101 | #9575CD 102 | #7E57C2 103 | #673AB7 104 | #5E35B1 105 | #512DA8 106 | #4527A0 107 | #311B92 108 | #B388FF 109 | #7C4DFF 110 | #651FFF 111 | #6200EA 112 | 113 | 114 | #E8EAF6 115 | #C5CAE9 116 | #9FA8DA 117 | #7986CB 118 | #5C6BC0 119 | #3F51B5 120 | #3949AB 121 | #303F9F 122 | #283593 123 | #1A237E 124 | #8C9EFF 125 | #536DFE 126 | #3D5AFE 127 | #304FFE 128 | 129 | 130 | #E3F2FD 131 | #BBDEFB 132 | #90CAF9 133 | #64B5F6 134 | #42A5F5 135 | #2196F3 136 | #1E88E5 137 | #1976D2 138 | #1565C0 139 | #0D47A1 140 | #82B1FF 141 | #448AFF 142 | #2979FF 143 | #2962FF 144 | 145 | 146 | #E1F5FE 147 | #B3E5FC 148 | #81D4fA 149 | #4fC3F7 150 | #29B6FC 151 | #03A9F4 152 | #039BE5 153 | #0288D1 154 | #0277BD 155 | #01579B 156 | #80D8FF 157 | #40C4FF 158 | #00B0FF 159 | #0091EA 160 | 161 | 162 | #E0F7FA 163 | #B2EBF2 164 | #80DEEA 165 | #4DD0E1 166 | #26C6DA 167 | #00BCD4 168 | #00ACC1 169 | #0097A7 170 | #00838F 171 | #006064 172 | #84FFFF 173 | #18FFFF 174 | #00E5FF 175 | #00B8D4 176 | 177 | 178 | #E0F2F1 179 | #B2DFDB 180 | #80CBC4 181 | #4DB6AC 182 | #26A69A 183 | #009688 184 | #00897B 185 | #00796B 186 | #00695C 187 | #004D40 188 | #A7FFEB 189 | #64FFDA 190 | #1DE9B6 191 | #00BFA5 192 | 193 | #00A394 194 | 195 | #11DAB1 196 | #28C9AA 197 | 198 | 199 | #E8F5E9 200 | #C8E6C9 201 | #A5D6A7 202 | #81C784 203 | #66BB6A 204 | #4CAF50 205 | #43A047 206 | #388E3C 207 | #2E7D32 208 | #1B5E20 209 | #B9F6CA 210 | #69F0AE 211 | #00E676 212 | #00C853 213 | 214 | 215 | #F1F8E9 216 | #DCEDC8 217 | #C5E1A5 218 | #AED581 219 | #9CCC65 220 | #8BC34A 221 | #7CB342 222 | #689F38 223 | #558B2F 224 | #33691E 225 | #CCFF90 226 | #B2FF59 227 | #76FF03 228 | #64DD17 229 | 230 | 231 | #F9FBE7 232 | #F0F4C3 233 | #E6EE9C 234 | #DCE775 235 | #D4E157 236 | #CDDC39 237 | #C0CA33 238 | #A4B42B 239 | #9E9D24 240 | #827717 241 | #F4FF81 242 | #EEFF41 243 | #C6FF00 244 | #AEEA00 245 | 246 | 247 | #FFFDE7 248 | #FFF9C4 249 | #FFF590 250 | #FFF176 251 | #FFEE58 252 | #FFEB3B 253 | #FDD835 254 | #FBC02D 255 | #F9A825 256 | #F57F17 257 | #FFFF82 258 | #FFFF00 259 | #FFEA00 260 | #FFD600 261 | 262 | 263 | #FFF8E1 264 | #FFECB3 265 | #FFE082 266 | #FFD54F 267 | #FFCA28 268 | #FFC107 269 | #FFB300 270 | #FFA000 271 | #FF8F00 272 | #FF6F00 273 | #FFE57F 274 | #FFD740 275 | #FFC400 276 | #FFAB00 277 | 278 | 279 | #FFF3E0 280 | #FFE0B2 281 | #FFCC80 282 | #FFB74D 283 | #FFA726 284 | #FF9800 285 | #FB8C00 286 | #F57C00 287 | #EF6C00 288 | #E65100 289 | #FFD180 290 | #FFAB40 291 | #FF9100 292 | #FF6D00 293 | 294 | 295 | #FBE9A7 296 | #FFCCBC 297 | #FFAB91 298 | #FF8A65 299 | #FF7043 300 | #FF5722 301 | #F4511E 302 | #E64A19 303 | #D84315 304 | #BF360C 305 | #FF9E80 306 | #FF6E40 307 | #FF3D00 308 | #DD2600 309 | 310 | 311 | #EFEBE9 312 | #D7CCC8 313 | #BCAAA4 314 | #A1887F 315 | #8D6E63 316 | #795548 317 | #6D4C41 318 | #5D4037 319 | #4E342E 320 | #3E2723 321 | 322 | 323 | #FAFAFA 324 | #F5F5F5 325 | #EEEEEE 326 | #E0E0E0 327 | #BDBDBD 328 | #9E9E9E 329 | #757575 330 | #616161 331 | #424242 332 | #3A3A3A 333 | #212121 334 | #1B1B1B 335 | #000000 336 | #ffffff 337 | 338 | 339 | #ECEFF1 340 | #CFD8DC 341 | #B0BBC5 342 | #90A4AE 343 | #78909C 344 | #607D8B 345 | #546E7A 346 | #455A64 347 | #37474F 348 | #263238 349 | #192126 350 | 351 | #15212D 352 | #1f2d3b 353 | #1F3143 354 | #294159 355 | 356 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Rx.DiffUtils 3 | Search wizards… 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.0.1' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saket/RxDiffUtil/97c8a9649e9bad9d0ed4393bbb3d7f54138536e4/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jan 19 14:47:35 IST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------