1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15import { Action } from '../../../common/view/browserOperation/Action'; 16import { ActionBarProp } from '../../../common/view/browserOperation/ActionBarProp'; 17import { ActionBarMode } from '../../../common/view/browserOperation/ActionBarMode'; 18 19export class ThirdSelectBarModel { 20 createActionBar(originLeftAction: Action, originTitle: string | Resource, isMultiPick: boolean, 21 selectedCount: number, maxSelectCount: number, isSelectPhotoGrid: boolean): ActionBarProp { 22 let leftAction: Action = originLeftAction; 23 let title: string | Resource = originTitle; 24 let menuList: Action[]; 25 if (isSelectPhotoGrid == true) { 26 menuList = [Action.NAVIGATION_ALBUMS]; 27 } else { 28 if (isMultiPick && selectedCount > 0 && maxSelectCount > 0) { 29 title = ActionBarProp.getCountDetailExternalSelectedTitle(selectedCount, maxSelectCount); 30 menuList = [Action.OK]; 31 } else { 32 menuList = []; 33 } 34 } 35 36 let actionBarProp: ActionBarProp = new ActionBarProp(); 37 actionBarProp 38 .setLeftAction(leftAction) 39 .setTitle(title) 40 .setMenuList(menuList) 41 .setMode(ActionBarMode.STANDARD_MODE) 42 .setMaxSelectCount(maxSelectCount); 43 return actionBarProp; 44 } 45}