diff --git a/res/values/strings.xml b/res/values/strings.xml
index 18a7be973..3b5bc1f54 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -41,8 +41,14 @@
SMS %1$s, MMS %2$s
Screen lock %1$s, Read receipts %2$s
Theme %1$s, Language %2$s
+ Theme %1$s, Language %2$s, Background %3$s
+ default
+ custom
+
Background image could not be saved
+ Custom
+ Default
diff --git a/res/xml/preferences_appearance.xml b/res/xml/preferences_appearance.xml
index e09244c2d..156df8438 100644
--- a/res/xml/preferences_appearance.xml
+++ b/res/xml/preferences_appearance.xml
@@ -16,7 +16,7 @@
android:entryValues="@array/language_values"
android:defaultValue="zz"/>
-
diff --git a/src/org/thoughtcrime/securesms/preferences/AppearancePreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/AppearancePreferenceFragment.java
index 7c7f516ae..ffa70a0ec 100644
--- a/src/org/thoughtcrime/securesms/preferences/AppearancePreferenceFragment.java
+++ b/src/org/thoughtcrime/securesms/preferences/AppearancePreferenceFragment.java
@@ -6,6 +6,7 @@ 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;
@@ -41,6 +42,15 @@ public class AppearancePreferenceFragment extends ListSummaryPreferenceFragment
public void onResume() {
super.onResume();
((ApplicationPreferencesActivity) getActivity()).getSupportActionBar().setTitle(R.string.preferences__appearance);
+ String imagePath = TextSecurePreferences.getBackgroundImagePath(getContext());
+ String backgroundString;
+ if(imagePath.isEmpty()){
+ backgroundString = this.getString(R.string.AppearancePreferencesFragment_background_default_summary);
+ }
+ else{
+ backgroundString = this.getString(R.string.AppearancePreferencesFragment_background_custom_summary);
+ }
+ this.findPreference(TextSecurePreferences.BACKGROUND_PREF).setSummary(backgroundString);
}
@Override
@@ -61,9 +71,18 @@ public class AppearancePreferenceFragment extends ListSummaryPreferenceFragment
if (langIndex == -1) langIndex = 0;
if (themeIndex == -1) themeIndex = 0;
- return context.getString(R.string.ApplicationPreferencesActivity_appearance_summary,
+ String imagePath = TextSecurePreferences.getBackgroundImagePath(context);
+ String backgroundString;
+ if(imagePath.isEmpty()){
+ backgroundString = context.getString(R.string.ApplicationPreferencesActivity_appearance_background_default);
+ }
+ else{
+ backgroundString = context.getString(R.string.ApplicationPreferencesActivity_appearance_background_custom);
+ }
+
+ return context.getString(R.string.ApplicationPreferencesActivity_appearance_summary_new,
themeEntries[themeIndex],
- languageEntries[langIndex]);
+ languageEntries[langIndex], backgroundString);
}
private class BackgroundClickListener implements Preference.OnPreferenceClickListener {
diff --git a/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java b/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java
index 1220f6bd5..21d97e541 100644
--- a/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java
+++ b/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java
@@ -86,8 +86,8 @@ public class ChatBackgroundActivity extends BaseActionBarActivity {
@Override
public void run() {
String destination = context.getFilesDir().getAbsolutePath() + "/background";
- scaleAndSaveImage(context, destination);
TextSecurePreferences.setBackgroundImagePath(context, destination);
+ scaleAndSaveImage(context, destination);
}
};
thread.start();
@@ -123,12 +123,15 @@ public class ChatBackgroundActivity extends BaseActionBarActivity {
scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 85, outStream);
} catch (InterruptedException e) {
e.printStackTrace();
+ TextSecurePreferences.setBackgroundImagePath(context, "");
showBackgroundSaveError();
} catch (ExecutionException e) {
e.printStackTrace();
+ TextSecurePreferences.setBackgroundImagePath(context, "");
showBackgroundSaveError();
} catch (FileNotFoundException e) {
e.printStackTrace();
+ TextSecurePreferences.setBackgroundImagePath(context, "");
showBackgroundSaveError();
}
}