mirror of
https://github.com/amnezia-vpn/amneziawg-android.git
synced 2026-07-03 14:05:13 +02:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ffb8bccbc5 | |||
| 08170f7e55 | |||
| 28d47b3470 | |||
| 8e3586328c | |||
| f315654d40 | |||
| fdfab18d45 | |||
| d43e77867c | |||
| df03bdd7f9 |
+2
-2
@@ -17,8 +17,8 @@ android {
|
||||
applicationId 'com.wireguard.android'
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 27
|
||||
versionCode 433
|
||||
versionName '0.0.20180716'
|
||||
versionCode 434
|
||||
versionName '0.0.20180718'
|
||||
}
|
||||
// If the keystore file exists
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
|
||||
@@ -55,12 +55,17 @@ public class QuickTileService extends TileService {
|
||||
icon.setBounds(0, 0, c.getWidth(), c.getHeight());
|
||||
icon.draw(c);
|
||||
iconOn = Icon.createWithBitmap(b);
|
||||
icon.setSlashed(true);
|
||||
b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
||||
c = new Canvas(b);
|
||||
icon.setBounds(0, 0, c.getWidth(), c.getHeight());
|
||||
icon.draw(c);
|
||||
iconOff = Icon.createWithBitmap(b);
|
||||
/* TODO(msf): Change this to an explicit test for P when we start targetting SDK 28 */
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1) {
|
||||
iconOff = iconOn;
|
||||
} else {
|
||||
icon.setSlashed(true);
|
||||
b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
||||
c = new Canvas(b);
|
||||
icon.setBounds(0, 0, c.getWidth(), c.getHeight());
|
||||
icon.draw(c);
|
||||
iconOff = Icon.createWithBitmap(b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,7 +39,7 @@ public class AppListDialogFragment extends DialogFragment {
|
||||
|
||||
private static final String KEY_EXCLUDED_APPS = "excludedApps";
|
||||
|
||||
private final List<String> currentlyExcludedApps = Arrays.asList(getArguments().getStringArray(KEY_EXCLUDED_APPS));
|
||||
private List<String> currentlyExcludedApps;
|
||||
private final ObservableKeyedList<String, ApplicationData> appData = new ObservableKeyedArrayList<>();
|
||||
|
||||
public static <T extends Fragment & AppExclusionListener> AppListDialogFragment newInstance(final String[] excludedApps, final T target) {
|
||||
@@ -51,6 +51,13 @@ public class AppListDialogFragment extends DialogFragment {
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
currentlyExcludedApps = Arrays.asList(getArguments().getStringArray(KEY_EXCLUDED_APPS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
|
||||
|
||||
@@ -26,6 +26,8 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
|
||||
import com.wireguard.android.Application;
|
||||
import com.wireguard.android.R;
|
||||
@@ -35,6 +37,7 @@ import com.wireguard.android.databinding.TunnelListFragmentBinding;
|
||||
import com.wireguard.android.databinding.TunnelListItemBinding;
|
||||
import com.wireguard.android.model.Tunnel;
|
||||
import com.wireguard.android.util.ExceptionLoggers;
|
||||
import com.wireguard.android.widget.CustomRecyclerViewScrollListener;
|
||||
import com.wireguard.config.Config;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -176,6 +179,7 @@ public class TunnelListFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public View onCreateView(@NonNull final LayoutInflater inflater, @Nullable final ViewGroup container,
|
||||
@@ -189,6 +193,23 @@ public class TunnelListFragment extends BaseFragment {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
binding.tunnelList.setOnScrollListener(new CustomRecyclerViewScrollListener() {
|
||||
@Override
|
||||
public void show() {
|
||||
binding.createMenu.animate()
|
||||
.translationY(0)
|
||||
.setInterpolator(new DecelerateInterpolator(2))
|
||||
.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
binding.createMenu.animate()
|
||||
.translationY(binding.createMenu.getHeight() + getResources().getDimension(R.dimen.fab_margin))
|
||||
.setInterpolator(new AccelerateInterpolator(2))
|
||||
.start();
|
||||
}
|
||||
});
|
||||
binding.executePendingBindings();
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright © 2018 Harsh Shandilya <msfjarvis@gmail.com>
|
||||
* 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.v7.widget.RecyclerView;
|
||||
|
||||
import com.wireguard.android.R;
|
||||
|
||||
public abstract class CustomRecyclerViewScrollListener extends RecyclerView.OnScrollListener {
|
||||
|
||||
private int scrollDist;
|
||||
private boolean isVisible = true;
|
||||
private static int flingThreshold;
|
||||
|
||||
@Override
|
||||
public void onScrolled(final RecyclerView recyclerView, final int dx, final int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
|
||||
if (flingThreshold == 0)
|
||||
flingThreshold = recyclerView.getResources().getDimensionPixelSize(R.dimen.design_fab_size_normal) / 2;
|
||||
|
||||
if (isVisible && scrollDist >= flingThreshold) {
|
||||
hide();
|
||||
scrollDist = 0;
|
||||
isVisible = false;
|
||||
} else if (!isVisible && scrollDist <= -flingThreshold) {
|
||||
show();
|
||||
scrollDist = 0;
|
||||
isVisible = true;
|
||||
}
|
||||
|
||||
if (isVisible ? dy > 0 : dy < 0) {
|
||||
scrollDist += dy;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void show();
|
||||
public abstract void hide();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright © 2018 Harsh Shandilya <msfjarvis@gmail.com>
|
||||
* Copyright © 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.wireguard.android.widget.fab;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.design.widget.CoordinatorLayout;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
public class FloatingActionButtonBehavior extends CoordinatorLayout.Behavior<FloatingActionsMenu> {
|
||||
|
||||
public FloatingActionButtonBehavior(final Context context, final AttributeSet attrs) { }
|
||||
|
||||
@Override
|
||||
public boolean layoutDependsOn(final CoordinatorLayout parent, final FloatingActionsMenu child,
|
||||
final View dependency) {
|
||||
return dependency instanceof Snackbar.SnackbarLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDependentViewChanged(final CoordinatorLayout parent, final FloatingActionsMenu child,
|
||||
final View dependency) {
|
||||
final float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight());
|
||||
child.setTranslationY(translationY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,8 @@
|
||||
android:id="@+id/tunnel_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/design_fab_size_normal"
|
||||
android:clipToPadding="false"
|
||||
android:choiceMode="multipleChoiceModal"
|
||||
app:items="@{tunnels}"
|
||||
app:layout="@{@layout/tunnel_list_item}"
|
||||
@@ -40,10 +42,11 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:fab_labelStyle="@style/fab_label"
|
||||
android:clipChildren="false"
|
||||
app:fab_labelsPosition="left" >
|
||||
app:fab_labelsPosition="left"
|
||||
app:layout_behavior="com.wireguard.android.widget.fab.FloatingActionButtonBehavior" >
|
||||
|
||||
<com.wireguard.android.widget.fab.LabeledFloatingActionButton
|
||||
android:id="@+id/create_empty"
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user