• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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.car.developeroptions.inputmethod;
18 
19 import android.app.settings.SettingsEnums;
20 import android.content.Context;
21 import android.hardware.input.InputDeviceIdentifier;
22 
23 import com.android.car.developeroptions.R;
24 import com.android.car.developeroptions.dashboard.DashboardFragment;
25 
26 
27 public class KeyboardLayoutPickerFragment extends DashboardFragment {
28 
29     private static final String TAG = "KeyboardLayoutPicker";
30 
31     /**
32      * Intent extra: The input device descriptor of the keyboard whose keyboard
33      * layout is to be changed.
34      */
35     public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
36 
37     @Override
getMetricsCategory()38     public int getMetricsCategory() {
39         return SettingsEnums.INPUTMETHOD_KEYBOARD;
40     }
41 
42     @Override
onAttach(Context context)43     public void onAttach(Context context) {
44         super.onAttach(context);
45 
46         final InputDeviceIdentifier inputDeviceIdentifier = getActivity().getIntent().
47                 getParcelableExtra(EXTRA_INPUT_DEVICE_IDENTIFIER);
48         if (inputDeviceIdentifier == null) {
49             getActivity().finish();
50         }
51 
52         use(KeyboardLayoutPickerController.class).initialize(this /*parent*/,
53                 inputDeviceIdentifier);
54     }
55 
56     @Override
getLogTag()57     protected String getLogTag() {
58         return TAG;
59     }
60 
getPreferenceScreenResId()61     protected int getPreferenceScreenResId() {
62         return R.xml.keyboard_layout_picker_fragment;
63     }
64 }
65