summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/android
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2018-05-16 11:23:12 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-16 17:31:31 +0200
commit9c3091456dde1c2600f52e1dd1b9a6083f6b0272 (patch)
treed99a687a50cdf8ff1ba04368de96e4eb9ede99c8 /app/src/main/java/com/wireguard/android
parent515be5e4530ba51aca2100b2e1ab43df086c9d47 (diff)
android: Directly use views for snackbars
There should be no need to deference an extra variable. Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/wireguard/android')
-rw-r--r--app/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.java13
-rw-r--r--app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java10
2 files changed, 8 insertions, 15 deletions
diff --git a/app/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.java b/app/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.java
index f7ed5e77..b7ce8820 100644
--- a/app/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.java
+++ b/app/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.java
@@ -10,7 +10,6 @@ import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
-import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.util.Log;
import android.view.LayoutInflater;
@@ -59,8 +58,7 @@ public class TunnelEditorFragment extends BaseFragment {
message = getString(R.string.config_save_error, savedTunnel.getName(), error);
Log.e(TAG, message, throwable);
if (binding != null) {
- final CoordinatorLayout container = binding.mainContainer;
- Snackbar.make(container, message, Snackbar.LENGTH_LONG).show();
+ Snackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
}
}
}
@@ -125,8 +123,7 @@ public class TunnelEditorFragment extends BaseFragment {
final String tunnelName = tunnel == null ? binding.getConfig().getName() : tunnel.getName();
final String message = getString(R.string.config_save_error, tunnelName, error);
Log.e(TAG, message, e);
- final CoordinatorLayout container = binding.mainContainer;
- Snackbar.make(container, error, Snackbar.LENGTH_LONG).show();
+ Snackbar.make(binding.mainContainer, error, Snackbar.LENGTH_LONG).show();
return false;
}
if (tunnel == null) {
@@ -178,8 +175,7 @@ public class TunnelEditorFragment extends BaseFragment {
message = getString(R.string.tunnel_create_error, error);
Log.e(TAG, message, throwable);
if (binding != null) {
- final CoordinatorLayout container = binding.mainContainer;
- Snackbar.make(container, message, Snackbar.LENGTH_LONG).show();
+ Snackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
}
}
}
@@ -198,8 +194,7 @@ public class TunnelEditorFragment extends BaseFragment {
message = getString(R.string.tunnel_rename_error, error);
Log.e(TAG, message, throwable);
if (binding != null) {
- final CoordinatorLayout container = binding.mainContainer;
- Snackbar.make(container, message, Snackbar.LENGTH_LONG).show();
+ Snackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
}
}
}
diff --git a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
index fcbadbfe..aae12c5f 100644
--- a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
+++ b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
@@ -16,7 +16,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.provider.OpenableColumns;
import android.support.annotation.NonNull;
-import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.util.Log;
import android.util.SparseBooleanArray;
@@ -142,7 +141,8 @@ public class TunnelListFragment extends BaseFragment {
}
}
} else {
- futureTunnels.add(tunnelManager.create(name, Config.from(contentResolver.openInputStream(uri))).toCompletableFuture());
+ futureTunnels.add(tunnelManager.create(name,
+ Config.from(contentResolver.openInputStream(uri))).toCompletableFuture());
}
if (futureTunnels.isEmpty()) {
@@ -244,8 +244,7 @@ public class TunnelListFragment extends BaseFragment {
Log.e(TAG, message, throwable);
}
if (binding != null) {
- final CoordinatorLayout container = binding.mainContainer;
- Snackbar.make(container, message, Snackbar.LENGTH_LONG).show();
+ Snackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
}
}
@@ -271,8 +270,7 @@ public class TunnelListFragment extends BaseFragment {
tunnels.size(), tunnels.size() + throwables.size());
if (binding != null) {
- final CoordinatorLayout container = binding.mainContainer;
- Snackbar.make(container, message, Snackbar.LENGTH_LONG).show();
+ Snackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
}
}