Search in sources :

Example 56 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project material-components-android by material-components.

the class TestUtilsMatchers method withFabContentHeight.

/** Returns a matcher that matches FloatingActionButtons with the specified content height */
public static Matcher withFabContentHeight(final int size) {
    return new BoundedMatcher<View, View>(View.class) {

        private String failedCheckDescription;

        @Override
        public void describeTo(final Description description) {
            description.appendText(failedCheckDescription);
        }

        @Override
        public boolean matchesSafely(final View view) {
            if (!(view instanceof FloatingActionButton)) {
                return false;
            }
            final FloatingActionButton fab = (FloatingActionButton) view;
            final Rect area = new Rect();
            fab.getContentRect(area);
            return area.height() == size;
        }
    };
}
Also used : Rect(android.graphics.Rect) Description(org.hamcrest.Description) FloatingActionButton(android.support.design.widget.FloatingActionButton) BoundedMatcher(android.support.test.espresso.matcher.BoundedMatcher) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Example 57 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project material-components-android by material-components.

the class FloatingActionButtonActions method setBackgroundTintList.

public static ViewAction setBackgroundTintList(@ColorInt final ColorStateList tint) {
    return new ViewAction() {

        @Override
        public Matcher<View> getConstraints() {
            return isAssignableFrom(FloatingActionButton.class);
        }

        @Override
        public String getDescription() {
            return "Sets FloatingActionButton background tint";
        }

        @Override
        public void perform(UiController uiController, View view) {
            uiController.loopMainThreadUntilIdle();
            final FloatingActionButton fab = (FloatingActionButton) view;
            fab.setBackgroundTintList(tint);
            uiController.loopMainThreadUntilIdle();
        }
    };
}
Also used : ViewAction(android.support.test.espresso.ViewAction) UiController(android.support.test.espresso.UiController) FloatingActionButton(android.support.design.widget.FloatingActionButton) View(android.view.View)

Example 58 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project material-components-android by material-components.

the class FloatingActionButtonActions method setCompatElevation.

public static ViewAction setCompatElevation(final float size) {
    return new ViewAction() {

        @Override
        public Matcher<View> getConstraints() {
            return isAssignableFrom(FloatingActionButton.class);
        }

        @Override
        public String getDescription() {
            return "Sets FloatingActionButton elevation";
        }

        @Override
        public void perform(UiController uiController, View view) {
            uiController.loopMainThreadUntilIdle();
            final FloatingActionButton fab = (FloatingActionButton) view;
            fab.setCompatElevation(size);
            uiController.loopMainThreadUntilIdle();
        }
    };
}
Also used : ViewAction(android.support.test.espresso.ViewAction) UiController(android.support.test.espresso.UiController) FloatingActionButton(android.support.design.widget.FloatingActionButton) View(android.view.View)

Example 59 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project FlexibleAdapter by davideas.

the class FragmentStaggeredLayout method addItem.

private int addItem(StaggeredItemStatus status, StaggeredHeaderItem headerItem) {
    StaggeredItem staggeredItem = DatabaseService.newStaggeredItem(DatabaseService.getInstance().getMaxStaggeredId(), headerItem);
    //!!!
    staggeredItem.setStatus(status);
    // The section object is known
    mAdapter.addItemToSection(staggeredItem, staggeredItem.getHeader(), new DatabaseService.ItemComparatorByGroup());
    // Add Item to the Database as well for next refresh
    DatabaseService.getInstance().addItem(staggeredItem, new DatabaseService.ItemComparatorById());
    // Change fab action (MOVE ITEM)
    if (mAdapter.getItemCountOfTypes(R.layout.recycler_staggered_item) >= 15) {
        FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
        fab.setImageResource(R.drawable.ic_sort_white_24dp);
    }
    // Retrieve the final position due to a possible hidden header became now visible!
    int scrollTo = mAdapter.getGlobalPositionOf(staggeredItem);
    Log.d(TAG, "Creating New Item " + staggeredItem + " at position " + scrollTo);
    return scrollTo;
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) DatabaseService(eu.davidea.samples.flexibleadapter.services.DatabaseService) StaggeredItem(eu.davidea.samples.flexibleadapter.items.StaggeredItem)

Example 60 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project cameraview by google.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mCameraView = (CameraView) findViewById(R.id.camera);
    if (mCameraView != null) {
        mCameraView.addCallback(mCallback);
    }
    FloatingActionButton takePicture = (FloatingActionButton) findViewById(R.id.take_picture);
    if (takePicture != null) {
        takePicture.setOnClickListener(mOnClickListener);
    }
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
    }
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

FloatingActionButton (android.support.design.widget.FloatingActionButton)84 View (android.view.View)58 Toolbar (android.support.v7.widget.Toolbar)28 TextView (android.widget.TextView)20 ImageView (android.widget.ImageView)16 Intent (android.content.Intent)13 RecyclerView (android.support.v7.widget.RecyclerView)12 ColorStateList (android.content.res.ColorStateList)9 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9 Bundle (android.os.Bundle)7 NavigationView (android.support.design.widget.NavigationView)7 TabLayout (android.support.design.widget.TabLayout)7 ViewPager (android.support.v4.view.ViewPager)7 ActionBar (android.support.v7.app.ActionBar)7 UiController (android.support.test.espresso.UiController)6 ViewAction (android.support.test.espresso.ViewAction)6 AdapterView (android.widget.AdapterView)6 ListView (android.widget.ListView)5 DrawerLayout (android.support.v4.widget.DrawerLayout)4 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)4