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

Commit 0d3fd2ee authored by Brian Attwell's avatar Brian Attwell
Browse files

Increase max QC title size on 720dp+ tablets

Because of the way that View#setScaleY() works, the maximum size of the
title TextView has to be less than the minimum size of the of the TextView's
parent. As a result, increasing the title size caused unexpected behavior.

Fixing this odd behavior required me to remove the title TextView
out of the header ViewGroup and instead manually control its position
inside MultiShrinkScroller. This required me to make MultiShrinkScroller
a FrameLayout. This necessitated lots of little changes inside MultiShrinkScroller
(ie, what type of LayoutParams to cast into).

There is a reason nobody else has messed around with scaling title TextViews.

Bug: 16683381
Change-Id: Ib8fc065931a6a0c2a96b8bd5a11bb055457aa3dd
parent 723e2f66
Loading
Loading
Loading
Loading
+29 −9
Original line number Diff line number Diff line
@@ -23,6 +23,11 @@
    android:focusableInTouchMode="true"
    android:descendantFocusability="afterDescendants" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/quickcontact_starting_empty_height"
@@ -31,12 +36,27 @@

        <LinearLayout
            android:layout_width="match_parent"
        android:layout_height="match_parent">
            android:layout_height="match_parent"
            android:orientation="horizontal">

            <!-- Needs a non null background for elevation to work on this View. This will
                 *not* cause an additional draw since the background is transparent. -->
            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#00000000"
                android:id="@+id/toolbar_parent">

                <include layout="@layout/quickcontact_header" />

                <include layout="@layout/quickcontact_title" />

            </FrameLayout>

            <include layout="@layout/quickcontact_content" />

        </LinearLayout>

    </LinearLayout>

</com.android.contacts.widget.MultiShrinkScroller>
 No newline at end of file
+26 −6
Original line number Diff line number Diff line
@@ -24,14 +24,34 @@
    android:focusableInTouchMode="true"
    android:descendantFocusability="afterDescendants" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/quickcontact_starting_empty_height"
            android:contentDescription="@string/quickcontact_transparent_view_description"
            android:id="@+id/transparent_view" />

        <!-- Needs a non null background for elevation to work on this View. This will *not*
             cause an additional draw since the background is transparent. -->
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#00000000"
            android:id="@+id/toolbar_parent">
            <include layout="@layout/quickcontact_header" />
        </FrameLayout>

        <include layout="@layout/quickcontact_content" />

    </LinearLayout>

    <!-- This title's maximum height must be less than the minimum size of its
         parent ViewGroup because of an oddity in the way View#setScaleY() works. As a result,
         this title can not be inside @style/quickcontact_header. -->
    <include layout="@layout/quickcontact_title" />

</com.android.contacts.widget.MultiShrinkScroller>
 No newline at end of file
+2 −23
Original line number Diff line number Diff line
@@ -14,15 +14,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- Needs a non null background in for elevation to work on this View. This will *not* cause an
     additional draw since the background is transparent. -->
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#00000000"
    android:id="@+id/toolbar_parent">
<merge xmlns:android="http://schemas.android.com/apk/res/android">

    <com.android.contacts.widget.QuickContactImageView
        android:id="@+id/photo"
@@ -61,17 +53,4 @@
        android:background="#00000000"
        android:id="@+id/toolbar"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/actionbar_text_color"
        android:maxLines="@integer/quickcontact_title_lines"
        android:ellipsize="end"
        android:layout_gravity="bottom|start"
        android:textSize="@dimen/quickcontact_maximum_title_size"
        android:layout_marginStart="@dimen/quickcontact_title_initial_margin"
        android:layout_marginEnd="@dimen/quickcontact_title_initial_margin"
        android:layout_marginBottom="@dimen/quickcontact_title_initial_margin"
        android:id="@+id/large_title"/>

</FrameLayout>
</merge>
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2014 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.
-->
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="@dimen/quickcontact_title_initial_margin"
    android:layout_marginEnd="@dimen/quickcontact_title_initial_margin"
    android:layout_marginBottom="@dimen/quickcontact_title_initial_margin"
    android:layout_gravity="top|start"
    android:textColor="@color/actionbar_text_color"
    android:maxLines="@integer/quickcontact_title_lines"
    android:textSize="@dimen/quickcontact_maximum_title_size"
    android:ellipsize="end"
    android:id="@+id/large_title"/>
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -21,4 +21,9 @@
    <dimen name="quick_contact_photo_container_height">360dip</dimen>
    <dimen name="contact_picker_contact_list_min_height">650dip</dimen>
    <dimen name="list_visible_scrollbar_padding">48dip</dimen>

    <!-- When QC is uncollapsed, the title has this much margin on its left, right and bottom -->
    <dimen name="quickcontact_title_initial_margin">32dp</dimen>
    <!-- Initial size of QuickContact's title size -->
    <dimen name="quickcontact_maximum_title_size">64dp</dimen>
</resources>
Loading