diff options
author | Pacien TRAN-GIRARD | 2017-07-15 11:53:43 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2017-07-15 11:53:43 +0200 |
commit | 75fb7ba17f5977b146f166412eaf39705a5f4e73 (patch) | |
tree | b7e06d28e3215e152a6018861bbf72a619a89d16 /app/src/main/java/org | |
parent | a2f166f907b7c7ac6f1e0ed6ff8c0637800f6b91 (diff) | |
download | tincapp-75fb7ba17f5977b146f166412eaf39705a5f4e73.tar.gz |
Refactor common list views
Diffstat (limited to 'app/src/main/java/org')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt | 16 | ||||
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt | 16 |
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 | |||
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_list_view.* | ||
13 | import kotlinx.android.synthetic.main.fragment_network_list_header.* | 14 | import kotlinx.android.synthetic.main.fragment_network_list_header.* |
14 | import kotlinx.android.synthetic.main.page_start.* | ||
15 | import org.pacien.tincapp.R | 15 | import org.pacien.tincapp.R |
16 | import org.pacien.tincapp.context.AppPaths | 16 | import org.pacien.tincapp.context.AppPaths |
17 | import org.pacien.tincapp.extensions.Android.setElements | 17 | import 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 | |||
13 | import java8.util.concurrent.CompletableFuture | 13 | import java8.util.concurrent.CompletableFuture |
14 | import kotlinx.android.synthetic.main.base.* | 14 | import kotlinx.android.synthetic.main.base.* |
15 | import kotlinx.android.synthetic.main.dialog_text_monopsace.view.* | 15 | import kotlinx.android.synthetic.main.dialog_text_monopsace.view.* |
16 | import kotlinx.android.synthetic.main.fragment_list_view.* | ||
16 | import kotlinx.android.synthetic.main.fragment_network_status_header.* | 17 | import kotlinx.android.synthetic.main.fragment_network_status_header.* |
17 | import kotlinx.android.synthetic.main.page_status.* | ||
18 | import org.pacien.tincapp.R | 18 | import org.pacien.tincapp.R |
19 | import org.pacien.tincapp.commands.Tinc | 19 | import org.pacien.tincapp.commands.Tinc |
20 | import org.pacien.tincapp.data.VpnInterfaceConfiguration | 20 | import 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 | } |