MonkeyedSnackbar: remove

This didn't actually help with much and caused problems.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-08-26 10:49:58 -06:00
parent 61d4f17f5d
commit 85462de254
7 changed files with 10 additions and 53 deletions

View File

@ -27,7 +27,6 @@ import com.wireguard.android.databinding.TunnelListItemBinding;
import com.wireguard.android.model.Tunnel;
import com.wireguard.android.model.Tunnel.State;
import com.wireguard.android.util.ExceptionLoggers;
import com.wireguard.android.widget.MonkeyedSnackbar;
/**
* Base class for fragments that need to know the currently-selected tunnel. Only does anything when
@ -119,7 +118,7 @@ public abstract class BaseFragment extends Fragment implements OnSelectedTunnelC
final String message = getContext().getString(messageResId, error);
final View view = getView();
if (view != null)
MonkeyedSnackbar.make(view, message, Snackbar.LENGTH_LONG).show();
Snackbar.make(view, message, Snackbar.LENGTH_LONG).show();
else
Toast.makeText(getContext(), message, Toast.LENGTH_LONG).show();
Log.e(TAG, message, throwable);

View File

@ -32,7 +32,6 @@ import com.wireguard.android.fragment.AppListDialogFragment.AppExclusionListener
import com.wireguard.android.model.Tunnel;
import com.wireguard.android.model.TunnelManager;
import com.wireguard.android.util.ExceptionLoggers;
import com.wireguard.android.widget.MonkeyedSnackbar;
import com.wireguard.config.Attribute;
import com.wireguard.config.Config;
import com.wireguard.config.Peer;
@ -73,7 +72,7 @@ public class TunnelEditorFragment extends BaseFragment implements AppExclusionLi
message = getString(R.string.config_save_error, savedTunnel.getName(), error);
Log.e(TAG, message, throwable);
if (binding != null) {
MonkeyedSnackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
Snackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
}
}
}
@ -196,7 +195,7 @@ public class TunnelEditorFragment extends BaseFragment implements AppExclusionLi
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);
MonkeyedSnackbar.make(binding.mainContainer, error, Snackbar.LENGTH_LONG).show();
Snackbar.make(binding.mainContainer, error, Snackbar.LENGTH_LONG).show();
return false;
}
if (tunnel == null) {
@ -249,7 +248,7 @@ public class TunnelEditorFragment extends BaseFragment implements AppExclusionLi
message = getString(R.string.tunnel_create_error, error);
Log.e(TAG, message, throwable);
if (binding != null) {
MonkeyedSnackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
Snackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
}
}
}
@ -268,7 +267,7 @@ public class TunnelEditorFragment extends BaseFragment implements AppExclusionLi
message = getString(R.string.tunnel_rename_error, error);
Log.e(TAG, message, throwable);
if (binding != null) {
MonkeyedSnackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
Snackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
}
}
}

View File

@ -40,7 +40,6 @@ import com.wireguard.android.databinding.TunnelListItemBinding;
import com.wireguard.android.model.Tunnel;
import com.wireguard.android.util.ExceptionLoggers;
import com.wireguard.android.util.ObservableSortedKeyedList;
import com.wireguard.android.widget.MonkeyedSnackbar;
import com.wireguard.android.widget.MultiselectableRelativeLayout;
import com.wireguard.android.widget.fab.FloatingActionsMenuRecyclerViewScrollListener;
import com.wireguard.config.Config;
@ -290,7 +289,7 @@ public class TunnelListFragment extends BaseFragment {
Log.e(TAG, message, throwable);
}
if (binding != null) {
MonkeyedSnackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
Snackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
}
}
@ -316,7 +315,7 @@ public class TunnelListFragment extends BaseFragment {
tunnels.size(), tunnels.size() + throwables.size());
if (binding != null)
MonkeyedSnackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
Snackbar.make(binding.mainContainer, message, Snackbar.LENGTH_LONG).show();
}
@Override

View File

@ -20,7 +20,6 @@ import com.wireguard.android.Application;
import com.wireguard.android.R;
import com.wireguard.android.util.ExceptionLoggers;
import com.wireguard.android.util.FragmentUtils;
import com.wireguard.android.widget.MonkeyedSnackbar;
import java.io.BufferedReader;
import java.io.File;
@ -80,7 +79,7 @@ public class LogExporterPreference extends Preference {
final String error = ExceptionLoggers.unwrapMessage(throwable);
final String message = getContext().getString(R.string.log_export_error, error);
Log.e(TAG, message, throwable);
MonkeyedSnackbar.make(
Snackbar.make(
FragmentUtils.getPrefActivity(this).findViewById(android.R.id.content),
message, Snackbar.LENGTH_LONG).show();
setEnabled(true);

View File

@ -21,7 +21,6 @@ import com.wireguard.android.R;
import com.wireguard.android.model.Tunnel;
import com.wireguard.android.util.ExceptionLoggers;
import com.wireguard.android.util.FragmentUtils;
import com.wireguard.android.widget.MonkeyedSnackbar;
import com.wireguard.config.Config;
import java.io.File;
@ -89,7 +88,7 @@ public class ZipExporterPreference extends Preference {
final String error = ExceptionLoggers.unwrapMessage(throwable);
final String message = getContext().getString(R.string.zip_export_error, error);
Log.e(TAG, message, throwable);
MonkeyedSnackbar.make(
Snackbar.make(
FragmentUtils.getPrefActivity(this).findViewById(android.R.id.content),
message, Snackbar.LENGTH_LONG).show();
setEnabled(true);

View File

@ -13,8 +13,6 @@ import android.support.design.widget.Snackbar;
import android.view.View;
import android.widget.TextView;
import com.wireguard.android.widget.MonkeyedSnackbar;
/**
* Standalone utilities for interacting with the system clipboard.
*/
@ -35,6 +33,6 @@ public final class ClipboardUtils {
return;
final CharSequence description = view.getContentDescription();
((ClipboardManager) service).setPrimaryClip(ClipData.newPlainText(description, text));
MonkeyedSnackbar.make(view, description + " copied to clipboard", Snackbar.LENGTH_LONG).show();
Snackbar.make(view, description + " copied to clipboard", Snackbar.LENGTH_LONG).show();
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright © 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package com.wireguard.android.widget;
import android.support.annotation.NonNull;
import android.support.design.widget.BaseTransientBottomBar;
import android.support.design.widget.Snackbar;
import android.util.Log;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import java.lang.reflect.Field;
public class MonkeyedSnackbar {
private static final String TAG = "WireGuard/" + MonkeyedSnackbar.class.getSimpleName();
public static Snackbar make(@NonNull final View view, @NonNull final CharSequence text,
@BaseTransientBottomBar.Duration final int duration) {
final Snackbar snackbar = Snackbar.make(view, text, duration);
try {
final Field accessibilityManager = Snackbar.class.getSuperclass().getDeclaredField("mAccessibilityManager");
accessibilityManager.setAccessible(true);
final Field isEnabled = AccessibilityManager.class.getDeclaredField("mIsEnabled");
isEnabled.setAccessible(true);
isEnabled.setBoolean(accessibilityManager.get(snackbar), false);
} catch (final Exception e) {
Log.e(TAG, "Unable to force-enable snackbar animations", e);
}
return snackbar;
}
}