mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
raised api level and made necessary code changes
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
package org.briarproject.android.util;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.RecyclerView.Adapter;
|
||||
import android.util.AttributeSet;
|
||||
@@ -71,7 +69,7 @@ public class BriarRecyclerView extends FrameLayout {
|
||||
showProgressBar();
|
||||
|
||||
// scroll down when opening keyboard
|
||||
if (isScrollingToEnd && Build.VERSION.SDK_INT >= 11) {
|
||||
if (isScrollingToEnd) {
|
||||
addLayoutChangeListener();
|
||||
}
|
||||
|
||||
@@ -90,7 +88,6 @@ public class BriarRecyclerView extends FrameLayout {
|
||||
};
|
||||
}
|
||||
|
||||
@TargetApi(11)
|
||||
private void addLayoutChangeListener() {
|
||||
recyclerView.addOnLayoutChangeListener(
|
||||
new OnLayoutChangeListener() {
|
||||
|
||||
@@ -25,7 +25,6 @@ import static android.hardware.Camera.Parameters.FOCUS_MODE_EDOF;
|
||||
import static android.hardware.Camera.Parameters.FOCUS_MODE_FIXED;
|
||||
import static android.hardware.Camera.Parameters.FOCUS_MODE_MACRO;
|
||||
import static android.hardware.Camera.Parameters.SCENE_MODE_BARCODE;
|
||||
import static android.view.SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
|
||||
@@ -59,8 +58,6 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
super.onAttachedToWindow();
|
||||
setKeepScreenOn(true);
|
||||
SurfaceHolder holder = getHolder();
|
||||
if (Build.VERSION.SDK_INT < 11)
|
||||
holder.setType(SURFACE_TYPE_PUSH_BUFFERS);
|
||||
holder.addCallback(this);
|
||||
}
|
||||
|
||||
@@ -164,8 +161,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
LOG.info("Setting scene mode to barcode");
|
||||
params.setSceneMode(SCENE_MODE_BARCODE);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 14 &&
|
||||
focusModes.contains(FOCUS_MODE_CONTINUOUS_PICTURE)) {
|
||||
if (focusModes.contains(FOCUS_MODE_CONTINUOUS_PICTURE)) {
|
||||
LOG.info("Setting focus mode to continuous picture");
|
||||
params.setFocusMode(FOCUS_MODE_CONTINUOUS_PICTURE);
|
||||
} else if (focusModes.contains(FOCUS_MODE_CONTINUOUS_VIDEO)) {
|
||||
@@ -212,12 +208,6 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
+ ", stretch " + stretch + ", pixels " + pixels
|
||||
+ ", score " + score);
|
||||
}
|
||||
// Large preview sizes can crash older devices
|
||||
int maxDimension = Math.max(width, height);
|
||||
if (Build.VERSION.SDK_INT < 14 && maxDimension > screenMax) {
|
||||
LOG.info("Too large for screen");
|
||||
continue;
|
||||
}
|
||||
if (bestSize == null || score > bestScore) {
|
||||
bestSize = size;
|
||||
bestScore = score;
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.briarproject.android.util;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Build;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
@@ -12,25 +10,7 @@ import static android.view.View.VISIBLE;
|
||||
|
||||
public class CustomAnimations {
|
||||
|
||||
public static void animateHeight(ViewGroup viewGroup, boolean isExtending,
|
||||
int duration) {
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
animateHeightPostGingerbread(viewGroup, isExtending, duration);
|
||||
} else {
|
||||
animateHeightGingerbread(viewGroup, isExtending);
|
||||
}
|
||||
}
|
||||
|
||||
private static void animateHeightGingerbread(ViewGroup viewGroup,
|
||||
boolean isExtending) {
|
||||
// No animations for Gingerbread
|
||||
if (isExtending) viewGroup.setVisibility(VISIBLE);
|
||||
else viewGroup.setVisibility(GONE);
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private static void animateHeightPostGingerbread(final ViewGroup viewGroup,
|
||||
public static void animateHeight(final ViewGroup viewGroup,
|
||||
final boolean isExtending, int duration) {
|
||||
ValueAnimator anim;
|
||||
if (isExtending) {
|
||||
@@ -74,4 +54,5 @@ public class CustomAnimations {
|
||||
anim.setDuration(duration);
|
||||
anim.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user