mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
getColumnIndex(): added @SuppressLint("Range") as -1 is expected result for column name doesn't exist
This commit is contained in:
parent
d08842d60d
commit
0aa69fd6da
4 changed files with 8 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package fr.free.nrw.commons.bookmarks.pictures;
|
package fr.free.nrw.commons.bookmarks.pictures;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentProviderClient;
|
import android.content.ContentProviderClient;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
|
@ -150,6 +151,7 @@ public class BookmarkPicturesDao {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("Range")
|
||||||
@NonNull
|
@NonNull
|
||||||
Bookmark fromCursor(Cursor cursor) {
|
Bookmark fromCursor(Cursor cursor) {
|
||||||
String fileName = cursor.getString(cursor.getColumnIndex(Table.COLUMN_MEDIA_NAME));
|
String fileName = cursor.getString(cursor.getColumnIndex(Table.COLUMN_MEDIA_NAME));
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package fr.free.nrw.commons.category;
|
package fr.free.nrw.commons.category;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentProviderClient;
|
import android.content.ContentProviderClient;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
|
@ -111,6 +112,7 @@ public class CategoryDao {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@SuppressLint("Range")
|
||||||
Category fromCursor(Cursor cursor) {
|
Category fromCursor(Cursor cursor) {
|
||||||
// Hardcoding column positions!
|
// Hardcoding column positions!
|
||||||
return new Category(
|
return new Category(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package fr.free.nrw.commons.explore.recentsearches;
|
package fr.free.nrw.commons.explore.recentsearches;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentProviderClient;
|
import android.content.ContentProviderClient;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
|
@ -178,6 +179,7 @@ public class RecentSearchesDao {
|
||||||
* @return RecentSearch object
|
* @return RecentSearch object
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@SuppressLint("Range")
|
||||||
RecentSearch fromCursor(Cursor cursor) {
|
RecentSearch fromCursor(Cursor cursor) {
|
||||||
// Hardcoding column positions!
|
// Hardcoding column positions!
|
||||||
return new RecentSearch(
|
return new RecentSearch(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package fr.free.nrw.commons.recentlanguages;
|
package fr.free.nrw.commons.recentlanguages;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ContentProviderClient;
|
import android.content.ContentProviderClient;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
|
@ -117,6 +118,7 @@ public class RecentLanguagesDao {
|
||||||
* @return Language object
|
* @return Language object
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@SuppressLint("Range")
|
||||||
Language fromCursor(final Cursor cursor) {
|
Language fromCursor(final Cursor cursor) {
|
||||||
// Hardcoding column positions!
|
// Hardcoding column positions!
|
||||||
final String languageName = cursor.getString(cursor.getColumnIndex(Table.COLUMN_NAME));
|
final String languageName = cursor.getString(cursor.getColumnIndex(Table.COLUMN_NAME));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue