migrate to AppCompatDialog

closes #3222
This commit is contained in:
agrajaghh 2015-05-20 23:36:30 +02:00 committed by Moxie Marlinspike
parent 927aac2c4a
commit c4339813e6
27 changed files with 221 additions and 227 deletions

View File

@ -297,7 +297,7 @@
android:finishOnTaskLaunch="true" />
<activity android:name=".PlayServicesProblemActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:theme="@style/TextSecure.DialogActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<activity android:name=".SmsSendtoActivity">

View File

@ -29,9 +29,6 @@ repositories {
maven { // textdrawable
url 'https://dl.bintray.com/amulyakhare/maven'
}
maven { // material-dialogs
url "https://jitpack.io"
}
maven { // cwac-camera
url 'https://repo.commonsware.com.s3.amazonaws.com'
}
@ -51,12 +48,6 @@ dependencies {
compile 'com.makeramen:roundedimageview:2.1.0'
compile 'com.pnikosis:materialish-progress:1.5'
compile 'de.greenrobot:eventbus:2.4.0'
compile ('com.afollestad:material-dialogs:0.7.3.1') {
exclude module: 'appcompat-v7'
exclude module: 'recyclerview-v7'
exclude module: 'support-annotations'
}
compile 'pl.tajchert:waitingdots:0.1.0'
compile 'com.soundcloud.android:android-crop:0.9.10@aar'
compile 'com.android.support:appcompat-v7:22.2.1'
@ -116,7 +107,6 @@ dependencyVerification {
'com.makeramen:roundedimageview:1f5a1865796b308c6cdd114acc6e78408b110f0a62fc63553278fbeacd489cd1',
'com.pnikosis:materialish-progress:d71d80e00717a096784482aee21001a9d299fec3833e4ebd87739ed36cf77c54',
'de.greenrobot:eventbus:61d743a748156a372024d083de763b9e91ac2dcb3f6a1cbc74995c7ddab6e968',
'com.afollestad:material-dialogs:624dffff240533ca69414464f416c81c88c5c29689bb169093b9a333104f2471',
'pl.tajchert:waitingdots:2835d49e0787dbcb606c5a60021ced66578503b1e9fddcd7a5ef0cd5f095ba2c',
'com.soundcloud.android:android-crop:ffd4b973cf6e97f7d64118a0dc088df50e9066fd5634fe6911dd0c0c5d346177',
'com.android.support:appcompat-v7:4b5ccba8c4557ef04f99aa0a80f8aa7d50f05f926a709010a54afd5c878d3618',

View File

@ -1,107 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<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" />
<TableLayout
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
android:layout_height="fill_parent"
android:paddingTop="24dp"
android:paddingLeft="24dp"
android:paddingRight="24dp">
<TableRow>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<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:layout_marginBottom="10dip"
android:text="@string/registration_problems__some_possible_problems_include" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<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" />
<TableRow>
<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>
android:text="•" />
<TableRow>
<TextView
style="@style/Registration.Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="10dip"
android:text="•" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
style="@style/Registration.Description"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/registration_problems__incorrect_number"
android:textStyle="bold" />
android:orientation="vertical" >
<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="@string/registration_problems__some_third_party_text_messaging_clients_such_as_handcent" />
</LinearLayout>
</TableRow>
<TableRow>
<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>
android:text="•" />
<TableRow>
<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="•" />
<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" />
<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:paddingRight="10dip"
android:text="@string/registration_problems__please_checkt_to_make_sure_you_entered_your_number_correctly" />
</LinearLayout>
</TableRow>
<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" />
android:text="•" />
<TextView
style="@style/Registration.Description"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="10dip"
android:text="@string/registration_problems__signal_will_not_work_with_google_voice_numbers" />
</LinearLayout>
</TableRow>
</TableLayout>
</LinearLayout>
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__signal_will_not_work_with_google_voice_numbers" />
</LinearLayout>
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>

View File

@ -9,7 +9,7 @@
<item name="android:windowAnimationStyle">@null</item>
</style>
<style name="TextSecure.DialogActivity" parent="Theme.AppCompat">
<style name="TextSecure.DialogActivity" parent="Theme.AppCompat.Light">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
@ -18,6 +18,13 @@
<item name="android:backgroundDimEnabled">false</item>
</style>
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/textsecure_primary_dark</item>
<item name="colorPrimary">@color/textsecure_primary</item>
<item name="colorPrimaryDark">@color/textsecure_primary_dark</item>
<item name="android:textColorLink">@color/textsecure_primary_dark</item>
</style>
<!-- ActionBar styles -->
<style name="TextSecure.DarkActionBar"
parent="@style/Widget.AppCompat.ActionBar">

View File

@ -88,6 +88,7 @@
<item name="colorPrimaryDark">@color/textsecure_primary_dark</item>
<item name="colorAccent">@color/textsecure_primary_dark</item>
<item name="android:windowBackground">@color/gray5</item>
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
<!--<item name="android:windowContentOverlay">@drawable/compat_actionbar_shadow_background</item>-->
<item name="attachment_type_selector_background">@color/white</item>
<item name="conversation_list_item_background_selected">@drawable/list_selected_holo_light</item>
@ -202,7 +203,6 @@
<item name="android:textColor">@color/text_color_dark_theme</item>
<item name="android:textColorSecondary">@color/text_color_secondary_dark_theme</item>
<item name="android:windowBackground">@color/black</item>
<item name="md_dark_theme">true</item>
<item name="conversation_list_item_background_selected">@drawable/list_selected_holo_dark</item>
<item name="conversation_list_item_background_unread">@drawable/conversation_list_item_unread_background_dark</item>
<item name="conversation_list_item_background_read">@drawable/conversation_list_item_background</item>

View File

@ -19,7 +19,6 @@
package org.thoughtcrime.redphone;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
@ -31,12 +30,11 @@ import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.redphone.ui.CallControls;
import org.thoughtcrime.redphone.ui.CallScreen;
import org.thoughtcrime.redphone.util.AudioUtils;
@ -248,7 +246,7 @@ public class RedPhone extends Activity {
private void handleNoSuchUser(final @NonNull RedPhoneEvent event) {
if (isFinishing()) return; // XXX Stuart added this check above, not sure why, so I'm repeating in ignorance. - moxie
AlertDialogWrapper.Builder dialog = new AlertDialogWrapper.Builder(this);
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(R.string.RedPhone_number_not_registered);
dialog.setIconAttribute(R.attr.dialog_alert_icon);
dialog.setMessage(R.string.RedPhone_the_number_you_dialed_does_not_support_secure_voice);

View File

@ -34,6 +34,7 @@ import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.support.v4.view.WindowCompat;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
@ -52,7 +53,6 @@ import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import com.commonsware.cwac.camera.CameraHost.FailureReason;
import com.google.protobuf.ByteString;
@ -465,7 +465,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
}
private void handleUnblock() {
new AlertDialogWrapper.Builder(this)
new AlertDialog.Builder(this)
.setTitle(R.string.ConversationActivity_unblock_question)
.setMessage(R.string.ConversationActivity_are_you_sure_you_want_to_unblock_this_contact)
.setNegativeButton(android.R.string.cancel, null)
@ -497,7 +497,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
}
private void handleResetSecureSession() {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.ConversationActivity_reset_secure_session_confirmation);
builder.setIconAttribute(R.attr.dialog_alert_icon);
builder.setCancelable(true);
@ -543,7 +543,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
return;
}
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.ConversationActivity_leave_group));
builder.setIconAttribute(R.attr.dialog_info_icon);
builder.setCancelable(true);
@ -645,7 +645,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
}
private void handleDeleteThread() {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.ConversationActivity_delete_thread_confirmation);
builder.setIconAttribute(R.attr.dialog_alert_icon);
builder.setCancelable(true);
@ -1036,7 +1036,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
numberItems[i] = contactData.numbers.get(i).type + ": " + contactData.numbers.get(i).number;
}
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setIconAttribute(R.attr.conversation_attach_contact_info);
builder.setTitle(R.string.ConversationActivity_select_contact_info);

