diff --git a/Package.swift b/Package.swift index 5348597..1759302 100644 --- a/Package.swift +++ b/Package.swift @@ -78,6 +78,9 @@ var package = Package( .library( name: "AndroidNFC", targets: ["AndroidNFC"] ), + .library( + name: "AndroidAppWidget", targets: ["AndroidAppWidget"] + ), ], dependencies: [ .package( @@ -490,6 +493,25 @@ var package = Package( sdkVersionDefine, ] ), + .target( + name: "AndroidAppWidget", + dependencies: [ + "AndroidJava", + "AndroidApp", + "AndroidContent", + "AndroidView", + "AndroidGraphics", + "AndroidUtil", + "AndroidWidget", + .product(name: "JavaLangIO", package: "SwiftJavaLang"), + ], + exclude: ["swift-java.config"], + swiftSettings: [ + .swiftLanguageMode(.v5), + ndkVersionDefine, + sdkVersionDefine, + ] + ), ], swiftLanguageModes: [.v5, .v6] ) diff --git a/Scripts/generate_appwidget_bindings.sh b/Scripts/generate_appwidget_bindings.sh new file mode 100644 index 0000000..b61373a --- /dev/null +++ b/Scripts/generate_appwidget_bindings.sh @@ -0,0 +1,5 @@ +# This is an example of how to generate bindings for an Android module. We should +# eventually build a more comprehensive script (perhaps in Python) for regenerating +# the bindings of all modules (+ any patches we want to apply to modules +# post-generation) +swift run swift-java wrap-java --output-directory Sources/AndroidAppWidget --swift-module AndroidAppWidget --depends-on AndroidAnimation=Sources/AndroidAnimation/swift-java.config --depends-on AndroidApp=Sources/AndroidApp/swift-java.config --depends-on AndroidAppWidget=Sources/AndroidAppWidget/swift-java.config --depends-on AndroidContent=Sources/AndroidContent/swift-java.config --depends-on AndroidGraphics=Sources/AndroidGraphics/swift-java.config --depends-on AndroidLocation=Sources/AndroidLocation/swift-java.config --depends-on AndroidMaterial=Sources/AndroidMaterial/swift-java.config --depends-on AndroidMedia=Sources/AndroidMedia/swift-java.config --depends-on AndroidNet=Sources/AndroidNet/swift-java.config --depends-on AndroidNFC=Sources/AndroidNFC/swift-java.config --depends-on AndroidOS=Sources/AndroidOS/swift-java.config --depends-on AndroidR=Sources/AndroidR/swift-java.config --depends-on AndroidUtil=Sources/AndroidUtil/swift-java.config --depends-on AndroidView=Sources/AndroidView/swift-java.config --depends-on AndroidWebKit=Sources/AndroidWebKit/swift-java.config --depends-on AndroidWidget=Sources/AndroidWidget/swift-java.config --depends-on AndroidX=Sources/AndroidX/swift-java.config diff --git a/Sources/AndroidAppWidget/AppWidgetHost.swift b/Sources/AndroidAppWidget/AppWidgetHost.swift new file mode 100644 index 0000000..3455a7e --- /dev/null +++ b/Sources/AndroidAppWidget/AppWidgetHost.swift @@ -0,0 +1,139 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import AndroidApp +import AndroidContent +import AndroidOS +import SwiftJava +import SwiftJavaJNICore + +@JavaClass("android.appwidget.AppWidgetHost") +open class AppWidgetHost: JavaObject { + @JavaMethod + @_nonoverride public convenience init(_ arg0: Context?, _ arg1: Int32, environment: JNIEnvironment? = nil) + + /// Java method `startListening`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHost.startListening() + /// ``` + @JavaMethod + open func startListening() + + /// Java method `stopListening`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHost.stopListening() + /// ``` + @JavaMethod + open func stopListening() + + /// Java method `deleteHost`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHost.deleteHost() + /// ``` + @JavaMethod + open func deleteHost() + + /// Java method `createView`. + /// + /// ### Java method signature + /// ```java + /// public final android.appwidget.AppWidgetHostView android.appwidget.AppWidgetHost.createView(android.content.Context,int,android.appwidget.AppWidgetProviderInfo) + /// ``` + @JavaMethod + open func createView(_ arg0: Context?, _ arg1: Int32, _ arg2: AppWidgetProviderInfo?) -> AppWidgetHostView! + + /// Java method `onCreateView`. + /// + /// ### Java method signature + /// ```java + /// protected android.appwidget.AppWidgetHostView android.appwidget.AppWidgetHost.onCreateView(android.content.Context,int,android.appwidget.AppWidgetProviderInfo) + /// ``` + @JavaMethod + open func onCreateView(_ arg0: Context?, _ arg1: Int32, _ arg2: AppWidgetProviderInfo?) -> AppWidgetHostView! + + /// Java method `clearViews`. + /// + /// ### Java method signature + /// ```java + /// protected void android.appwidget.AppWidgetHost.clearViews() + /// ``` + @JavaMethod + open func clearViews() + + /// Java method `allocateAppWidgetId`. + /// + /// ### Java method signature + /// ```java + /// public int android.appwidget.AppWidgetHost.allocateAppWidgetId() + /// ``` + @JavaMethod + open func allocateAppWidgetId() -> Int32 + + /// Java method `getAppWidgetIds`. + /// + /// ### Java method signature + /// ```java + /// public int[] android.appwidget.AppWidgetHost.getAppWidgetIds() + /// ``` + @JavaMethod + open func getAppWidgetIds() -> [Int32] + + /// Java method `deleteAppWidgetId`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHost.deleteAppWidgetId(int) + /// ``` + @JavaMethod + open func deleteAppWidgetId(_ arg0: Int32) + + /// Java method `onProviderChanged`. + /// + /// ### Java method signature + /// ```java + /// protected void android.appwidget.AppWidgetHost.onProviderChanged(int,android.appwidget.AppWidgetProviderInfo) + /// ``` + @JavaMethod + open func onProviderChanged(_ arg0: Int32, _ arg1: AppWidgetProviderInfo?) + + /// Java method `onAppWidgetRemoved`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHost.onAppWidgetRemoved(int) + /// ``` + @JavaMethod + open func onAppWidgetRemoved(_ arg0: Int32) + + /// Java method `onProvidersChanged`. + /// + /// ### Java method signature + /// ```java + /// protected void android.appwidget.AppWidgetHost.onProvidersChanged() + /// ``` + @JavaMethod + open func onProvidersChanged() + + /// Java method `startAppWidgetConfigureActivityForResult`. + /// + /// ### Java method signature + /// ```java + /// public final void android.appwidget.AppWidgetHost.startAppWidgetConfigureActivityForResult(android.app.Activity,int,int,int,android.os.Bundle) + /// ``` + @JavaMethod + open func startAppWidgetConfigureActivityForResult(_ arg0: Activity?, _ arg1: Int32, _ arg2: Int32, _ arg3: Int32, _ arg4: Bundle?) +} +extension JavaClass { + /// Java method `deleteAllHosts`. + /// + /// ### Java method signature + /// ```java + /// public static void android.appwidget.AppWidgetHost.deleteAllHosts() + /// ``` +@JavaStaticMethod + public func deleteAllHosts() +} diff --git a/Sources/AndroidAppWidget/AppWidgetHostView.swift b/Sources/AndroidAppWidget/AppWidgetHostView.swift new file mode 100644 index 0000000..bbc8f94 --- /dev/null +++ b/Sources/AndroidAppWidget/AppWidgetHostView.swift @@ -0,0 +1,173 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import AndroidContent +import AndroidGraphics +import AndroidOS +import AndroidUtil +import AndroidView +import AndroidWidget +import SwiftJava +import SwiftJavaJNICore + +@JavaClass("android.appwidget.AppWidgetHostView") +open class AppWidgetHostView: FrameLayout { + @JavaMethod + @_nonoverride public convenience init(_ arg0: Context?, _ arg1: Int32, _ arg2: Int32, environment: JNIEnvironment? = nil) + + @JavaMethod + @_nonoverride public convenience init(_ arg0: Context?, environment: JNIEnvironment? = nil) + + /// Java method `getAppWidgetInfo`. + /// + /// ### Java method signature + /// ```java + /// public android.appwidget.AppWidgetProviderInfo android.appwidget.AppWidgetHostView.getAppWidgetInfo() + /// ``` + @JavaMethod + open func getAppWidgetInfo() -> AppWidgetProviderInfo! + + /// Java method `updateAppWidgetSize`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHostView.updateAppWidgetSize(android.os.Bundle,int,int,int,int) + /// ``` + @available(*, deprecated) + @JavaMethod + open func updateAppWidgetSize(_ arg0: Bundle?, _ arg1: Int32, _ arg2: Int32, _ arg3: Int32, _ arg4: Int32) + + /// Java method `updateAppWidgetOptions`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHostView.updateAppWidgetOptions(android.os.Bundle) + /// ``` + @JavaMethod + open func updateAppWidgetOptions(_ arg0: Bundle?) + + /// Java method `generateLayoutParams`. + /// + /// ### Java method signature + /// ```java + /// public android.widget.FrameLayout$LayoutParams android.appwidget.AppWidgetHostView.generateLayoutParams(android.util.AttributeSet) + /// ``` + @JavaMethod + open override func generateLayoutParams(_ arg0: AttributeSet?) -> FrameLayout.LayoutParams! + + /// Java method `setOnLightBackground`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHostView.setOnLightBackground(boolean) + /// ``` + @JavaMethod + open func setOnLightBackground(_ arg0: Bool) + + /// Java method `updateAppWidget`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHostView.updateAppWidget(android.widget.RemoteViews) + /// ``` + @JavaMethod + open func updateAppWidget(_ arg0: RemoteViews?) + + /// Java method `setColorResources`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHostView.setColorResources(android.util.SparseIntArray) + /// ``` + @JavaMethod + open func setColorResources(_ arg0: SparseIntArray?) + + /// Java method `resetColorResources`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHostView.resetColorResources() + /// ``` + @JavaMethod + open func resetColorResources() + + /// Java method `setAppWidget`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetHostView.setAppWidget(int,android.appwidget.AppWidgetProviderInfo) + /// ``` + @JavaMethod + open func setAppWidget(_ arg0: Int32, _ arg1: AppWidgetProviderInfo?) + + /// Java method `getAppWidgetId`. + /// + /// ### Java method signature + /// ```java + /// public int android.appwidget.AppWidgetHostView.getAppWidgetId() + /// ``` + @JavaMethod + open func getAppWidgetId() -> Int32 + + /// Java method `onLayout`. + /// + /// ### Java method signature + /// ```java + /// protected void android.appwidget.AppWidgetHostView.onLayout(boolean,int,int,int,int) + /// ``` + @JavaMethod + open override func onLayout(_ arg0: Bool, _ arg1: Int32, _ arg2: Int32, _ arg3: Int32, _ arg4: Int32) + + /// Java method `prepareView`. + /// + /// ### Java method signature + /// ```java + /// protected void android.appwidget.AppWidgetHostView.prepareView(android.view.View) + /// ``` + @JavaMethod + open func prepareView(_ arg0: View?) + + /// Java method `getDefaultView`. + /// + /// ### Java method signature + /// ```java + /// protected android.view.View android.appwidget.AppWidgetHostView.getDefaultView() + /// ``` + @JavaMethod + open func getDefaultView() -> View! + + /// Java method `getErrorView`. + /// + /// ### Java method signature + /// ```java + /// protected android.view.View android.appwidget.AppWidgetHostView.getErrorView() + /// ``` + @JavaMethod + open func getErrorView() -> View! + + /// Java method `dispatchSaveInstanceState`. + /// + /// ### Java method signature + /// ```java + /// protected void android.appwidget.AppWidgetHostView.dispatchSaveInstanceState(android.util.SparseArray) + /// ``` + @JavaMethod + open override func dispatchSaveInstanceState(_ arg0: SparseArray?) + + /// Java method `dispatchRestoreInstanceState`. + /// + /// ### Java method signature + /// ```java + /// protected void android.appwidget.AppWidgetHostView.dispatchRestoreInstanceState(android.util.SparseArray) + /// ``` + @JavaMethod + open override func dispatchRestoreInstanceState(_ arg0: SparseArray?) +} +extension JavaClass { + /// Java method `getDefaultPaddingForWidget`. + /// + /// ### Java method signature + /// ```java + /// public static android.graphics.Rect android.appwidget.AppWidgetHostView.getDefaultPaddingForWidget(android.content.Context,android.content.ComponentName,android.graphics.Rect) + /// ``` +@JavaStaticMethod + public func getDefaultPaddingForWidget(_ arg0: Context?, _ arg1: ComponentName?, _ arg2: Rect?) -> Rect! +} diff --git a/Sources/AndroidAppWidget/AppWidgetManager.swift b/Sources/AndroidAppWidget/AppWidgetManager.swift new file mode 100644 index 0000000..ea69bbf --- /dev/null +++ b/Sources/AndroidAppWidget/AppWidgetManager.swift @@ -0,0 +1,260 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import AndroidApp +import AndroidContent +import AndroidOS +import AndroidWidget +import SwiftJava +import SwiftJavaJNICore + +@JavaClass("android.appwidget.AppWidgetManager") +open class AppWidgetManager: JavaObject { + /// Java method `getAppWidgetIds`. + /// + /// ### Java method signature + /// ```java + /// public int[] android.appwidget.AppWidgetManager.getAppWidgetIds(android.content.ComponentName) + /// ``` +@JavaMethod + open func getAppWidgetIds(_ arg0: ComponentName?) -> [Int32] + + /// Java method `getAppWidgetOptions`. + /// + /// ### Java method signature + /// ```java + /// public android.os.Bundle android.appwidget.AppWidgetManager.getAppWidgetOptions(int) + /// ``` +@JavaMethod + open func getAppWidgetOptions(_ arg0: Int32) -> Bundle! + + /// Java method `requestPinAppWidget`. + /// + /// ### Java method signature + /// ```java + /// public boolean android.appwidget.AppWidgetManager.requestPinAppWidget(android.content.ComponentName,android.os.Bundle,android.app.PendingIntent) + /// ``` +@JavaMethod + open func requestPinAppWidget(_ arg0: ComponentName?, _ arg1: Bundle?, _ arg2: PendingIntent?) -> Bool + + /// Java method `partiallyUpdateAppWidget`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetManager.partiallyUpdateAppWidget(int,android.widget.RemoteViews) + /// ``` +@JavaMethod + open func partiallyUpdateAppWidget(_ arg0: Int32, _ arg1: RemoteViews?) + + /// Java method `partiallyUpdateAppWidget`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetManager.partiallyUpdateAppWidget(int[],android.widget.RemoteViews) + /// ``` +@JavaMethod + open func partiallyUpdateAppWidget(_ arg0: [Int32], _ arg1: RemoteViews?) + + /// Java method `updateAppWidgetProviderInfo`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetManager.updateAppWidgetProviderInfo(android.content.ComponentName,java.lang.String) + /// ``` +@JavaMethod + open func updateAppWidgetProviderInfo(_ arg0: ComponentName?, _ arg1: String) + + /// Java method `notifyAppWidgetViewDataChanged`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetManager.notifyAppWidgetViewDataChanged(int[],int) + /// ``` +@JavaMethod + open func notifyAppWidgetViewDataChanged(_ arg0: [Int32], _ arg1: Int32) + + /// Java method `notifyAppWidgetViewDataChanged`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetManager.notifyAppWidgetViewDataChanged(int,int) + /// ``` +@JavaMethod + open func notifyAppWidgetViewDataChanged(_ arg0: Int32, _ arg1: Int32) + + /// Java method `bindAppWidgetIdIfAllowed`. + /// + /// ### Java method signature + /// ```java + /// public boolean android.appwidget.AppWidgetManager.bindAppWidgetIdIfAllowed(int,android.content.ComponentName,android.os.Bundle) + /// ``` +@JavaMethod + open func bindAppWidgetIdIfAllowed(_ arg0: Int32, _ arg1: ComponentName?, _ arg2: Bundle?) -> Bool + + /// Java method `bindAppWidgetIdIfAllowed`. + /// + /// ### Java method signature + /// ```java + /// public boolean android.appwidget.AppWidgetManager.bindAppWidgetIdIfAllowed(int,android.os.UserHandle,android.content.ComponentName,android.os.Bundle) + /// ``` +@JavaMethod + open func bindAppWidgetIdIfAllowed(_ arg0: Int32, _ arg1: UserHandle?, _ arg2: ComponentName?, _ arg3: Bundle?) -> Bool + + /// Java method `bindAppWidgetIdIfAllowed`. + /// + /// ### Java method signature + /// ```java + /// public boolean android.appwidget.AppWidgetManager.bindAppWidgetIdIfAllowed(int,android.content.ComponentName) + /// ``` +@JavaMethod + open func bindAppWidgetIdIfAllowed(_ arg0: Int32, _ arg1: ComponentName?) -> Bool + + /// Java method `isRequestPinAppWidgetSupported`. + /// + /// ### Java method signature + /// ```java + /// public boolean android.appwidget.AppWidgetManager.isRequestPinAppWidgetSupported() + /// ``` +@JavaMethod + open func isRequestPinAppWidgetSupported() -> Bool + + /// Java method `getAppWidgetInfo`. + /// + /// ### Java method signature + /// ```java + /// public android.appwidget.AppWidgetProviderInfo android.appwidget.AppWidgetManager.getAppWidgetInfo(int) + /// ``` +@JavaMethod + open func getAppWidgetInfo(_ arg0: Int32) -> AppWidgetProviderInfo! + + /// Java method `updateAppWidgetOptions`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetManager.updateAppWidgetOptions(int,android.os.Bundle) + /// ``` +@JavaMethod + open func updateAppWidgetOptions(_ arg0: Int32, _ arg1: Bundle?) + + /// Java method `updateAppWidget`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetManager.updateAppWidget(android.content.ComponentName,android.widget.RemoteViews) + /// ``` +@JavaMethod + open func updateAppWidget(_ arg0: ComponentName?, _ arg1: RemoteViews?) + + /// Java method `updateAppWidget`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetManager.updateAppWidget(int[],android.widget.RemoteViews) + /// ``` +@JavaMethod + open func updateAppWidget(_ arg0: [Int32], _ arg1: RemoteViews?) + + /// Java method `updateAppWidget`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetManager.updateAppWidget(int,android.widget.RemoteViews) + /// ``` +@JavaMethod + open func updateAppWidget(_ arg0: Int32, _ arg1: RemoteViews?) +} +extension JavaClass { + @JavaStaticField(isFinal: true) + public var ACTION_APPWIDGET_BIND: String + + @JavaStaticField(isFinal: true) + public var ACTION_APPWIDGET_CONFIGURE: String + + @JavaStaticField(isFinal: true) + public var ACTION_APPWIDGET_DELETED: String + + @JavaStaticField(isFinal: true) + public var ACTION_APPWIDGET_DISABLED: String + + @JavaStaticField(isFinal: true) + public var ACTION_APPWIDGET_ENABLED: String + + @JavaStaticField(isFinal: true) + public var ACTION_APPWIDGET_HOST_RESTORED: String + + @JavaStaticField(isFinal: true) + public var ACTION_APPWIDGET_OPTIONS_CHANGED: String + + @JavaStaticField(isFinal: true) + public var ACTION_APPWIDGET_PICK: String + + @JavaStaticField(isFinal: true) + public var ACTION_APPWIDGET_RESTORED: String + + @JavaStaticField(isFinal: true) + public var ACTION_APPWIDGET_UPDATE: String + + @JavaStaticField(isFinal: true) + public var EXTRA_APPWIDGET_ID: String + + @JavaStaticField(isFinal: true) + public var EXTRA_APPWIDGET_IDS: String + + @JavaStaticField(isFinal: true) + public var EXTRA_APPWIDGET_OLD_IDS: String + + @JavaStaticField(isFinal: true) + public var EXTRA_APPWIDGET_OPTIONS: String + + @JavaStaticField(isFinal: true) + public var EXTRA_APPWIDGET_PREVIEW: String + + @JavaStaticField(isFinal: true) + public var EXTRA_APPWIDGET_PROVIDER: String + + @JavaStaticField(isFinal: true) + public var EXTRA_APPWIDGET_PROVIDER_PROFILE: String + + @JavaStaticField(isFinal: true) + public var EXTRA_CUSTOM_EXTRAS: String + + @JavaStaticField(isFinal: true) + public var EXTRA_CUSTOM_INFO: String + + @JavaStaticField(isFinal: true) + public var EXTRA_HOST_ID: String + + @JavaStaticField(isFinal: true) + public var INVALID_APPWIDGET_ID: Int32 + + @JavaStaticField(isFinal: true) + public var META_DATA_APPWIDGET_PROVIDER: String + + @JavaStaticField(isFinal: true) + public var OPTION_APPWIDGET_HOST_CATEGORY: String + + @JavaStaticField(isFinal: true) + public var OPTION_APPWIDGET_MAX_HEIGHT: String + + @JavaStaticField(isFinal: true) + public var OPTION_APPWIDGET_MAX_WIDTH: String + + @JavaStaticField(isFinal: true) + public var OPTION_APPWIDGET_MIN_HEIGHT: String + + @JavaStaticField(isFinal: true) + public var OPTION_APPWIDGET_MIN_WIDTH: String + + @JavaStaticField(isFinal: true) + public var OPTION_APPWIDGET_RESTORE_COMPLETED: String + + @JavaStaticField(isFinal: true) + public var OPTION_APPWIDGET_SIZES: String + + /// Java method `getInstance`. + /// + /// ### Java method signature + /// ```java + /// public static android.appwidget.AppWidgetManager android.appwidget.AppWidgetManager.getInstance(android.content.Context) + /// ``` + @JavaStaticMethod + public func getInstance(_ arg0: Context?) -> AppWidgetManager! +} diff --git a/Sources/AndroidAppWidget/AppWidgetProvider.swift b/Sources/AndroidAppWidget/AppWidgetProvider.swift new file mode 100644 index 0000000..6f3b3dc --- /dev/null +++ b/Sources/AndroidAppWidget/AppWidgetProvider.swift @@ -0,0 +1,74 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import AndroidContent +import AndroidOS +import SwiftJava +import SwiftJavaJNICore + +@JavaClass("android.appwidget.AppWidgetProvider") +open class AppWidgetProvider: BroadcastReceiver { + @JavaMethod + @_nonoverride public convenience init(environment: JNIEnvironment? = nil) + + /// Java method `onReceive`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetProvider.onReceive(android.content.Context,android.content.Intent) + /// ``` + @JavaMethod + open override func onReceive(_ arg0: Context?, _ arg1: Intent?) + + /// Java method `onUpdate`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetProvider.onUpdate(android.content.Context,android.appwidget.AppWidgetManager,int[]) + /// ``` + @JavaMethod + open func onUpdate(_ arg0: Context?, _ arg1: AppWidgetManager?, _ arg2: [Int32]) + + /// Java method `onDeleted`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetProvider.onDeleted(android.content.Context,int[]) + /// ``` + @JavaMethod + open func onDeleted(_ arg0: Context?, _ arg1: [Int32]) + + /// Java method `onEnabled`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetProvider.onEnabled(android.content.Context) + /// ``` + @JavaMethod + open func onEnabled(_ arg0: Context?) + + /// Java method `onDisabled`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetProvider.onDisabled(android.content.Context) + /// ``` + @JavaMethod + open func onDisabled(_ arg0: Context?) + + /// Java method `onRestored`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetProvider.onRestored(android.content.Context,int[],int[]) + /// ``` + @JavaMethod + open func onRestored(_ arg0: Context?, _ arg1: [Int32], _ arg2: [Int32]) + + /// Java method `onAppWidgetOptionsChanged`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetProvider.onAppWidgetOptionsChanged(android.content.Context,android.appwidget.AppWidgetManager,int,android.os.Bundle) + /// ``` + @JavaMethod + open func onAppWidgetOptionsChanged(_ arg0: Context?, _ arg1: AppWidgetManager?, _ arg2: Int32, _ arg3: Bundle?) +} diff --git a/Sources/AndroidAppWidget/AppWidgetProviderInfo.swift b/Sources/AndroidAppWidget/AppWidgetProviderInfo.swift new file mode 100644 index 0000000..85fca60 --- /dev/null +++ b/Sources/AndroidAppWidget/AppWidgetProviderInfo.swift @@ -0,0 +1,197 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import AndroidContent +import AndroidGraphics +import AndroidOS +import SwiftJava +import SwiftJavaJNICore + +@JavaClass("android.appwidget.AppWidgetProviderInfo", implements: Parcelable.self) +open class AppWidgetProviderInfo: JavaObject { + @JavaField(isFinal: false) + public var autoAdvanceViewId: Int32 + + @JavaField(isFinal: false) + public var configure: ComponentName! + + @JavaField(isFinal: false) + public var descriptionRes: Int32 + + @JavaField(isFinal: false) + public var icon: Int32 + + @JavaField(isFinal: false) + public var initialKeyguardLayout: Int32 + + @JavaField(isFinal: false) + public var initialLayout: Int32 + + @available(*, deprecated) + @JavaField(isFinal: false) + public var label: String + + @JavaField(isFinal: false) + public var maxResizeHeight: Int32 + + @JavaField(isFinal: false) + public var maxResizeWidth: Int32 + + @JavaField(isFinal: false) + public var minHeight: Int32 + + @JavaField(isFinal: false) + public var minResizeHeight: Int32 + + @JavaField(isFinal: false) + public var minResizeWidth: Int32 + + @JavaField(isFinal: false) + public var minWidth: Int32 + + @JavaField(isFinal: false) + public var previewImage: Int32 + + @JavaField(isFinal: false) + public var previewLayout: Int32 + + @JavaField(isFinal: false) + public var provider: ComponentName! + + @JavaField(isFinal: false) + public var resizeMode: Int32 + + @JavaField(isFinal: false) + public var targetCellHeight: Int32 + + @JavaField(isFinal: false) + public var targetCellWidth: Int32 + + @JavaField(isFinal: false) + public var updatePeriodMillis: Int32 + + @JavaField(isFinal: false) + public var widgetCategory: Int32 + + @JavaField(isFinal: false) + public var widgetFeatures: Int32 + + @JavaMethod + @_nonoverride public convenience init(environment: JNIEnvironment? = nil) + + @JavaMethod + @_nonoverride public convenience init(_ arg0: Parcel?, environment: JNIEnvironment? = nil) + + /// Java method `loadLabel`. + /// + /// ### Java method signature + /// ```java + /// public final java.lang.String android.appwidget.AppWidgetProviderInfo.loadLabel(android.content.pm.PackageManager) + /// ``` + @JavaMethod + open func loadLabel(_ arg0: PackageManager?) -> String + + /// Java method `loadIcon`. + /// + /// ### Java method signature + /// ```java + /// public final android.graphics.drawable.Drawable android.appwidget.AppWidgetProviderInfo.loadIcon(android.content.Context,int) + /// ``` + @JavaMethod + open func loadIcon(_ arg0: Context?, _ arg1: Int32) -> Drawable! + + /// Java method `getProfile`. + /// + /// ### Java method signature + /// ```java + /// public final android.os.UserHandle android.appwidget.AppWidgetProviderInfo.getProfile() + /// ``` + @JavaMethod + open func getProfile() -> UserHandle! + + /// Java method `writeToParcel`. + /// + /// ### Java method signature + /// ```java + /// public void android.appwidget.AppWidgetProviderInfo.writeToParcel(android.os.Parcel,int) + /// ``` + @JavaMethod + open func writeToParcel(_ arg0: Parcel?, _ arg1: Int32) + + /// Java method `loadPreviewImage`. + /// + /// ### Java method signature + /// ```java + /// public final android.graphics.drawable.Drawable android.appwidget.AppWidgetProviderInfo.loadPreviewImage(android.content.Context,int) + /// ``` + @JavaMethod + open func loadPreviewImage(_ arg0: Context?, _ arg1: Int32) -> Drawable! + + /// Java method `getActivityInfo`. + /// + /// ### Java method signature + /// ```java + /// public android.content.pm.ActivityInfo android.appwidget.AppWidgetProviderInfo.getActivityInfo() + /// ``` + @JavaMethod + open func getActivityInfo() -> ActivityInfo! + + /// Java method `describeContents`. + /// + /// ### Java method signature + /// ```java + /// public int android.appwidget.AppWidgetProviderInfo.describeContents() + /// ``` + @JavaMethod + open func describeContents() -> Int32 + + /// Java method `toString`. + /// + /// ### Java method signature + /// ```java + /// public java.lang.String android.appwidget.AppWidgetProviderInfo.toString() + /// ``` + @JavaMethod + open override func toString() -> String + + /// Java method `clone`. + /// + /// ### Java method signature + /// ```java + /// public android.appwidget.AppWidgetProviderInfo android.appwidget.AppWidgetProviderInfo.clone() + /// ``` + @JavaMethod + open override func clone() -> AppWidgetProviderInfo! +} +extension JavaClass { + @JavaStaticField(isFinal: true) + public var CREATOR: Parcelable.Creator! + + @JavaStaticField(isFinal: true) + public var RESIZE_BOTH: Int32 + + @JavaStaticField(isFinal: true) + public var RESIZE_HORIZONTAL: Int32 + + @JavaStaticField(isFinal: true) + public var RESIZE_NONE: Int32 + + @JavaStaticField(isFinal: true) + public var RESIZE_VERTICAL: Int32 + + @JavaStaticField(isFinal: true) + public var WIDGET_CATEGORY_HOME_SCREEN: Int32 + + @JavaStaticField(isFinal: true) + public var WIDGET_CATEGORY_KEYGUARD: Int32 + + @JavaStaticField(isFinal: true) + public var WIDGET_CATEGORY_SEARCHBOX: Int32 + + @JavaStaticField(isFinal: true) + public var WIDGET_FEATURE_CONFIGURATION_OPTIONAL: Int32 + + @JavaStaticField(isFinal: true) + public var WIDGET_FEATURE_HIDE_FROM_PICKER: Int32 + + @JavaStaticField(isFinal: true) + public var WIDGET_FEATURE_RECONFIGURABLE: Int32 +} diff --git a/Sources/AndroidAppWidget/swift-java.config b/Sources/AndroidAppWidget/swift-java.config new file mode 100644 index 0000000..77d8c6c --- /dev/null +++ b/Sources/AndroidAppWidget/swift-java.config @@ -0,0 +1,10 @@ +{ + "classes" : { + "android.appwidget.AppWidgetHost" : "AppWidgetHost", + "android.appwidget.AppWidgetHostView" : "AppWidgetHostView", + "android.appwidget.AppWidgetManager" : "AppWidgetManager", + "android.appwidget.AppWidgetProvider" : "AppWidgetProvider", + "android.appwidget.AppWidgetProviderInfo" : "AppWidgetProviderInfo" + }, + "classpath" : "../../../../Library/Android/sdk/platforms/android-31/android.jar" +} diff --git a/Sources/AndroidWidget/FrameLayout.swift b/Sources/AndroidWidget/FrameLayout.swift index 5d13299..9c5ad85 100644 --- a/Sources/AndroidWidget/FrameLayout.swift +++ b/Sources/AndroidWidget/FrameLayout.swift @@ -3,6 +3,7 @@ import SwiftJava import CSwiftJavaJNI import AndroidView import AndroidContent +import AndroidUtil @JavaClass("android.widget.FrameLayout") open class FrameLayout: ViewGroup { @@ -25,6 +26,9 @@ open class FrameLayout: ViewGroup { @JavaMethod open func getMeasureAllChildren() -> Bool + @JavaMethod + open func generateLayoutParams(_ arg0: AttributeSet?) -> FrameLayout.LayoutParams! + @JavaMethod open func generateLayoutParams(_ arg0: ViewSwitcher.LayoutParams?) -> ViewSwitcher.LayoutParams!