List of usage examples for android.app ListActivity findViewById
@Nullable public <T extends View> T findViewById(@IdRes int id)
From source file:com.andrewshu.android.reddit.common.Common.java
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;//from w ww .j a va 2s .c om 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); } } }
From source file:in.shick.diode.common.Common.java
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;//from ww w.ja va 2 s. c om 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 (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); } } }