1/*
2 * Copyright (C) 2008-2012  OMRON SOFTWARE Co., Ltd.
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
17package jp.co.omronsoft.openwnn.JAJP;
18
19import jp.co.omronsoft.openwnn.*;
20import android.content.Context;
21import android.preference.ListPreference;
22import android.util.AttributeSet;
23
24/**
25 * The preference class of keyboard image list for Japanese IME.
26 * This class notices to {@code OpenWnnJAJP} that the keyboard image is changed.
27 *
28 * @author Copyright (C) 2009, OMRON SOFTWARE CO., LTD.
29 */
30public class KeyboardListPreferenceJAJP extends ListPreference {
31
32	public KeyboardListPreferenceJAJP(Context context, AttributeSet attrs) {
33        super(context, attrs);
34    }
35
36    public KeyboardListPreferenceJAJP(Context context) {
37        this(context, null);
38    }
39
40    /** @see android.preference.DialogPreference#onDialogClosed */
41    @Override protected void onDialogClosed(boolean positiveResult) {
42    	super.onDialogClosed(positiveResult);
43
44    	if (positiveResult) {
45    		OpenWnnJAJP wnn = OpenWnnJAJP.getInstance();
46        	int code = OpenWnnEvent.CHANGE_INPUT_VIEW;
47        	OpenWnnEvent ev = new OpenWnnEvent(code);
48        	try {
49        		wnn.onEvent(ev);
50        	} catch (Exception ex) {
51        	}
52    	}
53    }
54}
55