use of android.support.v7.view.menu.ActionMenuItemView in project HoloEverywhere by Prototik.
the class ActionMenuPresenter method getItemView.
@Override
public View getItemView(MenuItemImpl item, View convertView, ViewGroup parent) {
View actionView = item.getActionView();
if (actionView == null || item.hasCollapsibleActionView()) {
if (!(convertView instanceof ActionMenuItemView)) {
convertView = null;
}
actionView = super.getItemView(item, convertView, parent);
}
actionView.setVisibility(item.isActionViewExpanded() ? View.GONE : View.VISIBLE);
final ActionMenuView menuParent = (ActionMenuView) parent;
final ViewGroup.LayoutParams lp = actionView.getLayoutParams();
if (!menuParent.checkLayoutParams(lp)) {
actionView.setLayoutParams(menuParent.generateLayoutParams(lp));
}
return actionView;
}
use of android.support.v7.view.menu.ActionMenuItemView in project actor-platform by actorapp.
the class ActorToolbar method doColorizing.
public static void doColorizing(View v, final ColorFilter colorFilter, int toolbarIconsColor) {
if (v instanceof ImageButton) {
((ImageButton) v).getDrawable().setAlpha(255);
((ImageButton) v).getDrawable().setColorFilter(colorFilter);
}
if (v instanceof ImageView && !(v instanceof AvatarView)) {
((ImageView) v).getDrawable().setAlpha(255);
((ImageView) v).getDrawable().setColorFilter(colorFilter);
}
if (v instanceof AutoCompleteTextView) {
((AutoCompleteTextView) v).setTextColor(toolbarIconsColor);
}
if (v instanceof TextView) {
((TextView) v).setTextColor(toolbarIconsColor);
}
if (v instanceof EditText) {
((EditText) v).setTextColor(toolbarIconsColor);
}
if (v instanceof ViewGroup) {
for (int lli = 0; lli < ((ViewGroup) v).getChildCount(); lli++) {
doColorizing(((ViewGroup) v).getChildAt(lli), colorFilter, toolbarIconsColor);
}
}
if (v instanceof ActionMenuView) {
for (int j = 0; j < ((ActionMenuView) v).getChildCount(); j++) {
//Step 2: Changing the color of any ActionMenuViews - icons that
//are not back button, nor text, nor overflow menu icon.
final View innerView = ((ActionMenuView) v).getChildAt(j);
if (innerView instanceof ActionMenuItemView) {
int drawablesCount = ((ActionMenuItemView) innerView).getCompoundDrawables().length;
for (int k = 0; k < drawablesCount; k++) {
if (((ActionMenuItemView) innerView).getCompoundDrawables()[k] != null) {
final int finalK = k;
//Important to set the color filter in seperate thread,
//by adding it to the message queue
//Won't work otherwise.
//Works fine for my case but needs more testing
((ActionMenuItemView) innerView).getCompoundDrawables()[finalK].setColorFilter(colorFilter);
// innerView.post(new Runnable() {
// @Override
// public void run() {
// ((ActionMenuItemView) innerView).getCompoundDrawables()[finalK].setColorFilter(colorFilter);
// }
// });
}
}
}
}
}
}
use of android.support.v7.view.menu.ActionMenuItemView in project Android-Iconics by mikepenz.
the class IconicsFactory method onViewCreatedInternal.
/**
* @param view
* @param context
* @param attrs
*/
void onViewCreatedInternal(View view, final Context context, AttributeSet attrs) {
if (attrs == null) {
return;
}
if (view instanceof ActionMenuItemView) {
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Iconics);
String icon = a.getString(R.styleable.Iconics_ico_icon);
if (!TextUtils.isEmpty(icon)) {
((ActionMenuItemView) view).setIcon(getDrawable(context, a, icon));
}
a.recycle();
} else if (view instanceof EditText) {
//handle iconics
new Iconics.IconicsBuilder().ctx(context).on((TextView) view).build();
//for an editText we only style initial as styling the Editable causes problems!
} else if (view instanceof TextView) {
//handle iconics
new Iconics.IconicsBuilder().ctx(context).on((TextView) view).build();
((TextView) view).addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
Iconics.styleEditable(context, editable);
}
});
} else if (view instanceof ImageView) {
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Iconics);
String icon = a.getString(R.styleable.Iconics_ico_icon);
if (!TextUtils.isEmpty(icon)) {
((ImageView) view).setImageDrawable(getDrawable(context, a, icon));
}
a.recycle();
}
}
Aggregations