Class ShortVideoPlugin
-
- All Implemented Interfaces:
-
ai.nexconn.chatui.channel.extension.component.plugin.IPluginModule,ai.nexconn.chatui.channel.extension.component.plugin.IPluginRequestPermissionResultCallback
public class ShortVideoPlugin implements IPluginModule, IPluginRequestPermissionResultCallback
-
-
Field Summary
Fields Modifier and Type Field Description protected ChannelIdentifierconversationIdentifierprotected Contextcontextpublic final static intREQUEST_CODE_PERMISSION_PLUGIN
-
Constructor Summary
Constructors Constructor Description ShortVideoPlugin()
-
Method Summary
Modifier and Type Method Description DrawableobtainDrawable(Context context)Gets the plugin icon. StringobtainTitle(Context context)Gets the plugin title. voidonClick(Fragment currentFragment, NCExtension extension, int index)Called when the plugin is clicked. voidonActivityResult(int requestCode, int resultCode, Intent data)Returns data results when the activity finishes. booleanonRequestPermissionResult(Fragment fragment, NCExtension extension, int requestCode, @NonNull() Array<String> permissions, @NonNull() Array<int> grantResults)Plugin permission request result. -
-
Method Detail
-
obtainDrawable
Drawable obtainDrawable(Context context)
Gets the plugin icon.
- Parameters:
context- Context.- Returns:
The icon Drawable.
-
obtainTitle
String obtainTitle(Context context)
Gets the plugin title.
- Parameters:
context- Context.- Returns:
The title string.
-
onClick
void onClick(Fragment currentFragment, NCExtension extension, int index)
Called when the plugin is clicked. 1. If data from the Extension is needed, call the corresponding Extension methods to obtain it. 2. If a new activity needs to be started after clicking, use startActivityForResult or startActivityForPluginResult.
Note: Do not hold long-lived references to the fragment or extension object, as this will cause memory leaks.
- Parameters:
currentFragment- The fragment associated with the plugin.extension- The NCExtension object.index- The index of the plugin in the plugin panel.
-
onActivityResult
void onActivityResult(int requestCode, int resultCode, Intent data)
Returns data results when the activity finishes.
In onClick, you may start a new activity in two ways:
1. Using startActivityForResult — you need to handle the result in the corresponding Activity's Activity#onActivityResult(int, int, Intent).
2. Using startActivityForPluginResult — after ChannelFragment receives Activity#onActivityResult(int, int, Intent), you must call onActivityPluginResult so that NCExtension can return the data result through IPluginModule's onActivityResult method.
- Parameters:
requestCode- The request code used when starting the activity; will not exceed 255.resultCode- The result code returned when the activity finishes.data- The returned data.
-
onRequestPermissionResult
boolean onRequestPermissionResult(Fragment fragment, NCExtension extension, int requestCode, @NonNull() Array<String> permissions, @NonNull() Array<int> grantResults)
Plugin permission request result.
- Parameters:
fragment- Fragment.extension- NCExtension.requestCode- Request code.permissions- Requested permissions.grantResults- Permission grant results.- Returns:
true if the plugin has handled the permission result; false otherwise.
-
-
-
-