Class FilePlugin
-
- All Implemented Interfaces:
-
ai.nexconn.chatui.channel.extension.component.plugin.IPluginModule
public class FilePlugin implements IPluginModule
-
-
Constructor Summary
Constructors Constructor Description FilePlugin()
-
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. -
-
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.
-
-
-
-