summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main/java/com
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-03-09 12:21:35 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-03-09 12:21:35 -0600
commit40ebf8006e46f8857340648d7cea234ed699aed7 (patch)
treed52d5157884dec4f9cdadc895a2e66d20704249b /ui/src/main/java/com
parent8e8643122eb5783d4412c8a81fb03cc789c3f77c (diff)
global: optimize imports
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/java/com')
-rw-r--r--ui/src/main/java/com/wireguard/android/Application.java10
-rw-r--r--ui/src/main/java/com/wireguard/android/BootShutdownReceiver.java3
-rw-r--r--ui/src/main/java/com/wireguard/android/QuickTileService.java12
-rw-r--r--ui/src/main/java/com/wireguard/android/activity/BaseActivity.java10
-rw-r--r--ui/src/main/java/com/wireguard/android/activity/MainActivity.java14
-rw-r--r--ui/src/main/java/com/wireguard/android/activity/SettingsActivity.java16
-rw-r--r--ui/src/main/java/com/wireguard/android/activity/ThemeChangeAwareActivity.java12
-rw-r--r--ui/src/main/java/com/wireguard/android/activity/TunnelCreatorActivity.java6
-rw-r--r--ui/src/main/java/com/wireguard/android/activity/TunnelToggleActivity.java15
-rw-r--r--ui/src/main/java/com/wireguard/android/configStore/ConfigStore.java3
-rw-r--r--ui/src/main/java/com/wireguard/android/configStore/FileConfigStore.java3
-rw-r--r--ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.java19
-rw-r--r--ui/src/main/java/com/wireguard/android/databinding/ItemChangeListener.java12
-rw-r--r--ui/src/main/java/com/wireguard/android/databinding/ObservableKeyedRecyclerViewAdapter.java16
-rw-r--r--ui/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java11
-rw-r--r--ui/src/main/java/com/wireguard/android/fragment/BaseFragment.java16
-rw-r--r--ui/src/main/java/com/wireguard/android/fragment/ConfigNamingDialogFragment.java10
-rw-r--r--ui/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java11
-rw-r--r--ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.java11
-rw-r--r--ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java16
-rw-r--r--ui/src/main/java/com/wireguard/android/model/ApplicationData.java8
-rw-r--r--ui/src/main/java/com/wireguard/android/model/ObservableTunnel.java10
-rw-r--r--ui/src/main/java/com/wireguard/android/model/TunnelManager.java13
-rw-r--r--ui/src/main/java/com/wireguard/android/preference/LogExporterPreference.java11
-rw-r--r--ui/src/main/java/com/wireguard/android/preference/ModuleDownloaderPreference.java3
-rw-r--r--ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java8
-rw-r--r--ui/src/main/java/com/wireguard/android/preference/VersionPreference.java8
-rw-r--r--ui/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java9
-rw-r--r--ui/src/main/java/com/wireguard/android/ui/EdgeToEdge.kt7
-rw-r--r--ui/src/main/java/com/wireguard/android/util/AsyncWorker.java4
-rw-r--r--ui/src/main/java/com/wireguard/android/util/ClipboardUtils.java6
-rw-r--r--ui/src/main/java/com/wireguard/android/util/DownloadsFileSaver.java3
-rw-r--r--ui/src/main/java/com/wireguard/android/util/ErrorMessages.java6
-rw-r--r--ui/src/main/java/com/wireguard/android/util/ExceptionLoggers.java4
-rw-r--r--ui/src/main/java/com/wireguard/android/util/FragmentUtils.java6
-rw-r--r--ui/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java9
-rw-r--r--ui/src/main/java/com/wireguard/android/util/ObservableKeyedList.java5
-rw-r--r--ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java7
-rw-r--r--ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java3
-rw-r--r--ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.java8
-rw-r--r--ui/src/main/java/com/wireguard/android/viewmodel/InterfaceProxy.java11
-rw-r--r--ui/src/main/java/com/wireguard/android/viewmodel/PeerProxy.java13
-rw-r--r--ui/src/main/java/com/wireguard/android/widget/KeyInputFilter.java6
-rw-r--r--ui/src/main/java/com/wireguard/android/widget/MultiselectableRelativeLayout.java3
-rw-r--r--ui/src/main/java/com/wireguard/android/widget/NameInputFilter.java6
-rw-r--r--ui/src/main/java/com/wireguard/android/widget/SlashDrawable.java7
-rw-r--r--ui/src/main/java/com/wireguard/android/widget/ToggleSwitch.java7
-rw-r--r--ui/src/main/java/com/wireguard/util/Keyed.java2
-rw-r--r--ui/src/main/java/com/wireguard/util/KeyedList.java6
-rw-r--r--ui/src/main/java/com/wireguard/util/SortedKeyedList.java6
50 files changed, 194 insertions, 237 deletions
diff --git a/ui/src/main/java/com/wireguard/android/Application.java b/ui/src/main/java/com/wireguard/android/Application.java
index d3e0aa5f..52d5e1ea 100644
--- a/ui/src/main/java/com/wireguard/android/Application.java
+++ b/ui/src/main/java/com/wireguard/android/Application.java
@@ -5,8 +5,6 @@
package com.wireguard.android;
-import com.wireguard.util.NonNullForAll;
-
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -17,10 +15,6 @@ import android.os.Looper;
import android.os.StrictMode;
import android.util.Log;
-import androidx.preference.PreferenceManager;
-import androidx.annotation.Nullable;
-import androidx.appcompat.app.AppCompatDelegate;
-
import com.wireguard.android.backend.Backend;
import com.wireguard.android.backend.GoBackend;
import com.wireguard.android.backend.WgQuickBackend;
@@ -31,10 +25,14 @@ import com.wireguard.android.util.ExceptionLoggers;
import com.wireguard.android.util.ModuleLoader;
import com.wireguard.android.util.RootShell;
import com.wireguard.android.util.ToolsInstaller;
+import com.wireguard.util.NonNullForAll;
import java.lang.ref.WeakReference;
import java.util.Locale;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatDelegate;
+import androidx.preference.PreferenceManager;
import java9.util.concurrent.CompletableFuture;
@NonNullForAll
diff --git a/ui/src/main/java/com/wireguard/android/BootShutdownReceiver.java b/ui/src/main/java/com/wireguard/android/BootShutdownReceiver.java
index f5232d50..3f4bcd83 100644
--- a/ui/src/main/java/com/wireguard/android/BootShutdownReceiver.java
+++ b/ui/src/main/java/com/wireguard/android/BootShutdownReceiver.java
@@ -5,8 +5,6 @@
package com.wireguard.android;
-import com.wireguard.util.NonNullForAll;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -15,6 +13,7 @@ import android.util.Log;
import com.wireguard.android.backend.WgQuickBackend;
import com.wireguard.android.model.TunnelManager;
import com.wireguard.android.util.ExceptionLoggers;
+import com.wireguard.util.NonNullForAll;
@NonNullForAll
public class BootShutdownReceiver extends BroadcastReceiver {
diff --git a/ui/src/main/java/com/wireguard/android/QuickTileService.java b/ui/src/main/java/com/wireguard/android/QuickTileService.java
index f18d01b1..a485ae1e 100644
--- a/ui/src/main/java/com/wireguard/android/QuickTileService.java
+++ b/ui/src/main/java/com/wireguard/android/QuickTileService.java
@@ -5,11 +5,7 @@
package com.wireguard.android;
-import com.wireguard.util.NonNullForAll;
-
import android.content.Intent;
-import androidx.databinding.Observable;
-import androidx.databinding.Observable.OnPropertyChangedCallback;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.Icon;
@@ -17,8 +13,6 @@ import android.os.Build;
import android.os.IBinder;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
-import androidx.annotation.Nullable;
-import androidx.annotation.RequiresApi;
import android.util.Log;
import com.wireguard.android.activity.MainActivity;
@@ -26,9 +20,15 @@ import com.wireguard.android.activity.TunnelToggleActivity;
import com.wireguard.android.backend.Tunnel.State;
import com.wireguard.android.model.ObservableTunnel;
import com.wireguard.android.widget.SlashDrawable;
+import com.wireguard.util.NonNullForAll;
import java.util.Objects;
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+import androidx.databinding.Observable;
+import androidx.databinding.Observable.OnPropertyChangedCallback;
+
/**
* Service that maintains the application's custom Quick Settings tile. This service is bound by the
* system framework as necessary to update the appearance of the tile in the system UI, and to
diff --git a/ui/src/main/java/com/wireguard/android/activity/BaseActivity.java b/ui/src/main/java/com/wireguard/android/activity/BaseActivity.java
index 6c849412..704ca766 100644
--- a/ui/src/main/java/com/wireguard/android/activity/BaseActivity.java
+++ b/ui/src/main/java/com/wireguard/android/activity/BaseActivity.java
@@ -5,18 +5,18 @@
package com.wireguard.android.activity;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.databinding.CallbackRegistry;
-import androidx.databinding.CallbackRegistry.NotifierCallback;
import android.os.Bundle;
-import androidx.annotation.Nullable;
import com.wireguard.android.Application;
import com.wireguard.android.model.ObservableTunnel;
+import com.wireguard.util.NonNullForAll;
import java.util.Objects;
+import androidx.annotation.Nullable;
+import androidx.databinding.CallbackRegistry;
+import androidx.databinding.CallbackRegistry.NotifierCallback;
+
/**
* Base class for activities that need to remember the currently-selected tunnel.
*/
diff --git a/ui/src/main/java/com/wireguard/android/activity/MainActivity.java b/ui/src/main/java/com/wireguard/android/activity/MainActivity.java
index 1e098809..d9bbee20 100644
--- a/ui/src/main/java/com/wireguard/android/activity/MainActivity.java
+++ b/ui/src/main/java/com/wireguard/android/activity/MainActivity.java
@@ -5,16 +5,9 @@
package com.wireguard.android.activity;
-import com.wireguard.util.NonNullForAll;
-
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentTransaction;
-import androidx.appcompat.app.ActionBar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View.OnApplyWindowInsetsListener;
@@ -24,9 +17,16 @@ import com.wireguard.android.R;
import com.wireguard.android.fragment.TunnelDetailFragment;
import com.wireguard.android.fragment.TunnelEditorFragment;
import com.wireguard.android.model.ObservableTunnel;
+import com.wireguard.util.NonNullForAll;
import java.util.List;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.ActionBar;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
+
/**
* CRUD interface for WireGuard tunnels. This activity serves as the main entry point to the
* WireGuard application, and contains several fragments for listing, viewing details of, and
diff --git a/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.java b/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.java
index 02f6b29a..4d13bfbf 100644
--- a/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.java
+++ b/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.java
@@ -5,17 +5,9 @@
package com.wireguard.android.activity;
-import com.wireguard.util.NonNullForAll;
-
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
-import androidx.annotation.Nullable;
-import androidx.core.app.ActivityCompat;
-import androidx.core.content.ContextCompat;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceFragmentCompat;
-import androidx.preference.PreferenceScreen;
import android.util.SparseArray;
import android.view.MenuItem;
@@ -23,11 +15,19 @@ import com.wireguard.android.Application;
import com.wireguard.android.R;
import com.wireguard.android.backend.WgQuickBackend;
import com.wireguard.android.util.ModuleLoader;
+import com.wireguard.util.NonNullForAll;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import androidx.annotation.Nullable;
+import androidx.core.app.ActivityCompat;
+import androidx.core.content.ContextCompat;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceFragmentCompat;
+import androidx.preference.PreferenceScreen;
+
/**
* Interface for changing application-global persistent settings.
*/
diff --git a/ui/src/main/java/com/wireguard/android/activity/ThemeChangeAwareActivity.java b/ui/src/main/java/com/wireguard/android/activity/ThemeChangeAwareActivity.java
index 114d6f13..abe053e9 100644
--- a/ui/src/main/java/com/wireguard/android/activity/ThemeChangeAwareActivity.java
+++ b/ui/src/main/java/com/wireguard/android/activity/ThemeChangeAwareActivity.java
@@ -5,20 +5,16 @@
package com.wireguard.android.activity;
-import com.wireguard.util.NonNullForAll;
-
import android.content.SharedPreferences;
-import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
-import androidx.annotation.Nullable;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.app.AppCompatDelegate;
-import android.util.Log;
import com.wireguard.android.Application;
+import com.wireguard.util.NonNullForAll;
-import java.lang.reflect.Field;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.app.AppCompatDelegate;
@NonNullForAll
public abstract class ThemeChangeAwareActivity extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
diff --git a/ui/src/main/java/com/wireguard/android/activity/TunnelCreatorActivity.java b/ui/src/main/java/com/wireguard/android/activity/TunnelCreatorActivity.java
index 3149988f..3dee0c00 100644
--- a/ui/src/main/java/com/wireguard/android/activity/TunnelCreatorActivity.java
+++ b/ui/src/main/java/com/wireguard/android/activity/TunnelCreatorActivity.java
@@ -5,13 +5,13 @@
package com.wireguard.android.activity;
-import com.wireguard.util.NonNullForAll;
-
import android.os.Bundle;
-import androidx.annotation.Nullable;
import com.wireguard.android.fragment.TunnelEditorFragment;
import com.wireguard.android.model.ObservableTunnel;
+import com.wireguard.util.NonNullForAll;
+
+import androidx.annotation.Nullable;
/**
* Standalone activity for creating tunnels.
diff --git a/ui/src/main/java/com/wireguard/android/activity/TunnelToggleActivity.java b/ui/src/main/java/com/wireguard/android/activity/TunnelToggleActivity.java
index dbf156b8..82c79b6d 100644
--- a/ui/src/main/java/com/wireguard/android/activity/TunnelToggleActivity.java
+++ b/ui/src/main/java/com/wireguard/android/activity/TunnelToggleActivity.java
@@ -5,15 +5,9 @@
package com.wireguard.android.activity;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.annotation.Nullable;
-import androidx.annotation.RequiresApi;
-import androidx.appcompat.app.AppCompatActivity;
-
import android.content.ComponentName;
-import android.os.Bundle;
import android.os.Build;
+import android.os.Bundle;
import android.service.quicksettings.TileService;
import android.util.Log;
import android.widget.Toast;
@@ -21,9 +15,14 @@ import android.widget.Toast;
import com.wireguard.android.Application;
import com.wireguard.android.QuickTileService;
import com.wireguard.android.R;
-import com.wireguard.android.model.ObservableTunnel;
import com.wireguard.android.backend.Tunnel.State;
+import com.wireguard.android.model.ObservableTunnel;
import com.wireguard.android.util.ErrorMessages;
+import com.wireguard.util.NonNullForAll;
+
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+import androidx.appcompat.app.AppCompatActivity;
@RequiresApi(Build.VERSION_CODES.N)
@NonNullForAll
diff --git a/ui/src/main/java/com/wireguard/android/configStore/ConfigStore.java b/ui/src/main/java/com/wireguard/android/configStore/ConfigStore.java
index c4db4047..d709c1c1 100644
--- a/ui/src/main/java/com/wireguard/android/configStore/ConfigStore.java
+++ b/ui/src/main/java/com/wireguard/android/configStore/ConfigStore.java
@@ -5,9 +5,8 @@
package com.wireguard.android.configStore;
-import com.wireguard.util.NonNullForAll;
-
import com.wireguard.config.Config;
+import com.wireguard.util.NonNullForAll;
import java.util.Set;
diff --git a/ui/src/main/java/com/wireguard/android/configStore/FileConfigStore.java b/ui/src/main/java/com/wireguard/android/configStore/FileConfigStore.java
index 9eb56bde..a97ed2d0 100644
--- a/ui/src/main/java/com/wireguard/android/configStore/FileConfigStore.java
+++ b/ui/src/main/java/com/wireguard/android/configStore/FileConfigStore.java
@@ -5,14 +5,13 @@
package com.wireguard.android.configStore;
-import com.wireguard.util.NonNullForAll;
-
import android.content.Context;
import android.util.Log;
import com.wireguard.android.R;
import com.wireguard.config.BadConfigException;
import com.wireguard.config.Config;
+import com.wireguard.util.NonNullForAll;
import java.io.File;
import java.io.FileInputStream;
diff --git a/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.java b/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.java
index 616f665d..6dfd7856 100644
--- a/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.java
+++ b/ui/src/main/java/com/wireguard/android/databinding/BindingAdapters.java
@@ -5,16 +5,6 @@
package com.wireguard.android.databinding;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.databinding.BindingAdapter;
-import androidx.databinding.DataBindingUtil;
-import androidx.databinding.ObservableList;
-import androidx.databinding.ViewDataBinding;
-import androidx.databinding.adapters.ListenerUtil;
-import androidx.annotation.Nullable;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
import android.text.InputFilter;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
@@ -29,7 +19,16 @@ import com.wireguard.android.widget.ToggleSwitch.OnBeforeCheckedChangeListener;
import com.wireguard.config.Attribute;
import com.wireguard.config.InetNetwork;
import com.wireguard.util.Keyed;
+import com.wireguard.util.NonNullForAll;
+import androidx.annotation.Nullable;
+import androidx.databinding.BindingAdapter;
+import androidx.databinding.DataBindingUtil;
+import androidx.databinding.ObservableList;
+import androidx.databinding.ViewDataBinding;
+import androidx.databinding.adapters.ListenerUtil;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import java9.util.Optional;
/**
diff --git a/ui/src/main/java/com/wireguard/android/databinding/ItemChangeListener.java b/ui/src/main/java/com/wireguard/android/databinding/ItemChangeListener.java
index 284f73b4..efccace1 100644
--- a/ui/src/main/java/com/wireguard/android/databinding/ItemChangeListener.java
+++ b/ui/src/main/java/com/wireguard/android/databinding/ItemChangeListener.java
@@ -5,21 +5,21 @@
package com.wireguard.android.databinding;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.databinding.DataBindingUtil;
-import androidx.databinding.ObservableList;
-import androidx.databinding.ViewDataBinding;
-import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.wireguard.android.BR;
+import com.wireguard.util.NonNullForAll;
import java.lang.ref.WeakReference;
import java.util.Objects;
+import androidx.annotation.Nullable;
+import androidx.databinding.DataBindingUtil;
+import androidx.databinding.ObservableList;
+import androidx.databinding.ViewDataBinding;
+
/**
* Helper class for binding an ObservableList to the children of a ViewGroup.
*/
diff --git a/ui/src/main/java/com/wireguard/android/databinding/ObservableKeyedRecyclerViewAdapter.java b/ui/src/main/java/com/wireguard/android/databinding/ObservableKeyedRecyclerViewAdapter.java
index 36d1917a..c8222cde 100644
--- a/ui/src/main/java/com/wireguard/android/databinding/ObservableKeyedRecyclerViewAdapter.java
+++ b/ui/src/main/java/com/wireguard/android/databinding/ObservableKeyedRecyclerViewAdapter.java
@@ -5,24 +5,24 @@
package com.wireguard.android.databinding;
-import com.wireguard.util.NonNullForAll;
-
import android.content.Context;
-import androidx.databinding.DataBindingUtil;
-import androidx.databinding.ObservableList;
-import androidx.databinding.ViewDataBinding;
-import androidx.annotation.Nullable;
-import androidx.recyclerview.widget.RecyclerView;
-import androidx.recyclerview.widget.RecyclerView.Adapter;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.wireguard.android.BR;
import com.wireguard.android.util.ObservableKeyedList;
import com.wireguard.util.Keyed;
+import com.wireguard.util.NonNullForAll;
import java.lang.ref.WeakReference;
+import androidx.annotation.Nullable;
+import androidx.databinding.DataBindingUtil;
+import androidx.databinding.ObservableList;
+import androidx.databinding.ViewDataBinding;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.recyclerview.widget.RecyclerView.Adapter;
+
/**
* A generic {@code RecyclerView.Adapter} backed by a {@code ObservableKeyedList}.
*/
diff --git a/ui/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java b/ui/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java
index e806615c..ceb1725c 100644
--- a/ui/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java
+++ b/ui/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java
@@ -5,8 +5,6 @@
package com.wireguard.android.fragment;
-import com.wireguard.util.NonNullForAll;
-
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
@@ -14,10 +12,6 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.DialogFragment;
-import androidx.fragment.app.Fragment;
-import androidx.appcompat.app.AlertDialog;
import android.widget.Toast;
import com.wireguard.android.Application;
@@ -27,11 +21,16 @@ import com.wireguard.android.model.ApplicationData;
import com.wireguard.android.util.ErrorMessages;
import com.wireguard.android.util.ObservableKeyedArrayList;
import com.wireguard.android.util.ObservableKeyedList;
+import com.wireguard.util.NonNullForAll;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.fragment.app.DialogFragment;
+import androidx.fragment.app.Fragment;
import java9.util.Comparators;
import java9.util.stream.Collectors;
import java9.util.stream.StreamSupport;
diff --git a/ui/src/main/java/com/wireguard/android/fragment/BaseFragment.java b/ui/src/main/java/com/wireguard/android/fragment/BaseFragment.java
index 6fc6d25b..dfdcbac1 100644
--- a/ui/src/main/java/com/wireguard/android/fragment/BaseFragment.java
+++ b/ui/src/main/java/com/wireguard/android/fragment/BaseFragment.java
@@ -5,29 +5,29 @@
package com.wireguard.android.fragment;
-import com.wireguard.util.NonNullForAll;
-
import android.content.Context;
import android.content.Intent;
-import androidx.databinding.DataBindingUtil;
-import androidx.databinding.ViewDataBinding;
-import androidx.annotation.Nullable;
-import com.google.android.material.snackbar.Snackbar;
-import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
+import com.google.android.material.snackbar.Snackbar;
import com.wireguard.android.Application;
import com.wireguard.android.R;
import com.wireguard.android.activity.BaseActivity;
import com.wireguard.android.activity.BaseActivity.OnSelectedTunnelChangedListener;
import com.wireguard.android.backend.GoBackend;
+import com.wireguard.android.backend.Tunnel.State;
import com.wireguard.android.databinding.TunnelDetailFragmentBinding;
import com.wireguard.android.databinding.TunnelListItemBinding;
import com.wireguard.android.model.ObservableTunnel;
-import com.wireguard.android.backend.Tunnel.State;
import com.wireguard.android.util.ErrorMessages;
+import com.wireguard.util.NonNullForAll;
+
+import androidx.annotation.Nullable;
+import androidx.databinding.DataBindingUtil;
+import androidx.databinding.ViewDataBinding;
+import androidx.fragment.app.Fragment;
/**
* Base class for fragments that need to know the currently-selected tunnel. Only does anything when
diff --git a/ui/src/main/java/com/wireguard/android/fragment/ConfigNamingDialogFragment.java b/ui/src/main/java/com/wireguard/android/fragment/ConfigNamingDialogFragment.java
index 113af0ab..aa152172 100644
--- a/ui/src/main/java/com/wireguard/android/fragment/ConfigNamingDialogFragment.java
+++ b/ui/src/main/java/com/wireguard/android/fragment/ConfigNamingDialogFragment.java
@@ -5,16 +5,11 @@
package com.wireguard.android.fragment;
-import com.wireguard.util.NonNullForAll;
-
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.DialogFragment;
-import androidx.appcompat.app.AlertDialog;
import android.view.inputmethod.InputMethodManager;
import com.wireguard.android.Application;
@@ -22,12 +17,17 @@ import com.wireguard.android.R;
import com.wireguard.android.databinding.ConfigNamingDialogFragmentBinding;
import com.wireguard.config.BadConfigException;
import com.wireguard.config.Config;
+import com.wireguard.util.NonNullForAll;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.fragment.app.DialogFragment;
+
@NonNullForAll
public class ConfigNamingDialogFragment extends DialogFragment {
private static final String KEY_CONFIG_TEXT = "config_text";
diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java b/ui/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java
index a7ebb5d1..762efc5d 100644
--- a/ui/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java
+++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java
@@ -5,12 +5,7 @@
package com.wireguard.android.fragment;
-import com.wireguard.util.NonNullForAll;
-
import android.os.Bundle;
-import androidx.annotation.Nullable;
-import androidx.databinding.DataBindingUtil;
-
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -18,16 +13,20 @@ import android.view.View;
import android.view.ViewGroup;
import com.wireguard.android.R;
+import com.wireguard.android.backend.Tunnel.State;
import com.wireguard.android.databinding.TunnelDetailFragmentBinding;
import com.wireguard.android.databinding.TunnelDetailPeerBinding;
import com.wireguard.android.model.ObservableTunnel;
-import com.wireguard.android.backend.Tunnel.State;
import com.wireguard.android.ui.EdgeToEdge;
import com.wireguard.crypto.Key;
+import com.wireguard.util.NonNullForAll;
import java.util.Timer;
import java.util.TimerTask;
+import androidx.annotation.Nullable;
+import androidx.databinding.DataBindingUtil;
+
/**
* Fragment that shows details about a specific tunnel.
*/
diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.java b/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.java
index 397882d1..811157cc 100644
--- a/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.java
+++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.java
@@ -5,15 +5,9 @@
package com.wireguard.android.fragment;
-import com.wireguard.util.NonNullForAll;
-
import android.app.Activity;
import android.content.Context;
-import androidx.databinding.ObservableList;
import android.os.Bundle;
-import androidx.annotation.Nullable;
-import com.google.android.material.snackbar.Snackbar;
-
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -24,6 +18,7 @@ import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
+import com.google.android.material.snackbar.Snackbar;
import com.wireguard.android.Application;
import com.wireguard.android.R;
import com.wireguard.android.databinding.TunnelEditorFragmentBinding;
@@ -34,11 +29,15 @@ import com.wireguard.android.ui.EdgeToEdge;
import com.wireguard.android.util.ErrorMessages;
import com.wireguard.android.viewmodel.ConfigProxy;
import com.wireguard.config.Config;
+import com.wireguard.util.NonNullForAll;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
+import androidx.annotation.Nullable;
+import androidx.databinding.ObservableList;
+
/**
* Fragment for editing a WireGuard configuration.
*/
diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
index 747f69fa..995a2d59 100644
--- a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
+++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
@@ -5,8 +5,6 @@
package com.wireguard.android.fragment;
-import com.wireguard.util.NonNullForAll;
-
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
@@ -16,13 +14,6 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.OpenableColumns;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import com.google.android.material.snackbar.Snackbar;
-
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.view.ActionMode;
-import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -30,6 +21,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
+import com.google.android.material.snackbar.Snackbar;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
import com.wireguard.android.Application;
@@ -44,6 +36,7 @@ import com.wireguard.android.util.ErrorMessages;
import com.wireguard.android.widget.MultiselectableRelativeLayout;
import com.wireguard.config.BadConfigException;
import com.wireguard.config.Config;
+import com.wireguard.util.NonNullForAll;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -59,6 +52,11 @@ import java.util.Locale;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.view.ActionMode;
+import androidx.recyclerview.widget.RecyclerView;
import java9.util.concurrent.CompletableFuture;
import java9.util.stream.StreamSupport;
diff --git a/ui/src/main/java/com/wireguard/android/model/ApplicationData.java b/ui/src/main/java/com/wireguard/android/model/ApplicationData.java
index a64d9d71..f289f53d 100644
--- a/ui/src/main/java/com/wireguard/android/model/ApplicationData.java
+++ b/ui/src/main/java/com/wireguard/android/model/ApplicationData.java
@@ -5,14 +5,14 @@
package com.wireguard.android.model;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.databinding.BaseObservable;
-import androidx.databinding.Bindable;
import android.graphics.drawable.Drawable;
import com.wireguard.android.BR;
import com.wireguard.util.Keyed;
+import com.wireguard.util.NonNullForAll;
+
+import androidx.databinding.BaseObservable;
+import androidx.databinding.Bindable;
@NonNullForAll
public class ApplicationData extends BaseObservable implements Keyed<String> {
diff --git a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.java b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.java
index 70e3bac9..3a9fa229 100644
--- a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.java
+++ b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.java
@@ -5,19 +5,17 @@
package com.wireguard.android.model;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.databinding.BaseObservable;
-import androidx.databinding.Bindable;
-import androidx.annotation.Nullable;
-
import com.wireguard.android.BR;
import com.wireguard.android.backend.Statistics;
import com.wireguard.android.backend.Tunnel;
import com.wireguard.android.util.ExceptionLoggers;
import com.wireguard.config.Config;
import com.wireguard.util.Keyed;
+import com.wireguard.util.NonNullForAll;
+import androidx.annotation.Nullable;
+import androidx.databinding.BaseObservable;
+import androidx.databinding.Bindable;
import java9.util.concurrent.CompletableFuture;
import java9.util.concurrent.CompletionStage;
diff --git a/ui/src/main/java/com/wireguard/android/model/TunnelManager.java b/ui/src/main/java/com/wireguard/android/model/TunnelManager.java
index 77304091..4322b9e6 100644
--- a/ui/src/main/java/com/wireguard/android/model/TunnelManager.java
+++ b/ui/src/main/java/com/wireguard/android/model/TunnelManager.java
@@ -5,32 +5,31 @@
package com.wireguard.android.model;
-import com.wireguard.util.NonNullForAll;
-
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-import androidx.databinding.BaseObservable;
-import androidx.databinding.Bindable;
-import androidx.annotation.Nullable;
import com.wireguard.android.Application;
import com.wireguard.android.BR;
import com.wireguard.android.R;
-import com.wireguard.android.configStore.ConfigStore;
+import com.wireguard.android.backend.Statistics;
import com.wireguard.android.backend.Tunnel;
import com.wireguard.android.backend.Tunnel.State;
-import com.wireguard.android.backend.Statistics;
+import com.wireguard.android.configStore.ConfigStore;
import com.wireguard.android.util.ExceptionLoggers;
import com.wireguard.android.util.ObservableSortedKeyedArrayList;
import com.wireguard.android.util.ObservableSortedKeyedList;
import com.wireguard.config.Config;
+import com.wireguard.util.NonNullForAll;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.Set;
+import androidx.annotation.Nullable;
+import androidx.databinding.BaseObservable;
+import androidx.databinding.Bindable;
import java9.util.Comparators;
import java9.util.concurrent.CompletableFuture;
import java9.util.concurrent.CompletionStage;
diff --git a/ui/src/main/java/com/wireguard/android/preference/LogExporterPreference.java b/ui/src/main/java/com/wireguard/android/preference/LogExporterPreference.java
index 69608e4d..43494aaa 100644
--- a/ui/src/main/java/com/wireguard/android/preference/LogExporterPreference.java
+++ b/ui/src/main/java/com/wireguard/android/preference/LogExporterPreference.java
@@ -5,28 +5,27 @@
package com.wireguard.android.preference;
-import com.wireguard.util.NonNullForAll;
-
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
-import androidx.annotation.Nullable;
-import com.google.android.material.snackbar.Snackbar;
-import androidx.preference.Preference;
-
import android.util.AttributeSet;
import android.util.Log;
+import com.google.android.material.snackbar.Snackbar;
import com.wireguard.android.Application;
import com.wireguard.android.R;
import com.wireguard.android.util.DownloadsFileSaver;
import com.wireguard.android.util.DownloadsFileSaver.DownloadsFile;
import com.wireguard.android.util.ErrorMessages;
import com.wireguard.android.util.FragmentUtils;
+import com.wireguard.util.NonNullForAll;
import java.io.BufferedReader;
import java.io.InputStreamReader;
+import androidx.annotation.Nullable;
+import androidx.preference.Preference;
+
/**
* Preference implementing a button that asynchronously exports logs.
*/
diff --git a/ui/src/main/java/com/wireguard/android/preference/ModuleDownloaderPreference.java b/ui/src/main/java/com/wireguard/android/preference/ModuleDownloaderPreference.java
index 8858c725..86c943b3 100644
--- a/ui/src/main/java/com/wireguard/android/preference/ModuleDownloaderPreference.java
+++ b/ui/src/main/java/com/wireguard/android/preference/ModuleDownloaderPreference.java
@@ -5,8 +5,6 @@
package com.wireguard.android.preference;
-import com.wireguard.util.NonNullForAll;
-
import android.content.Context;
import android.content.Intent;
import android.system.OsConstants;
@@ -16,6 +14,7 @@ import android.widget.Toast;
import com.wireguard.android.Application;
import com.wireguard.android.R;
import com.wireguard.android.util.ErrorMessages;
+import com.wireguard.util.NonNullForAll;
import androidx.annotation.Nullable;
import androidx.preference.Preference;
diff --git a/ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java b/ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java
index 61752598..6219ed40 100644
--- a/ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java
+++ b/ui/src/main/java/com/wireguard/android/preference/ToolsInstallerPreference.java
@@ -5,16 +5,16 @@
package com.wireguard.android.preference;
-import com.wireguard.util.NonNullForAll;
-
import android.content.Context;
-import androidx.annotation.Nullable;
-import androidx.preference.Preference;
import android.util.AttributeSet;
import com.wireguard.android.Application;
import com.wireguard.android.R;
import com.wireguard.android.util.ToolsInstaller;
+import com.wireguard.util.NonNullForAll;
+
+import androidx.annotation.Nullable;
+import androidx.preference.Preference;
/**
* Preference implementing a button that asynchronously runs {@code ToolsInstaller} and displays the
diff --git a/ui/src/main/java/com/wireguard/android/preference/VersionPreference.java b/ui/src/main/java/com/wireguard/android/preference/VersionPreference.java
index 542fe2d2..b07df3e5 100644
--- a/ui/src/main/java/com/wireguard/android/preference/VersionPreference.java
+++ b/ui/src/main/java/com/wireguard/android/preference/VersionPreference.java
@@ -5,14 +5,10 @@
package com.wireguard.android.preference;
-import com.wireguard.util.NonNullForAll;
-
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
-import androidx.annotation.Nullable;
-import androidx.preference.Preference;
import android.util.AttributeSet;
import com.wireguard.android.Application;
@@ -21,9 +17,13 @@ import com.wireguard.android.R;
import com.wireguard.android.backend.Backend;
import com.wireguard.android.backend.GoBackend;
import com.wireguard.android.backend.WgQuickBackend;
+import com.wireguard.util.NonNullForAll;
import java.util.Locale;
+import androidx.annotation.Nullable;
+import androidx.preference.Preference;
+
@NonNullForAll
public class VersionPreference extends Preference {
@Nullable private String versionSummary;
diff --git a/ui/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java b/ui/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java
index 8f86fec7..0740787f 100644
--- a/ui/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java
+++ b/ui/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java
@@ -5,17 +5,13 @@
package com.wireguard.android.preference;
-import com.wireguard.util.NonNullForAll;
-
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
-import androidx.annotation.Nullable;
-import com.google.android.material.snackbar.Snackbar;
-import androidx.preference.Preference;
import android.util.AttributeSet;
import android.util.Log;
+import com.google.android.material.snackbar.Snackbar;
import com.wireguard.android.Application;
import com.wireguard.android.R;
import com.wireguard.android.model.ObservableTunnel;
@@ -24,6 +20,7 @@ import com.wireguard.android.util.DownloadsFileSaver.DownloadsFile;
import com.wireguard.android.util.ErrorMessages;
import com.wireguard.android.util.FragmentUtils;
import com.wireguard.config.Config;
+import com.wireguard.util.NonNullForAll;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -31,6 +28,8 @@ import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
+import androidx.annotation.Nullable;
+import androidx.preference.Preference;
import java9.util.concurrent.CompletableFuture;
/**
diff --git a/ui/src/main/java/com/wireguard/android/ui/EdgeToEdge.kt b/ui/src/main/java/com/wireguard/android/ui/EdgeToEdge.kt
index 52a19657..ac4d214d 100644
--- a/ui/src/main/java/com/wireguard/android/ui/EdgeToEdge.kt
+++ b/ui/src/main/java/com/wireguard/android/ui/EdgeToEdge.kt
@@ -6,12 +6,7 @@ package com.wireguard.android.ui
import android.view.View
import android.view.ViewGroup
-import androidx.core.view.marginBottom
-import androidx.core.view.marginLeft
-import androidx.core.view.marginRight
-import androidx.core.view.marginTop
-import androidx.core.view.updateLayoutParams
-import androidx.core.view.updatePadding
+import androidx.core.view.*
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
/**
diff --git a/ui/src/main/java/com/wireguard/android/util/AsyncWorker.java b/ui/src/main/java/com/wireguard/android/util/AsyncWorker.java
index f8341976..461e2b64 100644
--- a/ui/src/main/java/com/wireguard/android/util/AsyncWorker.java
+++ b/ui/src/main/java/com/wireguard/android/util/AsyncWorker.java
@@ -5,10 +5,10 @@
package com.wireguard.android.util;
-import com.wireguard.util.NonNullForAll;
-
import android.os.Handler;
+import com.wireguard.util.NonNullForAll;
+
import java.util.concurrent.Executor;
import java9.util.concurrent.CompletableFuture;
diff --git a/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.java b/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.java
index 649fe261..e9f65c59 100644
--- a/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.java
+++ b/ui/src/main/java/com/wireguard/android/util/ClipboardUtils.java
@@ -5,15 +5,15 @@
package com.wireguard.android.util;
-import com.wireguard.util.NonNullForAll;
-
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
-import com.google.android.material.snackbar.Snackbar;
import android.view.View;
import android.widget.TextView;
+import com.google.android.material.snackbar.Snackbar;
+import com.wireguard.util.NonNullForAll;
+
/**
* Standalone utilities for interacting with the system clipboard.
*/
diff --git a/ui/src/main/java/com/wireguard/android/util/DownloadsFileSaver.java b/ui/src/main/java/com/wireguard/android/util/DownloadsFileSaver.java
index 3f80a562..b4772ef4 100644
--- a/ui/src/main/java/com/wireguard/android/util/DownloadsFileSaver.java
+++ b/ui/src/main/java/com/wireguard/android/util/DownloadsFileSaver.java
@@ -5,8 +5,6 @@
package com.wireguard.android.util;
-import com.wireguard.util.NonNullForAll;
-
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@@ -18,6 +16,7 @@ import android.provider.MediaStore;
import android.provider.MediaStore.MediaColumns;
import com.wireguard.android.R;
+import com.wireguard.util.NonNullForAll;
import java.io.File;
import java.io.FileOutputStream;
diff --git a/ui/src/main/java/com/wireguard/android/util/ErrorMessages.java b/ui/src/main/java/com/wireguard/android/util/ErrorMessages.java
index 3b818251..accc7ef7 100644
--- a/ui/src/main/java/com/wireguard/android/util/ErrorMessages.java
+++ b/ui/src/main/java/com/wireguard/android/util/ErrorMessages.java
@@ -5,13 +5,9 @@
package com.wireguard.android.util;
-import com.wireguard.util.NonNullForAll;
-
import android.content.res.Resources;
import android.os.RemoteException;
-import androidx.annotation.Nullable;
-
import com.wireguard.android.Application;
import com.wireguard.android.R;
import com.wireguard.android.backend.BackendException;
@@ -24,11 +20,13 @@ import com.wireguard.config.ParseException;
import com.wireguard.crypto.Key.Format;
import com.wireguard.crypto.KeyFormatException;
import com.wireguard.crypto.KeyFormatException.Type;
+import com.wireguard.util.NonNullForAll;
import java.net.InetAddress;
import java.util.EnumMap;
import java.util.Map;
+import androidx.annotation.Nullable;
import java9.util.Maps;
@NonNullForAll
diff --git a/ui/src/main/java/com/wireguard/android/util/ExceptionLoggers.java b/ui/src/main/java/com/wireguard/android/util/ExceptionLoggers.java
index 3e56bd55..8a58afbe 100644
--- a/ui/src/main/java/com/wireguard/android/util/ExceptionLoggers.java
+++ b/ui/src/main/java/com/wireguard/android/util/ExceptionLoggers.java
@@ -5,11 +5,9 @@
package com.wireguard.android.util;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.annotation.Nullable;
import android.util.Log;
+import androidx.annotation.Nullable;
import java9.util.function.BiConsumer;
/**
diff --git a/ui/src/main/java/com/wireguard/android/util/FragmentUtils.java b/ui/src/main/java/com/wireguard/android/util/FragmentUtils.java
index 50a49fa1..f93fd60d 100644
--- a/ui/src/main/java/com/wireguard/android/util/FragmentUtils.java
+++ b/ui/src/main/java/com/wireguard/android/util/FragmentUtils.java
@@ -4,13 +4,13 @@
*/
package com.wireguard.android.util;
-import com.wireguard.util.NonNullForAll;
-
import android.content.Context;
-import androidx.preference.Preference;
import android.view.ContextThemeWrapper;
import com.wireguard.android.activity.SettingsActivity;
+import com.wireguard.util.NonNullForAll;
+
+import androidx.preference.Preference;
@NonNullForAll
public final class FragmentUtils {
diff --git a/ui/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java b/ui/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java
index bf16d921..e233588c 100644
--- a/ui/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java
+++ b/ui/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java
@@ -5,17 +5,16 @@
package com.wireguard.android.util;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.databinding.ObservableArrayList;
-import androidx.annotation.Nullable;
-
import com.wireguard.util.Keyed;
+import com.wireguard.util.NonNullForAll;
import java.util.Collection;
import java.util.ListIterator;
import java.util.Objects;
+import androidx.annotation.Nullable;
+import androidx.databinding.ObservableArrayList;
+
/**
* ArrayList that allows looking up elements by some key property. As the key property must always
* be retrievable, this list cannot hold {@code null} elements. Because this class places no
diff --git a/ui/src/main/java/com/wireguard/android/util/ObservableKeyedList.java b/ui/src/main/java/com/wireguard/android/util/ObservableKeyedList.java
index 1c430493..b191655e 100644
--- a/ui/src/main/java/com/wireguard/android/util/ObservableKeyedList.java
+++ b/ui/src/main/java/com/wireguard/android/util/ObservableKeyedList.java
@@ -5,13 +5,12 @@
package com.wireguard.android.util;
+import com.wireguard.util.Keyed;
+import com.wireguard.util.KeyedList;
import com.wireguard.util.NonNullForAll;
import androidx.databinding.ObservableList;
-import com.wireguard.util.Keyed;
-import com.wireguard.util.KeyedList;
-
/**
* A list that is both keyed and observable.
*/
diff --git a/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java b/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java
index 77d6bbf3..3af354b2 100644
--- a/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java
+++ b/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java
@@ -5,11 +5,8 @@
package com.wireguard.android.util;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.annotation.Nullable;
-
import com.wireguard.util.Keyed;
+import com.wireguard.util.NonNullForAll;
import com.wireguard.util.SortedKeyedList;
import java.util.AbstractList;
@@ -21,6 +18,8 @@ import java.util.NoSuchElementException;
import java.util.Set;
import java.util.Spliterator;
+import androidx.annotation.Nullable;
+
/**
* KeyedArrayList that enforces uniqueness and sorted order across the set of keys. This class uses
* binary search to improve lookup and replacement times to O(log(n)). However, due to the
diff --git a/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java b/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java
index 59531408..84e72e1e 100644
--- a/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java
+++ b/ui/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java
@@ -5,9 +5,8 @@
package com.wireguard.android.util;
-import com.wireguard.util.NonNullForAll;
-
import com.wireguard.util.Keyed;
+import com.wireguard.util.NonNullForAll;
import com.wireguard.util.SortedKeyedList;
/**
diff --git a/ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.java b/ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.java
index cc7bc082..d44a5976 100644
--- a/ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.java
+++ b/ui/src/main/java/com/wireguard/android/viewmodel/ConfigProxy.java
@@ -5,20 +5,20 @@
package com.wireguard.android.viewmodel;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.databinding.ObservableArrayList;
-import androidx.databinding.ObservableList;
import android.os.Parcel;
import android.os.Parcelable;
import com.wireguard.config.BadConfigException;
import com.wireguard.config.Config;
import com.wireguard.config.Peer;
+import com.wireguard.util.NonNullForAll;
import java.util.ArrayList;
import java.util.Collection;
+import androidx.databinding.ObservableArrayList;
+import androidx.databinding.ObservableList;
+
@NonNullForAll
public class ConfigProxy implements Parcelable {
public static final Parcelable.Creator<ConfigProxy> CREATOR = new ConfigProxyCreator();
diff --git a/ui/src/main/java/com/wireguard/android/viewmodel/InterfaceProxy.java b/ui/src/main/java/com/wireguard/android/viewmodel/InterfaceProxy.java
index da9c4f10..2bf87ea4 100644
--- a/ui/src/main/java/com/wireguard/android/viewmodel/InterfaceProxy.java
+++ b/ui/src/main/java/com/wireguard/android/viewmodel/InterfaceProxy.java
@@ -5,12 +5,6 @@
package com.wireguard.android.viewmodel;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.databinding.BaseObservable;
-import androidx.databinding.Bindable;
-import androidx.databinding.ObservableArrayList;
-import androidx.databinding.ObservableList;
import android.os.Parcel;
import android.os.Parcelable;
@@ -21,10 +15,15 @@ import com.wireguard.config.Interface;
import com.wireguard.crypto.Key;
import com.wireguard.crypto.KeyFormatException;
import com.wireguard.crypto.KeyPair;
+import com.wireguard.util.NonNullForAll;
import java.net.InetAddress;
import java.util.List;
+import androidx.databinding.BaseObservable;
+import androidx.databinding.Bindable;
+import androidx.databinding.ObservableArrayList;
+import androidx.databinding.ObservableList;
import java9.util.stream.Collectors;
import java9.util.stream.StreamSupport;
diff --git a/ui/src/main/java/com/wireguard/android/viewmodel/PeerProxy.java b/ui/src/main/java/com/wireguard/android/viewmodel/PeerProxy.java
index 7fc614a1..6e01d35c 100644
--- a/ui/src/main/java/com/wireguard/android/viewmodel/PeerProxy.java
+++ b/ui/src/main/java/com/wireguard/android/viewmodel/PeerProxy.java
@@ -5,15 +5,8 @@
package com.wireguard.android.viewmodel;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.databinding.BaseObservable;
-import androidx.databinding.Bindable;
-import androidx.databinding.Observable;
-import androidx.databinding.ObservableList;
import android.os.Parcel;
import android.os.Parcelable;
-import androidx.annotation.Nullable;
import com.wireguard.android.BR;
import com.wireguard.config.Attribute;
@@ -21,6 +14,7 @@ import com.wireguard.config.BadConfigException;
import com.wireguard.config.InetEndpoint;
import com.wireguard.config.Peer;
import com.wireguard.crypto.Key;
+import com.wireguard.util.NonNullForAll;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -29,6 +23,11 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
+import androidx.annotation.Nullable;
+import androidx.databinding.BaseObservable;
+import androidx.databinding.Bindable;
+import androidx.databinding.Observable;
+import androidx.databinding.ObservableList;
import java9.util.Lists;
import java9.util.Sets;
import java9.util.stream.Collectors;
diff --git a/ui/src/main/java/com/wireguard/android/widget/KeyInputFilter.java b/ui/src/main/java/com/wireguard/android/widget/KeyInputFilter.java
index c91b12ff..82c421cb 100644
--- a/ui/src/main/java/com/wireguard/android/widget/KeyInputFilter.java
+++ b/ui/src/main/java/com/wireguard/android/widget/KeyInputFilter.java
@@ -5,14 +5,14 @@
package com.wireguard.android.widget;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.annotation.Nullable;
import android.text.InputFilter;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import com.wireguard.crypto.Key;
+import com.wireguard.util.NonNullForAll;
+
+import androidx.annotation.Nullable;
/**
* InputFilter for entering WireGuard private/public keys encoded with base64.
diff --git a/ui/src/main/java/com/wireguard/android/widget/MultiselectableRelativeLayout.java b/ui/src/main/java/com/wireguard/android/widget/MultiselectableRelativeLayout.java
index 16742ae8..aa0d08d9 100644
--- a/ui/src/main/java/com/wireguard/android/widget/MultiselectableRelativeLayout.java
+++ b/ui/src/main/java/com/wireguard/android/widget/MultiselectableRelativeLayout.java
@@ -5,13 +5,12 @@
package com.wireguard.android.widget;
-import com.wireguard.util.NonNullForAll;
-
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import com.wireguard.android.R;
+import com.wireguard.util.NonNullForAll;
@NonNullForAll
public class MultiselectableRelativeLayout extends RelativeLayout {
diff --git a/ui/src/main/java/com/wireguard/android/widget/NameInputFilter.java b/ui/src/main/java/com/wireguard/android/widget/NameInputFilter.java
index 1ec14ac0..32f4f262 100644
--- a/ui/src/main/java/com/wireguard/android/widget/NameInputFilter.java
+++ b/ui/src/main/java/com/wireguard/android/widget/NameInputFilter.java
@@ -5,14 +5,14 @@
package com.wireguard.android.widget;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.annotation.Nullable;
import android.text.InputFilter;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import com.wireguard.android.backend.Tunnel;
+import com.wireguard.util.NonNullForAll;
+
+import androidx.annotation.Nullable;
/**
* InputFilter for entering WireGuard configuration names (Linux interface names).
diff --git a/ui/src/main/java/com/wireguard/android/widget/SlashDrawable.java b/ui/src/main/java/com/wireguard/android/widget/SlashDrawable.java
index 4a3142ea..3cb151af 100644
--- a/ui/src/main/java/com/wireguard/android/widget/SlashDrawable.java
+++ b/ui/src/main/java/com/wireguard/android/widget/SlashDrawable.java
@@ -6,8 +6,6 @@
package com.wireguard.android.widget;
-import com.wireguard.util.NonNullForAll;
-
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.res.ColorStateList;
@@ -24,11 +22,14 @@ import android.graphics.RectF;
import android.graphics.Region;
import android.graphics.drawable.Drawable;
import android.os.Build;
+import android.util.FloatProperty;
+
+import com.wireguard.util.NonNullForAll;
+
import androidx.annotation.ColorInt;
import androidx.annotation.IntRange;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
-import android.util.FloatProperty;
@RequiresApi(Build.VERSION_CODES.N)
@NonNullForAll
diff --git a/ui/src/main/java/com/wireguard/android/widget/ToggleSwitch.java b/ui/src/main/java/com/wireguard/android/widget/ToggleSwitch.java
index 3aec3329..a0cf2ac6 100644
--- a/ui/src/main/java/com/wireguard/android/widget/ToggleSwitch.java
+++ b/ui/src/main/java/com/wireguard/android/widget/ToggleSwitch.java
@@ -6,14 +6,15 @@
package com.wireguard.android.widget;
-import com.wireguard.util.NonNullForAll;
-
import android.content.Context;
import android.os.Parcelable;
-import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.Switch;
+import com.wireguard.util.NonNullForAll;
+
+import androidx.annotation.Nullable;
+
@NonNullForAll
public class ToggleSwitch extends Switch {
private boolean isRestoringState;
diff --git a/ui/src/main/java/com/wireguard/util/Keyed.java b/ui/src/main/java/com/wireguard/util/Keyed.java
index b4dc40cd..0cc85d50 100644
--- a/ui/src/main/java/com/wireguard/util/Keyed.java
+++ b/ui/src/main/java/com/wireguard/util/Keyed.java
@@ -5,8 +5,6 @@
package com.wireguard.util;
-import com.wireguard.util.NonNullForAll;
-
/**
* Interface for objects that have a identifying key of the given type.
*/
diff --git a/ui/src/main/java/com/wireguard/util/KeyedList.java b/ui/src/main/java/com/wireguard/util/KeyedList.java
index e0d06dbb..48bba484 100644
--- a/ui/src/main/java/com/wireguard/util/KeyedList.java
+++ b/ui/src/main/java/com/wireguard/util/KeyedList.java
@@ -5,13 +5,11 @@
package com.wireguard.util;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.annotation.Nullable;
-
import java.util.Collection;
import java.util.List;
+import androidx.annotation.Nullable;
+
/**
* A list containing elements that can be looked up by key. A {@code KeyedList} cannot contain
* {@code null} elements.
diff --git a/ui/src/main/java/com/wireguard/util/SortedKeyedList.java b/ui/src/main/java/com/wireguard/util/SortedKeyedList.java
index 7afc919e..80c50bed 100644
--- a/ui/src/main/java/com/wireguard/util/SortedKeyedList.java
+++ b/ui/src/main/java/com/wireguard/util/SortedKeyedList.java
@@ -5,14 +5,12 @@
package com.wireguard.util;
-import com.wireguard.util.NonNullForAll;
-
-import androidx.annotation.Nullable;
-
import java.util.Collection;
import java.util.Comparator;
import java.util.Set;
+import androidx.annotation.Nullable;
+
/**
* A keyed list where all elements are sorted by the comparator returned by {@code comparator()}
* applied to their keys.