Skip to content

[Android SDK update] Target SDK to 35 #13334

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

Merged
merged 169 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 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
4c14735
Fix for order creation
kidinov Feb 4, 2025
b0b5c3a
Revert "Fix for order creation"
kidinov Feb 4, 2025
5aa6cde
Apply bottom inset for all but button navigation bar, as it handles i…
kidinov Feb 4, 2025
1cc492c
Handle landscape mode too
kidinov Feb 4, 2025
3094125
Small refactoring
kidinov Feb 4, 2025
43d92e5
Removed unused param
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
ca910d0
Add edge-to-edge handling for navigation bar in AppSettingsActivity a…
kidinov Feb 5, 2025
5c1b46f
Implement edge-to-edge handling for PluginsScreen and adjust backgrou…
kidinov Feb 5, 2025
5b18e7b
Implement edge-to-edge handling for DomainDashboardScreen and adjust …
kidinov Feb 5, 2025
305f960
Add edge-to-edge handling for ThemePickerScreen and adjust toolbar ba…
kidinov Feb 5, 2025
8969f2e
Add edge-to-edge handling for FeedbackSurveyFragment and adjust toolb…
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
3ae16d0
use safe cast to enable enableEdgeToEdge
Feb 6, 2025
bacd83c
Merge pull request #13464 from woocommerce/13463-android-sdk-revisit-…
kidinov Feb 7, 2025
6095cc1
Merge branch '13270-android-sdk-update-target-sdk-to-35' into 13350-e…
kidinov Feb 7, 2025
dd90c0c
Add edge-to-edge handling for display cutout in navigation and status…
kidinov Feb 11, 2025
2c6ca9e
Merge remote-tracking branch 'origin/13350-edge-to-edge-AppSettingsAc…
kidinov Feb 11, 2025
c052c7b
Merge pull request #13460 from woocommerce/13455-android-sdk-edge-to-…
kidinov Feb 11, 2025
1a878e0
Merge branch '13270-android-sdk-update-target-sdk-to-35' into 13350-e…
kidinov Feb 11, 2025
63762cf
Refactor edge-to-edge handling in MainActivity to improve padding adj…
kidinov Feb 11, 2025
fbb6f8e
Enable edge-to-edge only for supported activities
Feb 11, 2025
8df5e6b
add documentation
Feb 12, 2025
498aa90
Merge branch '13270-android-sdk-update-target-sdk-to-35' into fix/non…
atorresveiga Feb 12, 2025
33980b6
Merge pull request #13480 from woocommerce/fix/non-component-activity…
atorresveiga Feb 13, 2025
0193da0
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Feb 13, 2025
79d018e
Merge branch '13270-android-sdk-update-target-sdk-to-35' into 13350-e…
kidinov Feb 13, 2025
d17116a
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
irfano Feb 17, 2025
3a819ea
Merge pull request #13469 from woocommerce/13350-edge-to-edge-AppSett…
kidinov Feb 18, 2025
5e78422
Fix an issue with bottom navigation insets on API < 30
hichamboushaba Feb 19, 2025
749600a
Improve handling of insets for MainView
hichamboushaba Feb 19, 2025
d703d43
Make sure to disable appBarLayout shadow when the toolbar is hidden
hichamboushaba Feb 19, 2025
565005e
Set global background color of AppBarLayout
hichamboushaba Feb 20, 2025
e5f9358
Edge to edge support for API faker UI hint
hichamboushaba Feb 19, 2025
0a4e95c
Animate API faker hint displaying
hichamboushaba Feb 19, 2025
9447787
Introduce a new extension to make working with insets easier
hichamboushaba Feb 20, 2025
76d3a4f
Simplify insets handling for AppSettings activity
hichamboushaba Feb 20, 2025
ab065d2
Revert "Add edge-to-edge handling for FeedbackSurveyFragment and adju…
hichamboushaba Feb 20, 2025
8a4b24e
Revert AppSettingsActivity Compose edge-to-edge workarounds
hichamboushaba Feb 20, 2025
5ba5514
Handle edge-to-edge layout for MagicLinkInterceptActivity
hichamboushaba Feb 20, 2025
a24d748
Simplify MainActivity edge-to-edge handling by using the new extension
hichamboushaba Feb 20, 2025
0342c64
Merge pull request #13590 from woocommerce/issue/edge-to-edge-fix-for…
hichamboushaba Feb 21, 2025
6d6c1fd
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Feb 24, 2025
7fe99cb
Merge remote-tracking branch 'origin/13270-android-sdk-update-target-…
kidinov Feb 24, 2025
3925f48
Make sure LoginActivity insets are applied always
hichamboushaba Feb 25, 2025
a0c99d0
Use the common helper function to apply default insets in LoginActivity
hichamboushaba Feb 25, 2025
569abb9
Fix handling of insets in the prologue carousel
hichamboushaba Feb 25, 2025
711dac2
Remove not needed call
hichamboushaba Feb 25, 2025
bdac0a9
Handle insets in login error screens
hichamboushaba Feb 25, 2025
c8f61f8
Handle insets in the HelpActivity in a similar way to MainActivity
hichamboushaba Feb 25, 2025
fcdd487
Force edge to edge in the login dialog fragments in all APIs
hichamboushaba Feb 25, 2025
bcc080f
Merge branch '13270-android-sdk-update-target-sdk-to-35' into issue/1…
irfano Feb 26, 2025
8ccc1c1
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
irfano Feb 26, 2025
dd745d8
Merge branch '13270-android-sdk-update-target-sdk-to-35' into issue/1…
irfano Feb 26, 2025
101343e
Merge pull request #13599 from woocommerce/issue/13350-edge-to-edge-kiwi
irfano Feb 26, 2025
2a94c61
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Feb 26, 2025
21e7c7f
Remove unused constant for date picker fragment in OrderFilterOptions…
kidinov Feb 27, 2025
b677ca9
Implement edge-to-edge handling for navigation and status bar in Orde…
kidinov Feb 27, 2025
aa3ad43
Add edge-to-edge handling for navigation and status bar in OrderFilte…
kidinov Feb 27, 2025
da20bee
Implement edge-to-edge handling for top app bar in OrderCustomerListS…
kidinov Feb 27, 2025
8226ec8
Implement edge-to-edge handling for status bar in ProductSelectorScreen
kidinov Feb 27, 2025
6e02934
Add edge-to-edge handling for navigation bars in CustomerListScreen
kidinov Feb 27, 2025
2397e88
Refactor edge-to-edge handling for navigation bars in ProductSelector…
kidinov Feb 27, 2025
03a1db3
Remove unused onCreateMenu method in OrderFilterCategoriesFragment
kidinov Feb 27, 2025
4c551d2
Add TopAppBarEdgeToEdge component and refactor usage in OrderCustomer…
kidinov Feb 27, 2025
2064dfc
Refactor UpdateProductStockStatusScreen to use TopAppBarEdgeToEdge fo…
kidinov Feb 27, 2025
86d6c1d
Refactor UpdateProductStockStatusScreen to use TopAppBarEdgeToEdge fo…
kidinov Feb 27, 2025
ccf4b4c
Refactor PrintingInstructionsFragment to implement edge-to-edge handl…
kidinov Feb 27, 2025
caf8106
Refactor VariationSelectorFragment and VariationSelectorScreen to imp…
kidinov Feb 27, 2025
60128f9
Updates robolectric version to support SDK 35
kidinov Feb 27, 2025
fa9fa64
Merge pull request #13639 from woocommerce/update-robolectic
AnirudhBhat Feb 28, 2025
8372fb4
Merge branch '13270-android-sdk-update-target-sdk-to-35' into 13631-a…
kidinov Feb 28, 2025
548e2b3
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Mar 10, 2025
51c6a58
Merge branch '13270-android-sdk-update-target-sdk-to-35' into 13631-a…
kidinov Mar 10, 2025
4385267
Enabled edge to edge for older SDK versions on the dialogs
kidinov Mar 10, 2025
3ff066f
Merge pull request #13638 from woocommerce/13631-android-sdk-revisit-…
kidinov Mar 11, 2025
8398659
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Mar 11, 2025
a617584
update picker version
Mar 18, 2025
0c972a9
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Mar 18, 2025
b777edb
Edge to edge support with appbar
kidinov Mar 18, 2025
fa8b6a0
Bottom button fully visible in landscape
kidinov Mar 18, 2025
4421037
update mediapicker commit
Mar 18, 2025
ce91f43
Merge pull request #13801 from woocommerce/13793-android-sdk-support-…
AnirudhBhat Mar 19, 2025
de8ba5c
update mediapicker version
Mar 19, 2025
c5ae37b
Merge pull request #13785 from woocommerce/issue/13396-edge-to-edge-m…
irfano Mar 19, 2025
da417a9
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Mar 20, 2025
cfb6ebf
Fix insets on login screen when keyboard is shown
malinajirka Mar 27, 2025
5c15359
Merge pull request #13858 from woocommerce/issue/13795-fix-login-flow…
malinajirka Mar 27, 2025
4e58f76
Update About Automattic library version
irfano Mar 28, 2025
cf47ca6
Fix edge-to-edge issue on System stats report screen
irfano Mar 28, 2025
cb31fb0
Fix edge-to-edge issue on the Application Log screen
irfano Mar 28, 2025
9643e46
Update about library reference
irfano Apr 2, 2025
e1556df
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Apr 3, 2025
a424afc
Added inset to to JetpackBenefitsDialog to handle insets
kidinov Apr 3, 2025
45bf6ec
Fix issue with keyboard hiding focused view
JorgeMucientes Apr 3, 2025
9b62e64
Remove unnecessary line of code
JorgeMucientes Apr 3, 2025
a6ae7a8
Move imePadding() after padding()
JorgeMucientes Apr 3, 2025
88d588e
Merge pull request #13889 from woocommerce/issue/woomob-2-scroll-when…
JorgeMucientes Apr 3, 2025
dd0d543
Update JetpackBenefitsScreen to use safeDrawing for window insets
kidinov Apr 4, 2025
c78cffa
Merge pull request #13888 from woocommerce/13796-android-sdk-jetpack-…
kidinov Apr 4, 2025
59df125
Update the Automattic About library version
irfano Apr 4, 2025
d79fd73
Merge branch '13270-android-sdk-update-target-sdk-to-35' into issue/1…
irfano Apr 4, 2025
87c179a
Merge pull request #13865 from woocommerce/issue/13799-fix-edge-to-ed…
irfano Apr 7, 2025
a417cf4
Fix AiProductPromptScreen screen's ability to scroll with keyboard
samiuelson Apr 9, 2025
5a170e2
Fix EditCouponScreen screen's ability to scroll with keyboard
samiuelson Apr 9, 2025
438d1f0
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Apr 10, 2025
4017ab0
Merge branch '13270-android-sdk-update-target-sdk-to-35' into 13798-a…
kidinov Apr 10, 2025
9320de6
Merge pull request #13910 from woocommerce/13798-android-sdk-create-p…
kidinov Apr 10, 2025
da5dd13
Merge pull request #13866 from woocommerce/issue/13799-fix-edge-to-ed…
kidinov Apr 10, 2025
6f92dc7
target SDK 34 until issue with the texts resolved
kidinov Apr 10, 2025
54e118b
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Apr 14, 2025
0ffce01
Simplified logic in ApplicationEdgeToEdgeEnabler
kidinov Apr 14, 2025
ee751d1
Fix Leak Canary crash
kidinov Apr 14, 2025
ea74e24
Use IME for inset on the main activity
kidinov Apr 15, 2025
ce4d5ed
Fixed bug when bottom padding was huge after comming back from a scre…
kidinov Apr 15, 2025
3db6df3
Merge branch '13270-android-sdk-update-target-sdk-to-35' into woomob-…
kidinov Apr 15, 2025
9eb1e58
Merge pull request #13921 from woocommerce/woomob-307-android-sdk-ret…
kidinov Apr 15, 2025
5e9db3e
Replace media picker version with a proper build number
JorgeMucientes Apr 15, 2025
e9c5193
Merge pull request #13922 from woocommerce/issue/WOOMOB-303-update-me…
kidinov Apr 16, 2025
cf4545b
Make cash payment screen scrollable
samiuelson Apr 16, 2025
a2401dd
Make email receipt screen scrollable
samiuelson Apr 16, 2025
9f81ac3
Make search screen scrollable
samiuelson Apr 16, 2025
6eb4a5c
Enhance SupportRequestFormActivity's window insets handling
JorgeMucientes Apr 16, 2025
535ac5b
Fix detekt long line
JorgeMucientes Apr 16, 2025
41e6597
Merge pull request #13925 from woocommerce/sdk-35-update-pos
malinajirka Apr 17, 2025
a98e4db
Fix NPE crash when the shown Activity is empty
hichamboushaba Apr 17, 2025
f93dd99
Merge pull request #13931 from woocommerce/android-sdk-35/fix-apifake…
malinajirka Apr 17, 2025
3debbaf
Different way of applying insets
kidinov Apr 18, 2025
6a2c2f7
Merge pull request #13929 from woocommerce/issue/android-35-ime-suppo…
kidinov Apr 18, 2025
228f70b
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Apr 18, 2025
e87a5bf
Handle ime inset in AppSettings Activity
hichamboushaba Apr 18, 2025
0bd438e
Remove calls to `imePadding` from Compose screens
hichamboushaba Apr 19, 2025
10cd018
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Apr 21, 2025
5d22185
Handle IME insets on products selector dialog fragment
hichamboushaba Apr 21, 2025
ceb5ad5
Handle insets in Customer List dialog fragment
hichamboushaba Apr 21, 2025
2671c65
Allow passing a custom windowInsets to the Toolbar composable
hichamboushaba Apr 23, 2025
91dd117
Update ProductSelectorScreen with a parameter to allow toggling off i…
hichamboushaba Apr 23, 2025
2da5637
Update OrderCustomerListScreen with a parameter to allow toggling off…
hichamboushaba Apr 23, 2025
4227178
Use the recommended TopAppBar insets
hichamboushaba Apr 23, 2025
a026cce
Merge pull request #13953 from woocommerce/android-sdk-35/fix-ime-issues
kidinov Apr 23, 2025
6ddb40e
Merge branch 'trunk' into 13270-android-sdk-update-target-sdk-to-35
kidinov Apr 23, 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
42 changes: 20 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,49 +125,46 @@
</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.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,19 +13,25 @@ import android.view.animation.Transformation
import android.widget.LinearLayout.LayoutParams
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.Group
import androidx.core.graphics.Insets
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
import androidx.core.view.updatePadding
import androidx.transition.ChangeBounds
import androidx.transition.Transition
import androidx.transition.TransitionListenerAdapter
import androidx.transition.TransitionManager
import com.google.android.material.appbar.AppBarLayout
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.map
import org.wordpress.android.util.DisplayUtils

