public class MenuActivity extends JotyActivity
addMenuItemToAppMenu
method (with various overloads) and the addItemAsSubMenu
method are
able to contribute to the building of the menu as they are used in the overriding of the onCreateOptionsMenu
Android method.
These methods feed a map (m_stockedMenuItems
) that binds each id with the respective action
and is used later by the overriding of the onOptionsItemSelected
Android method.
To help avoiding Id collisions when menu items are added basing of dynamic data these builder methods
take care to update the JotyApp.m_maxUsedMenuItemID that must be taken in consideration by the dynamic
building and is reset in the creation of the main activity of the app (a descendant of IdelActivity
Pre-built menu items typical of the user interface of the JotyApp are also provided through dedicated methods that map that action with an handler method to be implemented.
Beyond being a provider of builder methods this class takes care of inizializing the "back" botton in the action bar and to add the "(Joty) Home" menu item.
Another function of the class is to provide the identification of the Joty permission
( see Permission
for accessing the activity basing on the information stored in the
m_rolesPerm
member, where the joty permission for each user role is gettable (the default is "no access").
Further helps are opening an image from a binary field and assisting the Accessor mode management with a BasicPostStatement creator based on the accessor coordinates submitted.
The override of finish
introduces tha availability of an overridable beforeFinish
method
that assures the execution before the invocation of the ancestor method and comes with a parameter that
informs about the re-opening of the same class.
Modifier and Type | Class and Description |
---|---|
protected static interface |
MenuActivity.Action |
protected static class |
MenuActivity.Permission |
JotyActivity.AccessorCoordinates, JotyActivity.WaitCursor
Modifier and Type | Field and Description |
---|---|
JotyActivity.AccessorCoordinates |
m_accessorCoordinates |
boolean |
m_accessorMode |
protected MenuActivity |
m_contextActivity |
protected DataMainActivity |
m_mainActivity |
protected org.joty.common.ParamContext |
m_paramContext |
MenuActivity.Permission |
m_permission |
protected java.util.HashMap<java.lang.Integer,MenuActivity.Action> |
m_stockedMenuItems |
m_app, m_common, m_extras, m_termMap, m_terms, m_waitCursor
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_EXTERNAL_SERVICE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, COMPANION_DEVICE_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, HARDWARE_PROPERTIES_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_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RECEIVER_VISIBLE_TO_INSTANT_APPS, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STORAGE_SERVICE, STORAGE_STATS_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_CLASSIFICATION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_AWARE_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
Constructor and Description |
---|
MenuActivity() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
accessIsAllowed() |
protected boolean |
accessorMode() |
protected void |
addHome(android.view.Menu menu) |
android.view.SubMenu |
addItemAsSubMenu(android.view.Menu menu,
JotyApp.JotyMenus id,
java.lang.CharSequence caption,
int resId) |
protected void |
addMenuItemsToAppMenu(android.view.Menu menu) |
android.view.MenuItem |
addMenuItemToAppMenu(android.view.Menu menu,
int id,
java.lang.CharSequence caption,
int resId,
boolean menuIsSubMenu) |
android.view.MenuItem |
addMenuItemToAppMenu(android.view.Menu menu,
int id,
java.lang.CharSequence caption,
int resId,
boolean isSubMenu,
MenuActivity.Action action) |
android.view.MenuItem |
addMenuItemToAppMenu(android.view.Menu menu,
JotyApp.JotyMenus id,
java.lang.CharSequence caption,
int resId,
boolean isSubMenu) |
android.view.MenuItem |
addMenuItemToAppMenu(android.view.Menu menu,
JotyApp.JotyMenus id,
java.lang.CharSequence caption,
int resId,
boolean isSubMenu,
MenuActivity.Action action) |
protected void |
addNewRecordMenu(android.view.Menu menu) |
protected void |
beforeFinish(boolean forRenewing) |
org.joty.common.BasicPostStatement |
createContextPostStatement(JotyActivity.AccessorCoordinates accessorCoordinatesParam) |
org.joty.common.ParamContext |
createParamContext() |
org.joty.common.ParamContext |
createParamContext(ActivityController source) |
protected void |
doBackAction() |
protected void |
enableRole(java.lang.String roleName,
MenuActivity.Permission permission) |
void |
finish() |
void |
finish(boolean forRenewing) |
boolean |
getMaxPermission() |
protected boolean |
hasPermission(MenuActivity.Permission permission) |
DataMainActivity |
mainActivity() |
protected boolean |
navigationNeeded() |
protected void |
newRecord() |
protected void |
onCreate(android.os.Bundle savedInstanceState) |
boolean |
onCreateOptionsMenu(android.view.Menu menu) |
boolean |
onOptionsItemSelected(android.view.MenuItem item) |
protected void |
openImage(java.lang.String tableName,
java.lang.String targetField,
java.lang.String whereClause,
JotyActivity.AccessorCoordinates accessorCoordinates)
Gets the bytes from the database through the server and save them as temporary file.
|
void |
putFieldAsExtra(JotyResourceCursorAdapter adapter,
android.os.Bundle m_extras,
java.lang.String fieldName) |
protected void |
setBack() |
protected void |
setContextActivity(MenuActivity activity) |
protected void |
setContextParams() |
protected void |
setHint(int textViewResId,
java.lang.String text) |
android.view.MenuItem |
setItem(android.view.MenuItem item) |
protected void |
setLangHint(int textViewResId,
java.lang.String text) |
protected void |
setLangText(int textViewResId,
java.lang.String text) |
protected void |
setText(int textViewResId,
java.lang.String text) |
addExtrasInOpenActivity, getRespManager, getRespManagerKey, guiDataExchange, guiDataExchange, home, isPortrait, jotyLang, lockRotation, onBackPressed, onPostCreate, onResume, onSaveInstanceState, onWidgetClick, onWidgetItemSelected, postInit, resetDirtyStatus, setContentView, setWaitCursor, startActivity, startActivity, startActivity, term
addContentView, dispatchKeyEvent, findViewById, getDelegate, getDrawerToggleDelegate, getMenuInflater, getResources, getSupportActionBar, getSupportParentActivityIntent, invalidateOptionsMenu, onConfigurationChanged, onContentChanged, onCreateSupportNavigateUpTaskStack, onDestroy, onMenuItemSelected, onMenuOpened, onPanelClosed, onPostResume, onPrepareSupportNavigateUpTaskStack, onStart, onStop, onSupportActionModeFinished, onSupportActionModeStarted, onSupportContentChanged, onSupportNavigateUp, onTitleChanged, onWindowStartingSupportActionMode, setContentView, setContentView, setSupportActionBar, setSupportProgress, setSupportProgressBarIndeterminate, setSupportProgressBarIndeterminateVisibility, setSupportProgressBarVisibility, setTheme, startSupportActionMode, supportInvalidateOptionsMenu, supportNavigateUpTo, supportRequestWindowFeature, supportShouldUpRecreateTask
dump, getLastCustomNonConfigurationInstance, getSupportFragmentManager, getSupportLoaderManager, onActivityResult, onAttachFragment, onCreatePanelMenu, onLowMemory, onMultiWindowModeChanged, onNewIntent, onPause, onPictureInPictureModeChanged, onPrepareOptionsPanel, onPreparePanel, onRequestPermissionsResult, onResumeFragments, onRetainCustomNonConfigurationInstance, onRetainNonConfigurationInstance, onStateNotSaved, setEnterSharedElementCallback, setExitSharedElementCallback, startActivityForResult, startActivityFromFragment, startActivityFromFragment, startIntentSenderFromFragment, supportFinishAfterTransition, supportPostponeEnterTransition, supportStartPostponedEnterTransition, validateRequestPermissionsRequestCode
closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dismissKeyboardShortcutsHelper, dispatchGenericMotionEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, enterPictureInPictureMode, enterPictureInPictureMode, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMaxNumPictureInPictureActions, getMediaController, getParent, getParentActivityIntent, getPreferences, getReferrer, getRequestedOrientation, getSearchEvent, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, isActivityTransitionRunning, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isInMultiWindowMode, isInPictureInPictureMode, isLocalVoiceInteractionSupported, isTaskRoot, isVoiceInteraction, isVoiceInteractionRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onChildTitleChanged, onContextItemSelected, onContextMenuClosed, onCreate, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreatePanelView, onCreateThumbnail, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLocalVoiceInteractionStarted, onLocalVoiceInteractionStopped, onMultiWindowModeChanged, onNavigateUp, onNavigateUpFromChild, onOptionsMenuClosed, onPictureInPictureModeChanged, onPostCreate, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onProvideAssistContent, onProvideAssistData, onProvideKeyboardShortcuts, 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, requestDragAndDropPermissions, requestPermissions, requestShowKeyboardShortcuts, requestVisibleBehind, requestWindowFeature, runOnUiThread, setActionBar, setContentTransitionManager, setDefaultKeyMode, setEnterSharedElementCallback, setExitSharedElementCallback, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setIntent, setMediaController, setPictureInPictureParams, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTaskDescription, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, setVrModeEnabled, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderFromChild, startIntentSenderFromChild, startLocalVoiceInteraction, startLockTask, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLocalVoiceInteraction, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu
applyOverrideConfiguration, attachBaseContext, getAssets, getTheme
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getSystemServiceName, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startForegroundService, startInstrumentation, startService, stopService, unbindService, unregisterReceiver
getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
protected java.util.HashMap<java.lang.Integer,MenuActivity.Action> m_stockedMenuItems
public MenuActivity.Permission m_permission
public JotyActivity.AccessorCoordinates m_accessorCoordinates
public boolean m_accessorMode
protected org.joty.common.ParamContext m_paramContext
protected MenuActivity m_contextActivity
protected DataMainActivity m_mainActivity
protected void setContextActivity(MenuActivity activity)
protected void onCreate(@Nullable android.os.Bundle savedInstanceState)
onCreate
in class JotyActivity
protected boolean accessIsAllowed()
protected boolean hasPermission(MenuActivity.Permission permission)
public android.view.MenuItem addMenuItemToAppMenu(android.view.Menu menu, int id, java.lang.CharSequence caption, int resId, boolean menuIsSubMenu)
public android.view.MenuItem setItem(android.view.MenuItem item)
public android.view.SubMenu addItemAsSubMenu(android.view.Menu menu, JotyApp.JotyMenus id, java.lang.CharSequence caption, int resId)
public android.view.MenuItem addMenuItemToAppMenu(android.view.Menu menu, JotyApp.JotyMenus id, java.lang.CharSequence caption, int resId, boolean isSubMenu)
public android.view.MenuItem addMenuItemToAppMenu(android.view.Menu menu, JotyApp.JotyMenus id, java.lang.CharSequence caption, int resId, boolean isSubMenu, MenuActivity.Action action)
public android.view.MenuItem addMenuItemToAppMenu(android.view.Menu menu, int id, java.lang.CharSequence caption, int resId, boolean isSubMenu, MenuActivity.Action action)
protected void addMenuItemsToAppMenu(android.view.Menu menu)
protected void addHome(android.view.Menu menu)
public boolean onCreateOptionsMenu(android.view.Menu menu)
onCreateOptionsMenu
in class android.app.Activity
protected boolean navigationNeeded()
protected void setBack()
protected void addNewRecordMenu(android.view.Menu menu)
protected void newRecord()
public boolean onOptionsItemSelected(android.view.MenuItem item)
onOptionsItemSelected
in class android.app.Activity
protected void doBackAction()
protected void enableRole(java.lang.String roleName, MenuActivity.Permission permission)
public boolean getMaxPermission()
public org.joty.common.ParamContext createParamContext()
public org.joty.common.ParamContext createParamContext(ActivityController source)
protected void setContextParams()
protected boolean accessorMode()
public org.joty.common.BasicPostStatement createContextPostStatement(JotyActivity.AccessorCoordinates accessorCoordinatesParam)
protected void setLangText(int textViewResId, java.lang.String text)
protected void setText(int textViewResId, java.lang.String text)
protected void setLangHint(int textViewResId, java.lang.String text)
protected void setHint(int textViewResId, java.lang.String text)
public void putFieldAsExtra(JotyResourceCursorAdapter adapter, android.os.Bundle m_extras, java.lang.String fieldName)
public DataMainActivity mainActivity()
public void finish()
finish
in class JotyActivity
public void finish(boolean forRenewing)
protected void beforeFinish(boolean forRenewing)
protected void openImage(java.lang.String tableName, java.lang.String targetField, java.lang.String whereClause, JotyActivity.AccessorCoordinates accessorCoordinates)
getBytesFromDb
and openDocumentFromBytes
on the handler thread.tableName
- In accessor mode must be nulltargetField
- whereClause
- accessorCoordinates
- In accessor mode must specified. in Normal mode is ignored.