Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 411170890
  • Loading branch information
Material Design Team authored and paulfthomas committed Nov 29, 2021
1 parent db64adb commit 9d86d27
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions catalog/build.gradle
Expand Up @@ -13,8 +13,8 @@ dependencies {
api 'androidx.gridlayout:gridlayout:1.0.0'
api "androidx.multidex:multidex:2.0.1"
api "androidx.recyclerview:recyclerview:1.2.1"
api 'androidx.window:window:1.0.0-beta02'
api "androidx.window:window-java:1.0.0-beta02"
api 'androidx.window:window:1.0.0-beta04'
api "androidx.window:window-java:1.0.0-beta04"
api "androidx.preference:preference:1.1.1"

api 'com.google.guava:guava:27.0.1-android'
Expand Down
Expand Up @@ -29,11 +29,11 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.window.java.layout.WindowInfoRepositoryCallbackAdapter;
import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter;
import androidx.window.layout.DisplayFeature;
import androidx.window.layout.FoldingFeature;
import androidx.window.layout.FoldingFeature.Orientation;
import androidx.window.layout.WindowInfoRepository;
import androidx.window.layout.WindowInfoTracker;
import androidx.window.layout.WindowLayoutInfo;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
Expand All @@ -55,7 +55,7 @@ public class AdaptiveFeedDemoActivity extends DemoActivity {
private ExtendedFloatingActionButton navFab;
private AdaptiveFeedDemoFragment feedFragment;

@Nullable private WindowInfoRepositoryCallbackAdapter windowInfoRepo;
@Nullable private WindowInfoTrackerCallbackAdapter windowInfoTracker;
private final Consumer<WindowLayoutInfo> stateContainer = new StateContainer();
private final Handler handler = new Handler(Looper.getMainLooper());
private final Executor executor = command -> handler.post(() -> handler.post(command));
Expand All @@ -71,8 +71,8 @@ public View onCreateDemoView(
container = view.findViewById(R.id.feed_activity_container);
drawerLayout = view.findViewById(R.id.drawer_layout);
modalNavDrawer = view.findViewById(R.id.modal_nav_drawer);
windowInfoRepo =
new WindowInfoRepositoryCallbackAdapter(WindowInfoRepository.getOrCreate(this));
windowInfoTracker =
new WindowInfoTrackerCallbackAdapter(WindowInfoTracker.getOrCreate(this));
configuration = getResources().getConfiguration();
bottomNav = view.findViewById(R.id.bottom_nav);
navRail = view.findViewById(R.id.nav_rail);
Expand Down Expand Up @@ -107,16 +107,16 @@ protected void onCreate(@Nullable Bundle bundle) {
@Override
public void onStart() {
super.onStart();
if (windowInfoRepo != null) {
windowInfoRepo.addWindowLayoutInfoListener(executor, stateContainer);
if (windowInfoTracker != null) {
windowInfoTracker.addWindowLayoutInfoListener(this, executor, stateContainer);
}
}

@Override
public void onStop() {
super.onStop();
if (windowInfoRepo != null) {
windowInfoRepo.removeWindowLayoutInfoListener(stateContainer);
if (windowInfoTracker != null) {
windowInfoTracker.removeWindowLayoutInfoListener(stateContainer);
}
}

Expand Down
Expand Up @@ -33,11 +33,11 @@
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.ReactiveGuide;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.window.java.layout.WindowInfoRepositoryCallbackAdapter;
import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter;
import androidx.window.layout.DisplayFeature;
import androidx.window.layout.FoldingFeature;
import androidx.window.layout.FoldingFeature.Orientation;
import androidx.window.layout.WindowInfoRepository;
import androidx.window.layout.WindowInfoTracker;
import androidx.window.layout.WindowLayoutInfo;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
Expand All @@ -61,7 +61,7 @@ public class AdaptiveListViewDemoActivity extends DemoActivity {
private NavigationView navDrawer;
private ExtendedFloatingActionButton navFab;

@Nullable private WindowInfoRepositoryCallbackAdapter windowInfoRepo;
@Nullable private WindowInfoTrackerCallbackAdapter windowInfoTracker;
private final Consumer<WindowLayoutInfo> stateContainer = new StateContainer();
private final Handler handler = new Handler(Looper.getMainLooper());
private final Executor executor = command -> handler.post(() -> handler.post(command));
Expand All @@ -79,8 +79,8 @@ public View onCreateDemoView(
@Nullable ViewGroup viewGroup,
@Nullable Bundle bundle) {
View view = layoutInflater.inflate(R.layout.cat_adaptive_list_view_activity, viewGroup, false);
windowInfoRepo =
new WindowInfoRepositoryCallbackAdapter(WindowInfoRepository.getOrCreate(this));
windowInfoTracker =
new WindowInfoTrackerCallbackAdapter(WindowInfoTracker.getOrCreate(this));
drawerLayout = view.findViewById(R.id.drawer_layout);
constraintLayout = view.findViewById(R.id.list_view_activity_constraint_layout);
modalNavDrawer = view.findViewById(R.id.modal_nav_drawer);
Expand Down Expand Up @@ -141,16 +141,16 @@ private void updateLandscapeLayout(int guidelinePosition, int foldWidth) {
@Override
public void onStart() {
super.onStart();
if (windowInfoRepo != null) {
windowInfoRepo.addWindowLayoutInfoListener(executor, stateContainer);
if (windowInfoTracker != null) {
windowInfoTracker.addWindowLayoutInfoListener(this, executor, stateContainer);
}
}

@Override
public void onStop() {
super.onStop();
if (windowInfoRepo != null) {
windowInfoRepo.removeWindowLayoutInfoListener(stateContainer);
if (windowInfoTracker != null) {
windowInfoTracker.removeWindowLayoutInfoListener(stateContainer);
}
}

Expand Down
Expand Up @@ -28,10 +28,10 @@
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.window.java.layout.WindowInfoRepositoryCallbackAdapter;
import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter;
import androidx.window.layout.DisplayFeature;
import androidx.window.layout.FoldingFeature;
import androidx.window.layout.WindowInfoRepository;
import androidx.window.layout.WindowInfoTracker;
import androidx.window.layout.WindowLayoutInfo;
import com.google.android.material.transition.Hold;
import com.google.android.material.transition.MaterialContainerTransform;
Expand All @@ -44,7 +44,7 @@
/** An adaptive Fragment that hosts a toolbar and a child fragment with a list of music data. */
public class AdaptiveMusicPlayerLibraryDemoFragment extends MusicPlayerLibraryDemoFragment {

@Nullable private WindowInfoRepositoryCallbackAdapter windowInfoRepo;
@Nullable private WindowInfoTrackerCallbackAdapter windowInfoTracker;
private final Consumer<WindowLayoutInfo> stateContainer = new StateContainer();
private final Handler handler = new Handler(Looper.getMainLooper());
private final Executor executor = command -> handler.post(() -> handler.post(command));
Expand All @@ -56,25 +56,25 @@ public View onCreateView(
@Nullable ViewGroup viewGroup,
@Nullable Bundle bundle) {
View view = layoutInflater.inflate(getDemoLayoutResId(), viewGroup, false);
windowInfoRepo =
new WindowInfoRepositoryCallbackAdapter(
WindowInfoRepository.getOrCreate(requireActivity()));
windowInfoTracker =
new WindowInfoTrackerCallbackAdapter(
WindowInfoTracker.getOrCreate(requireActivity()));
return view;
}

@Override
public void onStart() {
super.onStart();
if (windowInfoRepo != null) {
windowInfoRepo.addWindowLayoutInfoListener(executor, stateContainer);
if (windowInfoTracker != null) {
windowInfoTracker.addWindowLayoutInfoListener(this.getActivity(), executor, stateContainer);
}
}

@Override
public void onStop() {
super.onStop();
if (windowInfoRepo != null) {
windowInfoRepo.removeWindowLayoutInfoListener(stateContainer);
if (windowInfoTracker != null) {
windowInfoTracker.removeWindowLayoutInfoListener(stateContainer);
}
}

Expand Down
Expand Up @@ -29,11 +29,11 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.window.java.layout.WindowInfoRepositoryCallbackAdapter;
import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter;
import androidx.window.layout.DisplayFeature;
import androidx.window.layout.FoldingFeature;
import androidx.window.layout.FoldingFeature.Orientation;
import androidx.window.layout.WindowInfoRepository;
import androidx.window.layout.WindowInfoTracker;
import androidx.window.layout.WindowLayoutInfo;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
Expand All @@ -54,7 +54,7 @@ public class AdaptiveSupportingPanelDemoActivity extends DemoActivity {
private ExtendedFloatingActionButton navFab;

private AdaptiveSupportingPanelDemoFragment demoFragment;
@Nullable private WindowInfoRepositoryCallbackAdapter windowInfoRepo;
@Nullable private WindowInfoTrackerCallbackAdapter windowInfoTracker;
private final Consumer<WindowLayoutInfo> stateContainer = new StateContainer();
private final Handler handler = new Handler(Looper.getMainLooper());
private final Executor executor = command -> handler.post(() -> handler.post(command));
Expand All @@ -68,8 +68,8 @@ public View onCreateDemoView(
@Nullable Bundle bundle) {
View view =
layoutInflater.inflate(R.layout.cat_adaptive_supporting_panel_activity, viewGroup, false);
windowInfoRepo =
new WindowInfoRepositoryCallbackAdapter(WindowInfoRepository.getOrCreate(this));
windowInfoTracker =
new WindowInfoTrackerCallbackAdapter(WindowInfoTracker.getOrCreate(this));
drawerLayout = view.findViewById(R.id.drawer_layout);
modalNavDrawer = view.findViewById(R.id.modal_nav_drawer);
bottomNav = view.findViewById(R.id.bottom_nav);
Expand Down Expand Up @@ -106,16 +106,16 @@ protected void onCreate(@Nullable Bundle bundle) {
@Override
public void onStart() {
super.onStart();
if (windowInfoRepo != null) {
windowInfoRepo.addWindowLayoutInfoListener(executor, stateContainer);
if (windowInfoTracker != null) {
windowInfoTracker.addWindowLayoutInfoListener(this, executor, stateContainer);
}
}

@Override
public void onStop() {
super.onStop();
if (windowInfoRepo != null) {
windowInfoRepo.removeWindowLayoutInfoListener(stateContainer);
if (windowInfoTracker != null) {
windowInfoTracker.removeWindowLayoutInfoListener(stateContainer);
}
}

Expand Down

0 comments on commit 9d86d27

Please sign in to comment.