Mimic Native ActionBar API #25

wants to merge 47 commits into


None yet
4 participants

JakeWharton commented May 14, 2011

Mimic the API of the native ActionBar on Android 3.0+. This implements all of the methods using behavior that is follows as closely to the 3.0+ version's implementation as possible.

The example application has also been updated with buttons to demonstrate the new functionality.

JakeWharton added some commits May 14, 2011

@JakeWharton JakeWharton Implement all methods from the native ActionBar API which deal with t…
…he standard navigation state (i.e., not tabbed or list navigation).
@JakeWharton JakeWharton Fix tab/spaces indentation. 0971079
@JakeWharton JakeWharton Add 'TODO' prefixes to custom view-related stuff so that they are hig…
…hlighted in Eclipse.
@JakeWharton JakeWharton Add accidentally-removed `clearHomeAction()` method which is a deprec…
…ated marshal to `setDisplayShowHomeEnabled(boolean)`.
@JakeWharton JakeWharton Damn tabs! 6a0cfe8
@JakeWharton JakeWharton Alphabetize and organize methods. 58d2a47
@JakeWharton JakeWharton Add navigation mode handling (currently only standard and list). Upda…
…te example application to demonstrate all the new features. Clean up some code from previous commits to conform to existing style of library.

JakeWharton commented May 14, 2011

Added navigation modes for standard (title only) and list navigation.

JakeWharton added some commits May 14, 2011

@JakeWharton JakeWharton Tabs to spaces, yet again. efc20b7
@JakeWharton JakeWharton Clean up layout of example buttons. f4c8758
@JakeWharton JakeWharton Fix alignment of list indicator when the progress bar is displayed. 2387d50
@JakeWharton JakeWharton Logo should be an ImageButton. b34011a
@JakeWharton JakeWharton The 'background_home' RelativeLayout should only contain the logo and…
… icon action item.
@JakeWharton JakeWharton Add left padding the logo so it is not directly against the left of t…
…he screen and aligns more properly with the up indicator.
@JakeWharton JakeWharton Add logo and home action item. Buttons now enable/disable when their …
…underlying values are relevant to the current action bar state.
@JakeWharton JakeWharton Only show list navigation popup if there is an adapter representing t…
…he possible values.
@JakeWharton JakeWharton Parse Build.VERSION.SDK string since Build.VERSION.SDK_INT only becam…
…e available on API level 4 and our minimum target is API level 3.
@JakeWharton JakeWharton Add missing JavaDocs. 6c42af4
@JakeWharton JakeWharton Flop-flip DocsJava for standard and list navigation. e92a582
@JakeWharton JakeWharton Add custom view support. 3b2ba5c
@JakeWharton JakeWharton Add subtitle support. 39e0f0b
@JakeWharton JakeWharton Remove unneccessary blank space in indicator images. 1055446
@JakeWharton JakeWharton Fix padding of logo. 88031f7
@JakeWharton JakeWharton Move logo loading to its own class so it properly works on pre-Ginger…
…bread devices. Update both the minimum and target API levels to 4 (Android 1.6) and 10 (Android 2.3.3), respectively. API level 3 accounts for only about 2% of all devices and has a highly broken implementation of the layout rendering engine which already did not render this library properly most of the time. API level 10 is the newest and final API level without a native ActionBar.
@JakeWharton JakeWharton Roll our own ActionBar-themed dropdown for list navigation. 11a3548
@JakeWharton JakeWharton Convert example button groups to enable/disable themselves based off …
…of state.

JakeWharton commented May 15, 2011

I believe I have everything except for tabbed navigation implemented. Been a crazy 24 hours of hacking all this support in but I think it turned out pretty well. I still have a few things on my TODO list other than tabbed navigation but they can wait a bit.

Check out the example app for a full demo of the new features.

QR Code


johannilsson commented May 15, 2011

Wow, you've been busy at work! And it looks really really good, will see if I can fix the tabbed navigation soonish. Sorry that I has been slightly away but it's been a crazy week here.

