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

Commit 015b21cf authored by satok's avatar satok
Browse files

Tweak voice layout for Dogfood

Change-Id: Ic51a044901a63c4cec907163e35cd5e458f36dde
parent 63546344
Loading
Loading
Loading
Loading
+101 −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.
*/
-->
<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:background="@drawable/background_voice">
    <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/popup_layout"
            android:orientation="vertical"
            android:layout_height="371dip"
            android:layout_width="500dip"
            android:layout_centerInParent="true"
            android:background="@drawable/vs_dialog_red">
        <TextView
                android:id="@+id/text"
                android:text="@string/voice_error"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:singleLine="true"
                android:layout_marginTop="10dip"
                android:textSize="28sp"
                android:textColor="#ffffff"
                android:layout_gravity="center"
                android:visibility="invisible"/>
        <RelativeLayout
                android:layout_height="0dip"
                android:layout_width="match_parent"
                android:layout_weight="1.0">
            <com.android.inputmethod.deprecated.voice.SoundIndicator
                    android:id="@+id/sound_indicator"
                    android:src="@drawable/mic_full"
                    android:background="@drawable/mic_base"
                    android:adjustViewBounds="true"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:layout_centerInParent="true"
                    android:visibility="gone"/>
            <ImageView
                    android:id="@+id/image"
                    android:src="@drawable/mic_slash"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:layout_centerInParent="true"
                    android:visibility="visible"/>
            <ProgressBar
                    android:id="@+id/progress"
                    android:indeterminate="true"
                    android:indeterminateOnly="false"
                    android:layout_height="60dip"
                    android:layout_width="60dip"
                    android:layout_centerInParent="true"
                    android:visibility="gone"/>
        </RelativeLayout>
        <!--
        The text is set by the code. We specify a random text (voice_error), so the
        text view does not have a zero height. This is necessary to keep the slash
        mic and the recording mic is the same position
        -->
        <TextView
                android:id="@+id/language"
                android:text="@string/voice_error"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:singleLine="true"
                android:textSize="14sp"
                android:layout_marginBottom="3dip"
                android:layout_gravity="center"
                android:textColor="#ffffff"
                android:visibility="invisible"/>
        <Button
                android:id="@+id/button"
                android:layout_width="match_parent"
                android:layout_height="54dip"
                android:singleLine="true"
                android:focusable="true"
                android:text="@string/cancel"
                android:layout_gravity="center_horizontal"
                android:background="@drawable/btn_center"
                android:textColor="#ffffff"
                android:textSize="19sp" />
    </LinearLayout>
</RelativeLayout>
+14 −13
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
                android:layout_width="wrap_content"
                android:singleLine="true"
                android:layout_marginTop="10dip"
                android:textSize="28sp"
                android:textSize="20sp"
                android:textColor="#ffffff"
                android:layout_gravity="center"
                android:visibility="invisible"/>
@@ -81,7 +81,8 @@
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:singleLine="true"
                android:textSize="14sp"
                android:textSize="15sp"
                android:layout_marginTop="3dip"
                android:layout_marginBottom="3dip"
                android:layout_gravity="center"
                android:textColor="#ffffff"
@@ -89,13 +90,13 @@
        <Button
                android:id="@+id/button"
                android:layout_width="match_parent"
                android:layout_height="54dip"
                android:layout_height="30dip"
                android:singleLine="true"
                android:focusable="true"
                android:text="@string/cancel"
                android:layout_gravity="center_horizontal"
                android:background="@drawable/btn_center"
                android:textColor="#ffffff"
                android:textSize="19sp" />
                android:textSize="15sp" />
    </LinearLayout>
</RelativeLayout>
+5 −6
Original line number Diff line number Diff line
@@ -67,7 +67,8 @@ public class InputMethodManagerCompatWrapper {

    // For the compatibility, IMM will create dummy subtypes if subtypes are not found.
    // This is required to be false if the current behavior is broken. For now, it's ok to be true.
    private static final boolean HAS_VOICE_FUNCTION = true;
    public static final boolean FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES =
            !InputMethodServiceCompatWrapper.CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED;
    private static final String VOICE_MODE = "voice";
    private static final String KEYBOARD_MODE = "keyboard";

@@ -118,8 +119,7 @@ public class InputMethodManagerCompatWrapper {
        Object retval = CompatUtils.invoke(mImm, null, METHOD_getEnabledInputMethodSubtypeList,
                (imi != null ? imi.getInputMethodInfo() : null), allowsImplicitlySelectedSubtypes);
        if (retval == null || !(retval instanceof List) || ((List<?>)retval).isEmpty()) {
            if (InputMethodServiceCompatWrapper.
                    CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) {
            if (!FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
                // Returns an empty list
                return Collections.emptyList();
            }
@@ -148,7 +148,7 @@ public class InputMethodManagerCompatWrapper {

    @SuppressWarnings("unused")
    private InputMethodSubtypeCompatWrapper getLastResortSubtype(String mode) {
        if (VOICE_MODE.equals(mode) && !HAS_VOICE_FUNCTION)
        if (VOICE_MODE.equals(mode) && !FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES)
            return null;
        Locale inputLocale = SubtypeSwitcher.getInstance().getInputLocale();
        if (inputLocale == null)
@@ -160,8 +160,7 @@ public class InputMethodManagerCompatWrapper {
            getShortcutInputMethodsAndSubtypes() {
        Object retval = CompatUtils.invoke(mImm, null, METHOD_getShortcutInputMethodsAndSubtypes);
        if (retval == null || !(retval instanceof Map) || ((Map<?, ?>)retval).isEmpty()) {
            if (InputMethodServiceCompatWrapper.
                    CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) {
            if (!FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
                // Returns an empty map
                return Collections.emptyMap();
            }
+7 −1
Original line number Diff line number Diff line
@@ -47,11 +47,17 @@ public class InputMethodServiceCompatWrapper extends InputMethodService {
    @SuppressWarnings("unused")
    public void notifyOnCurrentInputMethodSubtypeChanged(InputMethodSubtypeCompatWrapper subtype) {
        // Do nothing when the API level is 11 or later
        if (CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED) return;
        // and FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES is not true
        if (CAN_HANDLE_ON_CURRENT_INPUT_METHOD_SUBTYPE_CHANGED && !InputMethodManagerCompatWrapper.
                FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES) {
            return;
        }
        if (subtype == null) {
            subtype = mImm.getCurrentInputMethodSubtype();
        }
        if (subtype != null) {
            if (!InputMethodManagerCompatWrapper.FORCE_ENABLE_VOICE_EVEN_WITH_NO_VOICE_SUBTYPES
                    && !subtype.isDummy()) return;
            if (!InputMethodManagerCompatWrapper.SUBTYPE_SUPPORTED) {
                LanguageSwitcherProxy.getInstance().setLocale(subtype.getLocale());
            }
+4 −0
Original line number Diff line number Diff line
@@ -116,6 +116,10 @@ public final class InputMethodSubtypeCompatWrapper extends AbstractCompatWrapper
        return (String)CompatUtils.invoke(mObj, null, METHOD_getExtraValueOf, key);
    }

    public boolean isDummy() {
        return !hasOriginalObject();
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof InputMethodSubtypeCompatWrapper) {