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

Commit 1b2ddd25 authored by Skrilax_CZ's avatar Skrilax_CZ
Browse files

Make character picker for QWERTY keyboards use HOLO theme

Also, removed the cancel button. Instead, touching outside will close
the dialog.

Change-Id: I20c1d22b131a92e2e2022d054b4141a2b61c7dd8
parent a33a12bd
Loading
Loading
Loading
Loading
+11 −16
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ public class CharacterPickerDialog extends Dialog
    private String mOptions;
    private boolean mInsert;
    private LayoutInflater mInflater;
    private Button mCancelButton;

    /**
     * Creates a new CharacterPickerDialog that presents the specified
@@ -71,15 +70,13 @@ public class CharacterPickerDialog extends Dialog
        params.token = mView.getApplicationWindowToken();
        params.type = params.TYPE_APPLICATION_ATTACHED_DIALOG;
        params.flags = params.flags | Window.FEATURE_NO_TITLE;
        setCanceledOnTouchOutside(true);

        setContentView(R.layout.character_picker);

        GridView grid = (GridView) findViewById(R.id.characterPicker);
        grid.setAdapter(new OptionsAdapter(getContext()));
        grid.setOnItemClickListener(this);

        mCancelButton = (Button) findViewById(R.id.cancel);
        mCancelButton.setOnClickListener(this);
    }

    /**
@@ -90,6 +87,16 @@ public class CharacterPickerDialog extends Dialog
        replaceCharacterAndClose(result);
    }

    /**
     * Handles clicks on the character buttons.
     */
    public void onClick(View v) {
        if (v instanceof Button) {
            CharSequence result = ((Button) v).getText();
            replaceCharacterAndClose(result);
        }
    }

    private void replaceCharacterAndClose(CharSequence replace) {
        int selEnd = Selection.getSelectionEnd(mText);
        if (mInsert || selEnd == 0) {
@@ -101,18 +108,6 @@ public class CharacterPickerDialog extends Dialog
        dismiss();
    }

    /**
     * Handles clicks on the Cancel button.
     */
    public void onClick(View v) {
        if (v == mCancelButton) {
            dismiss();
        } else if (v instanceof Button) {
            CharSequence result = ((Button) v).getText();
            replaceCharacterAndClose(result);
        }
    }

    private class OptionsAdapter extends BaseAdapter {

        public OptionsAdapter(Context context) {
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 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.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_selected="true" android:state_pressed="false"
          android:drawable="@drawable/btn_keyboard_key_light_pressed_holo" />

    <item android:state_pressed="true"
          android:drawable="@drawable/btn_keyboard_key_light_pressed_holo" />

    <item android:state_pressed="false" android:state_focused="false"
          android:drawable="@drawable/btn_keyboard_key_light_normal_holo" />

</selector>
+1 −11
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
    android:orientation="horizontal"
    android:layout_width="304dp"
    android:layout_height="match_parent"
    android:background="@drawable/keyboard_popup_panel_trans_background">
    android:background="@drawable/keyboard_background">

    <GridView
        android:id="@+id/characterPicker"
@@ -36,14 +36,4 @@
        android:layout_gravity="center_vertical"
        android:listSelector="#0000"
    />

    <Button
        android:id="@+id/cancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="12dp"
        android:layout_marginEnd="12dp"
        android:background="@drawable/btn_close"
        android:layout_gravity="center_vertical"
    />
</LinearLayout>
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
    android:clickable="true"
    android:focusable="false"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:background="@drawable/btn_keyboard_key_trans"
    android:background="@drawable/btn_keyboard_key_ics_simple"
    android:textColor="#FFFFFFFF"
/>