Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
- Upgrading to API 27 (and other latest libs)
Browse files Browse the repository at this point in the history
- Increasing version code to 1.1.1
- Increasing minimum supported API to 14
  • Loading branch information
milosmns committed May 14, 2018
1 parent 03ca3c1 commit a5fd351
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 114 deletions.
24 changes: 13 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1' // JaCoCo Android tests
}
}

plugins {
id "com.github.dcendents.android-maven" version "1.5" // used for uploading to mavenCentral
id "com.jfrog.bintray" version "1.7.3" // used for uploading to jCenter
id "me.tatarka.retrolambda" version "3.6.0" // allowing Lambdas on Java 7 and older
id "com.jfrog.bintray" version "1.8.0" // used for uploading to jCenter
// id "me.tatarka.retrolambda" version "3.6.0" // allowing Lambdas on Java 7 and older
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

ext {
// If changed, commit and merge to 'release' branch to auto-deploy. Only tagged commits on release branch will be deployed
VERSION_CODE = 110
VERSION_NAME = "1.1"
VERSION_CODE = 111
VERSION_NAME = "1.1.1"

// don't forget to update CI config in: '.travis.yml'
BUILD_TOOLS = "25.0.2"
MINIMUM_SDK = 9
COMPILE_SDK = 25
TARGET_SDK = 25
BUILD_TOOLS = "27.0.3"
MINIMUM_SDK = 14
COMPILE_SDK = 27
TARGET_SDK = 27

// app/library module dependency versions
APPCOMPAT = "25.3.1"
APPCOMPAT = "27.1.1"
ESPRESSO = "2.2.2"
JUNIT = "4.12"
ROBOLECTRIC = "3.3.2"
ROBOLECTRIC = "3.8"
}
22 changes: 11 additions & 11 deletions demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
// apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'checkstyle'
apply plugin: 'jacoco-android'

Expand Down Expand Up @@ -69,7 +69,7 @@ android {

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_8
}

productFlavors {}
Expand All @@ -82,18 +82,18 @@ jacocoAndroidUnitTestReport {
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:$APPCOMPAT"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:$APPCOMPAT"

// compile "me.angrybyte.sillyandroid:sillyandroid:$VERSION_NAME" // global
compile project(':sillyandroid') // local all
// implementation "me.angrybyte.sillyandroid:sillyandroid:$VERSION_NAME" // global
implementation project(':sillyandroid') // local all

androidTestCompile("com.android.support.test.espresso:espresso-core:$ESPRESSO", {
androidTestImplementation("com.android.support.test.espresso:espresso-core:$ESPRESSO", {
exclude group: 'com.android.support', module: 'support-annotations'
})

testCompile "junit:junit:$JUNIT"
testCompile "org.robolectric:robolectric:$ROBOLECTRIC"
testCompile "com.android.support:appcompat-v7:$APPCOMPAT"
testCompile "org.robolectric:shadows-support-v4:$ROBOLECTRIC"
testImplementation "junit:junit:$JUNIT"
testImplementation "org.robolectric:robolectric:$ROBOLECTRIC"
testImplementation "com.android.support:appcompat-v7:$APPCOMPAT"
testImplementation "org.robolectric:shadows-supportv4:$ROBOLECTRIC"
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ protected void onCreate(@Nullable final Bundle savedInstanceState) {
final int idleContentColor = Coloring.contrastColor(idleBackgroundColor); // text and icon color when not pressed
final int pressedBackgroundColor = 0xFFFFCC00; // button background highlight color when pressed
final Drawable originalDrawable = ContextCompat.getDrawable(this, android.R.drawable.star_big_on); // load a random icon from android
final StateListDrawable statefulDrawable = Coloring.createContrastStateDrawable(this, idleContentColor, pressedBackgroundColor, true, originalDrawable);
@SuppressWarnings("ConstantConditions") final StateListDrawable statefulDrawable = Coloring.createContrastStateDrawable(this, idleContentColor,
pressedBackgroundColor, true, originalDrawable);
final ColorStateList statefulTextColors = Coloring.createContrastTextColors(idleContentColor, pressedBackgroundColor);
final Rect originalBounds = mPaddingButton.getBackground().copyBounds(); // copy original drawable's bounds so that the ripple is bordered
final int cornerRoundness = SillyAndroid.convertDipsToPixels(this, 4);
Expand Down
3 changes: 2 additions & 1 deletion demo/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
android:id="@+id/edit_text_keyboard"
android:layout_width="match_parent"
android:layout_height="50dp"
android:hint="@string/hint_keyboard_none" />
android:hint="@string/hint_keyboard_none"
android:inputType="text" />

<Button
android:id="@+id/button_hide_keyboard"
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Apr 02 17:42:25 CEST 2017
#Mon May 14 16:38:06 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
10 changes: 5 additions & 5 deletions sillyandroid/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
// apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'checkstyle'
apply plugin: 'jacoco-android'

Expand Down Expand Up @@ -76,7 +76,7 @@ android {

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_8
}
}

Expand All @@ -87,9 +87,9 @@ jacocoAndroidUnitTestReport {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
provided "com.android.support:appcompat-v7:$APPCOMPAT"
testCompile "com.android.support:appcompat-v7:$APPCOMPAT"
api fileTree(dir: 'libs', include: ['*.jar'])
compileOnly "com.android.support:appcompat-v7:$APPCOMPAT"
testImplementation "com.android.support:appcompat-v7:$APPCOMPAT"
}

// Maven push plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ public static boolean checkDozeModeWhiteList(@NonNull final Context context) {
return true;
} else {
final PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
return powerManager.isIgnoringBatteryOptimizations(context.getPackageName());
return powerManager != null && powerManager.isIgnoringBatteryOptimizations(context.getPackageName());
}
}

Expand Down Expand Up @@ -757,11 +757,7 @@ public static boolean hideKeyboard(@NonNull final Activity context) {
try {
final InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
final View layout = SillyAndroid.getContentView(context);
if (layout == null) {
return false;
}
imm.hideSoftInputFromWindow(layout.getApplicationWindowToken(), 0);
return true;
return layout != null && imm != null && imm.hideSoftInputFromWindow(layout.getApplicationWindowToken(), 0);
} catch (Exception e) {
Log.e(TAG, "Hiding keyboard failed", e);
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ protected final void toastShort(@StringRes final int stringId) {
/**
* Invokes {@link SillyAndroid#toastShort(Context, String)}.
*/
@SuppressWarnings("SameParameterValue")
protected final void toastShort(@NonNull final String string) {
SillyAndroid.toastShort(this, string);
}
Expand Down Expand Up @@ -245,6 +246,7 @@ protected final void toastLong(@NonNull final String string) {
* @return {@code True} if permission check {@link ContextCompat#checkSelfPermission(Context, String)} returns {@link PackageManager#PERMISSION_GRANTED}
* for the given permission, {@code false} if it is {@code null} or not granted
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
protected final boolean hasPermission(@Nullable String permission) {
return permission != null && ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED;
}
Expand All @@ -256,6 +258,7 @@ protected final boolean hasPermission(@Nullable String permission) {
* @param permissions Which permissions to ask for. They will be grouped and sent back to you in {@link #onPermissionsResult(int, Set, Set)}
* @return {@code True} if the permission request was made, {@code false} otherwise
*/
@SuppressWarnings("SameParameterValue")
protected final boolean requestPermissions(@IntRange(from = 0, to = 127) final int code, @Nullable final String... permissions) {
if (permissions != null && permissions.length > 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(permissions, code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ protected void onBlockingDestroy() {
*
* @return {@code True} if "stop" was invoked by now, {@code false} if not
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
protected final boolean isStopInvoked() {
return mIsStopInvoked;
}
Expand All @@ -57,6 +58,7 @@ protected final boolean isStopInvoked() {
*
* @return {@code True} if "destroy" was invoked by now, {@code false} if not
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
protected final boolean isDestroyInvoked() {
return mIsDestroyInvoked;
}
Expand Down
Loading

0 comments on commit a5fd351

Please sign in to comment.