Skip to content

Commit b7c4ddd

Browse files
nbradburyclaude
andauthored
Update compileSdk and targetSdk to 36 (#22695)
* Update compileSdkVersion and targetSkdVersion to 36 * Fix compilation errors and deprecation warnings for SDK 36 - Fix onCheckedChanged signature: CompoundButton parameter is now non-null in SDK 36 (PrefMainSwitchToolbarView, its interface, and NotificationsSettingsActivity) - Suppress deprecated announceForAccessibility() calls across 11 files (13 call sites) — replacement with live regions is a separate effort - Replace deprecated Locale constructors with Locale.Builder in LocaleManager Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove NoEdgeToEdge opt-out for SDK 36 edge-to-edge enforcement The windowOptOutEdgeToEdgeEnforcement attribute is deprecated and ignored on SDK 36, so the NoEdgeToEdge style no longer prevents edge-to-edge. Instead, let the 6 affected activities go through BaseAppCompatActivity.applyInsetOffsets() by removing them from the exclusion list, and add ActivityLifecycleCallbacks to handle insets for Zendesk activities that don't extend BaseAppCompatActivity. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix remaining SDK 36 deprecation warnings in Java files Suppress announceForAccessibility deprecation in CommentDetailFragment, WPMainActivity, and MediaPickerUtils. Replace deprecated Locale constructor with Locale.Builder in GutenbergUtils. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Replace deprecated Configuration.locale and setLocale for SDK 36 Use getLocales() and setLocales() instead of the deprecated Configuration.locale field and setLocale() method. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix checkstyle violation: remove empty line after opening brace Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Use idiomatic Kotlin 'in' operator for activity name check Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Suppress announceForAccessibility deprecation warning in test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix invisible status bar on Zendesk screens in light mode With edge-to-edge enforced, statusBarColor is ignored and the status bar is transparent. Set windowLightStatusBar to true in the day Zendesk style so icons are dark on the light background. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Handle IME insets to prevent keyboard overlapping editors With edge-to-edge enforced, adjustResize no longer shrinks the content area automatically. Include ime() in the inset types so the decorView padding accounts for the keyboard height. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Handle IME insets for Zendesk activities to prevent keyboard overlap Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add clarifying comments from code review feedback Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8265755 commit b7c4ddd

27 files changed

Lines changed: 120 additions & 49 deletions

WordPress/src/main/AndroidManifest.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246

247247
<activity
248248
android:name=".support.SupportWebViewActivity"
249-
android:theme="@style/WordPress.NoActionBar.NoEdgeToEdge" />
249+
android:theme="@style/WordPress.NoActionBar" />
250250

251251
<!-- empty title -->
252252

@@ -314,7 +314,7 @@
314314
android:label="@string/edit_comment"/>
315315
<activity
316316
android:name=".ui.comments.CommentsDetailActivity"
317-
android:theme="@style/WordPress.NoActionBar.NoEdgeToEdge"
317+
android:theme="@style/WordPress.NoActionBar"
318318
android:windowSoftInputMode="adjustResize"
319319
android:label="@string/comments"/>
320320
<activity
@@ -327,7 +327,7 @@
327327
<activity
328328
android:name=".ui.posts.EditPostActivity"
329329
android:configChanges="locale|orientation|screenSize"
330-
android:theme="@style/WordPress.NoActionBar.NoEdgeToEdge"
330+
android:theme="@style/WordPress.NoActionBar"
331331
android:windowSoftInputMode="stateHidden|adjustResize"
332332
android:exported="false">
333333
<meta-data
@@ -869,7 +869,7 @@
869869
<activity
870870
android:name=".ui.reader.ReaderCommentListActivity"
871871
android:label="@string/reader_title_comments"
872-
android:theme="@style/WordPress.NoActionBar.NoEdgeToEdge"
872+
android:theme="@style/WordPress.NoActionBar"
873873
android:windowSoftInputMode="adjustResize|stateHidden" />
874874
<activity
875875
android:name=".ui.reader.NoSiteToReblogActivity"
@@ -883,7 +883,7 @@
883883
android:theme="@style/WordPress.NoActionBar" />
884884
<activity
885885
android:name=".ui.reader.ReaderSubsActivity"
886-
android:theme="@style/WordPress.NoActionBar.NoEdgeToEdge"
886+
android:theme="@style/WordPress.NoActionBar"
887887
android:windowSoftInputMode="stateHidden" />
888888
<activity
889889
android:name=".ui.reader.ReaderPhotoViewerActivity"
@@ -967,7 +967,7 @@
967967
<!-- Notifications activities -->
968968
<activity
969969
android:name=".ui.notifications.NotificationsDetailActivity"
970-
android:theme="@style/WordPress.NoActionBar.NoEdgeToEdge" />
970+
android:theme="@style/WordPress.NoActionBar" />
971971

972972
<!--People Management-->
973973
<activity

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package org.wordpress.android
22

33
import android.app.Application
4+
import android.os.Build
45
import coil.decode.VideoFrameDecoder
56
import com.android.volley.RequestQueue
67
import dagger.hilt.EntryPoints
78
import okhttp3.OkHttpClient
89
import org.wordpress.android.fluxc.tools.FluxCImageLoader
910
import org.wordpress.android.modules.AppComponent
11+
import org.wordpress.android.ui.main.EdgeToEdgeActivityLifecycleCallbacks
1012

1113
/**
1214
* An abstract class to be extended by {@link WordPressApp} for real application and WordPressTest for UI test
@@ -15,6 +17,15 @@ import org.wordpress.android.modules.AppComponent
1517
abstract class WordPress : Application(), coil.ImageLoaderFactory {
1618
abstract fun initializer(): AppInitializer
1719

20+
override fun onCreate() {
21+
super.onCreate()
22+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
23+
registerActivityLifecycleCallbacks(
24+
EdgeToEdgeActivityLifecycleCallbacks()
25+
)
26+
}
27+
}
28+
1829
fun component(): AppComponent = EntryPoints.get(this, AppComponent::class.java)
1930

2031
fun wordPressComSignOut() {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class ActionableEmptyView : LinearLayout {
162162
subtitle.isVisible
163163
} ?: ""
164164

165+
@Suppress("DEPRECATION")
165166
announceForAccessibility("${title.text}.$subTitle")
166167
}
167168

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,10 +1480,11 @@ private void likeComment(
14801480
.OnNoteCommentLikeChanged(mNote, actionBinding.btnLike.isActivated()));
14811481
}
14821482

1483-
actionBinding.btnLike.announceForAccessibility(
1484-
getText(actionBinding.btnLike.isActivated() ? R.string.comment_liked_talkback
1485-
: R.string.comment_unliked_talkback)
1486-
);
1483+
@SuppressWarnings("deprecation")
1484+
CharSequence announcement = getText(actionBinding.btnLike.isActivated()
1485+
? R.string.comment_liked_talkback
1486+
: R.string.comment_unliked_talkback);
1487+
actionBinding.btnLike.announceForAccessibility(announcement);
14871488
}
14881489

14891490
private void toggleLikeButton(
@@ -1667,6 +1668,7 @@ public void onCommentChanged(OnCommentChanged event) {
16671668
}
16681669
}
16691670

1671+
@SuppressWarnings("deprecation")
16701672
private void announceCommentStatusChangeForAccessibility(CommentStatus newStatus) {
16711673
int resId = -1;
16721674
switch (newStatus) {

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

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/**
2-
* This suppression is so we can include deprecated activities (CommentsDetailActivity)
3-
*/
4-
@file:Suppress("DEPRECATION")
5-
61
package org.wordpress.android.ui.main
72

83
import android.os.Build
@@ -11,11 +6,9 @@ import androidx.annotation.RequiresApi
116
import androidx.appcompat.app.AppCompatActivity
127
import androidx.core.view.ViewCompat
138
import androidx.core.view.WindowInsetsCompat
14-
import org.wordpress.android.support.SupportWebViewActivity
159
import org.wordpress.android.ui.accounts.applicationpassword.ApplicationPasswordsListActivity
1610
import org.wordpress.android.ui.blaze.blazecampaigns.BlazeCampaignParentActivity
1711
import org.wordpress.android.ui.bloggingprompts.promptslist.BloggingPromptsListActivity
18-
import org.wordpress.android.ui.comments.CommentsDetailActivity
1912
import org.wordpress.android.ui.debug.preferences.DebugSharedPreferenceFlagsActivity
2013
import org.wordpress.android.ui.domains.management.DomainManagementActivity
2114
import org.wordpress.android.ui.domains.management.newdomainsearch.NewDomainSearchActivity
@@ -27,17 +20,13 @@ import org.wordpress.android.ui.media.MediaSettingsActivity
2720
import org.wordpress.android.ui.mysite.menu.MenuActivity
2821
import org.wordpress.android.ui.mysite.personalization.PersonalizationActivity
2922
import org.wordpress.android.ui.navmenus.NavMenusActivity
30-
import org.wordpress.android.ui.notifications.NotificationsDetailActivity
31-
import org.wordpress.android.ui.posts.EditPostActivity
3223
import org.wordpress.android.ui.posts.GutenbergKitActivity
3324
import org.wordpress.android.ui.postsrs.PostRsListActivity
3425
import org.wordpress.android.ui.postsrs.PostRsSettingsActivity
3526
import org.wordpress.android.ui.postsrs.terms.TermSelectionActivity
3627
import org.wordpress.android.ui.posts.sharemessage.EditJetpackSocialShareMessageActivity
3728
import org.wordpress.android.ui.prefs.experimentalfeatures.ExperimentalFeaturesActivity
38-
import org.wordpress.android.ui.reader.ReaderCommentListActivity
3929
import org.wordpress.android.ui.reader.ReaderPostPagerActivity
40-
import org.wordpress.android.ui.reader.ReaderSubsActivity
4130
import org.wordpress.android.ui.selfhostedusers.SelfHostedUsersActivity
4231
import org.wordpress.android.ui.sitemonitor.SiteMonitorParentActivity
4332
import org.wordpress.android.ui.subscribers.SubscribersActivity
@@ -65,6 +54,7 @@ open class BaseAppCompatActivity : AppCompatActivity() {
6554
val innerPadding = insets.getInsets(
6655
WindowInsetsCompat.Type.systemBars()
6756
or WindowInsetsCompat.Type.displayCutout()
57+
or WindowInsetsCompat.Type.ime()
6858
)
6959

7060
view.setPadding(
@@ -110,20 +100,11 @@ private val excludedActivities = listOf(
110100
SubscribersActivity::class.java.name,
111101
TermsDataViewActivity::class.java.name,
112102
ApplicationPasswordsListActivity::class.java.name,
113-
SupportWebViewActivity::class.java.name,
114103

115104
// these are excluded because they explicitly enable edge-to-edge
116105
MediaSettingsActivity::class.java.name,
117106
ReaderPostPagerActivity::class.java.name,
118107

119-
// these are excluded and use the NoEdgeToEdge style to avoid the keyboard overlapping
120-
// their editors
121-
CommentsDetailActivity::class.java.name,
122-
EditPostActivity::class.java.name,
123-
NotificationsDetailActivity::class.java.name,
124-
ReaderCommentListActivity::class.java.name,
125-
ReaderSubsActivity::class.java.name,
126-
127108
// these are excluded because they implement custom IME inset handling for proper
128109
// keyboard management with edge-to-edge support
129110
GutenbergKitActivity::class.java.name,
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package org.wordpress.android.ui.main
2+
3+
import android.app.Activity
4+
import android.app.Application
5+
import android.os.Bundle
6+
import androidx.core.view.ViewCompat
7+
import androidx.core.view.WindowInsetsCompat
8+
9+
/**
10+
* Applies edge-to-edge inset padding to third-party activities (e.g. Zendesk)
11+
* that don't extend [BaseAppCompatActivity] and therefore don't get
12+
* inset handling from [BaseAppCompatActivity.applyInsetOffsets].
13+
*/
14+
class EdgeToEdgeActivityLifecycleCallbacks :
15+
Application.ActivityLifecycleCallbacks {
16+
// Zendesk Support SDK 5.5.3 activity class names
17+
private val targetActivities = setOf(
18+
"zendesk.support.guide.HelpCenterActivity",
19+
"zendesk.support.guide.ViewArticleActivity",
20+
"zendesk.support.request.RequestActivity",
21+
"zendesk.support.requestlist.RequestListActivity"
22+
)
23+
24+
override fun onActivityCreated(
25+
activity: Activity,
26+
savedInstanceState: Bundle?
27+
) {
28+
if (activity::class.java.name in targetActivities) {
29+
applyInsetOffsets(activity)
30+
}
31+
}
32+
33+
private fun applyInsetOffsets(activity: Activity) {
34+
ViewCompat.setOnApplyWindowInsetsListener(
35+
activity.window.decorView
36+
) { view, insets ->
37+
val padding = insets.getInsets(
38+
WindowInsetsCompat.Type.systemBars()
39+
or WindowInsetsCompat.Type.displayCutout()
40+
or WindowInsetsCompat.Type.ime()
41+
)
42+
view.setPadding(
43+
padding.left,
44+
padding.top,
45+
padding.right,
46+
padding.bottom
47+
)
48+
WindowInsetsCompat.CONSUMED
49+
}
50+
}
51+
52+
override fun onActivityStarted(activity: Activity) = Unit
53+
override fun onActivityResumed(activity: Activity) = Unit
54+
override fun onActivityPaused(activity: Activity) = Unit
55+
override fun onActivityStopped(activity: Activity) = Unit
56+
override fun onActivitySaveInstanceState(
57+
activity: Activity,
58+
outState: Bundle
59+
) = Unit
60+
override fun onActivityDestroyed(activity: Activity) = Unit
61+
}

WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,7 @@ private void popupSnackbarForCompleteUpdate() {
11401140
.show();
11411141
}
11421142

1143+
@SuppressWarnings("deprecation")
11431144
private void announceTitleForAccessibility(PageType pageType) {
11441145
getWindow().getDecorView().announceForAccessibility(mBottomNav.getContentDescriptionForPageType(pageType));
11451146
}

WordPress/src/main/java/org/wordpress/android/ui/main/emailverificationbanner/EmailVerificationBanner.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ fun EmailVerificationBanner(
6868
val announcementString = stringResource(stringRes)
6969
val view = LocalView.current
7070
LaunchedEffect(verificationState.value) {
71+
@Suppress("DEPRECATION")
7172
view.announceForAccessibility(announcementString)
7273
}
7374
}

WordPress/src/main/java/org/wordpress/android/ui/prefs/notifications/NotificationsSettingsActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class NotificationsSettingsActivity : BaseAppCompatActivity(), MainSwitchToolbar
120120
hideDisabledView(isMainChecked)
121121
}
122122

123-
override fun onMainSwitchCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
123+
override fun onMainSwitchCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
124124
applicationScope.launch { updateNotificationSettingsUseCase.updateNotificationSettings(isChecked) }
125125

126126
hideDisabledView(isChecked)

WordPress/src/main/java/org/wordpress/android/ui/prefs/notifications/PrefMainSwitchToolbarView.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class PrefMainSwitchToolbarView @JvmOverloads constructor(
7979
* @param buttonView The main switch whose state has changed.
8080
* @param isChecked The new checked state of main switch.
8181
*/
82-
fun onMainSwitchCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean)
82+
fun onMainSwitchCheckedChanged(buttonView: CompoundButton, isChecked: Boolean)
8383
}
8484

8585
init {
@@ -296,7 +296,7 @@ class PrefMainSwitchToolbarView @JvmOverloads constructor(
296296
/*
297297
* User toggled the main switch
298298
*/
299-
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
299+
override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
300300
setToolbarTitle(isChecked)
301301
mainSwitchToolbarListener?.onMainSwitchCheckedChanged(buttonView, isChecked)
302302
}

0 commit comments

Comments
 (0)