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

Commit a6d6f0c2 authored by Andrew Lee's avatar Andrew Lee
Browse files

Implement custom view for rendering numerals.

This is a custom text view intended only for rendering the numerals
(and star and pound) on the dialpad. TextView has built in
top/bottom padding to help account for ascenders/descenders.

Since vertical space is at a premium on the dialpad, particularly
if the font size is scaled to a larger default, for the dialpad we
use this class to more precisely render characters according to the
precise amount of space they need.

Change-Id: I0eb18b2b2c1f31fa87aae30a71f51b323a9906a3
parent d55c1652
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -33,12 +33,12 @@
            style="@style/DialpadKeyButtonStyle">
            <LinearLayout
                style="@style/DialpadKeyInternalLayoutStyle">
                <TextView
                <com.android.contacts.common.dialpad.DialpadTextView
                    android:id="@+id/dialpad_key_number"
                    style="@style/DialpadKeyNumberStyle" />
                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="@dimen/dialpad_subtext_height" >
                    android:layout_height="wrap_content" >
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
@@ -46,6 +46,8 @@
                        android:src="@drawable/ic_dial_action_vm"
                        android:scaleType="fitCenter"
                        android:layout_centerInParent="true" />
                    <!-- Place empty text view so vertical height is same as other dialpad keys. -->
                    <TextView style="@style/DialpadKeyLettersStyle" />
                </RelativeLayout>
            </LinearLayout>
        </com.android.contacts.common.dialpad.DialpadKeyButton>
@@ -105,7 +107,7 @@
            style="@style/DialpadKeyButtonStyle">
            <LinearLayout
                style="@style/DialpadKeyInternalLayoutStyle">
                <TextView
                <com.android.contacts.common.dialpad.DialpadTextView
                    android:id="@id/dialpad_key_number"
                    style="@style/DialpadKeyStarPoundStyle" />
            </LinearLayout>
@@ -118,7 +120,7 @@
            style="@style/DialpadKeyButtonStyle">
            <LinearLayout
                style="@style/DialpadKeyInternalLayoutStyle">
                <TextView
                <com.android.contacts.common.dialpad.DialpadTextView
                    android:id="@id/dialpad_key_number"
                    style="@style/DialpadKeyStarPoundStyle" />
            </LinearLayout>
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
        <!-- Note in the referenced styles that we assign hard widths to these components
             because we want them to line up vertically when we arrange them in an MxN grid -->

        <TextView
        <com.android.contacts.common.dialpad.DialpadTextView
            android:id="@+id/dialpad_key_number"
            style="@style/DialpadKeyNumberStyle" />

+1 −0
Original line number Diff line number Diff line
@@ -75,4 +75,5 @@
    <declare-styleable name="Favorites">
        <attr name="favorites_padding_bottom" format="dimension"/>
    </declare-styleable>

</resources>
+4 −3
Original line number Diff line number Diff line
@@ -105,10 +105,11 @@
    <dimen name="tab_text_size">14sp</dimen>

    <!-- Text dimensions for dialpad keys -->
    <dimen name="dialpad_key_numbers_size">34dp</dimen>
    <dimen name="dialpad_key_letters_size">8dp</dimen>
    <dimen name="dialpad_key_star_pound_size">23dp</dimen>
    <dimen name="dialpad_key_numbers_size">36sp</dimen>
    <dimen name="dialpad_key_letters_size">8sp</dimen>
    <dimen name="dialpad_key_star_pound_size">23sp</dimen>
    <dimen name="dialpad_key_height">64dp</dimen>
    <dimen name="dialpad_key_number_margin_bottom">2dp</dimen>
    <dimen name="dialpad_subtext_height">10dp</dimen>
    <!-- The bottom row of the dialpad is slightly taller to account for the dial button -->
    <dimen name="dialpad_bottom_key_height">72dp</dimen>
+6 −3
Original line number Diff line number Diff line
@@ -99,8 +99,9 @@ background and text color. See also android:style/Widget.Holo.TextView.ListSepar
        <item name="android:textColor">@color/dialpad_primary_text_color</item>
        <item name="android:textSize">@dimen/dialpad_key_numbers_size</item>
        <item name="android:fontFamily">sans-serif-light</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_marginBottom">@dimen/dialpad_key_number_margin_bottom</item>
        <item name="android:gravity">center</item>
    </style>

@@ -117,9 +118,9 @@ background and text color. See also android:style/Widget.Holo.TextView.ListSepar
        <item name="android:textColor">@color/dialpad_secondary_text_color</item>
        <item name="android:textSize">@dimen/dialpad_key_letters_size</item>
        <item name="android:fontFamily">sans-serif-medium</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:gravity">center</item>
        <item name="android:gravity">center_horizontal</item>
    </style>

    <style name="DialpadKeyButtonStyle">
@@ -128,6 +129,7 @@ background and text color. See also android:style/Widget.Holo.TextView.ListSepar
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:layout_weight">13</item>
        <item name="android:minHeight">@dimen/dialpad_key_height</item>
        <item name="android:background">@drawable/btn_dialpad_key</item>
        <item name="android:focusable">true</item>
    </style>
@@ -140,6 +142,7 @@ background and text color. See also android:style/Widget.Holo.TextView.ListSepar
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_gravity">center</item>
        <item name="android:gravity">center</item>
        <item name="android:orientation">vertical</item>
    </style>
</resources>