blob: b59b853693e257d3f5f1d98a0afa4ec9f80996bb [file] [log] [blame]
Chuck Liao540fb752021-06-22 01:27:10 +08001/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.android.wallpaper.picker;
17
18import com.android.wallpaper.model.CustomizationSectionController;
19import com.android.wallpaper.model.WallpaperSectionController;
20
21import java.util.List;
22import java.util.stream.Collectors;
23
24/** The Fragment UI for wallpaper only section. */
25public class WallpaperOnlyFragment extends CustomizationPickerFragment {
26
27 /** Initiates WallpaperOnlyFragment instance. */
28 public static WallpaperOnlyFragment newInstance(CharSequence title) {
29 WallpaperOnlyFragment fragment = new WallpaperOnlyFragment();
30 fragment.setArguments(AppbarFragment.createArguments(title));
31 return fragment;
32 }
33
34 @Override
35 protected List<CustomizationSectionController<?>> getAvailableSections(
36 List<CustomizationSectionController<?>> controllers) {
37 List<CustomizationSectionController<?>> wallpaperOnlySections = controllers.stream()
38 .filter(controller -> controller instanceof WallpaperSectionController)
39 .collect(Collectors.toList());
40 return super.getAvailableSections(wallpaperOnlySections);
41 }
42}