Commit 01850962 authored by Bastien Le Querrec's avatar Bastien Le Querrec

add XMPP support, increase SDK target

parent 15e6b0ae
......@@ -17,6 +17,7 @@ android:
- build-tools-20.0.0
- build-tools-19.1.0
- android-22
- android-25
- extra-android-m2repository
before_script:
......
......@@ -22,6 +22,7 @@
<uses-permission android:name="android.permission.WRITE_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_MMS"/>
<uses-permission android:name="android.permission.READ_SMS"/>
......@@ -76,6 +77,21 @@
<data android:mimeType="video/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:host="s.silence.im"
android:scheme="https" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:host="s.silence.im"
android:scheme="http" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".ConversationListActivity"
......@@ -237,6 +253,16 @@
android:theme="@style/Silence.LightTheme"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<activity android:name=".XmppRegisterActivity"
android:label="@string/AndroidManifest__register"
android:windowSoftInputMode="stateUnchanged"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<activity android:name=".XmppRegisterCustomActivity"
android:label="@string/AndroidManifest__use_a_custom_xmpp_server"
android:windowSoftInputMode="stateUnchanged"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<!-- this can never have launchMode singleTask or singleInstance! -->
<activity android:name=".PanicResponderActivity"
android:noHistory="true"
......@@ -266,6 +292,14 @@
</intent-filter>
</service>
<service android:enabled="true" android:name=".service.XmppService"/>
<receiver android:name=".service.XmppServiceBoot">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name=".service.SmsListener"
android:permission="android.permission.BROADCAST_SMS"
android:enabled="true"
......@@ -315,6 +349,14 @@
</intent-filter>
</receiver>
<provider android:name="android.support.v4.content.FileProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="org.smssecure.provider.smssecure" >
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
<provider android:name=".providers.PartProvider"
android:grantUriPermissions="true"
android:exported="false"
......
......@@ -5,7 +5,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.android.tools.build:gradle:1.5.0'
classpath files('libs/gradle-witness.jar')
}
}
......@@ -56,6 +56,11 @@ dependencies {
compile project (':libs:com.amulyakhare.textdrawable:library')
compile 'me.relex:circleindicator:1.0.0@aar'
compile "org.igniterealtime.smack:smack-android-extensions:4.1.9"
compile "org.igniterealtime.smack:smack-experimental:4.1.9"
compile "org.igniterealtime.smack:smack-tcp:4.1.9"
compile "com.squareup.okhttp3:okhttp:3.5.0"
testCompile 'junit:junit:4.12'
testCompile 'org.assertj:assertj-core:1.7.1'
testCompile 'org.mockito:mockito-core:1.9.5'
......@@ -102,7 +107,6 @@ dependencyVerification {
'com.melnykov:floatingactionbutton:15d58d4fac0f7a288d0e5301bbaf501a146f5b3f5921277811bf99bd3b397263',
'com.nineoldandroids:library:68025a14e3e7673d6ad2f95e4b46d78d7d068343aa99256b686fe59de1b3163a',
'com.squareup.dagger:dagger:789aca24537022e49f91fc6444078d9de8f1dd99e1bfb090f18491b186967883',
'com.squareup.okio:okio:5e1098bd3fdee4c3347f5ab815b40ba851e4ab1b348c5e49a5b0362f0ce6e978',
'javax.inject:javax.inject:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
'org.apache.httpcomponents:httpclient-android:6f56466a9bd0d42934b90bfbfe9977a8b654c058bf44a12bdc2877c4e1f033f1',
'org.whispersystems:axolotl-android:40d3db5004a84749a73f68d2f0d01b2ae35a73c54df96d8c6c6723b96efb6fc0',
......@@ -113,19 +117,23 @@ dependencyVerification {
'org.whispersystems:textsecure-java:b407ca6d1430204dfabf38e27db22d5177409072a9668238bd1877de7676ad3f',
'se.emilsjolander:stickylistheaders:a08ca948aa6b220f09d82f16bbbac395f6b78897e9eeac6a9f0b0ba755928eeb',
'com.squareup.okhttp:okhttp:89b7f63e2e5b6c410266abc14f50fe52ea8d2d8a57260829e499b1cd9f0e61af',
'org.igniterealtime.smack:smack-android-extensions:622837f2afeb21c364e42685985f46d52c4b3746ea4108390face7b08303f209',
'org.igniterealtime.smack:smack-experimental:3b01f815b03e35f55149ab0f08432b69944e50582b2d277d9f3229729f440ed2',
'org.igniterealtime.smack:smack-tcp:69343b52816522aa491b743a0e620b06feb7245a174c7d0cce669586fa3995b3',
]
}
android {
compileSdkVersion 22
compileSdkVersion 25
buildToolsVersion '22.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
versionCode 128
versionName "0.14.8"
minSdkVersion 9
targetSdkVersion 22
targetSdkVersion 25
try{
buildConfigField "String", "BUILD_GIT_COMMIT", "\"" + 'git rev-parse --short HEAD'.execute().text.trim() + "\""
......
......@@ -112,3 +112,9 @@
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
-keep class org.apache.http.** { *; }
-dontwarn uk.co.senab.photoview.**
-keep class org.jivesoftware.smack.** { *; }
-keep class org.jivesoftware.smackx.** { *; }
......@@ -17,7 +17,7 @@
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:fontFamily="sans-serif-light"
tools:text="@string/IntroScreenActivity_welcome_to_smssecure"
tools:text="@string/IntroScreenActivity_welcome_to_silence"
android:textColor="@android:color/white" />
<ImageView android:id="@+id/watermark"
......@@ -38,6 +38,7 @@
android:id="@+id/subblurb"
android:textSize="@dimen/onboarding_subtitle_size"
android:textIsSelectable="false"
android:clickable="true"
android:gravity="center_horizontal"
android:layout_marginTop="20dp"
android:paddingLeft="20dp"
......
......@@ -111,6 +111,19 @@
android:orientation="horizontal"
android:gravity="left">
<ImageView android:id="@+id/xmpp_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingTop="2dp"
android:paddingRight="4dp"
android:paddingEnd="4dp"
android:src="?conversation_item_xmpp"
android:contentDescription="@string/conversation_item__xmpp_message_description"
android:visibility="gone"
android:tint="?conversation_item_received_text_secondary_color"
android:tintMode="multiply"/>
<ImageView android:id="@+id/secure_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -153,6 +153,18 @@
android:layout_height="wrap_content"
app:iconColor="?conversation_item_sent_text_secondary_color"/>
<ImageView android:id="@+id/xmpp_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="?conversation_item_xmpp"
android:visibility="gone"
android:layout_gravity="center_vertical|end"
android:paddingLeft="2dp"
android:paddingBottom="3dp"
android:tint="?conversation_item_sent_text_secondary_color"
android:tintMode="multiply"
android:contentDescription="@string/conversation_item__xmpp_message_description" />
<ImageView android:id="@+id/secure_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:background="@drawable/background_pattern_repeat">
<LinearLayout android:padding="16dp"
android:paddingBottom="0dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView style="@style/Registration.Description"
android:layout_width="fill_parent"
android:gravity="start"
android:layout_marginBottom="16dip"
android:text="@string/register_xmpp_account_it_is_highly_recommended_to_enable_stream_management" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="@+id/hostname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:layout_marginBottom="10dip"
android:hint="@string/register_xmpp_account_hostname"
android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="@+id/port"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:hint="@string/register_xmpp_account_port"
android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dip"
android:layout_marginBottom="16dip"
android:layout_gravity="right"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dip"
android:layout_weight="1"
android:text="@string/register_xmpp_account_cancel"
android:id="@+id/cancel_button"
android:enabled="true" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dip"
android:layout_weight="1"
android:text="@string/register_xmpp_account_connect"
android:id="@+id/connect_button"
android:enabled="true" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:background="@drawable/background_pattern_repeat">
<LinearLayout android:padding="16dp"
android:paddingBottom="0dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView style="@style/Registration.Description"
android:layout_width="fill_parent"
android:layout_marginBottom="16dip"
android:gravity="start"
android:text="@string/register_xmpp_account_description" />
<TextView style="@style/Registration.Description"
android:layout_width="fill_parent"
android:layout_marginBottom="16dip"
android:gravity="start"
android:text="@string/register_xmpp_account_warning" />
<TextView style="@style/Registration.Description"
android:layout_width="fill_parent"
android:gravity="start"
android:text="@string/register_xmpp_account_choose" />
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dip"
android:layout_marginBottom="16dip"
android:layout_gravity="right"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dip"
android:layout_weight="1"
android:text="@string/register_xmpp_account_use_a_trusted_server"
android:id="@+id/trusted_server_button"
android:enabled="true" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="5dip"
android:layout_weight="1"
android:text="@string/register_xmpp_account_use_my_own_server"
android:id="@+id/custom_server_button"
android:enabled="true" />
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/register_xmpp_account_cancel"
android:id="@+id/cancel_button"
android:enabled="true" />
</LinearLayout>
</ScrollView>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android" >
<TextView android:id="@+id/xmpp_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:fontFamily="monospace"
android:text="(null)"
android:paddingTop="10dip"
android:gravity="center"
android:clickable="true" />
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/xmpp_address_dialog__send_the_link_above_to_your_contacts_to_start_using_xmpp_messages_with_them"
android:gravity="center_vertical"
android:layout_below="@+id/xmpp_address"
android:padding="10dip" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android" >
<TextView android:id="@+id/xmpp_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/xmpp_enter_address_dialog__use_this_form_to_enter_the_xmpp_address_of"
android:gravity="center_vertical"
android:padding="10dip" />
<EditText android:id="@+id/xmpp_address"
android:layout_height="wrap_content"
android:hint="@string/xmpp_enter_address_dialog__xmpp_address"
android:inputType="textEmailAddress"
android:layout_below="@+id/xmpp_text"
android:layout_width="fill_parent">
</EditText>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="@string/conversation_secure_verified__menu_share_xmpp_address"
android:id="@+id/menu_display_xmpp_address"/>
<item android:title="@string/conversation_secure_verified__menu_share_xmpp_address_via_sms"
android:id="@+id/menu_start_xmpp_exchange"/>
<item android:title="@string/conversation_secure_verified__menu_enter_xmpp_address_manually"
android:id="@+id/menu_enter_xmpp_address_manually"/>
</menu>
......@@ -4,11 +4,11 @@
<style name="Widget.ProgressBar.Horizontal" parent="@android:style/Widget.Holo.ProgressBar.Horizontal">
</style>
<style name="SMSSecureDialogPrimaryText">
<style name="SilenceDialogPrimaryText">
<item name="android:textColor">?conversation_list_item_contact_color</item>
</style>
<style name="SMSSecureDialogSecondaryText">
<style name="SilenceDialogSecondaryText">
<item name="android:textColor">?conversation_list_item_date_color</item>
</style>
......
......@@ -66,6 +66,7 @@
<attr name="conversation_item_received_text_secondary_color" format="reference|color"/>
<attr name="conversation_item_sent_text_indicator_tab_color" format="reference|color"/>
<attr name="conversation_item_sent_indicator_text_background" format="reference" />
<attr name="conversation_item_xmpp" format="reference" />
<attr name="dialog_info_icon" format="reference" />
<attr name="dialog_alert_icon" format="reference" />
......@@ -112,6 +113,7 @@
<attr name="pref_ic_appearance" format="reference" />
<attr name="pref_ic_storage" format="reference" />
<attr name="pref_ic_chats" format="reference" />
<attr name="pref_ic_xmpp" format="reference" />
<attr name="pref_ic_advanced" format="reference" />
<attr name="app_protect_timeout_picker_color" format="reference"/>
......
......@@ -4,6 +4,8 @@
<color name="silence_primary_dark">#ff1c7ac5</color>
<color name="silence_primary_alpha33">#552090ea</color>
<color name="silence_primary_alpha_focus">#882090ea</color>
<color name="silence_xmpp">#ff139f5b</color>
<color name="silence_xmpp_offline">#fff57f17</color>
<color name="white">#ffffffff</color>
<color name="black">#ff000000</color>
......
This diff is collapsed.
......@@ -140,6 +140,7 @@
<item name="conversation_item_sent_text_indicator_tab_color">#99000000</item>
<item name="conversation_item_received_text_primary_color">@color/white</item>
<item name="conversation_item_received_text_secondary_color">#BFffffff</item>
<item name="conversation_item_xmpp">@drawable/ic_xmpp_white_18dp</item>
<item name="conversation_item_sent_indicator_text_background">@drawable/conversation_item_sent_indicator_text_shape</item>
......@@ -182,6 +183,7 @@
<item name="pref_ic_app_protection">@drawable/ic_app_protection_black</item>
<item name="pref_ic_appearance">@drawable/ic_brightness_6_black</item>
<item name="pref_ic_chats">@drawable/ic_forum_black_32dp</item>
<item name="pref_ic_xmpp">@drawable/ic_xmpp_black</item>
<item name="pref_ic_advanced">@drawable/ic_advanced_black</item>
<item name="app_protect_timeout_picker_color">@style/BetterPickersDialogFragment.Light</item>
......@@ -220,6 +222,7 @@
<item name="conversation_item_received_text_primary_color">@color/white</item>
<item name="conversation_item_received_text_secondary_color">#BFffffff</item>
<item name="conversation_item_sent_indicator_text_background">@drawable/conversation_item_sent_indicator_text_shape_dark</item>
<item name="conversation_item_xmpp">@drawable/ic_xmpp_white_18dp</item>
<item name="dialog_info_icon">@drawable/ic_info_outline_dark</item>
<item name="dialog_alert_icon">@drawable/ic_warning_dark</item>
......@@ -296,6 +299,7 @@
<item name="pref_ic_app_protection">@drawable/ic_app_protection_gray</item>
<item name="pref_ic_appearance">@drawable/ic_brightness_6_gray</item>
<item name="pref_ic_chats">@drawable/ic_forum_grey_32dp</item>
<item name="pref_ic_xmpp">@drawable/ic_xmpp_grey</item>
<item name="pref_ic_advanced">@drawable/ic_advanced_gray</item>
<item name="app_protect_timeout_picker_color">@style/BetterPickersDialogFragment</item>
......
......@@ -21,6 +21,10 @@
android:title="@string/preferences__chats"
android:icon="?pref_ic_chats"/>
<Preference android:key="preference_category_xmpp"
android:title="@string/preferences__xmpp"
android:icon="?pref_ic_xmpp"/>
<Preference android:key="preference_category_advanced"
android:title="@string/preferences__advanced"
android:icon="?pref_ic_advanced"/>
......
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/preferences__xmpp">
<org.smssecure.smssecure.components.SwitchPreferenceCompat
android:defaultValue="false"
android:key="pref_xmpp_enabled"
android:title="@string/preferences__enable_xmpp_messages" />
<Preference android:key="pref_xmpp_status"
android:title="@string/preferences__xmpp_status"
android:dependency="pref_xmpp_enabled" />
<org.smssecure.smssecure.components.SwitchPreferenceCompat
android:defaultValue="false"
android:key="pref_xmpp_force"
android:title="@string/preferences__force_xmpp_messages"
android:summary="@string/preferences__enable_this_option_to_always_use_xmpp_transport_even_if_recipient_is_offline"
android:dependency="pref_xmpp_enabled" />
<Preference android:key="pref_xmpp_notify"
android:title="@string/preferences__xmpp_notify"
android:summary="@string/preferences__xmpp_notify_summary"
android:dependency="pref_xmpp_enabled" />
</PreferenceCategory>
</PreferenceScreen>
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
......@@ -18,6 +18,7 @@ package org.smssecure.smssecure;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import org.smssecure.smssecure.crypto.PRNGFixes;
import org.smssecure.smssecure.dependencies.InjectableType;
......@@ -26,6 +27,8 @@ import org.smssecure.smssecure.jobs.requirements.MasterSecretRequirementProvider
import org.smssecure.smssecure.jobs.requirements.MediaNetworkRequirementProvider;
import org.smssecure.smssecure.jobs.requirements.ServiceRequirementProvider;
import org.smssecure.smssecure.util.SilencePreferences;
import org.smssecure.smssecure.util.XmppUtil;
import org.smssecure.smssecure.service.XmppService;
import org.whispersystems.jobqueue.JobManager;
import org.whispersystems.jobqueue.dependencies.DependencyInjector;
import org.whispersystems.jobqueue.requirements.NetworkRequirementProvider;
......@@ -60,6 +63,7 @@ public class ApplicationContext extends Application implements DependencyInjecto
initializeRandomNumberFix();
initializeLogging();
initializeJobManager();
initializeXmppService();
}
@Override
......@@ -94,6 +98,10 @@ public class ApplicationContext extends Application implements DependencyInjecto
.build();
}
private void initializeXmppService() {
XmppUtil.startService(this);
}
public void notifyMediaControlEvent() {
mediaNetworkRequirementProvider.notifyMediaControlEvent();
}
......
......@@ -17,9 +17,11 @@
package org.smssecure.smssecure;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Build.VERSION;
import android.os.Bundle;
......@@ -40,11 +42,12 @@ import org.smssecure.smssecure.preferences.AppearancePreferenceFragment;
import org.smssecure.smssecure.preferences.NotificationsPreferenceFragment;
import org.smssecure.smssecure.preferences.SmsMmsPreferenceFragment;
import org.smssecure.smssecure.preferences.ChatsPreferenceFragment;
import org.smssecure.smssecure.preferences.XmppPreferenceFragment;
import org.smssecure.smssecure.service.KeyCachingService;
import org.smssecure.smssecure.service.XmppService;
import org.smssecure.smssecure.util.Dialogs;
import org.smssecure.smssecure.util.DynamicLanguage;
import org.smssecure.smssecure.util.DynamicTheme;
import org.smssecure.smssecure.util.task.ProgressDialogAsyncTask;
import org.smssecure.smssecure.util.ResUtil;
import org.smssecure.smssecure.util.SilencePreferences;
import org.whispersystems.libaxolotl.util.guava.Optional;
......@@ -68,6 +71,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
private static final String PREFERENCE_CATEGORY_APP_PROTECTION = "preference_category_app_protection";
private static final String PREFERENCE_CATEGORY_APPEARANCE = "preference_category_appearance";
private static final String PREFERENCE_CATEGORY_CHATS = "preference_category_chats";
private static final String PREFERENCE_CATEGORY_XMPP = "preference_category_xmpp";
private static final String PREFERENCE_CATEGORY_ADVANCED = "preference_category_advanced";
private static final String PREFERENCE_ABOUT = "preference_about";
......@@ -136,10 +140,21 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
}
public static class ApplicationPreferenceFragment extends PreferenceFragment {
private BroadcastReceiver xmppUpdateReceiver;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
xmppUpdateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
setCategorySummaries();
}
};
getActivity().registerReceiver(xmppUpdateReceiver, new IntentFilter(XmppService.XMPP_CONNECTIVITY_EVENT));
addPreferencesFromResource(R.xml.preferences);
MasterSecret masterSecret = getArguments().getParcelable("master_secret");
......@@ -153,6 +168,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
.setOnPreferenceClickListener(new CategoryClickListener(masterSecret, PREFERENCE_CATEGORY_APPEARANCE));
this.findPreference(PREFERENCE_CATEGORY_CHATS)
.setOnPreferenceClickListener(new CategoryClickListener(masterSecret, PREFERENCE_CATEGORY_CHATS));
this.findPreference(PREFERENCE_CATEGORY_XMPP)
.setOnPreferenceClickListener(new CategoryClickListener(masterSecret, PREFERENCE_CATEGORY_XMPP));
this.findPreference(PREFERENCE_CATEGORY_ADVANCED)
.setOnPreferenceClickListener(new CategoryClickListener(masterSecret, PREFERENCE_CATEGORY_ADVANCED));
}
......@@ -175,6 +192,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
.setSummary(AppearancePreferenceFragment.getSummary(getActivity()));
this.findPreference(PREFERENCE_CATEGORY_CHATS)
.setSummary(ChatsPreferenceFragment.getSummary(getActivity()));
this.findPreference(PREFERENCE_CATEGORY_XMPP)
.setSummary(XmppPreferenceFragment.getSummary(getActivity()));
String version = String.format(this.getString(R.string.preferences__about_version), BuildConfig.VERSION_NAME);
String buildID = String.format(this.getString(R.string.preferences__about_build_id), BuildConfig.BUILD_GIT_COMMIT);
......@@ -214,6 +233,9 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
case PREFERENCE_CATEGORY_CHATS:
fragment = new ChatsPreferenceFragment();
break;
case PREFERENCE_CATEGORY_XMPP:
fragment = new XmppPreferenceFragment();
break;
case PREFERENCE_CATEGORY_ADVANCED:
fragment = new AdvancedPreferenceFragment();
break;
......@@ -234,5 +256,12 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
return true;
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (xmppUpdateReceiver != null) getActivity().unregisterReceiver(xmppUpdateReceiver);
}
}
}
package org.smssecure.smssecure;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.method.LinkMovementMethod;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ClickableSpan;