Android Open Source - MYKey_SoftKeyboard Ime Preferences Activity






From Project

Back to project page MYKey_SoftKeyboard.

License

The source code is released under:

Apache License

If you think the Android project MYKey_SoftKeyboard listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (C) 2011 The Android Open Source Project
 */*ww w  .j  a va  2s  .  c  o  m*/
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ime_preferences;

import string_Key.*;
import korean_automata.*;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;

import com.android.mykey.R;
import com.android.mykey.R.*;


/**
 * Displays the IME preferences inside the input method setting.
 */
public class ImePreferencesActivity extends PreferenceActivity implements Preference.OnPreferenceChangeListener {
  
  private CheckBoxPreference mVibration = null;
  private CheckBoxPreference mSound = null;
  private Preference mStringKey = null;

  public static final String PREF_VIBRATION = "Vibration";
  public static final String PREF_SOUND = "Sound";
  public static final String PREF_STRING_KEY = "String_Key";
  
  public static final String PREF_NAME = "mykey_pref";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        addPreferencesFromResource(R.xml.setting);
        
        mVibration = (CheckBoxPreference) findPreference(PREF_VIBRATION);
        mVibration.setOnPreferenceChangeListener(this);
        
        mSound = (CheckBoxPreference) findPreference(PREF_SOUND);
        mSound.setOnPreferenceChangeListener(this);
        
        mStringKey = findPreference(PREF_STRING_KEY);
        
        Intent intent = new Intent(ImePreferencesActivity.this, StringKeyModifyActivity.class);
        mStringKey.setIntent(intent);
    }

    
    
    
  @Override
  protected void onStop() {
    super.onStop();
    
    SharedPreferences setting = getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = setting.edit();
    
    editor.putBoolean(PREF_VIBRATION, mVibration.isChecked());
    editor.putBoolean(PREF_SOUND, mSound.isChecked());
    
    editor.commit();
  }

  
  @Override
  public boolean onPreferenceChange(Preference preference, Object newValue) {
    String key = preference.getKey();
    
    if(key.equals(PREF_VIBRATION)){
      
      if(mVibration.isChecked())
        mVibration.setChecked(false);
      else
        mVibration.setChecked(true);
      
    }
    else if(key.equals(PREF_SOUND)){
      
      if(mSound.isChecked())
        mSound.setChecked(false);
      else
        mSound.setChecked(true);
    
    }
    
    return false;
  }

}




Java Source Code List

com.android.mykey.LatinKeyboardView.java
com.android.mykey.LatinKeyboard.java
com.android.mykey.SoftKeyboard.java
ime_preferences.ImePreferencesActivity.java
key_process.Buffer.java
key_process.FinalCombinationInfo.java
key_process.KeyInfo.java
key_process.KeyMap.java
key_process.KeyProcessor.java
korean_automata.CombinationState.java
korean_automata.KoreanAutomata.java
korean_automata.PhonemeCategoryConverter.java
korean_automata.Proc1.java
korean_automata.Proc2.java
korean_automata.Proc3.java
korean_automata.Proc4.java
korean_automata.StArea.java
korean_automata.StEmpty.java
korean_automata.StError.java
korean_automata.StFirstArea.java
korean_automata.StFirstVowelAndFirst.java
korean_automata.StFirstVowel.java
korean_automata.StFirst.java
korean_automata.StMultiFinal.java
korean_automata.StSingleFinalAndFirst.java
korean_automata.StSingleFinal.java
korean_automata.StVowel.java
korean_automata.VerifyComb.java
string_Key.StringKeyHandler.java
string_Key.StringKeyListAdapter.java
string_Key.StringKeyModifyActivity.java