1 /*
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  */
16 package com.android.wallpaper.picker;
17 
18 import com.android.wallpaper.R;
19 import com.android.wallpaper.model.CustomizationSectionController;
20 import com.android.wallpaper.model.WallpaperSectionController;
21 
22 import java.util.List;
23 import java.util.stream.Collectors;
24 
25 /** The Fragment UI for wallpaper only section. */
26 public class WallpaperOnlyFragment extends CustomizationPickerFragment {
27 
28     @Override
getDefaultTitle()29     public CharSequence getDefaultTitle() {
30         return getString(R.string.wallpaper_app_name);
31     }
32 
33     @Override
getAvailableSections( List<CustomizationSectionController<?>> controllers)34     protected List<CustomizationSectionController<?>> getAvailableSections(
35             List<CustomizationSectionController<?>> controllers) {
36         List<CustomizationSectionController<?>> wallpaperOnlySections = controllers.stream()
37                 .filter(controller -> controller instanceof WallpaperSectionController)
38                 .collect(Collectors.toList());
39         return super.getAvailableSections(wallpaperOnlySections);
40     }
41 }
42