mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 699706: Scroll to the selected tab in Tabs tray [r=mfinkle]
This commit is contained in:
parent
81021f9877
commit
8f638b7d93
@ -104,6 +104,17 @@ public class TabsTray extends Activity implements GeckoApp.OnTabsChangedListener
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
GeckoApp.unregisterOnTabsChangedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
// This function is called after the initial list is populated
|
||||
// Scrolling to the selected tab can happen here
|
||||
if (hasFocus) {
|
||||
int position = mTabsAdapter.getPositionForTab(Tabs.getInstance().getSelectedTab());
|
||||
if (position != -1)
|
||||
mList.smoothScrollToPosition(position);
|
||||
}
|
||||
}
|
||||
|
||||
public void onTabsChanged() {
|
||||
@ -146,6 +157,13 @@ public class TabsTray extends Activity implements GeckoApp.OnTabsChangedListener
|
||||
return position;
|
||||
}
|
||||
|
||||
public int getPositionForTab(Tab tab) {
|
||||
if (mTabs == null || tab == null)
|
||||
return -1;
|
||||
|
||||
return mTabs.indexOf(tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user