You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found the ActionBar project yesterday and have found it to be wonderful.
One of the problems I have will Android application is that the purpose of icon buttons is not always clean (eg. some of the Gmail icons).
For this reason I needed adapted ActionBar of the user can use a LongClick to get a textual description of the Action's purposes.
I am not Git skilled and my Eclipse has completely reformatted the source code so I cannot easily generated a short list of differences.
If you are interested in the feature then the to ActionBar.java are quite trivial and outlined below.
There is an extended ActionBar.Action interface called "ActionBar.ActionPlus".
public interface ActionPlus extends Action {
public void performLongClickAction(View pView);
}
the class now implements "android.view.View.OnLongClickListener" and the supporting code is @OverRide
public boolean onLongClick(View view) {
final Object tag = view.getTag();
if (tag instanceof ActionPlus) {
final ActionPlus action = (ActionPlus) tag;
action.performLongClickAction(view);
return true;
}
return false;
}
Last peice of the ActionBar code change is addition of the following 4 lines in the inflateAction() method.
labelView.setImageResource(action.getDrawable());
if (action instanceof ActionPlus) {
labelView.setLongClickable(true);
labelView.setOnLongClickListener(this);
}
A example to how I have used this is my application is :
actionBar.addAction(new ActionBar.ActionPlus() {
public void performAction(View view) {
doOpenDrawer();
}
public int getDrawable() {
return R.drawable.drawer_open;
}
public void performLongClickAction(View view) {
UtilsNotify.show(MainMenu.this, R.string.action_open_drawer_description);
}
});
I'm not sure if this is a Best Practice implementation of how to extended the ActionBar functionality.
A better solution may have been to use a function "public int getStringId();" instead of the long "performLongClickAction()" and then use "Toast" directly to display the text message.
Also if it was a private library module (where I did not care about backward compatibility), I would have just extended the definition of the "Action"/"ActionAbstract" implementations to handle the mStringId member (as is currently done for the mDrawable member.
NB. for my own local copy I have now implement both the above suggestions.
The text was updated successfully, but these errors were encountered:
I found the ActionBar project yesterday and have found it to be wonderful.
One of the problems I have will Android application is that the purpose of icon buttons is not always clean (eg. some of the Gmail icons).
For this reason I needed adapted ActionBar of the user can use a LongClick to get a textual description of the Action's purposes.
I am not Git skilled and my Eclipse has completely reformatted the source code so I cannot easily generated a short list of differences.
If you are interested in the feature then the to ActionBar.java are quite trivial and outlined below.
There is an extended ActionBar.Action interface called "ActionBar.ActionPlus".
public interface ActionPlus extends Action {
public void performLongClickAction(View pView);
}
the class now implements "android.view.View.OnLongClickListener" and the supporting code is
@OverRide
public boolean onLongClick(View view) {
final Object tag = view.getTag();
if (tag instanceof ActionPlus) {
final ActionPlus action = (ActionPlus) tag;
action.performLongClickAction(view);
return true;
}
return false;
}
Last peice of the ActionBar code change is addition of the following 4 lines in the inflateAction() method.
A example to how I have used this is my application is :
I'm not sure if this is a Best Practice implementation of how to extended the ActionBar functionality.
A better solution may have been to use a function "public int getStringId();" instead of the long "performLongClickAction()" and then use "Toast" directly to display the text message.
Also if it was a private library module (where I did not care about backward compatibility), I would have just extended the definition of the "Action"/"ActionAbstract" implementations to handle the mStringId member (as is currently done for the mDrawable member.
NB. for my own local copy I have now implement both the above suggestions.
The text was updated successfully, but these errors were encountered: