mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
remove TextSecurePreferences to Prefs which is more handy and has no branding
This commit is contained in:
@@ -46,7 +46,7 @@ import org.thoughtcrime.securesms.preferences.NotificationsPreferenceFragment;
|
||||
import org.thoughtcrime.securesms.preferences.widgets.ProfilePreference;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
/**
|
||||
* The Activity for application preference display and management.
|
||||
@@ -122,9 +122,9 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (key.equals(TextSecurePreferences.THEME_PREF)) {
|
||||
if (key.equals(Prefs.THEME_PREF)) {
|
||||
recreate();
|
||||
} else if (key.equals(TextSecurePreferences.LANGUAGE_PREF)) {
|
||||
} else if (key.equals(Prefs.LANGUAGE_PREF)) {
|
||||
recreate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.thoughtcrime.securesms.util.ScreenLockUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Timer;
|
||||
@@ -102,7 +102,7 @@ public abstract class BaseActionBarActivity extends AppCompatActivity {
|
||||
|
||||
private void initializeScreenshotSecurity() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH &&
|
||||
TextSecurePreferences.isScreenSecurityEnabled(this))
|
||||
Prefs.isScreenSecurityEnabled(this))
|
||||
{
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
||||
} else {
|
||||
|
||||
@@ -20,17 +20,15 @@ import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.components.ContactFilterToolbar;
|
||||
import org.thoughtcrime.securesms.contacts.ContactsCursorLoader.DisplayMode;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
@@ -61,7 +59,7 @@ public abstract class ContactSelectionActivity extends PassphraseRequiredActionB
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle, boolean ready) {
|
||||
if (!getIntent().hasExtra(ContactSelectionListFragment.DISPLAY_MODE)) {
|
||||
int displayMode = TextSecurePreferences.isSmsEnabled(this) ? DisplayMode.FLAG_ALL
|
||||
int displayMode = Prefs.isSmsEnabled(this) ? DisplayMode.FLAG_ALL
|
||||
: DisplayMode.FLAG_PUSH | DisplayMode.FLAG_GROUPS;
|
||||
getIntent().putExtra(ContactSelectionListFragment.DISPLAY_MODE, displayMode);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener;
|
||||
@@ -454,7 +454,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
return true;
|
||||
}
|
||||
|
||||
if (recipient != null && TextSecurePreferences.isChatMuted(this, threadId)) {
|
||||
if (recipient != null && Prefs.isChatMuted(this, threadId)) {
|
||||
inflater.inflate(R.menu.conversation_muted, menu);
|
||||
}
|
||||
else {
|
||||
@@ -529,7 +529,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
private void handleMuteNotifications() {
|
||||
MuteDialog.show(this, until -> {
|
||||
TextSecurePreferences.setChatMutedUntil(this, threadId, until);
|
||||
Prefs.setChatMutedUntil(this, threadId, until);
|
||||
titleView.setTitle(glideRequests, dcChat); // update title-mute-icon
|
||||
});
|
||||
}
|
||||
@@ -544,7 +544,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
}
|
||||
|
||||
private void handleUnmuteNotifications() {
|
||||
TextSecurePreferences.setChatMutedUntil(this, threadId, 0);
|
||||
Prefs.setChatMutedUntil(this, threadId, 0);
|
||||
titleView.setTitle(glideRequests, dcChat); // update title-mute-icon
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
quickCameraToggle.setEnabled(false);
|
||||
}
|
||||
|
||||
String backgroundImagePath = TextSecurePreferences.getBackgroundImagePath(this);
|
||||
String backgroundImagePath = Prefs.getBackgroundImagePath(this);
|
||||
if(!backgroundImagePath.isEmpty()) {
|
||||
Drawable image = Drawable.createFromPath(backgroundImagePath);
|
||||
getWindow().setBackgroundDrawable(image);
|
||||
@@ -1460,7 +1460,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
if (TextSecurePreferences.isEnterSendsEnabled(ConversationActivity.this)) {
|
||||
if (Prefs.isEnterSendsEnabled(ConversationActivity.this)) {
|
||||
sendButton.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
|
||||
sendButton.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER));
|
||||
return true;
|
||||
@@ -1506,7 +1506,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
Recipient author;
|
||||
|
||||
if (messageRecord.isOutgoing()) {
|
||||
author = Recipient.from(this, Address.fromSerialized(TextSecurePreferences.getLocalNumber(this)), true);
|
||||
author = Recipient.from(this, Address.fromSerialized(Prefs.getLocalNumber(this)), true);
|
||||
} else {
|
||||
author = messageRecord.getIndividualRecipient();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.LongClickCopySpan;
|
||||
import org.thoughtcrime.securesms.util.LongClickMovementMethod;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.views.Stub;
|
||||
@@ -296,7 +296,7 @@ public class ConversationItem extends LinearLayout
|
||||
|
||||
private void setAudioViewTint(DcMsg messageRecord, Recipient recipient) {
|
||||
if (messageRecord.isOutgoing()) {
|
||||
if (DynamicTheme.LIGHT.equals(TextSecurePreferences.getTheme(context))) {
|
||||
if (DynamicTheme.LIGHT.equals(Prefs.getTheme(context))) {
|
||||
audioViewStub.get().setTint(getContext().getResources().getColor(R.color.core_light_60), defaultBubbleColor);
|
||||
} else {
|
||||
audioViewStub.get().setTint(Color.WHITE, defaultBubbleColor);
|
||||
@@ -361,7 +361,7 @@ public class ConversationItem extends LinearLayout
|
||||
private void setBodyText(DcMsg messageRecord) {
|
||||
bodyText.setClickable(false);
|
||||
bodyText.setFocusable(false);
|
||||
bodyText.setTextSize(TypedValue.COMPLEX_UNIT_SP, TextSecurePreferences.getMessageBodyTextSize(context));
|
||||
bodyText.setTextSize(TypedValue.COMPLEX_UNIT_SP, Prefs.getMessageBodyTextSize(context));
|
||||
|
||||
String text = messageRecord.getText();
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.search.model.MessageResult;
|
||||
import org.thoughtcrime.securesms.util.DateUtils;
|
||||
import org.thoughtcrime.securesms.util.ResUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.ThemeUtil;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
@@ -172,7 +172,7 @@ public class ConversationListItem extends RelativeLayout
|
||||
}
|
||||
|
||||
fromView.setCompoundDrawablesWithIntrinsicBounds(
|
||||
TextSecurePreferences.isChatMuted(getContext(), (int)threadId)? R.drawable.ic_volume_off_grey600_18dp : 0,
|
||||
Prefs.isChatMuted(getContext(), (int)threadId)? R.drawable.ic_volume_off_grey600_18dp : 0,
|
||||
0,
|
||||
thread.isVerified()? R.drawable.ic_verified : 0,
|
||||
0);
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.b44t.messenger.DcChat;
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
public class ConversationTitleView extends RelativeLayout {
|
||||
@@ -60,7 +60,7 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
setComposeTitle();
|
||||
} else {
|
||||
setRecipientTitle(dcChat);
|
||||
if (TextSecurePreferences.isChatMuted(getContext(), dcChat.getId())) {
|
||||
if (Prefs.isChatMuted(getContext(), dcChat.getId())) {
|
||||
imgLeft = R.drawable.ic_volume_off_white_18dp;
|
||||
}
|
||||
if (dcChat.isVerified()) {
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.FileProviderUtil;
|
||||
import org.thoughtcrime.securesms.util.IntentUtils;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
||||
@@ -266,8 +266,8 @@ public class CreateProfileActivity extends BaseActionBarActivity {
|
||||
}
|
||||
|
||||
private void initializeProfileName(boolean excludeSystem) {
|
||||
if (!TextUtils.isEmpty(TextSecurePreferences.getProfileName(this))) {
|
||||
String profileName = TextSecurePreferences.getProfileName(this);
|
||||
if (!TextUtils.isEmpty(Prefs.getProfileName(this))) {
|
||||
String profileName = Prefs.getProfileName(this);
|
||||
|
||||
name.setText(profileName);
|
||||
name.setSelection(profileName.length(), profileName.length());
|
||||
@@ -426,11 +426,11 @@ public class CreateProfileActivity extends BaseActionBarActivity {
|
||||
Context context = CreateProfileActivity.this;
|
||||
DcHelper.set(context, DcHelper.CONFIG_DISPLAY_NAME, name);
|
||||
setStatusText();
|
||||
TextSecurePreferences.setProfileName(context, name);
|
||||
Prefs.setProfileName(context, name);
|
||||
|
||||
try {
|
||||
AvatarHelper.setSelfAvatar(CreateProfileActivity.this, DcHelper.get(context, DcHelper.CONFIG_ADDRESS), avatarBytes);
|
||||
TextSecurePreferences.setProfileAvatarId(CreateProfileActivity.this, new SecureRandom().nextInt());
|
||||
Prefs.setProfileAvatarId(CreateProfileActivity.this, new SecureRandom().nextInt());
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
return false;
|
||||
|
||||
@@ -59,8 +59,8 @@ import org.thoughtcrime.securesms.util.Dialogs;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences.VibrateState;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Prefs.VibrateState;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
@@ -329,12 +329,12 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
PreferenceCategory privacyCategory = (PreferenceCategory) this.findPreference("privacy_settings");
|
||||
PreferenceCategory divider = (PreferenceCategory) this.findPreference("divider");
|
||||
|
||||
mutePreference.setChecked(TextSecurePreferences.isChatMuted(getContext(), chatId));
|
||||
mutePreference.setChecked(Prefs.isChatMuted(getContext(), chatId));
|
||||
|
||||
ringtoneMessagePreference.setSummary(getRingtoneSummary(getContext(), recipient.getMessageRingtone()));
|
||||
ringtoneCallPreference.setSummary(getRingtoneSummary(getContext(), recipient.getCallRingtone()));
|
||||
|
||||
VibrateState vibrateState = TextSecurePreferences.getChatVibrate(getContext(), chatId);
|
||||
VibrateState vibrateState = Prefs.getChatVibrate(getContext(), chatId);
|
||||
Pair<String, Integer> vibrateMessageSummary = getVibrateSummary(getContext(), vibrateState);
|
||||
Pair<String, Integer> vibrateCallSummary = getVibrateSummary(getContext(), vibrateState);
|
||||
|
||||
@@ -435,13 +435,13 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
Uri value = (Uri)newValue;
|
||||
|
||||
Uri defaultValue = TextSecurePreferences.getNotificationRingtone(getContext());
|
||||
Uri defaultValue = Prefs.getNotificationRingtone(getContext());
|
||||
|
||||
if (defaultValue.equals(value)) value = null;
|
||||
else if (value == null) value = Uri.EMPTY;
|
||||
|
||||
int chatId = recipient.getAddress().isDcChat()? recipient.getAddress().getDcChatId() : 0;
|
||||
TextSecurePreferences.setChatRingtone(getContext(), chatId, value);
|
||||
Prefs.setChatRingtone(getContext(), chatId, value);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -458,7 +458,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Uri current = recipient.getMessageRingtone();
|
||||
Uri defaultUri = TextSecurePreferences.getNotificationRingtone(getContext());
|
||||
Uri defaultUri = Prefs.getNotificationRingtone(getContext());
|
||||
|
||||
if (current == null) current = Settings.System.DEFAULT_NOTIFICATION_URI;
|
||||
else if (current.toString().isEmpty()) current = null;
|
||||
@@ -490,7 +490,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
final VibrateState vibrateState = VibrateState.fromId(value);
|
||||
|
||||
int chatId = recipient.getAddress().isDcChat()? recipient.getAddress().getDcChatId() : 0;
|
||||
TextSecurePreferences.setChatVibrate(getContext(), chatId, vibrateState);
|
||||
Prefs.setChatVibrate(getContext(), chatId, vibrateState);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -533,7 +533,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
int chatId = recipient.getAddress().isDcChat()? recipient.getAddress().getDcChatId() : 0;
|
||||
|
||||
if (TextSecurePreferences.isChatMuted(getContext(), chatId)) {
|
||||
if (Prefs.isChatMuted(getContext(), chatId)) {
|
||||
handleUnmute();
|
||||
}
|
||||
else {
|
||||
@@ -552,7 +552,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
}
|
||||
|
||||
private void setMuted(final Recipient recipient, final long until) {
|
||||
TextSecurePreferences.setChatMutedUntil(getActivity(), recipient.getAddress().getDcChatId(), until);
|
||||
Prefs.setChatMutedUntil(getActivity(), recipient.getAddress().getDcChatId(), until);
|
||||
setSummaries(recipient);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,13 +51,12 @@ import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.FileUtils;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* An activity to quickly share content with contacts
|
||||
@@ -96,7 +95,7 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity
|
||||
protected void onCreate(Bundle icicle, boolean ready) {
|
||||
if (!getIntent().hasExtra(ContactSelectionListFragment.DISPLAY_MODE)) {
|
||||
getIntent().putExtra(ContactSelectionListFragment.DISPLAY_MODE,
|
||||
TextSecurePreferences.isSmsEnabled(this)
|
||||
Prefs.isSmsEnabled(this)
|
||||
? DisplayMode.FLAG_ALL
|
||||
: DisplayMode.FLAG_PUSH | DisplayMode.FLAG_GROUPS);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import android.view.inputmethod.InputConnection;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.TransportOption;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiEditText;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
public class ComposeText extends EmojiEditText {
|
||||
|
||||
@@ -109,8 +109,8 @@ public class ComposeText extends EmojiEditText {
|
||||
}
|
||||
|
||||
public void setTransport(TransportOption transport) {
|
||||
final boolean useSystemEmoji = TextSecurePreferences.isSystemEmojiPreferred(getContext());
|
||||
final boolean isIncognito = TextSecurePreferences.isIncognitoKeyboardEnabled(getContext());
|
||||
final boolean useSystemEmoji = Prefs.isSystemEmojiPreferred(getContext());
|
||||
final boolean isIncognito = Prefs.isIncognitoKeyboardEnabled(getContext());
|
||||
|
||||
int imeOptions = (getImeOptions() & ~EditorInfo.IME_MASK_ACTION) | EditorInfo.IME_ACTION_SEND;
|
||||
int inputType = getInputType();
|
||||
@@ -134,7 +134,7 @@ public class ComposeText extends EmojiEditText {
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
InputConnection inputConnection = super.onCreateInputConnection(editorInfo);
|
||||
|
||||
if(TextSecurePreferences.isEnterSendsEnabled(getContext())) {
|
||||
if(Prefs.isEnterSendsEnabled(getContext())) {
|
||||
editorInfo.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class ComposeText extends EmojiEditText {
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
if (TextSecurePreferences.isIncognitoKeyboardEnabled(getContext())) {
|
||||
if (Prefs.isIncognitoKeyboardEnabled(getContext())) {
|
||||
setImeOptions(getImeOptions() | 16777216);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import android.widget.TextView;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.CustomDefaultPreference.CustomDefaultPreferenceDialogFragmentCompat.CustomPreferenceValidator;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
public class CustomDefaultPreference extends DialogPreference {
|
||||
|
||||
@@ -75,19 +75,19 @@ public class CustomDefaultPreference extends DialogPreference {
|
||||
}
|
||||
|
||||
private boolean isCustom() {
|
||||
return TextSecurePreferences.getBooleanPreference(getContext(), customToggle, false);
|
||||
return Prefs.getBooleanPreference(getContext(), customToggle, false);
|
||||
}
|
||||
|
||||
private void setCustom(boolean custom) {
|
||||
TextSecurePreferences.setBooleanPreference(getContext(), customToggle, custom);
|
||||
Prefs.setBooleanPreference(getContext(), customToggle, custom);
|
||||
}
|
||||
|
||||
private String getCustomValue() {
|
||||
return TextSecurePreferences.getStringPreference(getContext(), customPreference, "");
|
||||
return Prefs.getStringPreference(getContext(), customPreference, "");
|
||||
}
|
||||
|
||||
private void setCustomValue(String value) {
|
||||
TextSecurePreferences.setStringPreference(getContext(), customPreference, value);
|
||||
Prefs.setStringPreference(getContext(), customPreference, value);
|
||||
}
|
||||
|
||||
private String getDefaultValue() {
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiTextView;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.ResUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.spans.CenterAlignedRelativeSizeSpan;
|
||||
|
||||
public class FromTextView extends EmojiTextView {
|
||||
@@ -74,7 +74,7 @@ public class FromTextView extends EmojiTextView {
|
||||
|
||||
int chatId = recipient.getAddress().isDcChat()? recipient.getAddress().getDcChatId() : 0;
|
||||
|
||||
if (TextSecurePreferences.isChatMuted(getContext(), chatId)) {
|
||||
if (Prefs.isChatMuted(getContext(), chatId)) {
|
||||
setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_volume_off_grey600_18dp, 0, 0, 0);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||
import org.thoughtcrime.securesms.mms.QuoteModel;
|
||||
import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.concurrent.AssertedSuccessListener;
|
||||
@@ -99,7 +99,7 @@ public class InputPanel extends LinearLayout
|
||||
this.microphoneRecorderView.setClickable(false);
|
||||
}
|
||||
|
||||
if (TextSecurePreferences.isSystemEmojiPreferred(getContext())) {
|
||||
if (Prefs.isSystemEmojiPreferred(getContext())) {
|
||||
emojiToggle.setVisibility(View.GONE);
|
||||
emojiVisible = false;
|
||||
} else {
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.jobmanager.JobParameters;
|
||||
import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.guava.Optional;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class CameraView extends ViewGroup {
|
||||
int camera = typedArray.getInt(R.styleable.CameraView_camera, -1);
|
||||
|
||||
if (camera != -1) cameraId = camera;
|
||||
else if (isMultiCamera()) cameraId = TextSecurePreferences.getDirectCaptureCameraId(context);
|
||||
else if (isMultiCamera()) cameraId = Prefs.getDirectCaptureCameraId(context);
|
||||
|
||||
typedArray.recycle();
|
||||
}
|
||||
@@ -268,7 +268,7 @@ public class CameraView extends ViewGroup {
|
||||
: CameraInfo.CAMERA_FACING_BACK;
|
||||
onPause();
|
||||
onResume();
|
||||
TextSecurePreferences.setDirectCaptureCameraId(getContext(), cameraId);
|
||||
Prefs.setDirectCaptureCameraId(getContext(), cameraId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import android.util.AttributeSet;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiProvider.EmojiDrawable;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
|
||||
public class EmojiEditText extends AppCompatEditText {
|
||||
@@ -26,7 +26,7 @@ public class EmojiEditText extends AppCompatEditText {
|
||||
|
||||
public EmojiEditText(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
if (!TextSecurePreferences.isSystemEmojiPreferred(getContext())) {
|
||||
if (!Prefs.isSystemEmojiPreferred(getContext())) {
|
||||
setFilters(appendEmojiFilter(this.getFilters()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import android.util.TypedValue;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiProvider.EmojiDrawable;
|
||||
import org.thoughtcrime.securesms.components.emoji.parsing.EmojiParser;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ public class EmojiTextView extends AppCompatTextView {
|
||||
}
|
||||
|
||||
private boolean useSystemEmoji() {
|
||||
return TextSecurePreferences.isSystemEmojiPreferred(getContext());
|
||||
return Prefs.isSystemEmojiPreferred(getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,7 @@ import android.support.annotation.RequiresApi;
|
||||
import android.view.View;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
@SuppressLint("BatteryLife")
|
||||
public class DozeReminder extends Reminder {
|
||||
@@ -24,7 +24,7 @@ public class DozeReminder extends Reminder {
|
||||
context.getString(R.string.DozeReminder_this_device_does_not_support_play_services_tap_to_disable_system_battery));
|
||||
|
||||
setOkListener(v -> {
|
||||
TextSecurePreferences.setPromptedOptimizeDoze(context, true);
|
||||
Prefs.setPromptedOptimizeDoze(context, true);
|
||||
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,
|
||||
Uri.parse("package:" + context.getPackageName()));
|
||||
context.startActivity(intent);
|
||||
@@ -33,7 +33,7 @@ public class DozeReminder extends Reminder {
|
||||
setDismissListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TextSecurePreferences.setPromptedOptimizeDoze(context, true);
|
||||
Prefs.setPromptedOptimizeDoze(context, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class DozeReminder extends Reminder {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !TextSecurePreferences.hasPromptedOptimizeDoze(context) &&
|
||||
return !Prefs.hasPromptedOptimizeDoze(context) &&
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
|
||||
!((PowerManager)context.getSystemService(Context.POWER_SERVICE)).isIgnoringBatteryOptimizations(context.getPackageName());
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientProvider;
|
||||
import org.thoughtcrime.securesms.util.Hash;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
@@ -43,10 +43,8 @@ import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ApplicationDcContext extends DcContext {
|
||||
|
||||
@@ -192,7 +190,7 @@ public class ApplicationDcContext extends DcContext {
|
||||
Recipient recipient = new Recipient(Address.fromChat(chat.getId()), recipientDetails);
|
||||
if (!chat.isGroup()) {
|
||||
String identifier = Hash.sha256(chat.getName() + chat.getSubtitle());
|
||||
Uri systemContactPhoto = TextSecurePreferences.getSystemContactPhoto(context, identifier);
|
||||
Uri systemContactPhoto = Prefs.getSystemContactPhoto(context, identifier);
|
||||
if (systemContactPhoto != null) {
|
||||
recipient.setSystemContactPhoto(systemContactPhoto);
|
||||
}
|
||||
@@ -205,7 +203,7 @@ public class ApplicationDcContext extends DcContext {
|
||||
RecipientProvider.RecipientDetails recipientDetails = new RecipientProvider.RecipientDetails(contact.getDisplayName(), null, false, null, null);
|
||||
Recipient recipient = new Recipient(Address.fromContact(contact.getId()), recipientDetails);
|
||||
String identifier = Hash.sha256(contact.getName() + contact.getAddr());
|
||||
Uri systemContactPhoto = TextSecurePreferences.getSystemContactPhoto(context, identifier);
|
||||
Uri systemContactPhoto = Prefs.getSystemContactPhoto(context, identifier);
|
||||
if (systemContactPhoto != null) {
|
||||
recipient.setSystemContactPhoto(systemContactPhoto);
|
||||
}
|
||||
|
||||
@@ -34,10 +34,9 @@ import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.util.Hash;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -114,7 +113,7 @@ public class ContactAccessor {
|
||||
result.append(name).append("\n").append(mail).append("\n");
|
||||
}
|
||||
}
|
||||
TextSecurePreferences.setSystemContactPhotos(context, contactPhotoIdentifiers);
|
||||
Prefs.setSystemContactPhotos(context, contactPhotoIdentifiers);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
|
||||
@@ -35,8 +35,8 @@ public class AttachmentSecretProvider {
|
||||
public synchronized AttachmentSecret getOrCreateAttachmentSecret() {
|
||||
if (attachmentSecret != null) return attachmentSecret;
|
||||
|
||||
String unencryptedSecret = TextSecurePreferences.getAttachmentUnencryptedSecret(context);
|
||||
String encryptedSecret = TextSecurePreferences.getAttachmentEncryptedSecret(context);
|
||||
String unencryptedSecret = Prefs.getAttachmentUnencryptedSecret(context);
|
||||
String encryptedSecret = Prefs.getAttachmentEncryptedSecret(context);
|
||||
|
||||
if (unencryptedSecret != null) attachmentSecret = getUnencryptedAttachmentSecret(context, unencryptedSecret);
|
||||
else if (encryptedSecret != null) attachmentSecret = getEncryptedAttachmentSecret(encryptedSecret);
|
||||
@@ -64,8 +64,8 @@ public class AttachmentSecretProvider {
|
||||
} else {
|
||||
KeyStoreHelper.SealedData encryptedSecret = KeyStoreHelper.seal(attachmentSecret.serialize().getBytes());
|
||||
|
||||
TextSecurePreferences.setAttachmentEncryptedSecret(context, encryptedSecret.serialize());
|
||||
TextSecurePreferences.setAttachmentUnencryptedSecret(context, null);
|
||||
Prefs.setAttachmentEncryptedSecret(context, encryptedSecret.serialize());
|
||||
Prefs.setAttachmentUnencryptedSecret(context, null);
|
||||
|
||||
return attachmentSecret;
|
||||
}
|
||||
@@ -94,9 +94,9 @@ public class AttachmentSecretProvider {
|
||||
private void storeAttachmentSecret(@NonNull Context context, @NonNull AttachmentSecret attachmentSecret) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
KeyStoreHelper.SealedData encryptedSecret = KeyStoreHelper.seal(attachmentSecret.serialize().getBytes());
|
||||
TextSecurePreferences.setAttachmentEncryptedSecret(context, encryptedSecret.serialize());
|
||||
Prefs.setAttachmentEncryptedSecret(context, encryptedSecret.serialize());
|
||||
} else {
|
||||
TextSecurePreferences.setAttachmentUnencryptedSecret(context, attachmentSecret.serialize());
|
||||
Prefs.setAttachmentUnencryptedSecret(context, attachmentSecret.serialize());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.SecureRandom;
|
||||
@@ -22,8 +22,8 @@ public class DatabaseSecretProvider {
|
||||
}
|
||||
|
||||
public DatabaseSecret getOrCreateDatabaseSecret() {
|
||||
String unencryptedSecret = TextSecurePreferences.getDatabaseUnencryptedSecret(context);
|
||||
String encryptedSecret = TextSecurePreferences.getDatabaseEncryptedSecret(context);
|
||||
String unencryptedSecret = Prefs.getDatabaseUnencryptedSecret(context);
|
||||
String encryptedSecret = Prefs.getDatabaseEncryptedSecret(context);
|
||||
|
||||
if (unencryptedSecret != null) return getUnencryptedDatabaseSecret(context, unencryptedSecret);
|
||||
else if (encryptedSecret != null) return getEncryptedDatabaseSecret(encryptedSecret);
|
||||
@@ -40,8 +40,8 @@ public class DatabaseSecretProvider {
|
||||
} else {
|
||||
KeyStoreHelper.SealedData encryptedSecret = KeyStoreHelper.seal(databaseSecret.asBytes());
|
||||
|
||||
TextSecurePreferences.setDatabaseEncryptedSecret(context, encryptedSecret.serialize());
|
||||
TextSecurePreferences.setDatabaseUnencryptedSecret(context, null);
|
||||
Prefs.setDatabaseEncryptedSecret(context, encryptedSecret.serialize());
|
||||
Prefs.setDatabaseUnencryptedSecret(context, null);
|
||||
|
||||
return databaseSecret;
|
||||
}
|
||||
@@ -68,9 +68,9 @@ public class DatabaseSecretProvider {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
KeyStoreHelper.SealedData encryptedSecret = KeyStoreHelper.seal(databaseSecret.asBytes());
|
||||
TextSecurePreferences.setDatabaseEncryptedSecret(context, encryptedSecret.serialize());
|
||||
Prefs.setDatabaseEncryptedSecret(context, encryptedSecret.serialize());
|
||||
} else {
|
||||
TextSecurePreferences.setDatabaseUnencryptedSecret(context, databaseSecret.asString());
|
||||
Prefs.setDatabaseUnencryptedSecret(context, databaseSecret.asString());
|
||||
}
|
||||
|
||||
return databaseSecret;
|
||||
|
||||
@@ -11,9 +11,6 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.b44t.messenger.DcChat;
|
||||
import com.b44t.messenger.DcContact;
|
||||
import com.b44t.messenger.DcContext;
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
@@ -22,7 +19,7 @@ import com.google.i18n.phonenumbers.ShortNumberInfo;
|
||||
import org.thoughtcrime.securesms.util.DelimiterUtil;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
import org.thoughtcrime.securesms.util.NumberUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -105,7 +102,7 @@ public class Address implements Parcelable, Comparable<Address> {
|
||||
}
|
||||
|
||||
private static @NonNull ExternalAddressFormatter getExternalAddressFormatter(Context context) {
|
||||
String localNumber = TextSecurePreferences.getLocalNumber(context);
|
||||
String localNumber = Prefs.getLocalNumber(context);
|
||||
|
||||
if (!TextUtils.isEmpty(localNumber)) {
|
||||
Pair<String, ExternalAddressFormatter> cached = cachedFormatter.get();
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.thoughtcrime.securesms.service.UpdateApkReadyListener;
|
||||
import org.thoughtcrime.securesms.util.FileUtils;
|
||||
import org.thoughtcrime.securesms.util.Hex;
|
||||
import org.thoughtcrime.securesms.util.JsonUtils;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -106,7 +106,7 @@ public class UpdateApkJob extends ContextJob {
|
||||
|
||||
query.setFilterByStatus(DownloadManager.STATUS_PAUSED | DownloadManager.STATUS_PENDING | DownloadManager.STATUS_RUNNING | DownloadManager.STATUS_SUCCESSFUL);
|
||||
|
||||
long pendingDownloadId = TextSecurePreferences.getUpdateApkDownloadId(context);
|
||||
long pendingDownloadId = Prefs.getUpdateApkDownloadId(context);
|
||||
byte[] pendingDigest = getPendingDigest(context);
|
||||
Cursor cursor = downloadManager.query(query);
|
||||
|
||||
@@ -154,8 +154,8 @@ public class UpdateApkJob extends ContextJob {
|
||||
}
|
||||
|
||||
long downloadId = downloadManager.enqueue(downloadRequest);
|
||||
TextSecurePreferences.setUpdateApkDownloadId(context, downloadId);
|
||||
TextSecurePreferences.setUpdateApkDigest(context, Hex.toStringCondensed(digest));
|
||||
Prefs.setUpdateApkDownloadId(context, downloadId);
|
||||
Prefs.setUpdateApkDigest(context, Hex.toStringCondensed(digest));
|
||||
}
|
||||
|
||||
private void handleDownloadNotify(long downloadId) {
|
||||
@@ -182,7 +182,7 @@ public class UpdateApkJob extends ContextJob {
|
||||
|
||||
private @Nullable byte[] getPendingDigest(Context context) {
|
||||
try {
|
||||
String encodedDigest = TextSecurePreferences.getUpdateApkDigest(context);
|
||||
String encodedDigest = Prefs.getUpdateApkDigest(context);
|
||||
|
||||
if (encodedDigest == null) return null;
|
||||
|
||||
|
||||
@@ -9,13 +9,11 @@ import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase;
|
||||
import org.thoughtcrime.securesms.preferences.widgets.NotificationPrivacyPreference;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
public abstract class AbstractNotificationBuilder extends NotificationCompat.Builder {
|
||||
@@ -44,24 +42,24 @@ public abstract class AbstractNotificationBuilder extends NotificationCompat.Bui
|
||||
return builder;
|
||||
}
|
||||
|
||||
public void setAlarms(@Nullable Uri ringtone, TextSecurePreferences.VibrateState vibrate) {
|
||||
Uri defaultRingtone = TextSecurePreferences.getNotificationRingtone(context);
|
||||
boolean defaultVibrate = TextSecurePreferences.isNotificationVibrateEnabled(context);
|
||||
public void setAlarms(@Nullable Uri ringtone, Prefs.VibrateState vibrate) {
|
||||
Uri defaultRingtone = Prefs.getNotificationRingtone(context);
|
||||
boolean defaultVibrate = Prefs.isNotificationVibrateEnabled(context);
|
||||
|
||||
if (ringtone == null && !TextUtils.isEmpty(defaultRingtone.toString())) setSound(defaultRingtone);
|
||||
else if (ringtone != null && !ringtone.toString().isEmpty()) setSound(ringtone);
|
||||
|
||||
if (vibrate == TextSecurePreferences.VibrateState.ENABLED ||
|
||||
(vibrate == TextSecurePreferences.VibrateState.DEFAULT && defaultVibrate))
|
||||
if (vibrate == Prefs.VibrateState.ENABLED ||
|
||||
(vibrate == Prefs.VibrateState.DEFAULT && defaultVibrate))
|
||||
{
|
||||
setDefaults(Notification.DEFAULT_VIBRATE);
|
||||
}
|
||||
}
|
||||
|
||||
private void setLed() {
|
||||
String ledColor = TextSecurePreferences.getNotificationLedColor(context);
|
||||
String ledBlinkPattern = TextSecurePreferences.getNotificationLedPattern(context);
|
||||
String ledBlinkPatternCustom = TextSecurePreferences.getNotificationLedPatternCustom(context);
|
||||
String ledColor = Prefs.getNotificationLedColor(context);
|
||||
String ledBlinkPattern = Prefs.getNotificationLedPattern(context);
|
||||
String ledBlinkPatternCustom = Prefs.getNotificationLedPatternCustom(context);
|
||||
|
||||
if (!ledColor.equals("none")) {
|
||||
String[] blinkPatternArray = parseBlinkPattern(ledBlinkPattern, ledBlinkPatternCustom);
|
||||
|
||||
@@ -38,7 +38,6 @@ import android.util.Log;
|
||||
|
||||
import com.b44t.messenger.DcMsg;
|
||||
|
||||
import org.thoughtcrime.securesms.ConversationActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.connect.ApplicationDcContext;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
@@ -47,9 +46,8 @@ import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
import org.thoughtcrime.securesms.util.SpanUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -147,7 +145,7 @@ public class MessageNotifier {
|
||||
}
|
||||
|
||||
public static void updateNotification(@NonNull Context context) {
|
||||
if (!TextSecurePreferences.isNotificationsEnabled(context)) {
|
||||
if (!Prefs.isNotificationsEnabled(context)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -194,8 +192,8 @@ public class MessageNotifier {
|
||||
dcContext.marknoticedChat(chatId);
|
||||
}
|
||||
|
||||
if (!TextSecurePreferences.isNotificationsEnabled(context) ||
|
||||
TextSecurePreferences.isChatMuted(context, chatId))
|
||||
if (!Prefs.isNotificationsEnabled(context) ||
|
||||
Prefs.isChatMuted(context, chatId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -259,7 +257,7 @@ public class MessageNotifier {
|
||||
return;
|
||||
}
|
||||
|
||||
SingleRecipientNotificationBuilder builder = new SingleRecipientNotificationBuilder(context, TextSecurePreferences.getNotificationPrivacy(context));
|
||||
SingleRecipientNotificationBuilder builder = new SingleRecipientNotificationBuilder(context, Prefs.getNotificationPrivacy(context));
|
||||
List<NotificationItem> notifications = notificationState.getNotifications();
|
||||
Recipient recipient = notifications.get(0).getRecipient();
|
||||
int notificationId = (SUMMARY_NOTIFICATION_ID + (bundled ? notifications.get(0).getChatId() : 0));
|
||||
@@ -307,7 +305,7 @@ public class MessageNotifier {
|
||||
@NonNull NotificationState notificationState,
|
||||
boolean signal)
|
||||
{
|
||||
MultipleRecipientNotificationBuilder builder = new MultipleRecipientNotificationBuilder(context, TextSecurePreferences.getNotificationPrivacy(context));
|
||||
MultipleRecipientNotificationBuilder builder = new MultipleRecipientNotificationBuilder(context, Prefs.getNotificationPrivacy(context));
|
||||
List<NotificationItem> notifications = notificationState.getNotifications();
|
||||
|
||||
builder.setMessageCount(notificationState.getMessageCount(), notificationState.getThreadCount());
|
||||
@@ -337,20 +335,20 @@ public class MessageNotifier {
|
||||
}
|
||||
|
||||
private static void sendInThreadNotification(Context context, int chatId) {
|
||||
if (!TextSecurePreferences.isInThreadNotifications(context) ||
|
||||
if (!Prefs.isInThreadNotifications(context) ||
|
||||
ServiceUtil.getAudioManager(context).getRingerMode() != AudioManager.RINGER_MODE_NORMAL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( TextSecurePreferences.isChatMuted(context, chatId) ) {
|
||||
if( Prefs.isChatMuted(context, chatId) ) {
|
||||
Log.d(TAG, "chat muted");
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = TextSecurePreferences.getChatRingtone(context, chatId);
|
||||
Uri uri = Prefs.getChatRingtone(context, chatId);
|
||||
if (uri == null) {
|
||||
uri = TextSecurePreferences.getNotificationRingtone(context);
|
||||
uri = Prefs.getNotificationRingtone(context);
|
||||
}
|
||||
|
||||
if (uri.toString().isEmpty()) {
|
||||
@@ -405,7 +403,7 @@ public class MessageNotifier {
|
||||
body = SpanUtil.italic(message, italicLength);
|
||||
}
|
||||
|
||||
if (!TextSecurePreferences.isChatMuted(context, chatId)) {
|
||||
if (!Prefs.isChatMuted(context, chatId)) {
|
||||
notificationState.addNotification(new NotificationItem(id, mms, threadRecipient, individualRecipient, chatId, body, timestamp, slideDeck));
|
||||
}
|
||||
}
|
||||
@@ -425,7 +423,7 @@ public class MessageNotifier {
|
||||
}
|
||||
|
||||
private static void scheduleReminder(Context context, int count) {
|
||||
if (count >= TextSecurePreferences.getRepeatAlertsCount(context)) {
|
||||
if (count >= Prefs.getRepeatAlertsCount(context)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ import org.thoughtcrime.securesms.ConversationListActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.preferences.widgets.NotificationPrivacyPreference;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -44,7 +44,7 @@ public class MultipleRecipientNotificationBuilder extends AbstractNotificationBu
|
||||
setContentTitle(context.getString(R.string.app_name));
|
||||
setContentIntent(PendingIntent.getActivity(context, 0, new Intent(context, ConversationListActivity.class), 0));
|
||||
setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
||||
setPriority(TextSecurePreferences.getNotificationPriority(context));
|
||||
setPriority(Prefs.getNotificationPriority(context));
|
||||
setGroupSummary(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.ConversationActivity;
|
||||
import org.thoughtcrime.securesms.ConversationPopupActivity;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences.VibrateState;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Prefs.VibrateState;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -49,7 +49,7 @@ public class NotificationState {
|
||||
Recipient recipient = notifications.getFirst().getRecipient();
|
||||
|
||||
if (recipient != null && recipient.getAddress().isDcChat()) {
|
||||
return TextSecurePreferences.getChatRingtone(context, recipient.getAddress().getDcChatId());
|
||||
return Prefs.getChatRingtone(context, recipient.getAddress().getDcChatId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class NotificationState {
|
||||
Recipient recipient = notifications.getFirst().getRecipient();
|
||||
|
||||
if (recipient != null && recipient.getAddress().isDcChat()) {
|
||||
return TextSecurePreferences.getChatVibrate(context, recipient.getAddress().getDcChatId());
|
||||
return Prefs.getChatVibrate(context, recipient.getAddress().getDcChatId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -29,10 +29,9 @@ import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||
import org.thoughtcrime.securesms.preferences.widgets.NotificationPrivacyPreference;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.BitmapUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -53,7 +52,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
||||
|
||||
setSmallIcon(R.drawable.icon_notification);
|
||||
setColor(context.getResources().getColor(R.color.textsecure_primary));
|
||||
setPriority(TextSecurePreferences.getNotificationPriority(context));
|
||||
setPriority(Prefs.getNotificationPriority(context));
|
||||
setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,14 +13,13 @@ import android.widget.Toast;
|
||||
|
||||
import com.b44t.messenger.DcContext;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||
import org.thoughtcrime.securesms.BlockedContactsActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.SwitchPreferenceCompat;
|
||||
import org.thoughtcrime.securesms.connect.ApplicationDcContext;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -45,10 +44,10 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
||||
|
||||
dcContext = DcHelper.getContext(getContext());
|
||||
|
||||
this.findPreference(TextSecurePreferences.SCREEN_LOCK).setOnPreferenceChangeListener(new ScreenLockListener());
|
||||
this.findPreference(TextSecurePreferences.CHANGE_PASSPHRASE_PREF).setOnPreferenceClickListener(new ChangePassphraseClickListener());
|
||||
this.findPreference(TextSecurePreferences.SCREEN_LOCK_TIMEOUT_INTERVAL_PREF).setOnPreferenceClickListener(new LockIntervalClickListener());
|
||||
this.findPreference(TextSecurePreferences.SCREEN_SECURITY_PREF).setOnPreferenceChangeListener(new ScreenShotSecurityListener());
|
||||
this.findPreference(Prefs.SCREEN_LOCK).setOnPreferenceChangeListener(new ScreenLockListener());
|
||||
this.findPreference(Prefs.CHANGE_PASSPHRASE_PREF).setOnPreferenceClickListener(new ChangePassphraseClickListener());
|
||||
this.findPreference(Prefs.SCREEN_LOCK_TIMEOUT_INTERVAL_PREF).setOnPreferenceClickListener(new LockIntervalClickListener());
|
||||
this.findPreference(Prefs.SCREEN_SECURITY_PREF).setOnPreferenceChangeListener(new ScreenShotSecurityListener());
|
||||
|
||||
readReceiptsCheckbox = (CheckBoxPreference) this.findPreference("pref_read_receipts");
|
||||
readReceiptsCheckbox.setOnPreferenceChangeListener(new ReadReceiptToggleListener());
|
||||
@@ -73,14 +72,14 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
||||
}
|
||||
|
||||
private void initializePassphraseTimeoutSummary() {
|
||||
int timeoutSeconds = TextSecurePreferences.getScreenLockTimeoutInterval(getActivity());
|
||||
this.findPreference(TextSecurePreferences.SCREEN_LOCK_TIMEOUT_INTERVAL_PREF)
|
||||
int timeoutSeconds = Prefs.getScreenLockTimeoutInterval(getActivity());
|
||||
this.findPreference(Prefs.SCREEN_LOCK_TIMEOUT_INTERVAL_PREF)
|
||||
.setSummary(getResources().getQuantityString(R.plurals.AppProtectionPreferenceFragment_minutes, timeoutSeconds, timeoutSeconds / 60));
|
||||
}
|
||||
|
||||
private void initializeVisibility() {
|
||||
KeyguardManager keyguardManager = (KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
|
||||
SwitchPreferenceCompat screenLockPreference = (SwitchPreferenceCompat) findPreference(TextSecurePreferences.SCREEN_LOCK);
|
||||
SwitchPreferenceCompat screenLockPreference = (SwitchPreferenceCompat) findPreference(Prefs.SCREEN_LOCK);
|
||||
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP || keyguardManager == null || !keyguardManager.isKeyguardSecure()) {
|
||||
screenLockPreference.setChecked(false);
|
||||
screenLockPreference.setEnabled(false);
|
||||
@@ -91,9 +90,9 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
||||
}
|
||||
|
||||
private void manageScreenLockChildren(boolean enable) {
|
||||
SwitchPreferenceCompat timeoutPreference = (SwitchPreferenceCompat) findPreference(TextSecurePreferences.SCREEN_LOCK_TIMEOUT_PREF);
|
||||
SwitchPreferenceCompat timeoutPreference = (SwitchPreferenceCompat) findPreference(Prefs.SCREEN_LOCK_TIMEOUT_PREF);
|
||||
timeoutPreference.setEnabled(enable);
|
||||
findPreference(TextSecurePreferences.SCREEN_LOCK_TIMEOUT_INTERVAL_PREF).setEnabled(enable);
|
||||
findPreference(Prefs.SCREEN_LOCK_TIMEOUT_INTERVAL_PREF).setEnabled(enable);
|
||||
if (!enable) {
|
||||
timeoutPreference.setChecked(false);
|
||||
}
|
||||
@@ -103,7 +102,7 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean enabled = (Boolean) newValue;
|
||||
TextSecurePreferences.setScreenSecurityEnabled(getContext(), enabled);
|
||||
Prefs.setScreenSecurityEnabled(getContext(), enabled);
|
||||
Toast.makeText(getContext(), R.string.preferences__screen_security_restart_warning, Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
}
|
||||
@@ -114,7 +113,7 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean enabled = (Boolean) newValue;
|
||||
manageScreenLockChildren(enabled);
|
||||
TextSecurePreferences.setScreenLockEnabled(getContext(), enabled);
|
||||
Prefs.setScreenLockEnabled(getContext(), enabled);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -141,7 +140,7 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
||||
final int privacySummaryResId = R.string.ApplicationPreferencesActivity_privacy_summary;
|
||||
final String onRes = context.getString(R.string.ApplicationPreferencesActivity_on);
|
||||
final String offRes = context.getString(R.string.ApplicationPreferencesActivity_off);
|
||||
String screenLockState = TextSecurePreferences.isScreenLockEnabled(context) ? onRes : offRes;
|
||||
String screenLockState = Prefs.isScreenLockEnabled(context) ? onRes : offRes;
|
||||
String readReceiptState = DcHelper.getContext(context).getConfigInt("mdns_enabled", DcContext.DC_PREF_DEFAULT_MDNS_ENABLED)!=0? onRes : offRes;
|
||||
return context.getString(privacySummaryResId, screenLockState, readReceiptState);
|
||||
}
|
||||
@@ -162,7 +161,7 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
||||
new TimeDurationPickerDialog(getContext(), (view, duration) -> {
|
||||
int timeoutSeconds = (int) Math.max(TimeUnit.MILLISECONDS.toSeconds(duration), 60);
|
||||
|
||||
TextSecurePreferences.setScreenLockTimeoutInterval(getActivity(), timeoutSeconds);
|
||||
Prefs.setScreenLockTimeoutInterval(getActivity(), timeoutSeconds);
|
||||
|
||||
initializePassphraseTimeoutSummary();
|
||||
|
||||
|
||||
@@ -6,11 +6,10 @@ import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.preference.ListPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -20,11 +19,11 @@ public class AppearancePreferenceFragment extends ListSummaryPreferenceFragment
|
||||
public void onCreate(Bundle paramBundle) {
|
||||
super.onCreate(paramBundle);
|
||||
|
||||
this.findPreference(TextSecurePreferences.THEME_PREF).setOnPreferenceChangeListener(new ListSummaryListener());
|
||||
this.findPreference(TextSecurePreferences.LANGUAGE_PREF).setOnPreferenceChangeListener(new ListSummaryListener());
|
||||
initializeListSummary((ListPreference)findPreference(TextSecurePreferences.THEME_PREF));
|
||||
initializeListSummary((ListPreference)findPreference(TextSecurePreferences.LANGUAGE_PREF));
|
||||
this.findPreference(TextSecurePreferences.BACKGROUND_PREF).setOnPreferenceClickListener(new BackgroundClickListener());
|
||||
this.findPreference(Prefs.THEME_PREF).setOnPreferenceChangeListener(new ListSummaryListener());
|
||||
this.findPreference(Prefs.LANGUAGE_PREF).setOnPreferenceChangeListener(new ListSummaryListener());
|
||||
initializeListSummary((ListPreference)findPreference(Prefs.THEME_PREF));
|
||||
initializeListSummary((ListPreference)findPreference(Prefs.LANGUAGE_PREF));
|
||||
this.findPreference(Prefs.BACKGROUND_PREF).setOnPreferenceClickListener(new BackgroundClickListener());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,7 +41,7 @@ public class AppearancePreferenceFragment extends ListSummaryPreferenceFragment
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
((ApplicationPreferencesActivity) getActivity()).getSupportActionBar().setTitle(R.string.preferences__appearance);
|
||||
String imagePath = TextSecurePreferences.getBackgroundImagePath(getContext());
|
||||
String imagePath = Prefs.getBackgroundImagePath(getContext());
|
||||
String backgroundString;
|
||||
if(imagePath.isEmpty()){
|
||||
backgroundString = this.getString(R.string.AppearancePreferencesFragment_background_default_summary);
|
||||
@@ -50,7 +49,7 @@ public class AppearancePreferenceFragment extends ListSummaryPreferenceFragment
|
||||
else{
|
||||
backgroundString = this.getString(R.string.AppearancePreferencesFragment_background_custom_summary);
|
||||
}
|
||||
this.findPreference(TextSecurePreferences.BACKGROUND_PREF).setSummary(backgroundString);
|
||||
this.findPreference(Prefs.BACKGROUND_PREF).setSummary(backgroundString);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,13 +64,13 @@ public class AppearancePreferenceFragment extends ListSummaryPreferenceFragment
|
||||
String[] themeEntries = context.getResources().getStringArray(R.array.pref_theme_entries);
|
||||
String[] themeEntryValues = context.getResources().getStringArray(R.array.pref_theme_values);
|
||||
|
||||
int langIndex = Arrays.asList(languageEntryValues).indexOf(TextSecurePreferences.getLanguage(context));
|
||||
int themeIndex = Arrays.asList(themeEntryValues).indexOf(TextSecurePreferences.getTheme(context));
|
||||
int langIndex = Arrays.asList(languageEntryValues).indexOf(Prefs.getLanguage(context));
|
||||
int themeIndex = Arrays.asList(themeEntryValues).indexOf(Prefs.getTheme(context));
|
||||
|
||||
if (langIndex == -1) langIndex = 0;
|
||||
if (themeIndex == -1) themeIndex = 0;
|
||||
|
||||
String imagePath = TextSecurePreferences.getBackgroundImagePath(context);
|
||||
String imagePath = Prefs.getBackgroundImagePath(context);
|
||||
String backgroundString;
|
||||
if(imagePath.isEmpty()){
|
||||
backgroundString = context.getString(R.string.ApplicationPreferencesActivity_appearance_background_default);
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.thoughtcrime.securesms.BaseActionBarActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -54,7 +54,7 @@ public class ChatBackgroundActivity extends BaseActionBarActivity {
|
||||
defaultButton.setOnClickListener(new DefaultClickListener());
|
||||
galleryButton.setOnClickListener(new GalleryClickListener());
|
||||
|
||||
String backgroundImagePath = TextSecurePreferences.getBackgroundImagePath(this);
|
||||
String backgroundImagePath = Prefs.getBackgroundImagePath(this);
|
||||
setLayoutBackgroundImage(backgroundImagePath);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
@@ -87,14 +87,14 @@ public class ChatBackgroundActivity extends BaseActionBarActivity {
|
||||
@Override
|
||||
public void run() {
|
||||
String destination = context.getFilesDir().getAbsolutePath() + "/background";
|
||||
TextSecurePreferences.setBackgroundImagePath(context, destination);
|
||||
Prefs.setBackgroundImagePath(context, destination);
|
||||
scaleAndSaveImage(context, destination);
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
}
|
||||
else {
|
||||
TextSecurePreferences.setBackgroundImagePath(context, "");
|
||||
Prefs.setBackgroundImagePath(context, "");
|
||||
}
|
||||
finish();
|
||||
return true;
|
||||
@@ -124,15 +124,15 @@ public class ChatBackgroundActivity extends BaseActionBarActivity {
|
||||
scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 85, outStream);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
TextSecurePreferences.setBackgroundImagePath(context, "");
|
||||
Prefs.setBackgroundImagePath(context, "");
|
||||
showBackgroundSaveError();
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
TextSecurePreferences.setBackgroundImagePath(context, "");
|
||||
Prefs.setBackgroundImagePath(context, "");
|
||||
showBackgroundSaveError();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
TextSecurePreferences.setBackgroundImagePath(context, "");
|
||||
Prefs.setBackgroundImagePath(context, "");
|
||||
showBackgroundSaveError();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.connect.ApplicationDcContext;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
|
||||
private static final String TAG = ChatsPreferenceFragment.class.getSimpleName();
|
||||
@@ -33,7 +33,7 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
|
||||
super.onCreate(paramBundle);
|
||||
dcContext = DcHelper.getContext(getContext());
|
||||
|
||||
findPreference(TextSecurePreferences.MESSAGE_BODY_TEXT_SIZE_PREF)
|
||||
findPreference(Prefs.MESSAGE_BODY_TEXT_SIZE_PREF)
|
||||
.setOnPreferenceChangeListener(new ListSummaryListener());
|
||||
|
||||
trimEnabledCheckbox = (CheckBoxPreference) findPreference("pref_trim_threads");
|
||||
@@ -44,7 +44,7 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
|
||||
findPreference("pref_trim_now")
|
||||
.setOnPreferenceClickListener(new TrimNowClickListener());
|
||||
|
||||
initializeListSummary((ListPreference) findPreference(TextSecurePreferences.MESSAGE_BODY_TEXT_SIZE_PREF));
|
||||
initializeListSummary((ListPreference) findPreference(Prefs.MESSAGE_BODY_TEXT_SIZE_PREF));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,7 @@ import android.text.TextUtils;
|
||||
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
@@ -31,22 +31,22 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
public void onCreate(Bundle paramBundle) {
|
||||
super.onCreate(paramBundle);
|
||||
|
||||
this.findPreference(TextSecurePreferences.LED_COLOR_PREF)
|
||||
this.findPreference(Prefs.LED_COLOR_PREF)
|
||||
.setOnPreferenceChangeListener(new ListSummaryListener());
|
||||
this.findPreference(TextSecurePreferences.LED_BLINK_PREF)
|
||||
this.findPreference(Prefs.LED_BLINK_PREF)
|
||||
.setOnPreferenceChangeListener(new ListSummaryListener());
|
||||
this.findPreference(TextSecurePreferences.RINGTONE_PREF)
|
||||
this.findPreference(Prefs.RINGTONE_PREF)
|
||||
.setOnPreferenceChangeListener(new RingtoneSummaryListener());
|
||||
this.findPreference(TextSecurePreferences.REPEAT_ALERTS_PREF)
|
||||
this.findPreference(Prefs.REPEAT_ALERTS_PREF)
|
||||
.setOnPreferenceChangeListener(new ListSummaryListener());
|
||||
this.findPreference(TextSecurePreferences.NOTIFICATION_PRIVACY_PREF)
|
||||
this.findPreference(Prefs.NOTIFICATION_PRIVACY_PREF)
|
||||
.setOnPreferenceChangeListener(new NotificationPrivacyListener());
|
||||
this.findPreference(TextSecurePreferences.NOTIFICATION_PRIORITY_PREF)
|
||||
this.findPreference(Prefs.NOTIFICATION_PRIORITY_PREF)
|
||||
.setOnPreferenceChangeListener(new ListSummaryListener());
|
||||
|
||||
this.findPreference(TextSecurePreferences.RINGTONE_PREF)
|
||||
this.findPreference(Prefs.RINGTONE_PREF)
|
||||
.setOnPreferenceClickListener(preference -> {
|
||||
Uri current = TextSecurePreferences.getNotificationRingtone(getContext());
|
||||
Uri current = Prefs.getNotificationRingtone(getContext());
|
||||
|
||||
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
|
||||
@@ -60,13 +60,13 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
return true;
|
||||
});
|
||||
|
||||
initializeListSummary((ListPreference) findPreference(TextSecurePreferences.LED_COLOR_PREF));
|
||||
initializeListSummary((ListPreference) findPreference(TextSecurePreferences.LED_BLINK_PREF));
|
||||
initializeListSummary((ListPreference) findPreference(TextSecurePreferences.REPEAT_ALERTS_PREF));
|
||||
initializeListSummary((ListPreference) findPreference(TextSecurePreferences.NOTIFICATION_PRIVACY_PREF));
|
||||
initializeListSummary((ListPreference) findPreference(TextSecurePreferences.NOTIFICATION_PRIORITY_PREF));
|
||||
initializeListSummary((ListPreference) findPreference(Prefs.LED_COLOR_PREF));
|
||||
initializeListSummary((ListPreference) findPreference(Prefs.LED_BLINK_PREF));
|
||||
initializeListSummary((ListPreference) findPreference(Prefs.REPEAT_ALERTS_PREF));
|
||||
initializeListSummary((ListPreference) findPreference(Prefs.NOTIFICATION_PRIVACY_PREF));
|
||||
initializeListSummary((ListPreference) findPreference(Prefs.NOTIFICATION_PRIORITY_PREF));
|
||||
|
||||
initializeRingtoneSummary(findPreference(TextSecurePreferences.RINGTONE_PREF));
|
||||
initializeRingtoneSummary(findPreference(Prefs.RINGTONE_PREF));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,12 +86,12 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
|
||||
|
||||
if (Settings.System.DEFAULT_NOTIFICATION_URI.equals(uri)) {
|
||||
TextSecurePreferences.removeNotificationRingtone(getContext());
|
||||
Prefs.removeNotificationRingtone(getContext());
|
||||
} else {
|
||||
TextSecurePreferences.setNotificationRingtone(getContext(), uri != null ? uri : Uri.EMPTY);
|
||||
Prefs.setNotificationRingtone(getContext(), uri != null ? uri : Uri.EMPTY);
|
||||
}
|
||||
|
||||
initializeRingtoneSummary(findPreference(TextSecurePreferences.RINGTONE_PREF));
|
||||
initializeRingtoneSummary(findPreference(Prefs.RINGTONE_PREF));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
|
||||
private void initializeRingtoneSummary(Preference pref) {
|
||||
RingtoneSummaryListener listener = (RingtoneSummaryListener) pref.getOnPreferenceChangeListener();
|
||||
Uri uri = TextSecurePreferences.getNotificationRingtone(getContext());
|
||||
Uri uri = Prefs.getNotificationRingtone(getContext());
|
||||
|
||||
listener.onPreferenceChange(pref, uri);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
final int onCapsResId = R.string.ApplicationPreferencesActivity_On;
|
||||
final int offCapsResId = R.string.ApplicationPreferencesActivity_Off;
|
||||
|
||||
return context.getString(TextSecurePreferences.isNotificationsEnabled(context) ? onCapsResId : offCapsResId);
|
||||
return context.getString(Prefs.isNotificationsEnabled(context) ? onCapsResId : offCapsResId);
|
||||
}
|
||||
|
||||
private class NotificationPrivacyListener extends ListSummaryListener {
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.contacts.avatars.MyProfileContactPhoto;
|
||||
import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
public class ProfilePreference extends Preference {
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ProfilePreference extends Preference {
|
||||
profileName = getContext().getString(R.string.CreateProfileActivity_your_profile_info);
|
||||
}
|
||||
|
||||
final MyProfileContactPhoto profileImage = new MyProfileContactPhoto(address, String.valueOf(TextSecurePreferences.getProfileAvatarId(getContext())));
|
||||
final MyProfileContactPhoto profileImage = new MyProfileContactPhoto(address, String.valueOf(Prefs.getProfileAvatarId(getContext())));
|
||||
|
||||
GlideApp.with(getContext().getApplicationContext())
|
||||
.load(profileImage)
|
||||
|
||||
@@ -3,9 +3,8 @@ package org.thoughtcrime.securesms.service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
/**
|
||||
* Respond to a PanicKit trigger Intent by locking the app. PanicKit provides a
|
||||
@@ -18,7 +17,7 @@ public class PanicResponderListener extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent != null && !TextSecurePreferences.isPasswordDisabled(context) &&
|
||||
if (intent != null && !Prefs.isPasswordDisabled(context) &&
|
||||
"info.guardianproject.panic.action.TRIGGER".equals(intent.getAction()))
|
||||
{
|
||||
// as delta is protected with the system credentials,
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.thoughtcrime.securesms.util.FileProviderUtil;
|
||||
import org.thoughtcrime.securesms.util.FileUtils;
|
||||
import org.thoughtcrime.securesms.util.Hex;
|
||||
import org.thoughtcrime.securesms.util.ServiceUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -36,9 +36,9 @@ public class UpdateApkReadyListener extends BroadcastReceiver {
|
||||
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(intent.getAction())) {
|
||||
long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -2);
|
||||
|
||||
if (downloadId == TextSecurePreferences.getUpdateApkDownloadId(context)) {
|
||||
if (downloadId == Prefs.getUpdateApkDownloadId(context)) {
|
||||
Uri uri = getLocalUriForDownloadId(context, downloadId);
|
||||
String encodedDigest = TextSecurePreferences.getUpdateApkDigest(context);
|
||||
String encodedDigest = Prefs.getUpdateApkDigest(context);
|
||||
|
||||
if (uri == null) {
|
||||
Log.w(TAG, "Downloaded local URI is null?");
|
||||
|
||||
@@ -8,7 +8,7 @@ import android.util.Log;
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.jobs.UpdateApkJob;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Prefs;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class UpdateApkRefreshListener extends PersistentAlarmManagerListener {
|
||||
|
||||
@Override
|
||||
protected long getNextScheduledExecutionTime(Context context) {
|
||||
return TextSecurePreferences.getUpdateApkRefreshTime(context);
|
||||
return Prefs.getUpdateApkRefreshTime(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,7 +35,7 @@ public class UpdateApkRefreshListener extends PersistentAlarmManagerListener {
|
||||
}
|
||||
|
||||
long newTime = System.currentTimeMillis() + INTERVAL;
|
||||
TextSecurePreferences.setUpdateApkRefreshTime(context, newTime);
|
||||
Prefs.setUpdateApkRefreshTime(context, newTime);
|
||||
|
||||
return newTime;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
@@ -67,7 +66,7 @@ public class DynamicLanguage {
|
||||
}
|
||||
|
||||
private static Locale getSelectedLocale(Context context) {
|
||||
String language[] = TextUtils.split(TextSecurePreferences.getLanguage(context), "_");
|
||||
String language[] = TextUtils.split(Prefs.getLanguage(context), "_");
|
||||
|
||||
if (language[0].equals(DEFAULT)) {
|
||||
return Locale.getDefault();
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.thoughtcrime.securesms.R;
|
||||
public class DynamicNoActionBarTheme extends DynamicTheme {
|
||||
@Override
|
||||
protected int getSelectedTheme(Activity activity) {
|
||||
String theme = TextSecurePreferences.getTheme(activity);
|
||||
String theme = Prefs.getTheme(activity);
|
||||
|
||||
if (theme.equals("dark")) return R.style.TextSecure_DarkNoActionBar;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DynamicTheme {
|
||||
}
|
||||
|
||||
protected int getSelectedTheme(Activity activity) {
|
||||
String theme = TextSecurePreferences.getTheme(activity);
|
||||
String theme = Prefs.getTheme(activity);
|
||||
|
||||
if (theme.equals(DARK)) return R.style.TextSecure_DarkTheme;
|
||||
|
||||
|
||||
+2
-2
@@ -23,9 +23,9 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class TextSecurePreferences {
|
||||
public class Prefs {
|
||||
|
||||
private static final String TAG = TextSecurePreferences.class.getSimpleName();
|
||||
private static final String TAG = Prefs.class.getSimpleName();
|
||||
|
||||
public static final String CHANGE_PASSPHRASE_PREF = "pref_change_passphrase";
|
||||
public static final String DISABLE_PASSPHRASE_PREF = "pref_disable_passphrase";
|
||||
@@ -36,12 +36,12 @@ public class ScreenLockUtil {
|
||||
}
|
||||
|
||||
public static boolean isScreenLockEnabled(Context context) {
|
||||
return TextSecurePreferences.isScreenLockEnabled(context)
|
||||
return Prefs.isScreenLockEnabled(context)
|
||||
&& android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP;
|
||||
}
|
||||
|
||||
public static boolean isScreenLockTimeoutEnabled(Context context) {
|
||||
return TextSecurePreferences.isScreenLockTimeoutEnabled(context)
|
||||
return Prefs.isScreenLockTimeoutEnabled(context)
|
||||
&& android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ScreenLockUtil {
|
||||
ScreenLockUtil.applyScreenLock(activity);
|
||||
}
|
||||
}
|
||||
}, TextSecurePreferences.getScreenLockTimeoutInterval(activity) * 1000);
|
||||
}, Prefs.getScreenLockTimeoutInterval(activity) * 1000);
|
||||
return newTimer;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,21 +40,18 @@ import android.text.TextUtils;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.exoplayer2.extractor.ts.PsExtractor;
|
||||
import com.google.android.mms.pdu_alt.CharacterSets;
|
||||
import com.google.android.mms.pdu_alt.EncodedStringValue;
|
||||
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.components.ComposeText;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.util.guava.Optional;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -201,7 +198,7 @@ public class Util {
|
||||
if (address.isGroup()) return false;
|
||||
if (address.isEmail()) return false;
|
||||
if (address.isDcChat()) return false;
|
||||
String localNumber = TextSecurePreferences.getLocalNumber(context);
|
||||
String localNumber = Prefs.getLocalNumber(context);
|
||||
if (TextUtils.isEmpty(localNumber)) return false;
|
||||
|
||||
return localNumber.equals(address.toPhoneString());
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -9,13 +8,13 @@ public class VersionTracker {
|
||||
|
||||
|
||||
public static int getLastSeenVersion(Context context) {
|
||||
return TextSecurePreferences.getLastVersionCode(context);
|
||||
return Prefs.getLastVersionCode(context);
|
||||
}
|
||||
|
||||
public static void updateLastSeenVersion(Context context) {
|
||||
try {
|
||||
int currentVersionCode = Util.getCurrentApkReleaseVersion(context);
|
||||
TextSecurePreferences.setLastVersionCode(context, currentVersionCode);
|
||||
Prefs.setLastVersionCode(context, currentVersionCode);
|
||||
} catch (IOException ioe) {
|
||||
throw new AssertionError(ioe);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user