chore: Cleanup Android codebase (#2415)
This commit is contained in:
parent
5c5d629936
commit
bae1f52d4a
@ -82,9 +82,11 @@ class CameraDevicesManager(private val reactContext: ReactApplicationContext) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Required for NativeEventEmitter, this is just a dummy implementation:
|
// Required for NativeEventEmitter, this is just a dummy implementation:
|
||||||
|
@Suppress("unused", "UNUSED_PARAMETER")
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
fun addListener(eventName: String) {}
|
fun addListener(eventName: String) {}
|
||||||
|
|
||||||
|
@Suppress("unused", "UNUSED_PARAMETER")
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
fun removeListeners(count: Int) {}
|
fun removeListeners(count: Int) {}
|
||||||
}
|
}
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
package com.mrousavy.camera.extensions
|
|
||||||
|
|
||||||
import android.hardware.camera2.params.DynamicRangeProfiles
|
|
||||||
import android.os.Build
|
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
|
|
||||||
private fun Set<Long>.firstMatch(filter: Set<Long>): Long? {
|
|
||||||
filter.forEach { f ->
|
|
||||||
if (this.contains(f)) {
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
|
||||||
private val bestProfiles = setOf(
|
|
||||||
DynamicRangeProfiles.HDR10_PLUS,
|
|
||||||
DynamicRangeProfiles.HDR10,
|
|
||||||
DynamicRangeProfiles.HLG10
|
|
||||||
)
|
|
||||||
|
|
||||||
val DynamicRangeProfiles.bestProfile: Long?
|
|
||||||
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
|
||||||
get() {
|
|
||||||
return supportedProfiles.firstMatch(bestProfiles)
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.mrousavy.camera.extensions
|
|
||||||
|
|
||||||
fun <T> List<T>.containsAny(elements: List<T>): Boolean = elements.any { element -> this.contains(element) }
|
|
@ -9,6 +9,7 @@ import com.facebook.proguard.annotations.DoNotStrip;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a JS Frame Processor
|
* Represents a JS Frame Processor
|
||||||
|
* @noinspection JavaJniMissingFunction
|
||||||
*/
|
*/
|
||||||
public final class FrameProcessor {
|
public final class FrameProcessor {
|
||||||
/**
|
/**
|
||||||
|
@ -8,10 +8,10 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The base class of a native Frame Processor Plugin.
|
* The base class of a native Frame Processor Plugin.
|
||||||
*
|
* <p></p>
|
||||||
* Subclass this to create a custom Frame Processor Plugin, which can be called from a JS Frame Processor.
|
* Subclass this to create a custom Frame Processor Plugin, which can be called from a JS Frame Processor.
|
||||||
* Once subclassed, it needs to be registered in the VisionCamera Frame Processor
|
* Once subclassed, it needs to be registered in the VisionCamera Frame Processor
|
||||||
* runtime via `FrameProcessorPluginRegistry.addFrameProcessorPlugin` - ideally at app startup.
|
* runtime via <code>FrameProcessorPluginRegistry.addFrameProcessorPlugin</code> - ideally at app startup.
|
||||||
|
|
||||||
* See: <a href="https://react-native-vision-camera.com/docs/guides/frame-processors-plugins-android">Creating Frame Processor Plugins (Android)</a>
|
* See: <a href="https://react-native-vision-camera.com/docs/guides/frame-processors-plugins-android">Creating Frame Processor Plugins (Android)</a>
|
||||||
* for more information
|
* for more information
|
||||||
|
@ -14,6 +14,17 @@ public class FrameProcessorPluginRegistry {
|
|||||||
private static final Map<String, PluginInitializer> Plugins = new HashMap<>();
|
private static final Map<String, PluginInitializer> Plugins = new HashMap<>();
|
||||||
private static final String TAG = "FrameProcessorPluginRegistry";
|
private static final String TAG = "FrameProcessorPluginRegistry";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the given Plugin to the Frame Processor Plugin Registry.
|
||||||
|
* The given Plugin might then be initialized later from JavaScript, through the <code>VisionCameraProxy</code>.
|
||||||
|
* The returned Plugin will be deallocated once the value is no longer used in JavaScript.
|
||||||
|
* <p></p>
|
||||||
|
* This function can be called from any Thread, and should be called as soon as possible - ideally on app start
|
||||||
|
* or in a static initializer.
|
||||||
|
*
|
||||||
|
* @param name The name of the plugin which will be used to find the plugin from the JS side.
|
||||||
|
* @param pluginInitializer An initializer function to create instances of this Plugin.
|
||||||
|
*/
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
@Keep
|
@Keep
|
||||||
public static void addFrameProcessorPlugin(String name, PluginInitializer pluginInitializer) {
|
public static void addFrameProcessorPlugin(String name, PluginInitializer pluginInitializer) {
|
||||||
|
@ -23,7 +23,6 @@ public class VisionCameraScheduler {
|
|||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
private void scheduleTrigger() {
|
private void scheduleTrigger() {
|
||||||
CameraQueues.CameraQueue videoQueue = CameraQueues.Companion.getVideoQueue();
|
CameraQueues.CameraQueue videoQueue = CameraQueues.Companion.getVideoQueue();
|
||||||
// TODO: Make sure post(this::trigger) works.
|
|
||||||
videoQueue.getHandler().post(this::trigger);
|
videoQueue.getHandler().post(this::trigger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user