Michael Kolb | ba99c5d | 2010-11-29 14:57:41 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 5 | * use this file except in compliance with the License. You may obtain a copy of |
| 6 | * the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | * License for the specific language governing permissions and limitations under |
| 14 | * the License. |
| 15 | */ |
| 16 | |
Bijan Amirzada | 41242f2 | 2014-03-21 12:12:18 -0700 | [diff] [blame] | 17 | package com.android.browser; |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 18 | |
Bijan Amirzada | 41242f2 | 2014-03-21 12:12:18 -0700 | [diff] [blame] | 19 | import com.android.browser.R; |
Michael Kolb | ba99c5d | 2010-11-29 14:57:41 -0800 | [diff] [blame] | 20 | |
| 21 | import android.view.ActionMode; |
| 22 | import android.view.Menu; |
| 23 | import android.view.MenuItem; |
| 24 | |
| 25 | public class UrlSelectionActionMode implements ActionMode.Callback { |
| 26 | |
| 27 | private UiController mUiController; |
| 28 | |
| 29 | public UrlSelectionActionMode(UiController controller) { |
| 30 | mUiController = controller; |
| 31 | } |
| 32 | |
| 33 | // ActionMode.Callback implementation |
| 34 | |
| 35 | @Override |
| 36 | public boolean onCreateActionMode(ActionMode mode, Menu menu) { |
| 37 | mode.getMenuInflater().inflate(R.menu.url_selection, menu); |
| 38 | return true; |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | public boolean onActionItemClicked(ActionMode mode, MenuItem item) { |
| 43 | switch (item.getItemId()) { |
| 44 | case R.id.share: |
| 45 | mUiController.shareCurrentPage(); |
| 46 | mode.finish(); |
| 47 | break; |
| 48 | default: |
| 49 | return false; |
| 50 | } |
| 51 | return true; |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public void onDestroyActionMode(ActionMode mode) { |
| 56 | } |
| 57 | |
| 58 | @Override |
| 59 | public boolean onPrepareActionMode(ActionMode mode, Menu menu) { |
| 60 | return true; |
| 61 | } |
| 62 | |
| 63 | } |