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 BeautifulRefreshLayout by android-cjj.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(null);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
if (navigationView != null) {
setupDrawerContent(navigationView);
}
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
if (viewPager != null) {
setupViewPager(viewPager);
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "I'm CJJ", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
use of android.support.design.widget.FloatingActionButton in project ProguardSnips by PrashamTrivedi.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});
}
Aggregations