Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Conditional could be pushed inside branch expression
Browse files Browse the repository at this point in the history
  • Loading branch information
TacoTheDank committed Oct 1, 2020
1 parent 72916c8 commit ab25c1a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1028,8 +1028,7 @@ public void filterContent(final String subreddit) {
};

final String FILTER_TITLE =
(subreddit.equals("frontpage")) ? (getString(R.string.content_to_hide, "frontpage"))
: (getString(R.string.content_to_hide, "/r/" + subreddit));
(getString(R.string.content_to_hide, subreddit.equals("frontpage") ? "frontpage" : "/r/" + subreddit));

new AlertDialogWrapper.Builder(this).setTitle(FILTER_TITLE)
.alwaysCallMultiChoiceCallback()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1125,9 +1125,9 @@ public void setCommentStateHighlighted(final CommentViewHolder holder, final Com
currentNode = baseNode;
LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
resetMenu(holder.menuArea, false);
final View baseView = (SettingValues.rightHandedCommentMenu) ? inflater.inflate(
R.layout.comment_menu_right_handed, holder.menuArea)
: inflater.inflate(R.layout.comment_menu, holder.menuArea);
final View baseView = inflater.inflate(
SettingValues.rightHandedCommentMenu ?
R.layout.comment_menu_right_handed : R.layout.comment_menu, holder.menuArea);

if (!isReplying) {
baseView.setVisibility(View.GONE);
Expand Down Expand Up @@ -2558,4 +2558,4 @@ private RedditClient getAuthenticatedClient(String profileName) {
Authentication.doVerify(token, reddit, true, mContext);
return reddit;
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/me/ccrama/redditslide/SettingValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public static void setAllValues(SharedPreferences settings) {

// TODO: Remove the old pref check in a later version
// This handles forward migration from the old night_mode boolean state
nightModeState = prefs.getInt(PREF_NIGHT_MODE_STATE, prefs.getBoolean(PREF_NIGHT_MODE, false) ? NightModeState.MANUAL.ordinal() : NightModeState.DISABLED.ordinal());
nightModeState = prefs.getInt(PREF_NIGHT_MODE_STATE, (prefs.getBoolean(PREF_NIGHT_MODE, false) ? NightModeState.MANUAL : NightModeState.DISABLED).ordinal());
nightTheme = prefs.getInt(PREF_NIGHT_THEME, 0);
autoTime = prefs.getBoolean(PREF_AUTOTHEME, false);
colorBack = prefs.getBoolean(PREF_COLOR_BACK, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,9 @@ private void replaceQuoteSpans(Spannable spannable) {
spannable.removeSpan(quoteSpan);

//If the theme is Light or Sepia, use a darker blue; otherwise, use a lighter blue
final int barColor =
(SettingValues.currentTheme == 1 || SettingValues.currentTheme == 5)
? ContextCompat.getColor(getContext(), R.color.md_blue_600)
: ContextCompat.getColor(getContext(), R.color.md_blue_400);
final int barColor = ContextCompat.getColor(getContext(),
SettingValues.currentTheme == 1 || SettingValues.currentTheme == 5
? R.color.md_blue_600 : R.color.md_blue_400);

final int BAR_WIDTH = 4;
final int GAP = 5;
Expand Down

0 comments on commit ab25c1a

Please sign in to comment.