]> git.ktnx.net Git - mobile-ledger.git/blob - app/src/main/res/layout/activity_main.xml
fix crash when new trans. is started by a shortcut for removed profile
[mobile-ledger.git] / app / src / main / res / layout / activity_main.xml
1 <?xml version="1.0" encoding="utf-8"?><!--
2   ~ Copyright © 2021 Damyan Ivanov.
3   ~ This file is part of MoLe.
4   ~ MoLe is free software: you can distribute it and/or modify it
5   ~ under the term of the GNU General Public License as published by
6   ~ the Free Software Foundation, either version 3 of the License, or
7   ~ (at your opinion), any later version.
8   ~
9   ~ MoLe is distributed in the hope that it will be useful,
10   ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
11   ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   ~ GNU General Public License terms for details.
13   ~
14   ~ You should have received a copy of the GNU General Public License
15   ~ along with MoLe. If not, see <https://www.gnu.org/licenses/>.
16   -->
17 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
18     xmlns:tools="http://schemas.android.com/tools"
19     android:layout_width="match_parent"
20     android:layout_height="match_parent"
21     tools:context=".ui.activity.MainActivity"
22     >
23
24     <ScrollView
25         android:id="@+id/no_profiles_layout"
26         android:layout_width="match_parent"
27         android:layout_height="match_parent"
28         android:background="?table_row_dark_bg"
29         android:visibility="visible"
30         >
31         <androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto"
32             android:layout_width="match_parent"
33             android:layout_height="wrap_content"
34             >
35
36             <FrameLayout
37                 android:id="@+id/welcome_header"
38                 android:layout_width="match_parent"
39                 android:layout_height="wrap_content"
40                 app:layout_constraintEnd_toEndOf="parent"
41                 app:layout_constraintStart_toStartOf="parent"
42                 app:layout_constraintTop_toTopOf="parent"
43                 >
44
45                 <include layout="@layout/nav_header_layout" />
46             </FrameLayout>
47
48             <androidx.constraintlayout.widget.ConstraintLayout
49                 android:layout_width="0dp"
50                 android:layout_height="wrap_content"
51                 android:padding="@dimen/activity_horizontal_margin"
52                 app:layout_constraintBottom_toBottomOf="parent"
53                 app:layout_constraintEnd_toEndOf="parent"
54                 app:layout_constraintStart_toStartOf="parent"
55                 app:layout_constraintTop_toBottomOf="@id/welcome_header"
56                 >
57
58                 <TextView
59                     android:id="@+id/textView"
60                     android:layout_width="wrap_content"
61                     android:layout_height="wrap_content"
62                     android:layout_marginVertical="48dp"
63                     android:text="@string/text_welcome"
64                     android:textColor="?textColor"
65                     android:textSize="48sp"
66                     app:layout_constraintBottom_toTopOf="@id/textView3"
67                     app:layout_constraintEnd_toEndOf="parent"
68                     app:layout_constraintStart_toStartOf="parent"
69                     app:layout_constraintTop_toTopOf="parent"
70                     />
71
72                 <TextView
73                     android:id="@+id/textView3"
74                     android:layout_width="wrap_content"
75                     android:layout_height="wrap_content"
76                     android:layout_marginVertical="24dp"
77                     android:layout_marginStart="8dp"
78                     android:layout_marginEnd="8dp"
79                     android:text="@string/text_welcome_profile_needed"
80                     android:textColor="?textColor"
81                     android:textSize="20sp"
82                     app:layout_constraintBottom_toTopOf="@id/btn_no_profiles_add"
83                     app:layout_constraintEnd_toEndOf="parent"
84                     app:layout_constraintStart_toStartOf="parent"
85                     app:layout_constraintTop_toBottomOf="@+id/textView"
86                     />
87
88                 <Button
89                     android:id="@+id/btn_no_profiles_add"
90                     android:layout_width="wrap_content"
91                     android:layout_height="wrap_content"
92                     android:layout_marginVertical="24dp"
93                     android:layout_marginStart="8dp"
94                     android:layout_marginEnd="8dp"
95                     android:backgroundTint="?colorSecondary"
96                     android:drawablePadding="16dp"
97                     android:text="@string/create_profile_label"
98                     android:textColor="@color/design_default_color_on_primary"
99                     app:layout_constraintBottom_toTopOf="@id/restore_hint"
100                     app:layout_constraintEnd_toEndOf="parent"
101                     app:layout_constraintStart_toStartOf="parent"
102                     app:layout_constraintTop_toBottomOf="@+id/textView3"
103                     />
104                 <TextView
105                     android:id="@+id/restore_hint"
106                     android:layout_width="wrap_content"
107                     android:layout_height="wrap_content"
108                     android:layout_marginHorizontal="8dp"
109                     android:layout_marginVertical="24dp"
110                     android:text="@string/no_profile_restore_hint"
111                     android:textColor="?textColor"
112                     android:textSize="20sp"
113                     app:layout_constraintBottom_toTopOf="@id/btn_restore"
114                     app:layout_constraintEnd_toEndOf="parent"
115                     app:layout_constraintStart_toStartOf="parent"
116                     app:layout_constraintTop_toBottomOf="@id/btn_no_profiles_add"
117                     />
118
119                 <Button
120                     android:id="@+id/btn_restore"
121                     android:layout_width="wrap_content"
122                     android:layout_height="wrap_content"
123                     android:layout_marginHorizontal="8dp"
124                     android:layout_marginVertical="24dp"
125                     android:drawableStart="@drawable/ic_baseline_restore_24"
126                     android:drawablePadding="@dimen/text_margin"
127                     android:text="@string/restore_button_label"
128                     app:layout_constraintBottom_toBottomOf="parent"
129                     app:layout_constraintEnd_toEndOf="parent"
130                     app:layout_constraintStart_toStartOf="parent"
131                     app:layout_constraintTop_toBottomOf="@id/restore_hint"
132                     />
133             </androidx.constraintlayout.widget.ConstraintLayout>
134         </androidx.constraintlayout.widget.ConstraintLayout>
135     </ScrollView>
136     <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:app="http://schemas.android.com/apk/res-auto"
137         android:id="@+id/main_app_layout"
138         android:layout_width="match_parent"
139         android:layout_height="match_parent"
140         android:background="?android:attr/colorBackground"
141         android:orientation="vertical"
142         android:visibility="gone"
143         >
144
145         <com.google.android.material.floatingactionbutton.FloatingActionButton
146             android:id="@+id/btn_add_transaction"
147             android:layout_width="wrap_content"
148             android:layout_height="wrap_content"
149             android:layout_gravity="bottom|end"
150             android:layout_margin="@dimen/fab_margin"
151             android:contentDescription="@string/new_transaction_fab_description"
152             app:backgroundTint="?colorSecondary"
153             app:layout_constraintBottom_toBottomOf="parent"
154             app:layout_constraintEnd_toEndOf="parent"
155             app:maxImageSize="36dp"
156             app:srcCompat="@drawable/ic_add_white_24dp"
157             />
158
159         <androidx.drawerlayout.widget.DrawerLayout
160             android:id="@+id/drawer_layout"
161             android:layout_width="match_parent"
162             android:layout_height="match_parent"
163             tools:openDrawer="start"
164             >
165
166             <androidx.constraintlayout.widget.ConstraintLayout
167                 android:id="@+id/pager_layout"
168                 android:layout_width="match_parent"
169                 android:layout_height="match_parent"
170                 >
171
172                 <androidx.appcompat.widget.Toolbar
173                     android:id="@+id/toolbar"
174                     android:layout_width="match_parent"
175                     android:layout_height="wrap_content"
176                     android:background="?colorPrimary"
177                     android:theme="@style/AppTheme.AppBarOverlay"
178                     app:layout_constraintEnd_toEndOf="parent"
179                     app:layout_constraintStart_toStartOf="parent"
180                     app:layout_constraintTop_toTopOf="parent"
181                     app:popupTheme="@style/AppTheme.PopupOverlay"
182                     app:subtitleTextAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle"
183                     app:titleTextAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
184                     />
185
186
187                 <LinearLayout
188                     android:id="@+id/transaction_progress_layout"
189                     android:layout_width="match_parent"
190                     android:layout_height="wrap_content"
191                     android:gravity="center_vertical"
192                     android:orientation="horizontal"
193                     android:visibility="gone"
194                     app:layout_constraintEnd_toEndOf="parent"
195                     app:layout_constraintStart_toStartOf="parent"
196                     app:layout_constraintTop_toBottomOf="@id/toolbar"
197                     >
198
199                     <ProgressBar
200                         android:id="@+id/transaction_list_progress_bar"
201                         style="?android:attr/progressBarStyleHorizontal"
202                         android:layout_width="0dp"
203                         android:layout_height="wrap_content"
204                         android:layout_marginTop="-8dp"
205                         android:layout_marginBottom="-7dp"
206                         android:layout_weight="1"
207                         android:indeterminate="true"
208                         android:min="0"
209                         android:padding="0dp"
210                         android:progressTint="?colorPrimary"
211                         app:layout_constraintEnd_toEndOf="parent"
212                         app:layout_constraintStart_toStartOf="parent"
213                         />
214
215                     <TextView
216                         android:id="@+id/transaction_list_cancel_download"
217                         android:layout_width="wrap_content"
218                         android:layout_height="wrap_content"
219                         android:background="@drawable/ic_clear_accent_24dp"
220                         android:clickable="true"
221                         android:focusable="true"
222                         />
223                 </LinearLayout>
224
225                 <androidx.viewpager2.widget.ViewPager2
226                     android:id="@+id/main_pager"
227                     android:layout_width="match_parent"
228                     android:layout_height="0dp"
229                     app:layout_constraintBottom_toBottomOf="parent"
230                     app:layout_constraintEnd_toEndOf="parent"
231                     app:layout_constraintStart_toStartOf="parent"
232                     app:layout_constraintTop_toBottomOf="@id/transaction_progress_layout"
233                     >
234
235                 </androidx.viewpager2.widget.ViewPager2>
236
237                 <View
238                     android:layout_width="0dp"
239                     android:layout_height="?attr/main_header_shadow_height"
240                     android:background="@drawable/drop_shadow"
241                     app:layout_constraintEnd_toEndOf="parent"
242                     app:layout_constraintStart_toStartOf="parent"
243                     app:layout_constraintTop_toBottomOf="@id/transaction_progress_layout"
244                     />
245
246
247             </androidx.constraintlayout.widget.ConstraintLayout>
248
249             <com.google.android.material.navigation.NavigationView xmlns:app="http://schemas.android.com/apk/res-auto"
250                 android:id="@+id/nav_view"
251                 android:layout_width="wrap_content"
252                 android:layout_height="match_parent"
253                 android:layout_gravity="start"
254                 android:fitsSystemWindows="true"
255                 >
256
257
258                 <androidx.constraintlayout.widget.ConstraintLayout
259                     android:layout_width="match_parent"
260                     android:layout_height="match_parent"
261                     android:layout_marginBottom="0dp"
262                     android:animateLayoutChanges="true"
263                     android:orientation="vertical"
264                     >
265
266                     <LinearLayout
267                         android:id="@+id/nav_fixed_items"
268                         android:layout_width="match_parent"
269                         android:layout_height="wrap_content"
270                         android:divider="@drawable/list_divider"
271                         android:elevation="2dp"
272                         android:orientation="vertical"
273                         android:showDividers="beginning"
274                         android:visibility="visible"
275                         app:layout_constraintBottom_toBottomOf="parent"
276                         >
277
278                         <TextView
279                             android:id="@+id/textView2"
280                             style="@style/nav_button"
281                             android:layout_weight="1"
282                             android:text="@string/action_settings"
283                             android:visibility="gone"
284                             app:drawableStartCompat="@drawable/ic_settings_black_24dp"
285                             />
286                         <TextView
287                             android:id="@+id/nav_backup_restore"
288                             style="@style/nav_button"
289                             android:layout_weight="1"
290                             android:text="@string/action_import_export"
291                             app:drawableStartCompat="@drawable/ic_baseline_backup_24"
292                             />
293
294                     </LinearLayout>
295
296                     <ScrollView
297                         android:layout_width="0dp"
298                         android:layout_height="0dp"
299                         app:layout_constraintBottom_toTopOf="@+id/nav_fixed_items"
300                         app:layout_constraintEnd_toEndOf="parent"
301                         app:layout_constraintLeft_toLeftOf="parent"
302                         app:layout_constraintStart_toStartOf="parent"
303                         app:layout_constraintTop_toTopOf="parent"
304                         >
305
306                         <LinearLayout
307                             android:id="@+id/nav_upper"
308                             android:layout_width="match_parent"
309                             android:layout_height="wrap_content"
310                             android:animateLayoutChanges="true"
311                             android:orientation="vertical"
312                             android:showDividers="beginning"
313                             app:layout_constraintBottom_toTopOf="@+id/nav_fixed_items"
314                             app:layout_constraintTop_toBottomOf="@+id/nav_header"
315                             >
316
317                             <include layout="@layout/nav_header_layout" />
318
319                             <LinearLayout
320                                 android:id="@+id/nav_actions"
321                                 android:layout_width="match_parent"
322                                 android:layout_height="match_parent"
323                                 android:orientation="vertical"
324                                 >
325
326                                 <TextView
327                                     android:id="@+id/nav_account_summary"
328                                     style="@style/nav_button"
329                                     android:text="@string/account_summary_title"
330                                     app:drawableStartCompat="@drawable/ic_home_black_24dp"
331                                     />
332
333                                 <TextView
334                                     android:id="@+id/nav_latest_transactions"
335                                     style="@style/nav_button"
336                                     android:text="@string/nav_transactions_title"
337                                     app:drawableStartCompat="@drawable/ic_event_note_black_24dp"
338                                     />
339
340                                 <TextView
341                                     android:id="@+id/textView5"
342                                     style="@style/nav_button"
343                                     android:text="@string/nav_reports_title"
344                                     android:visibility="gone"
345                                     app:drawableStartCompat="@drawable/ic_assignment_black_24dp"
346                                     />
347
348                                 <androidx.constraintlayout.widget.ConstraintLayout
349                                     android:id="@+id/nav_profile_list_head_layout"
350                                     android:layout_width="match_parent"
351                                     android:layout_height="@dimen/thumb_row_height"
352                                     >
353
354                                     <ImageView
355                                         android:id="@+id/nav_new_profile_button"
356                                         android:layout_width="wrap_content"
357                                         android:layout_height="wrap_content"
358                                         android:layout_gravity="center"
359                                         android:contentDescription="@string/icon"
360                                         android:paddingStart="8dp"
361                                         android:paddingEnd="8dp"
362                                         android:visibility="gone"
363                                         app:layout_constraintBottom_toBottomOf="parent"
364                                         app:layout_constraintEnd_toStartOf="@id/nav_profile_list_head_buttons"
365                                         app:layout_constraintStart_toEndOf="@id/nav_profiles_label"
366                                         app:layout_constraintTop_toTopOf="parent"
367                                         app:srcCompat="@drawable/ic_add_circle_white_24dp"
368                                         />
369
370                                     <LinearLayout
371                                         android:id="@+id/nav_profile_list_head_buttons"
372                                         android:layout_width="wrap_content"
373                                         android:layout_height="0dp"
374                                         android:gravity="center_vertical"
375                                         android:orientation="horizontal"
376                                         android:paddingStart="16dp"
377                                         android:paddingEnd="16dp"
378                                         app:layout_constraintBottom_toBottomOf="parent"
379                                         app:layout_constraintEnd_toEndOf="parent"
380                                         app:layout_constraintTop_toTopOf="parent"
381                                         >
382
383                                         <ImageView
384                                             android:id="@+id/nav_profiles_cancel_edit"
385                                             android:layout_width="wrap_content"
386                                             android:layout_height="wrap_content"
387                                             android:background="@drawable/ic_clear_accent_24dp"
388                                             android:contentDescription="@string/icon"
389                                             android:gravity="end|center_vertical"
390                                             android:paddingStart="8dp"
391                                             android:paddingEnd="8dp"
392                                             android:visibility="gone"
393                                             app:layout_constraintBottom_toBottomOf="parent"
394                                             app:layout_constraintEnd_toEndOf="parent"
395                                             app:layout_constraintTop_toTopOf="parent"
396                                             />
397
398                                         <ImageView
399                                             android:id="@+id/nav_profiles_start_edit"
400                                             android:layout_width="wrap_content"
401                                             android:layout_height="wrap_content"
402                                             android:background="@drawable/ic_settings_black_24dp"
403                                             android:contentDescription="@string/icon"
404                                             android:gravity="end|center_vertical"
405                                             android:paddingStart="8dp"
406                                             android:paddingEnd="8dp"
407                                             app:layout_constraintBottom_toBottomOf="parent"
408                                             app:layout_constraintEnd_toEndOf="parent"
409                                             app:layout_constraintTop_toTopOf="parent"
410                                             />
411
412                                     </LinearLayout>
413
414                                     <TextView
415                                         android:id="@+id/nav_profiles_label"
416                                         style="@style/nav_button"
417                                         android:layout_width="wrap_content"
418                                         android:layout_height="0dp"
419                                         android:gravity="start|center_vertical"
420                                         android:text="@string/profiles"
421                                         app:layout_constraintBottom_toBottomOf="parent"
422                                         app:layout_constraintStart_toStartOf="parent"
423                                         app:layout_constraintTop_toTopOf="parent"
424                                         />
425
426                                 </androidx.constraintlayout.widget.ConstraintLayout>
427                                 <LinearLayout
428                                     android:id="@+id/nav_profile_list_container"
429                                     android:layout_width="match_parent"
430                                     android:layout_height="wrap_content"
431                                     android:animateLayoutChanges="true"
432                                     android:nestedScrollingEnabled="false"
433                                     android:orientation="vertical"
434                                     >
435
436                                     <androidx.recyclerview.widget.RecyclerView
437                                         android:id="@+id/nav_profile_list"
438                                         android:layout_width="match_parent"
439                                         android:layout_height="wrap_content"
440                                         android:isScrollContainer="false"
441                                         android:nestedScrollingEnabled="false"
442                                         android:orientation="vertical"
443                                         >
444
445                                     </androidx.recyclerview.widget.RecyclerView>
446
447                                 </LinearLayout>
448
449                             </LinearLayout>
450                             <TextView
451                                 android:id="@+id/nav_patterns"
452                                 style="@style/nav_button"
453                                 android:text="@string/nav_templates"
454                                 app:drawableStartCompat="@drawable/ic_baseline_auto_graph_24"
455                                 />
456
457                         </LinearLayout>
458                     </ScrollView>
459
460                 </androidx.constraintlayout.widget.ConstraintLayout>
461
462             </com.google.android.material.navigation.NavigationView>
463         </androidx.drawerlayout.widget.DrawerLayout>
464     </androidx.coordinatorlayout.widget.CoordinatorLayout>
465 </FrameLayout>