• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (C) 2023 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 
17 package com.android.settings.regionalpreferences;
18 
19 import android.content.Context;
20 
21 import com.android.settings.R;
22 
23 /** A controller for handling all first day of week preferences. */
24 public class FirstDayOfWeekItemListController extends
25         RegionalPreferenceListBasePreferenceController {
26 
27     private static final String KEY_PREFERENCE_CATEGORY_FIRST_DAY_OF_WEEK_ITEM =
28             "first_day_of_week_item_category";
29     private static final String KEY_PREFERENCE_FIRST_DAY_OF_WEEK_ITEM =
30             "first_day_of_week_item_list";
31 
FirstDayOfWeekItemListController(Context context, String key)32     public FirstDayOfWeekItemListController(Context context, String key) {
33         super(context, key);
34     }
35 
36     @Override
getPreferenceTitle(String item)37     protected String getPreferenceTitle(String item) {
38         return RegionalPreferencesDataUtils.dayConverter(mContext, item);
39     }
40 
41     @Override
getPreferenceCategoryKey()42     protected String getPreferenceCategoryKey() {
43         return KEY_PREFERENCE_CATEGORY_FIRST_DAY_OF_WEEK_ITEM;
44     }
45 
46     @Override
getPreferenceKey()47     public String getPreferenceKey() {
48         return KEY_PREFERENCE_FIRST_DAY_OF_WEEK_ITEM;
49     }
50 
51     @Override
getExtensionTypes()52     protected String getExtensionTypes() {
53         return ExtensionTypes.FIRST_DAY_OF_WEEK;
54     }
55 
56     @Override
getUnitValues()57     protected String[] getUnitValues() {
58         return mContext.getResources().getStringArray(R.array.first_day_of_week);
59     }
60 }
61