public static void setTextColorFromTheme(int theme, Resources resources, TextView... textViews) { int color; if (Util.isLightTheme(theme)) color = resources.getColor(R.color.reddit_light_dialog_text_color); else color = resources.getColor(R.color.reddit_dark_dialog_text_color); for (TextView textView : textViews) textView.setTextColor(color); }
/** Set the Drawable for the list selector etc. based on the current theme. */ public static void updateListDrawables(ListActivity la, int theme) { ListView lv = la.getListView(); if (Util.isLightTheme(theme)) { lv.setBackgroundResource(android.R.color.background_light); lv.setSelector(R.drawable.list_selector_blue); } else /* if (Common.isDarkTheme(theme)) */ { lv.setSelector(android.R.drawable.list_selector_background); } }
private void enableLoadingScreen() { if (Util.isLightTheme(mSettings.getTheme())) { setContentView(R.layout.loading_light); } else { setContentView(R.layout.loading_dark); } synchronized (ADAPTER_LOCK) { if (mSubredditsAdapter != null) mSubredditsAdapter.mLoading = true; } getWindow().setFeatureInt(Window.FEATURE_PROGRESS, 0); }
public static void updateNextPreviousButtons( ListActivity act, View nextPreviousView, String after, String before, int count, RedditSettings settings, OnClickListener downloadAfterOnClickListener, OnClickListener downloadBeforeOnClickListener) { boolean shouldShow = after != null || before != null; Button nextButton = null; Button previousButton = null; // If alwaysShowNextPrevious, use the navbar if (settings.isAlwaysShowNextPrevious()) { nextPreviousView = act.findViewById(R.id.next_previous_layout); if (nextPreviousView == null) return; View nextPreviousBorder = act.findViewById(R.id.next_previous_border_top); if (shouldShow) { if (nextPreviousView != null && nextPreviousBorder != null) { if (Util.isLightTheme(settings.getTheme())) { nextPreviousView.setBackgroundResource(android.R.color.background_light); nextPreviousBorder.setBackgroundResource(R.color.black); } else { nextPreviousBorder.setBackgroundResource(R.color.white); } nextPreviousView.setVisibility(View.VISIBLE); } // update the "next 25" and "prev 25" buttons nextButton = (Button) act.findViewById(R.id.next_button); previousButton = (Button) act.findViewById(R.id.previous_button); } else { nextPreviousView.setVisibility(View.GONE); } } // Otherwise we are using the ListView footer else { if (nextPreviousView == null) return; if (shouldShow && nextPreviousView.getVisibility() != View.VISIBLE) { nextPreviousView.setVisibility(View.VISIBLE); } else if (!shouldShow && nextPreviousView.getVisibility() == View.VISIBLE) { nextPreviousView.setVisibility(View.GONE); } // update the "next 25" and "prev 25" buttons nextButton = (Button) nextPreviousView.findViewById(R.id.next_button); previousButton = (Button) nextPreviousView.findViewById(R.id.previous_button); } if (nextButton != null) { if (after != null) { nextButton.setVisibility(View.VISIBLE); nextButton.setOnClickListener(downloadAfterOnClickListener); } else { nextButton.setVisibility(View.INVISIBLE); } } if (previousButton != null) { if (before != null && count != Constants.DEFAULT_THREAD_DOWNLOAD_LIMIT) { previousButton.setVisibility(View.VISIBLE); previousButton.setOnClickListener(downloadBeforeOnClickListener); } else { previousButton.setVisibility(View.INVISIBLE); } } }