-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use latest and greatest tools and libraries #124
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,55 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
maven { url 'https://plugins.gradle.org/m2/' } | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:2.3.0' | ||
classpath 'me.tatarka:gradle-retrolambda:3.3.0' | ||
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.10' | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
} | ||
ext { | ||
minSdkVersion = 9 | ||
targetSdkVersion = 28 | ||
compileSdkVersion = 28 | ||
buildToolsVersion = '28.0.3' | ||
javaVersion = JavaVersion.VERSION_1_7 | ||
java8Version = JavaVersion.VERSION_1_8 | ||
butterknifeVersion = '10.1.0' | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
options.compilerArgs += ['-Xlint:all', '-Xlint:-processing', '-Werror'] | ||
} | ||
repositories { | ||
mavenCentral() | ||
google() | ||
jcenter() | ||
} | ||
|
||
apply plugin: 'net.ltgt.errorprone' | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.3.2' | ||
classpath "com.jakewharton:butterknife-gradle-plugin:${butterknifeVersion}" | ||
} | ||
} | ||
|
||
group = GROUP | ||
version = VERSION_NAME | ||
plugins { | ||
id("net.ltgt.errorprone") version "0.7.1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL you can do this in Gradle 5.2.1 |
||
} | ||
|
||
ext { | ||
minSdkVersion = 9 | ||
targetSdkVersion = 25 | ||
compileSdkVersion = 25 | ||
buildToolsVersion = '25.0.2' | ||
javaVersion = JavaVersion.VERSION_1_7 | ||
java8Version = JavaVersion.VERSION_1_8 | ||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
google() | ||
jcenter() | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
options.compilerArgs += ['-Xlint:all', '-Xlint:-processing', '-Werror'] | ||
} | ||
|
||
group = GROUP | ||
version = VERSION_NAME | ||
} | ||
|
||
ext.deps = [ | ||
annotations: 'com.android.support:support-annotations:25.1.1', | ||
rxjava: 'io.reactivex.rxjava2:rxjava:2.0.3', | ||
rxandroid: 'io.reactivex.rxjava2:rxandroid:2.0.1', | ||
rxbinding: 'com.jakewharton.rxbinding:rxbinding:0.3.0', | ||
rxjava2interop: 'com.github.akarnokd:rxjava2-interop:0.4.0', | ||
butterknife: 'com.jakewharton:butterknife:8.4.0', | ||
butterknifeCompiler: 'com.jakewharton:butterknife-compiler:8.4.0', | ||
junit: 'junit:junit:4.12', | ||
assertj: 'org.assertj:assertj-core:1.7.0', | ||
robolectric: 'org.robolectric:robolectric:3.0', | ||
annotations : 'androidx.annotation:annotation:1.0.2', | ||
rxjava2 : 'io.reactivex.rxjava2:rxjava:2.2.7', | ||
rxandroid : 'io.reactivex.rxjava2:rxandroid:2.1.1', | ||
rxbinding : 'com.jakewharton.rxbinding:rxbinding:1.0.1', | ||
rxjava2interop : 'com.github.akarnokd:rxjava2-interop:0.13.5', | ||
butterknife : "com.jakewharton:butterknife:${ext.butterknifeVersion}", | ||
butterknifeCompiler: "com.jakewharton:butterknife-compiler:${ext.butterknifeVersion}", | ||
junit : 'junit:junit:4.12', | ||
assertj : 'org.assertj:assertj-core:3.12.2', | ||
robolectric : 'org.robolectric:robolectric:4.2.1', | ||
testcore : 'androidx.test:core:1.0.0' | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#Tue Mar 14 01:37:42 PDT 2017 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👋 |
||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
<manifest package="com.f2prateek.rx.preferences2"> | ||
<application/> | ||
</manifest> | ||
<manifest package="com.f2prateek.rx.preferences2"/> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,18 @@ | |
|
||
import android.content.SharedPreferences; | ||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; | ||
import android.support.annotation.CheckResult; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.support.annotation.RequiresApi; | ||
|
||
import androidx.annotation.CheckResult; | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.RequiresApi; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
import io.reactivex.Observable; | ||
import io.reactivex.ObservableEmitter; | ||
import io.reactivex.ObservableOnSubscribe; | ||
import io.reactivex.functions.Cancellable; | ||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
import static android.os.Build.VERSION_CODES.HONEYCOMB; | ||
import static com.f2prateek.rx.preferences2.Preconditions.checkNotNull; | ||
|
@@ -37,7 +39,7 @@ public static RxSharedPreferences create(@NonNull SharedPreferences preferences) | |
private RxSharedPreferences(final SharedPreferences preferences) { | ||
this.preferences = preferences; | ||
this.keyChanges = Observable.create(new ObservableOnSubscribe<String>() { | ||
@Override public void subscribe(final ObservableEmitter<String> emitter) throws Exception { | ||
@Override public void subscribe(final ObservableEmitter<String> emitter) { | ||
final OnSharedPreferenceChangeListener listener = new OnSharedPreferenceChangeListener() { | ||
@Override | ||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) { | ||
|
@@ -46,7 +48,7 @@ public void onSharedPreferenceChanged(SharedPreferences preferences, String key) | |
}; | ||
|
||
emitter.setCancellable(new Cancellable() { | ||
@Override public void cancel() throws Exception { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never actually throws. |
||
@Override public void cancel() { | ||
preferences.unregisterOnSharedPreferenceChangeListener(listener); | ||
} | ||
}); | ||
|
@@ -97,7 +99,6 @@ public Preference<Float> getFloat(@NonNull String key, @NonNull Float defaultVal | |
/** Create an integer preference for {@code key}. Default is {@code 0}. */ | ||
@CheckResult @NonNull | ||
public Preference<Integer> getInteger(@NonNull String key) { | ||
//noinspection UnnecessaryBoxing | ||
return getInteger(key, DEFAULT_INTEGER); | ||
} | ||
|
||
|
@@ -112,7 +113,6 @@ public Preference<Integer> getInteger(@NonNull String key, @NonNull Integer defa | |
/** Create a long preference for {@code key}. Default is {@code 0}. */ | ||
@CheckResult @NonNull | ||
public Preference<Long> getLong(@NonNull String key) { | ||
//noinspection UnnecessaryBoxing | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These inspections are redundant. |
||
return getLong(key, DEFAULT_LONG); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retrolambda no longer needed with latest butter knife.