From daf8d2fe48f1e2d5cef79b978ad73991bf1f0011 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 19 Aug 2018 18:14:00 +0200 Subject: Display current network name in activity action bar --- .../java/org/pacien/tincapp/activities/status/NetworkInfoFragment.kt | 2 -- .../main/java/org/pacien/tincapp/activities/status/StatusActivity.kt | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/org') 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 */ class NetworkInfoFragment : Fragment() { private val vpnService by lazy { TincVpnService } - private val netName by lazy { vpnService.getCurrentNetName() } private val interfaceConfiguration by lazy { vpnService.getCurrentInterfaceCfg() } private val listFormatter = VpnInterfaceConfigurationFormatter override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { val binding = StatusNetworkInfoFragmentBinding.inflate(inflater, container, false) - binding.netName = netName binding.vpnInterfaceConfiguration = interfaceConfiguration binding.listFormatter = listFormatter 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 * @author pacien */ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRefreshLayout.OnRefreshListener { + private val vpnService by lazy { TincVpnService } + private val netName by lazy { vpnService.getCurrentNetName() } private val broadcastMapper = BroadcastMapper(mapOf(Actions.EVENT_DISCONNECTED to this::onVpnShutdown)) private var shutdownDialog: AlertDialog? = null private var nodeListAdapter: ArrayAdapter? = null @@ -59,6 +61,7 @@ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRef override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + supportActionBar.subtitle = getString(R.string.status_activity_state_connected_to_format, netName) nodeListAdapter = ArrayAdapter(this, R.layout.fragment_list_item) layoutInflater.inflate(R.layout.fragment_list_view, main_content) -- cgit v1.2.3