Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android SDK update] Target SDK to 35 #13334

Open
wants to merge 31 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0cecbc9
Updated target SDK to 35
kidinov Jan 16, 2025
3db3d33
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Jan 17, 2025
c8eaca4
Main activity to look like before - less or more
kidinov Jan 17, 2025
1b71885
Enable edge to edge for all the activities in the app
kidinov Jan 17, 2025
eabfc03
Changed order subtitle and toolbar otherwise on some devices toolbar …
kidinov Jan 17, 2025
9688362
added comments into the empty methods so detekt is happy
kidinov Jan 17, 2025
462f3a0
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Jan 17, 2025
9807a6a
Simpulate edge to edge with using the same color as toolbar
kidinov Jan 22, 2025
63eb61f
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Jan 24, 2025
e7fca4c
Removed, assumable not used zendesk SDK's activities from the manifes…
kidinov Jan 24, 2025
fa4b9f8
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Jan 27, 2025
c395d9c
Merge pull request #13388 from woocommerce/edge-to-edge-ViewArticleAc…
kidinov Jan 28, 2025
b8b9e06
Merge pull request #13372 from woocommerce/edge-to-edge-woologviewer
kidinov Jan 29, 2025
40107f6
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Feb 3, 2025
0abbf0d
Removed unused zendesk.support.guide.HelpCenterActivity activity from…
kidinov Feb 3, 2025
91c5cf2
Edge to edge support fo the SSRActivity
kidinov Feb 3, 2025
57997e9
Fixed formatting
kidinov Feb 3, 2025
a571f9c
More idiomatic way of archiving of the same
kidinov Feb 3, 2025
faf2792
Apply top inset for UnifiedAboutScreenActivity
kidinov Feb 3, 2025
26369be
Merge pull request #13445 from woocommerce/13396-edge-to-edge-HelpCen…
kidinov Feb 4, 2025
a736794
Bottom padding so the while content is visible when scrolled up
kidinov Feb 4, 2025
83700ce
Merge pull request #13449 from woocommerce/13396-edge-to-edge-Unified…
kidinov Feb 4, 2025
e5b7107
Proper handling of the landscape mode with 3 buttons navigation for S…
kidinov Feb 4, 2025
69177b3
Proper handling of the landscape mode with 3 buttons navigation for W…
kidinov Feb 4, 2025
b7a1587
Proper handling of the landscape mode with 3 buttons navigation for S…
kidinov Feb 4, 2025
3e4f4a6
App bar background color too make it look like edge to edge
kidinov Feb 4, 2025
26ae6d9
Fixed UnifiedAboutScreenActivity to use edge-to-edge handling for nav…
kidinov Feb 4, 2025
a190860
Implement edge-to-edge handling for navigation bar in HelpActivity an…
kidinov Feb 5, 2025
c785da9
Fixed bottom padding for the lazy column in WooLogViewerScreen
kidinov Feb 5, 2025
8476d42
Merge pull request #13448 from woocommerce/13396-edged-to-edge-SSRAct…
kidinov Feb 5, 2025
bacd83c
Merge pull request #13464 from woocommerce/13463-android-sdk-revisit-…
kidinov Feb 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions WooCommerce/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
<activity
android:name=".ui.login.MagicLinkInterceptActivity"
android:exported="true"
android:theme="@style/LoginTheme">
android:theme="@style/LoginTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand All @@ -124,53 +125,51 @@
</activity>
<activity
android:name=".ui.prefs.AppSettingsActivity"
android:theme="@style/Theme.Woo.DayNight" />
android:theme="@style/Theme.Woo.DayNight"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.prefs.UnifiedAboutScreenActivity"
android:theme="@style/Theme.Woo.UnifiedAbout" />
android:theme="@style/Theme.Woo.UnifiedAbout"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".support.WooLogViewerActivity"
android:label="@string/logviewer_activity_title"
android:theme="@style/Theme.Woo.DayNight" />
android:theme="@style/Theme.Woo.DayNight"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".support.SSRActivity"
android:label="@string/support_system_status_report"
android:theme="@style/Theme.Woo.DayNight" />
android:theme="@style/Theme.Woo.DayNight"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".support.requests.SupportRequestFormActivity"
android:label="@string/support_request"
android:theme="@style/Theme.Woo.DayNight" />
android:theme="@style/Theme.Woo.DayNight"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".support.help.HelpActivity"
android:label="@string/support_help"
android:theme="@style/Theme.Woo.DayNight" />
<activity
android:name="zendesk.support.guide.HelpCenterActivity"
android:theme="@style/Theme.Woo.DayNight.Zendesk" />
<activity
android:name="zendesk.support.guide.ViewArticleActivity"
android:theme="@style/Theme.Woo.DayNight.Zendesk" />
<activity
android:name="zendesk.support.request.RequestActivity"
android:theme="@style/Theme.Woo.DayNight.Zendesk" />
<activity
android:name="zendesk.support.requestlist.RequestListActivity"
android:theme="@style/Theme.Woo.DayNight.Zendesk" />
android:theme="@style/Theme.Woo.DayNight"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="org.wordpress.android.mediapicker.ui.MediaPickerActivity"
android:theme="@style/Theme.Woo.DayNight" />
android:theme="@style/Theme.Woo.DayNight"
android:windowSoftInputMode="adjustResize" />
<!-- Make sure portrait screen orientation is not required for the installation of the app -->
<activity
android:name="com.google.mlkit.vision.codescanner.internal.GmsBarcodeScanningDelegateActivity"
android:screenOrientation="unspecified"
android:windowSoftInputMode="adjustResize"
tools:replace="android:screenOrientation" />
<activity
android:name="com.woocommerce.android.ui.woopos.root.WooPosActivity"
android:exported="false"
android:theme="@style/Theme.WooPos"
android:exported="false" />
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.woocommerce.android.ui.woopos.cardreader.WooPosCardReaderActivity"
android:theme="@style/Theme.WooPos.Transparent" />
android:theme="@style/Theme.WooPos.Transparent"
android:windowSoftInputMode="adjustResize" />

