Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64fc11c3 authored by satok's avatar satok Committed by Android (Google) Code Review
Browse files

Merge "Add input methods settings panel" into honeycomb

parents c6684f9e 82beadfa
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2403,6 +2403,8 @@

    <!-- Title of the pop-up dialog in which the user switches input method components. -->
    <string name="select_input_method">Select input method</string>
    <!-- Title of a button to open the settings for input methods [CHAR LIMIT=30] -->
    <string name="configure_input_methods">Configure input methods</string>

    <string name="fast_scroll_alphabet">\u0020ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
    <string name="fast_scroll_numeric_alphabet">\u00200123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
+104 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2011, 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.
*/
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:background="@drawable/status_bar_item_background"
    android:orientation="vertical"
    android:paddingRight="6dip"
    android:paddingLeft="6dip"
    android:paddingTop="5dip"
    android:paddingBottom="5dip"
    android:gravity="center_vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="center_vertical"
        android:orientation="horizontal">
        <LinearLayout
            android:id="@+id/item_subtype"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:background="?android:attr/selectableItemBackground">
            <RadioButton
                android:id="@+id/item_radio"
                android:layout_width="30dip"
                android:layout_height="wrap_content"
                android:layout_marginRight="11dip"
                android:focusable="false"
                android:clickable="false" />
            <ImageView
                android:id="@+id/item_icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scaleType="fitCenter" />
            <LinearLayout
                android:orientation="vertical"
                android:layout_width="0px"
                android:layout_weight="1"
                android:layout_height="wrap_content">
                <TextView
                    android:id="@+id/item_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:singleLine="true"
                    android:ellipsize="marquee"
                    android:layout_marginBottom="2dip" />
                <TextView
                    android:id="@+id/item_subtitle"
                    android:layout_marginTop="-4dip"
                    android:layout_gravity="center_vertical|left"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceSmall" />
            </LinearLayout>
        </LinearLayout>
        <View
            android:id="@+id/item_vertical_separator"
            android:layout_width="2dip"
            android:layout_height="match_parent"
            android:layout_marginBottom="5dip"
            android:background="@android:drawable/divider_horizontal_dark" />
        <ImageView
            android:id="@+id/item_settings_icon"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="5dip"
            android:layout_gravity="center_vertical"
            android:paddingRight="10dip"
            android:paddingLeft="10dip"
            android:src="@drawable/ic_sysbar_quicksettings"
            android:visibility="visible"
            android:clickable="true"
            android:focusable="true"
            android:background="?android:attr/selectableItemBackground" />
    </LinearLayout>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dip"
        android:background="@android:drawable/divider_horizontal_dark" />
</LinearLayout>
 No newline at end of file
+71 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2011, 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.systemui.statusbar.tablet.InputMethodsPanel
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:paddingBottom="28dip"
    android:orientation="vertical">
    <View
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="1" />
    <FrameLayout
        android:id="@+id/glow"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/recents_blue_glow">
        <LinearLayout
            android:layout_width="450dip"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dip"
            android:orientation="vertical"
            android:background="@*android:drawable/dialog_full_holo_dark">
            <ScrollView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:overScrollMode="ifContentScrolls"
                android:layout_marginTop="3dip"
                android:layout_weight="1">
                <LinearLayout
                    android:id="@+id/input_method_menu_list"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical" />
            </ScrollView>
            <TextView
                android:id="@+id/ime_settings_shortcut"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="?android:attr/listPreferredItemHeight"
                android:background="?android:attr/selectableItemBackground"
                android:orientation="vertical"
                android:paddingRight="6dip"
                android:paddingLeft="30dip"
                android:paddingTop="5dip"
                android:paddingBottom="5dip"
                android:gravity="center_vertical"
                android:singleLine="true"
                android:text="@string/status_bar_input_method_settings_configure_input_methods"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:ellipsize="marquee" />
        </LinearLayout>
    </FrameLayout>
