diff --git a/app/build.gradle b/app/build.gradle index e88c430..b3ddd0e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.kieranbrowne.cameraadversaria" minSdkVersion 21 targetSdkVersion 28 - versionCode 1 - versionName "1.0" + versionCode 3 + versionName "1.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1000a80..43f1e57 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,19 +1,21 @@ - + + android:theme="@style/AppTheme" tools:ignore="GoogleAppIndexingWarning"> + , val context: android.c override fun doInBackground(vararg params: Void?): Bitmap? { val gpuImage = GPUImage(context) - gpuImage.setFilter(AdversarialFilter(amp)) + gpuImage.setFilter(AdversarialFilter(amp,Math.random())) // ... val bitmap = BitmapFactory.decodeFile(private_file) diff --git a/app/src/main/java/com/kieranbrowne/cameraadversaria/MainActivity.kt b/app/src/main/java/com/kieranbrowne/cameraadversaria/MainActivity.kt index 26876da..7dc0b17 100644 --- a/app/src/main/java/com/kieranbrowne/cameraadversaria/MainActivity.kt +++ b/app/src/main/java/com/kieranbrowne/cameraadversaria/MainActivity.kt @@ -35,6 +35,7 @@ import java.lang.Exception class MainActivity : Activity(), TextureView.SurfaceTextureListener { + var isRearCam : Boolean = true; lateinit var previewSurface: Surface @@ -54,7 +55,9 @@ class MainActivity : Activity(), TextureView.SurfaceTextureListener { setContentView(R.layout.activity_main) - surfaceView.holder.addCallback(surfaceReadyCallback) + if(checkPermission()) { + surfaceView.holder.addCallback(surfaceReadyCallback) + } try { displayLatestImageThumb(); @@ -64,11 +67,9 @@ class MainActivity : Activity(), TextureView.SurfaceTextureListener { } private fun reopenCamera() { - if(checkPermission()) { if (previewSurface.isValid) { openCamera() } - } } @@ -296,7 +297,7 @@ class MainActivity : Activity(), TextureView.SurfaceTextureListener { val gpuImage = GPUImage(this) - gpuImage.setFilter(AdversarialFilter(0.0)) + gpuImage.setFilter(AdversarialFilter(0.0, Math.random())) gpuImage.setImage(private_file) val adversarial_image = gpuImage.getBitmapWithFilterApplied(bmp) @@ -399,6 +400,8 @@ class MainActivity : Activity(), TextureView.SurfaceTextureListener { ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE), 123) + //setContentView(R.layout.activity_main) + reopenCamera() return false } else { return true diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index 43a3ab1..e6571af 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png index 7c7507e..fdbf2b6 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index 2585aa3..25da74f 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index bf07e4b..b29fda3 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png index be99537..74db0ea 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index 1c5c48e..09b15c5 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 5d0dcbe..2134bee 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png index 02ce509..fecab92 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index 5adb066..565a9e0 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 7b33195..bf98473 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png index f6846ab..1843fe6 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index e2491a5..6bbdaa7 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 2bb0f71..8defd6c 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png index eb726aa..7ea879b 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index 5a02517..840ed57 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