From 91b0f6893f9848354af7654b3cebc842615bcd7f Mon Sep 17 00:00:00 2001 From: Marvin W Date: Thu, 18 Mar 2021 01:19:54 +0100 Subject: [PATCH] GCM: Fix confirm dialog in dark theme --- .../org/microg/gms/ui/AskPushPermission.java | 14 +- .../src/main/res/layout/ask_gcm.xml | 123 +++++++++--------- .../src/main/res/values/strings.xml | 1 + 3 files changed, 74 insertions(+), 64 deletions(-) diff --git a/play-services-core/src/main/java/org/microg/gms/ui/AskPushPermission.java b/play-services-core/src/main/java/org/microg/gms/ui/AskPushPermission.java index 61a77f3e..f069cb4e 100644 --- a/play-services-core/src/main/java/org/microg/gms/ui/AskPushPermission.java +++ b/play-services-core/src/main/java/org/microg/gms/ui/AskPushPermission.java @@ -4,9 +4,16 @@ import android.app.Activity; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; +import android.graphics.Typeface; import android.os.Bundle; import android.os.ResultReceiver; import android.text.Html; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.SpannableStringBuilder; +import android.text.Spanned; +import android.text.SpannedString; +import android.text.style.StyleSpan; import android.view.View; import android.widget.TextView; @@ -58,9 +65,12 @@ public class AskPushPermission extends FragmentActivity { try { PackageManager pm = getPackageManager(); final ApplicationInfo info = pm.getApplicationInfo(packageName, 0); - CharSequence label = pm.getApplicationLabel(info); + String label = pm.getApplicationLabel(info).toString(); + String raw = getString(R.string.gcm_allow_app_popup, label); + SpannableString s = new SpannableString(raw); + s.setSpan(new StyleSpan(Typeface.BOLD), raw.indexOf(label), raw.indexOf(label) + label.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); - ((TextView) findViewById(R.id.permission_message)).setText(Html.fromHtml("Allow " + label + " to register for push notifications?")); + ((TextView) findViewById(R.id.permission_message)).setText(s); findViewById(R.id.permission_allow_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/play-services-core/src/main/res/layout/ask_gcm.xml b/play-services-core/src/main/res/layout/ask_gcm.xml index f07c30cd..061e1ef8 100644 --- a/play-services-core/src/main/res/layout/ask_gcm.xml +++ b/play-services-core/src/main/res/layout/ask_gcm.xml @@ -14,88 +14,87 @@ limitations under the License. --> - + android:layout_width="match_parent" + android:layout_height="match_parent"> - - - - - - - - - - - - - - + android:gravity="center" + android:orientation="vertical" + android:paddingLeft="24dp" + android:paddingTop="18dp" + android:paddingRight="24dp" + android:paddingBottom="24dp"> - + android:gravity="center" + android:text="@string/gcm_allow_app_popup" + android:textSize="18sp"> + + + + + + + + + + + - + diff --git a/play-services-core/src/main/res/values/strings.xml b/play-services-core/src/main/res/values/strings.xml index e7b12dc0..12ffbc25 100644 --- a/play-services-core/src/main/res/values/strings.xml +++ b/play-services-core/src/main/res/values/strings.xml @@ -171,6 +171,7 @@ This can take a couple of minutes." Disconnected Connected since %1$s Receive push notifications + Allow %1$s to register for push notifications? Allow registration Allow the app to register for push notifications.