diff options
author | Wysie <sohyuanchin@gmail.com> | 2010-01-14 23:57:05 +0800 |
---|---|---|
committer | Wysie <sohyuanchin@gmail.com> | 2010-01-14 23:57:05 +0800 |
commit | 7baf0f8897cd0b0e1e3e333a188f0287d1b4bbb9 (patch) | |
tree | cc2467125bb82eaeb9f3eea2dac0857a2ea114b1 | |
parent | d180c6789191d3095708d297fe9e2d63fd10d087 (diff) | |
download | packages_apps_Contacts-7baf0f8897cd0b0e1e3e333a188f0287d1b4bbb9.tar.gz packages_apps_Contacts-7baf0f8897cd0b0e1e3e333a188f0287d1b4bbb9.tar.bz2 packages_apps_Contacts-7baf0f8897cd0b0e1e3e333a188f0287d1b4bbb9.zip |
2.8
Fixed bug at [url]http://code.google.com/p/cyanogenmod.../detail?id=999[/url]
Added German translations, thanks to thiasB!
Patched Call Logs by niuchl. It's supposed to be faster. Do report if it's faster/slow/bugs anything. His implementation does NOT make use of a HashTable or any cache.
-rw-r--r-- | res/values-de/strings.xml | 167 | ||||
-rwxr-xr-x | res/values/strings.xml | 4 | ||||
-rwxr-xr-x | src/com/android/contacts/ContactsListActivity.java | 37 | ||||
-rw-r--r-- | src/com/android/contacts/RecentCallsListActivity.java | 164 |
4 files changed, 259 insertions, 113 deletions
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 0d7520cce..704505c53 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -224,4 +224,171 @@ <string name="fail_reason_could_not_open_file" msgid="4013520943128739511">"\"<xliff:g id="FILE_NAME">%s</xliff:g>\" konnte nicht geöffnet werden: <xliff:g id="EXACT_REASON">%s</xliff:g>"</string> <string name="exporting_contact_list_progress" msgid="560522409559101193">"<xliff:g id="CURRENT_NUMBER">%s</xliff:g> von <xliff:g id="TOTAL_NUMBER">%s</xliff:g> Kontakten"</string> <string name="search_settings_description" msgid="2675223022992445813">"Namen Ihrer Kontakte"</string> + + <string name="recentCalls_deleteAllMissed">Verpasste löschen</string> + <string name="recentCalls_deleteAllOutgoing">Ausgehende löschen</string> + <string name="recentCalls_deleteAllIncoming">Eingehende löschen</string> + + <!-- Wysie_Soh: Contacts menu (across all 4, ie. Dialer, Contacts, Call log, Favourites --> + <string name="menu_preferences">Einstellungen</string> + <string name="contacts_manage_groups">Gruppen verwalten</string> + + <string name="menu_show_all">Zeige alle Gruppen</string> + <string name="menu_show_contacts_phones">Zeige Kontakte mit Rufnummer</string> + + <!-- Wysie_Soh: Dialer menu --> + <string name="dialer_menu_sms">SMS/MMS</string> + + <!-- Wysie_Soh: Call log menu --> + <string name="call_log_menu_total_duration">Geprächsdauer gesamt</string> + + <!-- Wysie_Soh: Total incoming/outgoing dialog --> + <string name="totalcalllog">Dauer total eingehend/ausgehend</string> + <string name="total_incoming">Eingehend</string> + <string name="total_outgoing">Ausgehend</string> + <string name="total_button_ok">Ok</string> + + <!-- Favourites menu --> + <string name="fav_clear_freq">Häufig angerufen leeren</string> + + <!-- Wysie_Soh: Preferences strings (based on ChainsDD's code) --> + <string name="title_dialer_category">Telefon</string> + <string name="title_vm_button">Linke Aktionstaste (LAT)</string> + <string name="title_vm_handler">Mailbox Verwaltung</string> + <string name="title_disable_num_check">Nummernprüfung ausschalten</string> + <string name="summaryon_disable_num_check">Linke Aktionstaste (LAT) und Menü werden dauerhaft aktiviert.</string> + <string name="summaryoff_disable_num_check">LAT und Menü werden aktiviert, wenn mindestens eine Nummer eingegeben wurde (ausser Mailbox).</string> + <string name="title_use_1_for_reg_vm">1 wählt Mailbox</string> + <string name="summaryon_use_1_for_reg_vm">Taste 1 wird für Mailbox genutzt.</string> + <string name="summaryoff_use_1_for_reg_vm">Taste 1 entsprechend Mailbox Verwaltung.</string> + <string name="title_enable_haptic_feedback">Nutze haptische Rückmeldung</string> + + <string name="title_digits_color_unselected">Farbe der Zahlen (normal)</string> + <string name="title_digits_color_focused">Farbe der Zahlen (fokusiert)</string> + <string name="title_digits_color_pressed">Farbe der Zahlen (gedrückt)</string> + <string name="title_choose_color">Farbe wählen</string> + <string name="title_use_custom_color">Nutze eigene Farben für Zahlen</string> + <string name="summaryon_custom_color">Unterstützte Formate: #RRGGBB oder #AARRGGBB (mit #).</string> + + <string name="title_change_digits_color">Farbe der Zahlen ändern</string> + + <string name="title_call_log_category">Anrufliste</string> + <string name="title_cl_relative_time">Relative Zeiten</string> + <string name="summaryon_cl_relative_time">Zeige relative Zeiten in Anrufliste.</string> + <string name="summaryoff_cl_relative_time">Zeige exakte Zeiten in Anrufliste.</string> + <string name="title_cl_show_seconds">Zeige Sekunden</string> + <string name="summary_cl_show_seconds">Zeige Sekunden bei exakten Zeiten.</string> + <string name="title_cl_ask_before_clear">Anrufliste löschen bestätigen</string> + <string name="summaryon_cl_ask_before_clear">Anrufliste löschen mit Bestätigung.</string> + <string name="summaryoff_cl_ask_before_clear">Anrufliste löschen ohne Bestätigung.</string> + <string name="title_cl_always_clear_cache">Nummernspeicher immer leeren</string> + <string name="summaryon_cl_always_clear_cache">Aktuelle Anrufliste ist immer sichergestellt.</string> + <string name="summaryoff_cl_always_clear_cache">Schnellerer Wechsel zur Anrufliste aber evtl. nicht aktuelle Kontaktinformationen nach Änderung.</string> + + <string name="title_view_cl">Individuelle Anruflisten</string> + <string name="summary_view_cl">Einstellungen für individuelle Anruflisten.</string> + + <string name="title_cl_grouping_settings">Gruppieren von Ruflisteneinstellungen</string> + <string name="title_cl_use_exp_grouping">Gruppieren unbekannter Nummern (experimentell)</string> + <string name="summary_cl_use_exp_grouping">Versuche ungespeicherte Nummern zu gruppieren. Betrifft auch Löschen von Anruflisten.</string> + <string name="title_cl_exp_grouping_num">Anzahl zu vergleichender Zahlen</string> + <string name="summary_cl_exp_grouping_num">Genauer, je größer die Anzahl.</string> + + <string name="title_contacts_category">Kontakte</string> + <string name="title_contacts_show_pic">Zeige Kontaktbilder</string> + <string name="summary_contacts_show_pic">Zeige Bilder von Kontakten an.</string> + <string name="title_contacts_show_dial_button">Zeige Anruftaste</string> + <string name="summary_contacts_show_dial_button">Zeige Anruftaste für Kontakte mit Rufnummern.</string> + <string name="title_contacts_view_pic_size">Größe der Kontaktbilder</string> + <string name="summary_contacts_view_pic_size">Größe der Kontaktbilder im Profil einstellen. Betrifft auch Favoriten.</string> + <string name="title_contacts_choose_pic_size">Größe wählen</string> + <string name="title_contacts_show_separators">Alphabetische Trennmarke</string> + <string name="summaryon_contacts_show_separators">Alphabetische Trennung wird angezeigt in der Kontaktliste.</string> + <string name="summaryoff_contacts_show_separators">Alphabetische Trennung wird nicht angezeigt in der Kontaktliste.</string> + <string name="title_auto_show_keyboard">Virt. Tastatur autom. zeigen</string> + <string name="summary_auto_show_keyboard">Die virtuelle Tastatur wird eingeblendet, sobald das Kontaktprofil betreten wird.</string> + <string name="title_auto_hide_keyboard">Virt. Tastatur verbergen</string> + <string name="summary_auto_hide_keyboard">Die virtuelle Tastatur wird ausgeblendet beim Scrollen.</string> + <string name="title_view_contact">Kontakt anzeigen</string> + <string name="summary_view_contact">Einstellungen für Ansicht eines Kontaktes ändern.</string> + <string name="title_show_text_mobile_only">Textaktionen nur für Handys</string> + <string name="summaryon_show_text_mobile_only"> Text/SMS Aktion nur für Mobilfunknummern.</string> + <string name="summaryoff_show_text_mobile_only">Text/SMS Aktion nur für alle Nummern.</string> + + <string name="groups_manager_title">Gruppen bearbeiten</string> + <string name="groups_manager_summary">Einstellungen für Gruppen bearbeiten.</string> + <string name="title_groups_ask_before_del">Löschen bestätigen</string> + <string name="summaryon_groups_ask_before_del">Löschen von Gruppen mit Bestätigung.</string> + <string name="summaryoff_groups_ask_before_del">Löschen von Gruppen ohne Bestätigung.</string> + + <string name="title_favourites_category">Häufig gewählt</string> + <string name="title_favourites_hide_freq_call">Häufig Gewählte verbergen.</string> + <string name="summary_favourites_hide_freq_call">Die Daten werden nicht gelöscht, nur verborgen.</string> + <string name="title_favs_ask_before_clear">Leeren bestätigen</string> + <string name="summaryon_favs_ask_before_clear">Leeren der Liste mit Bestätigung.</string> + <string name="summaryoff_favs_ask_before_clear">Leeren der Liste ohne Bestätigung.</string> + + <string name="title_all_show_label">Zeige Kennung</string> + <string name="summaryon_all_show_label">Kennungen (mobil, privat, etc.) werden angezeigt.</string> + <string name="summaryoff_all_show_label">Kennungen (mobil, privat, etc.) werden nicht angezeigt.</string> + + <string name="title_all_show_number">Zeige Rufnummer</string> + <string name="summaryon_all_show_number">Rufnummer wird gezeigt.</string> + <string name="summaryoff_all_show_number">Rufnummer wird nicht gezeigt.</string> + + <string name="title_misc_category">Sonstiges</string> + <string name="title_sensor_rotation">Autorotation verwenden</string> + + <string name="title_about">Über</string> + <string name="title_about_name">Mod Name</string> + <string name="summary_about_name">Wysie Contacts</string> + <string name="title_about_version">Version</string> + <string name="summary_about_version">2.7</string> + <string name="title_about_credits">Danksagung</string> + <string name="summary_about_credits">ChainsDD, geesun and the rest of XDA! :)</string> + + <!-- Wysie_Soh: Call log strings --> + + <string name="alert_clear_call_log_title">Anrufliste leeren</string> + <string name="alert_clear_call_log_message">Bist du sicher, dass du die Anrufliste leeren möchtest?</string> + <string name="menu_cl_clear_type">Lösche alle %s</string> + <string name="recentCalls_removeAllFrom">Lösche alle </string> + + <string name="alert_clear_cl_person">Bist du sicher, dass du alle Anrufe von %s löschen möchtest?</string> + <string name="alert_clear_cl_person_incoming">Bist du sicher, dass du alle eingegangenen Anrufe von %s löschen möchtest?</string> + <string name="alert_clear_cl_person_outgoing">Bist du sicher, dass du alle ausgegangenen Anrufe an %s löschen möchtest?</string> + <string name="alert_clear_cl_person_missed">Bist du sicher, dass du alle verpassten Anrufe von %s löschen möchtest?</string> + + <string name="alert_clear_cl_all_incoming">Bist du sicher, dass du alle eingegangenen Anrufe löschen möchtest?</string> + <string name="alert_clear_cl_all_outgoing">Bist du sicher, dass du alle ausgegangenen Anrufe löschen möchtest?</string> + <string name="alert_clear_cl_all_missed">Bist du sicher, dass du alle verpassten Anrufe löschen möchtest?</string> + + <!-- Wysie_Soh: Frequently called strings --> + <string name="alert_clear_freq_called">Lösche häufig Angerufene</string> + <string name="alert_clear_freq_called_msg">Bist du sicher, dass du die Liste der häufig angerufenen Kontakte löschen möchtest?</string> + + <!-- Wysie_Soh: View contact strings --> + <string name="view_contact_navigate">Gehe zu</string> + <string name="view_contact_groups">Gruppen</string> + <string name="view_call_log">Anrufliste ansehen</string> + <string name="view_contact_select_cl_number">Nummer auswählen um Log einzusehen</string> + + <!-- Wysie_Soh: Groups management --> + <string name="help_title">Nutzung</string> + <string name="help_message">Gruppenname gedrückt halten zum umbenennen oder löschen. Für neue Gruppe Menü drücken. Dieser Text wird bis zum nächsten Update nicht gezeigt. + </string> + + <string name="title_groups_manager">Gruppen verwalten</string> + <string name="option_create_group">Neue Gruppe</string> + <string name="alert_create_group_message">Gruppenname eingeben</string> + <string name="context_rename_group">Gruppe umbenennen</string> + <string name="context_delete_group">Gruppe löschen</string> + <string name="alert_rename_group_message">Neuen Gruppennamen eingeben</string> + <string name="alert_delete_group_message">Sicher, dass du diese Gruppe löschen möchstest?</string> + + <!-- Wysie_Soh: Others --> + <!-- Toast for call detail screen when couldn't read the requested details --> + <string name="toast_call_detail_error_wysie">Kein Kontakt oder Ruflisteneintrag für diese Nummer gefunden.</string> + <string name="menu_copy_string">Kopiere \"%s\"</string> + <string name="cl_total_cl">Gesamtdauer</string> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 50e54f8e0..4ac15396c 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -858,9 +858,9 @@ <string name="title_about_name">Mod Name</string> <string name="summary_about_name">Wysie Contacts</string> <string name="title_about_version">Version</string> - <string name="summary_about_version">2.7</string> + <string name="summary_about_version">2.8</string> <string name="title_about_credits">Credits</string> - <string name="summary_about_credits">ChainsDD, geesun and the rest of XDA! :)</string> + <string name="summary_about_credits">ChainsDD, geesun, niuchl, rac2030 and the rest of XDA! :)</string> <!-- Wysie_Soh: Call log strings --> <string name="alert_clear_call_log_title">Clear call log</string> diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java index 6f4ee0076..d17929837 100755 --- a/src/com/android/contacts/ContactsListActivity.java +++ b/src/com/android/contacts/ContactsListActivity.java @@ -2208,17 +2208,15 @@ public final class ContactsListActivity extends ListActivity size = cache.numberBuffer.sizeCopied; if (size != 0) { + //Wysie_Soh: 2.8 changes. Always show first. Only hide if preference is set to hide. + numberView.setText(cache.numberBuffer.data, 0, size); + numberView.setVisibility(View.VISIBLE); + labelView.setVisibility(View.VISIBLE); - if ((showContactsNumber && mContactsTab) || (showFavsNumber && mFavTab)) { - numberView.setText(cache.numberBuffer.data, 0, size); - numberView.setVisibility(View.VISIBLE); - } - else { + if ((!showContactsNumber && mContactsTab) || (!showFavsNumber && mFavTab)) { numberView.setVisibility(View.GONE); } - labelView.setVisibility(View.VISIBLE); - if ((showContactsDialButton && mContactsTab) || (showFavsDialButton && mFavTab)) { callView.setTag(new String(cache.numberBuffer.data, 0, size)); //Wysie_Soh: Set tag to green dial button callView.setVisibility(View.VISIBLE); @@ -2237,8 +2235,7 @@ public final class ContactsListActivity extends ListActivity } // Set the label - if (!cursor.isNull(TYPE_COLUMN_INDEX) && ((showContactsLabel && mContactsTab) || - (showFavsLabel && mFavTab))) { + if (!cursor.isNull(TYPE_COLUMN_INDEX)) { int type = cursor.getInt(TYPE_COLUMN_INDEX); if (type != People.Phones.TYPE_CUSTOM) { @@ -2252,7 +2249,7 @@ public final class ContactsListActivity extends ListActivity // Don't check size, if it's zero just don't show anything labelView.setText(cache.labelBuffer.data, 0, cache.labelBuffer.sizeCopied); } - + //Wysie_Soh: Set layout rules programmatically newNameLayout.addRule(RelativeLayout.ABOVE, R.id.label); newNumberLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); @@ -2261,19 +2258,21 @@ public final class ContactsListActivity extends ListActivity cache.nameView.setLayoutParams(newNameLayout); numberView.setLayoutParams(newNumberLayout); + + if ((!showContactsLabel && mContactsTab) || (!showFavsLabel && mFavTab)) { + labelView.setVisibility(View.GONE); + //Wysie_Soh: Set layout rules programmatically + newNameLayout.addRule(RelativeLayout.ABOVE, R.id.number); + newNumberLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); + newNumberLayout.addRule(RelativeLayout.ALIGN_BASELINE, 0); + newNumberLayout.setMargins(0, -10, 0, 8); + cache.nameView.setLayoutParams(newNameLayout); + numberView.setLayoutParams(newNumberLayout); + } } else { // There is no label, hide the the view labelView.setVisibility(View.GONE); - - //Wysie_Soh: Set layout rules programmatically - newNameLayout.addRule(RelativeLayout.ABOVE, R.id.number); - newNumberLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); - newNumberLayout.addRule(RelativeLayout.ALIGN_BASELINE, 0); - newNumberLayout.setMargins(0, -10, 0, 8); - - cache.nameView.setLayoutParams(newNameLayout); - numberView.setLayoutParams(newNumberLayout); } // Set the proper icon (star or presence or nothing) diff --git a/src/com/android/contacts/RecentCallsListActivity.java b/src/com/android/contacts/RecentCallsListActivity.java index 9a7285d36..0f7b6a96b 100644 --- a/src/com/android/contacts/RecentCallsListActivity.java +++ b/src/com/android/contacts/RecentCallsListActivity.java @@ -35,7 +35,6 @@ import android.database.sqlite.SQLiteDiskIOException; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteFullException; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; @@ -74,23 +73,18 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.RelativeLayout; -import android.widget.ResourceCursorAdapter; import android.widget.TextView; import com.android.internal.telephony.CallerInfo; import com.android.internal.telephony.ITelephony; -import java.io.FileNotFoundException; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - +import java.util.Map; import java.util.HashMap; import java.util.Hashtable; import java.util.LinkedList; import java.util.Locale; +import java.util.Set; +import java.util.HashSet; import java.lang.ref.SoftReference; import java.lang.ref.WeakReference; @@ -99,8 +93,6 @@ import android.view.LayoutInflater; import android.widget.ArrayAdapter; import java.util.ArrayList; import java.util.List; -import android.widget.Toast; - /** * Displays a list of call log entries. @@ -840,13 +832,19 @@ public class RecentCallsListActivity extends ListActivity @Override protected void onQueryComplete(int token, Object cookie, Cursor cursor) { final RecentCallsListActivity activity = mActivity.get(); + final Cursor fCursor = cursor; if (activity != null && !activity.isFinishing()) { // final RecentCallsListActivity.RecentCallsAdapter callsAdapter = activity.mAdapter; final RecentCallsListActivity.RecentCallsArrayAdapter callsAdapter = activity.mArrayAdapter; - callsAdapter.setLoading(false); - activity.getUpdateCallLogsItem(cursor); + // niuchl: Process time consuming job asynchronously, so that the main thread will not be blocked. + new Handler().post(new Runnable() { + public void run() { + activity.getUpdateCallLogsItem(fCursor); + callsAdapter.setLoading(false); + } + }); // callsAdapter.changeCursor(cursor); } else { @@ -942,6 +940,63 @@ public class RecentCallsListActivity extends ListActivity return false; } + private Map<String, Set<Long>> nameIdMap = null; + private Map<Long, Set<String>> idPhoneMap = null; + // niuchl: Querying database in batch mode, and the performace is improved a lot. + private void initNumberList() { + if (tempNumList != null && nameIdMap != null && idPhoneMap != null) { + return; + } + + tempNumList = new Hashtable<String, Long>(); + nameIdMap = new HashMap<String, Set<Long>>(); + idPhoneMap = new HashMap<Long, Set<String>>(); + Cursor cursor = getContentResolver().query(Phones.CONTENT_URI, + new String[] {Phones.NUMBER, Phones.PERSON_ID, Phones.DISPLAY_NAME}, + null, null, null); + + if (cursor != null && cursor.moveToFirst()) { + do { + String phone = cursor.getString(0); + Long id = cursor.getLong(1); + String name = cursor.getString(2); + tempNumList.put(phone, id); + if (nameIdMap.containsKey(name)) { + nameIdMap.get(name).add(id); + } else { + Set<Long> idSet = new HashSet(); + idSet.add(id); + nameIdMap.put(name, idSet); + } + if (idPhoneMap.containsKey(id)) { + idPhoneMap.get(id).add(phone); + } else { + Set<String> phoneSet = new HashSet(); + phoneSet.add(phone); + idPhoneMap.put(id, phoneSet); + } + } while (cursor.moveToNext()); + cursor.close(); + } + } + + private long getPersonId(String phoneNumber, String userName) { + if (nameIdMap.containsKey(userName)) { + Set<Long> idSet = nameIdMap.get(userName); + for (Long id : idSet) { + if (idPhoneMap.containsKey(id)) { + Set<String> phoneSet = idPhoneMap.get(id); + for (String phone : phoneSet) { + if (phone.equals(phoneNumber) || PhoneNumberUtils.compare(phone, phoneNumber)) { + return id; + } + } + } + } + } + return -1; + } + public void getUpdateCallLogsItem(Cursor cursor) { mListCallLogs.clear(); numbersCache.clear(); @@ -950,12 +1005,13 @@ public class RecentCallsListActivity extends ListActivity if (cursor == null) { return; } + + initNumberList(); Cursor phonesCursor = null; int number = -1; cacheUpdated = false; - if (cursor.getCount() != 0) { - cursor.moveToFirst(); + if (cursor.getCount() != 0 && cursor.moveToFirst()) { do { RecentCallsInfo item = new RecentCallsInfo(); @@ -977,44 +1033,18 @@ public class RecentCallsListActivity extends ListActivity item.duration = cursor.getInt( RecentCallsListActivity.DURATION_COLUMN_INDEX); - //Wysie_Soh: The following portion of code to retrieve personId - //really slows down the performance. However, without it, - //call logs will not be grouped by contact, and instead will be grouped - //by number (non-ideal). Thus, we make use of a Hashtable to keep - //numbers and ids pairs, and avoid querying. This speeds it up significantly, - //but it's still slower than default/without querying personId - item.personId = -1; - try { - item.personId = tempNumList.get(item.number); - } catch (NullPointerException e) { - } - - if (item.personId == -1) { - phonesCursor = getContentResolver().query( - Uri.withAppendedPath(Phones.CONTENT_FILTER_URL, - Uri.encode(item.number)), PHONES_ID_PROJECTION, null, null, null); - - if (phonesCursor != null && phonesCursor.moveToFirst()) { - item.personId = phonesCursor.getLong(PERSON_ID_COLUMN_INDEX); - tempNumList.put(item.number, item.personId); - cacheUpdated = true; - phonesCursor.close(); - } - } + item.personId = getPersonId(item.number, item.name); addItemIntoList(item); } while (cursor.moveToNext()); cursor.close(); - } // Log.e(TAG,"getUpdateCallLogsItem"); numbersCache.clear(); numbersCachePosition.clear(); personIdCache.clear(); mArrayAdapter.notifyDataSetChanged(); - writeCacheToFile(); - } static String numbersOnly(String s) { @@ -1054,7 +1084,6 @@ public class RecentCallsListActivity extends ListActivity @Override protected void onResume() { - loadCacheFromFile(); /* mListCallLogs.clear(); @@ -1763,53 +1792,4 @@ public class RecentCallsListActivity extends ListActivity //WYSIE TODO: Implement manual delete. - //Wysie: The purpose is to save the existing tempNumList hashtable to a binary file - //so that upon the next start, we can load from here directly, instead of querying - //CONTENT_FILTER_URL which is very slow. - private void writeCacheToFile() { - if (!cacheUpdated) - return; - try { - FileOutputStream fOut = openFileOutput(CACHEFILENAME, 0); - ObjectOutputStream oOut = new ObjectOutputStream(fOut); - oOut.writeObject(tempNumList); - oOut.close(); - fOut.close(); - //Log.d("WYSIE", "FILE SAVE SUCCESS"); - } - catch (FileNotFoundException e) { - //Do nothing - } - catch (IOException e) { - //Do nothing - } - } - - //Wysie: Load the Hashtable from file. Check EditContactActivity for the line - //deleteFile(CACHEFILENAME). The current logic works by ALWAYS deleting the cached/saved file - //as long as a contact info has been edited. This ensures that the call logs are always up to date. - private void loadCacheFromFile() { - try { - FileInputStream fIn = openFileInput(CACHEFILENAME); - ObjectInputStream oIn = new ObjectInputStream(fIn); - tempNumList = (Hashtable<String,Long>)oIn.readObject(); - oIn.close(); - fIn.close(); - //Log.d("WYSIE", "FILE LOAD SUCCESS"); - } - //In case of exceptions, create new tempNumList - catch (ClassNotFoundException e) { - tempNumList = new Hashtable<String,Long>(); - //Log.d("WYSIE", "FILE LOAD ERROR"); - } - catch (FileNotFoundException e) { - tempNumList = new Hashtable<String,Long>(); - //Log.d("WYSIE", "FILE LOAD ERROR"); - } - catch (IOException e) { - tempNumList = new Hashtable<String,Long>(); - //Log.d("WYSIE", "FILE LOAD ERROR"); - } - } - } |