Instead of the verbose setOnClickListener:
RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));Observable
.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)| /** | |
| * Check whether Google Play Services are available. | |
| * | |
| * If not, then display dialog allowing user to update Google Play Services | |
| * | |
| * @return true if available, or false if not | |
| */ | |
| private boolean checkGooglePlayServicesAvailable() | |
| { | |
| final int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()); |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE module PUBLIC | |
| "-//Puppy Crawl//DTD Check Configuration 1.3//EN" | |
| "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> | |
| <!-- This is a checkstyle configuration file. For descriptions of | |
| what the following rules do, please see the checkstyle configuration | |
| page at http://checkstyle.sourceforge.net/config.html --> | |
| <module name="Checker"> |
| import android.Manifest; | |
| import android.content.Context; | |
| import android.content.pm.PackageManager; | |
| import android.location.Location; | |
| import android.os.Bundle; | |
| import android.support.annotation.NonNull; | |
| import android.support.annotation.Nullable; | |
| import android.support.v4.content.ContextCompat; | |
| import com.google.android.gms.common.ConnectionResult; |
| package nl.remcomokveld.firebaseloaders; | |
| import android.content.Context; | |
| import android.support.annotation.NonNull; | |
| import android.support.v4.content.Loader; | |
| import com.google.firebase.database.DataSnapshot; | |
| import com.google.firebase.database.DatabaseError; | |
| import com.google.firebase.database.DatabaseReference; | |
| import com.google.firebase.database.ValueEventListener; |
| import android.content.Context; | |
| import android.content.pm.PackageInfo; | |
| import android.content.pm.PackageManager; | |
| import android.content.pm.PackageManager.NameNotFoundException; | |
| import android.content.pm.Signature; | |
| public class TamperCheck { | |
| //we store the hash of the signture for a little more protection | |
| private static final String APP_SIGNATURE = "1038C0E34658923C4192E61B16846"; |
| apply plugin: 'com.android.application' | |
| android { | |
| compileSdkVersion 21 | |
| buildToolsVersion "21.1.2" | |
| defaultConfig{ | |
| minSdkVersion 14 | |
| targetSdkVersion 21 | |
| versionCode 101 |
| // GSON can parse the data. | |
| // | |
| // Deserialization: | |
| // Note there is a bug in GSON 2.3.1 that can cause it to StackOverflow when working with RealmObjects. | |
| // To work around this, use the ExclusionStrategy below or downgrade to 1.7.1 | |
| // See more here: https://code.google.com/p/google-gson/issues/detail?id=440 | |
| // | |
| // Serialization: | |
| // <Type>RealmProxy objects are created by the Realm annotation processor. They are used to control | |
| // access to the actual data instead of storing them in fields and it is therefore them we need to register a |
| import android.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
| public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
| private int previousTotal = 0; // The total number of items in the dataset after the last load | |
| private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
| private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
| int firstVisibleItem, visibleItemCount, totalItemCount; |
| import android.content.Intent; | |
| import android.os.Bundle; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.util.Log; | |
| import com.google.android.gms.auth.api.Auth; | |
| import com.google.android.gms.auth.api.signin.GoogleSignInOptions; | |
| import com.google.android.gms.auth.api.signin.GoogleSignInResult; | |
| import com.google.android.gms.common.ConnectionResult; | |
| import com.google.android.gms.common.api.GoogleApiClient; |