-
Notifications
You must be signed in to change notification settings - Fork 15
Select a dialer app when more than one installed #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,13 +23,17 @@ | |||||
|
|
||||||
| import android.text.TextUtils; | ||||||
| import android.text.util.Linkify; | ||||||
| import android.text.style.UnderlineSpan; | ||||||
| import android.text.SpannableString; | ||||||
| import android.graphics.Paint; | ||||||
| import android.util.DisplayMetrics; | ||||||
| import android.util.Patterns; | ||||||
| import android.view.LayoutInflater; | ||||||
| import android.view.MenuItem; | ||||||
| import android.view.View; | ||||||
| import android.view.ViewGroup; | ||||||
| import android.widget.TextView; | ||||||
| import android.widget.Toast; | ||||||
|
|
||||||
| import com.bumptech.glide.Glide; | ||||||
|
|
||||||
|
|
@@ -396,10 +400,27 @@ private int getSpanCount(Activity activity) { | |||||
| return (int) (displayMetrics.widthPixels / minButtonWidth); | ||||||
| } | ||||||
|
|
||||||
| private static void linkPhoneNumber(TextView textView, String phoneNumber) { | ||||||
| textView.setText(phoneNumber); | ||||||
| Linkify.addLinks(textView, Patterns.PHONE, "tel:", | ||||||
| Linkify.sPhoneNumberMatchFilter, | ||||||
| Linkify.sPhoneNumberTransformFilter); | ||||||
| private void linkPhoneNumber(TextView textView, String phoneNumber) { | ||||||
| SpannableString spannableString = new SpannableString(phoneNumber); | ||||||
| spannableString.setSpan(new UnderlineSpan(), 0, phoneNumber.length(), 0); | ||||||
| textView.setText(spannableString); | ||||||
| textView.setClickable(true); | ||||||
| textView.setFocusable(true); | ||||||
| textView.setTextColor(getResources().getColor(R.color.colorAccent, null)); | ||||||
| textView.setOnClickListener(v -> { | ||||||
| Intent dialIntent = new Intent(Intent.ACTION_DIAL); | ||||||
| dialIntent.setData(android.net.Uri.parse("tel:" + phoneNumber)); | ||||||
|
|
||||||
| try { | ||||||
| Intent chooser = Intent.createChooser(dialIntent, "Choose phone app"); | ||||||
|
||||||
| Intent chooser = Intent.createChooser(dialIntent, "Choose phone app"); | |
| Intent chooser = Intent.createChooser(dialIntent, getString(R.string.chooser_title)); |
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The toast message should be extracted to a string resource for localization and consistency with Android best practices.
| Toast.makeText(this, "No phone app available to make calls", Toast.LENGTH_SHORT).show(); | |
| Toast.makeText(this, getString(R.string.no_phone_app_available), Toast.LENGTH_SHORT).show(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Paint import is unused and should be removed to keep imports clean.