diff options
author | John Reck <jreck@google.com> | 2011-07-29 10:56:07 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-07-29 10:56:43 -0700 |
commit | f26ff6306dec07a7fa34d0ad5c54b49aec268d18 (patch) | |
tree | 2a459a108b4ce9163d306e171d0e57159a0ba4ba /src/com/android/browser/SnapshotBar.java | |
parent | 10aa4bd07ad26c4797abc1bc85e71bd49a6299b7 (diff) | |
download | packages_apps_Browser-f26ff6306dec07a7fa34d0ad5c54b49aec268d18.zip packages_apps_Browser-f26ff6306dec07a7fa34d0ad5c54b49aec268d18.tar.gz packages_apps_Browser-f26ff6306dec07a7fa34d0ad5c54b49aec268d18.tar.bz2 |
Make snapshot go live a popup menu
Bug: 4982126
Change-Id: Ic4b6b645e8ec29f18e3b9fcdaf5f4a12ce58de4c
Diffstat (limited to 'src/com/android/browser/SnapshotBar.java')
-rw-r--r-- | src/com/android/browser/SnapshotBar.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/com/android/browser/SnapshotBar.java b/src/com/android/browser/SnapshotBar.java index 9fb68cf..ba0bf98 100644 --- a/src/com/android/browser/SnapshotBar.java +++ b/src/com/android/browser/SnapshotBar.java @@ -23,16 +23,22 @@ import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; +import android.view.Menu; +import android.view.MenuItem; import android.view.ViewConfiguration; import android.view.ViewPropertyAnimator; +import android.webkit.WebView; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.PopupMenu; +import android.widget.PopupMenu.OnMenuItemClickListener; import android.widget.TextView; import java.text.DateFormat; import java.util.Date; -public class SnapshotBar extends LinearLayout implements OnClickListener { +public class SnapshotBar extends LinearLayout implements OnClickListener, + OnMenuItemClickListener { private static final int MSG_SHOW_TITLE = 1; private static final long DURATION_SHOW_DATE = BaseUi.HIDE_TITLEBAR_DELAY; @@ -171,7 +177,11 @@ public class SnapshotBar extends LinearLayout implements OnClickListener { if (mBookmarks == v) { mTitleBar.getUiController().bookmarksOrHistoryPicker(false); } else if (mGoLive == v) { - goLive(); + PopupMenu popup = new PopupMenu(mContext, mGoLive); + Menu menu = popup.getMenu(); + popup.getMenuInflater().inflate(R.menu.snapshot_go_live, menu); + popup.setOnMenuItemClickListener(this); + popup.show(); } else if (mTabSwitcher == v) { ((PhoneUi) mTitleBar.getUi()).toggleNavScreen(); } else if (mOverflowMenu == v) { @@ -188,6 +198,16 @@ public class SnapshotBar extends LinearLayout implements OnClickListener { } } + @Override + public boolean onMenuItemClick(MenuItem item) { + switch (item.getItemId()) { + case R.id.snapshot_go_live: + goLive(); + return true; + } + return false; + } + private void goLive() { Tab t = mTitleBar.getUi().getActiveTab(); t.loadUrl(t.getUrl(), null); |