Migrate to AndroidX

pull/360/head
Mattia Iavarone 6 years ago
parent bc85178acf
commit ae2eada2a2
  1. 2
      build.gradle
  2. 14
      cameraview/build.gradle
  3. 12
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/BaseTest.java
  4. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/CameraLoggerTest.java
  5. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/CameraOptions1Test.java
  6. 2
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/CameraPreviewTest.java
  7. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/CameraUtilsTest.java
  8. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/CameraViewCallbacksTest.java
  9. 6
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/CameraViewTest.java
  10. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/CropHelperTest.java
  11. 21
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/GestureLayoutTest.java
  12. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/GlCameraPreviewTest.java
  13. 8
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/GridLinesLayoutTest.java
  14. 6
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/IntegrationTest.java
  15. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/Mapper1Test.java
  16. 7
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/MapperTest.java
  17. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/MockCameraController.java
  18. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/MockCameraPreview.java
  19. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/OrientationHelperTest.java
  20. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/PictureRecorderTest.java
  21. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/PictureResultTest.java
  22. 8
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/PinchGestureLayoutTest.java
  23. 18
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/ScrollGestureLayoutTest.java
  24. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/SurfaceCameraPreviewTest.java
  25. 14
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/TapGestureLayoutTest.java
  26. 6
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/TestActivity.java
  27. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/TextureCameraPreviewTest.java
  28. 7
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/VideoRecorderTest.java
  29. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/VideoResultTest.java
  30. 4
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/WorkerHandlerTest.java
  31. 19
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/YuvHelperTest.java
  32. 7
      cameraview/src/main/gles/com/otaliastudios/cameraview/AudioMediaEncoder.java
  33. 2
      cameraview/src/main/gles/com/otaliastudios/cameraview/EglBaseSurface.java
  34. 4
      cameraview/src/main/gles/com/otaliastudios/cameraview/EglCore.java
  35. 2
      cameraview/src/main/gles/com/otaliastudios/cameraview/EglWindowSurface.java
  36. 6
      cameraview/src/main/gles/com/otaliastudios/cameraview/MediaEncoder.java
  37. 9
      cameraview/src/main/gles/com/otaliastudios/cameraview/MediaEncoderEngine.java
  38. 15
      cameraview/src/main/gles/com/otaliastudios/cameraview/TextureMediaEncoder.java
  39. 8
      cameraview/src/main/gles/com/otaliastudios/cameraview/VideoMediaEncoder.java
  40. 5
      cameraview/src/main/java/com/otaliastudios/cameraview/AspectRatio.java
  41. 6
      cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java
  42. 6
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraController.java
  43. 6
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraListener.java
  44. 2
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraOptions.java
  45. 14
      cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java
  46. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/Frame.java
  47. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/FrameManager.java
  48. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/FrameProcessor.java
  49. 6
      cameraview/src/main/java/com/otaliastudios/cameraview/FullPictureRecorder.java
  50. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/FullVideoRecorder.java
  51. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/PictureRecorder.java
  52. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/PictureResult.java
  53. 2
      cameraview/src/main/java/com/otaliastudios/cameraview/Size.java
  54. 2
      cameraview/src/main/java/com/otaliastudios/cameraview/SizeSelector.java
  55. 2
      cameraview/src/main/java/com/otaliastudios/cameraview/SnapshotPictureRecorder.java
  56. 8
      cameraview/src/main/java/com/otaliastudios/cameraview/SnapshotVideoRecorder.java
  57. 6
      cameraview/src/main/java/com/otaliastudios/cameraview/VideoRecorder.java
  58. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/VideoResult.java
  59. 2
      cameraview/src/main/options/com/otaliastudios/cameraview/Audio.java
  60. 4
      cameraview/src/main/options/com/otaliastudios/cameraview/Facing.java
  61. 2
      cameraview/src/main/options/com/otaliastudios/cameraview/Flash.java
  62. 2
      cameraview/src/main/options/com/otaliastudios/cameraview/Gesture.java
  63. 2
      cameraview/src/main/options/com/otaliastudios/cameraview/GestureAction.java
  64. 2
      cameraview/src/main/options/com/otaliastudios/cameraview/Grid.java
  65. 2
      cameraview/src/main/options/com/otaliastudios/cameraview/Hdr.java
  66. 2
      cameraview/src/main/options/com/otaliastudios/cameraview/Mode.java
  67. 2
      cameraview/src/main/options/com/otaliastudios/cameraview/Preview.java
  68. 4
      cameraview/src/main/options/com/otaliastudios/cameraview/VideoCodec.java
  69. 2
      cameraview/src/main/options/com/otaliastudios/cameraview/WhiteBalance.java
  70. 4
      cameraview/src/main/utils/com/otaliastudios/cameraview/BitmapCallback.java
  71. 6
      cameraview/src/main/utils/com/otaliastudios/cameraview/CameraLogger.java
  72. 8
      cameraview/src/main/utils/com/otaliastudios/cameraview/CameraUtils.java
  73. 2
      cameraview/src/main/utils/com/otaliastudios/cameraview/CropHelper.java
  74. 2
      cameraview/src/main/utils/com/otaliastudios/cameraview/OrientationHelper.java
  75. 3
      cameraview/src/main/utils/com/otaliastudios/cameraview/RotationHelper.java
  76. 2
      cameraview/src/main/utils/com/otaliastudios/cameraview/SizeSelectors.java
  77. 2
      cameraview/src/main/utils/com/otaliastudios/cameraview/Task.java
  78. 3
      cameraview/src/main/utils/com/otaliastudios/cameraview/WorkerHandler.java
  79. 4
      cameraview/src/main/views/com/otaliastudios/cameraview/CameraPreview.java
  80. 4
      cameraview/src/main/views/com/otaliastudios/cameraview/GestureLayout.java
  81. 15
      cameraview/src/main/views/com/otaliastudios/cameraview/GlCameraPreview.java
  82. 8
      cameraview/src/main/views/com/otaliastudios/cameraview/GridLinesLayout.java
  83. 2
      cameraview/src/main/views/com/otaliastudios/cameraview/PinchGestureLayout.java
  84. 2
      cameraview/src/main/views/com/otaliastudios/cameraview/ScrollGestureLayout.java
  85. 4
      cameraview/src/main/views/com/otaliastudios/cameraview/SurfaceCameraPreview.java
  86. 4
      cameraview/src/main/views/com/otaliastudios/cameraview/TapGestureLayout.java
  87. 4
      cameraview/src/main/views/com/otaliastudios/cameraview/TextureCameraPreview.java
  88. 2
      cameraview/src/test/java/com/otaliastudios/cameraview/SizeSelectorsTest.java
  89. 6
      demo/build.gradle
  90. 6
      demo/src/main/java/com/otaliastudios/cameraview/demo/CameraActivity.java
  91. 2
      demo/src/main/java/com/otaliastudios/cameraview/demo/Control.java
  92. 11
      demo/src/main/java/com/otaliastudios/cameraview/demo/MessageView.java
  93. 3
      demo/src/main/java/com/otaliastudios/cameraview/demo/PicturePreviewActivity.java
  94. 2
      demo/src/main/java/com/otaliastudios/cameraview/demo/VideoPreviewActivity.java
  95. 8
      demo/src/main/res/layout/activity_camera.xml
  96. 13
      docs/_posts/2018-12-20-v1-migration-guide.md
  97. 2
      gradle.properties

