/* * Copyright 2024 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.photopicker.features.overflowmenu import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.android.photopicker.core.configuration.PhotopickerConfiguration import com.android.photopicker.core.events.RegisteredEventClass import com.android.photopicker.core.features.FeatureManager import com.android.photopicker.core.features.FeatureRegistration import com.android.photopicker.core.features.FeatureToken import com.android.photopicker.core.features.Location import com.android.photopicker.core.features.LocationParams import com.android.photopicker.core.features.PhotopickerUiFeature import com.android.photopicker.core.features.Priority /** Feature class for the Photopicker's overflow menu. */ class OverflowMenuFeature : PhotopickerUiFeature { companion object Registration : FeatureRegistration { override val TAG: String = "PhotopickerOverflowMenuFeature" override fun isEnabled(config: PhotopickerConfiguration) = true override fun build(featureManager: FeatureManager) = OverflowMenuFeature() } override fun registerLocations(): List> { return listOf(Pair(Location.OVERFLOW_MENU, Priority.HIGH.priority)) } override val token = FeatureToken.OVERFLOW_MENU.token /** Events consumed by the OverflowMenu */ override val eventsConsumed = setOf() /** Events produced by the OverflowMenu */ override val eventsProduced = setOf() @Composable override fun compose(location: Location, modifier: Modifier, params: LocationParams) { when (location) { Location.OVERFLOW_MENU -> OverflowMenu(modifier) else -> {} } } }