taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

login-form-collapses-under-the-keyboard.diff (3292B)


      1 diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFragment.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFragment.kt
      2 index 99f9f91e..ae52257b 100644
      3 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFragment.kt
      4 +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFragment.kt
      5 @@ -673,14 +673,34 @@ private fun ConfigScreen(
      6                      Modifier
      7                          .widthIn(max = if (isTabletLayout) 960.dp else 640.dp)
      8                          .fillMaxSize()
      9 -                        .padding(20.dp),
     10 +                        // A phone in landscape has about 150 dp of screen left
     11 +                        // once the keyboard is up; 40 dp of it must not go on
     12 +                        // padding, or the field being typed into does not fit.
     13 +                        .padding(
     14 +                            horizontal = 20.dp,
     15 +                            vertical = if (isTabletLayout) 20.dp else 8.dp,
     16 +                        ),
     17                  verticalArrangement = Arrangement.spacedBy(16.dp),
     18              ) {
     19 -                RowButtons(
     20 -                    mode = mode,
     21 -                    onManual = { onModeChanged(ConfigMode.Manual) },
     22 -                    onQr = { onModeChanged(ConfigMode.Qr) },
     23 -                )
     24 +                val tabs: @Composable () -> Unit = {
     25 +                    RowButtons(
     26 +                        mode = mode,
     27 +                        onManual = { onModeChanged(ConfigMode.Manual) },
     28 +                        onQr = { onModeChanged(ConfigMode.Qr) },
     29 +                    )
     30 +                }
     31 +                // In Manual mode the tab row goes *inside* the form's own
     32 +                // list, so that it can scroll away.  With the keyboard up a
     33 +                // phone in landscape has about 150 dp of screen left, and a
     34 +                // tab row pinned above the form takes a third of it -- enough
     35 +                // that the field being typed into could not be brought into
     36 +                // view at all.  The QR mode has nothing to type and a camera
     37 +                // preview that wants a fixed height, so it keeps the row
     38 +                // where it was.
     39 +                if (mode != ConfigMode.Manual)
     40 +                {
     41 +                    tabs()
     42 +                }
     43                  if (mode == ConfigMode.Manual)
     44                  {
     45                      ManualConfigScreen(
     46 @@ -688,6 +708,7 @@ private fun ConfigScreen(
     47                              Modifier
     48                                  .fillMaxWidth()
     49                                  .weight(1f),
     50 +                        tabs = tabs,
     51                          merchantUrl = merchantUrl,
     52                          username = username,
     53                          token = token,
     54 @@ -790,6 +811,7 @@ private fun ConfigScreen(
     55  @Composable
     56  private fun ManualConfigScreen(
     57      modifier: Modifier,
     58 +    tabs: @Composable () -> Unit,
     59      merchantUrl: String,
     60      username: String,
     61      token: String,
     62 @@ -811,6 +833,7 @@ private fun ManualConfigScreen(
     63          state = formListState,
     64          verticalArrangement = Arrangement.spacedBy(16.dp),
     65      ) {
     66 +        item { tabs() }
     67          item {
     68              OutlinedTextField(
     69                  value = merchantUrl,