diff options
author | Pacien TRAN-GIRARD | 2017-07-11 18:22:48 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2017-07-11 18:22:48 +0200 |
commit | a2f166f907b7c7ac6f1e0ed6ff8c0637800f6b91 (patch) | |
tree | 398bebaf42a7550600ae6c847dbe59b58f64da12 /app | |
parent | 1afc00f3f26472083d814a99f244dae39a960e34 (diff) | |
download | tincapp-a2f166f907b7c7ac6f1e0ed6ff8c0637800f6b91.tar.gz |
Fix empty list placeholder display
Diffstat (limited to 'app')
6 files changed, 24 insertions, 27 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt index 6bd845d..05f8904 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt | |||
@@ -10,6 +10,7 @@ import android.widget.AdapterView | |||
10 | import android.widget.ArrayAdapter | 10 | import android.widget.ArrayAdapter |
11 | import android.widget.TextView | 11 | import android.widget.TextView |
12 | import kotlinx.android.synthetic.main.base.* | 12 | import kotlinx.android.synthetic.main.base.* |
13 | import kotlinx.android.synthetic.main.fragment_network_list_header.* | ||
13 | import kotlinx.android.synthetic.main.page_start.* | 14 | import kotlinx.android.synthetic.main.page_start.* |
14 | import org.pacien.tincapp.R | 15 | import org.pacien.tincapp.R |
15 | import org.pacien.tincapp.context.AppPaths | 16 | import org.pacien.tincapp.context.AppPaths |
@@ -35,7 +36,6 @@ class StartActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRefr | |||
35 | network_list_wrapper.setOnRefreshListener(this) | 36 | network_list_wrapper.setOnRefreshListener(this) |
36 | network_list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_list_header, network_list, false), null, false) | 37 | network_list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_list_header, network_list, false), null, false) |
37 | network_list.addFooterView(View(this), null, false) | 38 | network_list.addFooterView(View(this), null, false) |
38 | network_list.emptyView = network_list_empty | ||
39 | network_list.adapter = networkListAdapter | 39 | network_list.adapter = networkListAdapter |
40 | network_list.onItemClickListener = this | 40 | network_list.onItemClickListener = this |
41 | } | 41 | } |
@@ -71,6 +71,7 @@ class StartActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRefr | |||
71 | val networks = AppPaths.confDir().list().toList() | 71 | val networks = AppPaths.confDir().list().toList() |
72 | runOnUiThread { | 72 | runOnUiThread { |
73 | networkListAdapter?.setElements(networks) | 73 | networkListAdapter?.setElements(networks) |
74 | network_list_placeholder.visibility = if (networkListAdapter?.isEmpty ?: true) View.VISIBLE else View.GONE | ||
74 | network_list_wrapper.isRefreshing = false | 75 | network_list_wrapper.isRefreshing = false |
75 | } | 76 | } |
76 | } | 77 | } |
diff --git a/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt index a2c39dd..0d7af6e 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt | |||
@@ -43,7 +43,6 @@ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRef | |||
43 | node_list_wrapper.setOnRefreshListener(this) | 43 | node_list_wrapper.setOnRefreshListener(this) |
44 | node_list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_status_header, node_list, false), null, false) | 44 | node_list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_status_header, node_list, false), null, false) |
45 | node_list.addFooterView(View(this), null, false) | 45 | node_list.addFooterView(View(this), null, false) |
46 | node_list.emptyView = node_list_empty | ||
47 | node_list.onItemClickListener = this | 46 | node_list.onItemClickListener = this |
48 | node_list.adapter = nodeListAdapter | 47 | node_list.adapter = nodeListAdapter |
49 | } | 48 | } |
@@ -82,6 +81,7 @@ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRef | |||
82 | getNodeNames().thenAccept { | 81 | getNodeNames().thenAccept { |
83 | runOnUiThread { | 82 | runOnUiThread { |
84 | nodeListAdapter?.setElements(it) | 83 | nodeListAdapter?.setElements(it) |
84 | node_list_placeholder.visibility = if (nodeListAdapter?.isEmpty ?: true) View.VISIBLE else View.GONE | ||
85 | node_list_wrapper.isRefreshing = false | 85 | node_list_wrapper.isRefreshing = false |
86 | if (!TincVpnService.isConnected()) openStartActivity() | 86 | if (!TincVpnService.isConnected()) openStartActivity() |
87 | } | 87 | } |
diff --git a/app/src/main/res/layout/fragment_network_list_header.xml b/app/src/main/res/layout/fragment_network_list_header.xml index 3531e3e..436cfc2 100644 --- a/app/src/main/res/layout/fragment_network_list_header.xml +++ b/app/src/main/res/layout/fragment_network_list_header.xml | |||
@@ -1,4 +1,16 @@ | |||
1 | <TextView | 1 | <LinearLayout |
2 | xmlns:android="http://schemas.android.com/apk/res/android" | 2 | xmlns:android="http://schemas.android.com/apk/res/android" |
3 | style="@style/AppTheme.SectionTitle" | 3 | android:layout_width="match_parent" |
4 | android:text="@string/title_connect_to_network"/> | 4 | android:layout_height="wrap_content" |
5 | android:orientation="vertical"> | ||
6 | |||
7 | <TextView | ||
8 | style="@style/AppTheme.SectionTitle" | ||
9 | android:text="@string/title_connect_to_network"/> | ||
10 | |||
11 | <TextView | ||
12 | android:id="@+id/network_list_placeholder" | ||
13 | style="@style/AppTheme.ListBlock.Placeholder" | ||
14 | android:text="@string/message_no_network_configuration_found"/> | ||
15 | |||
16 | </LinearLayout> | ||
diff --git a/app/src/main/res/layout/fragment_network_status_header.xml b/app/src/main/res/layout/fragment_network_status_header.xml index 947183b..cde547c 100644 --- a/app/src/main/res/layout/fragment_network_status_header.xml +++ b/app/src/main/res/layout/fragment_network_status_header.xml | |||
@@ -119,4 +119,9 @@ | |||
119 | style="@style/AppTheme.SectionTitle" | 119 | style="@style/AppTheme.SectionTitle" |
120 | android:text="@string/title_nodes"/> | 120 | android:text="@string/title_nodes"/> |
121 | 121 | ||
122 | <TextView | ||
123 | android:id="@+id/node_list_placeholder" | ||
124 | style="@style/AppTheme.ListBlock.Placeholder" | ||
125 | android:text="@string/message_no_known_node"/> | ||
126 | |||
122 | </LinearLayout> | 127 | </LinearLayout> |
diff --git a/app/src/main/res/layout/page_start.xml b/app/src/main/res/layout/page_start.xml index 68bf78f..b1bf2a4 100644 --- a/app/src/main/res/layout/page_start.xml +++ b/app/src/main/res/layout/page_start.xml | |||
@@ -15,20 +15,4 @@ | |||
15 | android:footerDividersEnabled="false" | 15 | android:footerDividersEnabled="false" |
16 | android:headerDividersEnabled="false"/> | 16 | android:headerDividersEnabled="false"/> |
17 | 17 | ||
18 | <LinearLayout | ||
19 | android:id="@+id/network_list_empty" | ||
20 | android:layout_width="match_parent" | ||
21 | android:layout_height="wrap_content" | ||
22 | android:orientation="vertical"> | ||
23 | |||
24 | <TextView | ||
25 | style="@style/AppTheme.SectionTitle" | ||
26 | android:text="@string/title_connect_to_network"/> | ||
27 | |||
28 | <TextView | ||
29 | style="@style/AppTheme.ListBlock.Placeholder" | ||
30 | android:text="@string/message_no_network_configuration_found"/> | ||
31 | |||
32 | </LinearLayout> | ||
33 | |||
34 | </android.support.v4.widget.SwipeRefreshLayout> | 18 | </android.support.v4.widget.SwipeRefreshLayout> |
diff --git a/app/src/main/res/layout/page_status.xml b/app/src/main/res/layout/page_status.xml index cd80d0b..bc68ea1 100644 --- a/app/src/main/res/layout/page_status.xml +++ b/app/src/main/res/layout/page_status.xml | |||
@@ -1,10 +1,10 @@ | |||
1 | <android.support.v4.widget.SwipeRefreshLayout | 1 | <android.support.v4.widget.SwipeRefreshLayout |
2 | xmlns:android="http://schemas.android.com/apk/res/android" | 2 | xmlns:android="http://schemas.android.com/apk/res/android" |
3 | xmlns:tools="http://schemas.android.com/tools" | 3 | xmlns:tools="http://schemas.android.com/tools" |
4 | android:id="@+id/node_list_wrapper" | ||
4 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
5 | android:layout_height="match_parent" | 6 | android:layout_height="match_parent" |
6 | android:orientation="vertical" | 7 | android:orientation="vertical" |
7 | android:id="@+id/node_list_wrapper" | ||
8 | tools:context="org.pacien.tincapp.activities.StatusActivity"> | 8 | tools:context="org.pacien.tincapp.activities.StatusActivity"> |
9 | 9 | ||
10 | <ListView | 10 | <ListView |
@@ -15,9 +15,4 @@ | |||
15 | android:footerDividersEnabled="false" | 15 | android:footerDividersEnabled="false" |
16 | android:headerDividersEnabled="false"/> | 16 | android:headerDividersEnabled="false"/> |
17 | 17 | ||
18 | <TextView | ||
19 | android:id="@+id/node_list_empty" | ||
20 | style="@style/AppTheme.ListBlock.Placeholder" | ||
21 | android:text="@string/message_no_known_node"/> | ||
22 | |||
23 | </android.support.v4.widget.SwipeRefreshLayout> | 18 | </android.support.v4.widget.SwipeRefreshLayout> |