2 * Copyright (C) 2011 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com
.android
.inputmethodcommon
;
19 import android
.content
.Context
;
20 import android
.graphics
.drawable
.Drawable
;
21 import android
.os
.Bundle
;
22 import android
.preference
.PreferenceFragment
;
25 * This is a helper class for an IME's settings preference fragment. It's recommended for every
26 * IME to have its own settings preference fragment which inherits this class.
28 public abstract class InputMethodSettingsFragment
extends PreferenceFragment
29 implements InputMethodSettingsInterface
{
30 private final InputMethodSettingsImpl mSettings
= new InputMethodSettingsImpl();
32 public void onCreate(Bundle savedInstanceState
) {
33 super.onCreate(savedInstanceState
);
34 final Context context
= getActivity();
35 setPreferenceScreen(getPreferenceManager().createPreferenceScreen(context
));
36 mSettings
.init(context
, getPreferenceScreen());
43 public void setInputMethodSettingsCategoryTitle(int resId
) {
44 mSettings
.setInputMethodSettingsCategoryTitle(resId
);
51 public void setInputMethodSettingsCategoryTitle(CharSequence title
) {
52 mSettings
.setInputMethodSettingsCategoryTitle(title
);
59 public void setSubtypeEnablerTitle(int resId
) {
60 mSettings
.setSubtypeEnablerTitle(resId
);
67 public void setSubtypeEnablerTitle(CharSequence title
) {
68 mSettings
.setSubtypeEnablerTitle(title
);
75 public void setSubtypeEnablerIcon(int resId
) {
76 mSettings
.setSubtypeEnablerIcon(resId
);
83 public void setSubtypeEnablerIcon(Drawable drawable
) {
84 mSettings
.setSubtypeEnablerIcon(drawable
);
91 public void onResume() {
93 mSettings
.updateSubtypeEnabler();