Java Code Examples for android.support.design.widget.FloatingActionButton#setTag()

The following examples show how to use android.support.design.widget.FloatingActionButton#setTag() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FloatingActionMenu.java    From MaterialWpp with Apache License 2.0 6 votes vote down vote up
public void addMenuItem(FloatingActionButton item) {
    mMenuItems.add(item);
    mMenuItemAnimators.add(new ItemAnimator(item));

    TextView button = new TextView(getContext());

    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    button.setLayoutParams(params);

    button.setBackgroundResource(R.drawable.rounded_corners);

    button.setTextColor(Color.WHITE);
    button.setText(item.getContentDescription());

    Integer paddingSize = (int)button.getTextSize() / 3;

    button.setPadding(paddingSize, paddingSize, paddingSize, paddingSize);

    addView(button);
    mMenuItemLabels.add(button);
    item.setTag(button);
    item.setOnClickListener(mOnItemClickListener);
    button.setOnClickListener(mOnItemClickListener);
}
 
Example 2
Source File: FloatingActionMenu.java    From AppCompat-Extension-Library with Apache License 2.0 6 votes vote down vote up
private void createLabels() {
    Context context = new ContextThemeWrapper(getContext(), mLabelsStyle);

    for (int i = 0; i < mButtonsCount; i++) {
        FloatingActionButton button = (FloatingActionButton) getChildAt(i);
        CharSequence title = button.getContentDescription();

        if (button == mMainButton || title == null ||
                button.getTag(R.id.fab_label) != null) continue;

        LabelView label = new LabelView(context);
        label.setAnimationOffset(mMaxButtonWidth / 2f + mLabelsMargin);
        label.setTextAppearance(getContext(), mLabelsStyle);
        label.setText(title);
        addView(label);

        button.setTag(R.id.fab_label, label);
    }
}
 
Example 3
Source File: FloatingActionMenu.java    From dttv-android with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds a new menu item to the FloatingActionMenu.
 * @param item The FloatingActionButton to add to the menu.
 */
public void addMenuItem(FloatingActionButton item) {
    mMenuItems.add(item);
    mMenuItemAnimators.add(new ItemAnimator(item));

    TextView button = new TextView(getContext());

    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    button.setLayoutParams(params);

    button.setBackgroundResource(R.drawable.rounded_corners);

    button.setTextColor(Color.WHITE);
    button.setText(item.getContentDescription());

    Integer paddingSize = (int)button.getTextSize() / 3;

    button.setPadding(paddingSize, paddingSize, paddingSize, paddingSize);

    addView(button);
    mMenuItemLabels.add(button);
    item.setTag(button);
    item.setOnClickListener(mOnItemClickListener);
    button.setOnClickListener(mOnItemClickListener);
}
 
Example 4
Source File: AAH_FilterView.java    From FabulousFilter with Apache License 2.0 5 votes vote down vote up
public void init() {
    fl = new FrameLayout(getContext());
    fl.setTag("aah_fl");
    fab = new FloatingActionButton(getContext());
    fab.setTag("aah_fab");
    fab.setCompatElevation(0);
    fl.addView(fab);
    this.addView(fl);

}
 
Example 5
Source File: FloatingActionMenu.java    From AppCompat-Extension-Library with Apache License 2.0 5 votes vote down vote up
/**
 * Remove an existing FloatingActionButton from the FloatingActionMenu
 * @param button the FloatingActionButton to remove
 */
public void removeButton(FloatingActionButton button) {
    removeView((View) button.getTag(R.id.fab_label));
    removeView(button);
    button.setTag(R.id.fab_label, null);
    mButtonsCount--;
}
 
Example 6
Source File: FragmentAdapter.java    From SteamGifts with MIT License 5 votes vote down vote up
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    FloatingActionButton scrollToTopButton = (FloatingActionButton) activity.findViewById(R.id.scroll_to_top_button);
    if (scrollToTopButton != null && positionOffsetPixels != 0) {
        scrollToTopButton.hide();
        scrollToTopButton.setTag(null);
    }
}