diff options
Diffstat (limited to 'app/src/main/java')
4 files changed, 14 insertions, 8 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java index d6e61ecc..1eb8aa0a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java @@ -185,14 +185,11 @@ public abstract class BaseActivity extends AppCompatActivity { } protected void setToolbarGoToTop(Toolbar toolbar) { - toolbar.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View view) { - if (BaseActivity.this instanceof ActivityToolbarInterface) { - ((ActivityToolbarInterface) BaseActivity.this).onLongPress(); - } - return true; + toolbar.setOnLongClickListener(view -> { + if (BaseActivity.this instanceof ActivityToolbarInterface) { + ((ActivityToolbarInterface) BaseActivity.this).onLongPress(); } + return true; }); } @@ -247,6 +244,7 @@ public abstract class BaseActivity extends AppCompatActivity { protected void applyAppBarLayoutAndToolbarTheme(AppBarLayout appBarLayout, Toolbar toolbar) { appBarLayout.setBackgroundColor(customThemeWrapper.getColorPrimary()); toolbar.setTitleTextColor(customThemeWrapper.getToolbarPrimaryTextAndIconColor()); + toolbar.setSubtitleTextColor(customThemeWrapper.getToolbarSecondaryTextColor()); if (toolbar.getNavigationIcon() != null) { toolbar.getNavigationIcon().setColorFilter(customThemeWrapper.getToolbarPrimaryTextAndIconColor(), android.graphics.PorterDuff.Mode.SRC_IN); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java index f8275d66..c9a08f48 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java @@ -337,6 +337,7 @@ public class ThemePreviewActivity extends AppCompatActivity { protected void applyAppBarLayoutAndToolbarTheme(AppBarLayout appBarLayout, Toolbar toolbar) { appBarLayout.setBackgroundColor(customTheme.colorPrimary); toolbar.setTitleTextColor(customTheme.toolbarPrimaryTextAndIconColor); + toolbar.setSubtitleTextColor(customTheme.toolbarSecondaryTextColor); if (toolbar.getNavigationIcon() != null) { toolbar.getNavigationIcon().setColorFilter(customTheme.toolbarPrimaryTextAndIconColor, android.graphics.PorterDuff.Mode.SRC_IN); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java index dac601f7..c01f6e20 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java @@ -64,6 +64,7 @@ public class ParsePost { boolean locked = data.getBoolean(JSONUtils.LOCKEC_KEY); boolean saved = data.getBoolean(JSONUtils.SAVED_KEY); StringBuilder postFlairHTMLBuilder = new StringBuilder(); + String flair = ""; if (data.has(JSONUtils.LINK_FLAIR_RICHTEXT_KEY)) { JSONArray flairArray = data.getJSONArray(JSONUtils.LINK_FLAIR_RICHTEXT_KEY); for (int i = 0; i < flairArray.length(); i++) { @@ -75,8 +76,13 @@ public class ParsePost { postFlairHTMLBuilder.append("<img src=\"").append(Html.escapeHtml(flairObject.getString(JSONUtils.U_KEY))).append("\">"); } } + flair = postFlairHTMLBuilder.toString(); } - String flair = postFlairHTMLBuilder.toString(); + + if (flair.equals("") && data.has(JSONUtils.LINK_FLAIR_TEXT_KEY) && !data.isNull(JSONUtils.LINK_FLAIR_TEXT_KEY)) { + flair = data.getString(JSONUtils.LINK_FLAIR_TEXT_KEY); + } + StringBuilder awardingsBuilder = new StringBuilder(); JSONArray awardingsArray = data.getJSONArray(JSONUtils.ALL_AWARDINGS_KEY); int nAwards = 0; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/JSONUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/JSONUtils.java index 03e7fe9e..5f753128 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/JSONUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/JSONUtils.java @@ -23,6 +23,7 @@ public class JSONUtils { public static final String U_KEY = "u"; public static final String LINK_KEY = "link"; public static final String LINK_AUTHOR_KEY = "link_author"; + public static final String LINK_FLAIR_TEXT_KEY = "link_flair_text"; public static final String LINK_FLAIR_RICHTEXT_KEY = "link_flair_richtext"; public static final String SCORE_KEY = "score"; public static final String LIKES_KEY = "likes"; |