Java源码示例:org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector
示例1
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void changeTabs() {
DocumentTabModelSelector selector =
ChromeApplication.getDocumentTabModelSelector();
TabModel tabModel = selector.getCurrentModel();
int currentIndex = tabModel.index();
if (mLastScroll == ScrollDirection.LEFT) {
if (currentIndex < tabModel.getCount() - 1) {
TabModelUtils.setIndex(tabModel, currentIndex + 1);
}
} else {
if (currentIndex > 0) {
TabModelUtils.setIndex(tabModel, currentIndex - 1);
}
}
}
示例2
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void changeTabs() {
DocumentTabModelSelector selector =
ChromeApplication.getDocumentTabModelSelector();
TabModel tabModel = selector.getCurrentModel();
int currentIndex = tabModel.index();
if (mLastScroll == ScrollDirection.LEFT) {
if (currentIndex < tabModel.getCount() - 1) {
TabModelUtils.setIndex(tabModel, currentIndex + 1);
}
} else {
if (currentIndex > 0) {
TabModelUtils.setIndex(tabModel, currentIndex - 1);
}
}
}
示例3
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void changeTabs() {
DocumentTabModelSelector selector =
ChromeApplication.getDocumentTabModelSelector();
TabModel tabModel = selector.getCurrentModel();
int currentIndex = tabModel.index();
if (mLastScroll == ScrollDirection.LEFT) {
if (currentIndex < tabModel.getCount() - 1) {
TabModelUtils.setIndex(tabModel, currentIndex + 1);
}
} else {
if (currentIndex > 0) {
TabModelUtils.setIndex(tabModel, currentIndex - 1);
}
}
}