Lines Matching refs:tab
28 import static com.android.deskclock.uidata.UiDataModel.Tab;
31 * All tab data is accessed via this model.
37 /** The listeners to notify when the selected tab is changed. */
40 /** The listeners to notify when the vertical scroll state of the selected tab is changed. */
43 /** The scrolled-to-top state of each tab. */
44 private final boolean[] mTabScrolledToTop = new boolean[Tab.values().length];
46 /** An enumerated value indicating the currently selected tab. */
47 private Tab mSelectedTab;
55 // Selected tab
59 * @param tabListener to be notified when the selected tab changes
66 * @param tabListener to no longer be notified when the selected tab changes
76 return Tab.values().length;
80 * @param ordinal the ordinal (left-to-right index) of the tab
81 * @return the tab at the given {@code ordinal}
83 Tab getTab(int ordinal) {
84 return Tab.values()[ordinal];
88 * @param position the position of the tab in the user interface
89 * @return the tab at the given {@code ordinal}
91 Tab getTabAt(int position) {
102 * @return an enumerated value indicating the currently selected primary tab
104 Tab getSelectedTab() {
112 * @param tab an enumerated value indicating the newly selected primary tab
114 void setSelectedTab(Tab tab) {
115 final Tab oldSelectedTab = getSelectedTab();
116 if (oldSelectedTab != tab) {
117 mSelectedTab = tab;
118 TabDAO.setSelectedTab(mPrefs, tab);
120 // Notify of the tab change.
122 tl.selectedTabChanged(oldSelectedTab, tab);
126 final boolean tabScrolledToTop = isTabScrolledToTop(tab);
129 tsl.selectedTabScrollToTopChanged(tab, tabScrolledToTop);
136 // Tab scrolling
140 * @param tabScrollListener to be notified when the scroll position of the selected tab changes
147 * @param tabScrollListener to be notified when the scroll position of the selected tab changes
154 * Updates the scrolling state in the {@link UiDataModel} for this tab.
156 * @param tab an enumerated value indicating the tab reporting its vertical scroll position
157 * @param scrolledToTop {@code true} iff the vertical scroll position of this tab is at the top
159 void setTabScrolledToTop(Tab tab, boolean scrolledToTop) {
160 if (isTabScrolledToTop(tab) != scrolledToTop) {
161 mTabScrolledToTop[tab.ordinal()] = scrolledToTop;
162 if (tab == getSelectedTab()) {
164 tsl.selectedTabScrollToTopChanged(tab, scrolledToTop);
171 * @param tab identifies the tab
172 * @return {@code true} iff the content in the given {@code tab} is currently scrolled to top
174 boolean isTabScrolledToTop(Tab tab) {
175 return mTabScrolledToTop[tab.ordinal()];