Skip to content

Commit

Permalink
Merge pull request #28 from TrixiEther/3.1.4-experimental-1.5-dev
Browse files Browse the repository at this point in the history
3.1.4-experimental-1.5
  • Loading branch information
TrixiEther committed Jan 18, 2023
2 parents e661362 + 8bfb77d commit 7592e49
Show file tree
Hide file tree
Showing 17 changed files with 127 additions and 36 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ android {
ndkVersion '21.4.7075529'

defaultConfig {
versionCode 1048
versionName '3.1.4-experimental-1.4'
versionCode 1049
versionName '3.1.4-experimental-1.5'

minSdkVersion 16
targetSdkVersion 30
Expand Down
1 change: 1 addition & 0 deletions lang/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<string name="about">О программе</string>
<string name="action_on_playback_completion">Действие при завершении воспроизведения</string>
<string name="active_scrollbar">Активная полоса прокрутки</string>
<string name="highlight_user_posts">Подсвечивать мои посты</string>
<string name="add_theme">Добавить тему</string>
<string name="add_thread_on_reply">Добавлять тред при ответе</string>
<string name="add_to_bottom__imperfective">Добавлять в конец</string>
Expand Down
1 change: 1 addition & 0 deletions lang/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<string name="about">About</string>
<string name="action_on_playback_completion">Action on playback completion</string>
<string name="active_scrollbar">Active scrollbar</string>
<string name="highlight_user_posts">Highlight my posts</string>
<string name="add_theme">Add theme</string>
<string name="add_thread_on_reply">Add thread on reply</string>
<string name="add_to_bottom__imperfective">Add to the bottom</string>
Expand Down
3 changes: 3 additions & 0 deletions metadata/en-US/changelogs/1049.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* ClickableToast design fix
* Fixed bug when selecting "Show thumbnails of all images" media content was smaller
* Added feature "Highlight my posts", which changes the background color for user posts
3 changes: 3 additions & 0 deletions metadata/ru/changelogs/1049.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Исправлен дизайн ClickableToast
* Исправлена ошибка при выборе «Показывать миниатюры всех изображений», когда медиаконтент был меньше
* Добавлена функция "Подсвечивать мои посты", которая меняет цвет фона для пользовательских сообщений.
6 changes: 6 additions & 0 deletions metadata/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,12 @@
"name": "3.1.4-experimental-1.4",
"date": "10.01.2023",
"changelog": true
},
{
"code": 1049,
"name": "3.1.4-experimental-1.5",
"date": "18.01.2023",
"changelog": true
}
]
}
7 changes: 0 additions & 7 deletions res/drawable/clickable_toast_background.xml

This file was deleted.

6 changes: 6 additions & 0 deletions res/values-v21/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@

<color name="color_text_error">#ffe53935</color>

<color name="background_clickable_toast_light">@color/background_popup_light</color>
<color name="color_text_clickable_toast_light">#000000</color>

<color name="background_clickable_toast_dark">@color/background_popup_dark</color>
<color name="color_text_clickable_toast_dark">#ffffff</color>

</resources>
2 changes: 2 additions & 0 deletions res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
<attr name="colorAttachmentBackground" format="color|reference" />
<attr name="colorSpoilerBackground" format="color|reference" />
<attr name="colorCardBackground" format="color|reference" />
<attr name="colorClickableToastBackground" format="color|reference" />

<attr name="colorTextThread" format="color|reference" />
<attr name="colorTextPost" format="color|reference" />
<attr name="colorTextMeta" format="color|reference" />
<attr name="colorTextQuote" format="color|reference" />
<attr name="colorTextTripcode" format="color|reference" />
<attr name="colorTextCapcode" format="color|reference" />
<attr name="colorTextClickableToast" format="color|reference" />

<attr name="colorPrimarySupport" format="color|reference" />
<attr name="colorAccentSupport" format="color|reference" />
Expand Down
6 changes: 6 additions & 0 deletions res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@
<color name="color_vote_like">#027305</color>
<color name="color_vote_red">#ff0000</color>

<color name="background_clickable_toast_light">#323232</color>
<color name="color_text_clickable_toast_light">#ffffff</color>

<color name="background_clickable_toast_dark">@color/background_clickable_toast_light</color>
<color name="color_text_clickable_toast_dark">@color/color_text_clickable_toast_light</color>

</resources>
5 changes: 4 additions & 1 deletion res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@
<item name="dialog_padding_text_half" type="dimen">8dp</item>
<item name="dialog_padding_view" type="dimen">12dp</item>

