Skip to content

Commit

Permalink
update camera library to no longer depend up old storage mechanisms
Browse files Browse the repository at this point in the history
  • Loading branch information
n8fr8 committed Mar 14, 2024
1 parent ef5ca6c commit 41dd239
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions android-libproofcam/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ plugins {
}

android {
compileSdk = 33
compileSdk = 34
namespace = "org.witness.proofmode.camera"

defaultConfig {
minSdk = 21
targetSdk = 33
targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,12 @@ class C2paUtils {

}

/**
* Add content credentials to media from an external URI
*/
fun addContentCredentials (_context: Context, _uri: Uri?, isDirectCapture: Boolean, allowMachineLearning: Boolean) {

addContentCredentials(_context, _uri, isDirectCapture, allowMachineLearning, _context.cacheDir)

}


/**
* Add content credentials to media from an external URI, and specify the output directory of where to stare the new file
*/
fun addContentCredentials (_context: Context, _uri: Uri?, isDirectCapture: Boolean, allowMachineLearning: Boolean, fileOutDir: File) {
fun addContentCredentials (_context: Context, _uri: Uri?, isDirectCapture: Boolean, allowMachineLearning: Boolean) : File {

var filePath: String? = null
if (_uri != null && "content" == _uri.scheme) {
Expand All @@ -90,13 +82,13 @@ class C2paUtils {
filePath = _uri!!.path
}

var fileMedia = File(filePath)
val fileMedia = File(filePath!!)
var fileOut = fileMedia
var fileName = fileMedia.name;

if (!isDirectCapture) {
fileName = "c2pa-$fileName"
fileOut = File(fileOutDir, fileName);
fileOut = File(_context.cacheDir, fileName);
}

if (fileMedia.exists()) {
Expand All @@ -112,8 +104,12 @@ class C2paUtils {
fileMedia,
fileOut
)


}

return fileOut

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class SwipeGestureDetector : GestureDetector.SimpleOnGestureListener() {

var swipeCallback: SwipeCallback? = null

/**
override fun onFling(e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
if (e1 == null || e2 == null) return super.onFling(e1, e2, velocityX, velocityY)
val deltaX = e1.x - e2.x
Expand All @@ -26,6 +27,7 @@ class SwipeGestureDetector : GestureDetector.SimpleOnGestureListener() {
return true
}
*/

interface SwipeCallback {
fun onLeftSwipe()
Expand Down

0 comments on commit 41dd239

Please sign in to comment.