From 05511d49007a54e47251130300b662bf411542b6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 23 Sep 2020 17:21:27 +0200 Subject: ui: cleanup code after churn Signed-off-by: Jason A. Donenfeld --- .../android/fragment/TunnelListFragment.kt | 17 +- .../java/com/wireguard/android/util/Extensions.kt | 1 - ui/src/main/res/drawable/ic_arrow_back.xml | 6 +- ui/src/main/res/drawable/tv_logo_banner.xml | 400 ++++++++++----------- ui/src/main/res/layout/tv_tunnel_list_item.xml | 2 +- 5 files changed, 206 insertions(+), 220 deletions(-) (limited to 'ui') diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt index 66b0e8ba..a2eacd0b 100644 --- a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt +++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt @@ -6,9 +6,7 @@ package com.wireguard.android.fragment import android.content.Intent import android.content.res.Resources -import android.net.Uri import android.os.Bundle -import android.provider.OpenableColumns import android.util.Log import android.view.LayoutInflater import android.view.Menu @@ -29,28 +27,16 @@ import com.wireguard.android.activity.TunnelCreatorActivity import com.wireguard.android.databinding.ObservableKeyedRecyclerViewAdapter.RowConfigurationHandler import com.wireguard.android.databinding.TunnelListFragmentBinding import com.wireguard.android.databinding.TunnelListItemBinding -import com.wireguard.android.fragment.ConfigNamingDialogFragment.Companion.newInstance import com.wireguard.android.model.ObservableTunnel import com.wireguard.android.util.ErrorMessages import com.wireguard.android.util.TunnelImporter import com.wireguard.android.widget.MultiselectableRelativeLayout -import com.wireguard.config.Config -import kotlinx.coroutines.Deferred -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext -import java.io.BufferedReader -import java.io.ByteArrayInputStream -import java.io.InputStreamReader -import java.nio.charset.StandardCharsets import java.util.ArrayList import java.util.HashSet -import java.util.Locale -import java.util.zip.ZipEntry -import java.util.zip.ZipInputStream /** * Fragment containing a list of known WireGuard tunnels. It allows creating and deleting tunnels. @@ -67,7 +53,8 @@ class TunnelListFragment : BaseFragment() { } private val qrImportResultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> - val qrCode = IntentIntegrator.parseActivityResult(result.resultCode, result.data)?.contents ?: return@registerForActivityResult + val qrCode = IntentIntegrator.parseActivityResult(result.resultCode, result.data)?.contents + ?: return@registerForActivityResult lifecycleScope.launch { TunnelImporter.importTunnel(parentFragmentManager, qrCode) { showSnackbar(it) } } } diff --git a/ui/src/main/java/com/wireguard/android/util/Extensions.kt b/ui/src/main/java/com/wireguard/android/util/Extensions.kt index 62bda7e9..2d0899c2 100644 --- a/ui/src/main/java/com/wireguard/android/util/Extensions.kt +++ b/ui/src/main/java/com/wireguard/android/util/Extensions.kt @@ -11,7 +11,6 @@ import androidx.annotation.AttrRes import androidx.lifecycle.lifecycleScope import androidx.preference.Preference import com.wireguard.android.Application -import com.wireguard.android.R import com.wireguard.android.activity.SettingsActivity import kotlinx.coroutines.CoroutineScope diff --git a/ui/src/main/res/drawable/ic_arrow_back.xml b/ui/src/main/res/drawable/ic_arrow_back.xml index 2e58492a..160b4a6f 100644 --- a/ui/src/main/res/drawable/ic_arrow_back.xml +++ b/ui/src/main/res/drawable/ic_arrow_back.xml @@ -8,7 +8,7 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - + diff --git a/ui/src/main/res/drawable/tv_logo_banner.xml b/ui/src/main/res/drawable/tv_logo_banner.xml index 84864b1c..24a173a7 100644 --- a/ui/src/main/res/drawable/tv_logo_banner.xml +++ b/ui/src/main/res/drawable/tv_logo_banner.xml @@ -8,204 +8,204 @@ android:height="393.14dp" android:viewportWidth="1934.5" android:viewportHeight="393.14"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui/src/main/res/layout/tv_tunnel_list_item.xml b/ui/src/main/res/layout/tv_tunnel_list_item.xml index c45abd08..15615536 100644 --- a/ui/src/main/res/layout/tv_tunnel_list_item.xml +++ b/ui/src/main/res/layout/tv_tunnel_list_item.xml @@ -34,9 +34,9 @@ android:layout_margin="8dp" android:layout_marginTop="4dp" android:layout_marginBottom="0dp" + android:backgroundTint="@{(item.state == State.UP && !isDeleting) ? @color/secondary_dark_color : (isDeleting && isFocused) ? @color/tv_card_delete_background : @color/tv_card_background}" android:checkable="true" android:focusable="true" - android:backgroundTint="@{(item.state == State.UP && !isDeleting) ? @color/secondary_dark_color : (isDeleting && isFocused) ? @color/tv_card_delete_background : @color/tv_card_background}" app:contentPadding="8dp">