diff --git a/app/build.gradle b/app/build.gradle
index 5982f77..0b9a340 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -7,7 +7,7 @@ android {
defaultConfig {
applicationId "org.eu.octt.browserocto"
minSdkVersion 1
- targetSdkVersion 30
+ targetSdkVersion 28
versionCode 999
versionName "999.999.999"
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6779beb..df29fbb 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,8 +4,11 @@
package="org.eu.octt.browserocto"
android:versionCode="1"
android:versionName="1.0.1">
-
+
+
+
+
current version date of file
+ // if yes direct to URL / ask to download
+ }
+ });
};
private Intent MakeIntBrowse(String Url, Boolean Cache) {
diff --git a/app/src/main/java/org/eu/octt/browserocto/TriCheckBox.java b/app/src/main/java/org/eu/octt/browserocto/TriCheckBox.java
new file mode 100644
index 0000000..317c0ae
--- /dev/null
+++ b/app/src/main/java/org/eu/octt/browserocto/TriCheckBox.java
@@ -0,0 +1,100 @@
+package org.eu.octt.browserocto;
+import android.widget.*;
+import android.content.*;
+import android.util.*;
+
+//
+public class TriCheckBox extends CheckBox {
+ static private final int UNKNOW = -1;
+ static private final int UNCHECKED = 0;
+ static private final int CHECKED = 1;
+
+ static private final int DrawableUndefined = R.drawable.checkbox_undefined; //R.drawable.ic_checkbox_indeterminate_black;
+ static private final int DrawableUnchecked = R.drawable.checkbox_unchecked; //android.R.drawable.checkbox_off_background;
+ static private final int DrawableChecked = R.drawable.checkbox_checked; //android.R.drawable.checkbox_on_background;
+
+ private int state;
+ private boolean binary = false; // allow emulating a binary checkbox
+
+ public TriCheckBox(Context context) {
+ super(context);
+ init();
+ }
+
+ public TriCheckBox(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public TriCheckBox(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ init();
+ }
+
+ private void init() {
+ state = BinTriDef();
+ updateBtn();
+
+ setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ // checkbox status is changed from uncheck to checked.
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ switch (state) {
+ default:
+ case UNKNOW:
+ state = UNCHECKED;
+ break;
+ case UNCHECKED:
+ state = CHECKED;
+ break;
+ case CHECKED:
+ state = BinTriDef();
+ break;
+ }
+ updateBtn();
+ }
+ });
+ }
+
+ private void updateBtn() {
+ int btnDrawable = DrawableUndefined;
+ switch (state) {
+ default:
+ case UNKNOW:
+ btnDrawable = DrawableUndefined;
+ break;
+ case UNCHECKED:
+ btnDrawable = DrawableUnchecked;
+ break;
+ case CHECKED:
+ btnDrawable = DrawableChecked;
+ break;
+ }
+
+ setButtonDrawable(btnDrawable);
+ }
+
+ private int BinTriDef() {
+ if (binary)
+ return UNCHECKED;
+ else
+ return UNKNOW;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public void setState(int state) {
+ this.state = state;
+ updateBtn();
+ }
+
+ public boolean getBinary() {
+ return binary;
+ }
+
+ public void setBinary(boolean binary) {
+ this.binary = binary;
+ init();
+ }
+}
diff --git a/app/src/main/java/org/eu/octt/browserocto/_Util.java b/app/src/main/java/org/eu/octt/browserocto/_Util.java
index 3c8c03a..1b4a3f2 100644
--- a/app/src/main/java/org/eu/octt/browserocto/_Util.java
+++ b/app/src/main/java/org/eu/octt/browserocto/_Util.java
@@ -7,6 +7,7 @@ import java.io.*;
import android.graphics.drawable.*;
import android.util.*;
import android.view.*;
+import android.content.res.*;
public class _Util extends Activity
{
@@ -60,6 +61,18 @@ public class _Util extends Activity
return "";
};
+ public static String TryStreamToString(InputStream In){
+ try {
+ return StreamToString(In);
+ } catch (IOException Ex) {
+ return null;
+ }
+ }
+
+ public static String OpenRawResourceString(Resources Res, int Id){
+ return TryStreamToString(Res.openRawResource(Id));
+ }
+
// https://stackoverflow.com/a/10857407
public static void WriteStreamToFile(InputStream In, String Path, String Name) throws IOException {
try {
@@ -100,6 +113,15 @@ public class _Util extends Activity
return Btn;
};
+ public static ToggleButton MakeToggleButton(Context c, Boolean Checked, Boolean Enabled){
+ ToggleButton Toggle = new ToggleButton(c);
+ if (Checked != null)
+ Toggle.setChecked(Checked);
+ if (Enabled != null)
+ Toggle.setEnabled(Enabled);
+ return Toggle;
+ };
+
public static RadioButton MakeRadioButton(Context c, Boolean Checked, String Text){
RadioButton Radio = new RadioButton(c);
Radio.setText(Text);
@@ -116,8 +138,27 @@ public class _Util extends Activity
return Check;
};
- public static View AddLayoutChild(View Child, LinearLayout Parent) {
- Parent.addView(Child);
+ public static View AddLayoutChild(View Child, View Parent){
+ if (Parent.getClass() == LinearLayout.class || Parent.getClass() == RadioGroup.class) {
+ LinearLayout _Parent = (LinearLayout)Parent;
+ _Parent.addView(Child);
+ };
+ if (Parent.getClass() == GridLayout.class) {
+ GridLayout _Parent = (GridLayout)Parent;
+ _Parent.addView(Child);
+ };
+ //_Parent.addView(Child);
+ //public static View AddLayoutChild(View Child, LinearLayout Parent){
+ // Parent.addView(Child);
return Child;
- }
+ };
+
+ //
+ public static T Cast(Object o, Class clazz) {
+ try {
+ return clazz.cast(o);
+ } catch(ClassCastException e) {
+ return null;
+ }
+ };
};
diff --git a/app/src/main/res/drawable/checkbox_checked.png b/app/src/main/res/drawable/checkbox_checked.png
new file mode 100644
index 0000000..eebb60e
Binary files /dev/null and b/app/src/main/res/drawable/checkbox_checked.png differ
diff --git a/app/src/main/res/drawable/checkbox_unchecked.png b/app/src/main/res/drawable/checkbox_unchecked.png
new file mode 100644
index 0000000..f1217c5
Binary files /dev/null and b/app/src/main/res/drawable/checkbox_unchecked.png differ
diff --git a/app/src/main/res/drawable/checkbox_undefined.png b/app/src/main/res/drawable/checkbox_undefined.png
new file mode 100644
index 0000000..eb158fa
Binary files /dev/null and b/app/src/main/res/drawable/checkbox_undefined.png differ
diff --git a/app/src/main/res/layout/main.xml b/app/src/main/res/layout/main.xml
index 289f0e6..98b2472 100644
--- a/app/src/main/res/layout/main.xml
+++ b/app/src/main/res/layout/main.xml
@@ -54,5 +54,12 @@
android:padding="10dp"
android:id="@+id/BtnExperimental"/>
+
+
diff --git a/app/src/main/res/layout/webnamespacesettings.xml b/app/src/main/res/layout/webnamespacesettings.xml
new file mode 100644
index 0000000..1c65ae0
--- /dev/null
+++ b/app/src/main/res/layout/webnamespacesettings.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/raw/webinhibitstyles.js b/app/src/main/res/raw/webinhibitstyles.js
new file mode 100644
index 0000000..d44cd79
--- /dev/null
+++ b/app/src/main/res/raw/webinhibitstyles.js
@@ -0,0 +1,54 @@
+//
+function RemoveInlineStyles(El) {
+ El.removeAttribute('style');
+ if (El.childNodes.length > 0) {
+ for (let Child in El.childNodes) {
+ /* filter element nodes only */
+ if (El.childNodes[Child].nodeType == 1)
+ RemoveInlineStyles(El.childNodes[Child]);
+ };
+ };
+};
+
+function RemoveStyleSheets() {
+ for (let El of document.getElementsByTagName('link')) {
+ if (String(El.getAttribute('rel')).toLowerCase() == 'stylesheet' || String(El.getAttribute('type')).toLowerCase() == 'text/css')
+ El.parentNode.removeChild(El);
+ };
+ for (let El of document.getElementsByTagName('style')) {
+ El.parentNode.removeChild(El);
+ };
+};
+
+function InhibitInlineStyles(El) {
+ El.setAttribute('browseroctodisabledstyle', El.getAttribute('style'));
+ El.removeAttribute('style');
+ if (El.childNodes.length > 0) {
+ for (let Child in El.childNodes) {
+ /* filter element nodes only */
+ if (El.childNodes[Child].nodeType == 1)
+ InhibitInlineStyles(El.childNodes[Child]);
+ };
+ };
+};
+
+function InhibitStyleSheets() {
+ for (let El of document.getElementsByTagName('link')) {
+ if (String(El.getAttribute('rel')).toLowerCase() == 'stylesheet' || String(El.getAttribute('type')).toLowerCase() == 'text/css')
+ ChangeElementTag(El);
+ };
+ for (let El of document.getElementsByTagName('style')) {
+ ChangeElementTag(El);
+ };
+};
+
+function ChangeElementTag(El) {
+ let NewTag = `browseroctodisabled${El.tagName}`;
+ El.outerHTML = `<${NewTag}${El.outerHTML.split(El.tagName).slice(1, -1).join(El.tagName)}${NewTag}>`;
+};
+
+//RemoveInlineStyles(document.body);
+//RemoveStyleSheets();
+
+InhibitInlineStyles(document.body);
+InhibitStyleSheets();
\ No newline at end of file
diff --git a/app/src/main/res/raw/webrestorestyles.js b/app/src/main/res/raw/webrestorestyles.js
new file mode 100644
index 0000000..e69de29
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
index 0948fdc..80c8124 100644
--- a/app/src/main/res/values-v21/styles.xml
+++ b/app/src/main/res/values-v21/styles.xml
@@ -2,4 +2,4 @@
-
\ No newline at end of file
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b6f10c6..5a90c17 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,4 +1,21 @@
browserocto
-
\ No newline at end of file
+ Search or enter URL...
+ Block Badware
+ Suppress Cookie Banners
+ Allow JavaScript/WASM
+ Allow Styles
+ Allow Site Storage
+ Fields Autofill
+ Force Offline Caching
+ SiteTweaks
+ Polyfill HTML
+ Polyfill/Downcompile JS
+ Polyfill CSS
+
+ DevTools
+ Custom JS
+ Custom CSS
+ Custom Redirects
+