UI.java revision 42c0c063206ed37ab63b887348369650b51942e9
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
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
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,
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.
15 */
16
17package com.android.browser;
18
19import android.content.res.Configuration;
20import android.graphics.Bitmap;
21import android.os.Bundle;
22import android.view.ActionMode;
23import android.view.KeyEvent;
24import android.view.Menu;
25import android.view.MenuItem;
26import android.view.View;
27import android.webkit.WebChromeClient.CustomViewCallback;
28import android.webkit.WebView;
29
30import java.util.List;
31
32/**
33 * UI interface definitions
34 */
35public interface UI {
36
37    public static enum ComboViews {
38        History,
39        Bookmarks,
40        Snapshots,
41    }
42
43    public void onPause();
44
45    public void onResume();
46
47    public void onDestroy();
48
49    public void onConfigurationChanged(Configuration config);
50
51    public boolean onBackKey();
52
53    public boolean onMenuKey();
54
55    public boolean needsRestoreAllTabs();
56
57    public void addTab(Tab tab);
58
59    public void removeTab(Tab tab);
60
61    public void setActiveTab(Tab tab);
62
63    public void updateTabs(List<Tab> tabs);
64
65    public void detachTab(Tab tab);
66
67    public void attachTab(Tab tab);
68
69    public void onSetWebView(Tab tab, WebView view);
70
71    public void createSubWindow(Tab tab, WebView subWebView);
72
73    public void attachSubWindow(View subContainer);
74
75    public void removeSubWindow(View subContainer);
76
77    public void onTabDataChanged(Tab tab);
78
79    public void onPageStopped(Tab tab);
80
81    public void onProgressChanged(Tab tab);
82
83    public void showActiveTabsPage();
84
85    public void removeActiveTabsPage();
86
87    public void showComboView(ComboViews startingView, Bundle extra);
88
89    public void showCustomView(View view, int requestedOrientation,
90            CustomViewCallback callback);
91
92    public void onHideCustomView();
93
94    public boolean isCustomViewShowing();
95
96    public void showVoiceTitleBar(String title, List<String> results);
97
98    public void revertVoiceTitleBar(Tab tab);
99
100    public boolean onPrepareOptionsMenu(Menu menu);
101
102    public void updateMenuState(Tab tab, Menu menu);
103
104    public void onOptionsMenuOpened();
105
106    public void onExtendedMenuOpened();
107
108    public boolean onOptionsItemSelected(MenuItem item);
109
110    public void onOptionsMenuClosed(boolean inLoad);
111
112    public void onExtendedMenuClosed(boolean inLoad);
113
114    public void onContextMenuCreated(Menu menu);
115
116    public void onContextMenuClosed(Menu menu, boolean inLoad);
117
118    public void onActionModeStarted(ActionMode mode);
119
120    public void onActionModeFinished(boolean inLoad);
121
122    public void setShouldShowErrorConsole(Tab tab, boolean show);
123
124    // returns if the web page is clear of any overlays (not including sub windows)
125    public boolean showsWeb();
126
127    Bitmap getDefaultVideoPoster();
128
129    View getVideoLoadingProgressView();
130
131    void bookmarkedStatusHasChanged(Tab tab);
132
133    void showMaxTabsWarning();
134
135    void editUrl(boolean clearInput);
136
137    boolean isEditingUrl();
138
139    boolean dispatchKey(int code, KeyEvent event);
140
141    public static interface DropdownChangeListener {
142        void onNewDropdownDimensions(int height);
143    }
144    void registerDropdownChangeListener(DropdownChangeListener d);
145
146    void showAutoLogin(Tab tab);
147
148    void hideAutoLogin(Tab tab);
149
150    void setFullscreen(boolean enabled);
151
152    void setUseQuickControls(boolean enabled);
153
154    public boolean shouldCaptureThumbnails();
155
156}
157