From f0303a2cbc6a197549105f2e2d8e2a6be133b767 Mon Sep 17 00:00:00 2001 From: "Wallace.Wang" Date: Thu, 12 Nov 2009 14:00:13 +0800 Subject: [PATCH] Add keyboard layout setting Change-Id: I8c1b7689c96c07676abf0653388940273e4aa935 --- AndroidManifest.xml | 9 ++++ res/layout/keyboard_picker.xml | 21 +++++++++ res/layout/keyboard_picker_item.xml | 27 +++++++++++ res/values/strings.xml | 2 + res/xml/language_settings.xml | 6 +++ src/com/android/settings/KeyboardPicker.java | 68 ++++++++++++++++++++++++++++ 6 files changed, 133 insertions(+) create mode 100644 res/layout/keyboard_picker.xml create mode 100644 res/layout/keyboard_picker_item.xml create mode 100644 src/com/android/settings/KeyboardPicker.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 78c0f5b354..7d298497b8 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -237,6 +237,15 @@ + + + + + + + + + + + + + + + + diff --git a/res/layout/keyboard_picker_item.xml b/res/layout/keyboard_picker_item.xml new file mode 100644 index 0000000000..11e28b4151 --- /dev/null +++ b/res/layout/keyboard_picker_item.xml @@ -0,0 +1,27 @@ + + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 054ed6cc4e..e1deff1c3b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2531,4 +2531,6 @@ found in the list of installed applications. SoftKeyBoard Enable Enable SoftKeyBoard + Keyboard layout setting + Choose a keyboard layout diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml index d3c0e02d13..37256db9f6 100644 --- a/res/xml/language_settings.xml +++ b/res/xml/language_settings.xml @@ -25,6 +25,12 @@ android:targetClass="com.android.settings.LocalePicker"/> + + + + diff --git a/src/com/android/settings/KeyboardPicker.java b/src/com/android/settings/KeyboardPicker.java new file mode 100644 index 0000000000..751a57202d --- /dev/null +++ b/src/com/android/settings/KeyboardPicker.java @@ -0,0 +1,68 @@ +package com.android.settings; + +import java.util.ArrayList; +import java.util.List; + +import android.app.ListActivity; +import android.os.Bundle; +import android.os.SystemProperties; +import android.util.Log; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.Toast; + +public class KeyboardPicker extends ListActivity{ + int getContentView() { + return R.layout.keyboard_picker; + } + + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + setContentView(getContentView()); + int layoutId = R.layout.keyboard_picker_item; + int fieldId = R.id.keyboard; + List mKeyboardLayout = new ArrayList(); + mKeyboardLayout.add("American(Standard keyboard)"); + mKeyboardLayout.add("Finnish"); + mKeyboardLayout.add("French"); + mKeyboardLayout.add("German"); + mKeyboardLayout.add("Ireland"); + mKeyboardLayout.add("Russia"); + mKeyboardLayout.add("Spanish(Latin America)"); + + + ArrayAdapter adapter = + new ArrayAdapter(this, layoutId, fieldId, mKeyboardLayout); + getListView().setAdapter(adapter); + } + @Override + protected void onListItemClick(ListView l, View v, int position, long id) { + switch(position){ + case 1: + SystemProperties.set("persist.sys.keylayout","fn"); + break; + case 2: + SystemProperties.set("persist.sys.keylayout","fr"); + break; + case 3: + SystemProperties.set("persist.sys.keylayout","de"); + break; + case 4: + SystemProperties.set("persist.sys.keylayout","Ireland"); + break; + case 5: + SystemProperties.set("persist.sys.keylayout","ru"); + break; + case 6: + SystemProperties.set("persist.sys.keylayout","spanish_latin"); + break; + default: + SystemProperties.set("persist.sys.keylayout","qwerty"); + break; + } + + Toast.makeText(this, "Please reboot your machine to enable the new keyboard layout.", Toast.LENGTH_LONG).show(); + } +} -- 2.11.0