Loading api/current.xml +214 −214 Original line number Diff line number Diff line Loading @@ -19481,17 +19481,6 @@ <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> </method> <method name="finishContextMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getCustomNavigationView" return="android.view.View" abstract="true" Loading Loading @@ -19783,19 +19772,6 @@ <parameter name="title" type="java.lang.CharSequence"> </parameter> </method> <method name="startContextMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="callback" type="android.app.ActionBar.ContextModeCallback"> </parameter> </method> <field name="DISPLAY_HIDE_HOME" type="int" transient="false" Loading Loading @@ -19863,194 +19839,6 @@ > </field> </class> <class name="ActionBar.ContextMode" extends="java.lang.Object" abstract="true" static="true" final="false" deprecated="not deprecated" visibility="public" > <constructor name="ActionBar.ContextMode" type="android.app.ActionBar.ContextMode" static="false" final="false" deprecated="not deprecated" visibility="public" > </constructor> <method name="finish" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getCustomView" return="android.view.View" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getMenu" return="android.view.Menu" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getSubtitle" return="java.lang.CharSequence" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getTitle" return="java.lang.CharSequence" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="invalidate" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="setCustomView" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="view" type="android.view.View"> </parameter> </method> <method name="setSubtitle" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="subtitle" type="java.lang.CharSequence"> </parameter> </method> <method name="setTitle" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="title" type="java.lang.CharSequence"> </parameter> </method> </class> <interface name="ActionBar.ContextModeCallback" abstract="true" static="true" final="false" deprecated="not deprecated" visibility="public" > <method name="onContextItemClicked" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ActionBar.ContextMode"> </parameter> <parameter name="item" type="android.view.MenuItem"> </parameter> </method> <method name="onCreateContextMode" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ActionBar.ContextMode"> </parameter> <parameter name="menu" type="android.view.Menu"> </parameter> </method> <method name="onDestroyContextMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ActionBar.ContextMode"> </parameter> </method> <method name="onPrepareContextMode" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ActionBar.ContextMode"> </parameter> <parameter name="menu" type="android.view.Menu"> </parameter> </method> </interface> <interface name="ActionBar.NavigationCallback" abstract="true" static="true" Loading Loading @@ -24691,6 +24479,194 @@ > </method> </class> <class name="ContextualMode" extends="java.lang.Object" abstract="true" static="false" final="false" deprecated="not deprecated" visibility="public" > <constructor name="ContextualMode" type="android.app.ContextualMode" static="false" final="false" deprecated="not deprecated" visibility="public" > </constructor> <method name="finish" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getCustomView" return="android.view.View" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getMenu" return="android.view.Menu" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getSubtitle" return="java.lang.CharSequence" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getTitle" return="java.lang.CharSequence" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="invalidate" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="setCustomView" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="view" type="android.view.View"> </parameter> </method> <method name="setSubtitle" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="subtitle" type="java.lang.CharSequence"> </parameter> </method> <method name="setTitle" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="title" type="java.lang.CharSequence"> </parameter> </method> </class> <interface name="ContextualMode.Callback" abstract="true" static="true" final="false" deprecated="not deprecated" visibility="public" > <method name="onContextItemClicked" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ContextualMode"> </parameter> <parameter name="item" type="android.view.MenuItem"> </parameter> </method> <method name="onCreateContextMode" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ContextualMode"> </parameter> <parameter name="menu" type="android.view.Menu"> </parameter> </method> <method name="onDestroyContextMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ContextualMode"> </parameter> </method> <method name="onPrepareContextMode" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ContextualMode"> </parameter> <parameter name="menu" type="android.view.Menu"> </parameter> </method> </interface> <class name="DatePickerDialog" extends="android.app.AlertDialog" abstract="false" Loading Loading @@ -40109,6 +40085,17 @@ visibility="public" > </method> <method name="finishContextualMode" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getApplicationContext" return="android.content.Context" abstract="true" Loading Loading @@ -40823,6 +40810,19 @@ <parameter name="intent" type="android.content.Intent"> </parameter> </method> <method name="startContextualMode" return="android.app.ContextualMode" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="callback" type="android.app.ContextualMode.Callback"> </parameter> </method> <method name="startInstrumentation" return="boolean" abstract="true" Loading Loading @@ -82198,7 +82198,7 @@ type="float" transient="false" volatile="false" value="0.001f" value="0.0010f" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -226630,7 +226630,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="arg0" type="T"> <parameter name="t" type="T"> </parameter> </method> </interface> core/java/android/app/ActionBar.java +0 −149 Original line number Diff line number Diff line Loading @@ -17,8 +17,6 @@ package android.app; import android.graphics.drawable.Drawable; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.SpinnerAdapter; Loading Loading @@ -220,20 +218,6 @@ public abstract class ActionBar { */ public abstract int getDisplayOptions(); /** * Start a context mode controlled by <code>callback</code>. * The {@link ContextModeCallback} will receive lifecycle events for the duration * of the context mode. * * @param callback Callback handler that will manage this context mode. */ public abstract void startContextMode(ContextModeCallback callback); /** * Finish the current context mode. */ public abstract void finishContextMode(); /** * Set the action bar into tabbed navigation mode. * Loading Loading @@ -311,139 +295,6 @@ public abstract class ActionBar { */ public abstract void selectTabAt(int position); /** * Represents a contextual mode of the Action Bar. Context modes can be used for * modal interactions with activity content and replace the normal Action Bar until finished. * Examples of good contextual modes include selection modes, search, content editing, etc. */ public static abstract class ContextMode { /** * Set the title of the context mode. This method will have no visible effect if * a custom view has been set. * * @param title Title string to set * * @see #setCustomView(View) */ public abstract void setTitle(CharSequence title); /** * Set the subtitle of the context mode. This method will have no visible effect if * a custom view has been set. * * @param subtitle Subtitle string to set * * @see #setCustomView(View) */ public abstract void setSubtitle(CharSequence subtitle); /** * Set a custom view for this context mode. The custom view will take the place of * the title and subtitle. Useful for things like search boxes. * * @param view Custom view to use in place of the title/subtitle. * * @see #setTitle(CharSequence) * @see #setSubtitle(CharSequence) */ public abstract void setCustomView(View view); /** * Invalidate the context mode and refresh menu content. The context mode's * {@link ContextModeCallback} will have its * {@link ContextModeCallback#onPrepareContextMode(ContextMode, Menu)} method called. * If it returns true the menu will be scanned for updated content and any relevant changes * will be reflected to the user. */ public abstract void invalidate(); /** * Finish and close this context mode. The context mode's {@link ContextModeCallback} will * have its {@link ContextModeCallback#onDestroyContextMode(ContextMode)} method called. */ public abstract void finish(); /** * Returns the menu of actions that this context mode presents. * @return The context mode's menu. */ public abstract Menu getMenu(); /** * Returns the current title of this context mode. * @return Title text */ public abstract CharSequence getTitle(); /** * Returns the current subtitle of this context mode. * @return Subtitle text */ public abstract CharSequence getSubtitle(); /** * Returns the current custom view for this context mode. * @return The current custom view */ public abstract View getCustomView(); } /** * Callback interface for ActionBar context modes. Supplied to * {@link ActionBar#startContextMode(ContextModeCallback)}, a ContextModeCallback * configures and handles events raised by a user's interaction with a context mode. * * <p>A context mode's lifecycle is as follows: * <ul> * <li>{@link ContextModeCallback#onCreateContextMode(ContextMode, Menu)} once on initial * creation</li> * <li>{@link ContextModeCallback#onPrepareContextMode(ContextMode, Menu)} after creation * and any time the {@link ContextMode} is invalidated</li> * <li>{@link ContextModeCallback#onContextItemClicked(ContextMode, MenuItem)} any time a * contextual action button is clicked</li> * <li>{@link ContextModeCallback#onDestroyContextMode(ContextMode)} when the context mode * is closed</li> * </ul> */ public interface ContextModeCallback { /** * Called when a context mode is first created. The menu supplied will be used to generate * action buttons for the context mode. * * @param mode ContextMode being created * @param menu Menu used to populate contextual action buttons * @return true if the context mode should be created, false if entering this context mode * should be aborted. */ public boolean onCreateContextMode(ContextMode mode, Menu menu); /** * Called to refresh a context mode's action menu whenever it is invalidated. * * @param mode ContextMode being prepared * @param menu Menu used to populate contextual action buttons * @return true if the menu or context mode was updated, false otherwise. */ public boolean onPrepareContextMode(ContextMode mode, Menu menu); /** * Called to report a user click on a contextual action button. * * @param mode The current ContextMode * @param item The item that was clicked * @return true if this callback handled the event, false if the standard MenuItem * invocation should continue. */ public boolean onContextItemClicked(ContextMode mode, MenuItem item); /** * Called when a context mode is about to be exited and destroyed. * * @param mode The current ContextMode being destroyed */ public void onDestroyContextMode(ContextMode mode); } /** * Callback interface for ActionBar navigation events. */ Loading core/java/android/app/Activity.java +16 −1 Original line number Diff line number Diff line Loading @@ -662,7 +662,7 @@ public class Activity extends ContextThemeWrapper /*package*/ boolean mWindowAdded = false; /*package*/ boolean mVisibleFromServer = false; /*package*/ boolean mVisibleFromClient = true; /*package*/ ActionBar mActionBar = null; /*package*/ ActionBarImpl mActionBar = null; private CharSequence mTitle; private int mTitleColor = 0; Loading Loading @@ -4253,4 +4253,19 @@ public class Activity extends ContextThemeWrapper } } } @Override public ContextualMode startContextualMode(ContextualMode.Callback callback) { if (mActionBar == null) { return null; } return mActionBar.startContextualMode(callback); } @Override public void finishContextualMode() { if (mActionBar != null) { mActionBar.finishContextualMode(); } } } core/java/android/app/ContextualMode.java 0 → 100644 +155 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app; import android.content.Context; import android.view.Menu; import android.view.MenuItem; import android.view.View; /** * Represents a contextual mode of the user interface. Contextual modes can be used for * modal interactions with content and replace parts of the normal UI until finished. * Examples of good contextual modes include selection modes, search, content editing, etc. */ public abstract class ContextualMode { /** * Set the title of the contextual mode. This method will have no visible effect if * a custom view has been set. * * @param title Title string to set * * @see #setCustomView(View) */ public abstract void setTitle(CharSequence title); /** * Set the subtitle of the contextual mode. This method will have no visible effect if * a custom view has been set. * * @param subtitle Subtitle string to set * * @see #setCustomView(View) */ public abstract void setSubtitle(CharSequence subtitle); /** * Set a custom view for this contextual mode. The custom view will take the place of * the title and subtitle. Useful for things like search boxes. * * @param view Custom view to use in place of the title/subtitle. * * @see #setTitle(CharSequence) * @see #setSubtitle(CharSequence) */ public abstract void setCustomView(View view); /** * Invalidate the contextual mode and refresh menu content. The contextual mode's * {@link ContextualMode.Callback} will have its * {@link Callback#onPrepareContextMode(ContextualMode, Menu)} method called. * If it returns true the menu will be scanned for updated content and any relevant changes * will be reflected to the user. */ public abstract void invalidate(); /** * Finish and close this context mode. The context mode's {@link ContextualMode.Callback} will * have its {@link Callback#onDestroyContextMode(ContextualMode)} method called. */ public abstract void finish(); /** * Returns the menu of actions that this contextual mode presents. * @return The contextual mode's menu. */ public abstract Menu getMenu(); /** * Returns the current title of this contextual mode. * @return Title text */ public abstract CharSequence getTitle(); /** * Returns the current subtitle of this contextual mode. * @return Subtitle text */ public abstract CharSequence getSubtitle(); /** * Returns the current custom view for this contextual mode. * @return The current custom view */ public abstract View getCustomView(); /** * Callback interface for contextual modes. Supplied to * {@link Context#startContextMode(Callback)}, a ContextModeCallback * configures and handles events raised by a user's interaction with a context mode. * * <p>A context mode's lifecycle is as follows: * <ul> * <li>{@link Callback#onCreateContextMode(ActionBar.ContextualMode, Menu)} once on initial * creation</li> * <li>{@link Callback#onPrepareContextMode(ActionBar.ContextualMode, Menu)} after creation * and any time the {@link ContextualMode} is invalidated</li> * <li>{@link Callback#onContextItemClicked(ActionBar.ContextualMode, MenuItem)} any time a * contextual action button is clicked</li> * <li>{@link Callback#onDestroyContextMode(ActionBar.ContextualMode)} when the context mode * is closed</li> * </ul> */ public interface Callback { /** * Called when a context mode is first created. The menu supplied will be used to generate * action buttons for the context mode. * * @param mode ContextMode being created * @param menu Menu used to populate contextual action buttons * @return true if the context mode should be created, false if entering this context mode * should be aborted. */ public boolean onCreateContextMode(ContextualMode mode, Menu menu); /** * Called to refresh a context mode's action menu whenever it is invalidated. * * @param mode ContextMode being prepared * @param menu Menu used to populate contextual action buttons * @return true if the menu or context mode was updated, false otherwise. */ public boolean onPrepareContextMode(ContextualMode mode, Menu menu); /** * Called to report a user click on a contextual action button. * * @param mode The current ContextMode * @param item The item that was clicked * @return true if this callback handled the event, false if the standard MenuItem * invocation should continue. */ public boolean onContextItemClicked(ContextualMode mode, MenuItem item); /** * Called when a context mode is about to be exited and destroyed. * * @param mode The current ContextMode being destroyed */ public void onDestroyContextMode(ContextualMode mode); } } No newline at end of file core/java/android/content/Context.java +23 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.content; import android.app.ContextualMode; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.AssetManager; Loading @@ -26,6 +27,7 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.media.MediaScannerConnection.OnScanCompletedListener; import android.net.Uri; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -1981,4 +1983,25 @@ public abstract class Context { public boolean isRestricted() { return false; } /** * Start a contextual mode controlled by <code>callback</code>. * The {@link ContextualMode.Callback} will receive lifecycle events for the duration * of the contextual mode. There can only be one contextual mode active at a time. * Starting a new contextual mode while one is already active will finish the old * contextual mode. * * @param callback Callback handler that will manage this context mode. * @return The new contextual mode started by this call, or <code>null</code> * if the mode was not started. */ public ContextualMode startContextualMode(ContextualMode.Callback callback) { return null; } /** * Finish the current contextual mode if present. */ public void finishContextualMode() { } } Loading
api/current.xml +214 −214 Original line number Diff line number Diff line Loading @@ -19481,17 +19481,6 @@ <parameter name="tab" type="android.app.ActionBar.Tab"> </parameter> </method> <method name="finishContextMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getCustomNavigationView" return="android.view.View" abstract="true" Loading Loading @@ -19783,19 +19772,6 @@ <parameter name="title" type="java.lang.CharSequence"> </parameter> </method> <method name="startContextMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="callback" type="android.app.ActionBar.ContextModeCallback"> </parameter> </method> <field name="DISPLAY_HIDE_HOME" type="int" transient="false" Loading Loading @@ -19863,194 +19839,6 @@ > </field> </class> <class name="ActionBar.ContextMode" extends="java.lang.Object" abstract="true" static="true" final="false" deprecated="not deprecated" visibility="public" > <constructor name="ActionBar.ContextMode" type="android.app.ActionBar.ContextMode" static="false" final="false" deprecated="not deprecated" visibility="public" > </constructor> <method name="finish" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getCustomView" return="android.view.View" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getMenu" return="android.view.Menu" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getSubtitle" return="java.lang.CharSequence" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getTitle" return="java.lang.CharSequence" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="invalidate" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="setCustomView" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="view" type="android.view.View"> </parameter> </method> <method name="setSubtitle" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="subtitle" type="java.lang.CharSequence"> </parameter> </method> <method name="setTitle" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="title" type="java.lang.CharSequence"> </parameter> </method> </class> <interface name="ActionBar.ContextModeCallback" abstract="true" static="true" final="false" deprecated="not deprecated" visibility="public" > <method name="onContextItemClicked" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ActionBar.ContextMode"> </parameter> <parameter name="item" type="android.view.MenuItem"> </parameter> </method> <method name="onCreateContextMode" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ActionBar.ContextMode"> </parameter> <parameter name="menu" type="android.view.Menu"> </parameter> </method> <method name="onDestroyContextMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ActionBar.ContextMode"> </parameter> </method> <method name="onPrepareContextMode" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ActionBar.ContextMode"> </parameter> <parameter name="menu" type="android.view.Menu"> </parameter> </method> </interface> <interface name="ActionBar.NavigationCallback" abstract="true" static="true" Loading Loading @@ -24691,6 +24479,194 @@ > </method> </class> <class name="ContextualMode" extends="java.lang.Object" abstract="true" static="false" final="false" deprecated="not deprecated" visibility="public" > <constructor name="ContextualMode" type="android.app.ContextualMode" static="false" final="false" deprecated="not deprecated" visibility="public" > </constructor> <method name="finish" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getCustomView" return="android.view.View" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getMenu" return="android.view.Menu" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getSubtitle" return="java.lang.CharSequence" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getTitle" return="java.lang.CharSequence" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="invalidate" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="setCustomView" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="view" type="android.view.View"> </parameter> </method> <method name="setSubtitle" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="subtitle" type="java.lang.CharSequence"> </parameter> </method> <method name="setTitle" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="title" type="java.lang.CharSequence"> </parameter> </method> </class> <interface name="ContextualMode.Callback" abstract="true" static="true" final="false" deprecated="not deprecated" visibility="public" > <method name="onContextItemClicked" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ContextualMode"> </parameter> <parameter name="item" type="android.view.MenuItem"> </parameter> </method> <method name="onCreateContextMode" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ContextualMode"> </parameter> <parameter name="menu" type="android.view.Menu"> </parameter> </method> <method name="onDestroyContextMode" return="void" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ContextualMode"> </parameter> </method> <method name="onPrepareContextMode" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="mode" type="android.app.ContextualMode"> </parameter> <parameter name="menu" type="android.view.Menu"> </parameter> </method> </interface> <class name="DatePickerDialog" extends="android.app.AlertDialog" abstract="false" Loading Loading @@ -40109,6 +40085,17 @@ visibility="public" > </method> <method name="finishContextualMode" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="getApplicationContext" return="android.content.Context" abstract="true" Loading Loading @@ -40823,6 +40810,19 @@ <parameter name="intent" type="android.content.Intent"> </parameter> </method> <method name="startContextualMode" return="android.app.ContextualMode" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="callback" type="android.app.ContextualMode.Callback"> </parameter> </method> <method name="startInstrumentation" return="boolean" abstract="true" Loading Loading @@ -82198,7 +82198,7 @@ type="float" transient="false" volatile="false" value="0.001f" value="0.0010f" static="true" final="true" deprecated="not deprecated" Loading Loading @@ -226630,7 +226630,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="arg0" type="T"> <parameter name="t" type="T"> </parameter> </method> </interface>
core/java/android/app/ActionBar.java +0 −149 Original line number Diff line number Diff line Loading @@ -17,8 +17,6 @@ package android.app; import android.graphics.drawable.Drawable; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.SpinnerAdapter; Loading Loading @@ -220,20 +218,6 @@ public abstract class ActionBar { */ public abstract int getDisplayOptions(); /** * Start a context mode controlled by <code>callback</code>. * The {@link ContextModeCallback} will receive lifecycle events for the duration * of the context mode. * * @param callback Callback handler that will manage this context mode. */ public abstract void startContextMode(ContextModeCallback callback); /** * Finish the current context mode. */ public abstract void finishContextMode(); /** * Set the action bar into tabbed navigation mode. * Loading Loading @@ -311,139 +295,6 @@ public abstract class ActionBar { */ public abstract void selectTabAt(int position); /** * Represents a contextual mode of the Action Bar. Context modes can be used for * modal interactions with activity content and replace the normal Action Bar until finished. * Examples of good contextual modes include selection modes, search, content editing, etc. */ public static abstract class ContextMode { /** * Set the title of the context mode. This method will have no visible effect if * a custom view has been set. * * @param title Title string to set * * @see #setCustomView(View) */ public abstract void setTitle(CharSequence title); /** * Set the subtitle of the context mode. This method will have no visible effect if * a custom view has been set. * * @param subtitle Subtitle string to set * * @see #setCustomView(View) */ public abstract void setSubtitle(CharSequence subtitle); /** * Set a custom view for this context mode. The custom view will take the place of * the title and subtitle. Useful for things like search boxes. * * @param view Custom view to use in place of the title/subtitle. * * @see #setTitle(CharSequence) * @see #setSubtitle(CharSequence) */ public abstract void setCustomView(View view); /** * Invalidate the context mode and refresh menu content. The context mode's * {@link ContextModeCallback} will have its * {@link ContextModeCallback#onPrepareContextMode(ContextMode, Menu)} method called. * If it returns true the menu will be scanned for updated content and any relevant changes * will be reflected to the user. */ public abstract void invalidate(); /** * Finish and close this context mode. The context mode's {@link ContextModeCallback} will * have its {@link ContextModeCallback#onDestroyContextMode(ContextMode)} method called. */ public abstract void finish(); /** * Returns the menu of actions that this context mode presents. * @return The context mode's menu. */ public abstract Menu getMenu(); /** * Returns the current title of this context mode. * @return Title text */ public abstract CharSequence getTitle(); /** * Returns the current subtitle of this context mode. * @return Subtitle text */ public abstract CharSequence getSubtitle(); /** * Returns the current custom view for this context mode. * @return The current custom view */ public abstract View getCustomView(); } /** * Callback interface for ActionBar context modes. Supplied to * {@link ActionBar#startContextMode(ContextModeCallback)}, a ContextModeCallback * configures and handles events raised by a user's interaction with a context mode. * * <p>A context mode's lifecycle is as follows: * <ul> * <li>{@link ContextModeCallback#onCreateContextMode(ContextMode, Menu)} once on initial * creation</li> * <li>{@link ContextModeCallback#onPrepareContextMode(ContextMode, Menu)} after creation * and any time the {@link ContextMode} is invalidated</li> * <li>{@link ContextModeCallback#onContextItemClicked(ContextMode, MenuItem)} any time a * contextual action button is clicked</li> * <li>{@link ContextModeCallback#onDestroyContextMode(ContextMode)} when the context mode * is closed</li> * </ul> */ public interface ContextModeCallback { /** * Called when a context mode is first created. The menu supplied will be used to generate * action buttons for the context mode. * * @param mode ContextMode being created * @param menu Menu used to populate contextual action buttons * @return true if the context mode should be created, false if entering this context mode * should be aborted. */ public boolean onCreateContextMode(ContextMode mode, Menu menu); /** * Called to refresh a context mode's action menu whenever it is invalidated. * * @param mode ContextMode being prepared * @param menu Menu used to populate contextual action buttons * @return true if the menu or context mode was updated, false otherwise. */ public boolean onPrepareContextMode(ContextMode mode, Menu menu); /** * Called to report a user click on a contextual action button. * * @param mode The current ContextMode * @param item The item that was clicked * @return true if this callback handled the event, false if the standard MenuItem * invocation should continue. */ public boolean onContextItemClicked(ContextMode mode, MenuItem item); /** * Called when a context mode is about to be exited and destroyed. * * @param mode The current ContextMode being destroyed */ public void onDestroyContextMode(ContextMode mode); } /** * Callback interface for ActionBar navigation events. */ Loading
core/java/android/app/Activity.java +16 −1 Original line number Diff line number Diff line Loading @@ -662,7 +662,7 @@ public class Activity extends ContextThemeWrapper /*package*/ boolean mWindowAdded = false; /*package*/ boolean mVisibleFromServer = false; /*package*/ boolean mVisibleFromClient = true; /*package*/ ActionBar mActionBar = null; /*package*/ ActionBarImpl mActionBar = null; private CharSequence mTitle; private int mTitleColor = 0; Loading Loading @@ -4253,4 +4253,19 @@ public class Activity extends ContextThemeWrapper } } } @Override public ContextualMode startContextualMode(ContextualMode.Callback callback) { if (mActionBar == null) { return null; } return mActionBar.startContextualMode(callback); } @Override public void finishContextualMode() { if (mActionBar != null) { mActionBar.finishContextualMode(); } } }
core/java/android/app/ContextualMode.java 0 → 100644 +155 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app; import android.content.Context; import android.view.Menu; import android.view.MenuItem; import android.view.View; /** * Represents a contextual mode of the user interface. Contextual modes can be used for * modal interactions with content and replace parts of the normal UI until finished. * Examples of good contextual modes include selection modes, search, content editing, etc. */ public abstract class ContextualMode { /** * Set the title of the contextual mode. This method will have no visible effect if * a custom view has been set. * * @param title Title string to set * * @see #setCustomView(View) */ public abstract void setTitle(CharSequence title); /** * Set the subtitle of the contextual mode. This method will have no visible effect if * a custom view has been set. * * @param subtitle Subtitle string to set * * @see #setCustomView(View) */ public abstract void setSubtitle(CharSequence subtitle); /** * Set a custom view for this contextual mode. The custom view will take the place of * the title and subtitle. Useful for things like search boxes. * * @param view Custom view to use in place of the title/subtitle. * * @see #setTitle(CharSequence) * @see #setSubtitle(CharSequence) */ public abstract void setCustomView(View view); /** * Invalidate the contextual mode and refresh menu content. The contextual mode's * {@link ContextualMode.Callback} will have its * {@link Callback#onPrepareContextMode(ContextualMode, Menu)} method called. * If it returns true the menu will be scanned for updated content and any relevant changes * will be reflected to the user. */ public abstract void invalidate(); /** * Finish and close this context mode. The context mode's {@link ContextualMode.Callback} will * have its {@link Callback#onDestroyContextMode(ContextualMode)} method called. */ public abstract void finish(); /** * Returns the menu of actions that this contextual mode presents. * @return The contextual mode's menu. */ public abstract Menu getMenu(); /** * Returns the current title of this contextual mode. * @return Title text */ public abstract CharSequence getTitle(); /** * Returns the current subtitle of this contextual mode. * @return Subtitle text */ public abstract CharSequence getSubtitle(); /** * Returns the current custom view for this contextual mode. * @return The current custom view */ public abstract View getCustomView(); /** * Callback interface for contextual modes. Supplied to * {@link Context#startContextMode(Callback)}, a ContextModeCallback * configures and handles events raised by a user's interaction with a context mode. * * <p>A context mode's lifecycle is as follows: * <ul> * <li>{@link Callback#onCreateContextMode(ActionBar.ContextualMode, Menu)} once on initial * creation</li> * <li>{@link Callback#onPrepareContextMode(ActionBar.ContextualMode, Menu)} after creation * and any time the {@link ContextualMode} is invalidated</li> * <li>{@link Callback#onContextItemClicked(ActionBar.ContextualMode, MenuItem)} any time a * contextual action button is clicked</li> * <li>{@link Callback#onDestroyContextMode(ActionBar.ContextualMode)} when the context mode * is closed</li> * </ul> */ public interface Callback { /** * Called when a context mode is first created. The menu supplied will be used to generate * action buttons for the context mode. * * @param mode ContextMode being created * @param menu Menu used to populate contextual action buttons * @return true if the context mode should be created, false if entering this context mode * should be aborted. */ public boolean onCreateContextMode(ContextualMode mode, Menu menu); /** * Called to refresh a context mode's action menu whenever it is invalidated. * * @param mode ContextMode being prepared * @param menu Menu used to populate contextual action buttons * @return true if the menu or context mode was updated, false otherwise. */ public boolean onPrepareContextMode(ContextualMode mode, Menu menu); /** * Called to report a user click on a contextual action button. * * @param mode The current ContextMode * @param item The item that was clicked * @return true if this callback handled the event, false if the standard MenuItem * invocation should continue. */ public boolean onContextItemClicked(ContextualMode mode, MenuItem item); /** * Called when a context mode is about to be exited and destroyed. * * @param mode The current ContextMode being destroyed */ public void onDestroyContextMode(ContextualMode mode); } } No newline at end of file
core/java/android/content/Context.java +23 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.content; import android.app.ContextualMode; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.AssetManager; Loading @@ -26,6 +27,7 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.media.MediaScannerConnection.OnScanCompletedListener; import android.net.Uri; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -1981,4 +1983,25 @@ public abstract class Context { public boolean isRestricted() { return false; } /** * Start a contextual mode controlled by <code>callback</code>. * The {@link ContextualMode.Callback} will receive lifecycle events for the duration * of the contextual mode. There can only be one contextual mode active at a time. * Starting a new contextual mode while one is already active will finish the old * contextual mode. * * @param callback Callback handler that will manage this context mode. * @return The new contextual mode started by this call, or <code>null</code> * if the mode was not started. */ public ContextualMode startContextualMode(ContextualMode.Callback callback) { return null; } /** * Finish the current contextual mode if present. */ public void finishContextualMode() { } }