XinyueZ has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/326285 )
Change subject: Fixed null-ptr for some codes ...................................................................... Fixed null-ptr for some codes Change-Id: I2264fb671ffdf9a0e74b36a917aed17a34111654 --- M app/src/main/java/org/wikipedia/page/gallery/GalleryItemFragment.java M app/src/main/java/org/wikipedia/util/StringUtil.java M build.gradle 3 files changed, 5 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/85/326285/1 diff --git a/app/src/main/java/org/wikipedia/page/gallery/GalleryItemFragment.java b/app/src/main/java/org/wikipedia/page/gallery/GalleryItemFragment.java index 2b82630..937ca01 100644 --- a/app/src/main/java/org/wikipedia/page/gallery/GalleryItemFragment.java +++ b/app/src/main/java/org/wikipedia/page/gallery/GalleryItemFragment.java @@ -8,6 +8,7 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.text.TextUtils; import android.view.GestureDetector; @@ -377,10 +378,10 @@ return; } updateProgressBar(false, true, 0); - if (shouldHaveWhiteBackground(galleryItem.getMimeType())) { + if (galleryItem != null && shouldHaveWhiteBackground(galleryItem.getMimeType())) { imageView.setBackgroundColor(Color.WHITE); } - parentActivity.supportInvalidateOptionsMenu(); + ActivityCompat.invalidateOptionsMenu(parentActivity); } @Override diff --git a/app/src/main/java/org/wikipedia/util/StringUtil.java b/app/src/main/java/org/wikipedia/util/StringUtil.java index 8a3f1f5..64ab79c 100644 --- a/app/src/main/java/org/wikipedia/util/StringUtil.java +++ b/app/src/main/java/org/wikipedia/util/StringUtil.java @@ -125,7 +125,7 @@ * @return The trimmed CharSequence. */ public static CharSequence trim(CharSequence str) { - if (str == null || str.length() == 0) { + if (TextUtils.isEmpty(str)) { return ""; } int len = str.length(); diff --git a/build.gradle b/build.gradle index 36762c1..204e5b9 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:2.1.3' + classpath 'com.android.tools.build:gradle:2.2.0' classpath 'com.facebook.testing.screenshot:plugin:0.4.2' classpath 'com.github.JakeWharton:sdk-manager-plugin:1d07987' classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7.1' -- To view, visit https://gerrit.wikimedia.org/r/326285 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2264fb671ffdf9a0e74b36a917aed17a34111654 Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: XinyueZ <xinyue.z...@immonet.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits