aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorpacien2018-08-19 18:14:00 +0200
committerpacien2018-08-19 18:14:00 +0200
commitdaf8d2fe48f1e2d5cef79b978ad73991bf1f0011 (patch)
treed1be2de6b91dcc6e13e1017a83bc7c70d1534521 /app/src/main
parent483e6634e0621d2100ae11cbcd8cba6d21a76c4e (diff)
downloadtincapp-daf8d2fe48f1e2d5cef79b978ad73991bf1f0011.tar.gz
Display current network name in activity action bar
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/status/NetworkInfoFragment.kt2
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/status/StatusActivity.kt3
-rw-r--r--app/src/main/res/layout/status_network_info_fragment.xml16
-rw-r--r--app/src/main/res/values/strings.xml1
4 files changed, 4 insertions, 18 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/activities/status/NetworkInfoFragment.kt b/app/src/main/java/org/pacien/tincapp/activities/status/NetworkInfoFragment.kt
index 385f996..de6f741 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/status/NetworkInfoFragment.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/status/NetworkInfoFragment.kt
@@ -31,13 +31,11 @@ import org.pacien.tincapp.service.TincVpnService
31 */ 31 */
32class NetworkInfoFragment : Fragment() { 32class NetworkInfoFragment : Fragment() {
33 private val vpnService by lazy { TincVpnService } 33 private val vpnService by lazy { TincVpnService }
34 private val netName by lazy { vpnService.getCurrentNetName() }
35 private val interfaceConfiguration by lazy { vpnService.getCurrentInterfaceCfg() } 34 private val interfaceConfiguration by lazy { vpnService.getCurrentInterfaceCfg() }
36 private val listFormatter = VpnInterfaceConfigurationFormatter 35 private val listFormatter = VpnInterfaceConfigurationFormatter
37 36
38 override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { 37 override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
39 val binding = StatusNetworkInfoFragmentBinding.inflate(inflater, container, false) 38 val binding = StatusNetworkInfoFragmentBinding.inflate(inflater, container, false)
40 binding.netName = netName
41 binding.vpnInterfaceConfiguration = interfaceConfiguration 39 binding.vpnInterfaceConfiguration = interfaceConfiguration
42 binding.listFormatter = listFormatter 40 binding.listFormatter = listFormatter
43 return binding.root 41 return binding.root
diff --git a/app/src/main/java/org/pacien/tincapp/activities/status/StatusActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/status/StatusActivity.kt
index 3125738..e5ca307 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/status/StatusActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/status/StatusActivity.kt
@@ -51,6 +51,8 @@ import kotlin.concurrent.timerTask
51 * @author pacien 51 * @author pacien
52 */ 52 */
53class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRefreshLayout.OnRefreshListener { 53class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRefreshLayout.OnRefreshListener {
54 private val vpnService by lazy { TincVpnService }
55 private val netName by lazy { vpnService.getCurrentNetName() }
54 private val broadcastMapper = BroadcastMapper(mapOf(Actions.EVENT_DISCONNECTED to this::onVpnShutdown)) 56 private val broadcastMapper = BroadcastMapper(mapOf(Actions.EVENT_DISCONNECTED to this::onVpnShutdown))
55 private var shutdownDialog: AlertDialog? = null 57 private var shutdownDialog: AlertDialog? = null
56 private var nodeListAdapter: ArrayAdapter<String>? = null 58 private var nodeListAdapter: ArrayAdapter<String>? = null
@@ -59,6 +61,7 @@ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRef
59 61
60 override fun onCreate(savedInstanceState: Bundle?) { 62 override fun onCreate(savedInstanceState: Bundle?) {
61 super.onCreate(savedInstanceState) 63 super.onCreate(savedInstanceState)
64 supportActionBar.subtitle = getString(R.string.status_activity_state_connected_to_format, netName)
62 nodeListAdapter = ArrayAdapter(this, R.layout.fragment_list_item) 65 nodeListAdapter = ArrayAdapter(this, R.layout.fragment_list_item)
63 66
64 layoutInflater.inflate(R.layout.fragment_list_view, main_content) 67 layoutInflater.inflate(R.layout.fragment_list_view, main_content)
diff --git a/app/src/main/res/layout/status_network_info_fragment.xml b/app/src/main/res/layout/status_network_info_fragment.xml
index 8038180..2dfe1bc 100644
--- a/app/src/main/res/layout/status_network_info_fragment.xml
+++ b/app/src/main/res/layout/status_network_info_fragment.xml
@@ -25,10 +25,6 @@
25 <import type="android.view.View"/> 25 <import type="android.view.View"/>
26 26
27 <variable 27 <variable
28 name="netName"
29 type="String"/>
30
31 <variable
32 name="vpnInterfaceConfiguration" 28 name="vpnInterfaceConfiguration"
33 type="org.pacien.tincapp.data.VpnInterfaceConfiguration"/> 29 type="org.pacien.tincapp.data.VpnInterfaceConfiguration"/>
34 30
@@ -44,18 +40,6 @@
44 40
45 <TextView 41 <TextView
46 style="@style/AppTheme.BlockTitle" 42 style="@style/AppTheme.BlockTitle"
47 android:text="@string/status_network_info_network_name_label"/>
48
49 <TextView
50 style="@style/AppTheme.BlockContent"
51 android:text="@{netName ?? @string/status_network_info_yes_value}"/>
52
53 </LinearLayout>
54
55 <LinearLayout style="@style/AppTheme.ListBlock">
56
57 <TextView
58 style="@style/AppTheme.BlockTitle"
59 android:text="@string/status_network_info_ip_addresses_label"/> 43 android:text="@string/status_network_info_ip_addresses_label"/>
60 44
61 <TextView 45 <TextView
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a9bf3ee..98a6905 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -112,6 +112,7 @@
112 <string name="configure_tools_private_keys_encryption_encrypting">Encrypting/decrypting private keys</string> 112 <string name="configure_tools_private_keys_encryption_encrypting">Encrypting/decrypting private keys</string>
113 113
114 <!-- Status activity --> 114 <!-- Status activity -->
115 <string name="status_activity_state_connected_to_format">Connected to %s</string>
115 <string name="status_activity_title_node_list">Nodes</string> 116 <string name="status_activity_title_node_list">Nodes</string>
116 <string name="status_activity_title_network_info">Network info</string> 117 <string name="status_activity_title_network_info">Network info</string>
117 118