Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac386e9c authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Format the template using HTML tags.

Manual formatting is to complicated to do.

Fixes: 28852429
Change-Id: Ibab723b82a2b14ad94a3038dffccc96f86ba8ee4
parent dd89b6bc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@

    <!-- Template for the warning message when an app requests a permission. -->
    <string name="permission_warning_template">Allow
        <xliff:g id="app_name" example="Gmail">%1$s</xliff:g> to
        &lt;b><xliff:g id="app_name" example="Gmail">%1$s</xliff:g>&lt;/b> to
        <xliff:g id="action" example="do something">%2$s</xliff:g>?</string>

    <!-- Permissions -->
+4 −11
Original line number Diff line number Diff line
@@ -27,13 +27,12 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PermissionInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Icon;
import android.hardware.camera2.utils.ArrayUtils;
import android.os.Build;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.style.StyleSpan;
import android.text.Html;
import android.text.Spanned;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -231,16 +230,10 @@ public class GrantPermissionsActivity extends OverlayTouchActivity
        for (GroupState groupState : mRequestGrantPermissionGroups.values()) {
            if (groupState.mState == GroupState.STATE_UNKNOWN) {
                CharSequence appLabel = mAppPermissions.getAppLabel();
                SpannableString message = new SpannableString(getString(
                        R.string.permission_warning_template, appLabel,
                        groupState.mGroup.getDescription()));
                Spanned message = Html.fromHtml(getString(R.string.permission_warning_template,
                        appLabel, groupState.mGroup.getDescription()), 0);
                // Set the permission message as the title so it can be announced.
                setTitle(message);
                // Color the app name.
                int appLabelStart = message.toString().indexOf(" " + appLabel.toString() + " ", 0);
                int appLabelLength = appLabel.length() + 1;
                message.setSpan(new StyleSpan(Typeface.BOLD), appLabelStart,
                        appLabelStart + appLabelLength, 0);

                // Set the new grant view
                // TODO: Use a real message for the action. We need group action APIs