From 823217c593db3282806917fce65fcc436c04f237 Mon Sep 17 00:00:00 2001 From: Florian Haar Date: Fri, 7 Dec 2018 08:41:21 +0100 Subject: [PATCH] Added default image as default on preferences screen #50 --- .../preferences/ChatBackgroundActivity.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java b/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java index 1d41fa2f2..c0e9a1d74 100644 --- a/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java +++ b/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java @@ -55,7 +55,11 @@ public class ChatBackgroundActivity extends BaseActionBarActivity { galleryButton.setOnClickListener(new GalleryClickListener()); String backgroundImagePath = Prefs.getBackgroundImagePath(this); - setLayoutBackgroundImage(backgroundImagePath); + if(backgroundImagePath.isEmpty()){ + setDefaultLayoutBackgroundImage(); + }else { + setLayoutBackgroundImage(backgroundImagePath); + } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { @@ -142,6 +146,11 @@ public class ChatBackgroundActivity extends BaseActionBarActivity { preview.setImageDrawable(image); } + private void setDefaultLayoutBackgroundImage() { + Drawable image = getResources().getDrawable(R.drawable.background_hd); + preview.setImageDrawable(image); + } + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { final Context context = getApplicationContext(); @@ -177,7 +186,7 @@ public class ChatBackgroundActivity extends BaseActionBarActivity { public void onClick(View view) { imageUri = null; tempDestinationPath = ""; - setLayoutBackgroundImage(""); + setDefaultLayoutBackgroundImage(); enableMenuItem(); }