Refactor packages, removed appcompat dependency

pull/1/head
Mattia Iavarone 7 years ago
parent b579a5c6f7
commit 97b768fa85
  1. 9
      camerakit/build.gradle
  2. 8
      camerakit/src/main/java/com/flurgle/camerakit/AspectRatio.java
  3. 0
      camerakit/src/main/java/com/flurgle/camerakit/Camera1.java
  4. 5
      camerakit/src/main/java/com/flurgle/camerakit/Camera2.java
  5. 0
      camerakit/src/main/java/com/flurgle/camerakit/CameraController.java
  6. 0
      camerakit/src/main/java/com/flurgle/camerakit/CameraOptions.java
  7. 20
      camerakit/src/main/java/com/flurgle/camerakit/CameraView.java
  8. 0
      camerakit/src/main/java/com/flurgle/camerakit/ExtraProperties.java
  9. 10
      camerakit/src/main/java/com/flurgle/camerakit/Mapper.java
  10. 0
      camerakit/src/main/java/com/flurgle/camerakit/Size.java
  11. 0
      camerakit/src/main/options/com/flurgle/camerakit/Facing.java
  12. 0
      camerakit/src/main/options/com/flurgle/camerakit/Flash.java
  13. 0
      camerakit/src/main/options/com/flurgle/camerakit/Focus.java
  14. 0
      camerakit/src/main/options/com/flurgle/camerakit/Grid.java
  15. 0
      camerakit/src/main/options/com/flurgle/camerakit/Method.java
  16. 0
      camerakit/src/main/options/com/flurgle/camerakit/Permissions.java
  17. 0
      camerakit/src/main/options/com/flurgle/camerakit/SessionType.java
  18. 0
      camerakit/src/main/options/com/flurgle/camerakit/VideoQuality.java
  19. 0
      camerakit/src/main/options/com/flurgle/camerakit/WhiteBalance.java
  20. 0
      camerakit/src/main/options/com/flurgle/camerakit/ZoomMode.java
  21. 0
      camerakit/src/main/utils/com/flurgle/camerakit/CameraUtils.java
  22. 0
      camerakit/src/main/utils/com/flurgle/camerakit/ExifUtils.java
  23. 0
      camerakit/src/main/views/com/flurgle/camerakit/FocusMarkerLayout.java
  24. 0
      camerakit/src/main/views/com/flurgle/camerakit/GridLinesLayout.java
  25. 0
      camerakit/src/main/views/com/flurgle/camerakit/PinchToZoomLayout.java
  26. 0
      camerakit/src/main/views/com/flurgle/camerakit/Preview.java
  27. 0
      camerakit/src/main/views/com/flurgle/camerakit/SurfaceViewPreview.java
  28. 0
      camerakit/src/main/views/com/flurgle/camerakit/TextureViewPreview.java

