Bug 952290 - Long press on navigation buttons (i.e. back/forward) in app menu should bring up history list. r=mcomella

--HG--
extra : rebase_source : abbaaa58512c78b28a9228d44870c00fb0d3e2d4
This commit is contained in:
Matt King 2015-04-30 13:54:05 -07:00
Родитель 49bdc62361
Коммит 410c397319
1 изменённых файлов: 36 добавлений и 0 удалений

Просмотреть файл

@ -104,6 +104,7 @@ import android.os.Bundle;
import android.os.StrictMode;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.MenuItemCompat;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
@ -123,6 +124,7 @@ import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.animation.Interpolator;
import android.widget.Button;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.Toast;
@ -3038,6 +3040,40 @@ public class BrowserApp extends GeckoApp
desktopMode.setChecked(tab.getDesktopMode());
desktopMode.setIcon(tab.getDesktopMode() ? R.drawable.ic_menu_desktop_mode_on : R.drawable.ic_menu_desktop_mode_off);
View backButtonView = MenuItemCompat.getActionView(back);
if (backButtonView != null) {
backButtonView.setOnLongClickListener(new Button.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
Tab tab = Tabs.getInstance().getSelectedTab();
if (tab != null) {
closeOptionsMenu();
return tabHistoryController.showTabHistory(tab,
TabHistoryController.HistoryAction.BACK);
}
return false;
}
});
}
View forwardButtonView = MenuItemCompat.getActionView(forward);
if (forwardButtonView != null) {
forwardButtonView.setOnLongClickListener(new Button.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
Tab tab = Tabs.getInstance().getSelectedTab();
if (tab != null) {
closeOptionsMenu();
return tabHistoryController.showTabHistory(tab,
TabHistoryController.HistoryAction.FORWARD);
}
return false;
}
});
}
String url = tab.getURL();
if (AboutPages.isAboutReader(url)) {
String urlFromReader = ReaderModeUtils.getUrlFromAboutReader(url);