Skip to content

Commit 5efa74d

Browse files
authored
Merge pull request #17287 from wordpress-mobile/analysis/wordpress-main-deprecated-warnings-part-2
[Compile Warnings As Errors] WordPress Module - Resolve Deprecated Warnings - Part.2
2 parents e15fada + 4c2033a commit 5efa74d

File tree

58 files changed

+228
-196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+228
-196
lines changed

WordPress/src/debug/java/org/wordpress/android/WPWellSqlConfig.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class WPWellSqlConfig(context: Context) : WellSqlConfig(context) {
1919
* and show a toast alerting to the downgrade. The sole purpose of this is to avoid the hassle of devs switching
2020
* branches and having to clear storage and login again due to a version downgrade.
2121
*/
22+
@Suppress("DEPRECATION")
2223
override fun onDowngrade(db: SQLiteDatabase?, helper: WellTableManager?, oldVersion: Int, newVersion: Int) {
2324
if (BuildConfig.RESET_DB_ON_DOWNGRADE.toBoolean()) {
2425
// note: don't call super() here because it throws an exception

WordPress/src/jetpack/java/org/wordpress/android/ui/accounts/login/LoginPrologueFragment.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class LoginPrologueFragment : Fragment(R.layout.jetpack_login_prologue_screen) {
2727
loginPrologueListener = context
2828
}
2929

30+
@Suppress("DEPRECATION")
3031
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
3132
super.onViewCreated(view, savedInstanceState)
3233

@@ -79,7 +80,7 @@ class LoginPrologueFragment : Fragment(R.layout.jetpack_login_prologue_screen) {
7980
viewModel.onFragmentResume()
8081
}
8182

82-
@Suppress("DEPRECATION")
83+
@Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
8384
override fun onActivityCreated(savedInstanceState: Bundle?) {
8485
super.onActivityCreated(savedInstanceState)
8586
// important for accessibility - talkback
@@ -91,6 +92,7 @@ class LoginPrologueFragment : Fragment(R.layout.jetpack_login_prologue_screen) {
9192
updateSystemBars(showDarkStatusAndNavBarInLightMode = false)
9293
}
9394

95+
@Suppress("DEPRECATION")
9496
private fun updateSystemBars(showDarkStatusAndNavBarInLightMode: Boolean) {
9597
activity?.let {
9698
WPActivityUtils.setLightStatusBar(it.window, !showDarkStatusAndNavBarInLightMode)

WordPress/src/main/java/org/wordpress/android/AppInitializer.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("DEPRECATION")
2+
13
package org.wordpress.android
24

35
import android.annotation.SuppressLint
@@ -163,7 +165,7 @@ class AppInitializer @Inject constructor(
163165
lateinit var storyNotificationTrackerProvider: StoryNotificationTrackerProvider
164166
private set
165167

166-
private lateinit var credentialsClient: GoogleApiClient
168+
@Suppress("DEPRECATION") private lateinit var credentialsClient: GoogleApiClient
167169

168170
private var startDate: Long
169171

@@ -341,6 +343,7 @@ class AppInitializer @Inject constructor(
341343
}
342344
}
343345

346+
@Suppress("DEPRECATION")
344347
private fun setupCredentialsClient() {
345348
credentialsClient = GoogleApiClient.Builder(application)
346349
.addConnectionCallbacks(object : GoogleApiClient.ConnectionCallbacks {
@@ -553,6 +556,7 @@ class AppInitializer @Inject constructor(
553556
AppLog.d(T.API, "Receiving OnUnexpectedError event, message: " + event.exception.message)
554557
}
555558

559+
@Suppress("DEPRECATION")
556560
private fun removeWpComUserRelatedData(context: Context) {
557561
// cancel all Volley requests - do this before unregistering push since that uses a Volley request
558562
VolleyUtils.cancelAllRequests(requestQueue)
@@ -764,6 +768,7 @@ class AppInitializer @Inject constructor(
764768
* 1. the app starts (but it's not opened by a service or a broadcast receiver, i.e. an activity is resumed)
765769
* 2. the app was in background and is now foreground
766770
*/
771+
@Suppress("DEPRECATION")
767772
fun onAppComesFromBackground() {
768773
readerTracker.setupTrackers()
769774
AppLog.i(T.UTILS, "App comes from background")

WordPress/src/main/java/org/wordpress/android/support/ZendeskHelper.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ private fun buildZendeskTags(
475475
* could prove useful for the Happiness Engineers while debugging the users' issues.
476476
*/
477477
private fun getNetworkInformation(context: Context): String {
478-
val networkType = when (NetworkUtils.getActiveNetworkInfo(context)?.type) {
478+
@Suppress("DEPRECATION") val networkType = when (NetworkUtils.getActiveNetworkInfo(context)?.type) {
479479
ConnectivityManager.TYPE_WIFI -> ZendeskConstants.networkWifi
480480
ConnectivityManager.TYPE_MOBILE -> ZendeskConstants.networkWWAN
481481
else -> ZendeskConstants.unknownValue
@@ -486,7 +486,7 @@ private fun getNetworkInformation(context: Context): String {
486486
return listOf(
487487
"${ZendeskConstants.networkTypeLabel} $networkType",
488488
"${ZendeskConstants.networkCarrierLabel} $carrierName",
489-
"${ZendeskConstants.networkCountryCodeLabel} ${countryCodeLabel.toUpperCase(context.currentLocale)}"
489+
"${ZendeskConstants.networkCountryCodeLabel} ${countryCodeLabel.uppercase(context.currentLocale)}"
490490
).joinToString(separator = "\n")
491491
}
492492

WordPress/src/main/java/org/wordpress/android/ui/JetpackRemoteInstallFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class JetpackRemoteInstallFragment : Fragment(R.layout.jetpack_remote_install_fr
131131
})
132132
}
133133

134-
@Suppress("DEPRECATION")
134+
@Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
135135
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
136136
super.onActivityResult(requestCode, resultCode, data)
137137
if (requestCode == JETPACK_LOGIN && resultCode == Activity.RESULT_OK) {

WordPress/src/main/java/org/wordpress/android/ui/accounts/signup/SignupUtils.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ package org.wordpress.android.ui.accounts.signup
33
import java.util.Locale
44
import javax.inject.Inject
55

6-
class SignupUtils
7-
@Inject constructor() {
6+
class SignupUtils @Inject constructor() {
87
/**
98
* Create a display name from the email address by taking everything before the "@" symbol,
109
* removing all non-letters and non-periods, replacing periods with spaces, and capitalizing
@@ -18,7 +17,7 @@ class SignupUtils
1817
val builder = StringBuilder()
1918
for (item in usernameArray) {
2019
if (item.isNotEmpty()) {
21-
builder.append(item.substring(0, 1).toUpperCase(Locale.ROOT))
20+
builder.append(item.substring(0, 1).uppercase(Locale.ROOT))
2221
if (item.length > 1) {
2322
builder.append(item.substring(1))
2423
}
@@ -38,6 +37,6 @@ class SignupUtils
3837
fun createUsernameFromEmail(emailAddress: String): String? {
3938
return emailAddress.split("@".toRegex())[0]
4039
.replace("[^A-Za-z0-9]".toRegex(), "")
41-
.toLowerCase(Locale.ROOT)
40+
.lowercase(Locale.ROOT)
4241
}
4342
}

WordPress/src/main/java/org/wordpress/android/ui/activitylog/detail/ActivityLogDetailActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ActivityLogDetailActivity : LocaleAwareActivity() {
3131
return super.onOptionsItemSelected(item)
3232
}
3333

34-
@Suppress("DEPRECATION")
34+
@Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
3535
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
3636
super.onActivityResult(requestCode, resultCode, data)
3737
when (requestCode) {

WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class ActivityLogListActivity : LocaleAwareActivity(), ScrollableViewInitialized
9595
return super.onOptionsItemSelected(item)
9696
}
9797

98-
@Suppress("DEPRECATION")
98+
@Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
9999
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
100100
super.onActivityResult(requestCode, resultCode, data)
101101
when (requestCode) {

WordPress/src/main/java/org/wordpress/android/ui/bloggingreminders/DayLabelUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DayLabelUtils
2626

2727
fun buildLowercaseNTimesLabel(bloggingRemindersModel: BloggingRemindersUiModel?): String? {
2828
val counts = resourceProvider.getStringArray(R.array.blogging_reminders_count).map {
29-
it.toLowerCase(Locale.getDefault())
29+
it.lowercase(Locale.getDefault())
3030
}
3131
val size = bloggingRemindersModel?.enabledDays?.size ?: 0
3232
return counts.getOrNull(size - 1)

WordPress/src/main/java/org/wordpress/android/ui/comments/CommentDetailFragment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,7 @@ public void onPause() {
635635
}
636636

637637
@Override
638+
@SuppressWarnings("deprecation")
638639
public void onActivityResult(int requestCode, int resultCode, Intent data) {
639640
super.onActivityResult(requestCode, resultCode, data);
640641
if (requestCode == INTENT_COMMENT_EDITOR && resultCode == Activity.RESULT_OK) {

0 commit comments

Comments
 (0)