Switch from toLowercase() to lowercase() method

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2023-04-18 15:07:28 +05:30
parent c511abe712
commit 3fe0ea719e
10 changed files with 22 additions and 22 deletions

View File

@@ -66,9 +66,9 @@ fun isMIUI(): Boolean {
} }
fun isHuawei(): Boolean { fun isHuawei(): Boolean {
return Build.MANUFACTURER.toLowerCase(Locale.getDefault()).contains("huawei") return Build.MANUFACTURER.lowercase(Locale.getDefault()).contains("huawei")
|| Build.HARDWARE.toLowerCase(Locale.getDefault()).contains("kirin") || Build.HARDWARE.lowercase(Locale.getDefault()).contains("kirin")
|| Build.HARDWARE.toLowerCase(Locale.getDefault()).contains("hi3") || Build.HARDWARE.lowercase(Locale.getDefault()).contains("hi3")
} }
fun getMIUIVersion(): String { fun getMIUIVersion(): String {
@@ -102,4 +102,4 @@ fun getSystemProperty(key: String): String {
} catch (e: Exception) { } catch (e: Exception) {
"" ""
} }
} }

View File

@@ -32,7 +32,7 @@ class AC2DMTask {
params["lang"] = Locale.getDefault().toString().replace("_", "-") params["lang"] = Locale.getDefault().toString().replace("_", "-")
params["google_play_services_version"] = PLAY_SERVICES_VERSION_CODE params["google_play_services_version"] = PLAY_SERVICES_VERSION_CODE
params["sdk_version"] = BUILD_VERSION_SDK params["sdk_version"] = BUILD_VERSION_SDK
params["device_country"] = Locale.getDefault().country.toLowerCase(Locale.US) params["device_country"] = Locale.getDefault().country.lowercase(Locale.US)
params["Email"] = email params["Email"] = email
params["service"] = "ac2dm" params["service"] = "ac2dm"
params["get_accountid"] = 1 params["get_accountid"] = 1
@@ -63,4 +63,4 @@ class AC2DMTask {
private const val BUILD_VERSION_SDK = 28 private const val BUILD_VERSION_SDK = 28
private const val PLAY_SERVICES_VERSION_CODE = 19629032 private const val PLAY_SERVICES_VERSION_CODE = 19629032
} }
} }

View File

@@ -156,11 +156,11 @@ class PermissionGroup : LinearLayout {
if (label.startsWith(it)) { if (label.startsWith(it)) {
return it.replace(it, "") return it.replace(it, "")
.replace("_", " ") .replace("_", " ")
.toLowerCase(Locale.getDefault()) .lowercase(Locale.getDefault())
.capitalize(Locale.getDefault()) .capitalize(Locale.getDefault())
} }
} }
return label.capitalize(Locale.getDefault()) return label.capitalize(Locale.getDefault())
} }
} }

View File

@@ -92,7 +92,7 @@ class DownloadView : RelativeLayout {
} }
B.txtStatus.text = download.status.name B.txtStatus.text = download.status.name
.toLowerCase(Locale.getDefault()) .lowercase(Locale.getDefault())
.capitalize(Locale.getDefault()) .capitalize(Locale.getDefault())
B.txtSize.text = StringBuilder() B.txtSize.text = StringBuilder()
@@ -143,4 +143,4 @@ class DownloadView : RelativeLayout {
fun clear() { fun clear() {
B.imgDownload.clear() B.imgDownload.clear()
} }
} }

View File

@@ -63,7 +63,7 @@ class InfoView : RelativeLayout {
fun badge(info: Map.Entry<String, String>) { fun badge(info: Map.Entry<String, String>) {
B.txtTitle.text = info.key B.txtTitle.text = info.key
.replace("_", " ") .replace("_", " ")
.toLowerCase(Locale.getDefault()) .lowercase(Locale.getDefault())
.capitalize(Locale.getDefault()) .capitalize(Locale.getDefault())
B.txtSubtitle.text = info.value B.txtSubtitle.text = info.value
} }
@@ -71,4 +71,4 @@ class InfoView : RelativeLayout {
@OnViewRecycled @OnViewRecycled
fun clear() { fun clear() {
} }
} }

View File