View File

@ -28,6 +28,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AlertDialog;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
@ -44,8 +45,6 @@ import android.view.ViewGroup;
import android.view.Window;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.securesms.ConversationAdapter.ItemClickListener;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.database.DatabaseFactory;
@ -252,8 +251,8 @@ public class ConversationFragment extends Fragment
}
private void handleDeleteMessages(final Set<MessageRecord> messageRecords) {
int messagesCount = messageRecords.size();
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
int messagesCount = messageRecords.size();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setIconAttribute(R.attr.dialog_alert_icon);
builder.setTitle(getActivity().getResources().getQuantityString(R.plurals.ConversationFragment_delete_selected_messages, messagesCount, messagesCount));

View File

@ -26,6 +26,7 @@ import android.graphics.PorterDuff;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.text.util.Linkify;
import android.util.AttributeSet;
@ -39,8 +40,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.securesms.components.AudioView;
import org.thoughtcrime.securesms.components.AvatarImageView;
import org.thoughtcrime.securesms.components.ThumbnailView;
@ -481,7 +480,7 @@ public class ConversationItem extends LinearLayout
context.startActivity(intent);
} else {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.ConversationItem_view_secure_media_question);
builder.setIconAttribute(R.attr.dialog_alert_icon);
builder.setCancelable(true);
@ -569,7 +568,7 @@ public class ConversationItem extends LinearLayout
message = R.string.ConversationItem_click_to_approve_unencrypted_dialog_message;
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
if (message > -1) builder.setMessage(message);

