mirror of
https://codeberg.org/monocles/monocles_chat.git
synced 2025-01-15 22:22:22 +01:00
Add monocles background
This commit is contained in:
parent
877da3a475
commit
152832d361
12 changed files with 43 additions and 7 deletions
|
@ -2893,13 +2893,22 @@ public class ConversationFragment extends XmppFragment
|
|||
}
|
||||
|
||||
private void updateChatBG() {
|
||||
if (activity != null && conversation != null && conversation.getUuid() != null) {
|
||||
Uri uri = ChatBackgroundHelper.getBgUri(activity, conversation.getUuid());
|
||||
if (uri != null) {
|
||||
binding.backgroundImage.setImageURI(uri);
|
||||
binding.backgroundImage.setVisibility(View.VISIBLE);
|
||||
if (activity != null) {
|
||||
if (activity.unicoloredBG()) {
|
||||
binding.conversationsFragment.setBackgroundResource(0);
|
||||
} else {
|
||||
binding.backgroundImage.setVisibility(View.GONE);
|
||||
if (activity != null && conversation != null && conversation.getUuid() != null) {
|
||||
Uri uri = ChatBackgroundHelper.getBgUri(activity, conversation.getUuid());
|
||||
if (uri != null) {
|
||||
binding.backgroundImage.setImageURI(uri);
|
||||
binding.backgroundImage.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.backgroundImage.setVisibility(View.GONE);
|
||||
binding.conversationsFragment.setBackground(ContextCompat.getDrawable(activity, R.drawable.chatbg));
|
||||
}
|
||||
} else {
|
||||
binding.conversationsFragment.setBackground(ContextCompat.getDrawable(activity, R.drawable.chatbg));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1000,6 +1000,10 @@ public abstract class XmppActivity extends ActionBarActivity {
|
|||
return getBooleanPreference(AppSettings.MANUALLY_CHANGE_PRESENCE, R.bool.manually_change_presence);
|
||||
}
|
||||
|
||||
public boolean unicoloredBG() {
|
||||
return getBooleanPreference("unicolored_chatbg", R.bool.use_unicolored_chatbg); // || getPreferences().getString(SettingsActivity.THEME, getString(R.string.theme)).equals("black");
|
||||
}
|
||||
|
||||
protected String getShareableUri() {
|
||||
return getShareableUri(false);
|
||||
}
|
||||
|
|
BIN
src/main/res/drawable/bg_dark_blue.png
Normal file
BIN
src/main/res/drawable/bg_dark_blue.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
src/main/res/drawable/bg_light_blue.png
Normal file
BIN
src/main/res/drawable/bg_light_blue.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
4
src/main/res/drawable/chatbg.xml
Normal file
4
src/main/res/drawable/chatbg.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="?attr/chat_bg"
|
||||
android:tileMode="repeat" />
|
5
src/main/res/drawable/rounded_hide_image_24.xml
Normal file
5
src/main/res/drawable/rounded_hide_image_24.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="?colorControlNormal" android:viewportHeight="960" android:viewportWidth="960" android:width="24dp">
|
||||
|
||||
<path android:fillColor="@android:color/white" android:pathData="M840,200L840,640Q840,660 827.5,670Q815,680 800,680Q785,680 772.5,669.5Q760,659 760,639L760,200Q760,200 760,200Q760,200 760,200L320,200Q300,200 290,187.5Q280,175 280,160Q280,145 290,132.5Q300,120 320,120L760,120Q793,120 816.5,143.5Q840,167 840,200ZM200,840Q167,840 143.5,816.5Q120,793 120,760L120,232L84,196Q73,185 73,168Q73,151 84,140Q95,129 112,129Q129,129 140,140L820,820Q831,831 831,848Q831,865 820,876Q809,887 792,887Q775,887 764,876L728,840L200,840ZM567,680L280,680Q268,680 262,669Q256,658 264,648L344,541Q350,533 360,533Q370,533 376,541L450,640L483,596L200,313L200,760Q200,760 200,760Q200,760 200,760L647,760L567,680ZM537,423L537,423L537,423Q537,423 537,423Q537,423 537,423ZM424,536L424,536L424,536Q424,536 424,536Q424,536 424,536Z"/>
|
||||
|
||||
</vector>
|
|
@ -35,6 +35,8 @@
|
|||
<item name="ic_accounts_selected" type="reference">@drawable/accounts_selected_white_24</item>
|
||||
<item name="ic_group_unselected" type="reference">@drawable/outline_group_white_24</item>
|
||||
<item name="ic_group_selected" type="reference">@drawable/ic_group_selected_white_24</item>
|
||||
|
||||
<item name="chat_bg">@drawable/bg_dark_blue</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Conversations3.SplashScreen" parent="@style/Theme.Conversations3">
|
||||
|
|
|
@ -9,4 +9,5 @@
|
|||
<bool name="show_nav_drawer">false</bool>
|
||||
<bool name="internal_meda_viewer">true</bool>
|
||||
<bool name="enable_otr">false</bool>
|
||||
<bool name="use_unicolored_chatbg">false</bool>
|
||||
</resources>
|
||||
|
|
|
@ -1179,4 +1179,6 @@
|
|||
<string name="gif_deleted">GIF deleted</string>
|
||||
<string name="failed_to_delete_gif">Failed to delete GIF</string>
|
||||
<string name="add_to_home_screen">Add to home screen</string>
|
||||
<string name="pref_use_unicolored_chatbg">Unicolored background</string>
|
||||
<string name="pref_use_unicolored_chatbg_summary">Use unicolored background in chats</string>
|
||||
</resources>
|
||||
|
|
|
@ -59,6 +59,8 @@
|
|||
<item name="ic_accounts_selected" type="reference">@drawable/accounts_selected_black_24</item>
|
||||
<item name="ic_group_unselected" type="reference">@drawable/outline_group_black_24dp</item>
|
||||
<item name="ic_group_selected" type="reference">@drawable/ic_group_selected_black_24</item>
|
||||
|
||||
<item name="chat_bg">@drawable/bg_light_blue</item>
|
||||
</style>
|
||||
|
||||
<style name="Preference.SwitchPreferenceCompat" parent="@style/Preference.SwitchPreferenceCompat.Material"
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<PreferenceCategory android:title="@string/appearance">
|
||||
<Preference
|
||||
android:key="import_background"
|
||||
android:icon="@drawable/ic_add_24dp"
|
||||
android:icon="@drawable/ic_image_24dp"
|
||||
android:summary="@string/pref_chat_background_summary"
|
||||
android:title="@string/custom_background" />
|
||||
<Preference
|
||||
|
@ -91,6 +91,12 @@
|
|||
android:icon="@drawable/ic_delete_24dp"
|
||||
android:summary="@string/pref_delete_background_summary"
|
||||
android:title="@string/delete_background" />
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="@bool/use_unicolored_chatbg"
|
||||
android:icon="@drawable/rounded_hide_image_24"
|
||||
android:key="unicolored_chatbg"
|
||||
android:summary="@string/pref_use_unicolored_chatbg_summary"
|
||||
android:title="@string/pref_use_unicolored_chatbg" />
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="@bool/show_less_avatars"
|
||||
android:icon="@drawable/ic_person_24dp"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<attr name="ic_accounts_selected" format="reference" />
|
||||
<attr name="ic_group_unselected" format="reference" />
|
||||
<attr name="ic_group_selected" format="reference" />
|
||||
<attr name="chat_bg" format="reference|color" />
|
||||
|
||||
<declare-styleable name="ReadMoreTextView">
|
||||
<attr name="trimExpandedText" format="string" />
|
||||
|
|
Loading…
Reference in a new issue