diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt | 20 | ||||
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/configure/ConfigureActivity.kt | 3 | ||||
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt | 4 | ||||
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt | 4 | ||||
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/viewlog/ViewLogActivity.kt | 3 | ||||
-rw-r--r-- | app/src/main/res/layout/base.xml | 43 | ||||
-rw-r--r-- | app/src/main/res/layout/base_activity.xml (renamed from app/src/main/res/values-w960dp/dimens.xml) | 8 | ||||
-rw-r--r-- | app/src/main/res/values/dimens.xml | 1 |
8 files changed, 24 insertions, 62 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt index a51d401..d9d549b 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt | |||
@@ -26,7 +26,7 @@ import android.support.design.widget.Snackbar | |||
26 | import android.support.v7.app.AlertDialog | 26 | import android.support.v7.app.AlertDialog |
27 | import android.support.v7.app.AppCompatActivity | 27 | import android.support.v7.app.AppCompatActivity |
28 | import android.view.* | 28 | import android.view.* |
29 | import kotlinx.android.synthetic.main.base.* | 29 | import kotlinx.android.synthetic.main.base_activity.* |
30 | import org.pacien.tincapp.R | 30 | import org.pacien.tincapp.R |
31 | import org.pacien.tincapp.context.App | 31 | import org.pacien.tincapp.context.App |
32 | import org.pacien.tincapp.context.AppInfo | 32 | import org.pacien.tincapp.context.AppInfo |
@@ -37,11 +37,12 @@ import org.pacien.tincapp.context.CrashRecorder | |||
37 | * @author pacien | 37 | * @author pacien |
38 | */ | 38 | */ |
39 | abstract class BaseActivity : AppCompatActivity() { | 39 | abstract class BaseActivity : AppCompatActivity() { |
40 | private val rootView by lazy { base_activity_frame!! } | ||
40 | private var active = false | 41 | private var active = false |
41 | 42 | ||
42 | override fun onCreate(savedInstanceState: Bundle?) { | 43 | override fun onCreate(savedInstanceState: Bundle?) { |
43 | super.onCreate(savedInstanceState) | 44 | super.onCreate(savedInstanceState) |
44 | setContentView(R.layout.base) | 45 | super.setContentView(R.layout.base_activity) |
45 | } | 46 | } |
46 | 47 | ||
47 | override fun onCreateOptionsMenu(m: Menu): Boolean { | 48 | override fun onCreateOptionsMenu(m: Menu): Boolean { |
@@ -69,6 +70,10 @@ abstract class BaseActivity : AppCompatActivity() { | |||
69 | super.onStop() | 70 | super.onStop() |
70 | } | 71 | } |
71 | 72 | ||
73 | override fun setContentView(layoutResID: Int) { | ||
74 | layoutInflater.inflate(layoutResID, rootView) | ||
75 | } | ||
76 | |||
72 | override fun getSupportActionBar() = super.getSupportActionBar()!! | 77 | override fun getSupportActionBar() = super.getSupportActionBar()!! |
73 | 78 | ||
74 | fun startActivityChooser(target: Intent, title: String) { | 79 | fun startActivityChooser(target: Intent, title: String) { |
@@ -76,7 +81,8 @@ abstract class BaseActivity : AppCompatActivity() { | |||
76 | startActivity(intentChooser) | 81 | startActivity(intentChooser) |
77 | } | 82 | } |
78 | 83 | ||
79 | fun aboutDialog(@Suppress("UNUSED_PARAMETER") i: MenuItem) { | 84 | @Suppress("UNUSED_PARAMETER") |
85 | fun aboutDialog(m: MenuItem) { | ||
80 | AlertDialog.Builder(this) | 86 | AlertDialog.Builder(this) |
81 | .setTitle(resources.getString(R.string.app_name)) | 87 | .setTitle(resources.getString(R.string.app_name)) |
82 | .setMessage(resources.getString(R.string.app_short_desc) + "\n\n" + | 88 | .setMessage(resources.getString(R.string.app_short_desc) + "\n\n" + |
@@ -112,11 +118,11 @@ abstract class BaseActivity : AppCompatActivity() { | |||
112 | .show() | 118 | .show() |
113 | } | 119 | } |
114 | 120 | ||
115 | fun inflate(@LayoutRes layout: Int) = layoutInflater.inflate(layout, main_content, false)!! | 121 | fun inflate(@LayoutRes layout: Int) = layoutInflater.inflate(layout, rootView, false)!! |
116 | fun inflate(inflateFunc: (LayoutInflater, ViewGroup, Boolean) -> View) = inflateFunc(layoutInflater, main_content, false) | 122 | fun inflate(inflateFunc: (LayoutInflater, ViewGroup?, Boolean) -> View) = inflateFunc(layoutInflater, rootView, false) |
117 | 123 | ||
118 | fun notify(@StringRes msg: Int) = Snackbar.make(activity_base, msg, Snackbar.LENGTH_LONG).show() | 124 | fun notify(@StringRes msg: Int) = Snackbar.make(base_activity_frame, msg, Snackbar.LENGTH_LONG).show() |
119 | fun notify(msg: String) = Snackbar.make(activity_base, msg, Snackbar.LENGTH_LONG).show() | 125 | fun notify(msg: String) = Snackbar.make(base_activity_frame, msg, Snackbar.LENGTH_LONG).show() |
120 | 126 | ||
121 | fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this) | 127 | fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this) |
122 | .setTitle(R.string.title_error).setMessage(msg) | 128 | .setTitle(R.string.title_error).setMessage(msg) |
diff --git a/app/src/main/java/org/pacien/tincapp/activities/configure/ConfigureActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/configure/ConfigureActivity.kt index 9c9be70..c215f70 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/configure/ConfigureActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/configure/ConfigureActivity.kt | |||
@@ -19,7 +19,6 @@ | |||
19 | package org.pacien.tincapp.activities.configure | 19 | package org.pacien.tincapp.activities.configure |
20 | 20 | ||
21 | import android.os.Bundle | 21 | import android.os.Bundle |
22 | import kotlinx.android.synthetic.main.base.* | ||
23 | import org.pacien.tincapp.R | 22 | import org.pacien.tincapp.R |
24 | import org.pacien.tincapp.activities.BaseActivity | 23 | import org.pacien.tincapp.activities.BaseActivity |
25 | 24 | ||
@@ -30,6 +29,6 @@ class ConfigureActivity : BaseActivity() { | |||
30 | override fun onCreate(savedInstanceState: Bundle?) { | 29 | override fun onCreate(savedInstanceState: Bundle?) { |
31 | super.onCreate(savedInstanceState) | 30 | super.onCreate(savedInstanceState) |
32 | supportActionBar.setDisplayHomeAsUpEnabled(true) | 31 | supportActionBar.setDisplayHomeAsUpEnabled(true) |
33 | layoutInflater.inflate(R.layout.configure_activity, main_content) | 32 | setContentView(R.layout.configure_activity) |
34 | } | 33 | } |
35 | } | 34 | } |
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 index 9e7e59d..06046e9 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt | |||
@@ -20,7 +20,7 @@ package org.pacien.tincapp.activities.start | |||
20 | 20 | ||
21 | import android.net.VpnService | 21 | import android.net.VpnService |
22 | import android.support.v7.app.AlertDialog | 22 | import android.support.v7.app.AlertDialog |
23 | import kotlinx.android.synthetic.main.base.* | 23 | import kotlinx.android.synthetic.main.base_activity.* |
24 | import kotlinx.android.synthetic.main.dialog_decrypt_keys.view.* | 24 | import kotlinx.android.synthetic.main.dialog_decrypt_keys.view.* |
25 | import org.pacien.tincapp.R | 25 | import org.pacien.tincapp.R |
26 | import org.pacien.tincapp.service.TincVpnService | 26 | import org.pacien.tincapp.service.TincVpnService |
@@ -52,7 +52,7 @@ class ConnectionStarter(private val parentActivity: StartActivity) { | |||
52 | } | 52 | } |
53 | 53 | ||
54 | private fun askForPassphrase() { | 54 | private fun askForPassphrase() { |
55 | val dialogView = parentActivity.layoutInflater.inflate(R.layout.dialog_decrypt_keys, parentActivity.main_content, false) | 55 | val dialogView = parentActivity.layoutInflater.inflate(R.layout.dialog_decrypt_keys, parentActivity.base_activity_frame, false) |
56 | 56 | ||
57 | AlertDialog.Builder(parentActivity) | 57 | AlertDialog.Builder(parentActivity) |
58 | .setTitle(R.string.title_unlock_private_keys) | 58 | .setTitle(R.string.title_unlock_private_keys) |
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 1111de7..cf1c1bc 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 | |||
@@ -26,7 +26,7 @@ import android.support.v7.app.AlertDialog | |||
26 | import android.view.LayoutInflater | 26 | import android.view.LayoutInflater |
27 | import android.view.View | 27 | import android.view.View |
28 | import android.view.ViewGroup | 28 | import android.view.ViewGroup |
29 | import kotlinx.android.synthetic.main.base.* | 29 | import kotlinx.android.synthetic.main.base_activity.* |
30 | import kotlinx.android.synthetic.main.status_node_info_dialog.view.* | 30 | import kotlinx.android.synthetic.main.status_node_info_dialog.view.* |
31 | import kotlinx.android.synthetic.main.status_node_list_fragment.* | 31 | import kotlinx.android.synthetic.main.status_node_list_fragment.* |
32 | import org.pacien.tincapp.R | 32 | import org.pacien.tincapp.R |
@@ -67,7 +67,7 @@ class NodeListFragment : Fragment() { | |||
67 | showNodeInfo(nodeInfo.name) | 67 | showNodeInfo(nodeInfo.name) |
68 | 68 | ||
69 | private fun showNodeInfo(nodeName: String) { | 69 | private fun showNodeInfo(nodeName: String) { |
70 | val dialogTextView = layoutInflater.inflate(R.layout.status_node_info_dialog, main_content, false) | 70 | val dialogTextView = layoutInflater.inflate(R.layout.status_node_info_dialog, base_activity_frame, false) |
71 | 71 | ||
72 | AlertDialog.Builder(context!!) | 72 | AlertDialog.Builder(context!!) |
73 | .setTitle(R.string.status_node_info_dialog_title) | 73 | .setTitle(R.string.status_node_info_dialog_title) |
diff --git a/app/src/main/java/org/pacien/tincapp/activities/viewlog/ViewLogActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/viewlog/ViewLogActivity.kt index a4e2216..dfe6d1b 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/viewlog/ViewLogActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/viewlog/ViewLogActivity.kt | |||
@@ -26,7 +26,6 @@ import android.view.Menu | |||
26 | import android.view.MenuItem | 26 | import android.view.MenuItem |
27 | import android.view.View | 27 | import android.view.View |
28 | import android.widget.ScrollView | 28 | import android.widget.ScrollView |
29 | import kotlinx.android.synthetic.main.base.* | ||
30 | import kotlinx.android.synthetic.main.view_log_activity.* | 29 | import kotlinx.android.synthetic.main.view_log_activity.* |
31 | import org.pacien.tincapp.R | 30 | import org.pacien.tincapp.R |
32 | import org.pacien.tincapp.activities.BaseActivity | 31 | import org.pacien.tincapp.activities.BaseActivity |
@@ -42,7 +41,7 @@ class ViewLogActivity : BaseActivity() { | |||
42 | override fun onCreate(savedInstanceState: Bundle?) { | 41 | override fun onCreate(savedInstanceState: Bundle?) { |
43 | super.onCreate(savedInstanceState) | 42 | super.onCreate(savedInstanceState) |
44 | supportActionBar.setDisplayHomeAsUpEnabled(true) | 43 | supportActionBar.setDisplayHomeAsUpEnabled(true) |
45 | layoutInflater.inflate(R.layout.view_log_activity, main_content) | 44 | setContentView(R.layout.view_log_activity) |
46 | enableLogging(viewModel.logging) | 45 | enableLogging(viewModel.logging) |
47 | } | 46 | } |
48 | 47 | ||
diff --git a/app/src/main/res/layout/base.xml b/app/src/main/res/layout/base.xml deleted file mode 100644 index 96dff5d..0000000 --- a/app/src/main/res/layout/base.xml +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | |||
3 | <!-- | ||
4 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon | ||
5 | * Copyright (C) 2017-2018 Pacien TRAN-GIRARD | ||
6 | * |