</com.android.systemui.statusbar.tablet.InputMethodsPanel>
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
@@ -109,5 +109,7 @@
    <string name="recent_tasks_app_label">Apps</string>

    <!-- Network connection string for Bluetooth Reverse Tethering -->
    <string name="bluetooth_tethered">Bluetooth tethered"</string>
    <string name="bluetooth_tethered">Bluetooth tethered</string>
    <!-- Title of a button to open the settings for input methods [CHAR LIMIT=30] -->
    <string name="status_bar_input_method_settings_configure_input_methods">Configure input methods</string>
</resources>
+3 −32
Original line number Diff line number Diff line
@@ -19,11 +19,9 @@ package com.android.systemui.statusbar.tablet;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.IBinder;
import android.provider.Settings;
import android.util.Log;
import android.util.Slog;
import android.util.AttributeSet;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
@@ -31,11 +29,8 @@ import android.view.inputmethod.InputMethodSubtype;
import android.view.View;
import android.widget.ImageView;

import com.android.server.InputMethodManagerService;
import com.android.systemui.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@@ -56,9 +51,6 @@ public class InputMethodButton extends ImageView {
    // other services we wish to talk to
    private final InputMethodManager mImm;
    private final int mId;
    // Cache of InputMethodsInfo
    private final HashMap<String, InputMethodInfo> mInputMethodsInfo =
            new HashMap<String, InputMethodInfo>();
    private ImageView mIcon;
    private IBinder mToken;
    private boolean mKeyboardVisible = false;
@@ -102,20 +94,6 @@ public class InputMethodButton extends ImageView {
        refreshStatusIcon();
    }

    private InputMethodInfo getCurrentInputMethodInfo() {
        String curInputMethodId = Settings.Secure.getString(getContext()
                .getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
        if (!mInputMethodsInfo.containsKey(curInputMethodId)) {
            mInputMethodsInfo.clear();
            List<InputMethodInfo> imis = mImm.getInputMethodList();
            for (int i = 0; i < imis.size(); ++i) {
                InputMethodInfo imi = imis.get(i);
                mInputMethodsInfo.put(imi.getId(), imi);
            }
        }
        return mInputMethodsInfo.get(curInputMethodId);
    }

    // TODO: Need to show an appropriate drawable for this shortcut button,
    // if there are two or more shortcut input methods contained in this button.
    // And need to add other methods to handle multiple shortcuts as appropriate.
@@ -141,8 +119,7 @@ public class InputMethodButton extends ImageView {
        final PackageManager pm = getContext().getPackageManager();
        if (imi != null) {
            if (DEBUG) {
                Log.d(TAG, "Update icons of IME: " + imi.getPackageName() + ","
                        + subtype.getLocale() + "," + subtype.getMode());
                Log.d(TAG, "Update icons of IME: " + imi.getPackageName());
            }
            if (subtype != null) {
                return pm.getDrawable(imi.getPackageName(), subtype.getIconResId(),
@@ -188,25 +165,19 @@ public class InputMethodButton extends ImageView {
            return;
        }
        if (!needsToShowIMEButton()) {
            setVisibility(View.INVISIBLE);
            setVisibility(View.GONE);
            return;
        } else {
            setVisibility(View.VISIBLE);
        }
        Drawable icon = null;
        switch (mId) {
            case ID_IME_SWITCH_BUTTON:
                // TODO: Just showing the first shortcut IME subtype for now. Should handle all
                // shortcuts as appropriate.
                icon = getSubtypeIcon(getCurrentInputMethodInfo(),
                        mImm.getCurrentInputMethodSubtype());
                break;
            case ID_IME_SHORTCUT_BUTTON:
                icon = getShortcutInputMethodAndSubtypeDrawable();
                break;
        }
        if (icon == null) {
            mIcon.setImageResource(R.drawable.ic_sysbar_ime_default);
            mIcon.setImageResource(R.drawable.ic_sysbar_ime);
        } else {
            mIcon.setImageDrawable(icon);
        }
Loading