@ -20,8 +20,6 @@ allprojects {
ext { ext {
compileSdkVersion = 28 compileSdkVersion = 28
supportLibVersion = '28.0.0'
lifecycleVersion = '1.1.1'
minSdkVersion = 15 minSdkVersion = 15
targetSdkVersion = 28 targetSdkVersion = 28
} }

@ -17,7 +17,7 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1 versionCode 1
versionName project.version versionName project.version
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
@ -43,15 +43,15 @@ dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19' testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'com.android.support.test:rules:1.0.2' androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'com.google.dexmaker:dexmaker:1.2' androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2' androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
api "com.android.support:exifinterface:$supportLibVersion" api 'androidx.exifinterface:exifinterface:1.0.0'
api "android.arch.lifecycle:common:$lifecycleVersion" api 'androidx.lifecycle:lifecycle-common:2.1.0-alpha01'
implementation "com.android.support:support-annotations:$supportLibVersion" implementation 'androidx.annotation:annotation:1.0.1'
} }
//endregion //endregion

@ -1,7 +1,6 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.annotation.SuppressLint;
import android.app.KeyguardManager; import android.app.KeyguardManager;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
@ -11,17 +10,14 @@ import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.PowerManager; import android.os.PowerManager;
import android.support.test.InstrumentationRegistry; import androidx.test.InstrumentationRegistry;
import android.support.test.annotation.UiThreadTest; import androidx.test.annotation.UiThreadTest;
import android.support.test.espresso.core.internal.deps.guava.collect.ObjectArrays; import androidx.test.espresso.core.internal.deps.guava.collect.ObjectArrays;
import android.support.test.rule.ActivityTestRule; import androidx.test.rule.ActivityTestRule;
import android.view.View; import android.view.View;
import org.junit.After;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Rule;
import org.mockito.invocation.InvocationOnMock; import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;
import org.mockito.stubbing.Stubber; import org.mockito.stubbing.Stubber;

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;

