Home | History | Annotate | Download | only in JAJP
      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 
     17 package jp.co.omronsoft.openwnn.JAJP;
     18 
     19 import android.content.Context;
     20 import android.preference.DialogPreference;
     21 import android.util.AttributeSet;
     22 import android.widget.Toast;
     23 import jp.co.omronsoft.openwnn.*;
     24 
     25 /**
     26  * The preference class to clear learning dictionary for Japanese IME.
     27  *
     28  * @author Copyright (C) 2009 OMRON SOFTWARE CO., LTD.  All Rights Reserved.
     29  */
     30 public class ClearLearnDictionaryDialogPreferenceJAJP extends DialogPreference {
     31     /** The context */
     32     protected Context mContext = null;
     33 
     34     /**
     35      * Constructor
     36      *
     37      * @param context   The context
     38      * @param attrs     The set of attributes
     39      */
     40     public ClearLearnDictionaryDialogPreferenceJAJP(Context context, AttributeSet attrs) {
     41         super(context, attrs);
     42         mContext = context;
     43     }
     44 
     45     /**
     46      * Constructor
     47      *
     48      * @param context   The context
     49      */
     50     public ClearLearnDictionaryDialogPreferenceJAJP(Context context) {
     51         this(context, null);
     52     }
     53 
     54     /** @see android.preference.DialogPreference#onDialogClosed */
     55     @Override protected void onDialogClosed(boolean positiveResult) {
     56         if (positiveResult) {
     57             /* clear the learning dictionary */
     58             OpenWnnEvent ev = new OpenWnnEvent(OpenWnnEvent.INITIALIZE_LEARNING_DICTIONARY, new WnnWord());
     59             OpenWnnJAJP.getInstance().onEvent(ev);
     60 
     61             /* show the message */
     62             Toast.makeText(mContext.getApplicationContext(), R.string.dialog_clear_learning_dictionary_done,
     63                            Toast.LENGTH_LONG).show();
     64         }
     65     }
     66 
     67 }
     68