use of com.google.android.material.appbar.AppBarLayout in project IITB-App by wncc.
the class EventFragment method setupAppBarLayout.
/**
* Initialize app bar layout
*/
private void setupAppBarLayout() {
// Set the behavior
AppBarLayout mAppBarLayout = getView().findViewById(R.id.appBar);
((CoordinatorLayout.LayoutParams) mAppBarLayout.getLayoutParams()).setBehavior(new AppBarLayout.Behavior());
// Set offset on init
mAppBarLayout.post(() -> setAppBarOffset(appBarOffset));
// Store offset for next init
mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
if (i != 0)
appBarOffset = -i;
}
});
}
use of com.google.android.material.appbar.AppBarLayout in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class FloatingAppBarScrollingViewBehaviorTest method setAppBarLayoutTransparent_backgroundDefaultAsWhite_shouldBeTransparent.
@Test
public void setAppBarLayoutTransparent_backgroundDefaultAsWhite_shouldBeTransparent() {
mContext.setTheme(R.style.Theme_Settings_Home);
final AppBarLayout appBarLayout = new AppBarLayout(mContext);
appBarLayout.setBackgroundColor(Color.WHITE);
mScrollingViewBehavior.setAppBarLayoutTransparent(appBarLayout);
assertThat(((ColorDrawable) appBarLayout.getBackground()).getColor()).isEqualTo(Color.TRANSPARENT);
}
use of com.google.android.material.appbar.AppBarLayout in project android_packages_apps_Settings by omnirom.
the class FloatingAppBarScrollingViewBehavior method onDependentViewChanged.
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
boolean changed = super.onDependentViewChanged(parent, child, dependency);
if (!initialized && dependency instanceof AppBarLayout) {
initialized = true;
AppBarLayout appBarLayout = (AppBarLayout) dependency;
setAppBarLayoutTransparent(appBarLayout);
}
return changed;
}
use of com.google.android.material.appbar.AppBarLayout in project android_packages_apps_Settings by omnirom.
the class HomepageAppBarScrollingViewBehavior method onDependentViewChanged.
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
boolean changed = super.onDependentViewChanged(parent, child, dependency);
if (!mInitialized && dependency instanceof AppBarLayout) {
mInitialized = true;
AppBarLayout appBarLayout = (AppBarLayout) dependency;
setAppBarLayoutTransparent(appBarLayout);
}
return changed;
}
use of com.google.android.material.appbar.AppBarLayout in project android_packages_apps_Settings by omnirom.
the class HomepageAppBarScrollingViewBehaviorTest method setAppBarLayoutTransparent_backgroundDefaultAsWhite_shouldBeTransparent.
@Test
public void setAppBarLayoutTransparent_backgroundDefaultAsWhite_shouldBeTransparent() {
mContext.setTheme(R.style.Theme_Settings_Home);
final AppBarLayout appBarLayout = new AppBarLayout(mContext);
appBarLayout.setBackgroundColor(Color.WHITE);
mScrollingViewBehavior.setAppBarLayoutTransparent(appBarLayout);
assertThat(((ColorDrawable) appBarLayout.getBackground()).getColor()).isEqualTo(Color.TRANSPARENT);
}
Aggregations