summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main/res/layout/tv_activity.xml
blob: cfa1f6ba2422003845dacf4297b542a8dafc3e86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <import type="android.view.View" />

        <import type="com.wireguard.android.model.ObservableTunnel" />

        <import type="com.wireguard.android.activity.TvMainActivity.KeyedFile" />

        <variable
            name="isDeleting"
            type="androidx.databinding.ObservableBoolean" />

        <variable
            name="files"
            type="com.wireguard.android.databinding.ObservableKeyedArrayList&lt;String, KeyedFile&gt;" />

        <variable
            name="filesRoot"
            type="androidx.databinding.ObservableField&lt;String&gt;" />

        <variable
            name="tunnels"
            type="com.wireguard.android.databinding.ObservableKeyedArrayList&lt;String, ObservableTunnel&gt;" />

        <variable
            name="tunnelRowConfigurationHandler"
            type="com.wireguard.android.databinding.ObservableKeyedRecyclerViewAdapter.RowConfigurationHandler" />

        <variable
            name="filesRowConfigurationHandler"
            type="com.wireguard.android.databinding.ObservableKeyedRecyclerViewAdapter.RowConfigurationHandler" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/banner_logo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginStart="5dp"
            android:layout_marginTop="5dp"
            app:cardElevation="2dp"
            app:contentPadding="0dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <ImageView
                android:layout_width="320dp"
                android:layout_height="67dp"
                android:contentDescription="@string/app_name"
                android:scaleType="fitXY"
                app:srcCompat="@drawable/tv_logo_banner" />

        </com.google.android.material.card.MaterialCardView>

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/tunnel_list"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginTop="16dp"
            android:orientation="horizontal"
            android:visibility="@{(tunnels.isEmpty || !filesRoot.isEmpty) ? View.GONE : View.VISIBLE}"
            app:configurationHandler="@{tunnelRowConfigurationHandler}"
            app:items="@{tunnels}"
            app:layout="@{@layout/tv_tunnel_list_item}"
            app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
            app:layout_constraintBottom_toTopOf="@id/delete_button"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/banner_logo"
            app:spanCount="3"
            tools:itemCount="10"
            tools:listitem="@layout/tv_tunnel_list_item" />

        <TextView
            android:id="@+id/files_root_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginStart="8dp"
            android:text="@{filesRoot}"
            android:textAppearance="?attr/textAppearanceTitleLarge"
            android:visibility="@{filesRoot.isEmpty ? View.GONE : View.VISIBLE}"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/banner_logo"
            tools:visibility="gone" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/files_list"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginTop="16dp"
            android:orientation="horizontal"
            android:visibility="@{filesRoot.isEmpty ? View.GONE : View.VISIBLE}"
            app:configurationHandler="@{filesRowConfigurationHandler}"
            app:items="@{files}"
            app:layout="@{@layout/tv_file_list_item}"
            app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
            app:layout_constraintBottom_toTopOf="@id/import_button"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/files_root_label"
            app:spanCount="5"
            tools:itemCount="10"
            tools:listitem="@layout/tv_file_list_item"
            tools:visibility="gone" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="@string/tv_add_tunnel_get_started"
            android:textAppearance="?attr/textAppearanceHeadlineSmall"
            android:visibility="@{(filesRoot.isEmpty &amp;&amp; tunnels.isEmpty) ? View.VISIBLE : View.GONE}"
            app:layout_constraintBottom_toTopOf="@id/delete_button"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/banner_logo"
            tools:visibility="gone" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/import_button"
            style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:minWidth="0dp"
            android:visibility="@{isDeleting ? View.GONE : View.VISIBLE}"
            app:icon="@{filesRoot.isEmpty ? @drawable/ic_action_add_white : @drawable/ic_arrow_back}"
            app:iconPadding="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/delete_button"
            style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="16dp"
            android:minWidth="0dp"
            android:visibility="@{((tunnels.isEmpty &amp;&amp; !isDeleting) || !filesRoot.isEmpty) ? View.GONE : View.VISIBLE}"
            app:icon="@{isDeleting ? @drawable/ic_arrow_back : @drawable/ic_action_delete}"
            app:iconPadding="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>