// Path: waterfallcache-sample/src/main/java/com/github/simonpercic/waterfallcachesample/test/AsyncActivity.java
// public class AsyncActivity extends BaseTestActivity {
// 
//     @Override protected void getTest(Cache waterfallCache, String key) {
//         waterfallCache.getAsync(key, SimpleObject.class, new WaterfallGetCallback<SimpleObject>() {
//             @Override public void onSuccess(SimpleObject object) {
//                 showValue(object);
//             }
// 
//             @Override public void onFailure(Throwable throwable) {
//                 showErrorMessage("Get", throwable);
//             }
//         });
//     }
// 
//     @Override protected void putTest(Cache waterfallCache, String value, String key) {
//         waterfallCache.putAsync(key, new SimpleObject(value), new WaterfallCallback() {
//             @Override public void onSuccess() {
//                 showSuccessMessage("Put", true);
//             }
// 
//             @Override public void onFailure(Throwable throwable) {
//                 showErrorMessage("Put", throwable);
//             }
//         });
//     }
// 
//     @Override protected void removeTest(Cache waterfallCache, String key) {
//         waterfallCache.removeAsync(key, new WaterfallCallback() {
//             @Override public void onSuccess() {
//                 showSuccessMessage("Remove", true);
//             }
// 
//             @Override public void onFailure(Throwable throwable) {
//                 showErrorMessage("Remove", throwable);
//             }
//         });
//     }
// 
//     @Override protected void containsTest(Cache waterfallCache, String key) {
//         waterfallCache.containsAsync(key, new WaterfallGetCallback<Boolean>() {
//             @Override public void onSuccess(Boolean contains) {
//                 showMessage(String.format("Contains: %s", contains));
//             }
// 
//             @Override public void onFailure(Throwable throwable) {
//                 showErrorMessage("Contains", throwable);
//             }
//         });
//     }
// 
//     @Override protected void clearTest(Cache waterfallCache) {
//         waterfallCache.clearAsync(new WaterfallCallback() {
//             @Override public void onSuccess() {
//                 showSuccessMessage("Clear", true);
//             }
// 
//             @Override public void onFailure(Throwable throwable) {
//                 showErrorMessage("Clear", throwable);
//             }
//         });
//     }
// 
//     public static Intent getIntent(Context context) {
//         return new Intent(context, AsyncActivity.class);
//     }
// }
// 
// Path: waterfallcache-sample/src/main/java/com/github/simonpercic/waterfallcachesample/test/RxActivity.java
// public class RxActivity extends BaseTestActivity {
// 
//     @Override
//     protected void getTest(Cache waterfallCache, String key) {
//         Observable<SimpleObject> test = waterfallCache.get(key, SimpleObject.class);
//         test.subscribe((simpleObject) -> {
//             showValue(simpleObject);
//         }, throwable -> showErrorMessage("Get", throwable));
//     }
// 
//     @Override protected void putTest(Cache waterfallCache, String value, String key) {
//         waterfallCache.put(key, new SimpleObject(value)).subscribe(
//                 success -> showSuccessMessage("Put", success),
//                 throwable -> showErrorMessage("Put", throwable));
//     }
// 
//     @Override protected void removeTest(Cache waterfallCache, String key) {
//         waterfallCache.remove(key).subscribe(
//                 success -> showSuccessMessage("Remove", success),
//                 throwable -> showErrorMessage("Remove", throwable));
//     }
// 
//     @Override protected void containsTest(Cache waterfallCache, String key) {
//         waterfallCache.contains(key).subscribe(
//                 contains -> showMessage(String.format("Contains: %s", contains)),
//                 throwable -> showErrorMessage("Contains", throwable));
//     }
// 
//     @Override protected void clearTest(Cache waterfallCache) {
//         waterfallCache.clear().subscribe(
//                 success -> showSuccessMessage("Clear", success),
//                 throwable -> showErrorMessage("Clear", throwable));
//     }
// 
//     public static Intent getIntent(Context context) {
//         return new Intent(context, RxActivity.class);
//     }
// }


import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.View.OnClickListener;
import com.github.simonpercic.waterfallcachesample.test.AsyncActivity;
import com.github.simonpercic.waterfallcachesample.test.RxActivity;
package com.github.simonpercic.waterfallcachesample;



/**
 * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a>
 */