@ -2,8 +2,8 @@ package com.otaliastudios.cameraview;
import android.hardware.Camera; import android.hardware.Camera;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -2,7 +2,7 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.test.rule.ActivityTestRule; import androidx.test.rule.ActivityTestRule;
import android.view.ViewGroup; import android.view.ViewGroup;
import org.junit.After; import org.junit.After;

@ -5,8 +5,8 @@ import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color; import android.graphics.Color;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -3,8 +3,8 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.graphics.PointF; import android.graphics.PointF;
import android.support.test.filters.MediumTest; import androidx.test.filters.MediumTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import android.view.ViewGroup; import android.view.ViewGroup;
import org.junit.After; import org.junit.After;

@ -3,9 +3,9 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.location.Location; import android.location.Location;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.test.filters.MediumTest; import androidx.test.filters.MediumTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.ViewGroup; import android.view.ViewGroup;

@ -2,8 +2,8 @@ package com.otaliastudios.cameraview;
import android.graphics.Rect; import android.graphics.Rect;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -3,25 +3,22 @@ package com.otaliastudios.cameraview;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.support.test.espresso.Espresso; import androidx.test.espresso.Espresso;
import android.support.test.espresso.Root; import androidx.test.espresso.Root;
import android.support.test.espresso.ViewAssertion; import androidx.test.espresso.ViewAssertion;
import android.support.test.espresso.ViewInteraction; import androidx.test.espresso.ViewInteraction;
import android.support.test.espresso.assertion.ViewAssertions; import androidx.test.espresso.assertion.ViewAssertions;
import android.support.test.espresso.matcher.RootMatchers; import androidx.test.espresso.matcher.RootMatchers;
import android.support.test.espresso.matcher.ViewMatchers; import androidx.test.espresso.matcher.ViewMatchers;
import android.support.test.rule.ActivityTestRule; import androidx.test.rule.ActivityTestRule;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import static android.support.test.espresso.Espresso.onView; import static androidx.test.espresso.Espresso.onView;
import static org.hamcrest.Matchers.any;
@TargetApi(17) @TargetApi(17)
public abstract class GestureLayoutTest<T extends GestureLayout> extends BaseTest { public abstract class GestureLayoutTest<T extends GestureLayout> extends BaseTest {

@ -2,8 +2,8 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import android.view.ViewGroup; import android.view.ViewGroup;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -1,17 +1,15 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.graphics.Canvas; import androidx.test.filters.MediumTest;
import android.support.test.filters.MediumTest; import androidx.test.rule.ActivityTestRule;
import android.support.test.rule.ActivityTestRule; import androidx.test.runner.AndroidJUnit4;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)

@ -5,9 +5,9 @@ import android.graphics.Bitmap;
import android.graphics.PointF; import android.graphics.PointF;
import android.hardware.Camera; import android.hardware.Camera;
import android.os.Build; import android.os.Build;
import android.support.test.filters.MediumTest; import androidx.test.filters.MediumTest;
import android.support.test.rule.ActivityTestRule; import androidx.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;

@ -2,8 +2,8 @@ package com.otaliastudios.cameraview;
import android.hardware.Camera; import android.hardware.Camera;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -1,12 +1,9 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.hardware.Camera; import androidx.test.filters.SmallTest;
import android.media.MediaRecorder; import androidx.test.runner.AndroidJUnit4;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;

@ -3,8 +3,8 @@ package com.otaliastudios.cameraview;
import android.graphics.PointF; import android.graphics.PointF;
import android.location.Location; import android.location.Location;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import java.io.File; import java.io.File;

@ -2,8 +2,8 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.view.Surface;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import android.view.OrientationEventListener; import android.view.OrientationEventListener;
import org.junit.After; import org.junit.After;

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -2,8 +2,8 @@ package com.otaliastudios.cameraview;
import android.location.Location; import android.location.Location;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -2,14 +2,14 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.test.espresso.ViewAction; import androidx.test.espresso.ViewAction;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static android.support.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;

@ -2,19 +2,19 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.test.espresso.ViewAction; import androidx.test.espresso.ViewAction;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static android.support.test.espresso.action.ViewActions.click; import static androidx.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeDown; import static androidx.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.action.ViewActions.swipeLeft; import static androidx.test.espresso.action.ViewActions.swipeLeft;
import static android.support.test.espresso.action.ViewActions.swipeRight; import static androidx.test.espresso.action.ViewActions.swipeRight;
import static android.support.test.espresso.action.ViewActions.swipeUp; import static androidx.test.espresso.action.ViewActions.swipeUp;
import static android.support.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNotNull;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;

@ -2,8 +2,8 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import android.view.ViewGroup; import android.view.ViewGroup;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -2,19 +2,19 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.test.espresso.action.GeneralClickAction; import androidx.test.espresso.action.GeneralClickAction;
import android.support.test.espresso.action.GeneralLocation; import androidx.test.espresso.action.GeneralLocation;
import android.support.test.espresso.action.Press; import androidx.test.espresso.action.Press;
import android.support.test.espresso.action.Tap; import androidx.test.espresso.action.Tap;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import android.view.InputDevice; import android.view.InputDevice;
import android.view.MotionEvent; import android.view.MotionEvent;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import static android.support.test.espresso.action.ViewActions.*; import static androidx.test.espresso.action.ViewActions.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)

