aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/pacien
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2017-07-15 11:53:43 +0200
committerPacien TRAN-GIRARD2017-07-15 11:53:43 +0200
commit75fb7ba17f5977b146f166412eaf39705a5f4e73 (patch)
treeb7e06d28e3215e152a6018861bbf72a619a89d16 /app/src/main/java/org/pacien
parenta2f166f907b7c7ac6f1e0ed6ff8c0637800f6b91 (diff)
downloadtincapp-75fb7ba17f5977b146f166412eaf39705a5f4e73.tar.gz
Refactor common list views
Diffstat (limited to 'app/src/main/java/org/pacien')
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt16
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt16
2 files changed, 16 insertions, 16 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 05f8904..6e8ad37 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt
@@ -10,8 +10,8 @@ import android.widget.AdapterView
10import android.widget.ArrayAdapter 10import android.widget.ArrayAdapter
11import android.widget.TextView 11import android.widget.TextView
12import kotlinx.android.synthetic.main.base.* 12import kotlinx.android.synthetic.main.base.*
13import kotlinx.android.synthetic.main.fragment_list_view.*
13import kotlinx.android.synthetic.main.fragment_network_list_header.* 14import kotlinx.android.synthetic.main.fragment_network_list_header.*
14import kotlinx.android.synthetic.main.page_start.*
15import org.pacien.tincapp.R 15import org.pacien.tincapp.R
16import org.pacien.tincapp.context.AppPaths 16import org.pacien.tincapp.context.AppPaths
17import org.pacien.tincapp.extensions.Android.setElements 17import org.pacien.tincapp.extensions.Android.setElements
@@ -32,12 +32,12 @@ class StartActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRefr
32 networkListAdapter = ArrayAdapter<String>(this, R.layout.fragment_list_item) 32 networkListAdapter = ArrayAdapter<String>(this, R.layout.fragment_list_item)
33 confChangeObserver = FileObserver(AppPaths.confDir().absolutePath, FileObserver.CHANGE, { _, _ -> onRefresh() }) 33 confChangeObserver = FileObserver(AppPaths.confDir().absolutePath, FileObserver.CHANGE, { _, _ -> onRefresh() })
34 34
35 layoutInflater.inflate(R.layout.page_start, main_content) 35 layoutInflater.inflate(R.layout.fragment_list_view, main_content)
36 network_list_wrapper.setOnRefreshListener(this) 36 list_wrapper.setOnRefreshListener(this)
37 network_list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_list_header, network_list, false), null, false) 37 list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_list_header, list, false), null, false)
38 network_list.addFooterView(View(this), null, false) 38 list.addFooterView(View(this), null, false)
39 network_list.adapter = networkListAdapter 39 list.adapter = networkListAdapter
40 network_list.onItemClickListener = this 40 list.onItemClickListener = this
41 } 41 }
42 42
43 override fun onCreateOptionsMenu(m: Menu): Boolean { 43 override fun onCreateOptionsMenu(m: Menu): Boolean {
@@ -72,7 +72,7 @@ class StartActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRefr
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_placeholder.visibility = if (networkListAdapter?.isEmpty ?: true) View.VISIBLE else View.GONE
75 network_list_wrapper.isRefreshing = false 75 list_wrapper.isRefreshing = false
76 } 76 }
77 } 77 }
78 78
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 0d7af6e..6d97dca 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt
@@ -13,8 +13,8 @@ import android.widget.TextView
13import java8.util.concurrent.CompletableFuture 13import java8.util.concurrent.CompletableFuture
14import kotlinx.android.synthetic.main.base.* 14import kotlinx.android.synthetic.main.base.*
15import kotlinx.android.synthetic.main.dialog_text_monopsace.view.* 15import kotlinx.android.synthetic.main.dialog_text_monopsace.view.*
16import kotlinx.android.synthetic.main.fragment_list_view.*
16import kotlinx.android.synthetic.main.fragment_network_status_header.* 17import kotlinx.android.synthetic.main.fragment_network_status_header.*
17import kotlinx.android.synthetic.main.page_status.*
18import org.pacien.tincapp.R 18import org.pacien.tincapp.R
19import org.pacien.tincapp.commands.Tinc 19import org.pacien.tincapp.commands.Tinc
20import org.pacien.tincapp.data.VpnInterfaceConfiguration 20import org.pacien.tincapp.data.VpnInterfaceConfiguration
@@ -39,12 +39,12 @@ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRef
39 nodeListAdapter = ArrayAdapter<String>(this, R.layout.fragment_list_item) 39 nodeListAdapter = ArrayAdapter<String>(this, R.layout.fragment_list_item)
40 refreshTimer = Timer(true) 40 refreshTimer = Timer(true)
41 41
42 layoutInflater.inflate(R.layout.page_status, main_content) 42 layoutInflater.inflate(R.layout.fragment_list_view, main_content)
43 node_list_wrapper.setOnRefreshListener(this) 43 list_wrapper.setOnRefreshListener(this)
44 node_list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_status_header, node_list, false), null, false) 44 list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_status_header, list, false), null, false)
45 node_list.addFooterView(View(this), null, false) 45 list.addFooterView(View(this), null, false)
46 node_list.onItemClickListener = this 46 list.onItemClickListener = this
47 node_list.adapter = nodeListAdapter 47 list.adapter = nodeListAdapter
48 } 48 }
49 49
50 override fun onCreateOptionsMenu(m: Menu): Boolean { 50 override fun onCreateOptionsMenu(m: Menu): Boolean {
@@ -82,7 +82,7 @@ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRef
82 runOnUiThread { 82 runOnUiThread {
83 nodeListAdapter?.setElements(it) 83 nodeListAdapter?.setElements(it)
84 node_list_placeholder.visibility = if (nodeListAdapter?.isEmpty ?: true) View.VISIBLE else View.GONE 84 node_list_placeholder.visibility = if (nodeListAdapter?.isEmpty ?: true) View.VISIBLE else View.GONE
85 node_list_wrapper.isRefreshing = false 85 list_wrapper.isRefreshing = false
86 if (!TincVpnService.isConnected()) openStartActivity() 86 if (!TincVpnService.isConnected()) openStartActivity()
87 } 87 }
88 } 88 }