ricardoalcocer / actionbarextras

Titanium Android Native Module that exposes ActionBar features not exposed by the Titanium SDK
MIT License
149 stars 60 forks source link

Title center, left-side button and shadow #106

Closed Angelk90 closed 8 years ago

Angelk90 commented 8 years ago

1) you can implement that the title and subtitle can be put at the center as happens to the image? 2) the ability to also put on the left of the menu buttons, as does for example the following app for GPS:https://lh3.googleusercontent.com/qv8jBA57QjCDX2e6fStvzDy7TocVXh_SX282izJBE0UOJXyxdt0kBzhJ68mockw-nQ=h900-rw 3) the possibility under the ActionBar to have the shadow effect, for example: http://i.stack.imgur.com/W6523.png

manumaticx commented 8 years ago

Hi @Angelk90

1) nope 2) isn't this default behavior or did I get you wrong? 3) ActionBar.elevation is what you're looking for: abx.elevation = 24;

Angelk90 commented 8 years ago

Hi @manumaticx ,

I thank you for having responded.

1) Can I ask why? 2) You say that is not a default behavior by the standard Android? The link of the image is dell'actionbarextras use. It is located in README.md files in "Some apps using ActionBarExtras", the app in question is PiniOn so I was wondering how I could do it myself. 3) I have done as you say, but I see no difference.

manumaticx commented 8 years ago

1) Actionbar is not intended to be used like this as per Googles guideline 2) Ah, you mean the icon on the left side? This is a logo / icon. You can set this with actionBar.setIcon() or actionBar.setLogo(). Icons of optionsMenu are on the right side. 3) What Theme are you using? MaterialTheme (provided by AppCompat) comes with a default elevation shadow as seen in the image below. You can adjust this with the elevation-property.

Angelk90 commented 8 years ago

1) Many do:https://www.google.it/search?q=action+bar+title+center&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiftd2v7fXNAhVMORoKHd0ICU4Q_AUICSgC&biw=1366&bih=643 2) for example:http://stackoverflow.com/questions/12979191/how-can-i-make-the-items-on-actionbar-to-be-one-on-the-left-one-in-the-center-a

manumaticx commented 8 years ago

1) I didn't say it's impossible ;) but I don't want to implement it. If you have a pull request, feel free to send it. 2) As I say, easiest way to make this: use actionbar.icon and actionBar.onHomeIconItemSelected

Angelk90 commented 8 years ago

1) put a title.setGravity (Gravity.CENTER) in the right place, nope? ;) 2) It is not an icon or a logo, but a button with an associated event.

manumaticx commented 8 years ago

1) something like that. Maybe you can hack this into the actionbar with Hyperloop ;) 2) Yes, but it would end up in the same result, right?

Angelk90 commented 8 years ago

1) Titanium as I do, I have to modify the library in java. 2) Would you do me an example.

manumaticx commented 8 years ago
/**
 * Android callback for {Ti.UI.Window} open event
 */
function onOpen() {

  var activity = $.index.getActivity();

  if (activity) {

    var actionBar = activity.getActionBar();

    if (actionBar) {
      abx.setDisplayShowHomeEnabled(true);
      actionBar.setIcon('appicon.png');
      abx.setDisplayShowTitleEnabled(false);
      actionBar.onHomeIconItemSelected = function() {
        // use this callback to handle clicks on the icon
      };
    }
  };

  return true;
}
Angelk90 commented 8 years ago

1)For the first point?

manumaticx commented 8 years ago

If you have a solution for this feel free to fork this module an build on your own 👍 A pull request would be very welcome.