@ -2,12 +2,10 @@ package com.otaliastudios.cameraview;
import android.app.Activity; import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
import android.graphics.Point; import android.graphics.Point;
import android.os.Bundle; import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

@ -2,8 +2,8 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import android.view.ViewGroup; import android.view.ViewGroup;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -1,16 +1,13 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.location.Location; import androidx.test.filters.SmallTest;
import android.support.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mockito; import org.mockito.Mockito;
import java.io.File;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;

@ -2,8 +2,8 @@ package com.otaliastudios.cameraview;
import android.location.Location; import android.location.Location;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

@ -1,33 +1,20 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.YuvImage;
import android.support.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
@SmallTest @SmallTest

@ -5,12 +5,11 @@ import android.media.AudioRecord;
import android.media.MediaCodec; import android.media.MediaCodec;
import android.media.MediaCodecInfo; import android.media.MediaCodecInfo;
import android.media.MediaFormat; import android.media.MediaFormat;
import android.media.MediaMuxer;
import android.media.MediaRecorder; import android.media.MediaRecorder;
import android.os.Build; import android.os.Build;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;

@ -21,7 +21,7 @@ import android.opengl.EGL14;
import android.opengl.EGLSurface; import android.opengl.EGLSurface;
import android.opengl.GLES20; import android.opengl.GLES20;
import android.os.Build; import android.os.Build;
import android.support.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import android.util.Log; import android.util.Log;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;

