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

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

Cleanup and improve T9 search code.

- Use an AsyncTask for loading the T9 cache and show UI indication for
  it to the user.
- Some general cleanup.

Change-Id: I2a95e142baa055c6ff54ef54fe4276f83389a062
parent dbf9e9fb
Loading
Loading
Loading
Loading
+34 −28
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <QuickContactBadge
        android:id="@+id/rowBadge"
        android:layout_width="40dp"
@@ -10,22 +11,27 @@
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:focusable="false" />

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

        <TextView
            android:id="@+id/rowName"
            android:layout_weight="0.5"
            android:gravity="center_vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <TextView
            android:id="@+id/rowNumber"
            android:layout_weight="0.5"
            android:gravity="center_vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </LinearLayout>

</LinearLayout>
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginLeft="12dp"
        android:layout_marginRight="12dp"
        style="@android:style/Widget.ProgressBar.Small"
        android:gravity="center_vertical" />

    <TextView
        android:layout_weight="1"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center_vertical"
        android:text="@string/t9_loading" />

</LinearLayout>
+1 −0
Original line number Diff line number Diff line
@@ -560,6 +560,7 @@
    <string name="dialog_voicemail_not_ready_message" msgid="4384716252789515378">"Konfigurieren Sie Ihre Mailbox unter \"Menü\" &gt; \"Einstellungen\"."</string>
    <string name="dialog_voicemail_airplane_mode_message" msgid="530922773669546093">"Deaktivieren Sie zunächst den Flugmodus, um die Mailbox anzurufen."</string>
    <string name="action_menu_overflow_description" msgid="2303272250613084574">"Mehr Optionen"</string>
    <string name="t9_loading">Lade Kontakte\u2026</string>
    <string name="t9_sort_title">T9-Sortierung</string>
    <string name="t9_sort_summary">Reihenfolge der T9-Resultate auswählen</string>
    <string name="t9_sort_name">Namenstreffer bevorzugen</string>
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
         used in the Launcher icon. -->
    <string name="people">People</string>

    <string name="t9_loading">Loading\u2026</string>
    <string name="t9_default_sort">1</string>
    <string name="t9_sort_title">T9 sorting mode</string>
    <string name="t9_sort_summary">Choose how to filter T9 results</string>
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.contacts;

import com.android.contacts.dialpad.T9SearchCache;
import com.android.contacts.list.ContactListFilterController;
import com.android.contacts.model.AccountTypeManager;
import com.android.contacts.test.InjectedServices;
@@ -43,6 +44,7 @@ public final class ContactsApplication extends Application {
    private AccountTypeManager mAccountTypeManager;
    private ContactPhotoManager mContactPhotoManager;
    private ContactListFilterController mContactListFilterController;
    private T9SearchCache mT9Cache;

    /**
     * Overrides the system services with mocks for testing.
@@ -112,6 +114,13 @@ public final class ContactsApplication extends Application {
            return mContactListFilterController;
        }

        if (T9SearchCache.T9_CACHE_SERVICE.equals(name)) {
            if (mT9Cache == null) {
                mT9Cache = T9SearchCache.createT9Cache(this);
            }
            return mT9Cache;
        }

        return super.getSystemService(name);
    }

Loading