public class IntroActivity extends AppCompatActivity implements OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_intro);

        findViewById(R.id.btn_rx_test).setOnClickListener(this);
        findViewById(R.id.btn_async_test).setOnClickListener(this);
    }

    @Override public void onClick(View v) {
        int id = v.getId();

        switch (id) {
            case R.id.btn_rx_test:
// Path: waterfallcache-sample/src/main/java/com/github/simonpercic/waterfallcachesample/test/AsyncActivity.java
// public class AsyncActivity extends BaseTestActivity {
// 
//     @Override protected void getTest(Cache waterfallCache, String key) {
//         waterfallCache.getAsync(key, SimpleObject.class, new WaterfallGetCallback<SimpleObject>() {
//             @Override public void onSuccess(SimpleObject object) {
//                 showValue(object);
//             }
// 
//             @Override public void onFailure(Throwable throwable) {
//                 showErrorMessage("Get", throwable);
//             }
//         });
//     }
// 
//     @Override protected void putTest(Cache waterfallCache, String value, String key) {
//         waterfallCache.putAsync(key, new SimpleObject(value), new WaterfallCallback() {
//             @Override public void onSuccess() {
//                 showSuccessMessage("Put", true);
//             }
// 
//             @Override public void onFailure(Throwable throwable) {
//                 showErrorMessage("Put", throwable);
//             }
//         });
//     }
// 
//     @Override protected void removeTest(Cache waterfallCache, String key) {
//         waterfallCache.removeAsync(key, new WaterfallCallback() {
//             @Override public void onSuccess() {
//                 showSuccessMessage("Remove", true);
//             }
// 
//             @Override public void onFailure(Throwable throwable) {
//                 showErrorMessage("Remove", throwable);
//             }
//         });
//     }
// 
//     @Override protected void containsTest(Cache waterfallCache, String key) {
//         waterfallCache.containsAsync(key, new WaterfallGetCallback<Boolean>() {
//             @Override public void onSuccess(Boolean contains) {
//                 showMessage(String.format("Contains: %s", contains));
//             }
// 
//             @Override public void onFailure(Throwable throwable) {
//                 showErrorMessage("Contains", throwable);
//             }
//         });
//     }
// 
//     @Override protected void clearTest(Cache waterfallCache) {
//         waterfallCache.clearAsync(new WaterfallCallback() {
//             @Override public void onSuccess() {
//                 showSuccessMessage("Clear", true);
//             }
// 
//             @Override public void onFailure(Throwable throwable) {
//                 showErrorMessage("Clear", throwable);
//             }
//         });
//     }
// 
//     public static Intent getIntent(Context context) {
//         return new Intent(context, AsyncActivity.class);
//     }
// }
// 
// Path: waterfallcache-sample/src/main/java/com/github/simonpercic/waterfallcachesample/test/RxActivity.java
// public class RxActivity extends BaseTestActivity {
// 
//     @Override
//     protected void getTest(Cache waterfallCache, String key) {
//         Observable<SimpleObject> test = waterfallCache.get(key, SimpleObject.class);
//         test.subscribe((simpleObject) -> {
//             showValue(simpleObject);
//         }, throwable -> showErrorMessage("Get", throwable));
//     }
// 
//     @Override protected void putTest(Cache waterfallCache, String value, String key) {
//         waterfallCache.put(key, new SimpleObject(value)).subscribe(
//                 success -> showSuccessMessage("Put", success),
//                 throwable -> showErrorMessage("Put", throwable));
//     }
// 
//     @Override protected void removeTest(Cache waterfallCache, String key) {
//         waterfallCache.remove(key).subscribe(
//                 success -> showSuccessMessage("Remove", success),
//                 throwable -> showErrorMessage("Remove", throwable));
//     }
// 
//     @Override protected void containsTest(Cache waterfallCache, String key) {
//         waterfallCache.contains(key).subscribe(
//                 contains -> showMessage(String.format("Contains: %s", contains)),
//                 throwable -> showErrorMessage("Contains", throwable));
//     }
// 
//     @Override protected void clearTest(Cache waterfallCache) {
//         waterfallCache.clear().subscribe(
//                 success -> showSuccessMessage("Clear", success),
//                 throwable -> showErrorMessage("Clear", throwable));
//     }
// 
//     public static Intent getIntent(Context context) {
//         return new Intent(context, RxActivity.class);
//     }
// }


// Path: waterfallcache-sample/src/main/java/com/github/simonpercic/waterfallcachesample/IntroActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.View.OnClickListener;
import com.github.simonpercic.waterfallcachesample.test.AsyncActivity;
import com.github.simonpercic.waterfallcachesample.test.RxActivity;

package com.github.simonpercic.waterfallcachesample;



/**
 * @author Simon Percic <a href="https://github.com/simonpercic">https://github.com/simonpercic</a>
 */
public class IntroActivity extends AppCompatActivity implements OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_intro);

        findViewById(R.id.btn_rx_test).setOnClickListener(this);
        findViewById(R.id.btn_async_test).setOnClickListener(this);
    }

    @Override public void onClick(View v) {
        int id = v.getId();

        switch (id) {
            case R.id.btn_rx_test:
                startActivity(RxActivity.getIntent(this));