@ -24,12 +24,10 @@ import android.opengl.EGLDisplay;
import android.opengl.EGLExt; import android.opengl.EGLExt;
import android.opengl.EGLSurface; import android.opengl.EGLSurface;
import android.os.Build; import android.os.Build;
import android.support.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import android.util.Log; import android.util.Log;
import android.view.Surface; import android.view.Surface;
import javax.microedition.khronos.egl.EGL10;
/** /**
* -- from grafika -- * -- from grafika --
* *

@ -18,7 +18,7 @@ package com.otaliastudios.cameraview;
import android.graphics.SurfaceTexture; import android.graphics.SurfaceTexture;
import android.os.Build; import android.os.Build;
import android.support.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import android.view.Surface; import android.view.Surface;
/** /**

@ -3,9 +3,9 @@ package com.otaliastudios.cameraview;
import android.media.MediaCodec; import android.media.MediaCodec;
import android.media.MediaFormat; import android.media.MediaFormat;
import android.os.Build; import android.os.Build;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import android.util.Log; import android.util.Log;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;

@ -1,20 +1,17 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.graphics.SurfaceTexture;
import android.media.MediaCodec; import android.media.MediaCodec;
import android.media.MediaFormat; import android.media.MediaFormat;
import android.media.MediaMuxer; import android.media.MediaMuxer;
import android.os.Build; import android.os.Build;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import android.util.Log;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2) @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
class MediaEncoderEngine { class MediaEncoderEngine {

@ -1,20 +1,11 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.graphics.SurfaceTexture;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.media.MediaMuxer;
import android.opengl.EGLContext; import android.opengl.EGLContext;
import android.opengl.Matrix; import android.opengl.Matrix;
import android.os.Build; import android.os.Build;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import android.util.Log;
import android.view.Surface;
import java.io.IOException;
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2) @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
class TextureMediaEncoder extends VideoMediaEncoder<TextureMediaEncoder.Config> { class TextureMediaEncoder extends VideoMediaEncoder<TextureMediaEncoder.Config> {

@ -3,15 +3,13 @@ package com.otaliastudios.cameraview;
import android.media.MediaCodec; import android.media.MediaCodec;
import android.media.MediaCodecInfo; import android.media.MediaCodecInfo;
import android.media.MediaFormat; import android.media.MediaFormat;
import android.media.MediaMuxer;
import android.os.Build; import android.os.Build;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import android.util.Log;
import android.view.Surface; import android.view.Surface;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer;
/** /**
* This alone does nothing. * This alone does nothing.

@ -1,9 +1,6 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.os.Parcel; import androidx.annotation.NonNull;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.util.SparseArray;
import java.util.HashMap; import java.util.HashMap;

@ -9,9 +9,9 @@ import android.graphics.SurfaceTexture;
import android.hardware.Camera; import android.hardware.Camera;
import android.location.Location; import android.location.Location;
import android.os.Build; import android.os.Build;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.annotation.WorkerThread; import androidx.annotation.WorkerThread;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import java.io.File; import java.io.File;

@ -6,9 +6,9 @@ import android.location.Location;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.annotation.WorkerThread; import androidx.annotation.WorkerThread;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;

@ -1,9 +1,9 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.graphics.PointF; import android.graphics.PointF;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.annotation.UiThread; import androidx.annotation.UiThread;
public abstract class CameraListener { public abstract class CameraListener {

@ -4,7 +4,7 @@ package com.otaliastudios.cameraview;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.hardware.Camera; import android.hardware.Camera;
import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CameraCharacteristics;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;

@ -4,10 +4,10 @@ import android.Manifest;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.arch.lifecycle.Lifecycle; import androidx.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleObserver; import androidx.lifecycle.LifecycleObserver;
import android.arch.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import android.arch.lifecycle.OnLifecycleEvent; import androidx.lifecycle.OnLifecycleEvent;
import android.content.Context; import android.content.Context;
import android.content.ContextWrapper; import android.content.ContextWrapper;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
@ -20,9 +20,9 @@ import android.media.MediaActionSound;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.support.annotation.ColorInt; import androidx.annotation.ColorInt;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.ViewGroup; import android.view.ViewGroup;

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* A preview frame to be processed by {@link FrameProcessor}s. * A preview frame to be processed by {@link FrameProcessor}s.

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.WorkerThread; import androidx.annotation.WorkerThread;
/** /**
* A FrameProcessor will process {@link Frame}s coming from the camera preview. * A FrameProcessor will process {@link Frame}s coming from the camera preview.

@ -1,9 +1,9 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.hardware.Camera; import android.hardware.Camera;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.media.ExifInterface; import androidx.exifinterface.media.ExifInterface;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;

@ -3,8 +3,8 @@ package com.otaliastudios.cameraview;
import android.hardware.Camera; import android.hardware.Camera;
import android.media.CamcorderProfile; import android.media.CamcorderProfile;
import android.media.MediaRecorder; import android.media.MediaRecorder;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* A {@link VideoRecorder} that uses {@link android.media.MediaRecorder} APIs. * A {@link VideoRecorder} that uses {@link android.media.MediaRecorder} APIs.

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Interface for picture capturing. * Interface for picture capturing.

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.location.Location; import android.location.Location;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Wraps the picture captured by {@link CameraView#takePicture()} or * Wraps the picture captured by {@link CameraView#takePicture()} or

@ -1,6 +1,6 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
/** /**
* A simple class representing a size, with width and height values. * A simple class representing a size, with width and height values.

@ -1,6 +1,6 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.List; import java.util.List;

@ -10,7 +10,7 @@ import android.hardware.Camera;
import android.opengl.EGL14; import android.opengl.EGL14;
import android.opengl.EGLContext; import android.opengl.EGLContext;
import android.opengl.Matrix; import android.opengl.Matrix;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;

@ -3,10 +3,10 @@ package com.otaliastudios.cameraview;
import android.graphics.SurfaceTexture; import android.graphics.SurfaceTexture;
import android.opengl.EGL14; import android.opengl.EGL14;
import android.os.Build; import android.os.Build;
import android.os.Handler;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.annotation.RequiresApi; import androidx.annotation.RequiresApi;
/** /**
* A {@link VideoRecorder} that uses {@link android.media.MediaCodec} APIs. * A {@link VideoRecorder} that uses {@link android.media.MediaCodec} APIs.

@ -1,9 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import java.io.File;
/** /**
* Interface for video recording. * Interface for video recording.

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.location.Location; import android.location.Location;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import java.io.File; import java.io.File;

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Audio values indicate whether to record audio stream when record video. * Audio values indicate whether to record audio stream when record video.

@ -2,8 +2,8 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Facing value indicates which camera sensor should be used for the current session. * Facing value indicates which camera sensor should be used for the current session.

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Flash value indicates the flash mode to be used. * Flash value indicates the flash mode to be used.

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Gestures actions are actions over camera controls that can be mapped to certain gestures over * Gestures actions are actions over camera controls that can be mapped to certain gestures over

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Grid values can be used to draw grid lines over the camera preview. * Grid values can be used to draw grid lines over the camera preview.

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Hdr values indicate whether to use high dynamic range techniques when capturing pictures. * Hdr values indicate whether to use high dynamic range techniques when capturing pictures.

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import java.io.File; import java.io.File;

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* The preview engine to be used. * The preview engine to be used.

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* Constants for selecting the encoder of video recordings. * Constants for selecting the encoder of video recordings.

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
/** /**
* White balance values control the white balance settings. * White balance values control the white balance settings.

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.annotation.UiThread; import androidx.annotation.UiThread;
/** /**
* Receives callbacks about a bitmap decoding operation. * Receives callbacks about a bitmap decoding operation.

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.IntDef; import androidx.annotation.IntDef;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.util.Log; import android.util.Log;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

@ -7,10 +7,10 @@ import android.graphics.BitmapFactory;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.hardware.Camera; import android.hardware.Camera;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.support.annotation.WorkerThread; import androidx.annotation.WorkerThread;
import android.support.media.ExifInterface; import androidx.exifinterface.media.ExifInterface;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.graphics.Rect; import android.graphics.Rect;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
class CropHelper { class CropHelper {

@ -2,7 +2,7 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.hardware.SensorManager; import android.hardware.SensorManager;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.view.Display; import android.view.Display;
import android.view.OrientationEventListener; import android.view.OrientationEventListener;
import android.view.Surface; import android.view.Surface;

@ -1,7 +1,6 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.graphics.Rect; import androidx.annotation.NonNull;
import android.support.annotation.NonNull;
/** /**
* This will only be used on low APIs or when GL surface is not available. * This will only be used on low APIs or when GL surface is not available.

@ -1,6 +1,6 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;

@ -1,6 +1,6 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;

@ -2,10 +2,9 @@ package com.otaliastudios.cameraview;
import android.os.Handler; import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

@ -2,10 +2,8 @@ package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.graphics.PointF; import android.graphics.PointF;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
abstract class GestureLayout extends FrameLayout { abstract class GestureLayout extends FrameLayout {

@ -1,30 +1,21 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.RectF;
import android.graphics.SurfaceTexture; import android.graphics.SurfaceTexture;
import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView;
import android.opengl.Matrix; import android.opengl.Matrix;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL10; import javax.microedition.khronos.opengles.GL10;
/** /**

@ -4,10 +4,10 @@ import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt; import androidx.annotation.ColorInt;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.View; import android.view.View;

@ -4,7 +4,7 @@ import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.graphics.PointF; import android.graphics.PointF;
import android.os.Build; import android.os.Build;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.ScaleGestureDetector; import android.view.ScaleGestureDetector;

@ -3,7 +3,7 @@ package com.otaliastudios.cameraview;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.graphics.PointF; import android.graphics.PointF;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.MotionEvent; import android.view.MotionEvent;

@ -1,8 +1,8 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;

@ -5,8 +5,8 @@ import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.graphics.PointF; import android.graphics.PointF;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;

@ -3,8 +3,8 @@ package com.otaliastudios.cameraview;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.graphics.SurfaceTexture; import android.graphics.SurfaceTexture;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.TextureView; import android.view.TextureView;
import android.view.View; import android.view.View;

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview; package com.otaliastudios.cameraview;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;

@ -10,7 +10,7 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
buildTypes { buildTypes {
@ -23,6 +23,6 @@ android {
dependencies { dependencies {
implementation project(':cameraview') implementation project(':cameraview')
implementation "com.android.support:appcompat-v7:$supportLibVersion" implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation "com.android.support:design:$supportLibVersion" implementation 'com.google.android.material:material:1.1.0-alpha02'
} }

@ -3,9 +3,9 @@ package com.otaliastudios.cameraview.demo;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.support.design.widget.BottomSheetBehavior; import com.google.android.material.bottomsheet.BottomSheetBehavior;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;

@ -1,7 +1,7 @@
package com.otaliastudios.cameraview.demo; package com.otaliastudios.cameraview.demo;
import android.graphics.Color; import android.graphics.Color;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

@ -2,21 +2,12 @@ package com.otaliastudios.cameraview.demo;
import android.content.Context; import android.content.Context;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import com.otaliastudios.cameraview.CameraView;
import java.util.ArrayList;
public class MessageView extends LinearLayout { public class MessageView extends LinearLayout {
private TextView message; private TextView message;

@ -3,12 +3,11 @@ package com.otaliastudios.cameraview.demo;
import android.app.Activity; import android.app.Activity;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.widget.ImageView; import android.widget.ImageView;
import com.otaliastudios.cameraview.AspectRatio; import com.otaliastudios.cameraview.AspectRatio;
import com.otaliastudios.cameraview.BitmapCallback; import com.otaliastudios.cameraview.BitmapCallback;
import com.otaliastudios.cameraview.CameraUtils;
import com.otaliastudios.cameraview.PictureResult; import com.otaliastudios.cameraview.PictureResult;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;

@ -4,7 +4,7 @@ import android.app.Activity;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import androidx.annotation.Nullable;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.MediaController; import android.widget.MediaController;

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root" android:id="@+id/root"
@ -132,7 +132,7 @@
</LinearLayout> </LinearLayout>
<!-- Edit --> <!-- Edit -->
<android.support.v4.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/controls" android:id="@+id/controls"
android:background="@android:color/white" android:background="@android:color/white"
app:layout_behavior="@string/bottom_sheet_behavior" app:layout_behavior="@string/bottom_sheet_behavior"
@ -145,6 +145,6 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
</android.support.v4.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

@ -13,20 +13,28 @@ in your app, plus understanding new concepts.
Until the final v2 release, these things might change, but likely they will not. Until the final v2 release, these things might change, but likely they will not.
### AndroidX
The lib was moved to AndroidX classes. Hopefully this should not have any impact on you.
### Open, not start ### Open, not start
The `start()` method has been renamed to `open()`, and the `stop()` method to `close()`. This was The `start()` method has been renamed to `open()`, and the `stop()` method to `close()`. This was
done for consistency with the `onCameraOpened` callback. done for consistency with the `onCameraOpened` callback.
### Jpeg Quality ### Jpeg Quality
Both `cameraJpegQuality` and `setJpegQuality()` have been removed. They were working only with specific Both `cameraJpegQuality` and `setJpegQuality()` have been removed. They were working only with specific
setups and made no real sense. We will use the default quality provided by the camera engine. setups and made no real sense. We will use the default quality provided by the camera engine.
### Crop Output ### Crop Output
Both `cameraCropOutput` and `setCropOutput()` have been removed. This was an expensive operation that Both `cameraCropOutput` and `setCropOutput()` have been removed. This was an expensive operation that
worked with pictures only. In v2, if you want your output to be cropped to match the view bounds, you worked with pictures only. In v2, if you want your output to be cropped to match the view bounds, you
will use the `*snapshot()` APIs (see below). will use the `*snapshot()` APIs (see below).
### Video Quality ### Video Quality
This was an opaque option packaging various parameters. It has been removed. This was an opaque option packaging various parameters. It has been removed.
You are expected to control the video quality by choosing the video size and setting video parameters You are expected to control the video quality by choosing the video size and setting video parameters
with new APIs (see below). with new APIs (see below).
@ -44,6 +52,7 @@ with new APIs (see below).
- In addition to `getSupportedPictureSizes` and `getSupportedPictureAspectRatio`, we now have equivalent methods for video. See below. - In addition to `getSupportedPictureSizes` and `getSupportedPictureAspectRatio`, we now have equivalent methods for video. See below.
### Session type ### Session type
The `SessionType` has been renamed to `Mode` which has a clearer meaning. The `SessionType` has been renamed to `Mode` which has a clearer meaning.
- `setSessionType()` is now `setMode()` - `setSessionType()` is now `setMode()`
@ -107,6 +116,7 @@ Some new APIs were introduced, which are respected by both standard videos and s
- `setVideoBitRate()` and `cameraVideoBitRate`: sets the video bit rate in bit/s - `setVideoBitRate()` and `cameraVideoBitRate`: sets the video bit rate in bit/s
### Camera Preview ### Camera Preview
The type of preview is now configurable with `cameraPreview` XML attribute and `Preview` control class. The type of preview is now configurable with `cameraPreview` XML attribute and `Preview` control class.
This defaults to the new `GL_SURFACE` and it is highly recommended that you do not change this. This defaults to the new `GL_SURFACE` and it is highly recommended that you do not change this.
@ -136,6 +146,7 @@ for instance, please do so using `setPictureSize()` and `setVideoSize()`.
**Note**: `getPreviewSize()` was removed as it has no useful meaning. **Note**: `getPreviewSize()` was removed as it has no useful meaning.
### CameraListener ### CameraListener
The listener interface brings two breaking signature changes: The listener interface brings two breaking signature changes:
- `onPictureTaken()` now returns a `PictureResult`. Use `result.getJpeg()` to access the jpeg stream. - `onPictureTaken()` now returns a `PictureResult`. Use `result.getJpeg()` to access the jpeg stream.
@ -145,10 +156,12 @@ The listener interface brings two breaking signature changes:
The result class includes rich information about the video (or video snapshot) that was taken. The result class includes rich information about the video (or video snapshot) that was taken.
### Experimental mode ### Experimental mode
The v2 version introduces a `cameraExperimental` XML flag that you can use to enable experimental features. The v2 version introduces a `cameraExperimental` XML flag that you can use to enable experimental features.
Might be used in the future to speed up development. Might be used in the future to speed up development.
### Other improvements & changes ### Other improvements & changes
- Added `@Nullable` and `@NonNull` annotations pretty much everywhere. This might **break** your Kotlin build. - Added `@Nullable` and `@NonNull` annotations pretty much everywhere. This might **break** your Kotlin build.
- Added `setGridColor()` and `cameraGridColor` to control the grid color - Added `setGridColor()` and `cameraGridColor` to control the grid color
- Default `Facing` value is not `BACK` anymore but rather a value that guarantees that you have cameras (if possible). - Default `Facing` value is not `BACK` anymore but rather a value that guarantees that you have cameras (if possible).

@ -9,6 +9,8 @@
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.

Loading…
Cancel
Save