Loading res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -519,6 +519,9 @@ <!-- Message displayed when there is no application available to handle the add contact menu option. [CHAR LIMIT=NONE] --> <string name="add_contact_not_available">Re-enable the People application to use this feature.</string> <!-- Message displayed when there is no application available to handle voice search. [CHAR LIMIT=NONE] --> <string name="voice_search_not_available">Voice search is not available.</string> <!-- Hint displayed in dialer search box when there is no query that is currently typed. [CHAR LIMIT=30] --> <string name="dialer_hint_find_contact">Type a name or phone number</string> Loading src/com/android/dialer/DialtactsActivity.java +33 −5 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ import android.app.FragmentTransaction; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; Loading @@ -48,6 +50,7 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.inputmethod.InputMethodManager; import android.widget.AbsListView.OnScrollListener; Loading Loading @@ -76,6 +79,7 @@ import com.android.dialerbind.DatabaseHelperManager; import com.android.internal.telephony.ITelephony; import java.util.ArrayList; import java.util.List; /** * The dialer tab's title is 'phone', a more common name (see strings.xml). Loading Loading @@ -330,7 +334,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O hideDialpadFragment(false, true); mInCallDialpadUp = false; } prepareVoiceSearchButton(); mFirstLaunch = false; mDialerDatabaseHelper.startSmartDialUpdateThread(); } Loading Loading @@ -447,8 +451,13 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } break; case R.id.voice_search_button: final Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); startActivityForResult(voiceIntent, ACTIVITY_REQUEST_CODE_VOICE_SEARCH); try { startActivityForResult(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), ACTIVITY_REQUEST_CODE_VOICE_SEARCH); } catch (ActivityNotFoundException e) { Toast.makeText(DialtactsActivity.this, R.string.voice_search_not_available, Toast.LENGTH_SHORT).show(); } break; default: { Log.wtf(TAG, "Unexpected onClick event from " + view); Loading Loading @@ -507,8 +516,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mSearchViewContainer = findViewById(R.id.search_view_container); mSearchViewCloseButton = findViewById(R.id.search_close_button); mSearchViewCloseButton.setOnClickListener(this); mVoiceSearchButton = findViewById(R.id.voice_search_button); mVoiceSearchButton.setOnClickListener(this); mSearchView = (EditText) findViewById(R.id.search_view); mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener); Loading @@ -524,6 +532,19 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O ssb.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mSearchView.setHint(ssb); prepareVoiceSearchButton(); } private void prepareVoiceSearchButton() { mVoiceSearchButton = findViewById(R.id.voice_search_button); final Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); if (canIntentBeHandled(voiceIntent)) { mVoiceSearchButton.setVisibility(View.VISIBLE); mVoiceSearchButton.setOnClickListener(this); } else { mVoiceSearchButton.setVisibility(View.GONE); } } final AnimatorListener mHideListener = new AnimatorListenerAdapter() { Loading Loading @@ -955,4 +976,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O intent.putExtra(Intents.Insert.NAME, text); return intent; } private boolean canIntentBeHandled(Intent intent) { final PackageManager packageManager = getPackageManager(); final List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return resolveInfo != null && resolveInfo.size() > 0; } } Loading
res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -519,6 +519,9 @@ <!-- Message displayed when there is no application available to handle the add contact menu option. [CHAR LIMIT=NONE] --> <string name="add_contact_not_available">Re-enable the People application to use this feature.</string> <!-- Message displayed when there is no application available to handle voice search. [CHAR LIMIT=NONE] --> <string name="voice_search_not_available">Voice search is not available.</string> <!-- Hint displayed in dialer search box when there is no query that is currently typed. [CHAR LIMIT=30] --> <string name="dialer_hint_find_contact">Type a name or phone number</string> Loading
src/com/android/dialer/DialtactsActivity.java +33 −5 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ import android.app.FragmentTransaction; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; Loading @@ -48,6 +50,7 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.inputmethod.InputMethodManager; import android.widget.AbsListView.OnScrollListener; Loading Loading @@ -76,6 +79,7 @@ import com.android.dialerbind.DatabaseHelperManager; import com.android.internal.telephony.ITelephony; import java.util.ArrayList; import java.util.List; /** * The dialer tab's title is 'phone', a more common name (see strings.xml). Loading Loading @@ -330,7 +334,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O hideDialpadFragment(false, true); mInCallDialpadUp = false; } prepareVoiceSearchButton(); mFirstLaunch = false; mDialerDatabaseHelper.startSmartDialUpdateThread(); } Loading Loading @@ -447,8 +451,13 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } break; case R.id.voice_search_button: final Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); startActivityForResult(voiceIntent, ACTIVITY_REQUEST_CODE_VOICE_SEARCH); try { startActivityForResult(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), ACTIVITY_REQUEST_CODE_VOICE_SEARCH); } catch (ActivityNotFoundException e) { Toast.makeText(DialtactsActivity.this, R.string.voice_search_not_available, Toast.LENGTH_SHORT).show(); } break; default: { Log.wtf(TAG, "Unexpected onClick event from " + view); Loading Loading @@ -507,8 +516,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mSearchViewContainer = findViewById(R.id.search_view_container); mSearchViewCloseButton = findViewById(R.id.search_close_button); mSearchViewCloseButton.setOnClickListener(this); mVoiceSearchButton = findViewById(R.id.voice_search_button); mVoiceSearchButton.setOnClickListener(this); mSearchView = (EditText) findViewById(R.id.search_view); mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener); Loading @@ -524,6 +532,19 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O ssb.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); mSearchView.setHint(ssb); prepareVoiceSearchButton(); } private void prepareVoiceSearchButton() { mVoiceSearchButton = findViewById(R.id.voice_search_button); final Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); if (canIntentBeHandled(voiceIntent)) { mVoiceSearchButton.setVisibility(View.VISIBLE); mVoiceSearchButton.setOnClickListener(this); } else { mVoiceSearchButton.setVisibility(View.GONE); } } final AnimatorListener mHideListener = new AnimatorListenerAdapter() { Loading Loading @@ -955,4 +976,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O intent.putExtra(Intents.Insert.NAME, text); return intent; } private boolean canIntentBeHandled(Intent intent) { final PackageManager packageManager = getPackageManager(); final List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return resolveInfo != null && resolveInfo.size() > 0; } }