fragment_merchant_config.xml (14710B)
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:layout_constraintStart_toStartOf="parent" 120 app:layout_constraintEnd_toEndOf="parent" 121 app:layout_constraintTop_toTopOf="parent"> 122 123 <com.google.android.material.textfield.TextInputEditText 124 android:layout_width="match_parent" 125 android:layout_height="wrap_content" 126 android:inputType="textUri" /> 127 </com.google.android.material.textfield.TextInputLayout> 128 129 <!-- Adding Username-URL field --> 130 <com.google.android.material.textfield.TextInputLayout 131 android:id="@+id/usernameView" 132 android:layout_width="0dp" 133 android:layout_height="wrap_content" 134 android:layout_margin="16dp" 135 android:hint="@string/config_username" 136 app:boxBackgroundMode="outline" 137 app:boxBackgroundColor="@android:color/transparent" 138 app:layout_constraintStart_toStartOf="parent" 139 app:layout_constraintEnd_toEndOf="parent" 140 app:layout_constraintTop_toBottomOf="@id/merchantUrlView"> 141 142 <com.google.android.material.textfield.TextInputEditText 143 android:layout_width="match_parent" 144 android:layout_height="wrap_content" 145 android:inputType="textUri" /> 146 </com.google.android.material.textfield.TextInputLayout> 147 148 <!-- Access-token field --> 149 <com.google.android.material.textfield.TextInputLayout 150 android:id="@+id/tokenView" 151 android:layout_width="0dp" 152 android:layout_height="wrap_content" 153 android:layout_margin="16dp" 154 android:hint="@string/config_password" 155 app:boxBackgroundMode="outline" 156 app:boxBackgroundColor="@android:color/transparent" 157 app:endIconMode="password_toggle" 158 app:layout_constraintStart_toStartOf="parent" 159 app:layout_constraintEnd_toStartOf="@+id/forgetTokenButton" 160 app:layout_constraintTop_toBottomOf="@id/usernameView"> 161 162 <com.google.android.material.textfield.TextInputEditText 163 android:layout_width="match_parent" 164 android:layout_height="wrap_content" 165 android:inputType="textWebPassword" /> 166 </com.google.android.material.textfield.TextInputLayout> 167 168 <!-- “Forget” token button --> 169 <Button 170 android:id="@+id/forgetTokenButton" 171 android:layout_width="wrap_content" 172 android:layout_height="wrap_content" 173 android:layout_margin="16dp" 174 android:text="@string/config_forget_password" 175 android:visibility="gone" 176 app:layout_constraintTop_toTopOf="@id/tokenView" 177 app:layout_constraintBottom_toBottomOf="@id/tokenView" 178 app:layout_constraintEnd_toEndOf="parent" /> 179 180 <!-- ─── Expiry Section: radio buttons + conditional date/time pickers ─── --> 181 <LinearLayout 182 android:id="@+id/expirySection" 183 android:layout_width="0dp" 184 android:layout_height="wrap_content" 185 android:layout_margin="16dp" 186 android:orientation="vertical" 187 app:layout_constraintTop_toBottomOf="@id/tokenView" 188 app:layout_constraintStart_toStartOf="parent" 189 app:layout_constraintEnd_toEndOf="parent"> 190 191 <!-- Expiry options --> 192 <RadioGroup 193 android:id="@+id/expiryOptionGroup" 194 android:layout_width="match_parent" 195 android:layout_height="wrap_content" 196 android:orientation="horizontal"> 197 198 <RadioButton 199 android:id="@+id/neverExpiresOption" 200 android:layout_width="0dp" 201 android:layout_weight="1" 202 android:layout_height="wrap_content" 203 android:checked="true" 204 android:text="@string/never_expires"/> 205 206 <RadioButton 207 android:id="@+id/dateExpiresOption" 208 android:layout_width="0dp" 209 android:layout_weight="1" 210 android:layout_height="wrap_content" 211 android:text="@string/expires_on"/> 212 </RadioGroup> 213 214 <!-- Deadline picker (initially hidden) --> 215 <LinearLayout 216 android:id="@+id/deadlinePickerLayout" 217 android:layout_width="match_parent" 218 android:layout_height="wrap_content" 219 android:orientation="vertical" 220 android:visibility="gone" 221 android:layout_marginTop="8dp"> 222 223 <TextView 224 android:id="@+id/deadlineLabel" 225 android:layout_width="wrap_content" 226 android:layout_height="wrap_content" 227 android:text="@string/token_validity_deadline" 228 style="@style/TextAppearance.Material3.BodyMedium" /> 229 230 <LinearLayout 231 android:layout_width="match_parent" 232 android:layout_height="wrap_content" 233 android:orientation="horizontal" 234 android:layout_marginTop="8dp"> 235 236 <com.google.android.material.button.MaterialButton 237 style="?attr/materialButtonOutlinedStyle" 238 android:id="@+id/selectDateButton" 239 android:layout_width="0dp" 240 android:layout_weight="1" 241 android:layout_height="wrap_content" 242 android:text="@string/pick_date" /> 243 244 <com.google.android.material.button.MaterialButton 245 style="?attr/materialButtonOutlinedStyle" 246 android:id="@+id/selectTimeButton" 247 android:layout_width="0dp" 248 android:layout_weight="1" 249 android:layout_height="wrap_content" 250 android:text="@string/pick_time" /> 251 </LinearLayout> 252 253 <TextView 254 android:id="@+id/selectedDeadline" 255 android:layout_width="wrap_content" 256 android:layout_height="wrap_content" 257 android:layout_marginTop="8dp" 258 android:text="@string/no_deadline_set" 259 style="@style/TextAppearance.Material3.BodyMedium"/> 260 </LinearLayout> 261 </LinearLayout> 262 263 264 265 <!-- save-password checkbox --> 266 <CheckBox 267 android:id="@+id/saveTokenCheckBox" 268 android:layout_width="0dp" 269 android:layout_height="wrap_content" 270 android:layout_marginStart="16dp" 271 android:layout_marginTop="16dp" 272 android:layout_marginBottom="16dp" 273 android:checked="true" 274 android:text="@string/config_save_password" 275 app:layout_constraintStart_toStartOf="parent" 276 app:layout_constraintEnd_toStartOf="@+id/okNewButton" 277 app:layout_constraintTop_toBottomOf="@id/expirySection" 278 app:layout_constraintBottom_toBottomOf="parent" 279 app:layout_constraintHorizontal_chainStyle="spread_inside" /> 280 281 <!-- “OK” button --> 282 <com.google.android.material.button.MaterialButton 283 android:id="@+id/okNewButton" 284 android:layout_width="wrap_content" 285 android:layout_height="wrap_content" 286 android:layout_margin="16dp" 287 android:text="@string/config_ok" 288 app:layout_constraintEnd_toEndOf="parent" 289 app:layout_constraintTop_toBottomOf="@id/expirySection" 290 app:layout_constraintBottom_toBottomOf="parent" /> 291 292 <!-- progress spinner --> 293 <ProgressBar 294 android:id="@+id/progressBarNew" 295 style="?android:attr/progressBarStyle" 296 android:layout_width="wrap_content" 297 android:layout_height="wrap_content" 298 android:visibility="invisible" 299 app:layout_constraintStart_toStartOf="@id/okNewButton" 300 app:layout_constraintEnd_toEndOf="@id/okNewButton" 301 app:layout_constraintTop_toTopOf="@id/okNewButton" 302 app:layout_constraintBottom_toBottomOf="@id/okNewButton" /> 303 304 </androidx.constraintlayout.widget.ConstraintLayout> 305 306 </LinearLayout> 307 </ScrollView>