@ -16,18 +16,17 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
} }
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/base' main.java.srcDirs += 'src/main/options'
main.java.srcDirs += 'src/main/api16' main.java.srcDirs += 'src/main/views'
main.java.srcDirs += 'src/main/api21'
main.java.srcDirs += 'src/main/types'
main.java.srcDirs += 'src/main/utils' main.java.srcDirs += 'src/main/utils'
} }
} }
dependencies { dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:exifinterface:25.3.1' compile 'com.android.support:exifinterface:25.3.1'
compile 'com.android.support:support-annotations:25.3.1'
compile 'android.arch.lifecycle:runtime:1.0.0-alpha1' compile 'android.arch.lifecycle:runtime:1.0.0-alpha1'
compile 'android.arch.lifecycle:extensions:1.0.0-alpha1' compile 'android.arch.lifecycle:extensions:1.0.0-alpha1'
annotationProcessor 'android.arch.lifecycle:compiler:1.0.0-alpha1' annotationProcessor 'android.arch.lifecycle:compiler:1.0.0-alpha1'

@ -3,11 +3,11 @@ package com.flurgle.camerakit;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.util.SparseArrayCompat; import android.util.SparseArray;
public class AspectRatio implements Comparable<AspectRatio>, Parcelable { public class AspectRatio implements Comparable<AspectRatio>, Parcelable {
private final static SparseArrayCompat<SparseArrayCompat<AspectRatio>> sCache = new SparseArrayCompat<>(16); private final static SparseArray<SparseArray<AspectRatio>> sCache = new SparseArray<>(16);
private final int mX; private final int mX;
private final int mY; private final int mY;
@ -79,10 +79,10 @@ public class AspectRatio implements Comparable<AspectRatio>, Parcelable {
int gcd = gcd(x, y); int gcd = gcd(x, y);
x /= gcd; x /= gcd;
y /= gcd; y /= gcd;
SparseArrayCompat<AspectRatio> arrayX = sCache.get(x); SparseArray<AspectRatio> arrayX = sCache.get(x);
if (arrayX == null) { if (arrayX == null) {
AspectRatio ratio = new AspectRatio(x, y); AspectRatio ratio = new AspectRatio(x, y);
arrayX = new SparseArrayCompat<>(); arrayX = new SparseArray<>();
arrayX.put(y, ratio); arrayX.put(y, ratio);
sCache.put(x, arrayX); sCache.put(x, arrayX);
return ratio; return ratio;

@ -35,6 +35,11 @@ class Camera2 extends CameraController {
private final HashMap<String, ExtraProperties> mExtraPropertiesMap = new HashMap<>(); private final HashMap<String, ExtraProperties> mExtraPropertiesMap = new HashMap<>();
@Override
boolean setExposureCorrection(float EVvalue) {
return false;
}
@Override @Override
boolean setZoom(float zoom) { boolean setZoom(float zoom) {
return false; return false;

@ -1,6 +1,7 @@
package com.flurgle.camerakit; package com.flurgle.camerakit;
import android.Manifest; import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.arch.lifecycle.Lifecycle; import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleObserver; import android.arch.lifecycle.LifecycleObserver;
@ -14,13 +15,12 @@ import android.content.res.TypedArray;
import android.graphics.PointF; import android.graphics.PointF;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.YuvImage; import android.graphics.YuvImage;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.os.Looper; import android.os.Looper;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -418,8 +418,15 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
*/ */
private boolean checkPermissions(@SessionType int sessionType) { private boolean checkPermissions(@SessionType int sessionType) {
checkPermissionsManifestOrThrow(sessionType); checkPermissionsManifestOrThrow(sessionType);
int cameraCheck = ContextCompat.checkSelfPermission(getContext(), Manifest.permission.CAMERA); boolean api23 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
int audioCheck = ContextCompat.checkSelfPermission(getContext(), Manifest.permission.RECORD_AUDIO); int cameraCheck, audioCheck;
if (!api23) {
cameraCheck = PackageManager.PERMISSION_GRANTED;
audioCheck = PackageManager.PERMISSION_GRANTED;
} else {
cameraCheck = getContext().checkSelfPermission(Manifest.permission.CAMERA);
audioCheck = getContext().checkSelfPermission(Manifest.permission.RECORD_AUDIO);
}
switch (sessionType) { switch (sessionType) {
case SESSION_TYPE_VIDEO: case SESSION_TYPE_VIDEO:
if (cameraCheck != PackageManager.PERMISSION_GRANTED || audioCheck != PackageManager.PERMISSION_GRANTED) { if (cameraCheck != PackageManager.PERMISSION_GRANTED || audioCheck != PackageManager.PERMISSION_GRANTED) {
@ -1069,6 +1076,8 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
} }
// If we end up here, we're in M.
@TargetApi(Build.VERSION_CODES.M)
private void requestPermissions(boolean requestCamera, boolean requestAudio) { private void requestPermissions(boolean requestCamera, boolean requestAudio) {
Activity activity = null; Activity activity = null;
Context context = getContext(); Context context = getContext();
@ -1083,8 +1092,7 @@ public class CameraView extends FrameLayout implements LifecycleObserver {
if (requestCamera) permissions.add(Manifest.permission.CAMERA); if (requestCamera) permissions.add(Manifest.permission.CAMERA);
if (requestAudio) permissions.add(Manifest.permission.RECORD_AUDIO); if (requestAudio) permissions.add(Manifest.permission.RECORD_AUDIO);
if (activity != null) { if (activity != null) {
ActivityCompat.requestPermissions(activity, activity.requestPermissions(permissions.toArray(new String[permissions.size()]),
permissions.toArray(new String[permissions.size()]),
CameraConstants.PERMISSION_REQUEST_CODE); CameraConstants.PERMISSION_REQUEST_CODE);
} }
} }

@ -1,7 +1,7 @@
package com.flurgle.camerakit; package com.flurgle.camerakit;
import android.hardware.Camera; import android.hardware.Camera;
import android.support.v4.util.SparseArrayCompat; import android.util.SparseArray;
abstract class Mapper { abstract class Mapper {
@ -15,10 +15,10 @@ abstract class Mapper {
@Focus abstract <T> int unmapFocus(T cameraConstant); @Focus abstract <T> int unmapFocus(T cameraConstant);
static class Mapper1 extends Mapper { static class Mapper1 extends Mapper {
private static final SparseArrayCompat<String> FLASH = new SparseArrayCompat<>(); private static final SparseArray<String> FLASH = new SparseArray<>();
private static final SparseArrayCompat<String> WB = new SparseArrayCompat<>(); private static final SparseArray<String> WB = new SparseArray<>();
private static final SparseArrayCompat<Integer> FACING = new SparseArrayCompat<>(); private static final SparseArray<Integer> FACING = new SparseArray<>();
private static final SparseArrayCompat<String> FOCUS = new SparseArrayCompat<>(); private static final SparseArray<String> FOCUS = new SparseArray<>();
static { static {
FLASH.put(CameraConstants.FLASH_OFF, Camera.Parameters.FLASH_MODE_OFF); FLASH.put(CameraConstants.FLASH_OFF, Camera.Parameters.FLASH_MODE_OFF);
Loading…
Cancel
Save