fragment_merchant_config.xml (10748B)
1 <?xml version="1.0" encoding="utf-8"?><!-- 2 ~ This file is part of GNU Taler 3 ~ (C) 2020 Taler Systems S.A. 4 ~ 5 ~ GNU Taler is free software; you can redistribute it and/or modify it under the 6 ~ terms of the GNU General Public License as published by the Free Software 7 ~ Foundation; either version 3, or (at your option) any later version. 8 ~ 9 ~ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY 10 ~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 ~ A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 ~ 13 ~ You should have received a copy of the GNU General Public License along with 14 ~ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 --> 16 17 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 18 xmlns:app="http://schemas.android.com/apk/res-auto" 19 android:layout_width="match_parent" 20 android:layout_height="match_parent" 21 android:fillViewport="true"> 22 23 <LinearLayout 24 android:layout_width="match_parent" 25 android:layout_height="wrap_content" 26 android:orientation="vertical"> 27 28 <!-- ─── 1) mode toggle ─────────────────────────────────────────────── --> 29 <com.google.android.material.button.MaterialButtonToggleGroup 30 android:id="@+id/configToggle" 31 android:layout_width="match_parent" 32 android:layout_height="wrap_content" 33 app:singleSelection="true" 34 android:padding="4dp" 35 app:layout_constraintTop_toTopOf="parent" 36 app:checkedButton="@id/newConfigButton"> 37 38 <Button 39 style="?attr/materialButtonOutlinedStyle" 40 android:id="@+id/qrConfigButton" 41 android:layout_width="0dp" 42 android:layout_height="wrap_content" 43 android:layout_weight="1" 44 android:text="@string/config_qr_label" /> 45 46 <Button 47 style="?attr/materialButtonOutlinedStyle" 48 android:id="@+id/newConfigButton" 49 android:layout_width="0dp" 50 android:layout_height="wrap_content" 51 android:layout_weight="1" 52 android:text="@string/config_setup_password" /> 53 </com.google.android.material.button.MaterialButtonToggleGroup> 54 55 <!-- ─── 2) QR-scanner form ──────────────────────────────── --> 56 <androidx.constraintlayout.widget.ConstraintLayout 57 android:id="@+id/qrConfigForm" 58 android:layout_width="match_parent" 59 android:layout_height="wrap_content" 60 android:padding="24dp" 61 android:visibility="gone"> 62 63 <!-- CameraX preview – now 50 % width, 60 % height --> 64 <androidx.camera.view.PreviewView 65 android:id="@+id/previewView" 66 android:layout_width="0dp" 67 android:layout_height="0dp" 68 android:scaleType="fitCenter" 69 70 app:layout_constraintWidth_percent="0.5" 71 app:layout_constraintHeight_percent="0.8" 72 73 app:layout_constraintStart_toStartOf="parent" 74 app:layout_constraintEnd_toEndOf="parent" 75 app:layout_constraintTop_toTopOf="parent" 76 app:layout_constraintBottom_toBottomOf="parent" /> 77 78 <!-- help / status text --> 79 <TextView 80 android:id="@+id/hintView" 81 style="@style/TextAppearance.Material3.BodyMedium" 82 android:layout_width="wrap_content" 83 android:layout_height="wrap_content" 84 android:layout_marginTop="16dp" 85 android:text="@string/scan_qr_hint" 86 app:layout_constraintTop_toBottomOf="@id/previewView" 87 app:layout_constraintStart_toStartOf="parent" 88 app:layout_constraintEnd_toEndOf="parent" /> 89 90 <!-- progress spinner --> 91 <ProgressBar 92 android:id="@+id/progressBarQr" 93 style="?android:attr/progressBarStyleLarge" 94 android:layout_width="wrap_content" 95 android:layout_height="wrap_content" 96 android:visibility="invisible" 97 app:layout_constraintTop_toTopOf="@id/previewView" 98 app:layout_constraintBottom_toBottomOf="@id/previewView" 99 app:layout_constraintStart_toStartOf="@id/previewView" 100 app:layout_constraintEnd_toEndOf="@id/previewView" /> 101 102 </androidx.constraintlayout.widget.ConstraintLayout> 103 104 <!-- ─── 3) Manual-token form (unchanged) ──────────────────────────── --> 105 <androidx.constraintlayout.widget.ConstraintLayout 106 android:id="@+id/newConfigForm" 107 android:layout_width="match_parent" 108 android:layout_height="wrap_content"> 109 110 <!-- Merchant-URL field --> 111 <com.google.android.material.textfield.TextInputLayout 112 android:id="@+id/merchantUrlView" 113 android:layout_width="0dp" 114 android:layout_height="wrap_content" 115 android:layout_margin="16dp" 116 android:hint="@string/config_merchant_url" 117 app:boxBackgroundMode="outline" 118 app:boxBackgroundColor="@android:color/transparent" 119 app:prefixText="https://" 120 app:layout_constraintStart_toStartOf="parent" 121 app:layout_constraintEnd_toEndOf="parent" 122 app:layout_constraintTop_toTopOf="parent"> 123 124 <com.google.android.material.textfield.TextInputEditText 125 android:layout_width="match_parent" 126 android:layout_height="wrap_content" 127 android:inputType="textUri" /> 128 </com.google.android.material.textfield.TextInputLayout> 129 130 <!-- Adding Username-URL field --> 131 <com.google.android.material.textfield.TextInputLayout 132 android:id="@+id/usernameView" 133 android:layout_width="0dp" 134 android:layout_height="wrap_content" 135 android:layout_margin="16dp" 136 android:hint="@string/config_username" 137 app:boxBackgroundMode="outline" 138 app:boxBackgroundColor="@android:color/transparent" 139 app:layout_constraintStart_toStartOf="parent" 140 app:layout_constraintEnd_toEndOf="parent" 141 app:layout_constraintTop_toBottomOf="@id/merchantUrlView"> 142 143 <com.google.android.material.textfield.TextInputEditText 144 android:layout_width="match_parent" 145 android:layout_height="wrap_content" 146 android:inputType="textUri" /> 147 </com.google.android.material.textfield.TextInputLayout> 148 149 <!-- Access-token field --> 150 <com.google.android.material.textfield.TextInputLayout 151 android:id="@+id/tokenView" 152 android:layout_width="0dp" 153 android:layout_height="wrap_content" 154 android:layout_margin="16dp" 155 android:hint="@string/config_password" 156 app:boxBackgroundMode="outline" 157 app:boxBackgroundColor="@android:color/transparent" 158 app:endIconMode="password_toggle" 159 app:layout_constraintStart_toStartOf="parent" 160 app:layout_constraintEnd_toStartOf="@+id/forgetTokenButton" 161 app:layout_constraintTop_toBottomOf="@id/usernameView"> 162 163 <com.google.android.material.textfield.TextInputEditText 164 android:layout_width="match_parent" 165 android:layout_height="wrap_content" 166 android:inputType="textWebPassword" /> 167 </com.google.android.material.textfield.TextInputLayout> 168 169 <!-- “Forget” token button --> 170 <Button 171 android:id="@+id/forgetTokenButton" 172 android:layout_width="wrap_content" 173 android:layout_height="wrap_content" 174 android:layout_margin="16dp" 175 android:text="@string/config_forget_password" 176 android:visibility="gone" 177 app:layout_constraintTop_toTopOf="@id/tokenView" 178 app:layout_constraintBottom_toBottomOf="@id/tokenView" 179 app:layout_constraintEnd_toEndOf="parent" /> 180 181 <!-- save-password checkbox --> 182 <CheckBox 183 android:id="@+id/saveTokenCheckBox" 184 android:layout_width="0dp" 185 android:layout_height="wrap_content" 186 android:layout_marginStart="16dp" 187 android:layout_marginTop="16dp" 188 android:layout_marginBottom="16dp" 189 android:checked="true" 190 android:text="@string/config_save_password" 191 app:layout_constraintStart_toStartOf="parent" 192 app:layout_constraintEnd_toStartOf="@+id/okNewButton" 193 app:layout_constraintTop_toBottomOf="@id/tokenView" 194 app:layout_constraintBottom_toBottomOf="parent" 195 app:layout_constraintHorizontal_chainStyle="spread_inside" /> 196 197 <!-- “OK” button --> 198 <com.google.android.material.button.MaterialButton 199 android:id="@+id/okNewButton" 200 android:layout_width="wrap_content" 201 android:layout_height="wrap_content" 202 android:layout_margin="16dp" 203 android:text="@string/config_ok" 204 app:layout_constraintEnd_toEndOf="parent" 205 app:layout_constraintTop_toBottomOf="@id/tokenView" 206 app:layout_constraintBottom_toBottomOf="parent" /> 207 208 <!-- progress spinner --> 209 <ProgressBar 210 android:id="@+id/progressBarNew" 211 style="?android:attr/progressBarStyle" 212 android:layout_width="wrap_content" 213 android:layout_height="wrap_content" 214 android:visibility="invisible" 215 app:layout_constraintStart_toStartOf="@id/okNewButton" 216 app:layout_constraintEnd_toEndOf="@id/okNewButton" 217 app:layout_constraintTop_toTopOf="@id/okNewButton" 218 app:layout_constraintBottom_toBottomOf="@id/okNewButton" /> 219 220 </androidx.constraintlayout.widget.ConstraintLayout> 221 222 </LinearLayout> 223 </ScrollView>