From b06679f628eeb5b6e7f917ee79024e4808ca8303 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 8 Sep 2020 20:45:39 +0200 Subject: treewide: fix code style issues reported by linter --- .../java/org/pacien/tincapp/activities/configure/ToolsFragment.kt | 4 ++-- .../main/java/org/pacien/tincapp/activities/start/StartActivity.kt | 4 ++-- .../org/pacien/tincapp/activities/status/nodes/NodeListViewModel.kt | 3 +-- .../pacien/tincapp/activities/status/subnets/SubnetListViewModel.kt | 3 +-- app/src/main/java/org/pacien/tincapp/commands/Command.kt | 4 ++-- .../main/java/org/pacien/tincapp/data/VpnInterfaceConfiguration.kt | 5 ++--- app/src/main/java/org/pacien/tincapp/intent/Actions.kt | 4 ++-- 7 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/pacien/tincapp/activities/configure/ToolsFragment.kt b/app/src/main/java/org/pacien/tincapp/activities/configure/ToolsFragment.kt index 2135f59..9d30bee 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/configure/ToolsFragment.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/configure/ToolsFragment.kt @@ -1,6 +1,6 @@ /* * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon - * Copyright (C) 2017-2018 Pacien TRAN-GIRARD + * Copyright (C) 2017-2020 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 @@ -45,6 +45,6 @@ class ToolsFragment : BaseFragment() { return binding.root } - private fun openDialog(tool: ConfigurationToolDialogFragment) = + private fun openDialog(tool: ConfigurationToolDialogFragment): () -> Unit = { tool.show(fragmentManager, tool.javaClass.simpleName) } } 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 index 45c9c08..909078f 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt @@ -1,6 +1,6 @@ /* * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon - * Copyright (C) 2017-2019 Pacien TRAN-GIRARD + * Copyright (C) 2017-2020 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 @@ -48,7 +48,7 @@ class StartActivity : BaseActivity() { Actions.EVENT_ABORTED to this::onVpnStartError )) - var connectDialog: AlertDialog? = null + private var connectDialog: AlertDialog? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListViewModel.kt b/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListViewModel.kt index 2e8c139..06bb0a4 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListViewModel.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/status/nodes/NodeListViewModel.kt @@ -1,6 +1,6 @@ /* * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon - * Copyright (C) 2017-2019 Pacien TRAN-GIRARD + * Copyright (C) 2017-2020 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 @@ -19,7 +19,6 @@ package org.pacien.tincapp.activities.status.nodes import androidx.lifecycle.ViewModel -import org.pacien.tincapp.service.TincVpnService /** * @author pacien diff --git a/app/src/main/java/org/pacien/tincapp/activities/status/subnets/SubnetListViewModel.kt b/app/src/main/java/org/pacien/tincapp/activities/status/subnets/SubnetListViewModel.kt index dc47b40..3e08d79 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/status/subnets/SubnetListViewModel.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/status/subnets/SubnetListViewModel.kt @@ -1,6 +1,6 @@ /* * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon - * Copyright (C) 2017-2019 Pacien TRAN-GIRARD + * Copyright (C) 2017-2020 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 @@ -19,7 +19,6 @@ package org.pacien.tincapp.activities.status.subnets import androidx.lifecycle.ViewModel -import org.pacien.tincapp.service.TincVpnService /** * @author pacien diff --git a/app/src/main/java/org/pacien/tincapp/commands/Command.kt b/app/src/main/java/org/pacien/tincapp/commands/Command.kt index 132cda9..782865a 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/Command.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/Command.kt @@ -1,6 +1,6 @@ /* * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon - * Copyright (C) 2017-2018 Pacien TRAN-GIRARD + * Copyright (C) 2017-2020 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 @@ -37,7 +37,7 @@ internal class Command(private val cmd: String) { } fun withArguments(vararg args: String): Command { - this.args.addAll(Arrays.asList(*args)) + this.args.addAll(listOf(*args)) return this } diff --git a/app/src/main/java/org/pacien/tincapp/data/VpnInterfaceConfiguration.kt b/app/src/main/java/org/pacien/tincapp/data/VpnInterfaceConfiguration.kt index c98b567..937213e 100644 --- a/app/src/main/java/org/pacien/tincapp/data/VpnInterfaceConfiguration.kt +++ b/app/src/main/java/org/pacien/tincapp/data/VpnInterfaceConfiguration.kt @@ -1,6 +1,6 @@ /* * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon - * Copyright (C) 2017-2019 Pacien TRAN-GIRARD + * Copyright (C) 2017-2020 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 @@ -77,8 +77,7 @@ data class VpnInterfaceConfiguration(val addresses: List = emptyLis fun fromInvitation(f: File) = fromInvitation(Configurations().properties(f)) private fun fromInvitation(c: Configuration) = VpnInterfaceConfiguration( c.getStringList(INVITATION_KEY_ADDRESSES) - .map { applyIgnoringException(CidrAddress.Companion::fromSlashSeparated, it) } - .filterNotNull(), + .mapNotNull { applyIgnoringException(CidrAddress.Companion::fromSlashSeparated, it) }, c.getStringList(INVITATION_KEY_ROUTES) .map { it.substringBefore(' ') } .map { CidrAddress.fromSlashSeparated(it) }) diff --git a/app/src/main/java/org/pacien/tincapp/intent/Actions.kt b/app/src/main/java/org/pacien/tincapp/intent/Actions.kt index 85cfd29..62c1175 100644 --- a/app/src/main/java/org/pacien/tincapp/intent/Actions.kt +++ b/app/src/main/java/org/pacien/tincapp/intent/Actions.kt @@ -1,6 +1,6 @@ /* * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon - * Copyright (C) 2017-2018 Pacien TRAN-GIRARD + * Copyright (C) 2017-2020 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 @@ -35,5 +35,5 @@ object Actions { const val TINC_SCHEME = "tinc" fun buildNetworkUri(netName: String, passphrase: String? = null): Uri = - Uri.Builder().scheme(Actions.TINC_SCHEME).opaquePart(netName).fragment(passphrase).build() + Uri.Builder().scheme(TINC_SCHEME).opaquePart(netName).fragment(passphrase).build() } -- cgit v1.2.3