feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package dev.cutdex.cutdex_native
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.DisplayMetrics
|
||||
import io.flutter.embedding.engine.plugins.FlutterPlugin
|
||||
import io.flutter.embedding.engine.plugins.activity.ActivityAware
|
||||
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
|
||||
import io.flutter.plugin.common.MethodCall
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
|
||||
class CutdexNativePlugin : FlutterPlugin, ActivityAware, MethodChannel.MethodCallHandler {
|
||||
private var channel: MethodChannel? = null
|
||||
private var activity: Activity? = null
|
||||
private var context: Context? = null
|
||||
|
||||
override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) {
|
||||
context = binding.applicationContext
|
||||
channel = MethodChannel(binding.binaryMessenger, "cutdex_native/device_info").also {
|
||||
it.setMethodCallHandler(this)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
|
||||
if (call.method == "getApplicationInfo") {
|
||||
val host = context ?: return result.error("unavailable", "No application context.", null)
|
||||
try {
|
||||
@Suppress("DEPRECATION")
|
||||
val info = host.packageManager.getPackageInfo(host.packageName, 0)
|
||||
@Suppress("DEPRECATION")
|
||||
val build = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) info.longVersionCode else info.versionCode.toLong()
|
||||
result.success(mapOf("appVersion" to (info.versionName ?: "unknown"), "appBuild" to build.toString()))
|
||||
} catch (error: Exception) {
|
||||
result.error("unavailable", "Application metadata unavailable.", null)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (call.method != "getDeviceInfo") {
|
||||
result.notImplemented()
|
||||
return
|
||||
}
|
||||
val host = activity
|
||||
if (host == null) {
|
||||
result.error("unavailable", "No activity is attached.", null)
|
||||
return
|
||||
}
|
||||
// Maximum bounds do not shrink with the app's split-screen window.
|
||||
val shortestSideDp = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
val bounds = host.windowManager.maximumWindowMetrics.bounds
|
||||
minOf(bounds.width(), bounds.height()) / host.resources.displayMetrics.density
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
val metrics = DisplayMetrics().also {
|
||||
host.windowManager.defaultDisplay.getRealMetrics(it)
|
||||
}
|
||||
minOf(metrics.widthPixels, metrics.heightPixels) / metrics.density
|
||||
}
|
||||
result.success(mapOf("displayShortestSideDp" to shortestSideDp.toDouble()))
|
||||
}
|
||||
|
||||
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
|
||||
activity = binding.activity
|
||||
}
|
||||
|
||||
override fun onDetachedFromActivityForConfigChanges() {
|
||||
activity = null
|
||||
}
|
||||
|
||||
override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) {
|
||||
activity = binding.activity
|
||||
}
|
||||
|
||||
override fun onDetachedFromActivity() {
|
||||
activity = null
|
||||
}
|
||||
|
||||
override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
|
||||
channel?.setMethodCallHandler(null)
|
||||
channel = null
|
||||
activity = null
|
||||
context = null
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user