From fab22969279b785cfa7b8566652714e3a1c339a6 Mon Sep 17 00:00:00 2001 From: Jake McGinty <me@jake.su> Date: Tue, 12 May 2015 14:46:50 -0700 Subject: [PATCH] turn RegistrationProblemsActivity into a dialog // FREEBIE --- AndroidManifest.xml | 4 - res/layout/registration_problems.xml | 205 ++++++++---------- .../RegistrationProblemsActivity.java | 24 -- .../RegistrationProgressActivity.java | 10 +- 4 files changed, 93 insertions(+), 150 deletions(-) delete mode 100644 src/org/thoughtcrime/securesms/RegistrationProblemsActivity.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 05eb86c62b..f208488743 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -50,10 +50,6 @@ <meta-data android:name="org.thoughtcrime.securesms.mms.TextSecureGlideModule" android:value="GlideModule" /> - <activity android:name=".RegistrationProblemsActivity" - android:theme="@style/Theme.AppCompat.Light.DialogWhenLarge" - android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> - <activity android:name=".CountrySelectionActivity" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> diff --git a/res/layout/registration_problems.xml b/res/layout/registration_problems.xml index 7abfbb522a..b142f5db38 100644 --- a/res/layout/registration_problems.xml +++ b/res/layout/registration_problems.xml @@ -1,140 +1,107 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dip" - android:paddingRight="10dip" - android:baselineAligned="false"> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> - <ScrollView android:layout_alignParentTop="true" - android:layout_above="@+id/button_frame" - android:layout_height="wrap_content" - android:layout_width="fill_parent" - android:paddingTop="5dip" - android:paddingBottom="12dip"> + <TextView + style="@style/Registration.Description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="10dip" + android:text="@string/registration_problems__some_possible_problems_include" /> - <LinearLayout - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> + <TableLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" > + + <TableRow> <TextView style="@style/Registration.Description" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginBottom="10dip" - android:text="@string/registration_problems__some_possible_problems_include" /> + android:paddingRight="10dip" + android:text="•" /> - <TableLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" > + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" > - <TableRow> + <TextView + style="@style/Registration.Description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/registration_problems__sms_interceptors" + android:textStyle="bold" /> - <TextView - style="@style/Registration.Description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingRight="10dip" - android:text="•" /> + <TextView + style="@style/Registration.Description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingRight="10dip" + android:text="@string/registration_problems__some_third_party_text_messaging_clients_such_as_handcent" /> + </LinearLayout> + </TableRow> - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" > + <TableRow> - <TextView - style="@style/Registration.Description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/registration_problems__sms_interceptors" - android:textStyle="bold" /> + <TextView + style="@style/Registration.Description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingRight="10dip" + android:text="•" /> - <TextView - style="@style/Registration.Description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingRight="10dip" - android:text="@string/registration_problems__some_third_party_text_messaging_clients_such_as_handcent" /> - </LinearLayout> - </TableRow> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" > - <TableRow> + <TextView + style="@style/Registration.Description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/registration_problems__incorrect_number" + android:textStyle="bold" /> - <TextView - style="@style/Registration.Description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingRight="10dip" - android:text="•" /> + <TextView + style="@style/Registration.Description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingRight="10dip" + android:text="@string/registration_problems__please_checkt_to_make_sure_you_entered_your_number_correctly" /> + </LinearLayout> + </TableRow> - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" > + <TableRow> - <TextView - style="@style/Registration.Description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/registration_problems__incorrect_number" - android:textStyle="bold" /> + <TextView + style="@style/Registration.Description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="•" /> - <TextView - style="@style/Registration.Description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingRight="10dip" - android:text="@string/registration_problems__please_checkt_to_make_sure_you_entered_your_number_correctly" /> - </LinearLayout> - </TableRow> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" > - <TableRow> + <TextView + style="@style/Registration.Description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/registration_problems__google_voice" + android:textStyle="bold" /> - <TextView - style="@style/Registration.Description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="•" /> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" > - - <TextView - style="@style/Registration.Description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/registration_problems__google_voice" - android:textStyle="bold" /> - - <TextView - style="@style/Registration.Description" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingRight="10dip" - android:text="@string/registration_problems__textsecure_will_not_work_with_google_voice_numbers" /> - </LinearLayout> - </TableRow> - </TableLayout> - </LinearLayout> - </ScrollView> - - <LinearLayout android:id="@+id/button_frame" - android:layout_alignParentBottom="true" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:minHeight="54dip" - android:orientation="vertical" - android:gravity="center"> - - <Button android:id="@+id/close_button" - android:layout_width="fill_parent" - android:layout_gravity="center" - android:layout_height="wrap_content" - android:paddingLeft="10dip" - android:paddingRight="10dip" - android:text="@android:string/ok"/> - </LinearLayout> -</RelativeLayout> \ No newline at end of file + <TextView + style="@style/Registration.Description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingRight="10dip" + android:text="@string/registration_problems__textsecure_will_not_work_with_google_voice_numbers" /> + </LinearLayout> + </TableRow> + </TableLayout> +</LinearLayout> diff --git a/src/org/thoughtcrime/securesms/RegistrationProblemsActivity.java b/src/org/thoughtcrime/securesms/RegistrationProblemsActivity.java deleted file mode 100644 index d313f8e8f5..0000000000 --- a/src/org/thoughtcrime/securesms/RegistrationProblemsActivity.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.thoughtcrime.securesms; - -import android.os.Bundle; -import android.support.v7.app.ActionBarActivity; -import android.view.View; -import android.widget.Button; - - -public class RegistrationProblemsActivity extends BaseActionBarActivity { - - @Override - public void onCreate(Bundle bundle) { - super.onCreate(bundle); - setContentView(R.layout.registration_problems); - setTitle(getString(R.string.RegistrationProblemsActivity_possible_problems)); - - ((Button)findViewById(R.id.close_button)).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - finish(); - } - }); - } -} diff --git a/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java b/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java index c696b2c7cc..123d4dd789 100644 --- a/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java +++ b/src/org/thoughtcrime/securesms/RegistrationProgressActivity.java @@ -31,6 +31,8 @@ import android.widget.TextView; import android.widget.Toast; +import com.afollestad.materialdialogs.MaterialDialog; + import org.thoughtcrime.securesms.crypto.MasterSecret; import org.thoughtcrime.securesms.push.TextSecureCommunicationFactory; import org.thoughtcrime.securesms.service.KeyCachingService; @@ -171,9 +173,11 @@ public class RegistrationProgressActivity extends BaseActionBarActivity { spannableString.setSpan(new ClickableSpan() { @Override public void onClick(View widget) { - Intent intent = new Intent(RegistrationProgressActivity.this, - RegistrationProblemsActivity.class); - startActivity(intent); + new MaterialDialog.Builder(RegistrationProgressActivity.this) + .title(R.string.RegistrationProblemsActivity_possible_problems) + .customView(R.layout.registration_problems, true) + .neutralText(android.R.string.ok) + .show(); } }, pretext.length() + 1, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);