diff --git a/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCell.java b/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCell.java
index f92b01e6..6d0742dd 100644
--- a/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCell.java
+++ b/Clover/app/src/main/java/org/floens/chan/ui/cell/PostCell.java
@@ -19,7 +19,6 @@ package org.floens.chan.ui.cell;
import android.annotation.TargetApi;
import android.content.Context;
-import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build;
@@ -53,15 +52,17 @@ import org.floens.chan.core.model.Post;
import org.floens.chan.core.model.PostLinkable;
import org.floens.chan.core.settings.ChanSettings;
import org.floens.chan.ui.helper.PostHelper;
+import org.floens.chan.ui.theme.Theme;
+import org.floens.chan.ui.theme.ThemeHelper;
import org.floens.chan.ui.view.FloatingMenu;
import org.floens.chan.ui.view.FloatingMenuItem;
import org.floens.chan.ui.view.ThumbnailView;
-import org.floens.chan.ui.theme.ThemeHelper;
import org.floens.chan.utils.Time;
import java.util.ArrayList;
import java.util.List;
+import static org.floens.chan.ui.theme.ThemeHelper.theme;
import static org.floens.chan.utils.AndroidUtils.dp;
import static org.floens.chan.utils.AndroidUtils.getRes;
import static org.floens.chan.utils.AndroidUtils.setRoundItemBackground;
@@ -84,12 +85,9 @@ public class PostCell extends RelativeLayout implements PostLinkable.Callback {
private boolean commentClickable = false;
private CharSequence iconsSpannable;
private int detailsSizePx;
- private int detailsColor;
private int iconsTextSize;
private int countrySizePx;
private boolean ignoreNextOnClick;
- private int highlightColor;
- private int savedColor;
private int paddingPx;
private PostCellCallback callback;
@@ -156,18 +154,6 @@ public class PostCell extends RelativeLayout implements PostLinkable.Callback {
dividerParams.rightMargin = paddingPx;
divider.setLayoutParams(dividerParams);
- TypedArray ta = getContext().obtainStyledAttributes(new int[]{
- R.attr.post_details_color,
- R.attr.post_highlighted_color,
- R.attr.post_saved_reply_color
- });
-
- detailsColor = ta.getColor(0, 0);
- highlightColor = ta.getColor(1, 0);
- savedColor = ta.getColor(2, 0);
-
- ta.recycle();
-
thumbnailView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -226,6 +212,10 @@ public class PostCell extends RelativeLayout implements PostLinkable.Callback {
}
public void setPost(final Post post, PostCellCallback callback, boolean highlighted, int markedNo) {
+ setPost(theme(), post, callback, highlighted, markedNo);
+ }
+
+ public void setPost(Theme theme, final Post post, PostCellCallback callback, boolean highlighted, int markedNo) {
if (this.post != null) {
unbindPost(this.post);
}
@@ -235,7 +225,7 @@ public class PostCell extends RelativeLayout implements PostLinkable.Callback {
this.highlighted = highlighted;
this.markedNo = markedNo;
- bindPost(post);
+ bindPost(theme, post);
}
public Post getPost() {
@@ -252,7 +242,7 @@ public class PostCell extends RelativeLayout implements PostLinkable.Callback {
return false;
}
- private void bindPost(Post post) {
+ private void bindPost(Theme theme, Post post) {
threadMode = callback.getLoadable().isThreadMode();
setPostLinkableListener(post, this);
@@ -264,9 +254,9 @@ public class PostCell extends RelativeLayout implements PostLinkable.Callback {
}
if (highlighted) {
- setBackgroundColor(highlightColor);
+ setBackgroundColor(theme.highlightedColor);
} else if (post.isSavedReply) {
- setBackgroundColor(savedColor);
+ setBackgroundColor(theme.savedReplyColor);
} else if (threadMode) {
setBackgroundResource(0);
} else {
@@ -293,7 +283,7 @@ public class PostCell extends RelativeLayout implements PostLinkable.Callback {
CharSequence relativeTime = DateUtils.getRelativeTimeSpanString(post.time * 1000L, Time.get(), DateUtils.SECOND_IN_MILLIS, 0);
SpannableString date = new SpannableString("No." + post.no + " " + relativeTime);
- date.setSpan(new ForegroundColorSpan(detailsColor), 0, date.length(), 0);
+ date.setSpan(new ForegroundColorSpan(theme.detailsColor), 0, date.length(), 0);
date.setSpan(new AbsoluteSizeSpan(detailsSizePx), 0, date.length(), 0);
titleParts[titlePartsCount] = date;
@@ -320,7 +310,7 @@ public class PostCell extends RelativeLayout implements PostLinkable.Callback {
boolean waitingForCountry = false;
if (!TextUtils.isEmpty(post.country)) {
- loadCountryIcon();
+ loadCountryIcon(theme);
waitingForCountry = true;
}
@@ -393,7 +383,7 @@ public class PostCell extends RelativeLayout implements PostLinkable.Callback {
}
}
- private void loadCountryIcon() {
+ private void loadCountryIcon(final Theme theme) {
final Post requestedPost = post;
Chan.getVolleyImageLoader().get(post.countryUrl, new ImageLoader.ImageListener() {
@Override
@@ -403,7 +393,7 @@ public class PostCell extends RelativeLayout implements PostLinkable.Callback {
SpannableString countryText = new SpannableString(post.countryName);
countryText.setSpan(new StyleSpan(Typeface.ITALIC), 0, countryText.length(), 0);
- countryText.setSpan(new ForegroundColorSpan(detailsColor), 0, countryText.length(), 0);
+ countryText.setSpan(new ForegroundColorSpan(theme.detailsColor), 0, countryText.length(), 0);
countryText.setSpan(new AbsoluteSizeSpan(countrySizePx), 0, countryText.length(), 0);
iconsSpannable = TextUtils.concat(iconsSpannable, countryIcon, countryText);
diff --git a/Clover/app/src/main/java/org/floens/chan/ui/controller/ThemeSettingsController.java b/Clover/app/src/main/java/org/floens/chan/ui/controller/ThemeSettingsController.java
index a8963f99..884c6a90 100644
--- a/Clover/app/src/main/java/org/floens/chan/ui/controller/ThemeSettingsController.java
+++ b/Clover/app/src/main/java/org/floens/chan/ui/controller/ThemeSettingsController.java
@@ -200,7 +200,7 @@ public class ThemeSettingsController extends Controller implements View.OnClickL
themeContext.getResources().getDimensionPixelSize(R.dimen.toolbar_height)));
PostCell postCell = (PostCell) LayoutInflater.from(themeContext).inflate(R.layout.cell_post, null);
- postCell.setPost(post, DUMMY_POST_CALLBACK, false, -1);
+ postCell.setPost(theme, post, DUMMY_POST_CALLBACK, false, -1);
linearLayout.addView(postCell, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
return linearLayout;
diff --git a/Clover/app/src/main/java/org/floens/chan/ui/theme/DarkTheme.java b/Clover/app/src/main/java/org/floens/chan/ui/theme/DarkTheme.java
index 78de8c86..d3f969f5 100644
--- a/Clover/app/src/main/java/org/floens/chan/ui/theme/DarkTheme.java
+++ b/Clover/app/src/main/java/org/floens/chan/ui/theme/DarkTheme.java
@@ -3,8 +3,9 @@ package org.floens.chan.ui.theme;
import org.floens.chan.R;
public class DarkTheme extends Theme {
- public DarkTheme(String displayName, String name, int resValue, boolean isLightTheme, ThemeHelper.PrimaryColor primaryColor) {
- super(displayName, name, resValue, isLightTheme, primaryColor);
+ public DarkTheme(String displayName, String name, int resValue, ThemeHelper.PrimaryColor primaryColor) {
+ super(displayName, name, resValue, primaryColor);
+ isLightTheme = false;
}
public void resolveDrawables() {
diff --git a/Clover/app/src/main/java/org/floens/chan/ui/theme/Theme.java b/Clover/app/src/main/java/org/floens/chan/ui/theme/Theme.java
index 9489f90b..db49abe6 100644
--- a/Clover/app/src/main/java/org/floens/chan/ui/theme/Theme.java
+++ b/Clover/app/src/main/java/org/floens/chan/ui/theme/Theme.java
@@ -35,8 +35,8 @@ public class Theme {
public final String displayName;
public final String name;
public final int resValue;
- public final boolean isLightTheme;
public final ThemeHelper.PrimaryColor primaryColor;
+ public boolean isLightTheme = true;
public int quoteColor;
public int highlightQuoteColor;
@@ -48,6 +48,9 @@ public class Theme {
public int idBackgroundLight;
public int idBackgroundDark;
public int capcodeColor;
+ public int detailsColor;
+ public int highlightedColor;
+ public int savedReplyColor;
public ThemeDrawable settingsDrawable;
public ThemeDrawable imageDrawable;
@@ -56,11 +59,10 @@ public class Theme {
public ThemeDrawable backDrawable;
public ThemeDrawable doneDrawable;
- public Theme(String displayName, String name, int resValue, boolean isLightTheme, ThemeHelper.PrimaryColor primaryColor) {
+ public Theme(String displayName, String name, int resValue, ThemeHelper.PrimaryColor primaryColor) {
this.displayName = displayName;
this.name = name;
this.resValue = resValue;
- this.isLightTheme = isLightTheme;
this.primaryColor = primaryColor;
resolveSpanColors();
@@ -91,7 +93,10 @@ public class Theme {
R.attr.post_name_color,
R.attr.post_id_background_light,
R.attr.post_id_background_dark,
- R.attr.post_capcode_color
+ R.attr.post_capcode_color,
+ R.attr.post_details_color,
+ R.attr.post_highlighted_color,
+ R.attr.post_saved_reply_color
});
quoteColor = ta.getColor(0, 0);
@@ -104,6 +109,9 @@ public class Theme {
idBackgroundLight = ta.getColor(7, 0);
idBackgroundDark = ta.getColor(8, 0);
capcodeColor = ta.getColor(9, 0);
+ detailsColor = ta.getColor(10, 0);
+ highlightedColor = ta.getColor(11, 0);
+ savedReplyColor = ta.getColor(12, 0);
ta.recycle();
}
diff --git a/Clover/app/src/main/java/org/floens/chan/ui/theme/ThemeHelper.java b/Clover/app/src/main/java/org/floens/chan/ui/theme/ThemeHelper.java
index a62e8f73..041163c3 100644
--- a/Clover/app/src/main/java/org/floens/chan/ui/theme/ThemeHelper.java
+++ b/Clover/app/src/main/java/org/floens/chan/ui/theme/ThemeHelper.java
@@ -46,9 +46,13 @@ public class ThemeHelper {
private Theme theme;
public ThemeHelper() {
- themes.add(new Theme("Light", "light", R.style.Chan_Theme, true, PrimaryColor.GREEN));
- themes.add(new DarkTheme("Dark", "dark", R.style.Chan_Theme_Dark, false, PrimaryColor.DARK));
- themes.add(new DarkTheme("Black", "black", R.style.Chan_Theme_Black, false, PrimaryColor.BLACK));
+ themes.add(new Theme("Light", "light", R.style.Chan_Theme, PrimaryColor.GREEN));
+ themes.add(new DarkTheme("Dark", "dark", R.style.Chan_Theme_Dark, PrimaryColor.DARK));
+ themes.add(new DarkTheme("Black", "black", R.style.Chan_Theme_Black, PrimaryColor.BLACK));
+ themes.add(new Theme("Yotsuba", "yotsuba", R.style.Chan_Theme_Yotsuba, PrimaryColor.RED));
+ themes.add(new Theme("Yotsuba B", "yotsuba_b", R.style.Chan_Theme_YotsubaB, PrimaryColor.RED));
+ themes.add(new Theme("Photon", "photon", R.style.Chan_Theme_Photon, PrimaryColor.ORANGE));
+ themes.add(new DarkTheme("Tomorrow", "tomorrow", R.style.Chan_Theme_Tomorrow, PrimaryColor.DARK));
updateCurrentTheme();
}
@@ -85,7 +89,7 @@ public class ThemeHelper {
}
public enum PrimaryColor {
- RED("red", 0xFF44336, 0xFFD32F2F),
+ RED("red", 0xFFF44336, 0xFFD32F2F),
PINK("pink", 0xFFE91E63, 0xFFC2185B),
PURPLE("purple", 0xFF9C27B0, 0xFF7B1FA2),
DEEP_PURPLE("deep purple", 0xFF673AB7, 0xFF512DA8),
diff --git a/Clover/app/src/main/res/values/attrs.xml b/Clover/app/src/main/res/values/attrs.xml
index b6cd1486..8e6bb32a 100644
--- a/Clover/app/src/main/res/values/attrs.xml
+++ b/Clover/app/src/main/res/values/attrs.xml
@@ -25,7 +25,6 @@ along with this program. If not, see .
-
diff --git a/Clover/app/src/main/res/values/styles.xml b/Clover/app/src/main/res/values/styles.xml
index f8e59e22..979e7634 100644
--- a/Clover/app/src/main/res/values/styles.xml
+++ b/Clover/app/src/main/res/values/styles.xml
@@ -40,21 +40,21 @@ along with this program. If not, see .
- #89000000
- #42000000
- - #FFBCBCBC
- - #FFD6BAD0
- - #FF646464
- #ff117743
- #ff0F0C5D
- #ff646464
- #ffDD0000
- #ff950000
+ - #ff789922
- #ff0000B4
- #ff000000
- #ffff0000
+
- #ff636363
- #00000000
- - #ff789922
- @drawable/ic_overflow
+ - #FFBCBCBC
+ - #FFD6BAD0
- #1e000000
@@ -98,6 +98,57 @@ along with this program. If not, see .
- #ff2c2c2c
+
+
+
+
+
+
+
+