const val EXPAND_COLLAPSE_ANIMATION_DURATION_MILLIS = 300L

Expand Down Expand Up @@ -182,3 +188,42 @@ fun View.scrollStartEvents(): Flow<Unit> {
.filter { it == MotionEvent.ACTION_MOVE }
.map { }
}

fun View.edgeToEdgeHandlingForNavigationBar() {
doOnApplyWindowInsets {
setPadding(it.left, 0, it.right, it.bottom)
}
}

fun View.edgeToEdgeForInLandscape() {
if (DisplayUtils.isLandscape(context)) {
edgeToEdgeHandlingForNavigationBar()
}
}

fun View.edgeToEdgeHandlingForNavigationAndStatusBar(appBarLayout: AppBarLayout? = null) {
doOnApplyWindowInsets(consumeInsets = true) { insets ->
updatePadding(
left = insets.left,
right = insets.right,
bottom = insets.bottom
)

if (appBarLayout != null) {
appBarLayout.updatePadding(top = insets.top)
} else {
updatePadding(top = insets.top)
}
}
}

inline fun View.doOnApplyWindowInsets(
insetsMask: Int = WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout(),
consumeInsets: Boolean = false,
crossinline action: (Insets) -> Unit
) {
ViewCompat.setOnApplyWindowInsetsListener(this) { v, insets ->
action(insets.getInsets(insetsMask))
if (consumeInsets) WindowInsetsCompat.CONSUMED else insets
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ 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.fillMaxSize
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawing
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 +63,28 @@ 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.safeDrawing.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top)),
) { padding ->
val scrollState = rememberScrollState()

Expand All @@ -84,6 +97,7 @@ fun SSRScreen(
modifier = Modifier
.background(color = MaterialTheme.colors.surface)
.verticalScroll(scrollState)
.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Bottom))
.padding(padding)
.padding(vertical = dimensionResource(id = R.dimen.major_100))
.fillMaxSize()
Expand All @@ -107,7 +121,8 @@ 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))
)
}
}
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.safeDrawing
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,13 @@ fun WooLogViewerScreen(
tint = colorResource(id = R.color.color_icon_menu)
)
}
}
},
)
}
},
modifier = Modifier
.fillMaxSize()
.background(color = colorResource(id = R.color.color_toolbar))
.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top)),
) { padding ->
LogViewerEntries(
entries,
Expand All @@ -76,7 +87,10 @@ fun LogViewerEntries(
entries: RollingLogEntries,
modifier: Modifier = Modifier
) {
LazyColumn(modifier = modifier) {
LazyColumn(
modifier = modifier,
contentPadding = WindowInsets.safeDrawing.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 @@ -8,6 +8,7 @@ import android.view.View
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.core.view.updatePadding
import com.woocommerce.android.AppPrefs
import com.woocommerce.android.AppUrls
import com.woocommerce.android.R
Expand All @@ -17,6 +18,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.doOnApplyWindowInsets
import com.woocommerce.android.extensions.isNotNullOrEmpty
import com.woocommerce.android.extensions.serializable
import com.woocommerce.android.extensions.show
Expand Down Expand Up @@ -69,6 +71,17 @@ class HelpActivity : AppCompatActivity() {
binding = ActivityHelpBinding.inflate(layoutInflater)
setContentView(binding.root)

binding.root.doOnApplyWindowInsets(consumeInsets = true) {
binding.root.updatePadding(
left = it.left,
right = it.right,
bottom = it.bottom
)
binding.appBarLayout.updatePadding(
top = it.top
)
}

setSupportActionBar(binding.toolbar.toolbar as Toolbar)
supportActionBar?.setHomeButtonEnabled(true)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import android.view.MenuItem
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding
import androidx.core.widget.doOnTextChanged
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.adjustActivityTransition
import com.woocommerce.android.extensions.doOnApplyWindowInsets
import com.woocommerce.android.extensions.serializable
import com.woocommerce.android.support.SupportHelper
import com.woocommerce.android.support.help.HelpOrigin
Expand Down Expand Up @@ -50,6 +53,21 @@ class SupportRequestFormActivity : AppCompatActivity() {
zendeskSettings.setup(context = this)

ActivitySupportRequestFormBinding.inflate(layoutInflater).apply {
this.root.doOnApplyWindowInsets(
insetsMask = WindowInsetsCompat.Type.systemBars()
or WindowInsetsCompat.Type.displayCutout()
or WindowInsetsCompat.Type.ime(),
consumeInsets = true
) { insets ->
this.root.updatePadding(
left = insets.left,
right = insets.right,
bottom = insets.bottom
)
this.appBarLayout.updatePadding(
top = insets.top
)
}
setContentView(root)
setupActionBar()
observeViewEvents(this)
Expand Down
Loading