use of de.baumann.browser.Browser.AlbumController in project browser by scoute-dich.
the class BrowserActivity method nextAlbumController.
private AlbumController nextAlbumController(boolean next) {
if (BrowserContainer.size() <= 1) {
return currentAlbumController;
}
List<AlbumController> list = BrowserContainer.list();
int index = list.indexOf(currentAlbumController);
if (next) {
index++;
if (index >= list.size()) {
index = 0;
}
} else {
index--;
if (index < 0) {
index = list.size() - 1;
}
}
return list.get(index);
}
use of de.baumann.browser.Browser.AlbumController in project browser by scoute-dich.
the class BrowserActivity method pinAlbums.
private synchronized void pinAlbums(String url) {
showOmnibox();
hideSoftInput(inputBox);
hideSearchPanel();
switcherContainer.removeAllViews();
ninjaWebView = new NinjaWebView(this);
for (AlbumController controller : BrowserContainer.list()) {
if (controller instanceof NinjaWebView) {
((NinjaWebView) controller).setBrowserController(this);
} else if (controller instanceof NinjaRelativeLayout) {
((NinjaRelativeLayout) controller).setBrowserController(this);
}
switcherContainer.addView(controller.getAlbumView(), LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT);
controller.getAlbumView().setVisibility(View.VISIBLE);
controller.deactivate();
}
if (BrowserContainer.size() < 1 && url == null) {
addAlbum(start_tab);
} else if (BrowserContainer.size() >= 1 && url == null) {
if (currentAlbumController != null) {
currentAlbumController.activate();
return;
}
int index = BrowserContainer.size() - 1;
currentAlbumController = BrowserContainer.get(index);
contentFrame.removeAllViews();
contentFrame.addView((View) currentAlbumController);
currentAlbumController.activate();
updateOmnibox();
} else {
// When url != null
ninjaWebView.setBrowserController(this);
ninjaWebView.setFlag(BrowserUnit.FLAG_NINJA);
ninjaWebView.setAlbumTitle(getString(R.string.album_untitled));
ViewUnit.bound(this, ninjaWebView);
ninjaWebView.loadUrl(url);
BrowserContainer.add(ninjaWebView);
final View albumView = ninjaWebView.getAlbumView();
switcherContainer.addView(albumView, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
contentFrame.removeAllViews();
contentFrame.addView(ninjaWebView);
if (currentAlbumController != null) {
currentAlbumController.deactivate();
}
currentAlbumController = ninjaWebView;
currentAlbumController.activate();
updateOmnibox();
}
}
Aggregations