View File

@ -30,6 +30,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AlertDialog;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
@ -42,7 +43,6 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import com.melnykov.fab.FloatingActionButton;
import org.thoughtcrime.securesms.ConversationListAdapter.ItemClickListener;
@ -171,8 +171,8 @@ public class ConversationListFragment extends Fragment
}
private void handleDeleteAllSelected() {
int conversationsCount = getListAdapter().getBatchSelections().size();
AlertDialogWrapper.Builder alert = new AlertDialogWrapper.Builder(getActivity());
int conversationsCount = getListAdapter().getBatchSelections().size();
AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
alert.setIconAttribute(R.attr.dialog_alert_icon);
alert.setTitle(getActivity().getResources().getQuantityString(R.plurals.ConversationListFragment_delete_selected_conversations,
conversationsCount, conversationsCount));

View File

@ -8,6 +8,7 @@ import android.support.annotation.NonNull;
import android.support.v4.app.ListFragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
@ -18,8 +19,6 @@ import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.database.loaders.DeviceListLoader;
import org.thoughtcrime.securesms.dependencies.InjectableType;
@ -141,7 +140,7 @@ public class DeviceListActivity extends PassphraseRequiredActionBarActivity {
final String deviceName = ((DeviceListItem)view).getDeviceName();
final long deviceId = ((DeviceListItem)view).getDeviceId();
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(getActivity().getString(R.string.DeviceListActivity_unlink_s, deviceName));
builder.setMessage(R.string.DeviceListActivity_by_unlinking_this_device_it_will_no_longer_be_able_to_send_or_receive);
builder.setNegativeButton(android.R.string.cancel, null);
@ -155,7 +154,7 @@ public class DeviceListActivity extends PassphraseRequiredActionBarActivity {
}
private void handleLoaderFailed() {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.DeviceListActivity_network_connection_failed);
builder.setPositiveButton(R.string.DeviceListActivity_try_again,
new DialogInterface.OnClickListener() {

View File

@ -2,19 +2,16 @@ package org.thoughtcrime.securesms;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.text.SpannableStringBuilder;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Toast;
import com.afollestad.materialdialogs.MaterialDialog;
import com.afollestad.materialdialogs.MaterialDialog.Builder;
import com.afollestad.materialdialogs.MaterialDialog.ButtonCallback;
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.push.TextSecureCommunicationFactory;
@ -56,40 +53,44 @@ public class DeviceProvisioningActivity extends PassphraseRequiredActionBarActiv
.append("\n")
.append(small(getString(R.string.DeviceProvisioningActivity_content_bullets)));
new Builder(this).title(getString(R.string.DeviceProvisioningActivity_link_this_device))
.iconRes(R.drawable.icon_dialog)
.content(content)
.positiveText(R.string.DeviceProvisioningActivity_continue)
.negativeText(R.string.DeviceProvisioningActivity_cancel)
.positiveColorRes(R.color.textsecure_primary)
.negativeColorRes(R.color.gray50)
.autoDismiss(false)
.callback(new ButtonCallback() {
@Override
public void onPositive(MaterialDialog dialog) {
handleProvisioning(dialog);
}
final AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle(R.string.DeviceProvisioningActivity_link_this_device)
.setIconAttribute(R.drawable.icon_dialog)
.setMessage(content)
.setPositiveButton(R.string.DeviceProvisioningActivity_continue, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@Override
public void onNegative(MaterialDialog dialog) {
dialog.dismiss();
finish();
}
})
.dismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
})
.show();
}
})
.setNegativeButton(R.string.DeviceProvisioningActivity_cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
})
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
})
.create();
dialog.show();
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
handleProvisioning(dialog);
}
});
}
private void initializeResources() {
this.uri = getIntent().getData();
}
private void handleProvisioning(final MaterialDialog dialog) {
private void handleProvisioning(final AlertDialog dialog) {
new ProgressDialogAsyncTask<Void, Void, Integer>(this,
R.string.DeviceProvisioningActivity_content_progress_title,
R.string.DeviceProvisioningActivity_content_progress_content)

View File

@ -7,14 +7,13 @@ import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.database.NoExternalStorageException;
import org.thoughtcrime.securesms.database.PlaintextBackupExporter;
@ -73,7 +72,7 @@ public class ExportFragment extends Fragment {
// }
private void handleExportPlaintextBackup() {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setIconAttribute(R.attr.dialog_alert_icon);
builder.setTitle(getActivity().getString(R.string.ExportFragment_export_plaintext_to_storage));
builder.setMessage(getActivity().getString(R.string.ExportFragment_warning_this_will_export_the_plaintext_contents));

View File

@ -6,10 +6,9 @@ import android.content.Intent;
import android.graphics.Rect;
import android.os.AsyncTask;
import android.provider.ContactsContract;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientFactory;
@ -53,7 +52,7 @@ public class GroupMembersDialog extends AsyncTask<Void, Void, Recipients> {
@Override
public void onPostExecute(Recipients members) {
GroupMembers groupMembers = new GroupMembers(members);
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.ConversationActivity_group_members);
builder.setIconAttribute(R.attr.group_members_dialog_icon);
builder.setCancelable(true);

View File

@ -1,6 +1,5 @@
package org.thoughtcrime.securesms;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
@ -8,14 +7,13 @@ import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.EncryptedBackupExporter;
@ -82,7 +80,7 @@ public class ImportFragment extends Fragment {
}
private void handleImportSms() {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setIconAttribute(R.attr.dialog_info_icon);
builder.setTitle(getActivity().getString(R.string.ImportFragment_import_system_sms_database));
builder.setMessage(getActivity().getString(R.string.ImportFragment_this_will_import_messages_from_the_system));
@ -106,7 +104,7 @@ public class ImportFragment extends Fragment {
}
private void handleImportEncryptedBackup() {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setIconAttribute(R.attr.dialog_alert_icon);
builder.setTitle(getActivity().getString(R.string.ImportFragment_restore_encrypted_backup));
builder.setMessage(getActivity().getString(R.string.ImportFragment_restoring_an_encrypted_backup_will_completely_replace_your_existing_keys));
@ -121,7 +119,7 @@ public class ImportFragment extends Fragment {
}
private void handleImportPlaintextBackup() {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setIconAttribute(R.attr.dialog_alert_icon);
builder.setTitle(getActivity().getString(R.string.ImportFragment_import_plaintext_backup));
builder.setMessage(getActivity().getString(R.string.ImportFragment_this_will_import_messages_from_a_plaintext_backup));

View File

@ -3,17 +3,27 @@ package org.thoughtcrime.securesms;
import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.NonNull;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import android.support.v7.app.AlertDialog;
import java.util.concurrent.TimeUnit;
public class MuteDialog extends AlertDialogWrapper {
public class MuteDialog extends AlertDialog {
private MuteDialog() {}
protected MuteDialog(Context context) {
super(context);
}
protected MuteDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
}
protected MuteDialog(Context context, int theme) {
super(context, theme);
}
public static void show(final Context context, final @NonNull MuteSelectionListener listener) {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.MuteDialog_mute_notifications);
builder.setItems(R.array.mute_durations, new DialogInterface.OnClickListener() {
@Override

View File

@ -23,8 +23,8 @@ import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.gms.common.GooglePlayServicesUtil;
public class PlayServicesProblemFragment extends DialogFragment {
@ -35,9 +35,10 @@ public class PlayServicesProblemFragment extends DialogFragment {
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(code, getActivity(), 9111);
if (dialog == null) {
return new MaterialDialog.Builder(getActivity()).negativeText(android.R.string.ok)
.content(getActivity().getString(R.string.PlayServicesProblemFragment_the_version_of_google_play_services_you_have_installed_is_not_functioning))
.build();
return new AlertDialog.Builder(getActivity())
.setNegativeButton(android.R.string.ok, null)
.setMessage(R.string.PlayServicesProblemFragment_the_version_of_google_play_services_you_have_installed_is_not_functioning)
.create();
} else {
return dialog;
}

View File

@ -16,14 +16,13 @@ import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.preference.PreferenceFragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.securesms.color.MaterialColor;
import org.thoughtcrime.securesms.color.MaterialColors;
import org.thoughtcrime.securesms.components.AvatarImageView;
@ -380,7 +379,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
}
private void handleBlock() {
new AlertDialogWrapper.Builder(getActivity())
new AlertDialog.Builder(getActivity())
.setTitle(R.string.RecipientPreferenceActivity_block_this_contact_question)
.setMessage(R.string.RecipientPreferenceActivity_you_will_no_longer_receive_messages_or_calls_from_this_user)
.setCancelable(true)
@ -394,7 +393,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
}
private void handleUnblock() {
new AlertDialogWrapper.Builder(getActivity())
new AlertDialog.Builder(getActivity())
.setTitle(R.string.RecipientPreferenceActivity_unblock_this_contact_question)
.setMessage(R.string.RecipientPreferenceActivity_are_you_sure_you_want_to_unblock_this_contact)
.setCancelable(true)

View File

@ -5,6 +5,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextUtils;
@ -18,7 +19,6 @@ import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.i18n.phonenumbers.AsYouTypeFormatter;
@ -207,7 +207,7 @@ public class RegistrationActivity extends BaseActionBarActivity {
return;
}
AlertDialogWrapper.Builder dialog = new AlertDialogWrapper.Builder(self);
AlertDialog.Builder dialog = new AlertDialog.Builder(self);
dialog.setTitle(PhoneNumberFormatter.getInternationalFormatFromE164(e164number));
dialog.setMessage(R.string.RegistrationActivity_we_will_now_verify_that_the_following_number_is_associated_with_your_device_s);
dialog.setPositiveButton(getString(R.string.RegistrationActivity_continue),

View File

@ -13,6 +13,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.support.v7.app.AlertDialog;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
@ -29,8 +30,6 @@ import android.widget.RelativeLayout;
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.RegistrationService;
@ -172,11 +171,11 @@ public class RegistrationProgressActivity extends BaseActionBarActivity {
spannableString.setSpan(new ClickableSpan() {
@Override
public void onClick(View widget) {
new MaterialDialog.Builder(RegistrationProgressActivity.this)
.title(R.string.RegistrationProblemsActivity_possible_problems)
.customView(R.layout.registration_problems, true)
.neutralText(android.R.string.ok)
.show();
new AlertDialog.Builder(RegistrationProgressActivity.this)
.setTitle(R.string.RegistrationProblemsActivity_possible_problems)
.setView(R.layout.registration_problems)
.setNeutralButton(android.R.string.ok, null)
.show();
}
}, pretext.length() + 1, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

View File

@ -1,13 +1,13 @@
package org.thoughtcrime.securesms.components;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import com.afollestad.materialdialogs.MaterialDialog;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
@ -34,34 +34,30 @@ public class RatingManager {
}
private static void showRatingDialog(final Context context) {
new MaterialDialog.Builder(context)
.title(context.getString(R.string.RatingManager_rate_this_app))
.content(context.getString(R.string.RatingManager_if_you_enjoy_using_this_app_please_take_a_moment))
.positiveText(context.getString(R.string.RatingManager_rate_now))
.negativeText(context.getString(R.string.RatingManager_no_thanks))
.neutralText(context.getString(R.string.RatingManager_later))
.callback(new MaterialDialog.ButtonCallback() {
new AlertDialog.Builder(context)
.setTitle(R.string.RatingManager_rate_this_app)
.setMessage(R.string.RatingManager_if_you_enjoy_using_this_app_please_take_a_moment)
.setPositiveButton(R.string.RatingManager_rate_now, new DialogInterface.OnClickListener() {
@Override
public void onPositive(MaterialDialog dialog) {
public void onClick(DialogInterface dialog, int which) {
TextSecurePreferences.setRatingEnabled(context, false);
startPlayStore(context);
super.onPositive(dialog);
}
@Override
public void onNegative(MaterialDialog dialog) {
TextSecurePreferences.setRatingEnabled(context, false);
super.onNegative(dialog);
}
@Override
public void onNeutral(MaterialDialog dialog) {
long waitUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(DAYS_UNTIL_REPROMPT_THRESHOLD);
TextSecurePreferences.setRatingLaterTimestamp(context, waitUntil);
super.onNeutral(dialog);
}
})
.show();
}
})
.setNegativeButton(R.string.RatingManager_no_thanks, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
TextSecurePreferences.setRatingEnabled(context, false);
}
})
.setNeutralButton(R.string.RatingManager_later, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
long waitUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(DAYS_UNTIL_REPROMPT_THRESHOLD);
TextSecurePreferences.setRatingLaterTimestamp(context, waitUntil);
}
})
.show();
}
private static void startPlayStore(Context context) {

View File

@ -13,10 +13,10 @@ import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.preference.PreferenceFragment;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import com.google.android.gms.gcm.GoogleCloudMessaging;
import org.thoughtcrime.redphone.signaling.RedPhoneAccountManager;
@ -210,7 +210,7 @@ public class AdvancedPreferenceFragment extends PreferenceFragment {
@Override
public boolean onPreferenceChange(final Preference preference, Object newValue) {
if (((CheckBoxPreference)preference).isChecked()) {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setIconAttribute(R.attr.dialog_info_icon);
builder.setTitle(R.string.ApplicationPreferencesActivity_disable_signal_messages_and_calls);
builder.setMessage(R.string.ApplicationPreferencesActivity_disable_signal_messages_and_calls_by_unregistering);

View File

@ -10,9 +10,9 @@ import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.support.v4.preference.PreferenceFragment;
import android.support.v7.app.AlertDialog;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import com.doomonafireball.betterpickers.hmspicker.HmsPickerBuilder;
import com.doomonafireball.betterpickers.hmspicker.HmsPickerDialogFragment;
@ -136,7 +136,7 @@ public class AppProtectionPreferenceFragment extends PreferenceFragment {
@Override
public boolean onPreferenceChange(final Preference preference, Object newValue) {
if (((CheckBoxPreference)preference).isChecked()) {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.ApplicationPreferencesActivity_disable_passphrase);
builder.setMessage(R.string.ApplicationPreferencesActivity_disable_lock_screen);
builder.setIconAttribute(R.attr.dialog_alert_icon);

View File

@ -4,25 +4,20 @@ import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.MultiSelectListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.support.v4.preference.PreferenceFragment;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.Log;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.Trimmer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class ChatsPreferenceFragment extends PreferenceFragment {
@ -80,7 +75,7 @@ public class ChatsPreferenceFragment extends PreferenceFragment {
@Override
public boolean onPreferenceClick(Preference preference) {
final int threadLengthLimit = TextSecurePreferences.getThreadTrimLength(getActivity());
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.ApplicationPreferencesActivity_delete_all_old_messages_now);
builder.setMessage(getString(R.string.ApplicationPreferencesActivity_are_you_sure_you_would_like_to_immediately_trim_all_conversation_threads_to_the_s_most_recent_messages,
threadLengthLimit));

View File

@ -20,6 +20,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.os.Parcelable;
import android.preference.ListPreference;
import android.support.v7.app.AlertDialog;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@ -28,8 +29,6 @@ import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
@ -78,7 +77,7 @@ public class LedBlinkPatternListPreference extends ListPreference implements OnS
}
private void initializeDialog(View view) {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setIconAttribute(R.attr.dialog_info_icon);
builder.setTitle(R.string.preferences__pref_led_blink_custom_pattern_title);
builder.setView(view);

View File

@ -17,14 +17,13 @@
package org.thoughtcrime.securesms.util;
import android.content.Context;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import android.support.v7.app.AlertDialog;
import org.thoughtcrime.securesms.R;
public class Dialogs {
public static void showAlertDialog(Context context, String title, String message) {
AlertDialogWrapper.Builder dialog = new AlertDialogWrapper.Builder(context);
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
dialog.setTitle(title);
dialog.setMessage(message);
dialog.setIconAttribute(R.attr.dialog_alert_icon);
@ -33,7 +32,7 @@ public class Dialogs {
}
public static void showInfoDialog(Context context, String title, String message) {
AlertDialogWrapper.Builder dialog = new AlertDialogWrapper.Builder(context);
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
dialog.setTitle(title);
dialog.setMessage(message);
dialog.setIconAttribute(R.attr.dialog_info_icon);

View File

@ -5,12 +5,11 @@ import android.content.DialogInterface.OnClickListener;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Environment;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.webkit.MimeTypeMap;
import android.widget.Toast;
import com.afollestad.materialdialogs.AlertDialogWrapper;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.mms.PartAuthority;
@ -149,7 +148,7 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
}
public static void showWarningDialog(Context context, OnClickListener onAcceptListener) {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.ConversationFragment_save_to_sd_card);
builder.setIconAttribute(R.attr.dialog_alert_icon);
builder.setCancelable(true);