Revert "For #17805 - Fix adjustResize deprecation (#18252)"

This reverts commit 38f906a6
upstream-sync
Arturo Mejia 3 years ago
parent 5c0c4117b5
commit 54db8f3fde

@ -77,7 +77,8 @@
android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize|layoutDirection|smallestScreenSize|screenLayout" android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize|layoutDirection|smallestScreenSize|screenLayout"
android:launchMode="singleTask" android:launchMode="singleTask"
android:resizeableActivity="true" android:resizeableActivity="true"
android:supportsPictureInPicture="true"> android:supportsPictureInPicture="true"
android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
@ -134,7 +135,7 @@
android:taskAffinity="" android:taskAffinity=""
android:resizeableActivity="true" android:resizeableActivity="true"
android:supportsPictureInPicture="true" android:supportsPictureInPicture="true"
android:windowSoftInputMode="stateAlwaysHidden" /> android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
<activity <activity
android:name=".IntentReceiverActivity" android:name=".IntentReceiverActivity"
@ -238,7 +239,7 @@
android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize|layoutDirection|smallestScreenSize|screenLayout" android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize|layoutDirection|smallestScreenSize|screenLayout"
android:exported="false" android:exported="false"
android:taskAffinity="" android:taskAffinity=""
android:windowSoftInputMode="stateAlwaysHidden" /> android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
<activity android:name=".settings.account.AuthIntentReceiverActivity" <activity android:name=".settings.account.AuthIntentReceiverActivity"
android:exported="false" /> android:exported="false" />

@ -77,7 +77,6 @@ import org.mozilla.fenix.exceptions.trackingprotection.TrackingProtectionExcepti
import org.mozilla.fenix.ext.alreadyOnDestination import org.mozilla.fenix.ext.alreadyOnDestination
import org.mozilla.fenix.ext.breadcrumb import org.mozilla.fenix.ext.breadcrumb
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.enableSystemInsetsHandling
import org.mozilla.fenix.ext.measureNoInline import org.mozilla.fenix.ext.measureNoInline
import org.mozilla.fenix.ext.metrics import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.nav import org.mozilla.fenix.ext.nav
@ -256,8 +255,6 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
components.core.requestInterceptor.setNavigationController(navHost.navController) components.core.requestInterceptor.setNavigationController(navHost.navController)
enableSystemInsetsHandling()
StartupTimeline.onActivityCreateEndHome(this) // DO NOT MOVE ANYTHING BELOW HERE. StartupTimeline.onActivityCreateEndHome(this) // DO NOT MOVE ANYTHING BELOW HERE.
} }

@ -5,8 +5,6 @@
package org.mozilla.fenix.customtabs package org.mozilla.fenix.customtabs
import android.content.Intent import android.content.Intent
import android.os.Bundle
import android.os.PersistableBundle
import androidx.annotation.VisibleForTesting import androidx.annotation.VisibleForTesting
import androidx.navigation.NavDestination import androidx.navigation.NavDestination
import androidx.navigation.NavDirections import androidx.navigation.NavDirections
@ -22,7 +20,6 @@ import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.NavGraphDirections import org.mozilla.fenix.NavGraphDirections
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.enableSystemInsetsHandling
import java.security.InvalidParameterException import java.security.InvalidParameterException
/** /**
@ -31,12 +28,6 @@ import java.security.InvalidParameterException
*/ */
@Suppress("TooManyFunctions") @Suppress("TooManyFunctions")
open class ExternalAppBrowserActivity : HomeActivity() { open class ExternalAppBrowserActivity : HomeActivity() {
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onCreate(savedInstanceState, persistentState)
enableSystemInsetsHandling()
}
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()

@ -5,12 +5,7 @@
package org.mozilla.fenix.ext package org.mozilla.fenix.ext
import android.app.Activity import android.app.Activity
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import android.view.View import android.view.View
import android.view.Window
import android.view.WindowInsets
import android.view.WindowInsets.Type
import android.view.WindowManager import android.view.WindowManager
import mozilla.components.concept.base.crash.Breadcrumb import mozilla.components.concept.base.crash.Breadcrumb
@ -53,43 +48,3 @@ fun Activity.breadcrumb(
) )
) )
} }
/**
* Handles inset changes for the whole activity.
*
* The deprecation of [WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE] in [VERSION_CODES.R]
* means inset changes have to be handled with a [View.OnApplyWindowInsetsListener].
* [Window.setDecorFitsSystemWindows] false tells the system that the app will handle all insets.
* When a keyboard is opened [WindowInsets.getInsets] of [Type.ime] updates accordingly.
*
* See https://github.com/mozilla-mobile/fenix/issues/17805.
* */
fun Activity.enableSystemInsetsHandling() {
if (VERSION.SDK_INT >= VERSION_CODES.R) {
val currentInsetTypes = mutableSetOf<Int>()
currentInsetTypes.add(Type.systemBars())
currentInsetTypes.add(Type.statusBars())
currentInsetTypes.add(Type.mandatorySystemGestures())
currentInsetTypes.add(Type.ime())
window.setDecorFitsSystemWindows(false)
window.decorView.setOnApplyWindowInsetsListener { v, _ ->
val currentInsetTypeMask = currentInsetTypes.fold(0) { accumulator, type ->
accumulator or type
}
val insets = window.decorView.rootWindowInsets.getInsets(currentInsetTypeMask)
v.setPadding(insets.left, insets.top, insets.right, insets.bottom)
WindowInsets.Builder()
.setInsets(currentInsetTypeMask, insets)
.build()
}
} else {
@Suppress("DEPRECATION")
window.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
)
}
}

