Back to project page MYKey_SoftKeyboard.
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.
/* * 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; } }