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;
}
};
}
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();
}
};
}
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();
}
};
}
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;
}
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);
}
}
Aggregations