org.botlibre.sdk.activity
Class MainActivity

java.lang.Object
  extended by android.content.Context
      extended by android.content.ContextWrapper
          extended by android.view.ContextThemeWrapper
              extended by android.app.Activity
                  extended by org.botlibre.sdk.activity.MainActivity
All Implemented Interfaces:
android.content.ComponentCallbacks, android.content.ComponentCallbacks2, android.view.KeyEvent.Callback, android.view.LayoutInflater.Factory, android.view.LayoutInflater.Factory2, android.view.View.OnCreateContextMenuListener, android.view.Window.Callback

public class MainActivity
extends android.app.Activity

Main view, allows connect, browse and content creation. Also stores a lot of shared data, such as the connection, current user/instance/conversation. You do not need to use the MainActivity in your app, but it needs to be there so the other activities can access the shared data. You can reuse any of the activities in your own app, such as just the Chat, Forum, LiveChat, or user management activities. You can customize the code and layouts any way you wish for your own app, or just use the SDKConnection, or LiveChatConnection API.

You can create an app to access a single bot, forum, or channel instance using this MainActivity class. You will need to create your bot, forum, or channel using yuor service provider website, or mobile app (BOT libre, FORUMS libre, LIVE CHAT libre, Paphus Live Chat).

You only need to set the applicationId, launchType, and launchInstanceId or launchInstanceName. You will also want to replace the logo.png in res/drawable and update the application name and version in the AndroidManifest, then you can package the app into your own apk file and upload it to Google Play or any other site. The app is yours, you can charge for it, or give it away for free.


Nested Class Summary
static class MainActivity.LaunchType
           
 
Field Summary
static java.lang.String[] accessModes
           
static boolean ADULT
           
static java.lang.String applicationId
          Enter your application ID here.
static java.util.List<AvatarConfig> avatars
           
static BotModeConfig botMode
           
static java.lang.String[] botModes
           
static java.lang.Object[] categories
           
static java.lang.Object[] channelCategories
           
static java.lang.Object[] channelTags
           
static java.lang.String[] channelTypes
           
static SDKConnection connection
          Configure your connection credentials here.
static java.lang.String conversation
           
static java.lang.String[] correctionModes
           
static MainActivity current
           
static boolean DEBUG
           
static java.lang.String defaultType
           
static boolean deviceVoice
           
static boolean disableVideo
           
static DomainConfig domain
           
static java.lang.String domainId
          To launch into a specific domain, enter the domain id here.
static java.lang.Object[] forumCategories
           
static java.lang.Object[] forumPostTags
           
static java.lang.Object[] forumTags
           
static WebMediumConfig instance
           
static java.util.List<WebMediumConfig> instances
           
static java.lang.String launchInstanceId
          If you are building a single instance app, then you can set the instance id or name here, and use this activity to launch it.
static java.lang.String launchInstanceName
           
static MainActivity.LaunchType launchType
          If you are building a single instance app, then you can set the launchType to have this activity launch the bot, forum, or channel.
static LearningConfig learning
           
static java.lang.String[] learningModes
           
static ForumPostConfig post
           
static java.util.List<ForumPostConfig> posts
           
static java.util.List<AvatarConfig> sharedAvatars
           
static boolean showImages
           
static boolean sound
           
static java.lang.Object[] tags
           
static java.lang.String template
           
static java.lang.Object[] templates
           
static java.lang.String type
           
static java.lang.String[] types
           
static UserConfig user
           
static UserConfig viewUser
           
static VoiceConfig voice
           
static boolean wasDelete
           
 
Fields inherited from class android.app.Activity
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK
 
Fields inherited from class android.content.Context
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
Fields inherited from interface android.content.ComponentCallbacks2
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
 
Constructor Summary
MainActivity()
           
 
Method Summary
 void browse(android.view.View view)
           
static void confirm(java.lang.String message, android.app.Activity activity, android.content.DialogInterface.OnClickListener listener)
           
 void createInstance(android.view.View view)
           
 void createUser()
           
 void editUser()
           
static void error(java.lang.String message, java.lang.Exception exception, android.app.Activity activity)
           
static java.lang.Object[] getAllTemplates(android.app.Activity activity)
           
static java.lang.String getFileNameFromPath(java.lang.String path)
           
static java.lang.String getFilePathFromURI(android.content.Context context, android.net.Uri uri)
           
static java.lang.String getFileTypeFromPath(java.lang.String path)
           
 void launch(android.view.View view)
          Start a chat session with the hard coded instance.
 void login()
           
 void login(android.view.View view)
           
 void logout()
           
 void logout(android.view.View view)
           
 void menu(android.view.View view)
           
 void onCreate(android.os.Bundle savedInstanceState)
           
 boolean onCreateOptionsMenu(android.view.Menu menu)
           
 boolean onOptionsItemSelected(android.view.MenuItem item)
           
 boolean onPrepareOptionsMenu(android.view.Menu menu)
           
 void onResume()
           
static void prompt(java.lang.String message, android.app.Activity activity, android.widget.EditText text, android.content.DialogInterface.OnClickListener listener)
           
 void resetMenu()
           
 void resetView()
           
static void showMessage(java.lang.String message, android.app.Activity activity)
           
 void viewUser()
           
 void viewUser(android.view.View view)
           
 
