From a2f166f907b7c7ac6f1e0ed6ff8c0637800f6b91 Mon Sep 17 00:00:00 2001
From: Pacien TRAN-GIRARD
Date: Tue, 11 Jul 2017 18:22:48 +0200
Subject: Fix empty list placeholder display
---
.../org/pacien/tincapp/activities/StartActivity.kt | 3 ++-
.../org/pacien/tincapp/activities/StatusActivity.kt | 2 +-
.../main/res/layout/fragment_network_list_header.xml | 18 +++++++++++++++---
.../main/res/layout/fragment_network_status_header.xml | 5 +++++
app/src/main/res/layout/page_start.xml | 16 ----------------
app/src/main/res/layout/page_status.xml | 7 +------
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
import android.widget.ArrayAdapter
import android.widget.TextView
import kotlinx.android.synthetic.main.base.*
+import kotlinx.android.synthetic.main.fragment_network_list_header.*
import kotlinx.android.synthetic.main.page_start.*
import org.pacien.tincapp.R
import org.pacien.tincapp.context.AppPaths
@@ -35,7 +36,6 @@ class StartActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRefr
network_list_wrapper.setOnRefreshListener(this)
network_list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_list_header, network_list, false), null, false)
network_list.addFooterView(View(this), null, false)
- network_list.emptyView = network_list_empty
network_list.adapter = networkListAdapter
network_list.onItemClickListener = this
}
@@ -71,6 +71,7 @@ class StartActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRefr
val networks = AppPaths.confDir().list().toList()
runOnUiThread {
networkListAdapter?.setElements(networks)
+ network_list_placeholder.visibility = if (networkListAdapter?.isEmpty ?: true) View.VISIBLE else View.GONE
network_list_wrapper.isRefreshing = false
}
}
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
node_list_wrapper.setOnRefreshListener(this)
node_list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_status_header, node_list, false), null, false)
node_list.addFooterView(View(this), null, false)
- node_list.emptyView = node_list_empty
node_list.onItemClickListener = this
node_list.adapter = nodeListAdapter
}
@@ -82,6 +81,7 @@ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRef
getNodeNames().thenAccept {
runOnUiThread {
nodeListAdapter?.setElements(it)
+ node_list_placeholder.visibility = if (nodeListAdapter?.isEmpty ?: true) View.VISIBLE else View.GONE
node_list_wrapper.isRefreshing = false
if (!TincVpnService.isConnected()) openStartActivity()
}
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 @@
-
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+
+
+
+
+
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 @@
style="@style/AppTheme.SectionTitle"
android:text="@string/title_nodes"/>
+
+
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 @@
android:footerDividersEnabled="false"
android:headerDividersEnabled="false"/>
-
-
-
-
-
-
-
-
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 @@
-
-
--
cgit v1.2.3