Merge "Clean up some lint warnings in SupportContentDemos." into oc-mr1-dev
diff --git a/samples/SupportContentDemos/build.gradle b/samples/SupportContentDemos/build.gradle
index 4acd3f2..7e204b1 100644
--- a/samples/SupportContentDemos/build.gradle
+++ b/samples/SupportContentDemos/build.gradle
@@ -33,6 +33,7 @@
lintOptions {
abortOnError true
- check 'NewApi'
+ disable "SetTextI18n", "AppCompatResource", "WrongConstant", "AllowBackup",
+ "GoogleAppIndexingWarning", "AlwaysShowAction"
}
}
diff --git a/samples/SupportContentDemos/src/main/java/com/example/android/support/content/demos/ContentPagerDemoActivity.java b/samples/SupportContentDemos/src/main/java/com/example/android/support/content/demos/ContentPagerDemoActivity.java
index c2b0266..a496dd3 100644
--- a/samples/SupportContentDemos/src/main/java/com/example/android/support/content/demos/ContentPagerDemoActivity.java
+++ b/samples/SupportContentDemos/src/main/java/com/example/android/support/content/demos/ContentPagerDemoActivity.java
@@ -19,6 +19,7 @@
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
+import android.support.annotation.NonNull;
import android.support.content.ContentPager;
import android.support.content.ContentPager.ContentCallback;
import android.support.content.LoaderQueryRunner;
@@ -34,6 +35,8 @@
import android.view.ViewGroup;
import android.widget.TextView;
+import java.util.Locale;
+
/**
* ContentPager demo activity.
*/
@@ -160,8 +163,9 @@
}
void loadPage(int page) {
- assert page >= 0;
- assert page <= (UnpagedDemoDataProvider.TOTAL_SIZE / PAGE_SIZE) - 1;
+ if (page < 0 || page >= (UnpagedDemoDataProvider.TOTAL_SIZE / PAGE_SIZE)) {
+ throw new IndexOutOfBoundsException();
+ }
mCurrentPage = page;
int offset = mCurrentPage * mPageSize;
@@ -180,7 +184,7 @@
return;
}
- holder.view.setText(String.format(
+ holder.view.setText(String.format(Locale.US,
"%d.%d (%d): %s",
mCurrentPage,
mCursor.getInt(0),
@@ -194,7 +198,7 @@
}
@Override
- public void onCursorReady(Query query, Cursor cursor) {
+ public void onCursorReady(@NonNull Query query, Cursor cursor) {
if (cursor == null) {
msg("Content query returned a null cursor: " + query.getUri());
}