use of android.support.v7.widget.ActionMenuView in project material by rey5137.
the class ToolbarManager method animateIn.
private void animateIn() {
ActionMenuView menuView = getMenuView();
for (int i = 0, count = menuView == null ? 0 : menuView.getChildCount(); i < count; i++) {
View child = menuView.getChildAt(i);
Animation anim = mAnimator.getInAnimation(child, i);
if (anim != null)
child.startAnimation(anim);
}
}
use of android.support.v7.widget.ActionMenuView in project material by rey5137.
the class ToolbarManager method onGlobalLayout.
private void onGlobalLayout() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
mToolbar.getViewTreeObserver().removeOnGlobalLayoutListener(mOnGlobalLayoutListener);
else
mToolbar.getViewTreeObserver().removeGlobalOnLayoutListener(mOnGlobalLayoutListener);
ActionMenuView menuView = getMenuView();
for (int i = 0, count = menuView == null ? 0 : menuView.getChildCount(); i < count; i++) {
View child = menuView.getChildAt(i);
if (mRippleStyle != 0) {
if (child.getBackground() == null || !(child.getBackground() instanceof ToolbarRippleDrawable))
ViewUtil.setBackground(child, getBackground());
}
}
if (mGroupChanged) {
animateIn();
mGroupChanged = false;
}
}
use of android.support.v7.widget.ActionMenuView in project Carbon by ZieIony.
the class Toolbar method ensureMenuView.
private void ensureMenuView() {
if (mMenuView == null) {
mMenuView = new ActionMenuView(getContext());
mMenuView.setPopupTheme(mPopupTheme);
mMenuView.setOnMenuItemClickListener(mMenuViewItemClickListener);
mMenuView.setMenuCallbacks(mActionMenuPresenterCallback, mMenuBuilderCallback);
final LayoutParams lp = generateDefaultLayoutParams();
lp.gravity = GravityCompat.END | (mButtonGravity & Gravity.VERTICAL_GRAVITY_MASK);
mMenuView.setLayoutParams(lp);
addSystemView(mMenuView);
}
}
use of android.support.v7.widget.ActionMenuView 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);
// }
// });
}
}
}
}
}
}
Aggregations