Merge branch 'dev' into pr3178
This commit is contained in:
commit
a13e6b69e3
81 changed files with 318 additions and 292 deletions
|
|
@ -162,13 +162,9 @@ public final class AnimationUtils {
|
|||
.ofObject(new ArgbEvaluator(), colorStart, colorEnd);
|
||||
viewPropertyAnimator.setInterpolator(new FastOutSlowInInterpolator());
|
||||
viewPropertyAnimator.setDuration(duration);
|
||||
viewPropertyAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(final ValueAnimator animation) {
|
||||
viewPropertyAnimator.addUpdateListener(animation ->
|
||||
ViewCompat.setBackgroundTintList(view,
|
||||
new ColorStateList(empty, new int[]{(int) animation.getAnimatedValue()}));
|
||||
}
|
||||
});
|
||||
new ColorStateList(empty, new int[]{(int) animation.getAnimatedValue()})));
|
||||
viewPropertyAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(final Animator animation) {
|
||||
|
|
@ -205,12 +201,8 @@ public final class AnimationUtils {
|
|||
.ofObject(new ArgbEvaluator(), colorStart, colorEnd);
|
||||
viewPropertyAnimator.setInterpolator(new FastOutSlowInInterpolator());
|
||||
viewPropertyAnimator.setDuration(duration);
|
||||
viewPropertyAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(final ValueAnimator animation) {
|
||||
view.setTextColor((int) animation.getAnimatedValue());
|
||||
}
|
||||
});
|
||||
viewPropertyAnimator.addUpdateListener(animation ->
|
||||
view.setTextColor((int) animation.getAnimatedValue()));
|
||||
viewPropertyAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(final Animator animation) {
|
||||
|
|
@ -430,7 +422,7 @@ public final class AnimationUtils {
|
|||
final long duration, final long delay,
|
||||
final Runnable execOnEnd) {
|
||||
if (enterOrExit) {
|
||||
view.setTranslationY(-view.getHeight() / 2);
|
||||
view.setTranslationY(-view.getHeight() / 2.0f);
|
||||
view.setAlpha(0f);
|
||||
view.animate()
|
||||
.setInterpolator(new FastOutSlowInInterpolator()).alpha(1f).translationY(0)
|
||||
|
|
@ -445,7 +437,7 @@ public final class AnimationUtils {
|
|||
}).start();
|
||||
} else {
|
||||
view.animate().setInterpolator(new FastOutSlowInInterpolator())
|
||||
.alpha(0f).translationY(-view.getHeight() / 2)
|
||||
.alpha(0f).translationY(-view.getHeight() / 2.0f)
|
||||
.setDuration(duration).setStartDelay(delay)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import android.content.pm.PackageManager;
|
|||
import android.content.res.Configuration;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
|
@ -72,4 +74,17 @@ public final class DeviceUtils {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compares current status bar height with default status bar height in Android and decides,
|
||||
* does the device has cutout or not
|
||||
* */
|
||||
public static boolean hasCutout(final float statusBarHeight, final DisplayMetrics metrics) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
final float defaultStatusBarHeight = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, 25, metrics);
|
||||
return statusBarHeight > defaultStatusBarHeight;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package org.schabi.newpipe.util;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package org.schabi.newpipe.util;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package org.schabi.newpipe.util;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.grack.nanojson.JsonArray;
|
||||
import com.grack.nanojson.JsonObject;
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@ public final class PermissionHelper {
|
|||
private PermissionHelper() { }
|
||||
|
||||
public static boolean checkStoragePermissions(final Activity activity, final int requestCode) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
if (!checkReadStoragePermissions(activity, requestCode)) {
|
||||
return false;
|
||||
}
|
||||
if (!checkReadStoragePermissions(activity, requestCode)) {
|
||||
return false;
|
||||
}
|
||||
return checkWriteStoragePermissions(activity, requestCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ public class RelatedStreamInfo extends ListInfo<InfoItem> {
|
|||
info.getOriginalUrl(), info.getUrl(), info.getId(), Collections.emptyList(), null);
|
||||
final RelatedStreamInfo relatedStreamInfo = new RelatedStreamInfo(
|
||||
info.getServiceId(), handler, info.getName());
|
||||
final List<InfoItem> streams = new ArrayList<>();
|
||||
streams.addAll(info.getRelatedStreams());
|
||||
final List<InfoItem> streams = new ArrayList<>(info.getRelatedStreams());
|
||||
relatedStreamInfo.setRelatedItems(streams);
|
||||
return relatedStreamInfo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package org.schabi.newpipe.util;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.StringRes;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import org.schabi.newpipe.MainActivity;
|
|||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
|
@ -254,12 +253,8 @@ public final class StateSaver {
|
|||
return new SavedState(prefixFileName, file.getAbsolutePath());
|
||||
} else {
|
||||
// Delete any file that contains the prefix
|
||||
final File[] files = cacheDir.listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(final File dir, final String name) {
|
||||
return name.contains(prefixFileName);
|
||||
}
|
||||
});
|
||||
final File[] files = cacheDir.listFiles((dir, name) ->
|
||||
name.contains(prefixFileName));
|
||||
for (final File fileToDelete : files) {
|
||||
fileToDelete.delete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public class TLSSocketFactoryCompat extends SSLSocketFactory {
|
|||
}
|
||||
|
||||
private Socket enableTLSOnSocket(final Socket socket) {
|
||||
if (socket != null && (socket instanceof SSLSocket)) {
|
||||
if (socket instanceof SSLSocket) {
|
||||
((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"});
|
||||
}
|
||||
return socket;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package org.schabi.newpipe.util;
|
|||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextThemeWrapper;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue