From 957826db1e46bffcd99ee52f21101728279521b9 Mon Sep 17 00:00:00 2001
From: pacien
Date: Mon, 20 Aug 2018 16:52:49 +0200
Subject: Refactor start activity
---
.../org/pacien/tincapp/activities/StartActivity.kt | 204 ---------------------
.../tincapp/activities/start/ConnectionStarter.kt | 69 +++++++
.../activities/start/NetworkListFragment.kt | 84 +++++++++
.../activities/start/NetworkListLiveData.kt | 46 +++++
.../activities/start/NetworkListViewModel.kt | 28 +++
.../tincapp/activities/start/StartActivity.kt | 117 ++++++++++++
.../tincapp/activities/status/StatusActivity.kt | 2 +-
.../activities/status/nodes/NodeListFragment.kt | 2 +-
.../org/pacien/tincapp/service/TincVpnService.kt | 2 +-
9 files changed, 347 insertions(+), 207 deletions(-)
delete mode 100644 app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt
create mode 100644 app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt
create mode 100644 app/src/main/java/org/pacien/tincapp/activities/start/NetworkListFragment.kt
create mode 100644 app/src/main/java/org/pacien/tincapp/activities/start/NetworkListLiveData.kt
create mode 100644 app/src/main/java/org/pacien/tincapp/activities/start/NetworkListViewModel.kt
create mode 100644 app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt
(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
deleted file mode 100644
index 7023316..0000000
--- a/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon
- * Copyright (C) 2017-2018 Pacien TRAN-GIRARD
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package org.pacien.tincapp.activities
-
-import android.app.Activity
-import android.content.Intent
-import android.net.VpnService
-import android.os.Bundle
-import android.support.v4.widget.SwipeRefreshLayout
-import android.support.v7.app.AlertDialog
-import android.view.Menu
-import android.view.MenuItem
-import android.view.View
-import android.widget.AdapterView
-import android.widget.ArrayAdapter
-import android.widget.TextView
-import kotlinx.android.synthetic.main.base.*
-import kotlinx.android.synthetic.main.dialog_decrypt_keys.view.*
-import kotlinx.android.synthetic.main.fragment_list_view.*
-import kotlinx.android.synthetic.main.fragment_network_list_header.*
-import org.pacien.tincapp.R
-import org.pacien.tincapp.activities.common.ProgressModal
-import org.pacien.tincapp.activities.configure.ConfigureActivity
-import org.pacien.tincapp.activities.status.StatusActivity
-import org.pacien.tincapp.context.AppPaths
-import org.pacien.tincapp.extensions.setElements
-import org.pacien.tincapp.intent.Actions
-import org.pacien.tincapp.intent.BroadcastMapper
-import org.pacien.tincapp.service.TincVpnService
-import org.pacien.tincapp.utils.TincKeyring
-
-/**
- * @author pacien
- */
-class StartActivity : BaseActivity() {
- companion object {
- private const val PERMISSION_REQUEST = 0
- }
-
- private val networkList = object : AdapterView.OnItemClickListener, SwipeRefreshLayout.OnRefreshListener {
- private var networkListAdapter: ArrayAdapter? = null
-
- fun init() {
- networkListAdapter = ArrayAdapter(this@StartActivity, R.layout.fragment_list_item)
- layoutInflater.inflate(R.layout.fragment_list_view, main_content)
- list_wrapper.setOnRefreshListener(this)
- list.addHeaderView(layoutInflater.inflate(R.layout.fragment_network_list_header, list, false), null, false)
- list.addFooterView(View(this@StartActivity), null, false)
- list.adapter = networkListAdapter
- list.onItemClickListener = this
- }
-
- fun destroy() {
- networkListAdapter = null
- }
-
- override fun onRefresh() {
- val networks = AppPaths.confDir().list()?.sorted() ?: emptyList()
- runOnUiThread {
- networkListAdapter?.setElements(networks)
- setPlaceholderVisibility()
- list_wrapper.isRefreshing = false
- }
- }
-
- override fun onItemClick(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
- connectionStarter.tryStart(netName = (view as TextView).text.toString(), displayStatus = true)
- }
-
- private fun setPlaceholderVisibility() = if (networkListAdapter?.isEmpty != false) {
- network_list_placeholder.text = getListPlaceholderText()
- network_list_placeholder.visibility = View.VISIBLE
- } else {
- network_list_placeholder.visibility = View.GONE
- }
-
- private fun getListPlaceholderText() = if (!AppPaths.storageAvailable()) {
- getText(R.string.message_storage_unavailable)
- } else {
- getText(R.string.message_no_network_configuration_found)
- }
- }
-
- private val connectionStarter = object {
- private var netName: String? = null
- private var passphrase: String? = null
- private var displayStatus = false
-
- fun displayStatus() = displayStatus
-
- fun tryStart(netName: String? = null, passphrase: String? = null, displayStatus: Boolean? = null) {
- if (netName != null) this.netName = netName
- this.passphrase = passphrase
- if (displayStatus != null) this.displayStatus = displayStatus
-
- val permissionRequestIntent = VpnService.prepare(this@StartActivity)
- if (permissionRequestIntent != null)
- return startActivityForResult(permissionRequestIntent, PERMISSION_REQUEST)
-
- if (TincKeyring.needsPassphrase(this.netName!!) && this.passphrase == null)
- return askForPassphrase()
-
- startVpn(this.netName!!, this.passphrase)
- }
-
- private fun askForPassphrase() {
- layoutInflater.inflate(R.layout.dialog_decrypt_keys, main_content, false).let { dialog ->
- AlertDialog.Builder(this@StartActivity)
- .setTitle(R.string.title_unlock_private_keys).setView(dialog)
- .setPositiveButton(R.string.action_unlock) { _, _ -> tryStart(passphrase = dialog.passphrase.text.toString()) }
- .setNegativeButton(R.string.action_cancel) { _, _ -> Unit }
- .show()
- }
- }
-
- private fun startVpn(netName: String, passphrase: String? = null) {
- connectDialog = ProgressModal.show(this@StartActivity, getString(R.string.message_starting_vpn))
- TincVpnService.connect(netName, passphrase)
- }
- }
-
- private val broadcastMapper = BroadcastMapper(mapOf(
- Actions.EVENT_CONNECTED to this::onVpnStart,
- Actions.EVENT_ABORTED to this::onVpnStartError))
-
- private var connectDialog: AlertDialog? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- networkList.init()
-
- if (intent.action == Actions.ACTION_CONNECT && intent.data?.schemeSpecificPart != null)
- connectionStarter.tryStart(intent.data.schemeSpecificPart, intent.data.fragment, false)
- }
-
- override fun onCreateOptionsMenu(m: Menu): Boolean {
- menuInflater.inflate(R.menu.menu_start, m)
- return super.onCreateOptionsMenu(m)
- }
-
- override fun onDestroy() {
- networkList.destroy()
- connectDialog?.dismiss()
- super.onDestroy()
- }
-
- override fun onStart() {
- super.onStart()
- networkList.onRefresh()
- }
-
- override fun onResume() {
- super.onResume()
- if (TincVpnService.isConnected()) openStatusActivity(false)
- broadcastMapper.register()
- handleRecentCrash()
- }
-
- override fun onPause() {
- broadcastMapper.unregister()
- super.onPause()
- }
-
- override fun onActivityResult(request: Int, result: Int, data: Intent?): Unit = when (request) {
- PERMISSION_REQUEST -> if (result == Activity.RESULT_OK) connectionStarter.tryStart() else Unit
- else -> throw IllegalArgumentException("Result for unknown request received.")
- }
-
- fun openConfigureActivity(@Suppress("UNUSED_PARAMETER") i: MenuItem) =
- startActivity(Intent(this, ConfigureActivity::class.java))
-
- private fun onVpnStart() {
- connectDialog?.dismiss()
- if (connectionStarter.displayStatus()) openStatusActivity()
- finish()
- }
-
- private fun onVpnStartError() {
- connectDialog?.dismiss()
- }
-
- private fun openStatusActivity(transition: Boolean = true) =
- startActivity(
- Intent(this, StatusActivity::class.java)
- .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
- .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
- .apply { if (!transition) addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION) })
-}
diff --git a/app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt b/app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt
new file mode 100644
index 0000000..9e7e59d
--- /dev/null
+++ b/app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt
@@ -0,0 +1,69 @@
+/*
+ * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon
+ * Copyright (C) 2017-2018 Pacien TRAN-GIRARD
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.pacien.tincapp.activities.start
+
+import android.net.VpnService
+import android.support.v7.app.AlertDialog
+import kotlinx.android.synthetic.main.base.*
+import kotlinx.android.synthetic.main.dialog_decrypt_keys.view.*
+import org.pacien.tincapp.R
+import org.pacien.tincapp.service.TincVpnService
+import org.pacien.tincapp.utils.TincKeyring
+
+/**
+ * @author pacien
+ */
+class ConnectionStarter(private val parentActivity: StartActivity) {
+ private var netName: String? = null
+ private var passphrase: String? = null
+ private var displayStatus = false
+
+ fun displayStatus() = displayStatus
+
+ fun tryStart(netName: String? = null, passphrase: String? = null, displayStatus: Boolean? = null) {
+ if (netName != null) this.netName = netName
+ this.passphrase = passphrase
+ if (displayStatus != null) this.displayStatus = displayStatus
+
+ val permissionRequestIntent = VpnService.prepare(parentActivity)
+ if (permissionRequestIntent != null)
+ return parentActivity.startActivityForResult(permissionRequestIntent, parentActivity.permissionRequestCode)
+
+ if (TincKeyring.needsPassphrase(this.netName!!) && this.passphrase == null)
+ return askForPassphrase()
+
+ startVpn(this.netName!!, this.passphrase)
+ }
+
+ private fun askForPassphrase() {
+ val dialogView = parentActivity.layoutInflater.inflate(R.layout.dialog_decrypt_keys, parentActivity.main_content, false)
+
+ AlertDialog.Builder(parentActivity)
+ .setTitle(R.string.title_unlock_private_keys)
+ .setView(dialogView)
+ .setPositiveButton(R.string.action_unlock) { _, _ -> tryStart(passphrase = dialogView.passphrase.text.toString()) }
+ .setNegativeButton(R.string.action_cancel) { _, _ -> Unit }
+ .show()
+ }
+
+ private fun startVpn(netName: String, passphrase: String? = null) {
+ parentActivity.showConnectProgressDialog()
+ TincVpnService.connect(netName, passphrase)
+ }
+}
diff --git a/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListFragment.kt b/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListFragment.kt
new file mode 100644
index 0000000..f255f53
--- /dev/null
+++ b/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListFragment.kt
@@ -0,0 +1,84 @@
+/*
+ * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon
+ * Copyright (C) 2017-2018 Pacien TRAN-GIRARD
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.pacien.tincapp.activities.start
+
+import android.arch.lifecycle.Observer
+import android.os.Bundle
+import android.support.v4.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.AdapterView
+import android.widget.ArrayAdapter
+import android.widget.TextView
+import kotlinx.android.synthetic.main.start_network_list.*
+import org.pacien.tincapp.R
+import org.pacien.tincapp.context.AppPaths
+import org.pacien.tincapp.extensions.hideBottomSeparator
+import org.pacien.tincapp.extensions.setElements
+
+/**
+ * @author pacien
+ */
+class NetworkListFragment : Fragment() {
+ private val appPaths = AppPaths
+ private val networkListViewModel by lazy { NetworkListViewModel() }
+ private val networkListAdapter by lazy { ArrayAdapter(context, R.layout.start_network_list_item) }
+ var connectToNetworkAction = { _: String -> Unit }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ networkListViewModel.networkList.observe(this, Observer { updateNetworkList(it.orEmpty()) })
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ return inflater.inflate(R.layout.start_network_list, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ val listHeaderView = layoutInflater.inflate(R.layout.start_network_list_header, start_network_list, false)
+ start_network_list.addHeaderView(listHeaderView, null, false)
+ start_network_list.hideBottomSeparator()
+ start_network_list.emptyView = start_network_list_placeholder
+ start_network_list.onItemClickListener = AdapterView.OnItemClickListener(this::onItemClick)
+ start_network_list.adapter = networkListAdapter
+ }
+
+ @Suppress("UNUSED_PARAMETER")
+ private fun onItemClick(parent: AdapterView<*>?, view: View?, position: Int, id: Long) = when (view) {
+ is TextView -> connectToNetworkAction(view.text.toString())
+ else -> Unit
+ }
+
+ private fun updateNetworkList(networks: List) {
+ networkListAdapter.setElements(networks)
+ if (networks.isEmpty()) updatePlaceholder()
+ }
+
+ private fun updatePlaceholder() {
+ val placeholderTextResource = when (appPaths.storageAvailable()) {
+ true -> R.string.start_network_list_empty_none_found
+ false -> R.string.start_network_list_empty_storage_not_available
+ }
+
+ start_network_list_placeholder.post {
+ start_network_list_placeholder_text.text = getString(placeholderTextResource)
+ }
+ }
+}
diff --git a/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListLiveData.kt b/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListLiveData.kt
new file mode 100644
index 0000000..d0d39b8
--- /dev/null
+++ b/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListLiveData.kt
@@ -0,0 +1,46 @@
+/*
+ * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon
+ * Copyright (C) 2017-2018 Pacien TRAN-GIRARD
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.pacien.tincapp.activities.start
+
+import android.arch.lifecycle.LiveData
+import org.pacien.tincapp.context.AppPaths
+import java.util.*
+import kotlin.concurrent.timer
+
+/**
+ * @author pacien
+ */
+class NetworkListLiveData : LiveData>() {
+ private val updateInterval = 2 * 1000L // in milliseconds
+ private val appPaths = AppPaths
+ private lateinit var updateTimer: Timer
+
+ override fun onActive() {
+ updateTimer = timer(period = updateInterval, action = { updateNetworkList() })
+ }
+
+ override fun onInactive() {
+ updateTimer.apply { cancel() }.apply { purge() }
+ }
+
+ private fun updateNetworkList() {
+ val networkList = appPaths.confDir().list()?.sorted() ?: emptyList()
+ postValue(networkList)
+ }
+}
diff --git a/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListViewModel.kt b/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListViewModel.kt
new file mode 100644
index 0000000..419522d
--- /dev/null
+++ b/app/src/main/java/org/pacien/tincapp/activities/start/NetworkListViewModel.kt
@@ -0,0 +1,28 @@
+/*
+ * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon
+ * Copyright (C) 2017-2018 Pacien TRAN-GIRARD
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.pacien.tincapp.activities.start
+
+import android.arch.lifecycle.ViewModel
+
+/**
+ * @author pacien
+ */
+class NetworkListViewModel : ViewModel() {
+ val networkList by lazy { NetworkListLiveData() }
+}
diff --git a/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt
new file mode 100644
index 0000000..9cc6159
--- /dev/null
+++ b/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt
@@ -0,0 +1,117 @@
+/*
+ * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon
+ * Copyright (C) 2017-2018 Pacien TRAN-GIRARD
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.pacien.tincapp.activities.start
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import android.support.v7.app.AlertDialog
+import android.view.Menu
+import android.view.MenuItem
+import kotlinx.android.synthetic.main.start_activity.*
+import org.pacien.tincapp.R
+import org.pacien.tincapp.activities.BaseActivity
+import org.pacien.tincapp.activities.common.ProgressModal
+import org.pacien.tincapp.activities.configure.ConfigureActivity
+import org.pacien.tincapp.activities.status.StatusActivity
+import org.pacien.tincapp.intent.Actions
+import org.pacien.tincapp.intent.BroadcastMapper
+import org.pacien.tincapp.service.TincVpnService
+
+/**
+ * @author pacien
+ */
+class StartActivity : BaseActivity() {
+ val permissionRequestCode = 0
+ private val connectionStarter by lazy { ConnectionStarter(this) }
+ private val broadcastMapper = BroadcastMapper(mapOf(
+ Actions.EVENT_CONNECTED to this::onVpnStart,
+ Actions.EVENT_ABORTED to this::onVpnStartError
+ ))
+
+ var connectDialog: AlertDialog? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.start_activity)
+ initNetworkListFragment()
+
+ if (intent.action == Actions.ACTION_CONNECT && intent.data?.schemeSpecificPart != null)
+ connectionStarter.tryStart(intent.data.schemeSpecificPart, intent.data.fragment, false)
+ }
+
+ private fun initNetworkListFragment() {
+ val fragment = start_activity_network_list_fragment as NetworkListFragment
+ fragment.connectToNetworkAction = { netName -> connectionStarter.tryStart(netName, displayStatus = true) }
+ }
+
+ override fun onCreateOptionsMenu(m: Menu): Boolean {
+ menuInflater.inflate(R.menu.menu_start, m)
+ return super.onCreateOptionsMenu(m)
+ }
+
+ override fun onDestroy() {
+ connectDialog?.dismiss()
+ super.onDestroy()
+ }
+
+ override fun onResume() {
+ super.onResume()
+ if (TincVpnService.isConnected()) openStatusActivity(false)
+ broadcastMapper.register()
+ handleRecentCrash()
+ }
+
+ override fun onPause() {
+ broadcastMapper.unregister()
+ super.onPause()
+ }
+
+ override fun onActivityResult(request: Int, result: Int, data: Intent?): Unit = when (request) {
+ permissionRequestCode -> if (result == Activity.RESULT_OK) connectionStarter.tryStart() else Unit
+ else -> throw IllegalArgumentException("Result for unknown request received.")
+ }
+
+ private fun onVpnStart() {
+ connectDialog?.dismiss()
+ if (connectionStarter.displayStatus()) openStatusActivity()
+ finish()
+ }
+
+ private fun onVpnStartError() {
+ connectDialog?.dismiss()
+ }
+
+ fun showConnectProgressDialog() {
+ connectDialog = ProgressModal.show(this, resources.getString(R.string.message_starting_vpn))
+ }
+
+ @Suppress("UNUSED_PARAMETER")
+ fun openConfigureActivity(m: MenuItem) =
+ startActivity(Intent(this, ConfigureActivity::class.java))
+
+ private fun openStatusActivity(transition: Boolean = true) {
+ val intent = Intent(this, StatusActivity::class.java)
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
+ .apply { if (!transition) addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION) }
+
+ startActivity(intent)
+ }
+}
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 1ac0e54..6627b61 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
@@ -26,8 +26,8 @@ import android.view.MenuItem
import kotlinx.android.synthetic.main.status_activity.*
import org.pacien.tincapp.R
import org.pacien.tincapp.activities.BaseActivity
-import org.pacien.tincapp.activities.StartActivity
import org.pacien.tincapp.activities.common.ProgressModal
+import org.pacien.tincapp.activities.start.StartActivity
import org.pacien.tincapp.activities.viewlog.ViewLogActivity
import org.pacien.tincapp.intent.Actions
import org.pacien.tincapp.intent.BroadcastMapper
diff --git a/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt b/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt
index 1cfc0f5..115809e 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt
@@ -47,7 +47,7 @@ class NodeListFragment : Fragment() {
private val tincCtl = Tinc
private val netName by lazy { vpnService.getCurrentNetName()!! }
private val nodeListViewModel by lazy { ViewModelProviders.of(this).get(NodeListViewModel::class.java) }
- private val nodeListAdapter by lazy { ArrayAdapter(context, R.layout.fragment_list_item) }
+ private val nodeListAdapter by lazy { ArrayAdapter(context, R.layout.status_node_list_item) }
private val nodeListObserver by lazy { Observer> { nodeListAdapter.setElements(it) } }
override fun onCreate(savedInstanceState: Bundle?) {
diff --git a/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt b/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
index 884229d..7176e25 100644
--- a/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
+++ b/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
@@ -91,7 +91,7 @@ class TincVpnService : VpnService() {
return reportError(resources.getString(R.string.message_passphrase_required))
if (!AppPaths.storageAvailable())
- return reportError(resources.getString(R.string.message_storage_unavailable))
+ return reportError(resources.getString(R.string.start_network_list_empty_storage_not_available))
if (!AppPaths.confDir(netName).exists())
return reportError(resources.getString(R.string.message_no_configuration_for_network_format, netName), docTopic = "configuration")
--
cgit v1.2.3