Methods inherited from class android.app.Activity
addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMediaController, getMenuInflater, getParent, getParentActivityIntent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isTaskRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onAttachedToWindow, onAttachFragment, onBackPressed, onConfigurationChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateDescription, onCreateNavigateUpTaskStack, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onNavigateUp, onNavigateUpFromChild, onOptionsMenuClosed, onPanelClosed, onPostCreate, onPrepareNavigateUpTaskStack, onPreparePanel, onProvideAssistData, onRestoreInstanceState, onRetainNonConfigurationInstance, onSaveInstanceState, onSearchRequested, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overridePendingTransition, postponeEnterTransition, recreate, registerForContextMenu, releaseInstance, removeDialog, reportFullyDrawn, requestVisibleBehind, requestWindowFeature, runOnUiThread, setActionBar, setContentTransitionManager, setContentView, setContentView, setContentView, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setIntent, setMediaController, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTaskDescription, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, shouldUpRecreateTask, showDialog, showDialog, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityForResult, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startLockTask, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu
 
Methods inherited from class android.view.ContextThemeWrapper
applyOverrideConfiguration, getResources, getTheme, setTheme
 
Methods inherited from class android.content.ContextWrapper
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startInstrumentation, startService, stopService, unbindService, unregisterReceiver
 
Methods inherited from class android.content.Context
getDrawable, getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

ADULT

public static final boolean ADULT
See Also:
Constant Field Values

applicationId

public static java.lang.String applicationId
Enter your application ID here. You can get an application ID from any of the services websites (BOT libre, FORUMS libre, LIVE CHAT libre, Paphus Live Chat)


connection

public static SDKConnection connection
Configure your connection credentials here. Choose which service provider you wish to connect to.


domainId

public static java.lang.String domainId
To launch into a specific domain, enter the domain id here.


domain

public static DomainConfig domain

defaultType

public static java.lang.String defaultType

launchInstanceId

public static java.lang.String launchInstanceId
If you are building a single instance app, then you can set the instance id or name here, and use this activity to launch it.


launchInstanceName

public static java.lang.String launchInstanceName

launchType

public static MainActivity.LaunchType launchType
If you are building a single instance app, then you can set the launchType to have this activity launch the bot, forum, or channel.


sound

public static boolean sound

disableVideo

public static boolean disableVideo

deviceVoice

public static boolean deviceVoice

instance

public static WebMediumConfig instance

post

public static ForumPostConfig post

user

public static UserConfig user

viewUser

public static UserConfig viewUser

type

public static java.lang.String type

botMode

public static BotModeConfig botMode

voice

public static VoiceConfig voice

learning

public static LearningConfig learning

conversation

public static java.lang.String conversation

template

public static java.lang.String template

templates

public static java.lang.Object[] templates

tags

public static java.lang.Object[] tags

categories

public static java.lang.Object[] categories

forumTags

public static java.lang.Object[] forumTags

forumPostTags

public static java.lang.Object[] forumPostTags

forumCategories

public static java.lang.Object[] forumCategories

channelTags

public static java.lang.Object[] channelTags

channelCategories

public static java.lang.Object[] channelCategories

showImages

public static boolean showImages

instances

public static java.util.List<WebMediumConfig> instances

posts

public static java.util.List<ForumPostConfig> posts

avatars

public static java.util.List<AvatarConfig> avatars

sharedAvatars

public static java.util.List<AvatarConfig> sharedAvatars

current

public static MainActivity current

wasDelete

public static boolean wasDelete

types

public static java.lang.String[] types

channelTypes

public static java.lang.String[] channelTypes

accessModes

public static java.lang.String[] accessModes

learningModes

public static java.lang.String[] learningModes

correctionModes

public static java.lang.String[] correctionModes

botModes

public static java.lang.String[] botModes
Constructor Detail

MainActivity

public MainActivity()
Method Detail

getFilePathFromURI

public static java.lang.String getFilePathFromURI(android.content.Context context,
                                                  android.net.Uri uri)

getFileNameFromPath

public static java.lang.String getFileNameFromPath(java.lang.String path)

getFileTypeFromPath

public static java.lang.String getFileTypeFromPath(java.lang.String path)

error

public static void error(java.lang.String message,
                         java.lang.Exception exception,
                         android.app.Activity activity)

showMessage

public static void showMessage(java.lang.String message,
                               android.app.Activity activity)

prompt

public static void prompt(java.lang.String message,
                          android.app.Activity activity,
                          android.widget.EditText text,
                          android.content.DialogInterface.OnClickListener listener)

confirm

public static void confirm(java.lang.String message,
                           android.app.Activity activity,
                           android.content.DialogInterface.OnClickListener listener)

getAllTemplates

public static java.lang.Object[] getAllTemplates(android.app.Activity activity)

onCreate

public void onCreate(android.os.Bundle savedInstanceState)
Overrides:
onCreate in class android.app.Activity

resetView

public void resetView()

onResume

public void onResume()
Overrides:
onResume in class android.app.Activity

onCreateOptionsMenu

public boolean onCreateOptionsMenu(android.view.Menu menu)
Overrides:
onCreateOptionsMenu in class android.app.Activity

onPrepareOptionsMenu

public boolean onPrepareOptionsMenu(android.view.Menu menu)
Overrides:
onPrepareOptionsMenu in class android.app.Activity

resetMenu

public void resetMenu()

onOptionsItemSelected

public boolean onOptionsItemSelected(android.view.MenuItem item)
Overrides:
onOptionsItemSelected in class android.app.Activity

login

public void login(android.view.View view)

logout

public void logout(android.view.View view)

login

public void login()

logout

public void logout()

menu

public void menu(android.view.View view)

createUser

public void createUser()

editUser

public void editUser()

viewUser

public void viewUser(android.view.View view)

viewUser

public void viewUser()

createInstance

public void createInstance(android.view.View view)

browse

public void browse(android.view.View view)

launch

public void launch(android.view.View view)
Start a chat session with the hard coded instance.