diff options
-rw-r--r-- | java/com/android/dialer/app/res/values/strings.xml | 2 | ||||
-rw-r--r-- | java/com/android/dialer/main/impl/MainActivity.java | 21 | ||||
-rw-r--r-- | java/com/android/dialer/main/impl/MainSearchController.java | 20 |
3 files changed, 40 insertions, 3 deletions
diff --git a/java/com/android/dialer/app/res/values/strings.xml b/java/com/android/dialer/app/res/values/strings.xml index 9554fc21b..5554059fd 100644 --- a/java/com/android/dialer/app/res/values/strings.xml +++ b/java/com/android/dialer/app/res/values/strings.xml @@ -532,7 +532,7 @@ <string name="call_settings_label">Calls</string> <!-- Label for the blocked numbers settings section [CHAR LIMIT=30] --> - <string name="manage_blocked_numbers_label">Call blocking</string> + <string name="manage_blocked_numbers_label">Blocked numbers</string> <!-- Label for the voicemail settings section [CHAR LIMIT=30] --> <string name="voicemail_settings_label">Voicemail</string> diff --git a/java/com/android/dialer/main/impl/MainActivity.java b/java/com/android/dialer/main/impl/MainActivity.java index 583310f7f..35597f949 100644 --- a/java/com/android/dialer/main/impl/MainActivity.java +++ b/java/com/android/dialer/main/impl/MainActivity.java @@ -27,9 +27,11 @@ import android.support.v7.app.AppCompatActivity; import android.widget.ImageView; import com.android.dialer.calllog.ui.NewCallLogFragment; import com.android.dialer.common.LogUtil; +import com.android.dialer.compat.CompatUtils; import com.android.dialer.contactsfragment.ContactsFragment; import com.android.dialer.contactsfragment.ContactsFragment.Header; import com.android.dialer.contactsfragment.ContactsFragment.OnContactSelectedListener; +import com.android.dialer.database.Database; import com.android.dialer.dialpadview.DialpadFragment; import com.android.dialer.dialpadview.DialpadFragment.DialpadListener; import com.android.dialer.dialpadview.DialpadFragment.LastOutgoingCallCallback; @@ -37,6 +39,7 @@ import com.android.dialer.dialpadview.DialpadFragment.OnDialpadQueryChangedListe import com.android.dialer.main.impl.BottomNavBar.OnBottomNavTabSelectedListener; import com.android.dialer.main.impl.toolbar.MainToolbar; import com.android.dialer.searchfragment.list.NewSearchFragment.SearchFragmentListener; +import com.android.dialer.smartdial.util.SmartDialPrefix; import com.android.dialer.speeddial.SpeedDialFragment; import com.android.dialer.voicemail.listui.NewVoicemailFragment; @@ -49,10 +52,14 @@ public final class MainActivity extends AppCompatActivity SearchFragmentListener { private static final String IS_FAB_HIDDEN_KEY = "is_fab_hidden"; + private static final String KEY_SAVED_LANGUAGE_CODE = "saved_language_code"; private MainSearchController searchController; private FloatingActionButton fab; + /** Language the device was in last time {@link #onSaveInstanceState(Bundle)} was called. */ + private String savedLanguageCode; + /** * @param context Context of the application package implementing MainActivity class. * @return intent for MainActivity.class @@ -69,6 +76,7 @@ public final class MainActivity extends AppCompatActivity LogUtil.enterBlock("MainActivity.onCreate"); setContentView(R.layout.main_activity); initLayout(); + SmartDialPrefix.initializeNanpSettings(this); } private void initLayout() { @@ -88,9 +96,19 @@ public final class MainActivity extends AppCompatActivity } @Override + protected void onResume() { + super.onResume(); + // Start the thread that updates the smart dial database if the activity is recreated with a + // language change. + boolean forceUpdate = !CompatUtils.getLocale(this).getISO3Language().equals(savedLanguageCode); + Database.get(this).getDatabaseHelper(this).startSmartDialUpdateThread(forceUpdate); + } + + @Override protected void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); bundle.putBoolean(IS_FAB_HIDDEN_KEY, !fab.isShown()); + bundle.putString(KEY_SAVED_LANGUAGE_CODE, CompatUtils.getLocale(this).getISO3Language()); } @Override @@ -99,6 +117,7 @@ public final class MainActivity extends AppCompatActivity if (savedInstanceState.getBoolean(IS_FAB_HIDDEN_KEY, false)) { fab.hide(); } + savedLanguageCode = savedInstanceState.getString(KEY_SAVED_LANGUAGE_CODE); } @Override @@ -110,7 +129,7 @@ public final class MainActivity extends AppCompatActivity @Override // OnDialpadQueryChangedListener public void onDialpadQueryChanged(String query) { - // TODO(calderwoodra): update search fragment + searchController.onDialpadQueryChanged(query); } @Override // DialpadListener diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java index 4645c9afe..4cccbf4bd 100644 --- a/java/com/android/dialer/main/impl/MainSearchController.java +++ b/java/com/android/dialer/main/impl/MainSearchController.java @@ -16,14 +16,17 @@ package com.android.dialer.main.impl; +import android.support.annotation.Nullable; import android.support.design.widget.FloatingActionButton; import android.text.TextUtils; import android.view.View; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; +import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.common.Assert; import com.android.dialer.dialpadview.DialpadFragment; import com.android.dialer.dialpadview.DialpadFragment.DialpadListener; +import com.android.dialer.dialpadview.DialpadFragment.OnDialpadQueryChangedListener; import com.android.dialer.main.impl.toolbar.MainToolbar; import com.android.dialer.main.impl.toolbar.SearchBarListener; import com.android.dialer.searchfragment.list.NewSearchFragment; @@ -181,11 +184,13 @@ final class MainSearchController implements SearchBarListener { mainActivity.getFragmentManager().beginTransaction().remove(getSearchFragment()).commit(); } + @Nullable private DialpadFragment getDialpadFragment() { return (DialpadFragment) mainActivity.getFragmentManager().findFragmentByTag(DIALPAD_FRAGMENT_TAG); } + @Nullable private NewSearchFragment getSearchFragment() { return (NewSearchFragment) mainActivity.getFragmentManager().findFragmentByTag(SEARCH_FRAGMENT_TAG); @@ -233,7 +238,20 @@ final class MainSearchController implements SearchBarListener { } @Override - public void onSearchQueryUpdated(String query) {} + public void onSearchQueryUpdated(String query) { + NewSearchFragment fragment = getSearchFragment(); + if (fragment != null) { + fragment.setQuery(query, CallInitiationType.Type.REGULAR_SEARCH); + } + } + + /** @see OnDialpadQueryChangedListener#onDialpadQueryChanged(java.lang.String) */ + public void onDialpadQueryChanged(String query) { + NewSearchFragment fragment = getSearchFragment(); + if (fragment != null) { + fragment.setQuery(query, CallInitiationType.Type.DIALPAD); + } + } @Override public void onVoiceButtonClicked(VoiceSearchResultCallback voiceSearchResultCallback) {} |