/*
* Zirco Browser for Android
*
* Copyright (C) 2010 J. Devauchelle and contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
package org.zirco.ui.activities;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.zirco.R;
import org.zirco.controllers.Controller;
import org.zirco.events.EventConstants;
import org.zirco.events.EventController;
import org.zirco.events.IDownloadEventsListener;
import org.zirco.events.IWebEventListener;
import org.zirco.model.DbAdapter;
import org.zirco.model.DownloadItem;
import org.zirco.model.UrlSuggestionCursorAdapter;
import org.zirco.ui.activities.preferences.PreferencesActivity;
import org.zirco.ui.components.ZircoWebView;
import org.zirco.ui.components.ZircoWebViewClient;
import org.zirco.ui.runnables.BookmarkThumbnailUpdater;
import org.zirco.ui.runnables.HideToolbarsRunnable;
import org.zirco.ui.runnables.HistoryUpdater;
import org.zirco.utils.AnimationManager;
import org.zirco.utils.ApplicationUtils;
import org.zirco.utils.Constants;
import org.zirco.utils.UrlUtils;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences.Editor;
import android.content.res.Configuration;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
import android.preference.PreferenceManager;
import android.view.ContextMenu;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.inputmethod.InputMethodManager;
import android.webkit.DownloadListener;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebIconDatabase;
import android.webkit.WebView;
import android.webkit.WebView.HitTestResult;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import android.widget.FilterQueryProvider;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewFlipper;
import android.widget.SimpleCursorAdapter.CursorToStringConverter;
/**
* The application main activity.
*/
public class ZircoMain extends Activity implements IWebEventListener, IToolbarsContainer, OnTouchListener, IDownloadEventsListener {
public static ZircoMain INSTANCE = null;
private static final int FLIP_PIXEL_THRESHOLD = 200;
private static final int FLIP_TIME_THRESHOLD = 400;
private static final int MENU_ADD_BOOKMARK = Menu.FIRST;
private static final int MENU_SHOW_BOOKMARKS = Menu.FIRST + 1;
private static final int MENU_SHOW_DOWNLOADS = Menu.FIRST + 2;
private static final int MENU_PREFERENCES = Menu.FIRST + 3;
private static final int MENU_EXIT = Menu.FIRST + 4;
private static final int MENU_SELECT_TEXT = Menu.FIRST + 5;
private static final int MENU_MOBILE_VIEW = Menu.FIRST + 6;
private static final int MENU_SHARE_PAGE = Menu.FIRST + 7;
private static final int CONTEXT_MENU_OPEN = Menu.FIRST + 10;
private static final int CONTEXT_MENU_OPEN_IN_NEW_TAB = Menu.FIRST + 11;
private static final int CONTEXT_MENU_DOWNLOAD = Menu.FIRST + 12;
private static final int CONTEXT_MENU_COPY = Menu.FIRST + 13;
private static final int CONTEXT_MENU_SEND_MAIL = Menu.FIRST + 14;
private static final int CONTEXT_MENU_SHARE = Menu.FIRST + 15;
private static final int OPEN_BOOKMARKS_HISTORY_ACTIVITY = 0;
private static final int OPEN_DOWNLOADS_ACTIVITY = 1;
protected LayoutInflater mInflater = null;
private LinearLayout mTopBar;
private LinearLayout mBottomBar;
private ImageView mPreviousTabView;
private ImageView mNextTabView;
private ImageButton mHomeButton;
private AutoCompleteTextView mUrlEditText;
private ImageButton mGoButton;
private ProgressBar mProgressBar;
private ImageView mBubbleRightView;
private ImageView mBubbleLeftView;
private ZircoWebView mCurrentWebView;
private List<ZircoWebView> mWebViews;
private ImageButton mPreviousButton;
private ImageButton mNextButton;
private ImageButton mNewTabButton;
private ImageButton mRemoveTabButton;
private ImageButton mQuickButton;
private Drawable mCircularProgress;
private boolean mUrlBarVisible;
private HideToolbarsRunnable mHideToolbarsRunnable;
private ViewFlipper mViewFlipper;
private DbAdapter mDbAdapter = null;
private GestureDetector mGestureDetector;
private SwitchTabsMethod mSwitchTabsMethod = SwitchTabsMethod.BOTH;
private enum SwitchTabsMethod {
BUTTONS,
FLING,
BOTH
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
INSTANCE = this;
Constants.initializeConstantsFromResources(this);
Controller.getInstance().setPreferences(PreferenceManager.getDefaultSharedPreferences(this));
if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_SHOW_FULL_SCREEN, false)) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_GENERAL_HIDE_TITLE_BARS, true)) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
}
setProgressBarVisibility(true);
setContentView(R.layout.main);
mCircularProgress = getResources().getDrawable(R.drawable.spinner);
EventController.getInstance().addDownloadListener(this);
mHideToolbarsRunnable = null;
mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
buildComponents();
EventController.getInstance().addWebListener(this);
mViewFlipper.removeAllViews();
updateSwitchTabsMethod();
Intent i = getIntent();
if (i.getData() != null) {
// App first launch from another app.
addTab(false);
navigateToUrl(i.getDataString());
} else {
// Normal start.
int currentVersionCode = ApplicationUtils.getApplicationVersionCode(this);
int savedVersionCode = PreferenceManager.getDefaultSharedPreferences(this).getInt(Constants.PREFERENCES_LAST_VERSION_CODE, -1);
// If currentVersionCode and savedVersionCode are different, the application has been updated.
if (currentVersionCode != savedVersionCode) {
// Save current version code.
Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
editor.putInt(Constants.PREFER
没有合适的资源?快使用搜索试试~ 我知道了~
android开源zicro浏览器源代码
共517个文件
svn-base:292个
png:86个
java:43个
5星 · 超过95%的资源 需积分: 13 251 下载量 188 浏览量
2011-07-25
11:57:27
上传
评论 7
收藏 626KB RAR 举报
温馨提示
android自带浏览器缺失太多类,这个开源浏览器zicro代码可以运行,功能齐全
资源推荐
资源详情
资源评论
收起资源包目录
android开源zicro浏览器源代码 (517个子文件)
adsweep 57KB
all-wcprops 4KB
all-wcprops 4KB
all-wcprops 3KB
all-wcprops 2KB
all-wcprops 2KB
all-wcprops 1KB
all-wcprops 953B
all-wcprops 914B
all-wcprops 878B
all-wcprops 676B
all-wcprops 650B
all-wcprops 608B
all-wcprops 485B
all-wcprops 367B
all-wcprops 360B
all-wcprops 212B
all-wcprops 198B
all-wcprops 180B
all-wcprops 180B
all-wcprops 81B
all-wcprops 78B
all-wcprops 72B
all-wcprops 71B
all-wcprops 68B
all-wcprops 68B
changelog 3KB
.checkstyle 467B
.classpath 273B
start_style.css 990B
entries 5KB
entries 5KB
entries 5KB
entries 3KB
entries 2KB
entries 2KB
entries 1KB
entries 1KB
entries 1KB
entries 1KB
entries 909B
entries 885B
entries 865B
entries 668B
entries 558B
entries 386B
entries 380B
entries 379B
entries 371B
entries 327B
entries 278B
entries 267B
entries 223B
entries 220B
entries 214B
start.html 484B
start_search.html 347B
start_bookmarks.html 259B
start_history.html 249B
ZircoMain.java 50KB
BookmarksListActivity.java 26KB
DbAdapter.java 24KB
ApplicationUtils.java 16KB
PreferencesActivity.java 14KB
HistoryExpandableListAdapter.java 9KB
ZircoWebView.java 8KB
MobileViewListActivity.java 7KB
AdBlockerWhiteListActivity.java 7KB
HistoryListActivity.java 7KB
AnimationManager.java 7KB
DownloadItem.java 6KB
Constants.java 5KB
ZircoWebViewClient.java 5KB
DateUtils.java 4KB
DownloadListAdapter.java 4KB
DownloadRunnable.java 4KB
Controller.java 4KB
EditBookmarkActivity.java 4KB
BaseSpinnerCustomPreferenceActivity.java 3KB
BookmarksCursorAdapter.java 3KB
EventController.java 3KB
IOUtils.java 3KB
DownloadsListActivity.java 3KB
UrlSuggestionCursorAdapter.java 3KB
SearchUrlPreferenceActivity.java 3KB
HomepagePreferenceActivity.java 3KB
UrlSuggestionItem.java 3KB
BookmarksHistoryActivity.java 3KB
BookmarkThumbnailUpdater.java 3KB
UserAgentPreferenceActivity.java 3KB
AboutActivity.java 3KB
UrlUtils.java 3KB
BookmarksUtils.java 2KB
HideToolbarsRunnable.java 2KB
ChangelogActivity.java 2KB
HistoryUpdater.java 1KB
EventConstants.java 1KB
HistoryItem.java 1KB
UrlSuggestionItemComparator.java 943B
IDownloadEventsListener.java 832B
共 517 条
- 1
- 2
- 3
- 4
- 5
- 6
windblueos12
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页