mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 22:03:55 +01:00
Merge branch 'main' into account-delete
This commit is contained in:
commit
a1385a4997
5 changed files with 9 additions and 14 deletions
|
|
@ -1,11 +1,7 @@
|
||||||
package fr.free.nrw.commons.settings
|
package fr.free.nrw.commons.settings
|
||||||
|
|
||||||
object Prefs {
|
object Prefs {
|
||||||
const val GLOBAL_PREFS = "fr.free.nrw.commons.preferences"
|
|
||||||
|
|
||||||
const val TRACKING_ENABLED = "eventLogging"
|
|
||||||
const val DEFAULT_LICENSE = "defaultLicense"
|
const val DEFAULT_LICENSE = "defaultLicense"
|
||||||
const val UPLOADS_SHOWING = "uploadsShowing"
|
|
||||||
const val MANAGED_EXIF_TAGS = "managed_exif_tags"
|
const val MANAGED_EXIF_TAGS = "managed_exif_tags"
|
||||||
const val VANISHED_ACCOUNT = "vanishAccount"
|
const val VANISHED_ACCOUNT = "vanishAccount"
|
||||||
const val DESCRIPTION_LANGUAGE = "languageDescription"
|
const val DESCRIPTION_LANGUAGE = "languageDescription"
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import fr.free.nrw.commons.theme.BaseActivity
|
||||||
class SettingsActivity : BaseActivity() {
|
class SettingsActivity : BaseActivity() {
|
||||||
|
|
||||||
private lateinit var binding: ActivitySettingsBinding
|
private lateinit var binding: ActivitySettingsBinding
|
||||||
// private var settingsDelegate: AppCompatDelegate? = null
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* to be called when the activity starts
|
* to be called when the activity starts
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
inAppCameraLocationPref?.setOnPreferenceChangeListener { _, newValue ->
|
inAppCameraLocationPref?.setOnPreferenceChangeListener { _, newValue ->
|
||||||
val isInAppCameraLocationTurnedOn = newValue as Boolean
|
val isInAppCameraLocationTurnedOn = newValue as Boolean
|
||||||
if (isInAppCameraLocationTurnedOn) {
|
if (isInAppCameraLocationTurnedOn) {
|
||||||
createDialogsAndHandleLocationPermissions(requireActivity())
|
createDialogsAndHandleLocationPermissions()
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
@ -279,7 +279,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
*
|
*
|
||||||
* @param activity
|
* @param activity
|
||||||
*/
|
*/
|
||||||
private fun createDialogsAndHandleLocationPermissions(activity: Activity) {
|
private fun createDialogsAndHandleLocationPermissions() {
|
||||||
inAppCameraLocationPermissionLauncher.launch(arrayOf(permission.ACCESS_FINE_LOCATION))
|
inAppCameraLocationPermissionLauncher.launch(arrayOf(permission.ACCESS_FINE_LOCATION))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -307,7 +307,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
return object : PreferenceGroupAdapter(preferenceScreen) {
|
return object : PreferenceGroupAdapter(preferenceScreen) {
|
||||||
override fun onBindViewHolder(holder: PreferenceViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: PreferenceViewHolder, position: Int) {
|
||||||
super.onBindViewHolder(holder, position)
|
super.onBindViewHolder(holder, position)
|
||||||
val preference = getItem(position)
|
|
||||||
val iconFrame: View? = holder.itemView.findViewById(R.id.icon_frame)
|
val iconFrame: View? = holder.itemView.findViewById(R.id.icon_frame)
|
||||||
iconFrame?.visibility = View.GONE
|
iconFrame?.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,10 @@ class FileUtilsWrapper @Inject constructor(private val context: Context) {
|
||||||
while ((bis.read(buffer).also { size = it }) > 0) {
|
while ((bis.read(buffer).also { size = it }) > 0) {
|
||||||
buffers.add(
|
buffers.add(
|
||||||
writeToFile(
|
writeToFile(
|
||||||
buffer.copyOf(size),
|
buffer,
|
||||||
file.name ?: "",
|
file.name ?: "",
|
||||||
getFileExt(file.name)
|
getFileExt(file.name),
|
||||||
|
size
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +68,7 @@ class FileUtilsWrapper @Inject constructor(private val context: Context) {
|
||||||
* Create a temp file containing the passed byte data.
|
* Create a temp file containing the passed byte data.
|
||||||
*/
|
*/
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
private fun writeToFile(data: ByteArray, fileName: String, fileExtension: String): File {
|
private fun writeToFile(data: ByteArray, fileName: String, fileExtension: String, size: Int): File {
|
||||||
val file = File.createTempFile(fileName, fileExtension, context.cacheDir)
|
val file = File.createTempFile(fileName, fileExtension, context.cacheDir)
|
||||||
try {
|
try {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
|
@ -75,7 +76,7 @@ class FileUtilsWrapper @Inject constructor(private val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOutputStream(file).use { fos ->
|
FileOutputStream(file).use { fos ->
|
||||||
fos.write(data)
|
fos.write(data, 0, size)
|
||||||
}
|
}
|
||||||
} catch (throwable: Exception) {
|
} catch (throwable: Exception) {
|
||||||
Timber.e(throwable, "Failed to create file")
|
Timber.e(throwable, "Failed to create file")
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ class NearbyParentFragmentPresenterTest {
|
||||||
// 111.19 km real distance, return false if 148306.444306 > currentLocationSearchRadius
|
// 111.19 km real distance, return false if 148306.444306 > currentLocationSearchRadius
|
||||||
NearbyController.currentLocationSearchRadius = 148306.0
|
NearbyController.currentLocationSearchRadius = 148306.0
|
||||||
val isClose = nearbyPresenter.searchCloseToCurrentLocation()
|
val isClose = nearbyPresenter.searchCloseToCurrentLocation()
|
||||||
assertFalse(isClose!!.equals(false))
|
assertFalse(!isClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -318,7 +318,7 @@ class NearbyParentFragmentPresenterTest {
|
||||||
// 111.19 km real distance, return false if 148253.333 > currentLocationSearchRadius
|
// 111.19 km real distance, return false if 148253.333 > currentLocationSearchRadius
|
||||||
NearbyController.currentLocationSearchRadius = 148307.0
|
NearbyController.currentLocationSearchRadius = 148307.0
|
||||||
val isClose = nearbyPresenter.searchCloseToCurrentLocation()
|
val isClose = nearbyPresenter.searchCloseToCurrentLocation()
|
||||||
assertTrue(isClose!!)
|
assertTrue(isClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expectMapAndListUpdate() {
|
fun expectMapAndListUpdate() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue