Mimic Native ActionBar API #25

Closed
wants to merge 47 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

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).
94f40c8
@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.
cf34152
@JakeWharton JakeWharton Add accidentally-removed `clearHomeAction()` method which is a deprec…
…ated marshal to `setDisplayShowHomeEnabled(boolean)`.
e0ebf1b
@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.
a8bc1d4
Contributor

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.
450993e
@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.
2d3d007
@JakeWharton JakeWharton Add logo and home action item. Buttons now enable/disable when their …
…underlying values are relevant to the current action bar state.
5f20fc8
@JakeWharton JakeWharton Only show list navigation popup if there is an adapter representing t…
…he possible values.
725858f
@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.
89698ce
@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.
1211cf2
@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.
e554e25
Contributor

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

Owner

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.

Owner

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.
bb30211
@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).

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

Conflicts:
	actionbar/src/com/markupartist/android/widget/ActionBar.java
b675cf8
Contributor

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.
95bfd4c
@JakeWharton JakeWharton Use our Action class to differentiate from MenuItem and add the abili…
…ty for future support of custom views and showAsAction support.
a0bf371
@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.
0e12560
@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.
86fafd6
Contributor

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.
Owner

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.
6abc8c3
@JakeWharton JakeWharton A couple missing JavaDocs. 4fd4f4c
Owner

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.

Contributor

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