Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion 5calls/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,16 @@
</provider>
</application>

<!-- Query for Android 11+ to find apps that can handle mailto Intents -->
<!-- Query for Android 11+ to find apps that can handle mailto and tel Intents -->
<queries>
<intent>
<action android:name="android.intent.action.SENDTO"/>
<data android:scheme="mailto" android:host="*" />
</intent>
<intent>
<action android:name="android.intent.action.DIAL"/>
<data android:scheme="tel" />
</intent>
</queries>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link

Copilot AI Sep 17, 2025

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.

Suggested change
import android.graphics.Paint;

Copilot uses AI. Check for mistakes.
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;

Expand Down Expand Up @@ -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");
Copy link

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The chooser title should be extracted to a string resource for localization and consistency with Android best practices.

Suggested change
Intent chooser = Intent.createChooser(dialIntent, "Choose phone app");
Intent chooser = Intent.createChooser(dialIntent, getString(R.string.chooser_title));

Copilot uses AI. Check for mistakes.
startActivity(chooser);
} catch (android.content.ActivityNotFoundException e) {
try {
startActivity(dialIntent);
} catch (android.content.ActivityNotFoundException e2) {
Toast.makeText(this, "No phone app available to make calls", Toast.LENGTH_SHORT).show();
Copy link

Copilot AI Sep 17, 2025

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.

Suggested change
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();

Copilot uses AI. Check for mistakes.
}
}
});
}
}