merge liliakai-settings

This commit is contained in:
Moxie Marlinspike
2013-05-06 12:48:16 -07:00
6 changed files with 130 additions and 140 deletions

View File

@@ -25,6 +25,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.preference.PreferenceManager;
import android.provider.ContactsContract;
import android.util.Log;
@@ -56,7 +57,6 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
private static final int PICK_IDENTITY_CONTACT = 1;
private static final int IMPORT_IDENTITY_ID = 2;
public static final String WHITESPACE_PREF = "pref_key_tag_whitespace";
public static final String RINGTONE_PREF = "pref_key_ringtone";
public static final String VIBRATE_PREF = "pref_key_vibrate";
public static final String NOTIFICATION_PREF = "pref_key_enable_notifications";
@@ -64,7 +64,6 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
public static final String LED_BLINK_PREF = "pref_led_blink";
public static final String LED_BLINK_PREF_CUSTOM = "pref_led_blink_custom";
public static final String IDENTITY_PREF = "pref_choose_identity";
public static final String SEND_IDENTITY_PREF = "pref_send_identity_key";
public static final String ALL_MMS_PERF = "pref_all_mms";
public static final String PASSPHRASE_TIMEOUT_INTERVAL_PREF = "pref_timeout_interval";
public static final String PASSPHRASE_TIMEOUT_PREF = "pref_timeout_passphrase";
@@ -390,4 +389,17 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
}
}
/* http://code.google.com/p/android/issues/detail?id=4611#c35 */
@SuppressWarnings("deprecation")
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)
{
super.onPreferenceTreeClick(preferenceScreen, preference);
if (preference!=null)
if (preference instanceof PreferenceScreen)
if (((PreferenceScreen)preference).getDialog()!=null)
((PreferenceScreen)preference).getDialog().getWindow().getDecorView().setBackgroundDrawable(this.getWindow().getDecorView().getBackground().getConstantState().newDrawable());
return false;
}
}

View File

@@ -113,9 +113,7 @@ public class KeyExchangeMessage {
}
private static boolean includeIdentitySignature(int messageVersion, Context context) {
return IdentityKeyUtil.hasIdentityKey(context) &&
(messageVersion >= 1) &&
PreferenceManager.getDefaultSharedPreferences(context).getBoolean(ApplicationPreferencesActivity.SEND_IDENTITY_PREF, true);
return IdentityKeyUtil.hasIdentityKey(context) && (messageVersion >= 1);
}

View File

@@ -13,8 +13,7 @@ public class Tag {
public static boolean isTaggable(Context context, String message) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
return sp.getBoolean(ApplicationPreferencesActivity.WHITESPACE_PREF, true) &&
message.matches(".*[^\\s].*") &&
return message.matches(".*[^\\s].*") &&
message.replaceAll("\\s+$", "").length() + WHITESPACE_TAG.length() <= 158;
}