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.app.settings.SettingsEnums;
20 import android.content.Context;
21 
22 import com.android.settings.R;
23 
24 /** A controller for handling all first day of week preferences. */
25 public class FirstDayOfWeekItemListController extends
26         RegionalPreferenceListBasePreferenceController {
27 
28     private static final String KEY_PREFERENCE_CATEGORY_FIRST_DAY_OF_WEEK_ITEM =
29             "first_day_of_week_item_category";
30     private static final String KEY_PREFERENCE_FIRST_DAY_OF_WEEK_ITEM =
31             "first_day_of_week_item_list";
32 
FirstDayOfWeekItemListController(Context context, String key)33     public FirstDayOfWeekItemListController(Context context, String key) {
34         super(context, key);
35     }
36 
37     @Override
getPreferenceTitle(String item)38     protected String getPreferenceTitle(String item) {
39         return RegionalPreferencesDataUtils.dayConverter(mContext, item);
40     }
41 
42     @Override
getPreferenceCategoryKey()43     protected String getPreferenceCategoryKey() {
44         return KEY_PREFERENCE_CATEGORY_FIRST_DAY_OF_WEEK_ITEM;
45     }
46 
47     @Override
getPreferenceKey()48     public String getPreferenceKey() {
49         return KEY_PREFERENCE_FIRST_DAY_OF_WEEK_ITEM;
50     }
51 
52     @Override
getExtensionTypes()53     protected String getExtensionTypes() {
54         return ExtensionTypes.FIRST_DAY_OF_WEEK;
55     }
56 
57     @Override
getUnitValues()58     protected String[] getUnitValues() {
59         return mContext.getResources().getStringArray(R.array.first_day_of_week);
60     }
61 
62     @Override
getMetricsActionKey()63     protected int getMetricsActionKey() {
64         return SettingsEnums.ACTION_SET_FIRST_DAY_OF_WEEK;
65     }
66 }
67