<!-- Stats today app widget -->
<meta-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import com.woocommerce.android.ui.login.AccountRepository
import com.woocommerce.android.ui.main.MainActivity
import com.woocommerce.android.ui.payments.cardreader.onboarding.CardReaderOnboardingChecker
import com.woocommerce.android.util.AppThemeUtils
import com.woocommerce.android.util.ApplicationEdgeToEdgeEnabler
import com.woocommerce.android.util.ApplicationLifecycleMonitor
import com.woocommerce.android.util.ApplicationLifecycleMonitor.ApplicationLifecycleListener
import com.woocommerce.android.util.GetWooCorePluginCachedVersion
Expand Down Expand Up @@ -160,6 +161,8 @@ class AppInitializer @Inject constructor() : ApplicationLifecycleListener {

@Inject lateinit var backgroundUpdatesDisabled: BackgroundUpdatesDisabled

@Inject lateinit var edgeToEdgeEnabler: ApplicationEdgeToEdgeEnabler

private var connectionReceiverRegistered = false

private lateinit var application: Application
Expand Down Expand Up @@ -219,6 +222,7 @@ class AppInitializer @Inject constructor() : ApplicationLifecycleListener {
val lifecycleMonitor = ApplicationLifecycleMonitor(this)
application.registerActivityLifecycleCallbacks(lifecycleMonitor)
application.registerComponentCallbacks(lifecycleMonitor)
application.registerActivityLifecycleCallbacks(edgeToEdgeEnabler)

trackStartupAnalytics()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import android.view.animation.Transformation
import android.widget.LinearLayout.LayoutParams
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.Group
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.children
import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
Expand Down Expand Up @@ -182,3 +184,19 @@ fun View.scrollStartEvents(): Flow<Unit> {
.filter { it == MotionEvent.ACTION_MOVE }
.map { }
}

fun View.edgeToEdgeHandlingForNavigationBar() {
ViewCompat.setOnApplyWindowInsetsListener(this) { v, insets ->
val systemInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemInsets.left, 0, systemInsets.right, systemInsets.bottom)
insets
}
}

fun View.edgeToEdgeHandlingForNavigationAndStatusBar() {
ViewCompat.setOnApplyWindowInsetsListener(this) { v, insets ->
val systemInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemInsets.left, systemInsets.top, systemInsets.right, systemInsets.bottom)
insets
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ package com.woocommerce.android.support
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.foundation.verticalScroll
Expand Down Expand Up @@ -58,20 +65,32 @@ fun SSRScreen(
IconButton(onClick = onCopyButtonClick, enabled = !isLoading) {
Icon(
painter = painterResource(id = R.drawable.ic_copy_white_24dp),
contentDescription = stringResource(id = R.string.support_system_status_report_copy_label),
contentDescription = stringResource(
id = R.string.support_system_status_report_copy_label
),
tint = colorResource(id = R.color.color_icon_menu),
)
}
IconButton(onClick = onShareButtonClick, enabled = !isLoading) {
Icon(
imageVector = Icons.Filled.Share,
contentDescription = stringResource(id = R.string.support_system_status_report_share_label),
contentDescription = stringResource(
id = R.string.support_system_status_report_share_label
),
tint = colorResource(id = R.color.color_icon_menu)
)
}
}
},
)
},
modifier = Modifier
.fillMaxSize()
.background(color = colorResource(id = R.color.color_toolbar))
.windowInsetsPadding(
WindowInsets.systemBars.only(
WindowInsetsSides.Start + WindowInsetsSides.Top + WindowInsetsSides.End
)
)
}
) { padding ->
val scrollState = rememberScrollState()

Expand Down Expand Up @@ -107,7 +126,13 @@ fun SSRContent(isLoading: Boolean, formattedSSR: String, modifier: Modifier) {
SelectionContainer {
Text(
text = formattedSSR,
modifier = Modifier.padding(dimensionResource(R.dimen.major_100))
modifier = Modifier
.padding(dimensionResource(R.dimen.major_100))
.padding(
WindowInsets.navigationBars
.only(WindowInsetsSides.Bottom)
.asPaddingValues()
)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class WooLogViewerActivity : AppCompatActivity() {
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name) + " " + title)
try {
startActivity(Intent.createChooser(intent, getString(R.string.share)))
} catch (ex: android.content.ActivityNotFoundException) {
} catch (_: android.content.ActivityNotFoundException) {
ToastUtils.showToast(this, R.string.logviewer_share_error)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.text.selection.SelectionContainer
Expand Down Expand Up @@ -60,9 +67,17 @@ fun WooLogViewerScreen(
tint = colorResource(id = R.color.color_icon_menu)
)
}
}
},
)
},
modifier = Modifier
.fillMaxSize()
.background(color = colorResource(id = R.color.color_toolbar))
.windowInsetsPadding(
WindowInsets.systemBars.only(
WindowInsetsSides.Start + WindowInsetsSides.Top + WindowInsetsSides.End
)
)
}
) { padding ->
LogViewerEntries(
entries,
Expand All @@ -76,7 +91,10 @@ fun LogViewerEntries(
entries: RollingLogEntries,
modifier: Modifier = Modifier
) {
LazyColumn(modifier = modifier) {
LazyColumn(
modifier = modifier,
contentPadding = WindowInsets.systemBars.only(WindowInsetsSides.Bottom).asPaddingValues()
) {
itemsIndexed(entries) { index, entry ->
LogViewerEntry(index, entry)
if (index < entries.lastIndex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.woocommerce.android.analytics.AnalyticsTracker.Companion.KEY_HELP_CON
import com.woocommerce.android.analytics.AnalyticsTracker.Companion.KEY_SOURCE_FLOW
import com.woocommerce.android.analytics.AnalyticsTracker.Companion.KEY_SOURCE_STEP
import com.woocommerce.android.databinding.ActivityHelpBinding
import com.woocommerce.android.extensions.edgeToEdgeHandlingForNavigationBar
import com.woocommerce.android.extensions.isNotNullOrEmpty
import com.woocommerce.android.extensions.serializable
import com.woocommerce.android.extensions.show
Expand Down Expand Up @@ -68,6 +69,7 @@ class HelpActivity : AppCompatActivity() {

binding = ActivityHelpBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.root.edgeToEdgeHandlingForNavigationBar()

setSupportActionBar(binding.toolbar.toolbar as Toolbar)
supportActionBar?.setHomeButtonEnabled(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.woocommerce.android.R
import com.woocommerce.android.analytics.AnalyticsEvent
import com.woocommerce.android.analytics.AnalyticsTracker
import com.woocommerce.android.databinding.ActivitySupportRequestFormBinding
import com.woocommerce.android.extensions.edgeToEdgeHandlingForNavigationBar
import com.woocommerce.android.extensions.serializable
import com.woocommerce.android.support.SupportHelper
import com.woocommerce.android.support.help.HelpOrigin
Expand Down Expand Up @@ -51,6 +52,7 @@ class SupportRequestFormActivity : AppCompatActivity() {
zendeskSettings.setup(context = this)

ActivitySupportRequestFormBinding.inflate(layoutInflater).apply {
this.root.edgeToEdgeHandlingForNavigationBar()
setContentView(root)
setupActionBar()
observeViewEvents(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ class MainActivity :

@Inject lateinit var animatorHelper: MainAnimatorHelper

@Inject lateinit var edgeToEdgeHelper: MainActivityEdgeToEdgeHelper

private val viewModel: MainActivityViewModel by viewModels()

private var unfilledOrderCount: Int = 0
Expand Down Expand Up @@ -302,7 +304,10 @@ class MainActivity :
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

edgeToEdgeHelper.applyEdgeToEdgeSettings(binding.appBarLayout)

toolbar = binding.toolbar.toolbar

setSupportActionBar(toolbar)
toolbar.navigationIcon = null

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.woocommerce.android.ui.main

import android.view.View
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import javax.inject.Inject

class MainActivityEdgeToEdgeHelper @Inject constructor() {
fun applyEdgeToEdgeSettings(viewToApplyPadding: View) {
ViewCompat.setOnApplyWindowInsetsListener(viewToApplyPadding) { v, insets ->
val innerPadding = insets.getInsets(
WindowInsetsCompat.Type.systemBars()
or WindowInsetsCompat.Type.displayCutout()
)
v.setPadding(0, innerPadding.top, 0, 0)
insets
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@ package com.woocommerce.android.ui.prefs

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentContainerView
import com.automattic.about.model.AboutConfigProvider
import com.woocommerce.android.R
import com.woocommerce.android.extensions.edgeToEdgeHandlingForNavigationAndStatusBar
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class UnifiedAboutScreenActivity : AppCompatActivity(), AboutConfigProvider {
@Inject lateinit var configBuilder: AboutConfigBuilder
@Inject
lateinit var configBuilder: AboutConfigBuilder

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.unified_about_screen_activity)

val fragmentContainer = findViewById<FragmentContainerView>(
R.id.about_fragment_container
)
fragmentContainer.edgeToEdgeHandlingForNavigationAndStatusBar()
}

override fun getAboutConfig() = configBuilder.createAboutConfig(this)
Expand Down
Loading