Refactor deprecated toUpperCase / toLowerCase methods
This commit is contained in:
parent
5c024dbda9
commit
4ec0f3d2d8
@ -1,7 +1,5 @@
|
|||||||
package org.cryptomator.presentation.logging
|
package org.cryptomator.presentation.logging
|
||||||
|
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
internal object GeneratedErrorCode {
|
internal object GeneratedErrorCode {
|
||||||
|
|
||||||
private const val A_PRIME = Int.MAX_VALUE
|
private const val A_PRIME = Int.MAX_VALUE
|
||||||
@ -22,7 +20,7 @@ internal object GeneratedErrorCode {
|
|||||||
var value = code
|
var value = code
|
||||||
value = value and 0xfffff xor (value ushr 20)
|
value = value and 0xfffff xor (value ushr 20)
|
||||||
value = value or 0x100000
|
value = value or 0x100000
|
||||||
return value.toString(32).substring(1).toUpperCase(Locale.getDefault())
|
return value.toString(32).substring(1).uppercase()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun traceCode(throwable: Throwable?): Int {
|
private fun traceCode(throwable: Throwable?): Int {
|
||||||
|
@ -4,13 +4,12 @@ import android.content.Context
|
|||||||
import org.cryptomator.presentation.model.CloudModel
|
import org.cryptomator.presentation.model.CloudModel
|
||||||
import org.cryptomator.presentation.model.WebDavCloudModel
|
import org.cryptomator.presentation.model.WebDavCloudModel
|
||||||
import java.util.Comparator
|
import java.util.Comparator
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
class CloudModelComparator(private val context: Context) : Comparator<CloudModel> {
|
class CloudModelComparator(private val context: Context) : Comparator<CloudModel> {
|
||||||
|
|
||||||
override fun compare(o1: CloudModel, o2: CloudModel): Int {
|
override fun compare(o1: CloudModel, o2: CloudModel): Int {
|
||||||
return if (o1 is WebDavCloudModel && o2 is WebDavCloudModel) {
|
return if (o1 is WebDavCloudModel && o2 is WebDavCloudModel) {
|
||||||
o1.url().compareTo(o2.url().toUpperCase(Locale.getDefault()), ignoreCase = true)
|
o1.url().compareTo(o2.url().uppercase(), ignoreCase = true)
|
||||||
} else {
|
} else {
|
||||||
context.getString(o1.name()).compareTo(context.getString(o2.name()), ignoreCase = true)
|
context.getString(o1.name()).compareTo(context.getString(o2.name()), ignoreCase = true)
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,7 @@ class BrowseFilesPresenter @Inject constructor( //
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun viewFile(cloudFile: CloudFileModel) {
|
private fun viewFile(cloudFile: CloudFileModel) {
|
||||||
val lowerFileName = cloudFile.name.toLowerCase(Locale.getDefault())
|
val lowerFileName = cloudFile.name.lowercase()
|
||||||
if (lowerFileName.endsWith(".txt") || lowerFileName.endsWith(".md") || lowerFileName.endsWith(".todo")) {
|
if (lowerFileName.endsWith(".txt") || lowerFileName.endsWith(".md") || lowerFileName.endsWith(".todo")) {
|
||||||
startIntent(
|
startIntent(
|
||||||
Intents.textEditorIntent() //
|
Intents.textEditorIntent() //
|
||||||
|
@ -10,7 +10,6 @@ import org.cryptomator.presentation.presenter.LicenseCheckPresenter
|
|||||||
import org.cryptomator.presentation.ui.activity.view.UpdateLicenseView
|
import org.cryptomator.presentation.ui.activity.view.UpdateLicenseView
|
||||||
import org.cryptomator.presentation.ui.dialog.LicenseConfirmationDialog
|
import org.cryptomator.presentation.ui.dialog.LicenseConfirmationDialog
|
||||||
import org.cryptomator.presentation.ui.dialog.UpdateLicenseDialog
|
import org.cryptomator.presentation.ui.dialog.UpdateLicenseDialog
|
||||||
import java.util.Locale
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
import kotlinx.android.synthetic.main.toolbar_layout.toolbar
|
import kotlinx.android.synthetic.main.toolbar_layout.toolbar
|
||||||
@ -53,7 +52,7 @@ class LicenseCheckActivity : BaseActivity(), UpdateLicenseDialog.Callback, Licen
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupToolbar() {
|
private fun setupToolbar() {
|
||||||
toolbar.title = getString(R.string.app_name).toUpperCase(Locale.getDefault())
|
toolbar.title = getString(R.string.app_name).uppercase()
|
||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ import org.cryptomator.presentation.ui.dialog.VaultDeleteConfirmationDialog
|
|||||||
import org.cryptomator.presentation.ui.dialog.VaultRenameDialog
|
import org.cryptomator.presentation.ui.dialog.VaultRenameDialog
|
||||||
import org.cryptomator.presentation.ui.fragment.VaultListFragment
|
import org.cryptomator.presentation.ui.fragment.VaultListFragment
|
||||||
import org.cryptomator.presentation.ui.layout.ObscuredAwareCoordinatorLayout.Listener
|
import org.cryptomator.presentation.ui.layout.ObscuredAwareCoordinatorLayout.Listener
|
||||||
import java.util.Locale
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlinx.android.synthetic.main.activity_layout_obscure_aware.activityRootView
|
import kotlinx.android.synthetic.main.activity_layout_obscure_aware.activityRootView
|
||||||
import kotlinx.android.synthetic.main.toolbar_layout.toolbar
|
import kotlinx.android.synthetic.main.toolbar_layout.toolbar
|
||||||
@ -100,7 +99,7 @@ class VaultListActivity : BaseActivity(), //
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupToolbar() {
|
private fun setupToolbar() {
|
||||||
toolbar.title = getString(R.string.app_name).toUpperCase(Locale.getDefault())
|
toolbar.title = getString(R.string.app_name).uppercase()
|
||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ import org.cryptomator.presentation.util.ResourceHelper.Companion.getDrawable
|
|||||||
import org.cryptomator.util.Optional
|
import org.cryptomator.util.Optional
|
||||||
import org.cryptomator.util.SharedPreferencesHandler
|
import org.cryptomator.util.SharedPreferencesHandler
|
||||||
import java.util.Comparator
|
import java.util.Comparator
|
||||||
import java.util.Locale
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlinx.android.synthetic.main.item_browse_files_node.view.cloudNodeImage
|
import kotlinx.android.synthetic.main.item_browse_files_node.view.cloudNodeImage
|
||||||
import kotlinx.android.synthetic.main.item_browse_files_node.view.itemCheckBox
|
import kotlinx.android.synthetic.main.item_browse_files_node.view.itemCheckBox
|
||||||
@ -119,7 +118,7 @@ constructor(
|
|||||||
if (sharedPreferencesHandler.useGlobSearch()) {
|
if (sharedPreferencesHandler.useGlobSearch()) {
|
||||||
nodes?.filter { cloudNode -> PatternMatcher(filterText, PatternMatcher.PATTERN_SIMPLE_GLOB).match(cloudNode.name) }
|
nodes?.filter { cloudNode -> PatternMatcher(filterText, PatternMatcher.PATTERN_SIMPLE_GLOB).match(cloudNode.name) }
|
||||||
} else {
|
} else {
|
||||||
nodes?.filter { cloudNode -> cloudNode.name.toLowerCase(Locale.getDefault()).startsWith(filterText.toLowerCase(Locale.getDefault())) }
|
nodes?.filter { cloudNode -> cloudNode.name.lowercase().startsWith(filterText.lowercase()) }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nodes
|
nodes
|
||||||
|
@ -6,7 +6,6 @@ import org.cryptomator.generator.BottomSheet
|
|||||||
import org.cryptomator.presentation.R
|
import org.cryptomator.presentation.R
|
||||||
import org.cryptomator.presentation.model.CloudFileModel
|
import org.cryptomator.presentation.model.CloudFileModel
|
||||||
import org.cryptomator.presentation.model.CloudNodeModel
|
import org.cryptomator.presentation.model.CloudNodeModel
|
||||||
import java.util.Locale
|
|
||||||
import kotlinx.android.synthetic.main.dialog_bottom_sheet_file_settings.delete_file
|
import kotlinx.android.synthetic.main.dialog_bottom_sheet_file_settings.delete_file
|
||||||
import kotlinx.android.synthetic.main.dialog_bottom_sheet_file_settings.export_file
|
import kotlinx.android.synthetic.main.dialog_bottom_sheet_file_settings.export_file
|
||||||
import kotlinx.android.synthetic.main.dialog_bottom_sheet_file_settings.iv_file_image
|
import kotlinx.android.synthetic.main.dialog_bottom_sheet_file_settings.iv_file_image
|
||||||
@ -38,7 +37,7 @@ class FileSettingsBottomSheet : BaseBottomSheet<FileSettingsBottomSheet.Callback
|
|||||||
tv_file_name.text = cloudFileModel.name
|
tv_file_name.text = cloudFileModel.name
|
||||||
tv_file_path.text = parentFolderPath
|
tv_file_path.text = parentFolderPath
|
||||||
|
|
||||||
val lowerFileName = cloudFileModel.name.toLowerCase(Locale.getDefault())
|
val lowerFileName = cloudFileModel.name.lowercase()
|
||||||
if (lowerFileName.endsWith(".txt") || lowerFileName.endsWith(".md") || lowerFileName.endsWith(".todo")) {
|
if (lowerFileName.endsWith(".txt") || lowerFileName.endsWith(".md") || lowerFileName.endsWith(".todo")) {
|
||||||
open_with_text.visibility = View.VISIBLE
|
open_with_text.visibility = View.VISIBLE
|
||||||
open_with_text.setOnClickListener {
|
open_with_text.setOnClickListener {
|
||||||
|
@ -8,7 +8,6 @@ import com.google.android.material.textfield.TextInputEditText
|
|||||||
import org.cryptomator.generator.Fragment
|
import org.cryptomator.generator.Fragment
|
||||||
import org.cryptomator.presentation.R
|
import org.cryptomator.presentation.R
|
||||||
import org.cryptomator.presentation.presenter.TextEditorPresenter
|
import org.cryptomator.presentation.presenter.TextEditorPresenter
|
||||||
import java.util.Locale
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlinx.android.synthetic.main.fragment_text_editor.textEditor
|
import kotlinx.android.synthetic.main.fragment_text_editor.textEditor
|
||||||
import kotlinx.android.synthetic.main.fragment_text_editor.textViewWrapper
|
import kotlinx.android.synthetic.main.fragment_text_editor.textViewWrapper
|
||||||
@ -63,9 +62,9 @@ class TextEditorFragment : BaseFragment() {
|
|||||||
|
|
||||||
clearSpans(textEditor)
|
clearSpans(textEditor)
|
||||||
|
|
||||||
val fulltext = textEditor.text.toString().toLowerCase(Locale.getDefault())
|
val fulltext = textEditor.text.toString().lowercase()
|
||||||
|
|
||||||
textEditorPresenter.query?.toLowerCase(Locale.getDefault())?.let {
|
textEditorPresenter.query?.lowercase()?.let {
|
||||||
val index: Int = when (direction) {
|
val index: Int = when (direction) {
|
||||||
Direction.PREVIOUS -> {
|
Direction.PREVIOUS -> {
|
||||||
textEditorPresenter.lastFilterLocation -= 1
|
textEditorPresenter.lastFilterLocation -= 1
|
||||||
|
@ -23,7 +23,6 @@ import java.io.ObjectOutputStream
|
|||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.HashSet
|
import java.util.HashSet
|
||||||
import java.util.Locale
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
@ -109,7 +108,7 @@ class FileUtil @Inject constructor(private val context: Context, private val mim
|
|||||||
private fun fileNameLowerCaseExtension(cloudFile: CloudFileModel): String {
|
private fun fileNameLowerCaseExtension(cloudFile: CloudFileModel): String {
|
||||||
val cloudFileName = cloudFile.name
|
val cloudFileName = cloudFile.name
|
||||||
val extension = getExtension(cloudFileName)
|
val extension = getExtension(cloudFileName)
|
||||||
return if (extension != null) getSimpleFileName(cloudFileName) + "." + extension.toLowerCase(Locale.ROOT) else cloudFileName
|
return if (extension != null) getSimpleFileName(cloudFileName) + "." + extension.lowercase() else cloudFileName
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fileInfo(name: String): FileInfo {
|
fun fileInfo(name: String): FileInfo {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user