Class FilePlugin

  • All Implemented Interfaces:
    ai.nexconn.chatui.channel.extension.component.plugin.IPluginModule

    
    public class FilePlugin
     implements IPluginModule
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      FilePlugin()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Drawable obtainDrawable(Context context) Gets the plugin icon.
      String obtainTitle(Context context) Gets the plugin title.
      void onClick(Fragment currentFragment, NCExtension extension, int index) Called when the plugin is clicked.
      void onActivityResult(int requestCode, int resultCode, Intent data) Returns data results when the activity finishes.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FilePlugin

        FilePlugin()
    • 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.