Compare commits

..

4 commits

Author SHA1 Message Date
Amir E. Aharoni
3a55583460
Disable linting for icon hiding code in preferences (#6519)
Some checks failed
Android CI / Run tests and generate APK (push) Has been cancelled
2025-10-18 13:51:46 +09:00
Amir E. Aharoni
717a855149
Fix lint warning about Timber (#6521)
Change trivial string formatting and function calls
for Timber logging.

This resolves all the lint warnings in the
Android/Lint/Correctness/Messages group.
2025-10-18 13:45:35 +09:00
Amir E. Aharoni
29b6d0f8fe
Replace Switch with SwitchMaterial (#6522)
Lint recommended replacing Switch with SwitchMaterial.
This was a very simple replacement, and I tested it in
the custom selector, where it is used, and it works as
it worked previously.
2025-10-18 13:43:37 +09:00
Xinyu Yang
b5b5d8a8e4
I didn’t look at the code carefully before and directly modified the contents of strings.xml. After reviewing it, I found that the issue was actually in WikidataItemDetailsActivity.kt, where the wrong label was selected. After correcting this, there should no longer be any problems. (#6524)
Co-authored-by: frank <u7896083@anu.edu.au>
2025-10-18 11:31:49 +09:00
7 changed files with 15 additions and 8 deletions

View file

@ -324,7 +324,7 @@ after opening the app.
) )
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.blockingGet() .blockingGet()
Timber.d("Resuming " + stuckUploads.size + " uploads...") Timber.d("Resuming %d uploads...", stuckUploads.size)
if (!stuckUploads.isEmpty()) { if (!stuckUploads.isEmpty()) {
for (contribution in stuckUploads) { for (contribution in stuckUploads) {
contribution.state = Contribution.STATE_QUEUED contribution.state = Contribution.STATE_QUEUED

View file

@ -9,7 +9,6 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ProgressBar import android.widget.ProgressBar
import android.widget.Switch
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isVisible import androidx.core.view.isVisible
@ -20,6 +19,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle import androidx.lifecycle.repeatOnLifecycle
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.switchmaterial.SwitchMaterial
import fr.free.nrw.commons.contributions.Contribution import fr.free.nrw.commons.contributions.Contribution
import fr.free.nrw.commons.contributions.ContributionDao import fr.free.nrw.commons.contributions.ContributionDao
import fr.free.nrw.commons.customselector.database.NotForUploadStatusDao import fr.free.nrw.commons.customselector.database.NotForUploadStatusDao
@ -82,7 +82,7 @@ class ImageFragment :
*/ */
private var selectorRV: RecyclerView? = null private var selectorRV: RecyclerView? = null
private var loader: ProgressBar? = null private var loader: ProgressBar? = null
private var switch: Switch? = null private var switch: SwitchMaterial? = null
lateinit var filteredImages: ArrayList<Image> lateinit var filteredImages: ArrayList<Image>
/** /**

View file

@ -112,8 +112,8 @@ class WikidataItemDetailsActivity : BaseActivity(), MediaDetailProvider, Categor
viewPagerAdapter!!.setTabs( viewPagerAdapter!!.setTabs(
R.string.title_for_media to depictionImagesListFragment!!, R.string.title_for_media to depictionImagesListFragment!!,
R.string.title_for_subcategories to childDepictionsFragment, R.string.title_for_child_classes to childDepictionsFragment,
R.string.title_for_parent_categories to parentDepictionsFragment R.string.title_for_parent_classes to parentDepictionsFragment
) )
binding!!.viewPager.offscreenPageLimit = 2 binding!!.viewPager.offscreenPageLimit = 2
viewPagerAdapter!!.notifyDataSetChanged() viewPagerAdapter!!.notifyDataSetChanged()

View file

@ -27,6 +27,7 @@ import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
import java.util.Locale import java.util.Locale
import javax.inject.Inject import javax.inject.Inject
import timber.log.Timber
/** /**
* This activity will set two tabs, achievements and * This activity will set two tabs, achievements and
@ -122,7 +123,7 @@ class ProfileActivity : BaseActivity() {
val rootView = window.decorView.findViewById<View>(android.R.id.content) val rootView = window.decorView.findViewById<View>(android.R.id.content)
val screenShot = getScreenShot(rootView) val screenShot = getScreenShot(rootView)
if (screenShot == null) { if (screenShot == null) {
Log.e("ERROR", "ScreenShot is null") Timber.e("ScreenShot is null")
return false return false
} }
showAlert(screenShot) showAlert(screenShot)

View file

@ -1,6 +1,7 @@
package fr.free.nrw.commons.settings package fr.free.nrw.commons.settings
import android.Manifest.permission import android.Manifest.permission
import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.app.Dialog import android.app.Dialog
import android.content.Context.MODE_PRIVATE import android.content.Context.MODE_PRIVATE
@ -303,6 +304,11 @@ class SettingsFragment : PreferenceFragmentCompat() {
) )
} }
// Remove the space for icons in the settings menu.
// This uses an internal API that shouldn't be used in app code,
// but it appears to be the most robust way to do this at the moment,
// disable the warning.
@SuppressLint("RestrictedApi")
override fun onCreateAdapter(preferenceScreen: PreferenceScreen): Adapter<PreferenceViewHolder> override fun onCreateAdapter(preferenceScreen: PreferenceScreen): Adapter<PreferenceViewHolder>
{ {
return object : PreferenceGroupAdapter(preferenceScreen) { return object : PreferenceGroupAdapter(preferenceScreen) {

View file

@ -37,7 +37,7 @@ object LocationUtils {
latLng = LatLng(latLngArray[1].trim().toDouble(), latLng = LatLng(latLngArray[1].trim().toDouble(),
latLngArray[0].trim().toDouble(), 1f) latLngArray[0].trim().toDouble(), 1f)
} catch (e: Exception) { } catch (e: Exception) {
Timber.e("Error while parsing user entered lat long: %s", e) Timber.e(e, "Error while parsing user entered lat long")
} }
return latLng return latLng

View file

@ -6,7 +6,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/mainBackground"> android:background="?attr/mainBackground">
<Switch <com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchWidget" android:id="@+id/switchWidget"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"