aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-08-21 22:39:07 +0200
committerpacien2018-08-21 22:39:07 +0200
commit8b44284c7fae76e7e402387500acab7b64a7dad3 (patch)
treef92c5c7ba4b03b97e6b87c3ad4c2383ade5ff737
parent9846c5ff85e6eb02c4599045d28798569ed8c5c8 (diff)
downloadtincapp-8b44284c7fae76e7e402387500acab7b64a7dad3.tar.gz
Remove side gutters on large screens
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt20
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/configure/ConfigureActivity.kt3
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/start/ConnectionStarter.kt4
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListFragment.kt4
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/viewlog/ViewLogActivity.kt3
-rw-r--r--app/src/main/res/layout/base.xml43
-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.xml1
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
26import android.support.v7.app.AlertDialog 26import android.support.v7.app.AlertDialog
27import android.support.v7.app.AppCompatActivity 27import android.support.v7.app.AppCompatActivity
28import android.view.* 28import android.view.*
29import kotlinx.android.synthetic.main.base.* 29import kotlinx.android.synthetic.main.base_activity.*
30import org.pacien.tincapp.R 30import org.pacien.tincapp.R
31import org.pacien.tincapp.context.App 31import org.pacien.tincapp.context.App
32import org.pacien.tincapp.context.AppInfo 32import org.pacien.tincapp.context.AppInfo
@@ -37,11 +37,12 @@ import org.pacien.tincapp.context.CrashRecorder
37 * @author pacien 37 * @author pacien
38 */ 38 */
39abstract class BaseActivity : AppCompatActivity() { 39abstract 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 @@
19package org.pacien.tincapp.activities.configure 19package org.pacien.tincapp.activities.configure
20 20
21import android.os.Bundle 21import android.os.Bundle
22import kotlinx.android.synthetic.main.base.*
23import org.pacien.tincapp.R 22import org.pacien.tincapp.R
24import org.pacien.tincapp.activities.BaseActivity 23import 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
21import android.net.VpnService 21import android.net.VpnService
22import android.support.v7.app.AlertDialog 22import android.support.v7.app.AlertDialog
23import kotlinx.android.synthetic.main.base.* 23import kotlinx.android.synthetic.main.base_activity.*
24import kotlinx.android.synthetic.main.dialog_decrypt_keys.view.* 24import kotlinx.android.synthetic.main.dialog_decrypt_keys.view.*
25import org.pacien.tincapp.R 25import org.pacien.tincapp.R
26import org.pacien.tincapp.service.TincVpnService 26import 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
26import android.view.LayoutInflater 26import android.view.LayoutInflater
27import android.view.View 27import android.view.View
28import android.view.ViewGroup 28import android.view.ViewGroup
29import kotlinx.android.synthetic.main.base.* 29import kotlinx.android.synthetic.main.base_activity.*
30import kotlinx.android.synthetic.main.status_node_info_dialog.view.* 30import kotlinx.android.synthetic.main.status_node_info_dialog.view.*
31import kotlinx.android.synthetic.main.status_node_list_fragment.* 31import kotlinx.android.synthetic.main.status_node_list_fragment.*
32import org.pacien.tincapp.R 32import 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
26import android.view.MenuItem 26import android.view.MenuItem
27import android.view.View 27import android.view.View
28import android.widget.ScrollView 28import android.widget.ScrollView
29import kotlinx.android.synthetic.main.base.*
30import kotlinx.android.synthetic.main.view_log_activity.* 29import kotlinx.android.synthetic.main.view_log_activity.*
31import org.pacien.tincapp.R 30import org.pacien.tincapp.R
32import org.pacien.tincapp.activities.BaseActivity 31import 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 *
7 * This program is free software: you can redistribute it and/or modify