</resources>
<item name="clickable_toast_horizontal_padding" type="dimen">24dp</item>
<item name="clickable_toast_elevation" type="dimen">2dp</item>

</resources>
6 changes: 5 additions & 1 deletion res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
<item name="colorAttachmentBackground">@color/background_attachment_light</item>
<item name="colorSpoilerBackground">@color/background_spoiler_light</item>
<item name="colorCardBackground">@color/background_card_light</item>
<item name="colorClickableToastBackground">@color/background_clickable_toast_light</item>

<item name="colorPrimarySupport">@color/color_primary_light</item>
<item name="colorAccentSupport">@color/color_accent_light</item>
Expand All @@ -143,6 +144,7 @@
<item name="colorTextQuote">@color/color_text_quote_light</item>
<item name="colorTextTripcode">@color/color_text_tripcode_light</item>
<item name="colorTextCapcode">@color/color_text_capcode_light</item>
<item name="colorTextClickableToast">@color/color_text_clickable_toast_light</item>

<item name="colorGainFactor">0.75</item>

Expand All @@ -158,6 +160,7 @@
<item name="colorAttachmentBackground">@color/background_attachment_dark</item>
<item name="colorSpoilerBackground">@color/background_spoiler_dark</item>
<item name="colorCardBackground">@color/background_card_dark</item>
<item name="colorClickableToastBackground">@color/background_clickable_toast_dark</item>

<item name="colorPrimarySupport">@color/color_primary_dark</item>
<item name="colorAccentSupport">@color/color_accent_dark</item>
Expand All @@ -171,6 +174,7 @@
<item name="colorTextQuote">@color/color_text_quote_dark</item>
<item name="colorTextTripcode">@color/color_text_tripcode_dark</item>
<item name="colorTextCapcode">@color/color_text_capcode_dark</item>
<item name="colorTextClickableToast">@color/color_text_clickable_toast_dark</item>

<item name="colorGainFactor">1.25</item>

Expand Down Expand Up @@ -281,7 +285,7 @@
<style name="ClickableToastTextAppearance">

<item name="android:textSize">14sp</item>
<item name="android:textColor">#ffffff</item>
<item name="android:textColor">?colorTextClickableToast</item>

</style>

Expand Down
7 changes: 7 additions & 0 deletions src/com/mishiranu/dashchan/content/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ public static boolean isActiveScrollbar() {
return PREFERENCES.getBoolean(KEY_ACTIVE_SCROLLBAR, DEFAULT_ACTIVE_SCROLLBAR);
}

public static final String KEY_HIGHLIGHT_USER_POSTS = "highlight_user_posts";
public static final boolean DEFAULT_HIGHLIGHT_USER_POSTS = true;

public static boolean isHighlightUserPosts() {
return PREFERENCES.getBoolean(KEY_HIGHLIGHT_USER_POSTS, DEFAULT_HIGHLIGHT_USER_POSTS);
}

public static final String KEY_ADVANCED_SEARCH = "advanced_search";
public static final boolean DEFAULT_ADVANCED_SEARCH = false;

Expand Down
3 changes: 3 additions & 0 deletions src/com/mishiranu/dashchan/graphics/ColorScheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ private ColorScheme(Context context, int windowBackgroundColor, int spoilerBackg
clickedColor = ResourceUtils.getSystemSelectorColor(context);
highlightTextColor = (Color.BLACK | linkColor) & 0x80ffffff;
highlightBackgroundColor = GraphicsUtils.isLight(windowBackgroundColor) ? 0x1e000000 : 0x1effffff;
// So far the same, but just in case - a new variable
highlightUserPostBackgroundColor = GraphicsUtils.isLight(windowBackgroundColor) ? 0x1e000000 : 0x1effffff;
}

