Search in sources :

Example 11 with ActionMenuView

use of android.support.v7.widget.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;
}
Also used : ViewGroup(android.view.ViewGroup) ActionMenuChildView(android.support.v7.internal.view.menu.ActionMenuView.ActionMenuChildView) View(android.view.View)

Example 12 with ActionMenuView

use of android.support.v7.widget.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);
    }
}
Also used : ViewGroup(android.view.ViewGroup) LayoutInflater(org.holoeverywhere.LayoutInflater) ActionMenuView(android.support.v7.internal.view.menu.ActionMenuView) TextView(org.holoeverywhere.widget.TextView) View(android.view.View) MenuBuilder(android.support.v7.internal.view.menu.MenuBuilder) ActionMenuPresenter(android.support.v7.internal.view.menu.ActionMenuPresenter)

Example 13 with ActionMenuView

use of android.support.v7.widget.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);
}
Also used : Handler(android.os.Handler) BindView(butterknife.BindView) View(android.view.View) ErrorView(tr.xip.errorview.ErrorView) ActionMenuView(android.support.v7.widget.ActionMenuView) RecyclerView(android.support.v7.widget.RecyclerView) ColorDrawable(android.graphics.drawable.ColorDrawable) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) MaterialTapTargetPrompt(uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt) ActionMenuView(android.support.v7.widget.ActionMenuView) Toolbar(android.support.v7.widget.Toolbar)

Example 14 with ActionMenuView

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);
                    // }
                    // });
                    }
                }
            }
        }
    }
}
Also used : EditText(android.widget.EditText) ImageButton(android.widget.ImageButton) AvatarView(im.actor.sdk.view.avatar.AvatarView) ViewGroup(android.view.ViewGroup) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ActionMenuView(android.support.v7.widget.ActionMenuView) ImageView(android.widget.ImageView) AutoCompleteTextView(android.widget.AutoCompleteTextView) ActionMenuView(android.support.v7.widget.ActionMenuView) TextView(android.widget.TextView) ActionMenuItemView(android.support.v7.view.menu.ActionMenuItemView) AvatarView(im.actor.sdk.view.avatar.AvatarView) View(android.view.View) ActionMenuItemView(android.support.v7.view.menu.ActionMenuItemView) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Aggregations

View (android.view.View)12 ActionMenuView (android.support.v7.widget.ActionMenuView)10 RecyclerView (android.support.v7.widget.RecyclerView)4 ViewGroup (android.view.ViewGroup)4 TextView (android.widget.TextView)4 ActionMenuItemView (android.support.v7.view.menu.ActionMenuItemView)3 ColorDrawable (android.graphics.drawable.ColorDrawable)2 ActionMenuPresenter (android.support.v7.internal.view.menu.ActionMenuPresenter)2 ActionMenuView (android.support.v7.internal.view.menu.ActionMenuView)2 MenuBuilder (android.support.v7.internal.view.menu.MenuBuilder)2 Animation (android.view.animation.Animation)2 TranslateAnimation (android.view.animation.TranslateAnimation)2 ImageView (android.widget.ImageView)2 BindView (butterknife.BindView)2 AccountManagerCallback (android.accounts.AccountManagerCallback)1 AccountManagerFuture (android.accounts.AccountManagerFuture)1 ObjectAnimator (android.animation.ObjectAnimator)1 SuppressLint (android.annotation.SuppressLint)1 SearchManager (android.app.SearchManager)1 Intent (android.content.Intent)1