mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
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 47232466ab.
* 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 95b909c29f.
* values-b+roa+tara\strings.xml: changed . . . to ...
* Revert "values-b+roa+tara\strings.xml: changed . . . to ..."
This reverts commit b5db1a3e68.
* 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 <nicolas.raoul@gmail.com>
This commit is contained in:
parent
cdc4f89da5
commit
522f1fe192
137 changed files with 617 additions and 572 deletions
|
|
@ -46,7 +46,7 @@ class BaseMarker {
|
|||
val drawable: Drawable = context.resources.getDrawable(drawableResId)
|
||||
icon =
|
||||
if (drawable is BitmapDrawable) {
|
||||
(drawable as BitmapDrawable).bitmap
|
||||
drawable.bitmap
|
||||
} else {
|
||||
val bitmap =
|
||||
Bitmap.createBitmap(
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ import fr.free.nrw.commons.utils.SystemThemeUtils;
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
|
||||
|
|
@ -301,7 +302,8 @@ public class LocationPickerActivity extends BaseActivity implements
|
|||
modifyLocationButton = findViewById(R.id.modify_location);
|
||||
removeLocationButton = findViewById(R.id.remove_location);
|
||||
showInMapButton = findViewById(R.id.show_in_map);
|
||||
showInMapButton.setText(getResources().getString(R.string.show_in_map_app).toUpperCase());
|
||||
showInMapButton.setText(getResources().getString(R.string.show_in_map_app).toUpperCase(
|
||||
Locale.ROOT));
|
||||
shadow = findViewById(R.id.location_picker_image_view_shadow);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package fr.free.nrw.commons
|
|||
import android.os.Parcelable
|
||||
import fr.free.nrw.commons.location.LatLng
|
||||
import fr.free.nrw.commons.wikidata.model.page.PageTitle
|
||||
import kotlinx.parcelize.IgnoredOnParcel
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
|
@ -124,6 +125,7 @@ class Media constructor(
|
|||
* Gets the categories the file falls under.
|
||||
* @return file categories as an ArrayList of Strings
|
||||
*/
|
||||
@IgnoredOnParcel
|
||||
var addedCategories: List<String>? = null
|
||||
// TODO added categories should be removed. It is added for a short fix. On category update,
|
||||
// categories should be re-fetched instead
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.bookmarks.items;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
|
|
@ -134,6 +135,7 @@ public class BookmarkItemsDao {
|
|||
* @param cursor : Object for storing database data
|
||||
* @return DepictedItem
|
||||
*/
|
||||
@SuppressLint("Range")
|
||||
DepictedItem fromCursor(final Cursor cursor) {
|
||||
final String fileName = cursor.getString(cursor.getColumnIndex(Table.COLUMN_NAME));
|
||||
final String description
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.bookmarks.locations;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
|
|
@ -146,6 +147,7 @@ public class BookmarkLocationsDao {
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressLint("Range")
|
||||
@NonNull
|
||||
Place fromCursor(final Cursor cursor) {
|
||||
final LatLng location = new LatLng(cursor.getDouble(cursor.getColumnIndex(Table.COLUMN_LAT)),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.bookmarks.pictures;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
|
|
@ -150,6 +151,7 @@ public class BookmarkPicturesDao {
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressLint("Range")
|
||||
@NonNull
|
||||
Bookmark fromCursor(Cursor cursor) {
|
||||
String fileName = cursor.getString(cursor.getColumnIndex(Table.COLUMN_MEDIA_NAME));
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class CategoryClient
|
|||
}.map {
|
||||
it
|
||||
.filter { page ->
|
||||
page.categoryInfo() == null || !page.categoryInfo().isHidden
|
||||
!page.categoryInfo().isHidden
|
||||
}.map {
|
||||
CategoryItem(
|
||||
it.title().replace(CATEGORY_PREFIX, ""),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.category;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
|
|
@ -111,6 +112,7 @@ public class CategoryDao {
|
|||
}
|
||||
|
||||
@NonNull
|
||||
@SuppressLint("Range")
|
||||
Category fromCursor(Cursor cursor) {
|
||||
// Hardcoding column positions!
|
||||
return new Category(
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class WikipediaInstructionsDialogFragment : DialogFragment() {
|
|||
) = DialogAddToWikipediaInstructionsBinding
|
||||
.inflate(inflater, container, false)
|
||||
.apply {
|
||||
val contribution: Contribution? = arguments!!.getParcelable(ARG_CONTRIBUTION)
|
||||
val contribution: Contribution? = requireArguments().getParcelable(ARG_CONTRIBUTION)
|
||||
tvWikicode.setText(contribution?.media?.wikiCode)
|
||||
instructionsCancel.setOnClickListener { dismiss() }
|
||||
instructionsConfirm.setOnClickListener {
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ class DescriptionEditActivity :
|
|||
) {
|
||||
try {
|
||||
descriptionEditHelper
|
||||
?.addDescription(
|
||||
.addDescription(
|
||||
applicationContext,
|
||||
media,
|
||||
updatedWikiText,
|
||||
|
|
@ -250,7 +250,7 @@ class DescriptionEditActivity :
|
|||
)
|
||||
}
|
||||
} catch (e: InvalidLoginTokenException) {
|
||||
val username: String? = sessionManager?.userName
|
||||
val username: String? = sessionManager.userName
|
||||
val logoutListener =
|
||||
CommonsApplication.BaseLogoutListener(
|
||||
this,
|
||||
|
|
@ -268,7 +268,7 @@ class DescriptionEditActivity :
|
|||
for (mediaDetail in uploadMediaDetails) {
|
||||
try {
|
||||
compositeDisposable.add(
|
||||
descriptionEditHelper!!
|
||||
descriptionEditHelper
|
||||
.addCaption(
|
||||
applicationContext,
|
||||
media,
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ class TransformImageImpl : TransformImage {
|
|||
} catch (e: LLJTranException) {
|
||||
Timber.tag("Error").d(e)
|
||||
return null
|
||||
false
|
||||
}
|
||||
|
||||
if (rotated) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import fr.free.nrw.commons.theme.BaseActivity;
|
|||
import fr.free.nrw.commons.utils.ActivityUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
|
|
@ -112,13 +113,13 @@ public class ExploreFragment extends CommonsDaggerSupportFragment {
|
|||
mobileRootFragment = new ExploreListRootFragment(mobileArguments);
|
||||
mapRootFragment = new ExploreMapRootFragment(mapArguments);
|
||||
fragmentList.add(featuredRootFragment);
|
||||
titleList.add(getString(R.string.explore_tab_title_featured).toUpperCase());
|
||||
titleList.add(getString(R.string.explore_tab_title_featured).toUpperCase(Locale.ROOT));
|
||||
|
||||
fragmentList.add(mobileRootFragment);
|
||||
titleList.add(getString(R.string.explore_tab_title_mobile).toUpperCase());
|
||||
titleList.add(getString(R.string.explore_tab_title_mobile).toUpperCase(Locale.ROOT));
|
||||
|
||||
fragmentList.add(mapRootFragment);
|
||||
titleList.add(getString(R.string.explore_tab_title_map).toUpperCase());
|
||||
titleList.add(getString(R.string.explore_tab_title_map).toUpperCase(Locale.ROOT));
|
||||
|
||||
((MainActivity)getActivity()).showTabs();
|
||||
((BaseActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.inject.Inject;
|
||||
import timber.log.Timber;
|
||||
|
|
@ -95,11 +96,11 @@ public class SearchActivity extends BaseActivity
|
|||
searchDepictionsFragment = new SearchDepictionsFragment();
|
||||
searchCategoryFragment= new SearchCategoryFragment();
|
||||
fragmentList.add(searchMediaFragment);
|
||||
titleList.add(getResources().getString(R.string.search_tab_title_media).toUpperCase());
|
||||
titleList.add(getResources().getString(R.string.search_tab_title_media).toUpperCase(Locale.ROOT));
|
||||
fragmentList.add(searchCategoryFragment);
|
||||
titleList.add(getResources().getString(R.string.search_tab_title_categories).toUpperCase());
|
||||
titleList.add(getResources().getString(R.string.search_tab_title_categories).toUpperCase(Locale.ROOT));
|
||||
fragmentList.add(searchDepictionsFragment);
|
||||
titleList.add(getResources().getString(R.string.search_tab_title_depictions).toUpperCase());
|
||||
titleList.add(getResources().getString(R.string.search_tab_title_depictions).toUpperCase(Locale.ROOT));
|
||||
|
||||
viewPagerAdapter.setTabData(fragmentList, titleList);
|
||||
viewPagerAdapter.notifyDataSetChanged();
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@ class CategoriesMediaFragment : PageableMediaFragment() {
|
|||
savedInstanceState: Bundle?,
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
onQueryUpdated("$CATEGORY_PREFIX${arguments!!.getString("categoryName")!!}")
|
||||
onQueryUpdated("$CATEGORY_PREFIX${requireArguments().getString("categoryName")!!}")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@ class ParentCategoriesFragment : PageableCategoryFragment() {
|
|||
savedInstanceState: Bundle?,
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
onQueryUpdated("$CATEGORY_PREFIX${arguments!!.getString("categoryName")!!}")
|
||||
onQueryUpdated("$CATEGORY_PREFIX${requireArguments().getString("categoryName")!!}")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,6 @@ class SubCategoriesFragment : PageableCategoryFragment() {
|
|||
savedInstanceState: Bundle?,
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
onQueryUpdated("$CATEGORY_PREFIX${arguments!!.getString("categoryName")!!}")
|
||||
onQueryUpdated("$CATEGORY_PREFIX${requireArguments().getString("categoryName")!!}")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ class ChildDepictionsFragment : PageableDepictionsFragment() {
|
|||
override val injectedPresenter
|
||||
get() = presenter
|
||||
|
||||
override fun getEmptyText(query: String) = getString(R.string.no_child_classes, arguments!!.getString("wikidataItemName")!!)
|
||||
override fun getEmptyText(query: String) = getString(R.string.no_child_classes, requireArguments().getString("wikidataItemName")!!)
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?,
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
onQueryUpdated(arguments!!.getString("entityId")!!)
|
||||
onQueryUpdated(requireArguments().getString("entityId")!!)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@ class DepictedImagesFragment : PageableMediaFragment() {
|
|||
savedInstanceState: Bundle?,
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
onQueryUpdated(arguments!!.getString("entityId")!!)
|
||||
onQueryUpdated(requireArguments().getString("entityId")!!)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ class ParentDepictionsFragment : PageableDepictionsFragment() {
|
|||
override val injectedPresenter
|
||||
get() = presenter
|
||||
|
||||
override fun getEmptyText(query: String) = getString(R.string.no_parent_classes, arguments!!.getString("wikidataItemName")!!)
|
||||
override fun getEmptyText(query: String) = getString(R.string.no_parent_classes, requireArguments().getString("wikidataItemName")!!)
|
||||
|
||||
override fun onViewCreated(
|
||||
view: View,
|
||||
savedInstanceState: Bundle?,
|
||||
) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
onQueryUpdated(arguments!!.getString("entityId")!!)
|
||||
onQueryUpdated(requireArguments().getString("entityId")!!)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.explore.recentsearches;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
|
|
@ -178,6 +179,7 @@ public class RecentSearchesDao {
|
|||
* @return RecentSearch object
|
||||
*/
|
||||
@NonNull
|
||||
@SuppressLint("Range")
|
||||
RecentSearch fromCursor(Cursor cursor) {
|
||||
// Hardcoding column positions!
|
||||
return new RecentSearch(
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import fr.free.nrw.commons.databinding.FragmentSearchHistoryBinding;
|
|||
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
|
||||
import fr.free.nrw.commons.explore.SearchActivity;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
||||
|
|
@ -90,7 +91,7 @@ public class RecentSearchesFragment extends CommonsDaggerSupportFragment {
|
|||
private void showDeleteAlertDialog(@NonNull final Context context, final int position) {
|
||||
new AlertDialog.Builder(context)
|
||||
.setMessage(R.string.delete_search_dialog)
|
||||
.setPositiveButton(getString(R.string.delete).toUpperCase(),
|
||||
.setPositiveButton(getString(R.string.delete).toUpperCase(Locale.ROOT),
|
||||
((dialog, which) -> setDeletePositiveButton(context, dialog, position)))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.create()
|
||||
|
|
|
|||
|
|
@ -600,8 +600,8 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
|
|||
// Check if the presented category is about need of category
|
||||
if (categoriesPresent) {
|
||||
for (String category : media.getCategories()) {
|
||||
if (category.toLowerCase().contains(CATEGORY_NEEDING_CATEGORIES) ||
|
||||
category.toLowerCase().contains(CATEGORY_UNCATEGORISED)) {
|
||||
if (category.toLowerCase(Locale.ROOT).contains(CATEGORY_NEEDING_CATEGORIES) ||
|
||||
category.toLowerCase(Locale.ROOT).contains(CATEGORY_UNCATEGORISED)) {
|
||||
categoriesPresent = false;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ class ZoomableActivity : BaseActivity() {
|
|||
onSwipe()
|
||||
}
|
||||
}
|
||||
binding.zoomProgressBar?.let {
|
||||
binding.zoomProgressBar.let {
|
||||
it.visibility = if (result.status is CallbackStatus.FETCHING) View.VISIBLE else View.GONE
|
||||
}
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ class ZoomableActivity : BaseActivity() {
|
|||
sharedPreferences.getBoolean(ImageHelper.SHOW_ALREADY_ACTIONED_IMAGES_PREFERENCE_KEY, true)
|
||||
|
||||
if (!images.isNullOrEmpty()) {
|
||||
binding.zoomable!!.setOnTouchListener(
|
||||
binding.zoomable.setOnTouchListener(
|
||||
object : OnSwipeTouchListener(this) {
|
||||
// Swipe left to view next image in the folder. (if available)
|
||||
override fun onSwipeLeft() {
|
||||
|
|
@ -271,7 +271,7 @@ class ZoomableActivity : BaseActivity() {
|
|||
* Handles down swipe action
|
||||
*/
|
||||
private fun onDownSwiped() {
|
||||
if (binding.zoomable?.zoomableController?.isIdentity == false) {
|
||||
if (binding.zoomable.zoomableController?.isIdentity == false) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -341,7 +341,7 @@ class ZoomableActivity : BaseActivity() {
|
|||
* Handles up swipe action
|
||||
*/
|
||||
private fun onUpSwiped() {
|
||||
if (binding.zoomable?.zoomableController?.isIdentity == false) {
|
||||
if (binding.zoomable.zoomableController?.isIdentity == false) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -414,7 +414,7 @@ class ZoomableActivity : BaseActivity() {
|
|||
* Handles right swipe action
|
||||
*/
|
||||
private fun onRightSwiped(showAlreadyActionedImages: Boolean) {
|
||||
if (binding.zoomable?.zoomableController?.isIdentity == false) {
|
||||
if (binding.zoomable.zoomableController?.isIdentity == false) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -451,7 +451,7 @@ class ZoomableActivity : BaseActivity() {
|
|||
* Handles left swipe action
|
||||
*/
|
||||
private fun onLeftSwiped(showAlreadyActionedImages: Boolean) {
|
||||
if (binding.zoomable?.zoomableController?.isIdentity == false) {
|
||||
if (binding.zoomable.zoomableController?.isIdentity == false) {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -646,7 +646,7 @@ class ZoomableActivity : BaseActivity() {
|
|||
.setProgressBarImage(ProgressBarDrawable())
|
||||
.setProgressBarImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
|
||||
.build()
|
||||
with(binding.zoomable!!) {
|
||||
with(binding.zoomable) {
|
||||
setHierarchy(hierarchy)
|
||||
setAllowTouchInterceptionWhileZoomed(true)
|
||||
setIsLongpressEnabled(false)
|
||||
|
|
@ -658,10 +658,10 @@ class ZoomableActivity : BaseActivity() {
|
|||
.setUri(imageUri)
|
||||
.setControllerListener(loadingListener)
|
||||
.build()
|
||||
binding.zoomable!!.controller = controller
|
||||
binding.zoomable.controller = controller
|
||||
|
||||
if (photoBackgroundColor != null) {
|
||||
binding.zoomable!!.setBackgroundColor(photoBackgroundColor!!)
|
||||
binding.zoomable.setBackgroundColor(photoBackgroundColor!!)
|
||||
}
|
||||
|
||||
if (!images.isNullOrEmpty()) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import fr.free.nrw.commons.R;
|
||||
import java.util.Locale;
|
||||
|
||||
public class NearbyFilterSearchRecyclerViewAdapter
|
||||
extends RecyclerView.Adapter<NearbyFilterSearchRecyclerViewAdapter.RecyclerViewHolder>
|
||||
|
|
@ -121,11 +122,11 @@ public class NearbyFilterSearchRecyclerViewAdapter
|
|||
results.count = labels.size();
|
||||
results.values = labels;
|
||||
} else {
|
||||
constraint = constraint.toString().toLowerCase();
|
||||
constraint = constraint.toString().toLowerCase(Locale.ROOT);
|
||||
|
||||
for (Label label : labels) {
|
||||
String data = label.toString();
|
||||
if (data.toLowerCase().startsWith(constraint.toString())) {
|
||||
if (data.toLowerCase(Locale.ROOT).startsWith(constraint.toString())) {
|
||||
filteredArrayList.add(Label.fromText(label.getText()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class WikidataFeedback : BaseActivity() {
|
|||
lat,
|
||||
lng,
|
||||
)
|
||||
} as Callable<SingleSource<Boolean?>>,
|
||||
},
|
||||
).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ aBoolean: Boolean? ->
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
|
@ -139,14 +140,14 @@ public class ProfileActivity extends BaseActivity {
|
|||
leaderboardFragment.setArguments(leaderBoardBundle);
|
||||
|
||||
fragmentList.add(leaderboardFragment);
|
||||
titleList.add(getResources().getString(R.string.leaderboard_tab_title).toUpperCase());
|
||||
titleList.add(getResources().getString(R.string.leaderboard_tab_title).toUpperCase(Locale.ROOT));
|
||||
|
||||
contributionsFragment = new ContributionsFragment();
|
||||
Bundle contributionsListBundle = new Bundle();
|
||||
contributionsListBundle.putString(KEY_USERNAME, userName);
|
||||
contributionsFragment.setArguments(contributionsListBundle);
|
||||
fragmentList.add(contributionsFragment);
|
||||
titleList.add(getString(R.string.contributions_fragment).toUpperCase());
|
||||
titleList.add(getString(R.string.contributions_fragment).toUpperCase(Locale.ROOT));
|
||||
|
||||
viewPagerAdapter.setTabData(fragmentList, titleList);
|
||||
viewPagerAdapter.notifyDataSetChanged();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import fr.free.nrw.commons.profile.ProfileActivity;
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import javax.inject.Inject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -361,7 +362,7 @@ public class AchievementsFragment extends CommonsDaggerSupportFragment {
|
|||
+ levelInfo.getMaxUniqueImages());
|
||||
binding.imageFeatured.setText(String.valueOf(achievements.getFeaturedImages()));
|
||||
binding.qualityImages.setText(String.valueOf(achievements.getQualityImages()));
|
||||
String levelUpInfoString = getString(R.string.level).toUpperCase();
|
||||
String levelUpInfoString = getString(R.string.level).toUpperCase(Locale.ROOT);
|
||||
levelUpInfoString += " " + levelInfo.getLevelNumber();
|
||||
binding.achievementLevel.setText(levelUpInfoString);
|
||||
binding.achievementBadgeImage.setImageDrawable(VectorDrawableCompat.create(getResources(), R.drawable.badge,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.recentlanguages;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
|
|
@ -117,6 +118,7 @@ public class RecentLanguagesDao {
|
|||
* @return Language object
|
||||
*/
|
||||
@NonNull
|
||||
@SuppressLint("Range")
|
||||
Language fromCursor(final Cursor cursor) {
|
||||
// Hardcoding column positions!
|
||||
final String languageName = cursor.getString(cursor.getColumnIndex(Table.COLUMN_NAME));
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import fr.free.nrw.commons.utils.ViewUtil;
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.util.Locale;
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class ReviewActivity extends BaseActivity {
|
||||
|
|
@ -241,7 +242,7 @@ public class ReviewActivity extends BaseActivity {
|
|||
|
||||
public void showSkipImageInfo(){
|
||||
DialogUtil.showAlertDialog(ReviewActivity.this,
|
||||
getString(R.string.skip_image).toUpperCase(),
|
||||
getString(R.string.skip_image).toUpperCase(Locale.ROOT),
|
||||
getString(R.string.skip_image_explanation),
|
||||
getString(android.R.string.ok),
|
||||
"",
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class FailedUploadsFragment :
|
|||
}
|
||||
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = sessionManager!!.getUserName()
|
||||
userName = sessionManager.getUserName()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,8 +96,8 @@ class FailedUploadsFragment :
|
|||
fun initRecyclerView() {
|
||||
binding.failedUploadsRecyclerView.setLayoutManager(LinearLayoutManager(this.context))
|
||||
binding.failedUploadsRecyclerView.adapter = adapter
|
||||
pendingUploadsPresenter!!.getFailedContributions()
|
||||
pendingUploadsPresenter!!.failedContributionList.observe(
|
||||
pendingUploadsPresenter.getFailedContributions()
|
||||
pendingUploadsPresenter.failedContributionList.observe(
|
||||
viewLifecycleOwner,
|
||||
) { list: PagedList<Contribution?> ->
|
||||
adapter.submitList(list)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import java.math.BigInteger;
|
|||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import java.util.Locale;
|
||||
import timber.log.Timber;
|
||||
|
||||
public class FileUtils {
|
||||
|
|
@ -139,7 +140,7 @@ public class FileUtils {
|
|||
String fileExtension = MimeTypeMap.getFileExtensionFromUrl(uri
|
||||
.toString());
|
||||
mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
|
||||
fileExtension.toLowerCase());
|
||||
fileExtension.toLowerCase(Locale.getDefault()));
|
||||
}
|
||||
return mimeType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ class PendingUploadsFragment :
|
|||
fun initRecyclerView() {
|
||||
binding.pendingUploadsRecyclerView.setLayoutManager(LinearLayoutManager(this.context))
|
||||
binding.pendingUploadsRecyclerView.adapter = adapter
|
||||
pendingUploadsPresenter!!.setup()
|
||||
pendingUploadsPresenter!!.totalContributionList.observe(
|
||||
pendingUploadsPresenter.setup()
|
||||
pendingUploadsPresenter.totalContributionList.observe(
|
||||
viewLifecycleOwner,
|
||||
) { list: PagedList<Contribution?> ->
|
||||
contributionsSize = list.size
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ public class UploadCategoriesFragment extends UploadBaseFragment implements Cate
|
|||
return false;
|
||||
});
|
||||
|
||||
Objects.requireNonNull(getView()).setFocusableInTouchMode(true);
|
||||
requireView().setFocusableInTouchMode(true);
|
||||
getView().requestFocus();
|
||||
getView().setOnKeyListener((v, keyCode, event) -> {
|
||||
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
|
|
@ -387,7 +387,7 @@ public class UploadCategoriesFragment extends UploadBaseFragment implements Cate
|
|||
});
|
||||
|
||||
Objects.requireNonNull(
|
||||
((AppCompatActivity) Objects.requireNonNull(getActivity())).getSupportActionBar())
|
||||
((AppCompatActivity) requireActivity()).getSupportActionBar())
|
||||
.hide();
|
||||
|
||||
if (getParentFragment().getParentFragment().getParentFragment()
|
||||
|
|
@ -407,7 +407,7 @@ public class UploadCategoriesFragment extends UploadBaseFragment implements Cate
|
|||
super.onStop();
|
||||
if (media != null) {
|
||||
Objects.requireNonNull(
|
||||
((AppCompatActivity) Objects.requireNonNull(getActivity())).getSupportActionBar())
|
||||
((AppCompatActivity) requireActivity()).getSupportActionBar())
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ public class DepictsFragment extends UploadBaseFragment implements DepictsContra
|
|||
return false;
|
||||
});
|
||||
|
||||
Objects.requireNonNull(getView()).setFocusableInTouchMode(true);
|
||||
requireView().setFocusableInTouchMode(true);
|
||||
getView().requestFocus();
|
||||
getView().setOnKeyListener((v, keyCode, event) -> {
|
||||
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
|
|
@ -411,7 +411,7 @@ public class DepictsFragment extends UploadBaseFragment implements DepictsContra
|
|||
});
|
||||
|
||||
Objects.requireNonNull(
|
||||
((AppCompatActivity) Objects.requireNonNull(getActivity())).getSupportActionBar())
|
||||
((AppCompatActivity) requireActivity()).getSupportActionBar())
|
||||
.hide();
|
||||
|
||||
if (getParentFragment().getParentFragment().getParentFragment()
|
||||
|
|
@ -431,7 +431,7 @@ public class DepictsFragment extends UploadBaseFragment implements DepictsContra
|
|||
super.onStop();
|
||||
if (media != null) {
|
||||
Objects.requireNonNull(
|
||||
((AppCompatActivity) Objects.requireNonNull(getActivity())).getSupportActionBar())
|
||||
((AppCompatActivity) requireActivity()).getSupportActionBar())
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
|||
@Override
|
||||
public void displayAddLocationDialog(final Runnable onSkipClicked) {
|
||||
isMissingLocationDialog = true;
|
||||
DialogUtil.showAlertDialog(Objects.requireNonNull(getActivity()),
|
||||
DialogUtil.showAlertDialog(requireActivity(),
|
||||
getString(R.string.no_location_found_title),
|
||||
getString(R.string.no_location_found_message),
|
||||
getString(R.string.add_location),
|
||||
|
|
|
|||
|
|
@ -129,9 +129,9 @@ public class UploadMediaPresenter implements UserActionListener, SimilarImageInt
|
|||
if (place.location != null) {
|
||||
final String countryCode = reverseGeoCode(place.location);
|
||||
if (countryCode != null && WLM_SUPPORTED_COUNTRIES
|
||||
.contains(countryCode.toLowerCase())) {
|
||||
.contains(countryCode.toLowerCase(Locale.ROOT))) {
|
||||
uploadItem.setWLMUpload(true);
|
||||
uploadItem.setCountryCode(countryCode.toLowerCase());
|
||||
uploadItem.setCountryCode(countryCode.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue