Skip to content

Commit 610919e

Browse files
baijun6nicolas-raoul
authored andcommitted
Partial fixes for errors and warnings reported by ./gradlew lint (#5885)
* BaseMarker.kt: removed unneeded cast * TransformImageImpl.kt: removed unreachable code * ZoomableActivity.kt: removed Unnecessary safe call on a non-null receiver of type ZoomableDraweeView * ZoomableActivity.kt: removed Unnecessary safe call on a non-null receiver of type ZoomableDraweeView * DescriptionEditActivity.kt: removed unnecessary non-null assertion (!!) on a non-null receiver of type DescriptionEditHelper * Media.kt: Property would not be serialized into a 'Parcel'. Added '@IgnoredOnParcel' annotation to remove the warning * ZoomableActivity.kt: removed Unnecessary non-null assertion (!!) on a non-null receiver of type ZoomableDraweeView * CategoryClient.kt: removed condition 'page.categoryInfo() == null' as it's always 'false' * DescriptionEditActivity.kt: removed unnecessary safe call on a non-null receiver of type SessionManager * DescriptionEditActivity.kt: removed unnecessary safe call on a non-null receiver of type DescriptionEditHelper * WikidataFeedback.kt: removed unneeded cast * FailedUploadsFragment.kt: removed unneeded non-null assertion (!!) * PendingUploadsFragment.kt: removed unneeded non-null assertion (!!) * AchievementsFragment.java: Changed toUpperCase to toUpperCase(Locale.getDefault()) * ExploreFragment.java: Changed toUpperCase to toUpperCase(Locale.getDefault()) * FileUtils.java: Changed toUpperCase to toUpperCase(Locale.getDefault()) * AchievementsFragment.java: Changed toUpperCase to toUpperCase(Locale.ROOT) * ExploreFragment.java: Changed toUpperCase to toUpperCase(Locale.ROOT) * LocationPickerActivity.java: Changed toUpperCase to toUpperCase(Locale.ROOT) * MediaDetailFragment.java: Changed toUpperCase to toUpperCase(Locale.ROOT) * NearbyFilterSearchRecyclerViewAdapter.java: Changed toUpperCase to toUpperCase(Locale.ROOT) * ProfileActivity.java: Changed toUpperCase to toUpperCase(Locale.ROOT) * RecentSearchesFragment.java: Changed toUpperCase to toUpperCase(Locale.ROOT) * ReviewActivity.java: Changed toUpperCase to toUpperCase(Locale.ROOT) * SearchActivity.java: Changed toUpperCase to toUpperCase(Locale.ROOT) * UploadMediaPresenter.java: Changed toUpperCase to toLowerCase(Locale.ROOT) * CategoriesMediaFragment.kt: Changed arguments!! to requireArguments() * ChildDepictionsFragment.kt: Changed arguments!! to requireArguments() * DepictedImagesFragment.kt: Changed arguments!! to requireArguments() * DepictsFragment: Changed Objects.requireNonNull(getView()) to requireViews(), Objects.requireNonNull(getActivity())) to requireActivity() * ParentCategoriesFragment.kt: Changed arguments!! to requireArguments() * ParentCategoriesFragment.kt: Changed arguments!! to requireArguments() * SubCategoriesFragment.kt: Changed arguments!! to requireArguments() * SubCategoriesFragment.kt: Changed Objects.requireNonNull(getView()) to requireViews(), Objects.requireNonNull(getActivity()) to requireActivity() * UploadMediaDetailFragment.java: Changed arguments!! to requireArguments() * WikipediaInstructionsDialogFragment.kt: Changed arguments!! to requireArguments() * BookmarkItemsDao.java: Added @SuppressLint("Range"), as -1 is expected behavior not index doesn't exist for getColumnIndex() * BookmarkLocationsDao.java: Added @SuppressLint("Range"), as -1 is expected behavior not index doesn't exist for getColumnIndex() * AndroidManifest.xml: Removed redundant label android:label="@string/app_name" * bs\strings.xml: Added missing few quantity * hr\strings.xml: Added missing few quantity * hr\strings.xml: Added missing zero, two, few, many quantities for lines 23 - 63 * Revert "hr\strings.xml: Added missing zero, two, few, many quantities for lines 23 - 63" This reverts commit 4723246. * cy\strings.xml: Added missing zero, two, few, many quantities for lines 23 - 63 * sr\strings.xml: Added missing few quantities for lines 35 to 70 * ro\strings.xml: Added missing few quantity and removed not needed zero for <plurals name="contributions_subtitle" fuzzy="true"> * cs\strings.xml: Added missing few many missing quantities for lines 33 - 74 * lt\strings.xml: Added missing few, many missing quantities for lines 34 - 58 * lt\strings.xml: Replaced . . . with ... * ca\strings.xml: Added missing many quantities for lines 21 - 51, replaced . . . with ... * ser\strings.xml: Added missing few quantities, replaced . . . with ... * br\strings.xml: Added missing two, few, many quantities * pt\strings.xml: Added missing many quantity, changed . . . to ... and ignored typo as it is correct for European Portuguese * it\strings.xml: changed . . . to ... * pt\strings.xml: fixed many quantity * ca\strings.xml: fixed many quantity * sr\strings.xml: fixed many quantity * cy\strings.xml: corrected quantities for "share_license_summary * fr\strings.xml: changed . . . to ... and add many quantities using the other quantity * fr\strings.xml: changed . . . to ... and add many quantities using the other quantity. Fixed some typos, added ignore for correct spellings but has warning * getColumnIndex(): added @SuppressLint("Range") as -1 is expected result for column name doesn't exist * values-b+sr+Latn\strings.xml: changed . . . to ... * Revert "values-b+sr+Latn\strings.xml: changed . . . to ..." This reverts commit 95b909c. * values-b+roa+tara\strings.xml: changed . . . to ... * Revert "values-b+roa+tara\strings.xml: changed . . . to ..." This reverts commit b5db1a3. * values-b+roa+tara\strings.xml: changed . . . to ... * values-b+sr+Latn\strings.xml: changed . . . to ..., add few based on other quantity. Ignored one ImpliedQuantity warning as it is correct. * it\strings.xml: changed . . . to ..., add many based on other quantity. * pt-rBR\strings.xml: changed . . . to ..., add many based on other quantity. Fixed typos, ignored warning for "one" quantity as translation didn't use number * si\strings.xml: Ignored ImpliedQuantity warning as it uses 1 not %d. Removed not needed zero quantity * si\strings.xml: Ignored ImpliedQuantity warning as it uses 1 not %d. Removed not needed zero quantity. Fixed wrong %1$d. Changed . . . to ... * mk\strings.xml: changed . . . to ... and ignored ImpliedQuantity as it doesn't use 1 * sl\strings.xml: changed . . . to ... and ignored ImpliedQuantity as it doesn't use %1$d * ru\strings.xml: changed . . . to ... and ignored ImpliedQuantity as it doesn't use %1$d * uk\strings.xml: changed . . . to ... and ignored ImpliedQuantity as it doesn't use %1$d * is\strings.xml: changed . . . to ... and ignored ImpliedQuantity as it doesn't use %1$d * strings.xml: changed . . . to ... * af\strings.xml: removed not needed zero quantity * de\strings.xml: fixed duplicate word typo * diq\strings.xml: changed - to dash (-) * hi\strings.xml: removed not needed zero * in\strings.xml: removed not needed one quantity * iw\strings.xml: removed not needed many quantity * ja\strings.xml: removed not needed one quantity * ko\strings.xml: removed not needed one quantity * ky\strings.xml: removed not needed one quantity * mr\strings.xml: removed not needed zero quantity * my\strings.xml: removed not needed one quantity * su\strings.xml: removed not needed one quantity * th\strings.xml: removed not needed one and zero quantity * zh\strings.xml: removed not needed one quantity * activity_description_edit.xml: changed android:tint to app:tint, changed layout_alignParentRight to layout_alignParentEnd * bottom_sheet_details_explore.xml: changed android:tint to app:tint, added focusable, changed to margin layout * bottom_sheet_item_layout.xml: changed android:tint to app:tint, added focusable * bottom_sheet_details_explore.xml: changed android:tint to app:tint, added focusable, changed margin layout and removed not needed and invalid params * item_place.xml.xml: changed android:tint to app:tint, added focusable, changed margin layout and removed not needed and invalid params * layout_campagin.xml: changed android:tint to app:tint, added focusable, changed margin layout and removed not needed and invalid params * layout_contribution.xml.xml: changed android:tint to app:tint * nearby_card_view.xml: changed android:tint to app:tint, added focusable, changed margin layout and removed not needed and invalid params * nearby_row_button.xml: changed android:tint to app:tint, added focusable, changed margin layout and removed not needed and invalid params * toolbar_location_picker.xml: changed android:tint to app:tint --------- Co-authored-by: Nicolas Raoul <[email protected]>
1 parent d21c63f commit 610919e

File tree

137 files changed

+617
-572
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+617
-572
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
android:exported="true"
100100
android:hardwareAccelerated="false"
101101
android:icon="@mipmap/ic_launcher"
102-
android:label="@string/app_name"
103102
android:windowSoftInputMode="adjustResize">
104103
<intent-filter android:label="@string/intent_share_upload_label">
105104
<action android:name="android.intent.action.SEND" />
@@ -122,7 +121,7 @@
122121
android:name=".contributions.MainActivity"
123122
android:configChanges="screenSize|keyboard|orientation"
124123
android:icon="@mipmap/ic_launcher"
125-
android:label="@string/app_name" />
124+
/>
126125
<activity
127126
android:name=".settings.SettingsActivity"
128127
android:label="@string/title_activity_settings" />

app/src/main/java/fr/free/nrw/commons/BaseMarker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BaseMarker {
4646
val drawable: Drawable = context.resources.getDrawable(drawableResId)
4747
icon =
4848
if (drawable is BitmapDrawable) {
49-
(drawable as BitmapDrawable).bitmap
49+
drawable.bitmap
5050
} else {
5151
val bitmap =
5252
Bitmap.createBitmap(

app/src/main/java/fr/free/nrw/commons/LocationPicker/LocationPickerActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import io.reactivex.android.schedulers.AndroidSchedulers;
5454
import io.reactivex.schedulers.Schedulers;
5555
import java.util.List;
56+
import java.util.Locale;
5657
import javax.inject.Inject;
5758
import javax.inject.Named;
5859
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
@@ -301,7 +302,8 @@ private void bindViews() {
301302
modifyLocationButton = findViewById(R.id.modify_location);
302303
removeLocationButton = findViewById(R.id.remove_location);
303304
showInMapButton = findViewById(R.id.show_in_map);
304-
showInMapButton.setText(getResources().getString(R.string.show_in_map_app).toUpperCase());
305+
showInMapButton.setText(getResources().getString(R.string.show_in_map_app).toUpperCase(
306+
Locale.ROOT));
305307
shadow = findViewById(R.id.location_picker_image_view_shadow);
306308
}
307309

app/src/main/java/fr/free/nrw/commons/Media.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package fr.free.nrw.commons
33
import android.os.Parcelable
44
import fr.free.nrw.commons.location.LatLng
55
import fr.free.nrw.commons.wikidata.model.page.PageTitle
6+
import kotlinx.parcelize.IgnoredOnParcel
67
import kotlinx.parcelize.Parcelize
78
import java.util.Date
89
import java.util.Locale
@@ -124,6 +125,7 @@ class Media constructor(
124125
* Gets the categories the file falls under.
125126
* @return file categories as an ArrayList of Strings
126127
*/
128+
@IgnoredOnParcel
127129
var addedCategories: List<String>? = null
128130
// TODO added categories should be removed. It is added for a short fix. On category update,
129131
// categories should be re-fetched instead

app/src/main/java/fr/free/nrw/commons/bookmarks/items/BookmarkItemsDao.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fr.free.nrw.commons.bookmarks.items;
22

3+
import android.annotation.SuppressLint;
34
import android.content.ContentProviderClient;
45
import android.content.ContentValues;
56
import android.database.Cursor;
@@ -134,6 +135,7 @@ public boolean findBookmarkItem(final String depictedItemID) {
134135
* @param cursor : Object for storing database data
135136
* @return DepictedItem
136137
*/
138+
@SuppressLint("Range")
137139
DepictedItem fromCursor(final Cursor cursor) {
138140
final String fileName = cursor.getString(cursor.getColumnIndex(Table.COLUMN_NAME));
139141
final String description

app/src/main/java/fr/free/nrw/commons/bookmarks/locations/BookmarkLocationsDao.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fr.free.nrw.commons.bookmarks.locations;
22

3+
import android.annotation.SuppressLint;
34
import android.content.ContentProviderClient;
45
import android.content.ContentValues;
56
import android.database.Cursor;
@@ -146,6 +147,7 @@ public boolean findBookmarkLocation(Place bookmarkLocation) {
146147
return false;
147148
}
148149

150+
@SuppressLint("Range")
149151
@NonNull
150152
Place fromCursor(final Cursor cursor) {
151153
final LatLng location = new LatLng(cursor.getDouble(cursor.getColumnIndex(Table.COLUMN_LAT)),

app/src/main/java/fr/free/nrw/commons/bookmarks/pictures/BookmarkPicturesDao.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fr.free.nrw.commons.bookmarks.pictures;
22

3+
import android.annotation.SuppressLint;
34
import android.content.ContentProviderClient;
45
import android.content.ContentValues;
56
import android.database.Cursor;
@@ -150,6 +151,7 @@ public boolean findBookmark(Bookmark bookmark) {
150151
return false;
151152
}
152153

154+
@SuppressLint("Range")
153155
@NonNull
154156
Bookmark fromCursor(Cursor cursor) {
155157
String fileName = cursor.getString(cursor.getColumnIndex(Table.COLUMN_MEDIA_NAME));

app/src/main/java/fr/free/nrw/commons/category/CategoryClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class CategoryClient
124124
}.map {
125125
it
126126
.filter { page ->
127-
page.categoryInfo() == null || !page.categoryInfo().isHidden
127+
!page.categoryInfo().isHidden
128128
}.map {
129129
CategoryItem(
130130
it.title().replace(CATEGORY_PREFIX, ""),

app/src/main/java/fr/free/nrw/commons/category/CategoryDao.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fr.free.nrw.commons.category;
22

3+
import android.annotation.SuppressLint;
34
import android.content.ContentProviderClient;
45
import android.content.ContentValues;
56
import android.database.Cursor;
@@ -111,6 +112,7 @@ List<CategoryItem> recentCategories(int limit) {
111112
}
112113

113114
@NonNull
115+
@SuppressLint("Range")
114116
Category fromCursor(Cursor cursor) {
115117
// Hardcoding column positions!
116118
return new Category(

app/src/main/java/fr/free/nrw/commons/contributions/WikipediaInstructionsDialogFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class WikipediaInstructionsDialogFragment : DialogFragment() {
2222
) = DialogAddToWikipediaInstructionsBinding
2323
.inflate(inflater, container, false)
2424
.apply {
25-
val contribution: Contribution? = arguments!!.getParcelable(ARG_CONTRIBUTION)
25+
val contribution: Contribution? = requireArguments().getParcelable(ARG_CONTRIBUTION)
2626
tvWikicode.setText(contribution?.media?.wikiCode)
2727
instructionsCancel.setOnClickListener { dismiss() }
2828
instructionsConfirm.setOnClickListener {

app/src/main/java/fr/free/nrw/commons/description/DescriptionEditActivity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class DescriptionEditActivity :
237237
) {
238238
try {
239239
descriptionEditHelper
240-
?.addDescription(
240+
.addDescription(
241241
applicationContext,
242242
media,
243243
updatedWikiText,
@@ -250,7 +250,7 @@ class DescriptionEditActivity :
250250
)
251251
}
252252
} catch (e: InvalidLoginTokenException) {
253-
val username: String? = sessionManager?.userName
253+
val username: String? = sessionManager.userName
254254
val logoutListener =
255255
CommonsApplication.BaseLogoutListener(
256256
this,
@@ -268,7 +268,7 @@ class DescriptionEditActivity :
268268
for (mediaDetail in uploadMediaDetails) {
269269
try {
270270
compositeDisposable.add(
271-
descriptionEditHelper!!
271+
descriptionEditHelper
272272
.addCaption(
273273
applicationContext,
274274
media,

app/src/main/java/fr/free/nrw/commons/edit/TransformImageImpl.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ class TransformImageImpl : TransformImage {
6565
} catch (e: LLJTranException) {
6666
Timber.tag("Error").d(e)
6767
return null
68-
false
6968
}
7069

7170
if (rotated) {

app/src/main/java/fr/free/nrw/commons/explore/ExploreFragment.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import fr.free.nrw.commons.utils.ActivityUtils;
2323
import java.util.ArrayList;
2424
import java.util.List;
25+
import java.util.Locale;
2526
import javax.inject.Inject;
2627
import javax.inject.Named;
2728

@@ -112,13 +113,13 @@ public void setTabs() {
112113
mobileRootFragment = new ExploreListRootFragment(mobileArguments);
113114
mapRootFragment = new ExploreMapRootFragment(mapArguments);
114115
fragmentList.add(featuredRootFragment);
115-
titleList.add(getString(R.string.explore_tab_title_featured).toUpperCase());
116+
titleList.add(getString(R.string.explore_tab_title_featured).toUpperCase(Locale.ROOT));
116117

117118
fragmentList.add(mobileRootFragment);
118-
titleList.add(getString(R.string.explore_tab_title_mobile).toUpperCase());
119+
titleList.add(getString(R.string.explore_tab_title_mobile).toUpperCase(Locale.ROOT));
119120

120121
fragmentList.add(mapRootFragment);
121-
titleList.add(getString(R.string.explore_tab_title_map).toUpperCase());
122+
titleList.add(getString(R.string.explore_tab_title_map).toUpperCase(Locale.ROOT));
122123

123124
((MainActivity)getActivity()).showTabs();
124125
((BaseActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);

app/src/main/java/fr/free/nrw/commons/explore/SearchActivity.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.ArrayList;
2929
import java.util.Date;
3030
import java.util.List;
31+
import java.util.Locale;
3132
import java.util.concurrent.TimeUnit;
3233
import javax.inject.Inject;
3334
import timber.log.Timber;
@@ -95,11 +96,11 @@ public void setTabs() {
9596
searchDepictionsFragment = new SearchDepictionsFragment();
9697
searchCategoryFragment= new SearchCategoryFragment();
9798
fragmentList.add(searchMediaFragment);
98-
titleList.add(getResources().getString(R.string.search_tab_title_media).toUpperCase());
99+
titleList.add(getResources().getString(R.string.search_tab_title_media).toUpperCase(Locale.ROOT));
99100
fragmentList.add(searchCategoryFragment);
100-
titleList.add(getResources().getString(R.string.search_tab_title_categories).toUpperCase());
101+
titleList.add(getResources().getString(R.string.search_tab_title_categories).toUpperCase(Locale.ROOT));
101102
fragmentList.add(searchDepictionsFragment);
102-
titleList.add(getResources().getString(R.string.search_tab_title_depictions).toUpperCase());
103+
titleList.add(getResources().getString(R.string.search_tab_title_depictions).toUpperCase(Locale.ROOT));
103104

104105
viewPagerAdapter.setTabData(fragmentList, titleList);
105106
viewPagerAdapter.notifyDataSetChanged();

app/src/main/java/fr/free/nrw/commons/explore/categories/media/CategoriesMediaFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ class CategoriesMediaFragment : PageableMediaFragment() {
1818
savedInstanceState: Bundle?,
1919
) {
2020
super.onViewCreated(view, savedInstanceState)
21-
onQueryUpdated("$CATEGORY_PREFIX${arguments!!.getString("categoryName")!!}")
21+
onQueryUpdated("$CATEGORY_PREFIX${requireArguments().getString("categoryName")!!}")
2222
}
2323
}

app/src/main/java/fr/free/nrw/commons/explore/categories/parent/ParentCategoriesFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ class ParentCategoriesFragment : PageableCategoryFragment() {
2121
savedInstanceState: Bundle?,
2222
) {
2323
super.onViewCreated(view, savedInstanceState)
24-
onQueryUpdated("$CATEGORY_PREFIX${arguments!!.getString("categoryName")!!}")
24+
onQueryUpdated("$CATEGORY_PREFIX${requireArguments().getString("categoryName")!!}")
2525
}
2626
}

app/src/main/java/fr/free/nrw/commons/explore/categories/sub/SubCategoriesFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ class SubCategoriesFragment : PageableCategoryFragment() {
2020
savedInstanceState: Bundle?,
2121
) {
2222
super.onViewCreated(view, savedInstanceState)
23-
onQueryUpdated("$CATEGORY_PREFIX${arguments!!.getString("categoryName")!!}")
23+
onQueryUpdated("$CATEGORY_PREFIX${requireArguments().getString("categoryName")!!}")
2424
}
2525
}

app/src/main/java/fr/free/nrw/commons/explore/depictions/child/ChildDepictionsFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class ChildDepictionsFragment : PageableDepictionsFragment() {
1313
override val injectedPresenter
1414
get() = presenter
1515

16-
override fun getEmptyText(query: String) = getString(R.string.no_child_classes, arguments!!.getString("wikidataItemName")!!)
16+
override fun getEmptyText(query: String) = getString(R.string.no_child_classes, requireArguments().getString("wikidataItemName")!!)
1717

1818
override fun onViewCreated(
1919
view: View,
2020
savedInstanceState: Bundle?,
2121
) {
2222
super.onViewCreated(view, savedInstanceState)
23-
onQueryUpdated(arguments!!.getString("entityId")!!)
23+
onQueryUpdated(requireArguments().getString("entityId")!!)
2424
}
2525
}

app/src/main/java/fr/free/nrw/commons/explore/depictions/media/DepictedImagesFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ class DepictedImagesFragment : PageableMediaFragment() {
1717
savedInstanceState: Bundle?,
1818
) {
1919
super.onViewCreated(view, savedInstanceState)
20-
onQueryUpdated(arguments!!.getString("entityId")!!)
20+
onQueryUpdated(requireArguments().getString("entityId")!!)
2121
}
2222
}

app/src/main/java/fr/free/nrw/commons/explore/depictions/parent/ParentDepictionsFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class ParentDepictionsFragment : PageableDepictionsFragment() {
1313
override val injectedPresenter
1414
get() = presenter
1515

16-
override fun getEmptyText(query: String) = getString(R.string.no_parent_classes, arguments!!.getString("wikidataItemName")!!)
16+
override fun getEmptyText(query: String) = getString(R.string.no_parent_classes, requireArguments().getString("wikidataItemName")!!)
1717

1818
override fun onViewCreated(
1919
view: View,
2020
savedInstanceState: Bundle?,
2121
) {
2222
super.onViewCreated(view, savedInstanceState)
23-
onQueryUpdated(arguments!!.getString("entityId")!!)
23+
onQueryUpdated(requireArguments().getString("entityId")!!)
2424
}
2525
}

app/src/main/java/fr/free/nrw/commons/explore/recentsearches/RecentSearchesDao.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fr.free.nrw.commons.explore.recentsearches;
22

3+
import android.annotation.SuppressLint;
34
import android.content.ContentProviderClient;
45
import android.content.ContentValues;
56
import android.database.Cursor;
@@ -178,6 +179,7 @@ public List<String> recentSearches(int limit) {
178179
* @return RecentSearch object
179180
*/
180181
@NonNull
182+
@SuppressLint("Range")
181183
RecentSearch fromCursor(Cursor cursor) {
182184
// Hardcoding column positions!
183185
return new RecentSearch(

app/src/main/java/fr/free/nrw/commons/explore/recentsearches/RecentSearchesFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
1616
import fr.free.nrw.commons.explore.SearchActivity;
1717
import java.util.List;
18+
import java.util.Locale;
1819
import javax.inject.Inject;
1920

2021

@@ -90,7 +91,7 @@ private void setDeleteRecentPositiveButton(@NonNull final Context context,
9091
private void showDeleteAlertDialog(@NonNull final Context context, final int position) {
9192
new AlertDialog.Builder(context)
9293
.setMessage(R.string.delete_search_dialog)
93-
.setPositiveButton(getString(R.string.delete).toUpperCase(),
94+
.setPositiveButton(getString(R.string.delete).toUpperCase(Locale.ROOT),
9495
((dialog, which) -> setDeletePositiveButton(context, dialog, position)))
9596
.setNegativeButton(android.R.string.cancel, null)
9697
.create()

app/src/main/java/fr/free/nrw/commons/media/MediaDetailFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,8 @@ private void updateToDoWarning() {
600600
// Check if the presented category is about need of category
601601
if (categoriesPresent) {
602602
for (String category : media.getCategories()) {
603-
if (category.toLowerCase().contains(CATEGORY_NEEDING_CATEGORIES) ||
604-
category.toLowerCase().contains(CATEGORY_UNCATEGORISED)) {
603+
if (category.toLowerCase(Locale.ROOT).contains(CATEGORY_NEEDING_CATEGORIES) ||
604+
category.toLowerCase(Locale.ROOT).contains(CATEGORY_UNCATEGORISED)) {
605605
categoriesPresent = false;
606606
}
607607
break;

0 commit comments

Comments
 (0)