johannilsson / android-actionbar

DEPRECATED Android Action Bar Implementation
1.3k stars 564 forks source link

Added a method to set the title textview clickable like a IntentAction #8

Closed RickardPettersson closed 13 years ago

RickardPettersson commented 13 years ago

This was a functionality i been asked to have in Train Status Sweden i think its can be a good function to have in the Actionbar.

Maybe you finding a better way to do it then i did, then you can fix it or ask me to do it.

johannilsson commented 13 years ago

Hi, this is a great idea. Not sure it should be with a IntentAction though.

I guess the most common use case is to intercept clicks on the title to do things like scroll to top. To do this I think it would be more convenient to add a OnClickListener or a more specific OnTitleClickListener.

In the activity or wherever the action bar is configured you could use it like;

actionBar.setOnTitleClickListener(new OnTitleClickListener() {
    public void onClick (View v) {
        // Handle on click here...
    }
});

Would this approach solve what you're trying to do too?

RickardPettersson commented 13 years ago

Yes it should solve the problem, do you whant to fix it or should i?

johannilsson commented 13 years ago

If you have the time to fix it I'm happy to pull it from you. Otherwise I can do it, can't promise when though :)