Add a typeFace element and a symbol's color element
- add default bold theme - add Change-Id: Ie3f31a6973c12e7f8b885d0036f50e8647c9fe82
This commit is contained in:
parent
cd61cadb71
commit
6c20ab55b5
12 changed files with 101 additions and 18 deletions
|
@ -21,7 +21,7 @@
|
|||
<com.android.inputmethod.latin.LatinKeyboardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
|
||||
android:id="@android:id/keyboardView"
|
||||
android:id="@+id/LatinkeyboardBaseView"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
|
@ -22,7 +22,7 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
|
||||
|
||||
android:id="@android:id/keyboardView"
|
||||
android:id="@+id/LatinkeyboardBaseView"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
38
java/res/layout/input_stone_bold.xml
Executable file
38
java/res/layout/input_stone_bold.xml
Executable file
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
**
|
||||
** Copyright 2010, The Android Open Source Project
|
||||
**
|
||||
** 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<com.android.inputmethod.latin.LatinKeyboardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
|
||||
android:id="@+id/LatinkeyboardBaseView"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/keyboard_background"
|
||||
android:textStyle="bold"
|
||||
|
||||
latin:keyBackground="@drawable/btn_keyboard_key_ginger"
|
||||
latin:keyTextSize="22dip"
|
||||
latin:keyTextColor="@color/latinkeyboard_key_color_black"
|
||||
latin:shadowColor="@color/latinkeyboard_key_color_white"
|
||||
latin:keyTextStyle="bold"
|
||||
latin:symbolColorScheme="black"
|
||||
latin:popupLayout="@layout/input_stone_popup"
|
||||
/>
|
|
@ -31,5 +31,6 @@
|
|||
latin:keyTextSize="22dip"
|
||||
latin:keyTextColor="@color/latinkeyboard_key_color_black"
|
||||
latin:shadowColor="@color/latinkeyboard_key_color_white"
|
||||
latin:popupLayout="@layout/input7_popup"
|
||||
latin:symbolColorScheme="black"
|
||||
latin:popupLayout="@layout/input_stone_popup"
|
||||
/>
|
|
@ -25,10 +25,9 @@
|
|||
android:orientation="horizontal"
|
||||
android:background="@drawable/keyboard_popup_panel_background"
|
||||
>
|
||||
<com.android.inputmethod.latin.LatinKeyboardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.android.inputmethod.latin.LatinKeyboardBaseView
|
||||
xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
|
||||
android:id="@android:id/keyboardView"
|
||||
android:id="@+id/LatinKeyboardBaseView"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -38,9 +37,9 @@
|
|||
latin:keyTextColor="@color/latinkeyboard_key_color_black"
|
||||
latin:shadowColor="@color/latinkeyboard_key_color_white"
|
||||
latin:keyTextSize="22dip"
|
||||
latin:popupLayout="@layout/input7_popup"
|
||||
latin:popupLayout="@layout/input_stone_popup"
|
||||
/>
|
||||
<ImageButton android:id="@android:id/closeButton"
|
||||
<ImageButton android:id="@+id/closeButton"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@drawable/btn_close"
|
||||
android:layout_width="wrap_content"
|
|
@ -52,6 +52,18 @@
|
|||
<attr name="shadowColor" format="color" />
|
||||
<attr name="shadowRadius" format="float" />
|
||||
<attr name="backgroundDimAmount" format="float" />
|
||||
|
||||
<attr name="keyTextStyle">
|
||||
<flag name="normal" value="0" />
|
||||
<flag name="bold" value="1" />
|
||||
<flag name="italic" value="2" />
|
||||
</attr>
|
||||
|
||||
<attr name="symbolColorScheme">
|
||||
<flag name="white" value="0" />
|
||||
<flag name="black" value="1" />
|
||||
</attr>
|
||||
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -332,18 +332,21 @@
|
|||
<string name="keyboard_layout">Keyboard Theme</string>
|
||||
<string name="layout_basic" translatable="false">Basic</string>
|
||||
<string name="layout_high_contrast" translatable="false">Basic (High Contrast)</string>
|
||||
<string name="layout_stone" translatable="false">Default</string>
|
||||
<string name="layout_stone_bold" translatable="false">Default (bold)</string>
|
||||
<string name="layout_stone_normal" translatable="false">Default (normal)</string>
|
||||
|
||||
<string-array name="keyboard_layout_modes" translatable="false">
|
||||
<item>@string/layout_basic</item>
|
||||
<item>@string/layout_high_contrast</item>
|
||||
<item>@string/layout_stone</item>
|
||||
<item>@string/layout_stone_normal</item>
|
||||
<item>@string/layout_stone_bold</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="keyboard_layout_modes_values" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
<string name="prefs_debug_mode">Debug (Temporary)</string>
|
||||
|
|
|
@ -30,5 +30,6 @@
|
|||
<item name="shadowColor">#BB000000</item>
|
||||
<item name="shadowRadius">2.75</item>
|
||||
<item name="backgroundDimAmount">0.5</item>
|
||||
<item name="symbolColorScheme">white</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
android:persistent="true"
|
||||
android:entryValues="@array/keyboard_layout_modes_values"
|
||||
android:entries="@array/keyboard_layout_modes"
|
||||
android:defaultValue="6"
|
||||
android:defaultValue="3"
|
||||
/>
|
||||
|
||||
<PreferenceScreen
|
||||
|
|
|
@ -48,10 +48,11 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
public static final int KEYBOARDMODE_IM = R.id.mode_im;
|
||||
public static final int KEYBOARDMODE_WEB = R.id.mode_webentry;
|
||||
|
||||
public static final String DEFAULT_LAYOUT_ID = "2";
|
||||
public static final String DEFAULT_LAYOUT_ID = "3";
|
||||
public static final String PREF_KEYBOARD_LAYOUT = "keyboard_layout";
|
||||
private static final int[] LAYOUTS = new int [] {
|
||||
R.layout.input, R.layout.input2, R.layout.input7};
|
||||
R.layout.input_basic, R.layout.input_basic_highcontrast, R.layout.input_stone_normal,
|
||||
R.layout.input_stone_bold};
|
||||
|
||||
private static final int SYMBOLS_MODE_STATE_NONE = 0;
|
||||
private static final int SYMBOLS_MODE_STATE_BEGIN = 1;
|
||||
|
@ -424,8 +425,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Generalize for any theme
|
||||
public boolean isBlackSym () {
|
||||
return (mLayoutId == 6);
|
||||
if (mInputView != null && mInputView.getSymbolColorSheme() == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -264,8 +264,10 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
Log.d(TAG, "Log theme Id. (1)");
|
||||
}
|
||||
// TODO: Not to convert theme ID here. Currently "2" is treated as "6" in a log server.
|
||||
if (mThemeId == "2") {
|
||||
if (mThemeId.equals("2")) {
|
||||
mThemeId = "6";
|
||||
} else if (mThemeId.equals("3")) {
|
||||
mThemeId = "7";
|
||||
}
|
||||
mLogBuffer.add(new LogEntry (time, ID_THEME_ID,
|
||||
new String[] {mThemeId}));
|
||||
|
|
|
@ -165,6 +165,8 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||
private Map<Key,View> mMiniKeyboardCache;
|
||||
private int[] mWindowOffset;
|
||||
private Key[] mKeys;
|
||||
private Typeface mKeyTextStyle = Typeface.DEFAULT;
|
||||
private int mSymbolColorScheme = 0;
|
||||
|
||||
/** Listener for {@link OnKeyboardActionListener}. */
|
||||
private OnKeyboardActionListener mKeyboardActionListener;
|
||||
|
@ -334,6 +336,24 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||
case R.styleable.LatinKeyboardBaseView_backgroundDimAmount:
|
||||
mBackgroundDimAmount = a.getFloat(attr, 0.5f);
|
||||
break;
|
||||
//case android.R.styleable.
|
||||
case R.styleable.LatinKeyboardBaseView_keyTextStyle:
|
||||
int textStyle = a.getInt(attr, 0);
|
||||
switch (textStyle) {
|
||||
case 0:
|
||||
mKeyTextStyle = Typeface.DEFAULT;
|
||||
break;
|
||||
case 1:
|
||||
mKeyTextStyle = Typeface.DEFAULT_BOLD;
|
||||
break;
|
||||
default:
|
||||
mKeyTextStyle = Typeface.defaultFromStyle(textStyle);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case R.styleable.LatinKeyboardBaseView_symbolColorScheme:
|
||||
mSymbolColorScheme = a.getInt(attr, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,6 +546,10 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||
return mShowPreview;
|
||||
}
|
||||
|
||||
public int getSymbolColorSheme() {
|
||||
return mSymbolColorScheme;
|
||||
}
|
||||
|
||||
public void setVerticalCorrection(int verticalOffset) {
|
||||
}
|
||||
|
||||
|
@ -693,7 +717,7 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||
paint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
} else {
|
||||
paint.setTextSize(mKeyTextSize);
|
||||
paint.setTypeface(Typeface.DEFAULT);
|
||||
paint.setTypeface(mKeyTextStyle);
|
||||
}
|
||||
// Draw a drop shadow for the text
|
||||
paint.setShadowLayer(mShadowRadius, 0, 0, mShadowColor);
|
||||
|
@ -894,7 +918,7 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
|||
mPreviewText.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
} else {
|
||||
mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSizeLarge);
|
||||
mPreviewText.setTypeface(Typeface.DEFAULT);
|
||||
mPreviewText.setTypeface(mKeyTextStyle);
|
||||
}
|
||||
}
|
||||
mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
|
||||
|
|
Loading…
Reference in a new issue