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

Commit a3a0c772 authored by Danny Baumann's avatar Danny Baumann
Browse files

Fix up call log search UX.

Change-Id: I0dc9556af8ae7328236a0efab0c96cdabc9938fc
parent b9bbfc41
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@

        <activity android:name="com.android.dialer.calllog.CallLogActivity"
            android:label="@string/call_log_activity_title"
            android:theme="@style/DialtactsThemeWithoutActionBarOverlay"
            android:theme="@style/DialtactsThemeWithoutActionBar"
            android:screenOrientation="nosensor"
            android:icon="@mipmap/ic_launcher_phone">
            <intent-filter>
+22 −7
Original line number Diff line number Diff line
@@ -19,6 +19,19 @@
    android:layout_height="match_parent"
    android:id="@+id/calllog_frame"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/toolbar_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:elevation="@dimen/tab_elevation"
        android:orientation="vertical">

        <Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="@color/actionbar_background_color" />
        <com.android.contacts.common.list.ViewPagerTabs
            android:id="@+id/viewpager_header"
            android:layout_width="match_parent"
@@ -26,8 +39,10 @@
            android:textAllCaps="true"
            android:orientation="horizontal"
            android:layout_gravity="top"
        android:elevation="@dimen/tab_elevation"
            style="@style/DialtactsActionBarTabTextStyle" />

    </LinearLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/call_log_pager"
        android:layout_width="match_parent"
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
    <item
        android:id="@+id/search_calllog"
        android:title="@string/calllog_search_hint"
        android:showAsAction="never"
        android:icon="@drawable/ic_ab_search"
        android:showAsAction="always"
        android:orderInCategory="1"/>
    <item
        android:id="@+id/delete_all"
+10 −6
Original line number Diff line number Diff line
@@ -99,6 +99,12 @@
        <item name="android:actionOverflowButtonStyle">@style/DialtactsActionBarOverflowWhite</item>
    </style>

    <style name="DialtactsThemeWithoutActionBar" parent="DialtactsThemeWithoutActionBarOverlay">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowActionBar">false</item>
        <item name="android:toolbarStyle">@style/ToolbarStyle</item>
    </style>

    <!-- Hide the actionbar title during the activity preview -->
    <style name="DialtactsActivityTheme" parent="DialtactsTheme">
        <item name="android:actionBarStyle">@style/DialtactsActionBarWithoutTitleStyle</item>
@@ -106,12 +112,6 @@
        <item name="android:fastScrollTrackDrawable">@null</item>
    </style>

    <style name="DialtactsActionBarSpinner"
        parent="@*android:style/Widget.Holo.Light.Spinner.DropDown.ActionBar">

        <item name="android:background">@drawable/spinner_ab_holo_dark</item>
    </style>

    <style name="CallDetailActivityTheme1" parent="android:Theme.Holo.Light">
        <item name="android:windowBackground">@color/background_dialer_list_items</item>
        <item name="android:gravity">top</item>
@@ -167,6 +167,10 @@
        <item name="android:fontFamily">"sans-serif-medium"</item>
    </style>

    <style name="ToolbarStyle" parent="@android:style/Widget.Toolbar">
        <item name="android:titleTextAppearance">@style/DialtactsActionBarTitleText</item>
    </style>

    <style name="ListViewStyle" parent="@android:style/Widget.Material.Light.ListView">
        <item name="android:overScrollMode">always</item>
    </style>
+16 −27
Original line number Diff line number Diff line
@@ -26,14 +26,13 @@ import android.telephony.SubscriptionManager;
import android.graphics.Typeface;
import android.telecom.PhoneAccount;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.style.StyleSpan;
import android.view.View;
import android.widget.TextView;

import com.android.contacts.common.CallUtil;
import com.android.contacts.common.format.TextHighlighter;
import com.android.contacts.common.testing.NeededForTesting;
import com.android.contacts.common.util.PhoneNumberHelper;
import com.android.dialer.calllog.ContactInfo;
@@ -60,6 +59,7 @@ public class PhoneCallDetailsHelper {
    // Helper classes.
    private final PhoneNumberDisplayHelper mPhoneNumberHelper;
    private final PhoneNumberUtilsWrapper mPhoneNumberUtilsWrapper;
    private final TextHighlighter mHighlighter;

    /**
     * List of items to be concatenated together for accessibility descriptions
@@ -79,6 +79,8 @@ public class PhoneCallDetailsHelper {
        mResources = resources;
        mPhoneNumberUtilsWrapper = phoneUtils;
        mPhoneNumberHelper = new PhoneNumberDisplayHelper(context, resources, phoneUtils);
        mHighlighter = new TextHighlighter(Typeface.BOLD,
                mResources.getColor(R.color.text_highlight_color));
    }

    /** Fills the call details views with content. */
@@ -136,38 +138,25 @@ public class PhoneCallDetailsHelper {
            views.callAccountLabel.setVisibility(View.GONE);
        }

        CharSequence nameText;
        CharSequence displayNumber =
            mPhoneNumberHelper.getDisplayNumber(details.accountHandle, details.number,
                    details.numberPresentation, details.formattedNumber);
        String phoneNum = (String) details.number;
        if (!TextUtils.isEmpty(filter) && phoneNum.contains(filter)) {
            int start, end;
            start = phoneNum.indexOf(filter);
            end = start + filter.length();
            SpannableString result = new SpannableString(phoneNum);
            result.setSpan(new StyleSpan(Typeface.BOLD), start, end,
                    Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
            displayNumber = result;
        }
        final CharSequence nameText;
        if (TextUtils.isEmpty(details.name)) {
            nameText = displayNumber;
            nameText = mPhoneNumberHelper.getDisplayNumber(details.accountHandle,
                    details.number, details.numberPresentation, details.formattedNumber);
            // We have a real phone number as "nameView" so make it always LTR
            views.nameView.setTextDirection(View.TEXT_DIRECTION_LTR);
        } else {
            nameText = details.name;
            if (!TextUtils.isEmpty(filter) && nameText.toString().contains(filter)) {
                int start,end;
                start = nameText.toString().indexOf(filter);
                end = start + filter.length();
                SpannableString style = new SpannableString(nameText);
                style.setSpan(new StyleSpan(Typeface.BOLD), start, end,
                        Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
                nameText = style;
            }
        }

        int filterIndex = filter != null && nameText != null
                ? nameText.toString().toLowerCase().indexOf(filter.toLowerCase()) : -1;
        if (filterIndex >= 0) {
            SpannableString s = new SpannableString(nameText);
            mHighlighter.applyMaskingHighlight(s, filterIndex, filterIndex + filter.length());
            views.nameView.setText(s);
        } else {
            views.nameView.setText(nameText);
        }

        if (isVoicemail && !TextUtils.isEmpty(details.transcription)) {
            views.voicemailTranscriptionView.setText(details.transcription);
Loading