Skip to content

Commit 9d86d27

Browse files
Material Design Teampaulfthomas
authored andcommitted
Internal change
PiperOrigin-RevId: 411170890
1 parent db64adb commit 9d86d27

File tree

5 files changed

+39
-39
lines changed

5 files changed

+39
-39
lines changed

catalog/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ dependencies {
1313
api 'androidx.gridlayout:gridlayout:1.0.0'
1414
api "androidx.multidex:multidex:2.0.1"
1515
api "androidx.recyclerview:recyclerview:1.2.1"
16-
api 'androidx.window:window:1.0.0-beta02'
17-
api "androidx.window:window-java:1.0.0-beta02"
16+
api 'androidx.window:window:1.0.0-beta04'
17+
api "androidx.window:window-java:1.0.0-beta04"
1818
api "androidx.preference:preference:1.1.1"
1919

2020
api 'com.google.guava:guava:27.0.1-android'

catalog/java/io/material/catalog/adaptive/AdaptiveFeedDemoActivity.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
import androidx.annotation.NonNull;
3030
import androidx.annotation.Nullable;
3131
import androidx.drawerlayout.widget.DrawerLayout;
32-
import androidx.window.java.layout.WindowInfoRepositoryCallbackAdapter;
32+
import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter;
3333
import androidx.window.layout.DisplayFeature;
3434
import androidx.window.layout.FoldingFeature;
3535
import androidx.window.layout.FoldingFeature.Orientation;
36-
import androidx.window.layout.WindowInfoRepository;
36+
import androidx.window.layout.WindowInfoTracker;
3737
import androidx.window.layout.WindowLayoutInfo;
3838
import com.google.android.material.bottomnavigation.BottomNavigationView;
3939
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
@@ -55,7 +55,7 @@ public class AdaptiveFeedDemoActivity extends DemoActivity {
5555
private ExtendedFloatingActionButton navFab;
5656
private AdaptiveFeedDemoFragment feedFragment;
5757

58-
@Nullable private WindowInfoRepositoryCallbackAdapter windowInfoRepo;
58+
@Nullable private WindowInfoTrackerCallbackAdapter windowInfoTracker;
5959
private final Consumer<WindowLayoutInfo> stateContainer = new StateContainer();
6060
private final Handler handler = new Handler(Looper.getMainLooper());
6161
private final Executor executor = command -> handler.post(() -> handler.post(command));
@@ -71,8 +71,8 @@ public View onCreateDemoView(
7171
container = view.findViewById(R.id.feed_activity_container);
7272
drawerLayout = view.findViewById(R.id.drawer_layout);
7373
modalNavDrawer = view.findViewById(R.id.modal_nav_drawer);
74-
windowInfoRepo =
75-
new WindowInfoRepositoryCallbackAdapter(WindowInfoRepository.getOrCreate(this));
74+
windowInfoTracker =
75+
new WindowInfoTrackerCallbackAdapter(WindowInfoTracker.getOrCreate(this));
7676
configuration = getResources().getConfiguration();
7777
bottomNav = view.findViewById(R.id.bottom_nav);
7878
navRail = view.findViewById(R.id.nav_rail);
@@ -107,16 +107,16 @@ protected void onCreate(@Nullable Bundle bundle) {
107107
@Override
108108
public void onStart() {
109109
super.onStart();
110-
if (windowInfoRepo != null) {
111-
windowInfoRepo.addWindowLayoutInfoListener(executor, stateContainer);
110+
if (windowInfoTracker != null) {
111+
windowInfoTracker.addWindowLayoutInfoListener(this, executor, stateContainer);
112112
}
113113
}
114114

115115
@Override
116116
public void onStop() {
117117
super.onStop();
118-
if (windowInfoRepo != null) {
119-
windowInfoRepo.removeWindowLayoutInfoListener(stateContainer);
118+
if (windowInfoTracker != null) {
119+
windowInfoTracker.removeWindowLayoutInfoListener(stateContainer);
120120
}
121121
}
122122

catalog/java/io/material/catalog/adaptive/AdaptiveListViewDemoActivity.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
import androidx.constraintlayout.widget.ConstraintSet;
3434
import androidx.constraintlayout.widget.ReactiveGuide;
3535
import androidx.drawerlayout.widget.DrawerLayout;
36-
import androidx.window.java.layout.WindowInfoRepositoryCallbackAdapter;
36+
import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter;
3737
import androidx.window.layout.DisplayFeature;
3838
import androidx.window.layout.FoldingFeature;
3939
import androidx.window.layout.FoldingFeature.Orientation;
40-
import androidx.window.layout.WindowInfoRepository;
40+
import androidx.window.layout.WindowInfoTracker;
4141
import androidx.window.layout.WindowLayoutInfo;
4242
import com.google.android.material.bottomnavigation.BottomNavigationView;
4343
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
@@ -61,7 +61,7 @@ public class AdaptiveListViewDemoActivity extends DemoActivity {
6161
private NavigationView navDrawer;
6262
private ExtendedFloatingActionButton navFab;
6363

64-
@Nullable private WindowInfoRepositoryCallbackAdapter windowInfoRepo;
64+
@Nullable private WindowInfoTrackerCallbackAdapter windowInfoTracker;
6565
private final Consumer<WindowLayoutInfo> stateContainer = new StateContainer();
6666
private final Handler handler = new Handler(Looper.getMainLooper());
6767
private final Executor executor = command -> handler.post(() -> handler.post(command));
@@ -79,8 +79,8 @@ public View onCreateDemoView(
7979
@Nullable ViewGroup viewGroup,
8080
@Nullable Bundle bundle) {
8181
View view = layoutInflater.inflate(R.layout.cat_adaptive_list_view_activity, viewGroup, false);
82-
windowInfoRepo =
83-
new WindowInfoRepositoryCallbackAdapter(WindowInfoRepository.getOrCreate(this));
82+
windowInfoTracker =
83+
new WindowInfoTrackerCallbackAdapter(WindowInfoTracker.getOrCreate(this));
8484
drawerLayout = view.findViewById(R.id.drawer_layout);
8585
constraintLayout = view.findViewById(R.id.list_view_activity_constraint_layout);
8686
modalNavDrawer = view.findViewById(R.id.modal_nav_drawer);
@@ -141,16 +141,16 @@ private void updateLandscapeLayout(int guidelinePosition, int foldWidth) {
141141
@Override
142142
public void onStart() {
143143
super.onStart();
144-
if (windowInfoRepo != null) {
145-
windowInfoRepo.addWindowLayoutInfoListener(executor, stateContainer);
144+
if (windowInfoTracker != null) {
145+
windowInfoTracker.addWindowLayoutInfoListener(this, executor, stateContainer);
146146
}
147147
}
148148

149149
@Override
150150
public void onStop() {
151151
super.onStop();
152-
if (windowInfoRepo != null) {
153-
windowInfoRepo.removeWindowLayoutInfoListener(stateContainer);
152+
if (windowInfoTracker != null) {
153+
windowInfoTracker.removeWindowLayoutInfoListener(stateContainer);
154154
}
155155
}
156156

catalog/java/io/material/catalog/adaptive/AdaptiveMusicPlayerLibraryDemoFragment.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
import android.view.ViewGroup;
2929
import androidx.annotation.NonNull;
3030
import androidx.annotation.Nullable;
31-
import androidx.window.java.layout.WindowInfoRepositoryCallbackAdapter;
31+
import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter;
3232
import androidx.window.layout.DisplayFeature;
3333
import androidx.window.layout.FoldingFeature;
34-
import androidx.window.layout.WindowInfoRepository;
34+
import androidx.window.layout.WindowInfoTracker;
3535
import androidx.window.layout.WindowLayoutInfo;
3636
import com.google.android.material.transition.Hold;
3737
import com.google.android.material.transition.MaterialContainerTransform;
@@ -44,7 +44,7 @@
4444
/** An adaptive Fragment that hosts a toolbar and a child fragment with a list of music data. */
4545
public class AdaptiveMusicPlayerLibraryDemoFragment extends MusicPlayerLibraryDemoFragment {
4646

47-
@Nullable private WindowInfoRepositoryCallbackAdapter windowInfoRepo;
47+
@Nullable private WindowInfoTrackerCallbackAdapter windowInfoTracker;
4848
private final Consumer<WindowLayoutInfo> stateContainer = new StateContainer();
4949
private final Handler handler = new Handler(Looper.getMainLooper());
5050
private final Executor executor = command -> handler.post(() -> handler.post(command));
@@ -56,25 +56,25 @@ public View onCreateView(
5656
@Nullable ViewGroup viewGroup,
5757
@Nullable Bundle bundle) {
5858
View view = layoutInflater.inflate(getDemoLayoutResId(), viewGroup, false);
59-
windowInfoRepo =
60-
new WindowInfoRepositoryCallbackAdapter(
61-
WindowInfoRepository.getOrCreate(requireActivity()));
59+
windowInfoTracker =
60+
new WindowInfoTrackerCallbackAdapter(
61+
WindowInfoTracker.getOrCreate(requireActivity()));
6262
return view;
6363
}
6464

6565
@Override
6666
public void onStart() {
6767
super.onStart();
68-
if (windowInfoRepo != null) {
69-
windowInfoRepo.addWindowLayoutInfoListener(executor, stateContainer);
68+
if (windowInfoTracker != null) {
69+
windowInfoTracker.addWindowLayoutInfoListener(this.getActivity(), executor, stateContainer);
7070
}
7171
}
7272

7373
@Override
7474
public void onStop() {
7575
super.onStop();
76-
if (windowInfoRepo != null) {
77-
windowInfoRepo.removeWindowLayoutInfoListener(stateContainer);
76+
if (windowInfoTracker != null) {
77+
windowInfoTracker.removeWindowLayoutInfoListener(stateContainer);
7878
}
7979
}
8080

catalog/java/io/material/catalog/adaptive/AdaptiveSupportingPanelDemoActivity.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
import androidx.annotation.NonNull;
3030
import androidx.annotation.Nullable;
3131
import androidx.drawerlayout.widget.DrawerLayout;
32-
import androidx.window.java.layout.WindowInfoRepositoryCallbackAdapter;
32+
import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter;
3333
import androidx.window.layout.DisplayFeature;
3434
import androidx.window.layout.FoldingFeature;
3535
import androidx.window.layout.FoldingFeature.Orientation;
36-
import androidx.window.layout.WindowInfoRepository;
36+
import androidx.window.layout.WindowInfoTracker;
3737
import androidx.window.layout.WindowLayoutInfo;
3838
import com.google.android.material.bottomnavigation.BottomNavigationView;
3939
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
@@ -54,7 +54,7 @@ public class AdaptiveSupportingPanelDemoActivity extends DemoActivity {
5454
private ExtendedFloatingActionButton navFab;
5555

5656
private AdaptiveSupportingPanelDemoFragment demoFragment;
57-
@Nullable private WindowInfoRepositoryCallbackAdapter windowInfoRepo;
57+
@Nullable private WindowInfoTrackerCallbackAdapter windowInfoTracker;
5858
private final Consumer<WindowLayoutInfo> stateContainer = new StateContainer();
5959
private final Handler handler = new Handler(Looper.getMainLooper());
6060
private final Executor executor = command -> handler.post(() -> handler.post(command));
@@ -68,8 +68,8 @@ public View onCreateDemoView(
6868
@Nullable Bundle bundle) {
6969
View view =
7070
layoutInflater.inflate(R.layout.cat_adaptive_supporting_panel_activity, viewGroup, false);
71-
windowInfoRepo =
72-
new WindowInfoRepositoryCallbackAdapter(WindowInfoRepository.getOrCreate(this));
71+
windowInfoTracker =
72+
new WindowInfoTrackerCallbackAdapter(WindowInfoTracker.getOrCreate(this));
7373
drawerLayout = view.findViewById(R.id.drawer_layout);
7474
modalNavDrawer = view.findViewById(R.id.modal_nav_drawer);
7575
bottomNav = view.findViewById(R.id.bottom_nav);
@@ -106,16 +106,16 @@ protected void onCreate(@Nullable Bundle bundle) {
106106
@Override
107107
public void onStart() {
108108
super.onStart();
109-
if (windowInfoRepo != null) {
110-
windowInfoRepo.addWindowLayoutInfoListener(executor, stateContainer);
109+
if (windowInfoTracker != null) {
110+
windowInfoTracker.addWindowLayoutInfoListener(this, executor, stateContainer);
111111
}
112112
}
113113

114114
@Override
115115
public void onStop() {
116116
super.onStop();
117-
if (windowInfoRepo != null) {
118-
windowInfoRepo.removeWindowLayoutInfoListener(stateContainer);
117+
if (windowInfoTracker != null) {
118+
windowInfoTracker.removeWindowLayoutInfoListener(stateContainer);
119119
}
120120
}
121121

0 commit comments

Comments
 (0)