Skip to content

Commit

Permalink
fix: message composer keyboard [WPB-1848] (#2214)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas authored Sep 15, 2023
1 parent 1075431 commit faa587a
Show file tree
Hide file tree
Showing 72 changed files with 1,171 additions and 1,120 deletions.
7 changes: 6 additions & 1 deletion app/src/main/kotlin/com/wire/android/ui/WireActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand All @@ -43,8 +44,10 @@ import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.setValue
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavController
import androidx.navigation.NavHostController
Expand Down Expand Up @@ -119,6 +122,8 @@ class WireActivity : AppCompatActivity() {
proximitySensorManager.initialize()
lifecycle.addObserver(currentScreenManager)

WindowCompat.setDecorFitsSystemWindows(window, false)

viewModel.observePersistentConnectionStatus()
val startDestination = when (viewModel.initialAppState) {
InitialAppState.NOT_MIGRATED -> MigrationScreenDestination
Expand Down Expand Up @@ -154,7 +159,7 @@ class WireActivity : AppCompatActivity() {
LocalActivity provides this
) {
WireTheme {
Column {
Column(modifier = Modifier.statusBarsPadding()) {
ReportDrawnWhen { isLoaded }
val navigator = rememberNavigator(this@WireActivity::finish)
val scope = rememberCoroutineScope()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -118,7 +118,7 @@ private fun CodeContent(
) {
val focusRequester = remember { FocusRequester() }
val keyboardController = LocalSoftwareKeyboardController.current
Scaffold(topBar = {
WireScaffold(topBar = {
WireCenterAlignedTopAppBar(
elevation = 0.dp,
title = stringResource(id = state.type.titleResId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -64,6 +64,7 @@ import com.wire.android.ui.common.button.WirePrimaryButton
import com.wire.android.ui.common.error.CoreFailureErrorDialog
import com.wire.android.ui.common.rememberBottomBarElevationState
import com.wire.android.ui.common.rememberTopBarElevationState
import com.wire.android.ui.common.scaffold.WireScaffold
import com.wire.android.ui.common.textfield.WirePasswordTextField
import com.wire.android.ui.common.textfield.WireTextField
import com.wire.android.ui.common.textfield.WireTextFieldState
Expand Down Expand Up @@ -138,7 +139,7 @@ private fun DetailsContent(
serverConfig: ServerConfig.Links
) {
val scrollState = rememberScrollState()
Scaffold(
WireScaffold(
topBar = {
WireCenterAlignedTopAppBar(
elevation = scrollState.rememberTopBarElevationState().value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import androidx.compose.foundation.text.ClickableText
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -139,7 +139,7 @@ private fun EmailContent(
) {
val focusRequester = remember { FocusRequester() }

Scaffold(topBar = {
WireScaffold(topBar = {
WireCenterAlignedTopAppBar(
elevation = 0.dp,
title = stringResource(id = state.type.titleResId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -121,7 +121,7 @@ private fun OverviewContent(
overviewParams: CreateAccountOverviewParams,
serverConfig: ServerConfig.Links
) {
Scaffold(
WireScaffold(
topBar = {
WireCenterAlignedTopAppBar(
elevation = 0.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -71,7 +71,7 @@ private fun SummaryContent(
state: CreateAccountSummaryViewState,
onContinuePressed: () -> Unit
) {
Scaffold(
WireScaffold(
topBar = {
WireCenterAlignedTopAppBar(
elevation = 0.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -78,7 +78,7 @@ private fun UsernameContent(
onErrorDismiss: () -> Unit,
onUsernameErrorAnimated: () -> Unit
) {
Scaffold(
WireScaffold(
topBar = {
WireCenterAlignedTopAppBar(
elevation = 0.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -135,7 +135,7 @@ private fun RegisterDeviceContent(
cancelLoginDialogState.dismiss()
}

Scaffold(
WireScaffold(
topBar = {
WireCenterAlignedTopAppBar(
elevation = 0.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.Icon
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
Expand Down Expand Up @@ -132,7 +132,7 @@ private fun RemoveDeviceContent(
}

val lazyListState = rememberLazyListState()
Scaffold(topBar = {
WireScaffold(topBar = {
RemoveDeviceTopBar(
elevation = lazyListState.rememberTopBarElevationState().value,
onBackButtonClicked = onBackButtonClicked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -166,7 +166,7 @@ private fun MainLoginContent(
val ssoDisabledWithProxyDialogState = rememberVisibilityState<FeatureDisabledWithProxyDialogState>()
FeatureDisabledWithProxyDialogContent(dialogState = ssoDisabledWithProxyDialogState)

Scaffold(
WireScaffold(
topBar = {
WireCenterAlignedTopAppBar(
elevation = scrollState.rememberTopBarElevationState().value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand Down Expand Up @@ -124,7 +124,7 @@ private fun WelcomeContent(
val enterpriseDisabledWithProxyDialogState = rememberVisibilityState<FeatureDisabledWithProxyDialogState>()
val createPersonalAccountDisabledWithProxyDialogState = rememberVisibilityState<FeatureDisabledWithProxyDialogState>()
val context = LocalContext.current
Scaffold(topBar = {
WireScaffold(topBar = {
if (isThereActiveSession) {
WireCenterAlignedTopAppBar(
elevation = 0.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import androidx.compose.material.rememberSwipeableState
import androidx.compose.material.swipeable
import androidx.compose.material3.FabPosition
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
Expand All @@ -46,6 +45,7 @@ import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.Velocity
import com.wire.android.ui.common.scaffold.WireScaffold
import com.wire.android.ui.theme.wireDimensions
import kotlin.math.roundToInt

Expand Down Expand Up @@ -73,7 +73,6 @@ fun CollapsingTopBarScaffold(
topBarHeader: @Composable (elevation: Dp) -> Unit,
topBarCollapsing: @Composable () -> Unit,
topBarFooter: @Composable () -> Unit = {},
snackbarHost: @Composable () -> Unit = {},
content: @Composable () -> Unit,
bottomBar: @Composable () -> Unit = {},
floatingActionButton: @Composable () -> Unit = {},
Expand Down Expand Up @@ -123,9 +122,8 @@ fun CollapsingTopBarScaffold(
private fun Float.toOffset() = Offset(0f, this)
}

Scaffold(
WireScaffold(
topBar = { topBarHeader(with(LocalDensity.current) { topBarElevationState.toDp() }) },
snackbarHost = snackbarHost,
bottomBar = bottomBar,
floatingActionButton = floatingActionButton,
floatingActionButtonPosition = floatingActionButtonPosition,
Expand Down
36 changes: 0 additions & 36 deletions app/src/main/kotlin/com/wire/android/ui/common/KeyboardHelper.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import com.wire.android.ui.common.scaffold.WireScaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -62,7 +62,7 @@ fun SettingUpWireScreenContent(
message: AnnotatedString = AnnotatedString(stringResource(R.string.migration_message)),
type: SettingUpWireScreenType = SettingUpWireScreenType.Progress
) {
Scaffold(
WireScaffold(
topBar = {
WireCenterAlignedTopAppBar(
elevation = 0.dp,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Wire
* Copyright (C) 2023 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.wire.android.ui.common.bottombar

import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.unit.Dp
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

@Composable
fun BottomNavigationBarHeight(): Dp {
val insets = ViewCompat.getRootWindowInsets(LocalView.current)
val density = LocalDensity.current
val navigationBarHeight = remember(insets) {
val bottomInset = insets?.getInsets(WindowInsetsCompat.Type.navigationBars())?.bottom ?: 0
with(density) { bottomInset.toDp() }
}
return navigationBarHeight
}
Loading

0 comments on commit faa587a

Please sign in to comment.