Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 839e75c5 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

Deeplink to KeyguardQuickAffordancePickerFragment

Sets up ThemePicker deeplink fragment navigation code to go to
KeyguardQuickAffordancePickerFragment.

Bug: 258471384
Test: see other CLs in this topic for testing details
Change-Id: Iae005899fc714b1892399512ed07cfc78110a9f2
parent 218bdcd1
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.android.customization.module

import androidx.fragment.app.Fragment
import com.android.customization.picker.quickaffordance.ui.fragment.KeyguardQuickAffordancePickerFragment
import com.android.wallpaper.module.FragmentFactory

class ThemePickerFragmentFactory : FragmentFactory {

    override fun create(id: String): Fragment? {
        return when (id) {
            KeyguardQuickAffordancePickerFragment.DESTINATION_ID ->
                KeyguardQuickAffordancePickerFragment.newInstance()
            else -> null
        }
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import com.android.systemui.shared.quickaffordance.data.content.KeyguardQuickAff
import com.android.wallpaper.model.LiveWallpaperInfo;
import com.android.wallpaper.model.WallpaperInfo;
import com.android.wallpaper.module.CustomizationSections;
import com.android.wallpaper.module.FragmentFactory;
import com.android.wallpaper.module.WallpaperPicker2Injector;
import com.android.wallpaper.module.WallpaperPreferences;
import com.android.wallpaper.picker.CustomizationPickerActivity;
@@ -61,6 +62,7 @@ public class ThemePickerInjector extends WallpaperPicker2Injector
    private KeyguardQuickAffordancePickerInteractor mKeyguardQuickAffordancePickerInteractor;
    private KeyguardQuickAffordancePickerViewModel.Factory
            mKeyguardQuickAffordancePickerViewModelFactory;
    private FragmentFactory mFragmentFactory;

    @Override
    public CustomizationSections getCustomizationSections(Activity activity) {
@@ -160,4 +162,12 @@ public class ThemePickerInjector extends WallpaperPicker2Injector
        }
        return mKeyguardQuickAffordancePickerViewModelFactory;
    }

    @Override
    public FragmentFactory getFragmentFactory() {
        if (mFragmentFactory == null) {
            mFragmentFactory = new ThemePickerFragmentFactory();
        }
        return mFragmentFactory;
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import com.android.wallpaper.picker.AppbarFragment

class KeyguardQuickAffordancePickerFragment : AppbarFragment() {
    companion object {
        const val DESTINATION_ID = "quick_affordances"
        @JvmStatic
        fun newInstance(): KeyguardQuickAffordancePickerFragment {
            return KeyguardQuickAffordancePickerFragment()
        }