• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.testing
17 
18 import android.content.Context
19 import android.os.Bundle
20 import androidx.fragment.app.Fragment
21 import com.android.wallpaper.model.WallpaperInfo
22 import com.android.wallpaper.module.WallpaperPreviewFragmentManager
23 import com.android.wallpaper.picker.ImagePreviewFragment
24 import com.android.wallpaper.picker.PreviewFragment
25 
26 class TestWallpaperPreviewFragmentManager : WallpaperPreviewFragmentManager {
getPreviewFragmentnull27     override fun getPreviewFragment(
28         context: Context,
29         wallpaperInfo: WallpaperInfo,
30         mode: Int,
31         viewAsHome: Boolean,
32         viewFullScreen: Boolean,
33         testingModeEnabled: Boolean
34     ): Fragment {
35         val args = Bundle()
36         args.putParcelable(PreviewFragment.ARG_WALLPAPER, wallpaperInfo)
37         args.putInt(PreviewFragment.ARG_PREVIEW_MODE, mode)
38         args.putBoolean(PreviewFragment.ARG_VIEW_AS_HOME, viewAsHome)
39         args.putBoolean(PreviewFragment.ARG_FULL_SCREEN, viewFullScreen)
40         args.putBoolean(PreviewFragment.ARG_TESTING_MODE_ENABLED, testingModeEnabled)
41         val fragment = ImagePreviewFragment()
42         fragment.arguments = args
43         return fragment
44     }
45 }
46