Use interface instead of event bus, moving some stuff out of activity and into presenter
This commit is contained in:
parent
76b297781f
commit
f71ebd2643
@ -61,7 +61,6 @@ import android.view.ViewTreeObserver;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Transformation;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@ -95,12 +94,12 @@ import javax.inject.Inject;
|
||||
|
||||
import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.browser.BookmarksView;
|
||||
import acr.browser.lightning.browser.BrowserPresenter;
|
||||
import acr.browser.lightning.browser.BrowserView;
|
||||
import acr.browser.lightning.browser.TabsView;
|
||||
import acr.browser.lightning.bus.BookmarkEvents;
|
||||
import acr.browser.lightning.bus.BrowserEvents;
|
||||
import acr.browser.lightning.bus.NavigationEvents;
|
||||
import acr.browser.lightning.bus.TabEvents;
|
||||
import acr.browser.lightning.constant.BookmarkPage;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
@ -208,6 +207,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
|
||||
private BrowserPresenter mPresenter;
|
||||
private TabsView mTabsView;
|
||||
private BookmarksView mBookmarksView;
|
||||
|
||||
// Proxy
|
||||
@Inject ProxyUtils mProxyUtils;
|
||||
@ -301,6 +301,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
tabsFragment.setArguments(tabsFragmentArguments);
|
||||
|
||||
final BookmarksFragment bookmarksFragment = new BookmarksFragment();
|
||||
mBookmarksView = bookmarksFragment;
|
||||
final Bundle bookmarksFragmentArguments = new Bundle();
|
||||
bookmarksFragmentArguments.putBoolean(BookmarksFragment.INCOGNITO_MODE, isIncognito());
|
||||
bookmarksFragment.setArguments(bookmarksFragmentArguments);
|
||||
@ -338,7 +339,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
}
|
||||
updateTabNumber(0);
|
||||
} else {
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, mSwapBookmarksAndTabs ? mDrawerRight : mDrawerLeft);
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, getTabDrawer());
|
||||
mArrowImage.setImageResource(R.drawable.ic_action_home);
|
||||
mArrowImage.setColorFilter(mIconColor, PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
@ -719,8 +720,8 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
// Handle action buttons
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
if (mDrawerLayout.isDrawerOpen(mDrawerRight)) {
|
||||
mDrawerLayout.closeDrawer(mDrawerRight);
|
||||
if (mDrawerLayout.isDrawerOpen(getBookmarkDrawer())) {
|
||||
mDrawerLayout.closeDrawer(getBookmarkDrawer());
|
||||
}
|
||||
return true;
|
||||
case R.id.action_back:
|
||||
@ -858,17 +859,14 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
@Override
|
||||
public void onClick(String text) {
|
||||
if (!TextUtils.isEmpty(text)) {
|
||||
showSearchInterfaceBar(text);
|
||||
mPresenter.findInPage(text);
|
||||
showFindInPageControls(text);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showSearchInterfaceBar(String text) {
|
||||
final LightningView currentView = mTabsManager.getCurrentTab();
|
||||
if (currentView != null) {
|
||||
currentView.find(text);
|
||||
}
|
||||
private void showFindInPageControls(@NonNull String text) {
|
||||
mSearchBar.setVisibility(View.VISIBLE);
|
||||
|
||||
TextView tw = (TextView) findViewById(R.id.search_query);
|
||||
@ -898,7 +896,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
new BrowserDialog.Item(R.string.close_tab) {
|
||||
@Override
|
||||
public void onClick() {
|
||||
deleteTab(position);
|
||||
mPresenter.deleteTab(position);
|
||||
}
|
||||
},
|
||||
new BrowserDialog.Item(R.string.close_other_tabs) {
|
||||
@ -1060,21 +1058,16 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
|
||||
@Override
|
||||
public void closeEmptyTab() {
|
||||
final WebView currentWebView = mTabsManager.getCurrentWebView();
|
||||
if (currentWebView != null && currentWebView.copyBackForwardList().getSize() == 0) {
|
||||
closeCurrentTab();
|
||||
}
|
||||
}
|
||||
|
||||
private void closeCurrentTab() {
|
||||
// don't delete the tab because the browser will close and mess stuff up
|
||||
// Currently do nothing
|
||||
// Possibly closing the current tab might close the browser
|
||||
// and mess stuff up
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level) {
|
||||
if (level > TRIM_MEMORY_MODERATE && Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
Log.d(TAG, "Low Memory, Free Memory");
|
||||
mTabsManager.freeMemory();
|
||||
mPresenter.onAppLowMemory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1088,11 +1081,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
mPresenter.newTab(null, true);
|
||||
}
|
||||
|
||||
// TODO move this to presenter
|
||||
private synchronized void deleteTab(int position) {
|
||||
mPresenter.deleteTab(position);
|
||||
}
|
||||
|
||||
void performExitCleanUp() {
|
||||
final LightningView currentTab = mTabsManager.getCurrentTab();
|
||||
if (mPreferences.getClearCacheExit() && currentTab != null && !isIncognito()) {
|
||||
@ -1178,7 +1166,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
if (mDrawerLayout.isDrawerOpen(getTabDrawer())) {
|
||||
mDrawerLayout.closeDrawer(getTabDrawer());
|
||||
} else if (mDrawerLayout.isDrawerOpen(getBookmarkDrawer())) {
|
||||
mEventBus.post(new BrowserEvents.UserPressedBack());
|
||||
mBookmarksView.navigateBack();
|
||||
} else {
|
||||
if (currentTab != null) {
|
||||
Log.d(TAG, "onBackPressed");
|
||||
@ -1194,7 +1182,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
if (mCustomView != null || mCustomViewCallback != null) {
|
||||
onHideCustomView();
|
||||
} else {
|
||||
deleteTab(mTabsManager.positionOf(currentTab));
|
||||
mPresenter.deleteTab(mTabsManager.positionOf(currentTab));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1491,10 +1479,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
searchTheWeb(url);
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0);
|
||||
final LightningView currentTab = mTabsManager.getCurrentTab();
|
||||
if (currentTab != null) {
|
||||
currentTab.requestFocus();
|
||||
}
|
||||
mPresenter.onAutoCompleteItemPressed();
|
||||
}
|
||||
|
||||
});
|
||||
@ -1763,6 +1748,11 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeBookmarksDrawer() {
|
||||
mDrawerLayout.closeDrawer(getBookmarkDrawer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHideCustomView() {
|
||||
final LightningView currentTab = mTabsManager.getCurrentTab();
|
||||
@ -1837,6 +1827,37 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackButtonPressed() {
|
||||
final LightningView currentTab = mTabsManager.getCurrentTab();
|
||||
if (currentTab != null) {
|
||||
if (currentTab.canGoBack()) {
|
||||
currentTab.goBack();
|
||||
} else {
|
||||
mPresenter.deleteTab(mTabsManager.positionOf(currentTab));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onForwardButtonPressed() {
|
||||
final LightningView currentTab = mTabsManager.getCurrentTab();
|
||||
if (currentTab != null) {
|
||||
if (currentTab.canGoForward()) {
|
||||
currentTab.goForward();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHomeButtonPressed() {
|
||||
final LightningView currentTab = mTabsManager.getCurrentTab();
|
||||
if (currentTab != null) {
|
||||
currentTab.loadHomepage();
|
||||
closeDrawers(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets whether or not the activity will display
|
||||
* in full-screen mode (i.e. the ActionBar will be hidden) and
|
||||
@ -1908,7 +1929,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
*/
|
||||
@Override
|
||||
public void onCloseWindow(LightningView view) {
|
||||
deleteTab(mTabsManager.positionOf(view));
|
||||
mPresenter.deleteTab(mTabsManager.positionOf(view));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1957,10 +1978,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
height = mToolbarLayout.getMeasuredHeight();
|
||||
}
|
||||
|
||||
final LightningView currentTab = mTabsManager.getCurrentTab();
|
||||
if (currentTab == null)
|
||||
return;
|
||||
|
||||
final int totalHeight = height;
|
||||
if (mToolbarLayout.getTranslationY() < -(height - 0.01f)) {
|
||||
Animation show = new Animation() {
|
||||
@ -2135,7 +2152,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
mDrawerHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDrawerLayout.closeDrawer(mDrawerRight);
|
||||
closeDrawers(null);
|
||||
}
|
||||
}, 150);
|
||||
}
|
||||
@ -2227,19 +2244,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link acr.browser.lightning.fragment.BookmarksFragment} send this message on reply
|
||||
* to {@link acr.browser.lightning.bus.BrowserEvents.UserPressedBack} message if the
|
||||
* fragement is showing the boomarks root folder.
|
||||
*
|
||||
* @param event an event notifying the browser that the bookmark drawer
|
||||
* should be closed.
|
||||
*/
|
||||
@Subscribe
|
||||
public void closeBookmarks(final BookmarkEvents.CloseBookmarks event) {
|
||||
mDrawerLayout.closeDrawer(mDrawerRight);
|
||||
}
|
||||
|
||||
/**
|
||||
* The user wants to close a tab
|
||||
*
|
||||
@ -2247,7 +2251,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
*/
|
||||
@Subscribe
|
||||
public void closeTab(final TabEvents.CloseTab event) {
|
||||
deleteTab(event.position);
|
||||
mPresenter.deleteTab(event.position);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2260,67 +2264,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
BrowserActivity.this.showTab(event.position);
|
||||
}
|
||||
|
||||
/**
|
||||
* The user long pressed on a tab, ask him if he want to close the tab
|
||||
*
|
||||
* @param event contains the tab position in the tabs adapter
|
||||
*/
|
||||
@Subscribe
|
||||
public void showCloseDialog(final TabEvents.ShowCloseDialog event) {
|
||||
BrowserActivity.this.showCloseDialog(event.position);
|
||||
}
|
||||
|
||||
/**
|
||||
* The user wants to create a new tab
|
||||
*
|
||||
* @param event a marker
|
||||
*/
|
||||
@Subscribe
|
||||
public void newTab(final TabEvents.NewTab event) {
|
||||
BrowserActivity.this.newTab(null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* The user wants to go back on current tab
|
||||
*
|
||||
* @param event a marker
|
||||
*/
|
||||
@Subscribe
|
||||
public void goBack(final NavigationEvents.GoBack event) {
|
||||
final LightningView currentTab = mTabsManager.getCurrentTab();
|
||||
if (currentTab != null) {
|
||||
if (currentTab.canGoBack()) {
|
||||
currentTab.goBack();
|
||||
} else {
|
||||
deleteTab(mTabsManager.positionOf(currentTab));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The user wants to go forward on current tab
|
||||
*
|
||||
* @param event a marker
|
||||
*/
|
||||
@Subscribe
|
||||
public void goForward(final NavigationEvents.GoForward event) {
|
||||
final LightningView currentTab = mTabsManager.getCurrentTab();
|
||||
if (currentTab != null) {
|
||||
if (currentTab.canGoForward()) {
|
||||
currentTab.goForward();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void goHome(final NavigationEvents.GoHome event) {
|
||||
final LightningView currentTab = mTabsManager.getCurrentTab();
|
||||
if (currentTab != null) {
|
||||
currentTab.loadHomepage();
|
||||
closeDrawers(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The user long pressed the new tab button
|
||||
*
|
||||
|
@ -0,0 +1,7 @@
|
||||
package acr.browser.lightning.browser;
|
||||
|
||||
public interface BookmarksView {
|
||||
|
||||
void navigateBack();
|
||||
|
||||
}
|
@ -341,4 +341,22 @@ public class BrowserPresenter {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onAutoCompleteItemPressed() {
|
||||
final LightningView currentTab = mTabsModel.getCurrentTab();
|
||||
if (currentTab != null) {
|
||||
currentTab.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
public void findInPage(@NonNull String query) {
|
||||
final LightningView currentView = mTabsModel.getCurrentTab();
|
||||
if (currentView != null) {
|
||||
currentView.find(query);
|
||||
}
|
||||
}
|
||||
|
||||
public void onAppLowMemory() {
|
||||
mTabsModel.freeMemory();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,14 +25,6 @@ public final class BookmarkEvents {
|
||||
public static class ToggleBookmarkForCurrentPage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sended by the {@link acr.browser.lightning.fragment.BookmarksFragment} when it wants to close
|
||||
* itself (generally in reply to a {@link acr.browser.lightning.bus.BrowserEvents.UserPressedBack}
|
||||
* event.
|
||||
*/
|
||||
public static class CloseBookmarks {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sended when a bookmark is edited
|
||||
*/
|
||||
|
@ -34,12 +34,6 @@ public final class BrowserEvents {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the BookmarksFragment and TabsFragment that the user pressed the back button
|
||||
*/
|
||||
public static class UserPressedBack {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -1,34 +0,0 @@
|
||||
package acr.browser.lightning.bus;
|
||||
|
||||
/**
|
||||
* Collections of navigation events, like go back or go forward
|
||||
*
|
||||
* @author Stefano Pacifici
|
||||
* @date 2015/09/15
|
||||
*/
|
||||
public class NavigationEvents {
|
||||
private NavigationEvents() {
|
||||
// No instances please
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired by {@link acr.browser.lightning.fragment.TabsFragment} when the user presses back
|
||||
* button.
|
||||
*/
|
||||
public static class GoBack {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired by {@link acr.browser.lightning.fragment.TabsFragment} when the user presses forward
|
||||
* button.
|
||||
*/
|
||||
public static class GoForward {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired by {@link acr.browser.lightning.fragment.TabsFragment} when the user presses the home
|
||||
* button.
|
||||
*/
|
||||
public static class GoHome {
|
||||
}
|
||||
}
|
@ -37,25 +37,6 @@ public final class TabEvents {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sended by {@link acr.browser.lightning.fragment.TabsFragment} when the user long press on the
|
||||
* tab itself.
|
||||
*/
|
||||
public static class ShowCloseDialog {
|
||||
public final int position;
|
||||
|
||||
public ShowCloseDialog(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sended by {@link acr.browser.lightning.fragment.TabsFragment} when the user want to create a
|
||||
* new tab.
|
||||
*/
|
||||
public static class NewTab {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sended by {@link acr.browser.lightning.fragment.TabsFragment} when the user long presses on
|
||||
* new tab button.
|
||||
|
@ -56,6 +56,8 @@ public interface UIController {
|
||||
|
||||
void newTabClicked();
|
||||
|
||||
void closeBookmarksDrawer();
|
||||
|
||||
void setForwardButtonEnabled(boolean enabled);
|
||||
|
||||
void setBackButtonEnabled(boolean enabled);
|
||||
@ -64,4 +66,10 @@ public interface UIController {
|
||||
|
||||
TabsManager getTabModel();
|
||||
|
||||
void onBackButtonPressed();
|
||||
|
||||
void onForwardButtonPressed();
|
||||
|
||||
void onHomeButtonPressed();
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,11 @@ import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.anthonycr.bonsai.Action;
|
||||
import com.anthonycr.bonsai.Observable;
|
||||
import com.anthonycr.bonsai.OnSubscribe;
|
||||
import com.anthonycr.bonsai.Schedulers;
|
||||
import com.anthonycr.bonsai.Subscriber;
|
||||
import com.squareup.otto.Bus;
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
@ -40,6 +45,8 @@ import acr.browser.lightning.activity.ReadingActivity;
|
||||
import acr.browser.lightning.activity.TabsManager;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.async.AsyncExecutor;
|
||||
import acr.browser.lightning.async.ImageDownloadTask;
|
||||
import acr.browser.lightning.browser.BookmarksView;
|
||||
import acr.browser.lightning.bus.BookmarkEvents;
|
||||
import acr.browser.lightning.bus.BrowserEvents;
|
||||
import acr.browser.lightning.constant.Constants;
|
||||
@ -48,18 +55,10 @@ import acr.browser.lightning.database.BookmarkManager;
|
||||
import acr.browser.lightning.database.HistoryItem;
|
||||
import acr.browser.lightning.dialog.LightningDialogBuilder;
|
||||
import acr.browser.lightning.preference.PreferenceManager;
|
||||
import acr.browser.lightning.async.ImageDownloadTask;
|
||||
|
||||
import com.anthonycr.bonsai.Action;
|
||||
import com.anthonycr.bonsai.Observable;
|
||||
import com.anthonycr.bonsai.OnSubscribe;
|
||||
import com.anthonycr.bonsai.Schedulers;
|
||||
import com.anthonycr.bonsai.Subscriber;
|
||||
|
||||
import acr.browser.lightning.utils.ThemeUtils;
|
||||
import acr.browser.lightning.view.LightningView;
|
||||
|
||||
public class BookmarksFragment extends Fragment implements View.OnClickListener, View.OnLongClickListener {
|
||||
public class BookmarksFragment extends Fragment implements View.OnClickListener, View.OnLongClickListener, BookmarksView {
|
||||
|
||||
private final static String TAG = BookmarksFragment.class.getSimpleName();
|
||||
|
||||
@ -78,6 +77,8 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener,
|
||||
|
||||
private TabsManager mTabsManager;
|
||||
|
||||
private UIController mUiController;
|
||||
|
||||
// Adapter
|
||||
private BookmarkViewAdapter mBookmarkAdapter;
|
||||
|
||||
@ -117,7 +118,8 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener,
|
||||
BrowserApp.getAppComponent().inject(this);
|
||||
final Bundle arguments = getArguments();
|
||||
final Context context = getContext();
|
||||
mTabsManager = ((UIController) context).getTabModel();
|
||||
mUiController = (UIController) context;
|
||||
mTabsManager = mUiController.getTabModel();
|
||||
mIsIncognito = arguments.getBoolean(INCOGNITO_MODE, false);
|
||||
boolean darkTheme = mPreferenceManager.getUseTheme() != 0 || mIsIncognito;
|
||||
mWebpageBitmap = ThemeUtils.getThemedBitmap(context, R.drawable.ic_webpage, darkTheme);
|
||||
@ -247,16 +249,6 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void userPressedBack(final BrowserEvents.UserPressedBack event) {
|
||||
if (mBookmarkManager.isRootFolder()) {
|
||||
mEventBus.post(new BookmarkEvents.CloseBookmarks());
|
||||
} else {
|
||||
setBookmarkDataSet(mBookmarkManager.getBookmarksFromFolder(null, true), true);
|
||||
mBookmarksListView.setSelection(mScrollIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void bookmarkDeleted(@NonNull final BookmarkEvents.Deleted event) {
|
||||
mBookmarks.remove(event.item);
|
||||
@ -365,6 +357,16 @@ public class BookmarksFragment extends Fragment implements View.OnClickListener,
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigateBack() {
|
||||
if (mBookmarkManager.isRootFolder()) {
|
||||
mUiController.closeBookmarksDrawer();
|
||||
} else {
|
||||
setBookmarkDataSet(mBookmarkManager.getBookmarksFromFolder(null, true), true);
|
||||
mBookmarksListView.setSelection(mScrollIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private class BookmarkViewAdapter extends ArrayAdapter<HistoryItem> {
|
||||
|
||||
final Context context;
|
||||
|
@ -39,7 +39,6 @@ import acr.browser.lightning.R;
|
||||
import acr.browser.lightning.activity.TabsManager;
|
||||
import acr.browser.lightning.app.BrowserApp;
|
||||
import acr.browser.lightning.browser.TabsView;
|
||||
import acr.browser.lightning.bus.NavigationEvents;
|
||||
import acr.browser.lightning.bus.TabEvents;
|
||||
import acr.browser.lightning.controller.UIController;
|
||||
import acr.browser.lightning.fragment.anim.HorizontalItemAnimator;
|
||||
@ -215,16 +214,16 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View
|
||||
mUiController.showCloseDialog(mTabsManager.indexOfCurrentTab());
|
||||
break;
|
||||
case R.id.new_tab_button:
|
||||
mBus.post(new TabEvents.NewTab());
|
||||
mUiController.newTabClicked();
|
||||
break;
|
||||
case R.id.action_back:
|
||||
mBus.post(new NavigationEvents.GoBack());
|
||||
mUiController.onBackButtonPressed();
|
||||
break;
|
||||
case R.id.action_forward:
|
||||
mBus.post(new NavigationEvents.GoForward());
|
||||
mUiController.onForwardButtonPressed();
|
||||
break;
|
||||
case R.id.action_home:
|
||||
mBus.post(new NavigationEvents.GoHome());
|
||||
mUiController.onHomeButtonPressed();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -416,8 +415,7 @@ public class TabsFragment extends Fragment implements View.OnClickListener, View
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
// Show close dialog
|
||||
mBus.post(new TabEvents.ShowCloseDialog(getAdapterPosition()));
|
||||
mUiController.showCloseDialog(getAdapterPosition());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user