public class RTTCallActivity extends android.support.v7.app.AppCompatActivity implements TextListener, SessionListener, FailDialog.FailDialogListener, AbstractDialog.DialogListener, CallEndDialog.SaveDialogListener
The screen for a call in progress.
There are two call modes, selectable from Settings: real-time and en-bloc modes. In real-time mode, chars are sent as they are entered. There is no notion of messages and no need for a "Send" button. In en-bloc mode, chars are only sent in bunches when Send is pressed. The Send button is only visible in en-bloc mode, and touching it calls sendText(), which is not used otherwise. In both modes, outgoing text sending is handled by a helper, TextEntryMonitor. That class watches the EditText in this activity for changes, and determines which characters to send via the SipClient.
This screen contains three TextViews, one of which is an EditText where the user enters their own text. The largest TextView contains the incoming text, which is added in addText(), called from RTTextReceived(). Adding text to the display fields is kind of a hassle due to the need to run it on the UI thread. Android is rude enough to make us worry about this.
A third, smaller TextView (R.id.control_messages) shows the call progress (Dialing, ringing, connected, etc). There is probably a slicker way to display that information, like some icon that changes state, or even a label whose entire text changes, rather than adding new lines to this TextView.
Incoming text must be scrubbed of 0xFFEF Unicode chars to maintain an accurate view of how many characters are in the incoming text field. When editing CharSequences, for example when getting a subsequence that chops off the end, invisible 0xFFEF characters may remain, which count as characters but to a human are not really characters. We need to remove these if they ever occur, since their presence in the received text will be due to changes made here, and they will not likely be sent in the actual incoming text. If they are, I suppose there could be a bug here, but it probably won't have any effect. We don't want them in the other party's displayed text field because when a backspace char comes in, we need to delete one char, and it should be a real visible one, not a fake invisible one.
Text of the call may be saved at any time via the "Save Text" button, or at the end of the call from an option in the dialog that pops up.
The activity is discarded when a dialog callback indicates to the activity that the end-call dialog has been dismissed. Various kinds of dialogs may be displayed depending on what caused them (error, hanging up, etc), but all of them call a method of the activity to let it know that the dialog is done and the activity may be destroyed.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TAG |
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK
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, CARRIER_CONFIG_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, FINGERPRINT_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, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
Constructor and Description |
---|
RTTCallActivity() |
Modifier and Type | Method and Description |
---|---|
void |
controlMessageReceived(java.lang.String message)
TextListener interface callback
|
void |
dialogDismissed()
DialogListener callback.
|
void |
dialogFail()
FailDialogListener callback.
|
void |
dialogSaveText()
SaveDialogListener callback, which is called when the end-of-call dialog Save Text option is
chosen.
|
void |
hangUp(android.view.View view)
Called by pressing the red Hang Up button
|
protected void |
onCreate(android.os.Bundle savedInstanceState) |
protected void |
onDestroy() |
protected void |
onSaveInstanceState(android.os.Bundle outState) |
protected void |
onStart() |
protected void |
onStop() |
void |
RTTextReceived(java.lang.String text)
TextListener interface callback
|
void |
saveText(android.view.View view)
Called by the Save Text button, or at the end of a call.
|
void |
sendText(android.view.View view)
Only used in the case where the user has chosen to send text en bloc rather than
character-by-character (for example, if they don't trust AutoCorrect).
|
void |
SessionClosed()
SessionListener interface callback
|
void |
SessionDisconnected(java.lang.String reason)
SessionListener interface callback
|
void |
SessionEstablished(java.lang.String userName)
SessionListener interface callback
|
void |
SessionFailed(java.lang.String reason)
SessionListener interface callback
|
addContentView, getDelegate, getDrawerToggleDelegate, getMenuInflater, getSupportActionBar, getSupportParentActivityIntent, invalidateOptionsMenu, onConfigurationChanged, onContentChanged, onCreateSupportNavigateUpTaskStack, onMenuItemSelected, onMenuOpened, onPanelClosed, onPostCreate, onPostResume, onPrepareSupportNavigateUpTaskStack, onSupportActionModeFinished, onSupportActionModeStarted, onSupportContentChanged, onSupportNavigateUp, onTitleChanged, onWindowStartingSupportActionMode, setContentView, setContentView, setContentView, setSupportActionBar, setSupportProgress, setSupportProgressBarIndeterminate, setSupportProgressBarIndeterminateVisibility, setSupportProgressBarVisibility, startSupportActionMode, supportInvalidateOptionsMenu, supportNavigateUpTo, supportRequestWindowFeature, supportShouldUpRecreateTask
dump, getLastCustomNonConfigurationInstance, getSupportFragmentManager, getSupportLoaderManager, getSupportMediaController, onActivityResult, onAttachFragment, onBackPressed, onCreatePanelMenu, onKeyDown, onLowMemory, onNewIntent, onPause, onPrepareOptionsPanel, onPreparePanel, onRequestPermissionsResult, onResume, onResumeFragments, onRetainCustomNonConfigurationInstance, onRetainNonConfigurationInstance, onStateNotSaved, setEnterSharedElementCallback, setExitSharedElementCallback, setSupportMediaController, startActivityForResult, startActivityFromFragment, supportFinishAfterTransition, supportPostponeEnterTransition, supportStartPostponedEnterTransition, validateRequestPermissionsRequestCode
closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMediaController, getParent, getParentActivityIntent, getPreferences, getReferrer, getRequestedOrientation, getSearchEvent, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isTaskRoot, isVoiceInteraction, isVoiceInteractionRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onChildTitleChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelView, onCreateThumbnail, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onNavigateUp, onNavigateUpFromChild, onOptionsItemSelected, onOptionsMenuClosed, onPostCreate, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onProvideAssistContent, onProvideAssistData, onProvideReferrer, onRestart, onRestoreInstanceState, onRestoreInstanceState, onSaveInstanceState, onSearchRequested, onSearchRequested, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overridePendingTransition, postponeEnterTransition, recreate, registerForContextMenu, releaseInstance, removeDialog, reportFullyDrawn, requestPermissions, requestVisibleBehind, requestWindowFeature, runOnUiThread, setActionBar, setContentTransitionManager, 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, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startLockTask, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu
applyOverrideConfiguration, attachBaseContext, getResources, getTheme, setTheme
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, 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, getSystemServiceName, 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
public static final java.lang.String TAG
protected void onCreate(android.os.Bundle savedInstanceState)
onCreate
in class android.support.v7.app.AppCompatActivity
protected void onStart()
onStart
in class android.support.v4.app.FragmentActivity
protected void onStop()
onStop
in class android.support.v7.app.AppCompatActivity
protected void onDestroy()
onDestroy
in class android.support.v7.app.AppCompatActivity
protected void onSaveInstanceState(android.os.Bundle outState)
onSaveInstanceState
in class android.support.v4.app.FragmentActivity
public void controlMessageReceived(java.lang.String message)
controlMessageReceived
in interface TextListener
public void RTTextReceived(java.lang.String text)
RTTextReceived
in interface TextListener
text
- the incoming characterspublic void SessionEstablished(java.lang.String userName)
SessionEstablished
in interface SessionListener
userName
- the SIP URI of the other partypublic void hangUp(android.view.View view)
view
- the buttonpublic void SessionClosed()
SessionClosed
in interface SessionListener
public void SessionFailed(java.lang.String reason)
SessionFailed
in interface SessionListener
public void SessionDisconnected(java.lang.String reason)
SessionDisconnected
in interface SessionListener
public void sendText(android.view.View view)
view
- Send buttonpublic void saveText(android.view.View view)
view
- the Save Text button (or null, it's not used)public void dialogFail()
dialogFail
in interface FailDialog.FailDialogListener
public void dialogDismissed()
dialogDismissed
in interface AbstractDialog.DialogListener
public void dialogSaveText()
dialogSaveText
in interface CallEndDialog.SaveDialogListener