public final int windowBackgroundColor;
Expand All @@ -45,6 +47,7 @@ private ColorScheme(Context context, int windowBackgroundColor, int spoilerBackg

public final int highlightTextColor;
public final int highlightBackgroundColor;
public final int highlightUserPostBackgroundColor;

public final float colorGainFactor;

Expand Down
23 changes: 17 additions & 6 deletions src/com/mishiranu/dashchan/ui/navigator/manager/ViewUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.SystemClock;
Expand Down Expand Up @@ -77,6 +75,8 @@ public class ViewUnit {
private static final float ALPHA_HIDDEN_POST = 0.2f;
private static final float ALPHA_DELETED_POST = 0.5f;

private static final float MEDIA_ITEM_RESIZE_COEFFICIENT = 1.5f;

@SuppressLint("InflateParams")
ViewUnit(UiManager uiManager) {
Context context = uiManager.getContext();
Expand Down Expand Up @@ -544,7 +544,7 @@ private void handlePostViewAttachments(PostViewHolder holder) {
int holders = attachmentHolders.size();
if (holders < size) {
int postBackgroundColor = getPostBackgroundColor(uiManager.getContext(), configurationSet);
float thumbnailsScale = Preferences.getThumbnailsScale();
float thumbnailsScale = Preferences.getThumbnailsScale() * MEDIA_ITEM_RESIZE_COEFFICIENT;
float textScale = Preferences.getTextScale();
for (int i = holders; i < size; i++) {
View view = LayoutInflater.from(context).inflate(R.layout.list_item_post_attachment, null);
Expand Down Expand Up @@ -1283,6 +1283,7 @@ public Dimensions(int thumbnailWidth, int multipleAttachmentInfoWidth, int comme
public ArrayList<ImageView> badgeImages;
public final ImageView[] stateImages = new ImageView[PostState.POST_ITEM_STATES.size()];
public final int highlightBackgroundColor;
public final int highlightUserPostBackgroundColor;

public final UiManager.ThumbnailClickListener thumbnailClickListener;
public final UiManager.ThumbnailLongClickListener thumbnailLongClickListener;
Expand Down Expand Up @@ -1319,7 +1320,11 @@ public PostViewHolder(ViewGroup parent, UiManager uiManager, Lazy<Dimensions> di
bottomBarReplies = itemView.findViewById(R.id.bottom_bar_replies);
bottomBarExpand = itemView.findViewById(R.id.bottom_bar_expand);
bottomBarOpenThread = itemView.findViewById(R.id.bottom_bar_open_thread);
highlightBackgroundColor = ThemeEngine.getColorScheme(itemView.getContext()).highlightBackgroundColor;

ColorScheme colorScheme = ThemeEngine.getColorScheme(itemView.getContext());
highlightBackgroundColor = colorScheme.highlightBackgroundColor;
highlightUserPostBackgroundColor = colorScheme.highlightUserPostBackgroundColor;


thumbnailClickListener = uiManager.interaction().createThumbnailClickListener();
thumbnailLongClickListener = uiManager.interaction().createThumbnailLongClickListener();
Expand Down Expand Up @@ -1355,7 +1360,7 @@ public PostViewHolder(ViewGroup parent, UiManager uiManager, Lazy<Dimensions> di
this.dimensions = dimensions.get(this);
thumbnail.setDrawTouching(true);
ViewGroup.LayoutParams thumbnailLayoutParams = thumbnail.getLayoutParams();
float thumbnailsScale = Preferences.getThumbnailsScale() * 1.5f;
float thumbnailsScale = Preferences.getThumbnailsScale() * MEDIA_ITEM_RESIZE_COEFFICIENT;
if (thumbnailsScale != 1f) {
thumbnailLayoutParams.width = (int) (this.dimensions.thumbnailWidth * thumbnailsScale);
thumbnailLayoutParams.height = thumbnailLayoutParams.width;
Expand Down Expand Up @@ -1423,7 +1428,13 @@ private void installBackgroundUnchecked() {
} else if (selection == UiManager.Selection.SELECTED) {
layout.setSecondaryBackgroundColor(highlightBackgroundColor);
} else {
layout.setSecondaryBackground(null);
boolean highlightUserPost = Preferences.isHighlightUserPosts() &&
configurationSet.postStateProvider.isUserPost(postItem.getPostNumber());
if (highlightUserPost) {
layout.setSecondaryBackgroundColor(highlightUserPostBackgroundColor);
} else {
layout.setSecondaryBackground(null);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
R.string.crop_thumbnails, R.string.crop_thumbnails__summary);
addCheck(true, Preferences.KEY_ACTIVE_SCROLLBAR, Preferences.DEFAULT_ACTIVE_SCROLLBAR,
R.string.active_scrollbar, 0);
addCheck(true, Preferences.KEY_HIGHLIGHT_USER_POSTS, Preferences.DEFAULT_HIGHLIGHT_USER_POSTS,
R.string.highlight_user_posts, 0);
addCheck(true, Preferences.KEY_SCROLL_THREAD_GALLERY, Preferences.DEFAULT_SCROLL_THREAD_GALLERY,
R.string.scroll_thread_when_scrolling_gallery, 0);
addButton(R.string.themes, 0).setOnClickListener(p -> ((FragmentHandler) requireActivity())
Expand Down

0 comments on commit 7592e49

Please sign in to comment.