@ -13,8 +13,7 @@ import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.graphics.Typeface import android.graphics.Typeface
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.os.Build.VERSION import android.os.Build
import android.os.Build.VERSION_CODES
import android.os.Bundle import android.os.Bundle
import android.speech.RecognizerIntent import android.speech.RecognizerIntent
import android.text.style.StyleSpan import android.text.style.StyleSpan
@ -90,8 +89,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
// https://github.com/mozilla-mobile/fenix/issues/14279 // https://github.com/mozilla-mobile/fenix/issues/14279
// To prevent GeckoView from resizing we're going to change the softInputMode to not adjust // To prevent GeckoView from resizing we're going to change the softInputMode to not adjust
// the size of the window. // the size of the window.
if (VERSION.SDK_INT < VERSION_CODES.R) requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)
requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)
// Refocus the toolbar editing and show keyboard if the QR fragment isn't showing // Refocus the toolbar editing and show keyboard if the QR fragment isn't showing
if (childFragmentManager.findFragmentByTag(QR_FRAGMENT_TAG) == null) { if (childFragmentManager.findFragmentByTag(QR_FRAGMENT_TAG) == null) {
toolbarView.view.edit.focus() toolbarView.view.edit.focus()
@ -104,8 +102,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
// Let's reset back to the default behavior after we're done searching // Let's reset back to the default behavior after we're done searching
// This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17805 // This will be addressed on https://github.com/mozilla-mobile/fenix/issues/17805
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
if (VERSION.SDK_INT < VERSION_CODES.R) requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -349,7 +346,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
private fun updateAccessibilityTraversalOrder() { private fun updateAccessibilityTraversalOrder() {
val searchWrapperId = search_wrapper.id val searchWrapperId = search_wrapper.id
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP_MR1) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
qr_scan_button.accessibilityTraversalAfter = searchWrapperId qr_scan_button.accessibilityTraversalAfter = searchWrapperId
search_engines_shortcut_button.accessibilityTraversalAfter = searchWrapperId search_engines_shortcut_button.accessibilityTraversalAfter = searchWrapperId
fill_link_from_clipboard.accessibilityTraversalAfter = searchWrapperId fill_link_from_clipboard.accessibilityTraversalAfter = searchWrapperId

@ -4,25 +4,17 @@
package org.mozilla.fenix.settings.account package org.mozilla.fenix.settings.account
import android.os.Bundle
import android.os.PersistableBundle
import mozilla.components.concept.sync.AccountObserver import mozilla.components.concept.sync.AccountObserver
import mozilla.components.concept.sync.AuthType import mozilla.components.concept.sync.AuthType
import mozilla.components.concept.sync.OAuthAccount import mozilla.components.concept.sync.OAuthAccount
import org.mozilla.fenix.customtabs.ExternalAppBrowserActivity import org.mozilla.fenix.customtabs.ExternalAppBrowserActivity
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.enableSystemInsetsHandling
/** /**
* A special custom tab for signing into a Firefox Account. The activity is closed once the user is signed in. * A special custom tab for signing into a Firefox Account. The activity is closed once the user is signed in.
*/ */
class AuthCustomTabActivity : ExternalAppBrowserActivity() { class AuthCustomTabActivity : ExternalAppBrowserActivity() {
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onCreate(savedInstanceState, persistentState)
enableSystemInsetsHandling()
}
private val accountStateObserver = object : AccountObserver { private val accountStateObserver = object : AccountObserver {
/** /**
* Navigate away from this activity when we have successful authentication * Navigate away from this activity when we have successful authentication

@ -342,6 +342,7 @@
<item name="android:windowAnimationStyle">@style/Animation.Design.BottomSheetDialog</item> <item name="android:windowAnimationStyle">@style/Animation.Design.BottomSheetDialog</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item> <item name="android:windowIsFloating">false</item>
<item name="android:windowSoftInputMode">adjustResize</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="android:windowFullscreen">false</item> <item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
@ -618,6 +619,7 @@
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item> <item name="android:windowIsFloating">false</item>
<item name="android:windowSoftInputMode">adjustResize</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="android:windowFullscreen">false</item> <item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>

Loading…
Cancel
Save