blob: 87446ece05ae0640720bf875f071351390feeea9 [file] [log] [blame]
Michael Kolbba99c5d2010-11-29 14:57:41 -08001/*
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 Amirzada41242f22014-03-21 12:12:18 -070017package com.android.browser;
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080018
Bijan Amirzada41242f22014-03-21 12:12:18 -070019import com.android.browser.R;
Michael Kolbba99c5d2010-11-29 14:57:41 -080020
21import android.view.ActionMode;
22import android.view.Menu;
23import android.view.MenuItem;
24
25public 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}