@@ -101,9 +101,9 @@ abstract class BaseActivity : AppCompatActivity(), NetworkProvider.NetworkListen
} }
fun openStreamBrowseActivity(browseUrl: String, title: String = "") { fun openStreamBrowseActivity(browseUrl: String, title: String = "") {
val intent = if (browseUrl.toLowerCase().contains("expanded")) val intent = if (browseUrl.lowercase().contains("expanded"))
Intent(this, ExpandedStreamBrowseActivity::class.java) Intent(this, ExpandedStreamBrowseActivity::class.java)
else if (browseUrl.toLowerCase().contains("developer")) else if (browseUrl.lowercase().contains("developer"))
Intent(this, DevProfileActivity::class.java) Intent(this, DevProfileActivity::class.java)
else else
Intent(this, StreamBrowseActivity::class.java) Intent(this, StreamBrowseActivity::class.java)
@@ -181,4 +181,4 @@ abstract class BaseActivity : AppCompatActivity(), NetworkProvider.NetworkListen
NetworkProvider.removeListener(this) NetworkProvider.removeListener(this)
super.onStop() super.onStop()
} }
} }

View File

@@ -63,9 +63,9 @@ open class BaseFragment : Fragment() {
} }
fun openStreamBrowseActivity(browseUrl: String, title: String = "") { fun openStreamBrowseActivity(browseUrl: String, title: String = "") {
val intent = if (browseUrl.toLowerCase().contains("expanded")) val intent = if (browseUrl.lowercase().contains("expanded"))
Intent(requireContext(), ExpandedStreamBrowseActivity::class.java) Intent(requireContext(), ExpandedStreamBrowseActivity::class.java)
else if (browseUrl.toLowerCase().contains("developer")) else if (browseUrl.lowercase().contains("developer"))
Intent(requireContext(), DevProfileActivity::class.java) Intent(requireContext(), DevProfileActivity::class.java)
else else
Intent(requireContext(), StreamBrowseActivity::class.java) Intent(requireContext(), StreamBrowseActivity::class.java)
@@ -81,4 +81,4 @@ open class BaseFragment : Fragment() {
intent.putExtra(Constants.STRING_EXTRA, title) intent.putExtra(Constants.STRING_EXTRA, title)
startActivity(intent, requireContext().getEmptyActivityBundle()) startActivity(intent, requireContext().getEmptyActivityBundle())
} }
} }

View File

@@ -71,7 +71,7 @@ class BlacklistViewModel(application: Application) : BaseAndroidViewModel(applic
} }
blackList.add(black) blackList.add(black)
} }
liveData.postValue(blackList.sortedBy { it.displayName.toLowerCase(Locale.getDefault()) }) liveData.postValue(blackList.sortedBy { it.displayName.lowercase(Locale.getDefault()) })
requestState = RequestState.Complete requestState = RequestState.Complete
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()

View File

@@ -44,7 +44,7 @@ class InstalledViewModel(application: Application) : BaseAppsViewModel(applicati
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
try { try {
appList.flushAndAdd(getFilteredApps()) appList.flushAndAdd(getFilteredApps())
liveData.postValue(appList.sortedBy { it.displayName.toLowerCase(Locale.getDefault()) }) liveData.postValue(appList.sortedBy { it.displayName.lowercase(Locale.getDefault()) })
requestState = RequestState.Complete requestState = RequestState.Complete
} catch (e: Exception) { } catch (e: Exception) {
requestState = RequestState.Pending requestState = RequestState.Pending
@@ -79,7 +79,7 @@ class InstalledViewModel(application: Application) : BaseAppsViewModel(applicati
appList.flushAndAdd(updatedList) appList.flushAndAdd(updatedList)
//Post new update list //Post new update list
liveData.postValue(appList.sortedBy { it.displayName.toLowerCase(Locale.getDefault()) }) liveData.postValue(appList.sortedBy { it.displayName.lowercase(Locale.getDefault()) })
} }
override fun onCleared() { override fun onCleared() {

View File

@@ -70,7 +70,7 @@ class UpdatesViewModel(application: Application) : BaseAppsViewModel(application
} else { } else {
false false
} }
}.sortedBy { it.displayName.toLowerCase(Locale.getDefault()) }.also { apps -> }.sortedBy { it.displayName.lowercase(Locale.getDefault()) }.also { apps ->
updateFileMap.clear() updateFileMap.clear()
apps.forEach { apps.forEach {