Merge "Annotate Window.Callback menu methods with nullability"
This commit is contained in:
@@ -3523,7 +3523,7 @@ public class Activity extends ContextThemeWrapper
|
||||
* {@link android.view.Window#FEATURE_OPTIONS_PANEL} panel,
|
||||
* so that subclasses of Activity don't need to deal with feature codes.
|
||||
*/
|
||||
public boolean onCreatePanelMenu(int featureId, Menu menu) {
|
||||
public boolean onCreatePanelMenu(int featureId, @NonNull Menu menu) {
|
||||
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
|
||||
boolean show = onCreateOptionsMenu(menu);
|
||||
show |= mFragments.dispatchCreateOptionsMenu(menu, getMenuInflater());
|
||||
@@ -3541,8 +3541,8 @@ public class Activity extends ContextThemeWrapper
|
||||
* panel, so that subclasses of
|
||||
* Activity don't need to deal with feature codes.
|
||||
*/
|
||||
public boolean onPreparePanel(int featureId, View view, Menu menu) {
|
||||
if (featureId == Window.FEATURE_OPTIONS_PANEL && menu != null) {
|
||||
public boolean onPreparePanel(int featureId, @Nullable View view, @NonNull Menu menu) {
|
||||
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
|
||||
boolean goforit = onPrepareOptionsMenu(menu);
|
||||
goforit |= mFragments.dispatchPrepareOptionsMenu(menu);
|
||||
return goforit;
|
||||
@@ -3555,7 +3555,8 @@ public class Activity extends ContextThemeWrapper
|
||||
*
|
||||
* @return The default implementation returns true.
|
||||
*/
|
||||
public boolean onMenuOpened(int featureId, Menu menu) {
|
||||
@Override
|
||||
public boolean onMenuOpened(int featureId, @NonNull Menu menu) {
|
||||
if (featureId == Window.FEATURE_ACTION_BAR) {
|
||||
initWindowDecorActionBar();
|
||||
if (mActionBar != null) {
|
||||
@@ -3576,7 +3577,7 @@ public class Activity extends ContextThemeWrapper
|
||||
* panel, so that subclasses of
|
||||
* Activity don't need to deal with feature codes.
|
||||
*/
|
||||
public boolean onMenuItemSelected(int featureId, MenuItem item) {
|
||||
public boolean onMenuItemSelected(int featureId, @NonNull MenuItem item) {
|
||||
CharSequence titleCondensed = item.getTitleCondensed();
|
||||
|
||||
switch (featureId) {
|
||||
@@ -3626,7 +3627,7 @@ public class Activity extends ContextThemeWrapper
|
||||
* For context menus ({@link Window#FEATURE_CONTEXT_MENU}), the
|
||||
* {@link #onContextMenuClosed(Menu)} will be called.
|
||||
*/
|
||||
public void onPanelClosed(int featureId, Menu menu) {
|
||||
public void onPanelClosed(int featureId, @NonNull Menu menu) {
|
||||
switch (featureId) {
|
||||
case Window.FEATURE_OPTIONS_PANEL:
|
||||
mFragments.dispatchOptionsMenuClosed(menu);
|
||||
@@ -3734,7 +3735,7 @@ public class Activity extends ContextThemeWrapper
|
||||
*
|
||||
* @see #onCreateOptionsMenu
|
||||
*/
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (mParent != null) {
|
||||
return mParent.onOptionsItemSelected(item);
|
||||
}
|
||||
@@ -3958,7 +3959,7 @@ public class Activity extends ContextThemeWrapper
|
||||
* @return boolean Return false to allow normal context menu processing to
|
||||
* proceed, true to consume it here.
|
||||
*/
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
public boolean onContextItemSelected(@NonNull MenuItem item) {
|
||||
if (mParent != null) {
|
||||
return mParent.onContextItemSelected(item);
|
||||
}
|
||||
@@ -3972,7 +3973,7 @@ public class Activity extends ContextThemeWrapper
|
||||
*
|
||||
* @param menu The context menu that is being closed.
|
||||
*/
|
||||
public void onContextMenuClosed(Menu menu) {
|
||||
public void onContextMenuClosed(@NonNull Menu menu) {
|
||||
if (mParent != null) {
|
||||
mParent.onContextMenuClosed(menu);
|
||||
}
|
||||
@@ -7210,7 +7211,7 @@ public class Activity extends ContextThemeWrapper
|
||||
mActivityTransitionState.setEnterActivityOptions(this, getActivityOptions());
|
||||
}
|
||||
|
||||
final void performNewIntent(Intent intent) {
|
||||
final void performNewIntent(@NonNull Intent intent) {
|
||||
mCanEnterPictureInPicture = true;
|
||||
onNewIntent(intent);
|
||||
}
|
||||
|
||||
@@ -937,8 +937,8 @@ public class Dialog implements DialogInterface, Window.Callback,
|
||||
* @see Activity#onPreparePanel(int, View, Menu)
|
||||
*/
|
||||
@Override
|
||||
public boolean onPreparePanel(int featureId, View view, Menu menu) {
|
||||
if (featureId == Window.FEATURE_OPTIONS_PANEL && menu != null) {
|
||||
public boolean onPreparePanel(int featureId, @Nullable View view, @NonNull Menu menu) {
|
||||
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
|
||||
return onPrepareOptionsMenu(menu) && menu.hasVisibleItems();
|
||||
}
|
||||
return true;
|
||||
@@ -948,7 +948,7 @@ public class Dialog implements DialogInterface, Window.Callback,
|
||||
* @see Activity#onMenuOpened(int, Menu)
|
||||
*/
|
||||
@Override
|
||||
public boolean onMenuOpened(int featureId, Menu menu) {
|
||||
public boolean onMenuOpened(int featureId, @NonNull Menu menu) {
|
||||
if (featureId == Window.FEATURE_ACTION_BAR) {
|
||||
mActionBar.dispatchMenuVisibilityChanged(true);
|
||||
}
|
||||
@@ -959,7 +959,7 @@ public class Dialog implements DialogInterface, Window.Callback,
|
||||
* @see Activity#onMenuItemSelected(int, MenuItem)
|
||||
*/
|
||||
@Override
|
||||
public boolean onMenuItemSelected(int featureId, MenuItem item) {
|
||||
public boolean onMenuItemSelected(int featureId, @NonNull MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -967,7 +967,7 @@ public class Dialog implements DialogInterface, Window.Callback,
|
||||
* @see Activity#onPanelClosed(int, Menu)
|
||||
*/
|
||||
@Override
|
||||
public void onPanelClosed(int featureId, Menu menu) {
|
||||
public void onPanelClosed(int featureId, @NonNull Menu menu) {
|
||||
if (featureId == Window.FEATURE_ACTION_BAR) {
|
||||
mActionBar.dispatchMenuVisibilityChanged(false);
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ public abstract class Window {
|
||||
* @return boolean You must return true for the panel to be displayed;
|
||||
* if you return false it will not be shown.
|
||||
*/
|
||||
public boolean onCreatePanelMenu(int featureId, Menu menu);
|
||||
boolean onCreatePanelMenu(int featureId, @NonNull Menu menu);
|
||||
|
||||
/**
|
||||
* Prepare a panel to be displayed. This is called right before the
|
||||
@@ -438,7 +438,7 @@ public abstract class Window {
|
||||
*
|
||||
* @see #onCreatePanelView
|
||||
*/
|
||||
public boolean onPreparePanel(int featureId, View view, Menu menu);
|
||||
boolean onPreparePanel(int featureId, @Nullable View view, @NonNull Menu menu);
|
||||
|
||||
/**
|
||||
* Called when a panel's menu is opened by the user. This may also be
|
||||
@@ -450,7 +450,7 @@ public abstract class Window {
|
||||
* @return Return true to allow the menu to open, or false to prevent
|
||||
* the menu from opening.
|
||||
*/
|
||||
public boolean onMenuOpened(int featureId, Menu menu);
|
||||
boolean onMenuOpened(int featureId, @NonNull Menu menu);
|
||||
|
||||
/**
|
||||
* Called when a panel's menu item has been selected by the user.
|
||||
@@ -462,7 +462,7 @@ public abstract class Window {
|
||||
* false to perform the normal menu handling (calling its
|
||||
* Runnable or sending a Message to its target Handler).
|
||||
*/
|
||||
public boolean onMenuItemSelected(int featureId, MenuItem item);
|
||||
boolean onMenuItemSelected(int featureId, @NonNull MenuItem item);
|
||||
|
||||
/**
|
||||
* This is called whenever the current window attributes change.
|
||||
@@ -512,7 +512,7 @@ public abstract class Window {
|
||||
* @param menu If onCreatePanelView() returned null, this is the Menu
|
||||
* being displayed in the panel.
|
||||
*/
|
||||
public void onPanelClosed(int featureId, Menu menu);
|
||||
void onPanelClosed(int featureId, @NonNull Menu menu);
|
||||
|
||||
/**
|
||||
* Called when the user signals the desire to start a search.
|
||||
|
||||
Reference in New Issue
Block a user