use of android.support.v7.internal.view.menu.ActionMenuView 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.internal.view.menu.ActionMenuView in project HoloEverywhere by Prototik.
the class ActionBarContextView method initForMode.
public void initForMode(final ActionMode mode) {
if (mClose == null) {
LayoutInflater inflater = LayoutInflater.from(getContext());
mClose = inflater.inflate(R.layout.abc_action_mode_close_item, this, false);
addView(mClose);
} else if (mClose.getParent() == null) {
addView(mClose);
}
View closeButton = mClose.findViewById(R.id.action_mode_close_button);
closeButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mode.finish();
}
});
final MenuBuilder menu = (MenuBuilder) mode.getMenu();
if (mActionMenuPresenter != null) {
mActionMenuPresenter.dismissPopupMenus();
}
mActionMenuPresenter = new ActionMenuPresenter(getContext());
mActionMenuPresenter.setReserveOverflow(true);
final ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.FILL_PARENT);
if (!mSplitActionBar) {
menu.addMenuPresenter(mActionMenuPresenter);
mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
mMenuView.setBackgroundDrawable(null);
addView(mMenuView, layoutParams);
} else {
// Allow full screen width in split mode.
mActionMenuPresenter.setWidthLimit(getContext().getResources().getDisplayMetrics().widthPixels, true);
// No limit to the item count; use whatever will fit.
mActionMenuPresenter.setItemLimit(Integer.MAX_VALUE);
// Span the whole width
layoutParams.width = ViewGroup.LayoutParams.FILL_PARENT;
layoutParams.height = mContentHeight;
menu.addMenuPresenter(mActionMenuPresenter);
mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
mMenuView.setBackgroundDrawable(mSplitBackground);
mSplitView.addView(mMenuView, layoutParams);
}
}
use of android.support.v7.internal.view.menu.ActionMenuView in project TeamCityApp by vase4kin.
the class OverviewViewImpl method showPrompt.
/**
* Show prompt
*
* @param secondaryText - secondary text
* @param listener - listener to receive callback when prompt is shown
*/
private void showPrompt(@StringRes int secondaryText, final OnboardingManager.OnPromptShownListener listener) {
// Creating prompt
final Toolbar toolbar = (Toolbar) mActivity.findViewById(R.id.toolbar);
int color = ((ColorDrawable) toolbar.getBackground()).getColor();
final MaterialTapTargetPrompt.Builder promptBuilder = new MaterialTapTargetPrompt.Builder(mActivity).setPrimaryText(R.string.title_onboarding_build_menu).setSecondaryText(secondaryText).setAnimationInterpolator(new FastOutSlowInInterpolator()).setIcon(R.drawable.ic_more_vert_black_24dp).setIconDrawableTintList(ColorStateList.valueOf(color)).setBackgroundColour(color).setCaptureTouchEventOutsidePrompt(true).setPromptStateChangeListener(new MaterialTapTargetPrompt.PromptStateChangeListener() {
@Override
public void onPromptStateChanged(MaterialTapTargetPrompt prompt, int state) {
listener.onPromptShown();
}
});
// Show prompt
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
final View child = toolbar.getChildAt(2);
if (child instanceof ActionMenuView) {
final ActionMenuView actionMenuView = ((ActionMenuView) child);
promptBuilder.setTarget(actionMenuView.getChildAt(actionMenuView.getChildCount() - 1));
}
promptBuilder.show();
}
}, TIMEOUT_PROMPT);
}
use of android.support.v7.internal.view.menu.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