2 * Copyright (C) 2012 - 2014 Brandon Tate, bossturbo
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.bossturban.webviewmarker;
19 import android.webkit.JavascriptInterface;
21 public class TextSelectionController {
22 public static final String TAG = "TextSelectionController";
23 public static final String INTERFACE_NAME = "TextSelection";
25 private TextSelectionControlListener mListener;
27 public TextSelectionController(TextSelectionControlListener listener) {
32 public void jsError(String error) {
33 if (mListener != null) {
34 mListener.jsError(error);
38 public void jsLog(String message) {
39 if (mListener != null) {
40 mListener.jsLog(message);
44 public void startSelectionMode() {
45 if (mListener != null) {
46 mListener.startSelectionMode();
50 public void endSelectionMode() {
51 if (mListener != null) {
52 mListener.endSelectionMode();
56 public void selectionChanged(String range, String text, String handleBounds, boolean isReallyChanged) {
57 if (mListener != null) {
58 mListener.selectionChanged(range, text, handleBounds, isReallyChanged);
62 public void setContentWidth(float contentWidth) {
63 if (mListener != null) {
64 mListener.setContentWidth(contentWidth);