Verified Commit 91b0f689 authored by Marvin W.'s avatar Marvin W. 🐿
Browse files

GCM: Fix confirm dialog in dark theme

parent 5eb04b44
......@@ -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 <b>" + label + "</b> 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) {
......
......@@ -14,40 +14,34 @@
limitations under the License.
-->
<FrameLayout
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:clipChildren="false"
android:clipToPadding="false">
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/dialog_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="@+id/desc_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="20dip"
android:paddingLeft="20dip"
android:paddingTop="18dip"
android:paddingEnd="16dip"
android:paddingRight="16dip">
android:background="?android:attr/colorBackground"
android:orientation="vertical">
<LinearLayout
android:id="@+id/perm_desc_root"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="24dp"
android:paddingTop="18dp"
android:paddingRight="24dp"
android:paddingBottom="24dp">
<ImageView
android:id="@+id/permission_icon"
android:layout_width="36dip"
android:layout_height="36dip"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginBottom="12dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_cloud_bell"
app:tint="?attr/colorAccent">
......@@ -55,47 +49,52 @@
<TextView
android:id="@+id/permission_message"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dip"
android:paddingLeft="16dip"
android:text="Allow {appName} to register for push notifications?"
android:textSize="20sp">
android:gravity="center"
android:text="@string/gcm_allow_app_popup"
android:textSize="18sp">
</TextView>
</LinearLayout>
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.25dp"
android:background="?android:attr/textColorSecondary" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal"
android:paddingStart="20dip"
android:paddingLeft="20dip"
android:paddingEnd="16dip"
android:paddingRight="16dip">
android:orientation="vertical">
<Button
android:id="@+id/permission_deny_button"
style="?attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/deny">
android:id="@+id/permission_allow_button"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="?android:attr/selectableItemBackground"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="@string/allow">
</Button>
<View
android:layout_width="match_parent"
android:layout_height="0.25dp"
android:background="?android:attr/textColorSecondary" />
<Button
android:id="@+id/permission_allow_button"
style="?attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/allow">
android:id="@+id/permission_deny_button"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="?android:attr/selectableItemBackground"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="@string/deny">
</Button>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</ScrollView>
......@@ -171,6 +171,7 @@ This can take a couple of minutes."</string>
<string name="gcm_network_state_disconnected">Disconnected</string>
<string name="gcm_network_state_connected">Connected since <xliff:g example="2 hours ago">%1$s</xliff:g></string>
<string name="gcm_enable_switch">Receive push notifications</string>
<string name="gcm_allow_app_popup">Allow <xliff:g example="F-Droid">%1$s</xliff:g> to register for push notifications?</string>
<string name="pref_push_app_allow_register_title">Allow registration</string>
<string name="pref_push_app_allow_register_summary">Allow the app to register for push notifications.</string>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment