Interface IPluginModule
-
- All Implemented Interfaces:
public interface IPluginModule
-
-
Method Summary
Modifier and Type Method Description abstract DrawableobtainDrawable(Context context)Gets the plugin icon. abstract StringobtainTitle(Context context)Gets the plugin title. abstract voidonClick(Fragment currentFragment, RongExtension extension, int index)Called when the plugin is clicked. abstract voidonActivityResult(int requestCode, int resultCode, Intent data)Returns data results when the activity finishes. -
-
Method Detail
-
obtainDrawable
abstract Drawable obtainDrawable(Context context)
Gets the plugin icon.
- Parameters:
context- Context.- Returns:
The icon Drawable.
-
obtainTitle
abstract String obtainTitle(Context context)
Gets the plugin title.
- Parameters:
context- Context.- Returns:
The title string.
-
onClick
abstract void onClick(Fragment currentFragment, RongExtension 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 RongExtension object.index- The index of the plugin in the plugin panel.
-
onActivityResult
abstract 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 RongExtension 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.
-
-
-
-