aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2020-02-08 19:30:21 +0100
committerChristian Schneppe <christian.schneppe@pix-art.de>2020-02-08 19:30:21 +0100
commitae09585ce2ebc97cad21df69b90753f7236990b6 (patch)
treefb0eb35d64b78de3b7f4240aaa434e3eaea759df /src/main/java
parente96467e5ad9e001086be19cb6521c0f59ab8fd64 (diff)
add preferece to use unicolored background
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java13
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java4
3 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 5a6f542f3..ef09a6a41 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -58,6 +58,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.view.menu.MenuPopupHelper;
import androidx.appcompat.widget.PopupMenu;
+import androidx.core.content.ContextCompat;
import androidx.core.view.inputmethod.InputConnectionCompat;
import androidx.core.view.inputmethod.InputContentInfoCompat;
import androidx.databinding.DataBindingUtil;
@@ -111,6 +112,7 @@ import de.pixart.messenger.ui.util.ScrollState;
import de.pixart.messenger.ui.util.SendButtonAction;
import de.pixart.messenger.ui.util.SendButtonTool;
import de.pixart.messenger.ui.util.ShareUtil;
+import de.pixart.messenger.ui.util.StyledAttributes;
import de.pixart.messenger.ui.util.ViewUtil;
import de.pixart.messenger.ui.widget.EditMessage;
import de.pixart.messenger.utils.Compatibility;
@@ -1672,6 +1674,16 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
}
+ private void updateChatBG() {
+ if (activity.unicoloredBG()) {
+ binding.conversationsFragment.setBackgroundResource(0);
+ binding.conversationsFragment.setBackgroundColor(StyledAttributes.getColor(activity, R.attr.color_background_tertiary));
+ } else {
+ binding.conversationsFragment.setBackgroundColor(0);
+ binding.conversationsFragment.setBackground(ContextCompat.getDrawable(activity, R.drawable.chatbg));
+ }
+ }
+
public void startDownloadable(Message message) {
if (!hasPermissions(REQUEST_START_DOWNLOAD, Manifest.permission.WRITE_EXTERNAL_STORAGE) && !hasPermissions(REQUEST_START_DOWNLOAD, Manifest.permission.READ_EXTERNAL_STORAGE)) {
this.mPendingDownloadableMessage = message;
@@ -2563,6 +2575,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
return;
}
}
+ updateChatBG();
this.refresh(true);
}
diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
index 68e0c9809..a85d4ddb2 100644
--- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
@@ -76,6 +76,7 @@ public class SettingsActivity extends XmppActivity implements
public static final String USE_INVIDIOUS = "use_invidious";
public static final String ALLOW_MESSAGE_CORRECTION = "allow_message_correction";
public static final String ENABLE_OTR_ENCRYPTION = "enable_otr_encryption";
+ public static final String USE_UNICOLORED_CHATBG = "unicolored_chatbg";
public static final int REQUEST_CREATE_BACKUP = 0xbf8701;
Preference multiAccountPreference;
@@ -512,6 +513,8 @@ public class SettingsActivity extends XmppActivity implements
xmppConnectionService.expireOldMessages(true);
} else if (name.equals(THEME) || name.equals(THEME_COLOR)) {
updateTheme();
+ } else if (name.equals(USE_UNICOLORED_CHATBG)) {
+ xmppConnectionService.updateConversationUi();
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index 9d6fd1bf6..f2a3f5c76 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -434,6 +434,10 @@ public abstract class XmppActivity extends ActionBarActivity {
return getStringPreference("theme_color", R.string.theme_color);
}
+ public boolean unicoloredBG() {
+ return getBooleanPreference("unicolored_chatbg", R.bool.use_unicolored_chatbg);
+ }
+
public void setBubbleColor(final View v, final int backgroundColor, final int borderColor) {
GradientDrawable shape = (GradientDrawable) v.getBackground();
shape.setColor(backgroundColor);