Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
94f40c8
Implement all methods from the native ActionBar API which deal with t…
JakeWharton May 14, 2011
0971079
Fix tab/spaces indentation.
JakeWharton May 14, 2011
cf34152
Add 'TODO' prefixes to custom view-related stuff so that they are hig…
JakeWharton May 14, 2011
e0ebf1b
Add accidentally-removed `clearHomeAction()` method which is a deprec…
JakeWharton May 14, 2011
6a0cfe8
Damn tabs!
JakeWharton May 14, 2011
58d2a47
Alphabetize and organize methods.
JakeWharton May 14, 2011
a8bc1d4
Add navigation mode handling (currently only standard and list). Upda…
JakeWharton May 14, 2011
efc20b7
Tabs to spaces, yet again.
JakeWharton May 14, 2011
f4c8758
Clean up layout of example buttons.
JakeWharton May 14, 2011
2387d50
Fix alignment of list indicator when the progress bar is displayed.
JakeWharton May 14, 2011
b34011a
Logo should be an ImageButton.
JakeWharton May 15, 2011
450993e
The 'background_home' RelativeLayout should only contain the logo and…
JakeWharton May 15, 2011
2d3d007
Add left padding the logo so it is not directly against the left of t…
JakeWharton May 15, 2011
5f20fc8
Add logo and home action item. Buttons now enable/disable when their …
JakeWharton May 15, 2011
725858f
Only show list navigation popup if there is an adapter representing t…
JakeWharton May 15, 2011
89698ce
Parse Build.VERSION.SDK string since Build.VERSION.SDK_INT only becam…
JakeWharton May 15, 2011
6c42af4
Add missing JavaDocs.
JakeWharton May 15, 2011
e92a582
Flop-flip DocsJava for standard and list navigation.
JakeWharton May 15, 2011
3b2ba5c
Add custom view support.
JakeWharton May 15, 2011
39e0f0b
Add subtitle support.
JakeWharton May 15, 2011
1055446
Remove unneccessary blank space in indicator images.
JakeWharton May 15, 2011
88031f7
Fix padding of logo.
JakeWharton May 15, 2011
1211cf2
Move logo loading to its own class so it properly works on pre-Ginger…
JakeWharton May 15, 2011
11a3548
Roll our own ActionBar-themed dropdown for list navigation.
JakeWharton May 15, 2011
e554e25
Convert example button groups to enable/disable themselves based off …
JakeWharton May 15, 2011
14b21d2
Make sure getSubtitle() returns null when in standard navigaton with …
JakeWharton May 15, 2011
cfb6be6
Tiny JavaDoc and logic tweaks.
JakeWharton May 15, 2011
0994783
Fix return value of isShowing(). Add show/hide toggles to ActionBar d…
JakeWharton May 15, 2011
2c045e3
Fix display logic of title/subtitle and custom view buttons when the …
JakeWharton May 15, 2011
64bb50f
Fix regression of setSubtitle() not calling reloadDisplay() which wil…
JakeWharton May 15, 2011
69d0fac
Clear all existing custom views when adding a View object.
JakeWharton May 16, 2011
5e3d1ba
Fix loading the activity label from the manifest file as the title.
JakeWharton May 16, 2011
26c0462
Initial support for NAVIGATION_MODE_TABS.
johannilsson May 16, 2011
a5c7b33
Add remaining tab methods.
JakeWharton May 17, 2011
8ed1ec5
Add tabs to demo activity.
JakeWharton May 17, 2011
5672c56
Add scrolling text to tabs.
JakeWharton May 17, 2011
ad59059
Removed SearchAction that was never used.
johannilsson May 17, 2011
d5bb112
Fix that hides title, subtitle and custom view when in tab mode.
johannilsson May 17, 2011
bb30211
Fix that allows tabs to focus and change background when tapped and n…
johannilsson May 17, 2011
0b3d972
Convert Actions to be MenuItem implementations and the ActionBar to b…
JakeWharton May 17, 2011
b675cf8
Merge remote-tracking branch 'upstream/mimic-native-api' into mimic-n…
JakeWharton May 17, 2011
95bfd4c
Marshal visibility directly to the view. Make sure the is/setChecked(…
JakeWharton May 17, 2011
a0bf371
Use our Action class to differentiate from MenuItem and add the abili…
JakeWharton May 17, 2011
0e12560
Toggle Action isChecked() on click to allow updating the icon/title/v…
JakeWharton May 17, 2011
86fafd6
Add icon and custom views, along with the remainder of methods from t…
JakeWharton May 18, 2011
6abc8c3
Revert implementing the Menu interface directly and use the old xxxAc…
JakeWharton May 18, 2011
4fd4f4c
A couple missing JavaDocs.
JakeWharton May 18, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tiny JavaDoc and logic tweaks.
  • Loading branch information
JakeWharton committed May 15, 2011
commit cfb6be6e1265ab5804dfd9ae649bdd076905e0a9
65 changes: 34 additions & 31 deletions actionbar/src/com/markupartist/android/widget/ActionBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import android.widget.Toast;

/**
* Implementation of the action bar design pattern for use on Android 1.5+.
* Implementation of the action bar design pattern for use on Android 1.6+.
*
* @author Johan Nilsson <http://markupartist.com>
*/
Expand Down Expand Up @@ -146,13 +146,17 @@ public static interface OnNavigationListener {
// * Tab navigation mode. Instead of static title text this mode presents a
// * series of tabs for navigation within the activity.
// */
//public static final int NAVIGATION_MODE_TABS = 0x2;// = android.app.ActionBar.NAVIGATION_MODE_TABS;
//TODO public static final int NAVIGATION_MODE_TABS = 0x2;// = android.app.ActionBar.NAVIGATION_MODE_TABS;



/** Layout inflation service. */
private final LayoutInflater mInflater;

/** Parent view of the action bar. */
private final RelativeLayout mBarView;

/** Home logo. */
private final ImageView mHomeLogo;

/** Home button up indicator. */
Expand All @@ -173,14 +177,16 @@ public static interface OnNavigationListener {
/** Custom view parent. */
private final FrameLayout mCustomView;

/** Container for all action items. */
private final LinearLayout mActionsView;

/** Indeterminate progress bar. */
private final ProgressBar mProgress;

/** Home logo. */
/** Home item icon. */
private final ImageButton mHomeIconImage;

/** Home button. */
/** Home item. */
private final RelativeLayout mHomeIcon;

/**
Expand Down Expand Up @@ -267,7 +273,6 @@ public ActionBar(Context context, AttributeSet attrs) {

mListView = (FrameLayout) mBarView.findViewById(R.id.actionbar_list);
mListView.setOnClickListener(mListClicked);

mListIndicator = mBarView.findViewById(R.id.actionbar_list_indicator);

mCustomView = (FrameLayout) mBarView.findViewById(R.id.actionbar_custom);
Expand Down Expand Up @@ -301,11 +306,9 @@ public ActionBar(Context context, AttributeSet attrs) {
}
}

//Show the home icon and title by default
//Show the title by default
setDisplayOption(DISPLAY_SHOW_TITLE, true);
reloadDisplay();

//Use standard navigation by default
//Use standard navigation by default (this will call reloadDisplay)
setNavigationMode(NAVIGATION_MODE_STANDARD);
}

Expand All @@ -316,8 +319,7 @@ public ActionBar(Context context, AttributeSet attrs) {
// ------------------------------------------------------------------------

/**
* Helper to set a flag to a new value. This will also update the action
* bar accordingly to reflect the current state of the flags.
* Helper to set a flag to a new value.
*
* @param flag Flag to update.
* @param enabled New value.
Expand Down Expand Up @@ -501,7 +503,7 @@ public CharSequence getSubtitle() {
* @see #setDisplayShowTitleEnabled(boolean)
*/
public CharSequence getTitle() {
if (mNavigationMode == NAVIGATION_MODE_STANDARD) {
if ((mNavigationMode == NAVIGATION_MODE_STANDARD) && !mTitleView.getText().equals("")) {
return mTitleView.getText();
} else {
return null;
Expand Down Expand Up @@ -756,7 +758,6 @@ public void setSelectedNavigationItem(int position) {
*/
public void setSubtitle(int resId) {
mSubtitleView.setText(resId);
reloadDisplay();
}

/**(
Expand All @@ -771,7 +772,6 @@ public void setSubtitle(int resId) {
*/
public void setSubtitle(CharSequence subtitle) {
mSubtitleView.setText((subtitle == null) ? "" : subtitle);
reloadDisplay();
}

/**
Expand All @@ -783,7 +783,7 @@ public void setSubtitle(CharSequence subtitle) {
* @see #getTitle()
*/
public void setTitle(CharSequence title) {
mTitleView.setText(title);
mTitleView.setText((title == null) ? "" : title);
}

/**
Expand Down Expand Up @@ -906,12 +906,13 @@ public int getProgressBarVisibility() {
}

/**
* Function to set a click listener for Title TextView
* Function to set a click listener for title and subtitle TextView.
*
* @param listener the onClickListener
* @param listener The callback listener.
*/
public void setOnTitleClickListener(OnClickListener listener) {
mTitleView.setOnClickListener(listener);
mSubtitleView.setOnClickListener(listener);
}

@Override
Expand All @@ -925,22 +926,22 @@ public void onClick(View view) {

/**
* Adds a list of {@link Action}s.
* @param actionList the actions to add
*
* @param actions List of actions to add.
*
* @see #addAction(Action)
* @see #addAction(Action, int)
*/
public void addActions(List<Action> actionList) {
int actions = actionList.size();
for (int i = 0; i < actions; i++) {
addAction(actionList.get(i));
public void addActions(List<Action> actions) {
for (Action action : actions) {
addAction(action);
}
}

/**
* Adds a new {@link Action}.
*
* @param action the action to add
* @param action Action to add.
*
* @see #addAction(Action, int)
* @see #addActions(List)
Expand All @@ -953,8 +954,8 @@ public void addAction(Action action) {
/**
* Adds a new {@link Action} at the specified index.
*
* @param action the action to add
* @param index the position at which to add the action
* @param action Action to add.
* @param index The position at which to add the action.
*
* @see #addAction(Action)
* @see #addActions(List)
Expand All @@ -964,24 +965,25 @@ public void addAction(Action action, int index) {
}

/**
* Removes all action views from this action bar
* Removes all action views from this action bar.
*/
public void removeAllActions() {
mActionsView.removeAllViews();
}

/**
* Remove a action from the action bar.
* Remove an action from the action bar.
*
* @param index position of action to remove
* @param index Position of action to remove.
*/
public void removeActionAt(int index) {
mActionsView.removeViewAt(index);
}

/**
* Remove a action from the action bar.
* @param action The action to remove
* Remove an action from the action bar.
*
* @param action The action to remove.
*/
public void removeAction(Action action) {
int childCount = mActionsView.getChildCount();
Expand All @@ -998,7 +1000,8 @@ public void removeAction(Action action) {

/**
* Returns the number of actions currently registered with the action bar.
* @return action count
*
* @return Action count.
*/
public int getActionCount() {
return mActionsView.getChildCount();
Expand Down