Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
WindowInfoRepositoryCallbackAdapterWrapper.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package io.flutter.embedding.android;
6
7import android.app.Activity;
8import androidx.annotation.NonNull;
9import androidx.core.util.Consumer;
10import androidx.window.java.layout.WindowInfoTrackerCallbackAdapter;
11import androidx.window.layout.WindowLayoutInfo;
12import java.util.concurrent.Executor;
13
14/** Wraps {@link WindowInfoTrackerCallbackAdapter} in order to be able to mock it during testing. */
16
17 @NonNull final WindowInfoTrackerCallbackAdapter adapter;
18
20 @NonNull WindowInfoTrackerCallbackAdapter adapter) {
21 this.adapter = adapter;
22 }
23
25 @NonNull Activity activity,
26 @NonNull Executor executor,
27 @NonNull Consumer<WindowLayoutInfo> consumer) {
28 adapter.addWindowLayoutInfoListener(activity, executor, consumer);
29 }
30
31 public void removeWindowLayoutInfoListener(@NonNull Consumer<WindowLayoutInfo> consumer) {
32 adapter.removeWindowLayoutInfoListener(consumer);
33 }
34}
void addWindowLayoutInfoListener( @NonNull Activity activity, @NonNull Executor executor, @NonNull Consumer< WindowLayoutInfo > consumer)