Checked out the example and really like the navigation mode list :)

Amazing! Great work.


johannilsson commented May 16, 2011

I've merged this to the branch mimic-native-api and added initial support for tabs.

Support for tabs is far from complete but it do look pretty good already even though it's hacked up and lack support for configuration and such, will continue the work during the week.

JakeWharton and others added some commits May 17, 2011

@JakeWharton JakeWharton Add remaining tab methods. a5c7b33
@JakeWharton JakeWharton Add tabs to demo activity. 8ed1ec5
@JakeWharton JakeWharton Add scrolling text to tabs. 5672c56
@johannilsson johannilsson Removed SearchAction that was never used. ad59059
@johannilsson johannilsson Fix that hides title, subtitle and custom view when in tab mode. d5bb112
@johannilsson johannilsson Fix that allows tabs to focus and change background when tapped and n…
…avigated to by the trackball.
@JakeWharton JakeWharton Convert Actions to be MenuItem implementations and the ActionBar to b…
…e a Menu implementor. This allows for fun stuff like inflation of action items from menu XML files (see OtherActivity in the demo).

 * isEnabled/isVisible do not work.
 * Home action item must have id of `R.id.actionbar_item_home` to be properly recognized.
@JakeWharton JakeWharton Merge remote-tracking branch 'upstream/mimic-native-api' into mimic-n…


JakeWharton commented May 17, 2011

Let me know what you think of JakeWharton/android-actionbar@0b3d97218adc265a67d8ecb7896abf5d9ef041d3. I can revert it if it is not the route you want to go in. It fixes #7 and is something I do in the custom version of your library that is used in the yet-unreleased ActionBarSherlock v3.

JakeWharton added some commits May 17, 2011

@JakeWharton JakeWharton Marshal visibility directly to the view. Make sure the is/setChecked(…
…) methods require that the item is checkable.
@JakeWharton JakeWharton Use our Action class to differentiate from MenuItem and add the abili…
…ty for future support of custom views and showAsAction support.
@JakeWharton JakeWharton Toggle Action isChecked() on click to allow updating the icon/title/v…
…iew in the click listener. Use direct lookups to Action and Tab instance properties to save a method lookup and call.
@JakeWharton JakeWharton Add icon and custom views, along with the remainder of methods from t…
…he native ActionBar.Tab class. Demo activity has been updated to randomly assign these to new tabs.

JakeWharton commented May 18, 2011

Updated demo apk linked above for those interested.

Two problems i've noticed:

  • Custom tab views (or at least the simple one I have created) are distorted.
  • List view dropdown doesn't show d-pad selection. The selection with the d-pad works, but there is no state displayed on screen because the list items do not use the normal style.

johannilsson commented May 18, 2011

Jake, this looks really good and you have made huge progress during the last days, I'm not too happy with the naming of the add methods but I guess I can get used to it and I see the benefits of implementing Menu. It might be possible to refactor out handling of action items to a separate view and have addAction methods to delagate to that view from the action bar, will have to think about that. My time is somewhat limited since I can only contribute a few hours each evening, but I will review and apply a few fixes as soon as I can.

I've started to work on the selection issues on the list view last night and I hope to finish that and a few other things during the week. I have also have a couple of uncommited fixes for the tab handling I hope I can wrap up really soon.

Anyway, thank you and I'm looking forward to ActionBarSherlock v3.

JakeWharton added some commits May 18, 2011

@JakeWharton JakeWharton Revert implementing the Menu interface directly and use the old xxxAc…
…tion(...)-style methods. The Menu implementation has been moved to a local subclass which is accessable via the `asMenu()` method.
@JakeWharton JakeWharton A couple missing JavaDocs. 4fd4f4c

johannilsson commented May 19, 2011

I've pushed a small fix yesterday that solves the list navigation problems with trackball, your latest changes is also merged to mimic-native-api.


JakeWharton commented May 31, 2011

Closing this since you've already merged it into a topic branch and I want to delete my forked repo since a few people started to watch it instead of yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment