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 --- app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt | 3 ++- app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'app/src/main/java') 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() } -- cgit v1.2.3