16e80583aSopenharmony_ci/**
26e80583aSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
36e80583aSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
46e80583aSopenharmony_ci * you may not use this file except in compliance with the License.
56e80583aSopenharmony_ci * You may obtain a copy of the License at
66e80583aSopenharmony_ci *
76e80583aSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
86e80583aSopenharmony_ci *
96e80583aSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
106e80583aSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
116e80583aSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
126e80583aSopenharmony_ci * See the License for the specific language governing permissions and
136e80583aSopenharmony_ci * limitations under the License.
146e80583aSopenharmony_ci */
156e80583aSopenharmony_ci
166e80583aSopenharmony_ci/**
176e80583aSopenharmony_ci * Setting item configuration class, read-only
186e80583aSopenharmony_ci */
196e80583aSopenharmony_ciexport class SettingItemsConfig {
206e80583aSopenharmony_ci  /**
216e80583aSopenharmony_ci   * layout options: grid or list
226e80583aSopenharmony_ci   */
236e80583aSopenharmony_ci  static readonly SETTING_ITEM_LAYOUT_OPTIONS = 'LayoutOptions';
246e80583aSopenharmony_ci
256e80583aSopenharmony_ci  /**
266e80583aSopenharmony_ci   * Setting options name
276e80583aSopenharmony_ci   */
286e80583aSopenharmony_ci  static readonly SETTING_ITEM_PHONE_GRID_LAYOUT_OPTIONS = 'PhoneGridLayOutOptions';
296e80583aSopenharmony_ci
306e80583aSopenharmony_ci  /**
316e80583aSopenharmony_ci   * Setting options name
326e80583aSopenharmony_ci   */
336e80583aSopenharmony_ci  static readonly SETTING_ITEM_PAD_GRID_LAYOUT_OPTIONS = 'PadGridLayOutOptions';
346e80583aSopenharmony_ci
356e80583aSopenharmony_ci  /**
366e80583aSopenharmony_ci   * Index: Layout settings
376e80583aSopenharmony_ci   */
386e80583aSopenharmony_ci  static readonly SETTINGS_INDEX_LAYOUT: number = 0;
396e80583aSopenharmony_ci
406e80583aSopenharmony_ci  /**
416e80583aSopenharmony_ci   * Index: grid layout
426e80583aSopenharmony_ci   */
436e80583aSopenharmony_ci  static readonly SETTINGS_INDEX_GRID_LAYOUT: number = 1;
446e80583aSopenharmony_ci
456e80583aSopenharmony_ci  /**
466e80583aSopenharmony_ci   * Applicable equipment: Not supported on all devices
476e80583aSopenharmony_ci   */
486e80583aSopenharmony_ci  static readonly DEVICE_TYPE_NULL: number = 0;
496e80583aSopenharmony_ci
506e80583aSopenharmony_ci  /**
516e80583aSopenharmony_ci   * Applicable equipment: phone support
526e80583aSopenharmony_ci   */
536e80583aSopenharmony_ci  static readonly DEVICE_TYPE_PHONE: number = 1;
546e80583aSopenharmony_ci
556e80583aSopenharmony_ci  /**
566e80583aSopenharmony_ci   * Applicable equipment: pad support
576e80583aSopenharmony_ci   */
586e80583aSopenharmony_ci  static readonly DEVICE_TYPE_PAD: number = 1 << 1;
596e80583aSopenharmony_ci
606e80583aSopenharmony_ci  /**
616e80583aSopenharmony_ci   * Applicable conditions: no restrictions
626e80583aSopenharmony_ci   */
636e80583aSopenharmony_ci  static readonly CONDITION_ALL: number = 0xffffffff;
646e80583aSopenharmony_ci
656e80583aSopenharmony_ci  /**
666e80583aSopenharmony_ci   * Applicable conditions: Valid for list layout
676e80583aSopenharmony_ci   */
686e80583aSopenharmony_ci  static readonly CONDITION_LIST_LAYOUT_ENABLE: number = 1;
696e80583aSopenharmony_ci
706e80583aSopenharmony_ci  /**
716e80583aSopenharmony_ci   * Applicable conditions: Valid for grid layout
726e80583aSopenharmony_ci   */
736e80583aSopenharmony_ci  static readonly CONDITION_GRID_LAYOUT_ENABLE: number = 1 << 1;
746e80583aSopenharmony_ci
756e80583aSopenharmony_ci  /**
766e80583aSopenharmony_ci   * setting type: Single box
776e80583aSopenharmony_ci   */
786e80583aSopenharmony_ci  static readonly SETTING_TYPE_RADIO = 1;
796e80583aSopenharmony_ci
806e80583aSopenharmony_ci  /**
816e80583aSopenharmony_ci   * setting type: switch
826e80583aSopenharmony_ci   */
836e80583aSopenharmony_ci  static readonly SETTING_TYPE_SWITCH = 2;
846e80583aSopenharmony_ci
856e80583aSopenharmony_ci  /**
866e80583aSopenharmony_ci   * hide options
876e80583aSopenharmony_ci   */
886e80583aSopenharmony_ci  static readonly HIDE_OPTIONS: boolean = false;
896e80583aSopenharmony_ci
906e80583aSopenharmony_ci  /**
916e80583aSopenharmony_ci   * show options
926e80583aSopenharmony_ci   */
936e80583aSopenharmony_ci  static readonly SHOW_OPTIONS: boolean = true;
946e80583aSopenharmony_ci
956e80583aSopenharmony_ci  /**
966e80583aSopenharmony_ci   * setting options info
976e80583aSopenharmony_ci   */
986e80583aSopenharmony_ci  static readonly sSettingsMap = {
996e80583aSopenharmony_ci    // LayoutOptions
1006e80583aSopenharmony_ci    'LayoutOptions': {
1016e80583aSopenharmony_ci      index: SettingItemsConfig.SETTINGS_INDEX_LAYOUT,
1026e80583aSopenharmony_ci      description: $r('app.string.layout_style'),
1036e80583aSopenharmony_ci      settingType: SettingItemsConfig.SETTING_TYPE_RADIO,
1046e80583aSopenharmony_ci      deviceType: SettingItemsConfig.DEVICE_TYPE_PHONE,
1056e80583aSopenharmony_ci      condition: SettingItemsConfig.CONDITION_ALL,
1066e80583aSopenharmony_ci      optionList: [
1076e80583aSopenharmony_ci        { name: 'List'},
1086e80583aSopenharmony_ci        { name: 'Grid'}
1096e80583aSopenharmony_ci      ],
1106e80583aSopenharmony_ci      isShowOptions: SettingItemsConfig.HIDE_OPTIONS
1116e80583aSopenharmony_ci    },
1126e80583aSopenharmony_ci
1136e80583aSopenharmony_ci    // PhoneGridLayOutOptions
1146e80583aSopenharmony_ci    'PhoneGridLayOutOptions': {
1156e80583aSopenharmony_ci      index: SettingItemsConfig.SETTINGS_INDEX_GRID_LAYOUT,
1166e80583aSopenharmony_ci      description: $r('app.string.launcher_layout'),
1176e80583aSopenharmony_ci      settingType: SettingItemsConfig.SETTING_TYPE_RADIO,
1186e80583aSopenharmony_ci      deviceType: SettingItemsConfig.DEVICE_TYPE_PHONE,
1196e80583aSopenharmony_ci      condition: SettingItemsConfig.CONDITION_GRID_LAYOUT_ENABLE,
1206e80583aSopenharmony_ci      optionList: [
1216e80583aSopenharmony_ci        { name: '4X4', params:{row:4, column:4}},
1226e80583aSopenharmony_ci        { name: '5X4', params:{row:5, column:4}},
1236e80583aSopenharmony_ci        { name: '6X4', params:{row:6, column:4}}
1246e80583aSopenharmony_ci      ],
1256e80583aSopenharmony_ci      isShowOptions: SettingItemsConfig.HIDE_OPTIONS
1266e80583aSopenharmony_ci    },
1276e80583aSopenharmony_ci
1286e80583aSopenharmony_ci    // PadGridLayOutOptions
1296e80583aSopenharmony_ci    'PadGridLayOutOptions': {
1306e80583aSopenharmony_ci      index: SettingItemsConfig.SETTINGS_INDEX_GRID_LAYOUT,
1316e80583aSopenharmony_ci      description: $r('app.string.launcher_layout'),
1326e80583aSopenharmony_ci      settingType: SettingItemsConfig.SETTING_TYPE_RADIO,
1336e80583aSopenharmony_ci      deviceType: SettingItemsConfig.DEVICE_TYPE_PAD,
1346e80583aSopenharmony_ci      condition: SettingItemsConfig.CONDITION_GRID_LAYOUT_ENABLE,
1356e80583aSopenharmony_ci      optionList: [
1366e80583aSopenharmony_ci        { name: '5X11', params:{row:5, column:11}},
1376e80583aSopenharmony_ci        { name: '4X10', params:{row:4, column:10}},
1386e80583aSopenharmony_ci        { name: '4X9', params:{row:4, column:9}}
1396e80583aSopenharmony_ci      ],
1406e80583aSopenharmony_ci      isShowOptions: SettingItemsConfig.HIDE_OPTIONS
1416e80583aSopenharmony_ci    },
1426e80583aSopenharmony_ci
1436e80583aSopenharmony_ci    // PhoneGestureNavigationOptions
1446e80583aSopenharmony_ci    'PhoneGestureNavigationOptions': {
1456e80583aSopenharmony_ci      index: 2,
1466e80583aSopenharmony_ci      description: $r('app.string.gesture_navigation_options'),
1476e80583aSopenharmony_ci      settingType: SettingItemsConfig.SETTING_TYPE_SWITCH,
1486e80583aSopenharmony_ci      deviceType: SettingItemsConfig.DEVICE_TYPE_PHONE,
1496e80583aSopenharmony_ci      condition: SettingItemsConfig.CONDITION_GRID_LAYOUT_ENABLE,
1506e80583aSopenharmony_ci      isShowOptions: SettingItemsConfig.SHOW_OPTIONS
1516e80583aSopenharmony_ci    },
1526e80583aSopenharmony_ci
1536e80583aSopenharmony_ci    // PadGestureNavigationOptions
1546e80583aSopenharmony_ci    'PadGestureNavigationOptions': {
1556e80583aSopenharmony_ci      index: 2,
1566e80583aSopenharmony_ci      description: $r('app.string.gesture_navigation_options'),
1576e80583aSopenharmony_ci      settingType: SettingItemsConfig.SETTING_TYPE_SWITCH,
1586e80583aSopenharmony_ci      deviceType: SettingItemsConfig.DEVICE_TYPE_PAD,
1596e80583aSopenharmony_ci      condition: SettingItemsConfig.CONDITION_GRID_LAYOUT_ENABLE,
1606e80583aSopenharmony_ci      isShowOptions: SettingItemsConfig.SHOW_OPTIONS
1616e80583aSopenharmony_ci    },
1626e80583aSopenharmony_ci  };
1636e80583aSopenharmony_ci}