├── .classpath ├── .gitignore ├── .project ├── .settings └── org.eclipse.jdt.core.prefs ├── AndroidManifest.xml ├── README.textile ├── proguard.cfg ├── project.properties ├── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-ldpi │ └── ic_launcher.png ├── drawable-mdpi │ └── ic_launcher.png └── values │ └── strings.xml └── src └── org └── tint └── addons └── framework ├── Action.aidl ├── Action.java ├── AskUserChoiceAction.java ├── AskUserConfirmationAction.java ├── AskUserInputAction.java ├── BaseAskUserAction.java ├── Callbacks.java ├── IAddon.aidl ├── LoadUrlAction.java ├── OpenTabAction.java ├── ShowDialogAction.java ├── ShowToastAction.java └── TabAction.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /gen 2 | /bin 3 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | TintBrowserAddonFrameworkLibrary 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | h1. Tint Browser Addon Framework Library 2 | 3 | This project is licensed under the "Apache 2":http://www.apache.org/licenses/LICENSE-2.0 license. -------------------------------------------------------------------------------- /proguard.cfg: -------------------------------------------------------------------------------- 1 | -optimizationpasses 5 2 | -dontusemixedcaseclassnames 3 | -dontskipnonpubliclibraryclasses 4 | -dontpreverify 5 | -verbose 6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* 7 | 8 | -keep public class * extends android.app.Activity 9 | -keep public class * extends android.app.Application 10 | -keep public class * extends android.app.Service 11 | -keep public class * extends android.content.BroadcastReceiver 12 | -keep public class * extends android.content.ContentProvider 13 | -keep public class * extends android.app.backup.BackupAgentHelper 14 | -keep public class * extends android.preference.Preference 15 | -keep public class com.android.vending.licensing.ILicensingService 16 | 17 | -keepclasseswithmembernames class * { 18 | native ; 19 | } 20 | 21 | -keepclasseswithmembers class * { 22 | public (android.content.Context, android.util.AttributeSet); 23 | } 24 | 25 | -keepclasseswithmembers class * { 26 | public (android.content.Context, android.util.AttributeSet, int); 27 | } 28 | 29 | -keepclassmembers class * extends android.app.Activity { 30 | public void *(android.view.View); 31 | } 32 | 33 | -keepclassmembers enum * { 34 | public static **[] values(); 35 | public static ** valueOf(java.lang.String); 36 | } 37 | 38 | -keep class * implements android.os.Parcelable { 39 | public static final android.os.Parcelable$Creator *; 40 | } 41 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-14 12 | android.library=true 13 | -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anasthase/TintBrowserAddonFrameworkLibrary/a20f5a440317fbd47941bd1dcbad72ca5ca65ed3/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anasthase/TintBrowserAddonFrameworkLibrary/a20f5a440317fbd47941bd1dcbad72ca5ca65ed3/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anasthase/TintBrowserAddonFrameworkLibrary/a20f5a440317fbd47941bd1dcbad72ca5ca65ed3/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/Action.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | parcelable Action; -------------------------------------------------------------------------------- /src/org/tint/addons/framework/Action.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | import android.os.Parcel; 22 | import android.os.Parcelable; 23 | 24 | public class Action implements Parcelable { 25 | 26 | public static final int ACTION_NONE = 0; 27 | 28 | public static final int ACTION_SHOW_TOAST = 1; 29 | public static final int ACTION_SHOW_DIALOG = 2; 30 | public static final int ACTION_ASK_USER_CONFIRMATION = 3; 31 | public static final int ACTION_ASK_USER_INPUT = 4; 32 | public static final int ACTION_ASK_USER_CHOICE = 5; 33 | 34 | public static final int ACTION_OPEN_TAB = 6; 35 | public static final int ACTION_CLOSE_TAB = 7; 36 | 37 | public static final int ACTION_LOAD_URL = 8; 38 | 39 | public static final int ACTION_BROWSE_STOP = 9; 40 | public static final int ACTION_BROWSE_RELOAD = 10; 41 | public static final int ACTION_BROWSE_FORWARD = 11; 42 | public static final int ACTION_BROWSE_BACK = 12; 43 | 44 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { 45 | 46 | public Action createFromParcel(Parcel in) { 47 | int action = in.readInt(); 48 | 49 | switch (action) { 50 | case ACTION_CLOSE_TAB: 51 | case ACTION_BROWSE_STOP: 52 | case ACTION_BROWSE_RELOAD: 53 | case ACTION_BROWSE_FORWARD: 54 | case ACTION_BROWSE_BACK: 55 | return new TabAction(in, action); 56 | case ACTION_SHOW_TOAST: 57 | return new ShowToastAction(in); 58 | case ACTION_SHOW_DIALOG: 59 | return new ShowDialogAction(in); 60 | case ACTION_ASK_USER_CONFIRMATION: 61 | return new AskUserConfirmationAction(in); 62 | case ACTION_ASK_USER_INPUT: 63 | return new AskUserInputAction(in); 64 | case ACTION_ASK_USER_CHOICE: 65 | return new AskUserChoiceAction(in); 66 | case ACTION_OPEN_TAB: 67 | return new OpenTabAction(in); 68 | case ACTION_LOAD_URL: 69 | return new LoadUrlAction(in); 70 | default: 71 | return new Action(ACTION_NONE); 72 | } 73 | } 74 | 75 | public Action[] newArray(int size) { 76 | return new Action[size]; 77 | } 78 | }; 79 | 80 | protected int mAction; 81 | 82 | public Action(int action) { 83 | mAction = action; 84 | } 85 | 86 | @Override 87 | public void writeToParcel(Parcel dest, int flags) { 88 | dest.writeInt(mAction); 89 | } 90 | 91 | @Override 92 | public int describeContents() { 93 | return 0; 94 | } 95 | 96 | public int getAction() { 97 | return mAction; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/AskUserChoiceAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | import android.os.Parcel; 25 | 26 | public class AskUserChoiceAction extends BaseAskUserAction { 27 | 28 | private String mTitle; 29 | private List mChoices; 30 | 31 | public AskUserChoiceAction(int id, String title, List choices) { 32 | super(ACTION_ASK_USER_CHOICE, id); 33 | 34 | mTitle = title; 35 | mChoices = choices; 36 | } 37 | 38 | public AskUserChoiceAction(Parcel in) { 39 | super(in, ACTION_ASK_USER_CHOICE); 40 | 41 | mTitle = in.readString(); 42 | mChoices = new ArrayList(); 43 | in.readStringList(mChoices); 44 | } 45 | 46 | public String getTitle() { 47 | return mTitle; 48 | } 49 | 50 | public List getChoices() { 51 | return mChoices; 52 | } 53 | 54 | @Override 55 | public void writeToParcel(Parcel dest, int flags) { 56 | super.writeToParcel(dest, flags); 57 | 58 | dest.writeString(mTitle); 59 | dest.writeStringList(mChoices); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/AskUserConfirmationAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | import android.os.Parcel; 22 | 23 | public class AskUserConfirmationAction extends BaseAskUserAction { 24 | 25 | private String mTitle; 26 | private String mMessage; 27 | private String mPositiveButtonCaption; 28 | private String mNegativeButtonCaption; 29 | 30 | public AskUserConfirmationAction(int id, String title, String message, String positiveButtonCaption, String negativeButtonCaption) { 31 | super(ACTION_ASK_USER_CONFIRMATION, id); 32 | 33 | mTitle = title; 34 | mMessage = message; 35 | mPositiveButtonCaption = positiveButtonCaption; 36 | mNegativeButtonCaption = negativeButtonCaption; 37 | } 38 | 39 | public AskUserConfirmationAction(Parcel in) { 40 | super(in, ACTION_ASK_USER_CONFIRMATION); 41 | 42 | mTitle = in.readString(); 43 | mMessage = in.readString(); 44 | mPositiveButtonCaption = in.readString(); 45 | mNegativeButtonCaption = in.readString(); 46 | } 47 | 48 | public String getTitle() { 49 | return mTitle; 50 | } 51 | 52 | public String getMessage() { 53 | return mMessage; 54 | } 55 | 56 | public String getPositiveButtonCaption() { 57 | return mPositiveButtonCaption; 58 | } 59 | 60 | public String getNegativeButtonCaption() { 61 | return mNegativeButtonCaption; 62 | } 63 | 64 | @Override 65 | public void writeToParcel(Parcel dest, int flags) { 66 | super.writeToParcel(dest, flags); 67 | 68 | dest.writeString(mTitle); 69 | dest.writeString(mMessage); 70 | dest.writeString(mPositiveButtonCaption); 71 | dest.writeString(mNegativeButtonCaption); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/AskUserInputAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | import android.os.Parcel; 22 | import android.text.InputType; 23 | 24 | public class AskUserInputAction extends BaseAskUserAction { 25 | 26 | private String mTitle; 27 | private String mMessage; 28 | private String mInputHint; 29 | private String mDefaultInput; 30 | private int mInputType; 31 | 32 | public AskUserInputAction(int id, String title, String message) { 33 | this(id, title, message, null, null, InputType.TYPE_CLASS_TEXT); 34 | } 35 | 36 | public AskUserInputAction(int id, String title, String message, String inputHint) { 37 | this(id, title, message, inputHint, null, InputType.TYPE_CLASS_TEXT); 38 | } 39 | 40 | public AskUserInputAction(int id, String title, String message, String inputHint, String defaultInput) { 41 | this(id, title, message, inputHint, defaultInput, InputType.TYPE_CLASS_TEXT); 42 | } 43 | 44 | public AskUserInputAction(int id, String title, String message, String inputHint, String defaultInput, int inputType) { 45 | super(ACTION_ASK_USER_INPUT, id); 46 | 47 | mTitle = title; 48 | mMessage = message; 49 | mInputHint = inputHint; 50 | mDefaultInput = defaultInput; 51 | mInputType = inputType; 52 | } 53 | 54 | public AskUserInputAction(Parcel in) { 55 | super(in, ACTION_ASK_USER_INPUT); 56 | 57 | mTitle = in.readString(); 58 | mMessage = in.readString(); 59 | mInputHint = in.readString(); 60 | mDefaultInput = in.readString(); 61 | mInputType = in.readInt(); 62 | } 63 | 64 | public String getTitle() { 65 | return mTitle; 66 | } 67 | 68 | public String getMessage() { 69 | return mMessage; 70 | } 71 | 72 | public String getInputHint() { 73 | return mInputHint; 74 | } 75 | 76 | public String getDefaultInput() { 77 | return mDefaultInput; 78 | } 79 | 80 | public int getInputType() { 81 | return mInputType; 82 | } 83 | 84 | @Override 85 | public void writeToParcel(Parcel dest, int flags) { 86 | super.writeToParcel(dest, flags); 87 | 88 | dest.writeString(mTitle); 89 | dest.writeString(mMessage); 90 | dest.writeString(mInputHint); 91 | dest.writeString(mDefaultInput); 92 | dest.writeInt(mInputType); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/BaseAskUserAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | import android.os.Parcel; 22 | 23 | public abstract class BaseAskUserAction extends Action { 24 | 25 | protected int mId; 26 | 27 | protected BaseAskUserAction(int action, int id) { 28 | super(action); 29 | mId = id; 30 | } 31 | 32 | protected BaseAskUserAction(Parcel in, int action) { 33 | super(action); 34 | mId = in.readInt(); 35 | } 36 | 37 | public int getId() { 38 | return mId; 39 | } 40 | 41 | @Override 42 | public void writeToParcel(Parcel dest, int flags) { 43 | super.writeToParcel(dest, flags); 44 | dest.writeInt(mId); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/Callbacks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | public class Callbacks { 22 | 23 | public static final int PAGE_STARTED = 1; 24 | public static final int PAGE_FINISHED = 2; 25 | 26 | public static final int TAB_OPENED = 4; 27 | public static final int TAB_CLOSED = 8; 28 | public static final int TAB_SWITCHED = 16; 29 | 30 | public static final int HAS_SETTINGS_PAGE = 32; 31 | 32 | public static final int CONTRIBUTE_MAIN_MENU = 64; 33 | public static final int CONTRIBUTE_LINK_CONTEXT_MENU = 128; 34 | public static final int CONTRIBUTE_HISTORY_BOOKMARKS_MENU = 256; 35 | public static final int CONTRIBUTE_BOOKMARK_CONTEXT_MENU = 512; 36 | public static final int CONTRIBUTE_HISTORY_CONTEXT_MENU = 1024; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/IAddon.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | import org.tint.addons.framework.Action; 22 | 23 | /** 24 | * AIDL interface for an addon service. 25 | */ 26 | interface IAddon { 27 | void onBind(); 28 | void onUnbind(); 29 | 30 | String getName(); 31 | String getShortDescription(); 32 | String getDescription(); 33 | String getContact(); 34 | 35 | int getCallbacks(); 36 | 37 | List onPageStarted(String tabId, String url); 38 | List onPageFinished(String tabId, String url); 39 | 40 | List onTabOpened(String tabId); 41 | List onTabClosed(String tabId); 42 | List onTabSwitched(String tabId); 43 | 44 | String getContributedMainMenuItem(String currentTabId, String currentTitle, String currentUrl); 45 | List onContributedMainMenuItemSelected(String currentTabId, String currentTitle, String currentUrl); 46 | 47 | String getContributedLinkContextMenuItem(String currentTabId, int hitTestResult, String url); 48 | List onContributedLinkContextMenuItemSelected(String currentTabId, int hitTestResult, String url); 49 | 50 | String getContributedHistoryBookmarksMenuItem(String currentTabId); 51 | List onContributedHistoryBookmarksMenuItemSelected(String currentTabId); 52 | 53 | String getContributedBookmarkContextMenuItem(String currentTabId); 54 | List onContributedBookmarkContextMenuItemSelected(String currentTabId, String title, String url); 55 | 56 | String getContributedHistoryContextMenuItem(String currentTabId); 57 | List onContributedHistoryContextMenuItemSelected(String currentTabId, String title, String url); 58 | 59 | List onUserConfirm(String currentTabId, int questionId, boolean positiveAnswer); 60 | List onUserInput(String currentTabId, int questionId, boolean cancelled, String userInput); 61 | List onUserChoice(String currentTabId, int questionId, boolean cancelled, int userChoice); 62 | 63 | void showAddonSettingsActivity(); 64 | } -------------------------------------------------------------------------------- /src/org/tint/addons/framework/LoadUrlAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | import android.os.Parcel; 22 | 23 | public class LoadUrlAction extends TabAction { 24 | 25 | private String mUrl; 26 | private boolean mLoadRawUrl; 27 | 28 | public LoadUrlAction(String url) { 29 | this(null, url, false); 30 | } 31 | 32 | public LoadUrlAction(String tabId, String url) { 33 | this(tabId, url, false); 34 | } 35 | 36 | public LoadUrlAction(String url, boolean loadRawUrl) { 37 | this(null, url, loadRawUrl); 38 | } 39 | 40 | public LoadUrlAction(String tabId, String url, boolean loadRawUrl) { 41 | super(ACTION_LOAD_URL, tabId); 42 | 43 | mUrl = url; 44 | mLoadRawUrl = loadRawUrl; 45 | } 46 | 47 | public LoadUrlAction(Parcel in) { 48 | super(in, ACTION_LOAD_URL); 49 | 50 | mUrl = in.readString(); 51 | mLoadRawUrl = in.readInt() > 0 ? true : false; 52 | } 53 | 54 | public String getUrl() { 55 | return mUrl; 56 | } 57 | 58 | public boolean getLoadRawUrl() { 59 | return mLoadRawUrl; 60 | } 61 | 62 | @Override 63 | public void writeToParcel(Parcel dest, int flags) { 64 | super.writeToParcel(dest, flags); 65 | 66 | dest.writeString(mUrl); 67 | dest.writeInt(mLoadRawUrl ? 1 : 0); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/OpenTabAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | import android.os.Parcel; 22 | 23 | public class OpenTabAction extends Action { 24 | 25 | private String mUrl; 26 | 27 | public OpenTabAction() { 28 | this((String) null); 29 | } 30 | 31 | public OpenTabAction(String url) { 32 | super(ACTION_OPEN_TAB); 33 | 34 | mUrl = url; 35 | } 36 | 37 | public OpenTabAction(Parcel in) { 38 | super(ACTION_OPEN_TAB); 39 | 40 | mUrl = in.readString(); 41 | } 42 | 43 | public String getUrl() { 44 | return mUrl; 45 | } 46 | 47 | @Override 48 | public void writeToParcel(Parcel dest, int flags) { 49 | super.writeToParcel(dest, flags); 50 | 51 | dest.writeString(mUrl); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/ShowDialogAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | import android.os.Parcel; 22 | 23 | public class ShowDialogAction extends Action { 24 | 25 | private String mTitle; 26 | private String mMessage; 27 | 28 | public ShowDialogAction(String title, String message) { 29 | super(ACTION_SHOW_DIALOG); 30 | 31 | mTitle = title; 32 | mMessage = message; 33 | } 34 | 35 | public ShowDialogAction(Parcel in) { 36 | super(ACTION_SHOW_DIALOG); 37 | 38 | mTitle = in.readString(); 39 | mMessage = in.readString(); 40 | } 41 | 42 | public String getTitle() { 43 | return mTitle; 44 | } 45 | 46 | public String getMessage() { 47 | return mMessage; 48 | } 49 | 50 | @Override 51 | public void writeToParcel(Parcel dest, int flags) { 52 | super.writeToParcel(dest, flags); 53 | 54 | dest.writeString(mTitle); 55 | dest.writeString(mMessage); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/ShowToastAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tint Browser for Android 3 | * 4 | * Copyright (C) 2012 - to infinity and beyond J. Devauchelle and contributors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.tint.addons.framework; 20 | 21 | import android.os.Parcel; 22 | import android.widget.Toast; 23 | 24 | public class ShowToastAction extends Action { 25 | 26 | private String mMessage; 27 | private int mToastLenght; 28 | 29 | public ShowToastAction(String toastMessage) { 30 | this(toastMessage, Toast.LENGTH_SHORT); 31 | } 32 | 33 | public ShowToastAction(String toastMessage, int toastLength) { 34 | super(Action.ACTION_SHOW_TOAST); 35 | 36 | mMessage = toastMessage; 37 | 38 | if ((toastLength == 0) || 39 | (toastLength == 1)) { 40 | mToastLenght = toastLength; 41 | } else { 42 | mToastLenght = Toast.LENGTH_SHORT; 43 | } 44 | } 45 | 46 | public ShowToastAction(Parcel in) { 47 | super(Action.ACTION_SHOW_TOAST); 48 | 49 | mMessage = in.readString(); 50 | mToastLenght = in.readInt(); 51 | 52 | if ((mToastLenght != Toast.LENGTH_SHORT) && 53 | (mToastLenght != Toast.LENGTH_LONG)) { 54 | mToastLenght = Toast.LENGTH_SHORT; 55 | } 56 | } 57 | 58 | public String getMessage() { 59 | return mMessage; 60 | } 61 | 62 | public int getLength() { 63 | return mToastLenght; 64 | } 65 | 66 | @Override 67 | public void writeToParcel(Parcel dest, int flags) { 68 | super.writeToParcel(dest, flags); 69 | dest.writeString(mMessage); 70 | dest.writeInt(mToastLenght); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/org/tint/addons/framework/TabAction.java: -------------------------------------------------------------------------------- 1 | package org.tint.addons.framework; 2 | 3 | import android.os.Parcel; 4 | 5 | public class TabAction extends Action { 6 | 7 | protected String mTabId; 8 | 9 | public TabAction(int action) { 10 | this(action, null); 11 | } 12 | 13 | public TabAction(int action, String tabId) { 14 | super(action); 15 | mTabId = tabId; 16 | } 17 | 18 | public TabAction(Parcel in, int action) { 19 | super(action); 20 | mTabId = in.readString(); 21 | } 22 | 23 | public String getTabId() { 24 | return mTabId; 25 | } 26 | 27 | @Override 28 | public void writeToParcel(Parcel dest, int flags) { 29 | super.writeToParcel(dest, flags); 30 | dest.writeString(mTabId); 31 | } 32 | 33 | public static TabAction createCloseTabAction() { 34 | return new TabAction(ACTION_CLOSE_TAB); 35 | } 36 | 37 | public static TabAction createCloseTabAction(String tabId) { 38 | return new TabAction(ACTION_CLOSE_TAB, tabId); 39 | } 40 | 41 | public static TabAction createBrowseStopAction() { 42 | return new TabAction(ACTION_BROWSE_STOP); 43 | } 44 | 45 | public static TabAction createBrowseStopAction(String tabId) { 46 | return new TabAction(ACTION_BROWSE_STOP, tabId); 47 | } 48 | 49 | public static TabAction createBrowseReloadAction() { 50 | return new TabAction(ACTION_BROWSE_RELOAD); 51 | } 52 | 53 | public static TabAction createBrowseReloadAction(String tabId) { 54 | return new TabAction(ACTION_BROWSE_RELOAD, tabId); 55 | } 56 | 57 | public static TabAction createBrowseForwardAction() { 58 | return new TabAction(ACTION_BROWSE_FORWARD); 59 | } 60 | 61 | public static TabAction createBrowseForwardAction(String tabId) { 62 | return new TabAction(ACTION_BROWSE_FORWARD, tabId); 63 | } 64 | 65 | public static TabAction createBrowseBackAction() { 66 | return new TabAction(ACTION_BROWSE_BACK); 67 | } 68 | 69 | public static TabAction createBrowseBackAction(String tabId) { 70 | return new TabAction(ACTION_BROWSE_BACK, tabId); 71 | } 72 | 73 | } 74 | --------------------------------------------------------------------------------