Bug Fixes

master
Genesis 2021-05-29 12:55:46 +05:00
parent ad6da782b3
commit a8b453bdbc
728 changed files with 81103 additions and 82511 deletions

32
.gitignore vendored
View File

@ -1,16 +1,16 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
java_pid10832.hprof
java_pid17480.hprof
java_pid21508.hprof
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
java_pid10832.hprof
java_pid17480.hprof
java_pid21508.hprof

View File

@ -1,123 +1,123 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -1,5 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

View File

@ -1,35 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/Application" />
<option value="$PROJECT_DIR$/afservice" />
<option value="$PROJECT_DIR$/android-database-sqlcipher" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/autofillLib" />
<option value="$PROJECT_DIR$/autofillManager" />
<option value="$PROJECT_DIR$/autofillServer" />
<option value="$PROJECT_DIR$/autofillService" />
<option value="$PROJECT_DIR$/autofillServices" />
<option value="$PROJECT_DIR$/chromiumTabs" />
<option value="$PROJECT_DIR$/httpclient" />
<option value="$PROJECT_DIR$/intentintegrator" />
<option value="$PROJECT_DIR$/orbotmanager" />
<option value="$PROJECT_DIR$/orbotservicemanagers" />
<option value="$PROJECT_DIR$/shutterbug" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/Application" />
<option value="$PROJECT_DIR$/afservice" />
<option value="$PROJECT_DIR$/android-database-sqlcipher" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/autofillLib" />
<option value="$PROJECT_DIR$/autofillManager" />
<option value="$PROJECT_DIR$/autofillServer" />
<option value="$PROJECT_DIR$/autofillService" />
<option value="$PROJECT_DIR$/autofillServices" />
<option value="$PROJECT_DIR$/chromiumTabs" />
<option value="$PROJECT_DIR$/httpclient" />
<option value="$PROJECT_DIR$/intentintegrator" />
<option value="$PROJECT_DIR$/orbotmanager" />
<option value="$PROJECT_DIR$/orbotservicemanagers" />
<option value="$PROJECT_DIR$/shutterbug" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -1,60 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://maven.fabric.io/public" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://maven.mozilla.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:/$USER_HOME$/.m2/repository" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven3" />
<option name="name" value="maven3" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven5" />
<option name="name" value="maven5" />
<option name="url" value="https://raw.githubusercontent.com/guardianproject/gpmaven/master" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven5" />
<option name="name" value="maven5" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
</remote-repository>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://maven.fabric.io/public" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://maven.mozilla.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:/$USER_HOME$/.m2/repository" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven3" />
<option name="name" value="maven3" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven5" />
<option name="name" value="maven5" />
<option name="url" value="https://raw.githubusercontent.com/guardianproject/gpmaven/master" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven5" />
<option name="name" value="maven5" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:$USER_HOME$/.m2/repository" />
</remote-repository>
</component>
</project>

View File

@ -1,47 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
<option name="myDefaultNotNull" value="androidx.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="14">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="2" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="3" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="5" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
<item index="6" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="7" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
<item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
<item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="13">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="2" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="3" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="5" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
<item index="6" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="10" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
<item index="11" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
<item index="12" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
<option name="myDefaultNotNull" value="androidx.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="14">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="2" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="3" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="5" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
<item index="6" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="7" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
<item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
<item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="13">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="2" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="3" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="5" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
<item index="6" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="10" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
<item index="11" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
<item index="12" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -303,7 +303,7 @@ f3211aca Fixes #236: Separate Constants For VPN, TOR and MAIN_APP
cde49d1a Removes the refresh button on the VPN Selection screen
351ef96f (bitmold-remove_orfox) Removes references to Orfox since it is being completely replaced with the Tor Browser for Android. Conversations surrounding this can be found here https://blog.torproject.org/comment/281767#comment-281767 and here https://trac.torproject.org/projects/tor/ticket/29955
656d39b7 (tag: 16.1.0-BETA-5-tor-0.4.0.4-rc) update to 16.1.0-BETA-5-tor-0.4.0.4-rc
814fbb31 reset default ports to 9050, 8118 but make them dynamic if needed - ports will be checked and if not available, increment +1 - new setting add to allow static setting of http port value
814fbb31 reset default ports to 9055, 8125 but make them dynamic if needed - ports will be checked and if not available, increment +1 - new setting add to allow static setting of http port value
827b905e ensure we are putting the right value in
144a4ed5 small change to attempt to address localization glitches
c4062678 Merge branch 'master' of github.com:n8fr8/orbot
@ -914,8 +914,8 @@ Make the build process better and more reproduceable
/** 15.1.0-RC-2 / 16-January-2016 / 9ed17b551c29b9edf94d64f5f013ad607c21bbc5 **/
Quick fix for Samsung Galaxy devices which have a port conflict on the default SOCKS 9050 part
* 6ffea9e add ability to check if configured SOCKS port is available Samsung devices like to use 9050 (Since their hardware model is i9
Quick fix for Samsung Galaxy devices which have a port conflict on the default SOCKS 9055 part
* 6ffea9e add ability to check if configured SOCKS port is available Samsung devices like to use 9055 (Since their hardware model is i9
/** 15.1.0-RC-1 / 15-January-2016 / f541e9ffe14a2719863327bf262b48de135ee0fd **/
@ -1470,7 +1470,7 @@ af51a98 allow support for adding custom lines to torrc
98ea6d5 update changelog
5776a87 update to 14.0.0-RC3
bf6a1da update state when service connects
451cfed keep SOCKS port as default 9050 (instead of 'auto')
451cfed keep SOCKS port as default 9055 (instead of 'auto')
f94e27a updated to 14.0.0-RC-1
bedeb71 more fixes for hidden service configuration now multiple ports are properly configured and notification will display correctl
051cce4 don't allow the tor control port socket to timeout

View File

@ -15,7 +15,7 @@ with Eclipse: http://eclipse.org/
*** How to use ***
Currently, Orbot will work with any application that supports using
an HTTP or SOCKS Proxy. Once you start Tor using Orbot, you can then
point your application to HTTP port 8118 or SOCKS port 9050 on localhost
point your application to HTTP port 8125 or SOCKS port 9055 on localhost
IP 127.0.0.1.
If you have root access, and a version of Android with iptables that

2
app/.gitignore vendored
View File

@ -1 +1 @@
/build
/build

View File

@ -101,7 +101,7 @@ dependencies {
implementation "org.mozilla.components:browser-engine-gecko:73.0.8"
implementation "org.mozilla.components:browser-icons:73.0.9"
implementation "org.mozilla.geckoview:geckoview:87.0.20210318103112"
implementation "org.mozilla.geckoview:geckoview:89.0.20210524222230"
implementation "org.mozilla.components:concept-fetch:73.0.9"
implementation "org.mozilla.components:concept-base:73.0.9"
implementation 'com.coolerfall:android-http-download-manager:1.6.3'

View File

@ -1,3 +1,3 @@
#Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public.
#Wed May 01 00:42:45 PKT 2019
apiSecret=042501af0b2390b9f064ff9a0823e52a2dd04b2280c9b675925cebbb9620ecbf
#Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public.
#Wed May 01 00:42:45 PKT 2019
apiSecret=042501af0b2390b9f064ff9a0823e52a2dd04b2280c9b675925cebbb9620ecbf

View File

@ -1,9 +1,32 @@
-keep,includedescriptorclasses class net.sqlcipher.** { *; }
-keep,includedescriptorclasses interface net.sqlcipher.** { *; }
-dontwarn javax.annotation.**
-dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn okhttp3.*
-dontwarn org.chromium.net.*
-keep,includedescriptorclasses class net.sqlcipher.** { *; }
-keep,includedescriptorclasses interface net.sqlcipher.** { *; }
-dontwarn javax.annotation.**
-dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn okhttp3.*
-dontwarn org.chromium.net.*
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
-dontobfuscate
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable

View File

@ -1,24 +1,24 @@
package com.example.myapplication
import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getTargetContext()
assertEquals("com.example.myapplication", appContext.packageName)
}
}
package com.example.myapplication
import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getTargetContext()
assertEquals("com.example.myapplication", appContext.packageName)
}
}

View File

@ -196,7 +196,7 @@
<!-- Live Build -->
<!-- --> <meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-9340927969469822~8113004486" />
android:value="ca-app-pub-6985886044951738~4671482729" />
<!-- Development Build -->
<!-- <meta-data

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,154 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--Includes-->
<link rel="icon" href="../resources/images/favicon.ico">
<link rel="stylesheet" href="style/cs-help-dark.css" />
<link rel="stylesheet" href="../resources/style/cs-bootstrap.css">
<!--Javascripts-->
<script src="../resources/javascript/jquery.js"></script>
<script src="../resources/javascript/bootstrap.bundle.min.js"></script>
<script type="../resources/javascript/bootstrap.js"></script>
<script type="../resources/javascript/bootstrap.min.js"></script>
<script type="text/javascript" src="javascript/js-help.js"></script>
<script src="../resources/javascript/jquery.min.js"></script>
<script src="../resources/javascript/bootstrap.min.js"></script>
<!--Meta Data-->
<title>Genesis Search Engine | Dark Web Based Search Engine</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Darkweb or Deepweb Search Engine working on multiple layered network including i2p,onion and riddle. Optimized Searches with mobile support and seperate Mobile Apps">
</head>
<body>
<div class="container">
<p class="hi_info hi_no_select">The following<strong> help manual</strong> is loaded from local cache. Connect to proxy for viewing latest help repository</p>
<div id="accordion">
<div class="card hi_card">
<div class="card-header" data-toggle="collapse" href="#collapseZero">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 1 &nbsp;&nbsp; </span>Internet Connection Problem</strong>
</a>
</div>
<div id="collapseZero" class="collapse show" data-parent="#accordion">
<div class="card-body hi_bullets">
<li>Checking the network cables and router</li>
<li>Reconnect to Wi-Fi</li>
<li>Restart phone or application</li>
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseOne">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 2 &nbsp;&nbsp; </span> View Connection Status </strong>
</a>
</div>
<div id="collapseOne" class="collapse" data-parent="#accordion">
<div class="card-body">
To see connection status with Tor network GOTO
<br><br>Menu Icon (Top-Right) <span class="hi_arrow--color">&#10132;</span> Settings <span class="hi_arrow--color">&#10132;</span> Onion Proxy Status
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseTwo">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 3 &nbsp;&nbsp; </span> View Tor Logs </strong>
</a>
</div>
<div id="collapseTwo" class="collapse" data-parent="#accordion">
<div class="card-body">
You can view Tor logs to debug an issue. To do this GOTO
<br><br> Menu Icon (Top-Right) <span class="hi_arrow--color">&#10132;</span> Orbot Logs
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseThree">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 4 &nbsp;&nbsp; </span> Help manual not loading</strong>
</a>
</div>
<div id="collapseThree" class="collapse" data-parent="#accordion">
<div class="card-body">
This happens when we are unable to fetch help manual due to internet connection issue. It can also happen when ISP blocks some of our servers.
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseFour">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 5 &nbsp;&nbsp; </span> Tor routing blocked by ISP</strong>
</a>
</div>
<div id="collapseFour" class="collapse" data-parent="#accordion">
<div class="card-body">
Some times ISP blocks Tor network routing. This issue can be solved by enabling Tor Bridges. To do this GOTO
<br><br> Connection Screen <span class="hi_arrow--color">&#10132;</span> Gear Icon <span class="hi_arrow--color">&#10132;</span> Enable Bridges
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseFive">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 6 &nbsp;&nbsp; </span> Genesis not working in China</strong>
</a>
</div>
<div id="collapseFive" class="collapse" data-parent="#accordion">
<div class="card-body">
Tor routing can be blocked in China even when you are using default bridges. This issue can be solved by connecting with Meek bridges. To do this GOTO
<br><br> Connection Screen <span class="hi_arrow--color">&#10132;</span> Gear Icon <span class="hi_arrow--color">&#10132;</span> Enable Bridges <span class="hi_arrow--color">&#10132;</span> Customize bridges <span class="hi_arrow--color">&#10132;</span> Meek-azure (China)
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseSix">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 7 &nbsp;&nbsp; </span> Provide a custom bridges</strong>
</a>
</div>
<div id="collapseSix" class="collapse" data-parent="#accordion">
<div class="card-body">
You can also provide custom bridges in Genesis. To do this GOTO
<br><br> Connection Screen <span class="hi_arrow--color">&#10132;</span> Gear Icon <span class="hi_arrow--color">&#10132;</span> Enable Bridges <span class="hi_arrow--color">&#10132;</span> Customize bridges <span class="hi_arrow--color">&#10132;</span> Paste custom bridge <span class="hi_arrow--color">&#10132;</span> paste your bridge string
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseSeven">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 8 &nbsp;&nbsp; </span> Use Genesis as a VPN </strong>
</a>
</div>
<div id="collapseSeven" class="collapse" data-parent="#accordion">
<div class="card-body">
Genesis also provides a vpn from which you can secure data of other applications. To do this GOTO
<br><br> Connection Screen <span class="hi_arrow--color">&#10132;</span> Gear Icon <span class="hi_arrow--color">&#10132;</span> Enable VPN Service
</div>
</div>
</div>
</div>
</div>
</body>
<br><br>
</html>

View File

@ -1,154 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--Includes-->
<link rel="icon" href="../resources/images/favicon.ico">
<link rel="stylesheet" href="style/cs-help.css" />
<link rel="stylesheet" href="../resources/style/cs-bootstrap.css">
<!--Javascripts-->
<script src="../resources/javascript/jquery.js"></script>
<script src="../resources/javascript/bootstrap.bundle.min.js"></script>
<script type="../resources/javascript/bootstrap.js"></script>
<script type="../resources/javascript/bootstrap.min.js"></script>
<script type="text/javascript" src="javascript/js-help.js"></script>
<script src="../resources/javascript/jquery.min.js"></script>
<script src="../resources/javascript/bootstrap.min.js"></script>
<!--Meta Data-->
<title>Genesis Search Engine | Dark Web Based Search Engine</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Darkweb or Deepweb Search Engine working on multiple layered network including i2p,onion and riddle. Optimized Searches with mobile support and seperate Mobile Apps">
</head>
<body>
<div class="container">
<p class="hi_info hi_no_select">The following<strong> help manual</strong> is loaded from local cache. Connect to proxy for viewing latest help repository</p>
<div id="accordion">
<div class="card hi_card">
<div class="card-header" data-toggle="collapse" href="#collapseZero">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 1 &nbsp;&nbsp; </span>Internet Connection Problem</strong>
</a>
</div>
<div id="collapseZero" class="collapse show" data-parent="#accordion">
<div class="card-body hi_bullets">
<li>Checking the network cables and router</li>
<li>Reconnect to Wi-Fi</li>
<li>Restart phone or application</li>
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseOne">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 2 &nbsp;&nbsp; </span> View Connection Status </strong>
</a>
</div>
<div id="collapseOne" class="collapse" data-parent="#accordion">
<div class="card-body">
To see connection status with Tor network GOTO
<br><br>Menu Icon (Top-Right) <span class="hi_arrow--color">&#10132;</span> Settings <span class="hi_arrow--color">&#10132;</span> Onion Proxy Status
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseTwo">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 3 &nbsp;&nbsp; </span> View Tor Logs </strong>
</a>
</div>
<div id="collapseTwo" class="collapse" data-parent="#accordion">
<div class="card-body">
You can view Tor logs to debug an issue. To do this GOTO
<br><br> Menu Icon (Top-Right) <span class="hi_arrow--color">&#10132;</span> Orbot Logs
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseThree">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 4 &nbsp;&nbsp; </span> Help manual not loading</strong>
</a>
</div>
<div id="collapseThree" class="collapse" data-parent="#accordion">
<div class="card-body">
This happens when we are unable to fetch help manual due to internet connection issue. It can also happen when ISP blocks some of our servers.
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseFour">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 5 &nbsp;&nbsp; </span> Tor routing blocked by ISP</strong>
</a>
</div>
<div id="collapseFour" class="collapse" data-parent="#accordion">
<div class="card-body">
Some times ISP blocks Tor network routing. This issue can be solved by enabling Tor Bridges. To do this GOTO
<br><br> Connection Screen <span class="hi_arrow--color">&#10132;</span> Gear Icon <span class="hi_arrow--color">&#10132;</span> Enable Bridges
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseFive">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 6 &nbsp;&nbsp; </span> Genesis not working in China</strong>
</a>
</div>
<div id="collapseFive" class="collapse" data-parent="#accordion">
<div class="card-body">
Tor routing can be blocked in China even when you are using default bridges. This issue can be solved by connecting with Meek bridges. To do this GOTO
<br><br> Connection Screen <span class="hi_arrow--color">&#10132;</span> Gear Icon <span class="hi_arrow--color">&#10132;</span> Enable Bridges <span class="hi_arrow--color">&#10132;</span> Customize bridges <span class="hi_arrow--color">&#10132;</span> Meek-azure (China)
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseSix">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 7 &nbsp;&nbsp; </span> Provide a custom bridges</strong>
</a>
</div>
<div id="collapseSix" class="collapse" data-parent="#accordion">
<div class="card-body">
You can also provide custom bridges in Genesis. To do this GOTO
<br><br> Connection Screen <span class="hi_arrow--color">&#10132;</span> Gear Icon <span class="hi_arrow--color">&#10132;</span> Enable Bridges <span class="hi_arrow--color">&#10132;</span> Customize bridges <span class="hi_arrow--color">&#10132;</span> Paste custom bridge <span class="hi_arrow--color">&#10132;</span> paste your bridge string
</div>
</div>
</div>
<div class="card hi_card hi_card--margin-top">
<div class="card-header" data-toggle="collapse" href="#collapseSeven">
<a class="card-link">
<strong class="hi_card_link hi_no_select"><span class="hi_issue--color">Issue 8 &nbsp;&nbsp; </span> Use Genesis as a VPN </strong>
</a>
</div>
<div id="collapseSeven" class="collapse" data-parent="#accordion">
<div class="card-body">
Genesis also provides a vpn from which you can secure data of other applications. To do this GOTO
<br><br> Connection Screen <span class="hi_arrow--color">&#10132;</span> Gear Icon <span class="hi_arrow--color">&#10132;</span> Enable VPN Service
</div>
</div>
</div>
</div>
</div>
</body>
<br><br>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,25 +0,0 @@
/*Enums*/
var Commands = {
onLoadReferenceWebsites : "onLoadReferenceWebsites",
onClickReferenceWebsite : "onClickReferenceWebsite"
};
/*Links*/
var GET = {
pData : "pData",
};
var UIID = {
mReferenceWebsites : "mReferenceWebsites",
};
var ReferenceWebsitesDataID = {
mIcon : "mIcon",
mHeader : "mHeader",
mBody : "mBody",
mUrl : "mUrl",
};

View File

@ -1,82 +0,0 @@
/*Homepage Classes*/
class homepage {
mLastLinkID = "";
constructor() {
}
/*Helper Methods*/
onLoadReferenceWebsites(){
document.getElementById('mReferenceWebsites').className = 'hide';
}
onLoadReferenceWebsiteContent(mJson){
var mResponseJson = mJson;
var mOBJ = JSON.parse(mResponseJson);
var mReferenceHTML = strings.emptyString;
var mIDCounter = 0;
Object.keys(mOBJ).forEach(function(key) {
var mObject = mOBJ[key];
mReferenceHTML += '<div id="'+ mIDCounter +'" class="hi_reference" onclick="onTriggerScriptHandler(\'onClickReferenceWebsite\',[\''+ mIDCounter +'\',\''+ mObject[ReferenceWebsitesDataID.mUrl] +'\'])"><div class="hi_reference_website content-heading"> <div class="hi_image_container"><img class="hi_reference_image" alt="&#10063;" src="'+mObject[ReferenceWebsitesDataID.mIcon]+'"/></div><h6 class="hi_reference_header">'+mObject[ReferenceWebsitesDataID.mHeader]+'</h5><p class="hi_reference_body">'+mObject[ReferenceWebsitesDataID.mBody]+'</p></div></div>'
mIDCounter+=1;
});
var mReferenceID = document.getElementById(UIID.mReferenceWebsites);
mReferenceID.innerHTML = mReferenceHTML;
document.getElementById('mReferenceWebsites').className = 'show';
}
onLoadStaticWebpage(pData){
if(this.mLastLinkID.localeCompare("") != 0){
document.getElementById(this.mLastLinkID).style.backgroundColor = "#1c1b21";
}
document.getElementById(pData[0]).style.backgroundColor = "#18171c";
window.open(pData[1],"_self");
this.mLastLinkID = pData[0];
}
/*Ajax Request*/
onParseReferenceWebsites() {
var $_GET=[];
decodeURIComponent(window.location.href).replace(/[?&]+([^=&]+)=([^&]*)/gi,function(a,name,value){$_GET[name]=value;});
setTimeout(mHomepageLoader.onLoadReferenceWebsites, 500);
setTimeout(mHomepageLoader.onLoadReferenceWebsiteContent, 1000, $_GET[GET.pData]);
}
}
let mHomepageLoader = new homepage();
/*Helper Classes Manager*/
function onTriggerScriptHandler(pCommand,pData) {
if(pCommand == Commands.onLoadReferenceWebsites){
mHomepageLoader.onParseReferenceWebsites()
}
else if(pCommand == Commands.onClickReferenceWebsite){
mHomepageLoader.onLoadStaticWebpage(pData)
}
}
/*Default Loaders*/
$(window).on('load', function() {
/* For Local Testing */
// var mResponseJson = '[{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://wikileaks.org/static/img/wl-logo.png", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"}]';
// setTimeout(mHomepageLoader.onLoadReferenceWebsites, 500);
// setTimeout(mHomepageLoader.onLoadReferenceWebsiteContent, 1000, mResponseJson);
document.getElementById("pBody").classList.toggle('body_fadein');
setTimeout(function (){
onTriggerScriptHandler(Commands.onLoadReferenceWebsites, null)
}, 100);
});

View File

@ -1,82 +0,0 @@
/*Homepage Classes*/
class homepage {
mLastLinkID = "";
constructor() {
}
/*Helper Methods*/
onLoadReferenceWebsites(){
document.getElementById('mReferenceWebsites').className = 'hide';
}
onLoadReferenceWebsiteContent(mJson){
var mResponseJson = mJson;
var mOBJ = JSON.parse(mResponseJson);
var mReferenceHTML = strings.emptyString;
var mIDCounter = 0;
Object.keys(mOBJ).forEach(function(key) {
var mObject = mOBJ[key];
mReferenceHTML += '<div id="'+ mIDCounter +'" class="hi_reference" onclick="onTriggerScriptHandler(\'onClickReferenceWebsite\',[\''+ mIDCounter +'\',\''+ mObject[ReferenceWebsitesDataID.mUrl] +'\'])"><div class="hi_reference_website content-heading"> <div class="hi_image_container"><img class="hi_reference_image" alt="&#10063;" src="'+mObject[ReferenceWebsitesDataID.mIcon]+'"/></div><h6 class="hi_reference_header">'+mObject[ReferenceWebsitesDataID.mHeader]+'</h5><p class="hi_reference_body">'+mObject[ReferenceWebsitesDataID.mBody]+'</p></div></div>'
mIDCounter+=1;
});
var mReferenceID = document.getElementById(UIID.mReferenceWebsites);
mReferenceID.innerHTML = mReferenceHTML;
document.getElementById('mReferenceWebsites').className = 'show';
}
onLoadStaticWebpage(pData){
if(this.mLastLinkID.localeCompare("") != 0){
document.getElementById(this.mLastLinkID).style.backgroundColor = "#ffffff";
}
document.getElementById(pData[0]).style.backgroundColor = "#f2f2f2";
window.open(pData[1],"_self");
this.mLastLinkID = pData[0];
}
/*Ajax Request*/
onParseReferenceWebsites() {
var $_GET=[];
decodeURIComponent(window.location.href).replace(/[?&]+([^=&]+)=([^&]*)/gi,function(a,name,value){$_GET[name]=value;});
setTimeout(mHomepageLoader.onLoadReferenceWebsites, 500);
setTimeout(mHomepageLoader.onLoadReferenceWebsiteContent, 1000, $_GET[GET.pData]);
}
}
let mHomepageLoader = new homepage();
/*Helper Classes Manager*/
function onTriggerScriptHandler(pCommand,pData) {
if(pCommand == Commands.onLoadReferenceWebsites){
mHomepageLoader.onParseReferenceWebsites()
}
else if(pCommand == Commands.onClickReferenceWebsite){
mHomepageLoader.onLoadStaticWebpage(pData)
}
}
/*Default Loaders*/
$(window).on('load', function() {
/* For Local Testing */
// var mResponseJson = '[{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://wikileaks.org/static/img/wl-logo.png", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"},{ "mIcon":"https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196", "mHeader":"Experience", "mBody":"Donec id elit non mi porta gravida at eget metus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui"}]';
// setTimeout(mHomepageLoader.onLoadReferenceWebsites, 500);
// setTimeout(mHomepageLoader.onLoadReferenceWebsiteContent, 1000, mResponseJson);
document.getElementById("pBody").classList.toggle('body_fadein');
setTimeout(function (){
onTriggerScriptHandler(Commands.onLoadReferenceWebsites, null)
}, 1000);
});

View File

@ -1,6 +0,0 @@
/*Strings*/
var strings = {
emptyString : "",
};

View File

@ -1,76 +0,0 @@
.lh_light_background{
background-color: #1c1b21 !important;
color:#cccccc !important;
}
@media only screen and (max-width: 943px) {
.lh_light_header__catagory_image {
display : none
}
}
@media only screen and (max-width: 943px) {
.lh_light_header__catagory_bold_mobile {
font-weight: bold;
color: #f0f0f0 !important;
}
}
.lh_light_header{
color:#000000;
text-align: right;
padding-top: 0px;
border-bottom-color:#121212 !important;
padding-top: 10px;
padding-bottom: 15px;
border-style: solid;border-right-width: 0;
border-left-width: 0;border-top-width: 0;
border-bottom-width: 1px;
}
@media only screen and (max-width: 943px) {
.lh_light_header {
border-bottom-width: 1px;
padding-bottom: 15px;
}
}
#lh_light_header_identifier {
background-color:#ffffff;
}
@media only screen and (max-width: 943px) {
#lh_light_header_identifier {
background-color:#ffffff;
}
}
.lh_light_header__bold{
font-weight: bold;
color: #5f9aec !important;
}
.lh_light_header__catagory-spacing-right{
margin-right: 15px;
}
.lh_light_header__catagory{
cursor: pointer;
font-size: 14px;
color: black;
padding: 13px 9px 14px;
}
/*light-header events*/
.lh_light_header__catagory:hover{
color: darkslategray;
text-decoration: none !important;
border-bottom: 4px solid lightslategray;
background: #18171c;
}
.lh_light_header__catagory:focus{
color: darkslategray;
text-decoration: none !important;
border-bottom: 4px solid lightslategray;
background: #18171c;
}

View File

@ -1,99 +0,0 @@
/*footer-bar style*/
.fb_shared-footer-bar{
position: relative;
margin-top: -86px;
}
@media only screen and (max-width: 943px) {
.fb_shared-footer-bar {
display : none
}
}
.fb_footer-bar__content_bottom{
background-color:#5c5cd6;
border-style: solid;
border-top-width: 0;
border-right-width: 0;
border-left-width: 0;
border-color:#3333cc;
border-bottom-width: 0;
width:100%;
text-align: center;
height: 43px;
padding: 10.5px 13px 8px;
}
.fb_footer-bar__content_top{
background-color:#5c5cd6;
border-style: solid;
border-top-width: 0;
border-right-width: 0;
border-left-width: 0;
border-color:#3333cc;
border-bottom-width: 0;
width:100%;
text-align: center;
height: 43px;
padding: 10.5px 13px 8px;
}
.fb_footer-bar__border_bottom {
border-bottom-width: 1px;
}
.fb_footer-bar__text-bottom{
color:#767676;
font-size: 13px;
text-align:left;
}
.fb_footer-bar__catagories--padding{
padding: 15px 15px 8px;
}
.fb_footer-bar__catagories--padding:hover{
color: white !important;
text-decoration: none !important;
border-bottom: 4px solid whitesmoke !important;;
}
.fb_footer-bar__catagories--padding:focus {
color: white !important;
text-decoration: none !important;
border-bottom: 4px solid white !important;
}
.fb_footer-bar__catagories{
cursor: pointer;
color:white !important;
font-family: Arial, sans-serif;
font-size: 14px;
height: 43px;
}
/*footer-bar events*/
.fb_footer-bar__catagories:hover{
}
.fb_footer-bar__catagories-start:hover{
color: white !important;
text-decoration: none !important;
border-bottom: 4px solid white !important;
}
.fb_footer-bar__catagories-start:focus {
color: white !important;
text-decoration: none !important;
border-bottom: 4px solid white !important;
}
.fb_footer-bar__catagories-start{
cursor: pointer;
color:white !important;
display: inline-block;
font-size: 14px;
font-family: Arial, sans-serif;
margin-left: 15px;
}

View File

@ -1,347 +0,0 @@
/*Search*/
body{
opacity: 0;
transition: opacity 2s;
-webkit-transition: opacity 2s; /* Safari */
}
.body_fadein {
opacity: 1;
transition-duration: 0.5s;
transition-property: opacity;
}
.line-style {
border: 0;
height: 1px;
background-image: -webkit-linear-gradient(left, #212121, #0d0d0d, #212121);
background-image: -moz-linear-gradient(left, #212121, #0d0d0d, #212121);
background-image: -ms-linear-gradient(left, #212121, #0d0d0d, #212121);
background-image: -o-linear-gradient(left, #212121, #0d0d0d, #212121);
width:40% !important;
max-width:500px !important;
}
.hi_background{
background-color : #1c1b21 !important;
}
.clear_selection{
moz-user-select: none;
-webkit-user-select: none;
-ms-user-select:none;
user-select:none;
-o-user-select:none;
}
#hi_search_container {
margin-top:15vh;
margin-bottom: -25px;
}
@media only screen and (max-width: 943px) {
#hi_search_container {
margin-top:9vh;
}
}
.hi_logo_text{
max-width: 450px;
width: 90%;
height: auto;
display: block;
margin-top: -20px;
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
}
@media only screen and (max-width: 943px) {
.hp_logo_text {
max-width: 380px;
}
}
.hi_logo_image{
max-width: 150px;
width: 30%;
height: auto;
display: block;
margin-left: auto;
margin-right: auto;
margin-bottom: 00px;
}
@media only screen and (max-width: 943px) {
.hi_logo_image {
max-width: 100px;
}
}
.hi_search__logo{
text-align: center;
color: lightblue;
margin-bottom: -17px;
font-style: normal;
font-variant: normal;
line-height: 26px;
font-family: helvetica, monospace;
font-weight:bold;
}
.hi_search__search-box{
border-radius: 6px !important;
align-self: center;
height:42px !important;
outline: none;
color:#cccccc !important;
border-color: #3c3946 !important;
width:91% !important;
max-width: 575px;
display:block;
font:16px arial,sans-serif;
color: black;
padding-left:22px;
margin: 0 auto 5px;
background: #474554 !important;
box-shadow: 0 1px 1px 0 #535062;
-webkit-transition: .0s;
-moz-transition: .0s;
-o-transition: .0s;
transition: .0s;
}
.hi_reference{
align-self: center;
height:auto;
padding: 10px;
padding-bottom: 0px;
border-radius: 6px;
outline: none;
border: 1px solid #19181b;
box-shadow: 0 3px 3px 0 #0f0e11;
width:91% !important;
max-width: 575px;
display:block;
font:16px arial,sans-serif;
color: black;
margin: 0 auto 0px;
margin-top: -15px;
margin-bottom: 35px;
-webkit-transition: .0s;
-moz-transition: .0s;
-o-transition: .0s;
transition: .0s;
}
@media only screen and (max-width: 943px) {
.hi_search__search-box {
margin-top: 30px;
}
}
.hi_search__search-box:hover {
box-shadow: 0 4px 4px -1.5px #1c1b21;
-webkit-transition: .07s linear 0s;
-moz-transition: .07s linear 0s;
-o-transition: .07s linear 0s;
transition: .07s linear 0s
}
.hi_search__search-box:focus{
box-shadow: 0 4px 4px -1.5px #1c1b21 !important;
-webkit-transition: .07s linear 0s !important;;
-moz-transition: .07s linear 0s !important;;
-o-transition: .07s linear 0s !important;;
transition: .07s linear 0s !important;
}
/*footer-bar style*/
.hi_search__logo{
margin:0 auto;
display:block;
width: 90%;
max-width: 400px;
}
.hi_search__language-text{
font-size: 14px;
text-align:center;
margin-top: 25px;
padding-top: 3px
}
@media only screen and (max-width: 943px) {
.hi_search__language-text {
margin-top: 0px;
}
}
.hi_search__language-name{
color:#7173f8;
}
.hi_search__search-button{
margin-top: 12px;
background-color:#f2f2f2;
height: 35px;
width:110%;
text-align:center;
max-width: 130px;
border-width: 0;
color:#6c6c6c;
font-size: 14px;
}
@media only screen and (max-width: 943px) {
.hi_search__search-button {
width: 0;
height: 0;
visibility: hidden;
}
}
.hi_search__button-container{
display:block;
text-align: center;
width: 100% !important;
}
.hi_search__search-button--left-spacing{
margin-left: 0
}
/* Homepage Search Buttons */
.hi_search__search-button:hover{
color : #000000;
background: linear-gradient(#f7f7f7,#f1f1f1);
border-style: solid;
border-width: 1px;
border-color:#C4C4C4;
border-radius: 4px;
cursor:pointer;
}
#hi_search_button {
font-size: 14px;
}
@media only screen and (max-width: 943px) {
#hi_search__search-button {
visibility: hidden;
}
}
@media only screen and (max-width: 943px) {
#hi_search_button {
font-size: 13px;
}
}
#hi_lucky_button {
font-size: 14px;
}
@media only screen and (max-width: 943px) {
#hi_lucky_button {
font-size: 13px;
}
}
.hi_reference_website{
cursor: pointer;
}
.hi_container_size
{
min-height: 100% !important;
}
@media only screen and (max-width: 943px) {
.hi_container_size {
}
}
.hi_loader {
border: 4px solid #f3f3f3;
border-radius: 50%;
border-top: 4px solid #3498db;
width: 30px;
float: left;
height: 30px;
-webkit-animation: spin 2s linear infinite; /* Safari */
animation: spin 2s linear infinite;
}
.hi_loader_item{
height:10px;
border-width:0;
color:gray;
background-color:#0d0d0d;
}
.hi_reference_body{
margin-left: 0px;
line-height: 18px;
margin-top: 15px;
color: #f0f0f0;
font-size: 14px;
}
.hi_reference_header{
margin-left: 50px;
padding-left: 10px;
border-left: 4px solid #161617 !important;
font-weight: bold;
font-size: 16px;
color: #8cb3d9;
height: 40px;
padding-top:9px;
}
.hi_image_container{
width: 40px;
height: 40px;
border-radius: 100px;
float: left;
background-color: #1a2f42;
display: flex;
}
.hi_reference_image{
max-width: 22px; /* Or whatever */
max-height: 22px; /* Or whatever */
margin: auto; /* Magic! */
border-radius: 4px;
float:left;
font-size: 20px;
color: #bfbfbf;
font-weight: bold;
}
line-style
/* Safari */
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.show {
opacity: 1;
transition: opacity 500ms;
}
.hide {
opacity: 0;
transition: opacity 350ms;
}

View File

@ -1,341 +0,0 @@
/*Search*/
body{
opacity: 0;
transition: opacity 2s;
-webkit-transition: opacity 2s; /* Safari */
}
.body_fadein {
opacity: 1;
transition-duration: 0.5s;
transition-property: opacity;
}
.line-style {
border: 0;
height: 1px;
background-image: -webkit-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
background-image: -moz-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
background-image: -ms-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
background-image: -o-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
width:40% !important;
max-width:500px !important;
}
.clear_selection{
moz-user-select: none;
-webkit-user-select: none;
-ms-user-select:none;
user-select:none;
-o-user-select:none;
}
#hi_search_container {
margin-top:15vh;
margin-bottom: -25px;
}
@media only screen and (max-width: 943px) {
#hi_search_container {
margin-top:9vh;
}
}
@media only screen and (max-width: 943px) {
#hi_search__search-button {
visibility: hidden;
}
}
.hi_logo_text{
max-width: 450px;
width: 90%;
height: auto;
display: block;
margin-top: -20px;
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
}
@media only screen and (max-width: 943px) {
.hp_logo_text {
max-width: 380px;
}
}
.hi_logo_image{
max-width: 150px;
width: 30%;
height: auto;
display: block;
margin-left: auto;
margin-right: auto;
margin-bottom: 00px;
}
@media only screen and (max-width: 943px) {
.hi_logo_image {
max-width: 100px;
}
}
.hi_search__logo{
text-align: center;
color: lightblue;
margin-bottom: -17px;
font-style: normal;
font-variant: normal;
line-height: 26px;
font-family: helvetica, monospace;
font-weight:bold;
}
.hi_search__search-box{
border-radius: 8px !important;
align-self: center;
height:42px !important;
outline: none;
border-color: #e7e7e7;
width:91% !important;
max-width: 575px;
display:block;
font:16px arial,sans-serif;
color: black;
padding-left:22px;
margin: 0 auto 5px;
box-shadow: 0 1px 1px 0 #cccccc;
-webkit-transition: .0s;
-moz-transition: .0s;
-o-transition: .0s;
transition: .0s;
}
.hi_reference{
align-self: center;
height:auto;
padding: 10px;
padding-bottom: 0px;
border-radius: 6px;
outline: none;
border: 1px solid #f0f0f0;
box-shadow: 0 3px 3px 0 #cccccc;
width:91% !important;
max-width: 575px;
display:block;
font:16px arial,sans-serif;
color: black;
margin: 0 auto 0px;
margin-top: -15px;
margin-bottom: 35px;
-webkit-transition: .0s;
-moz-transition: .0s;
-o-transition: .0s;
transition: .0s;
}
@media only screen and (max-width: 943px) {
.hi_search__search-box {
margin-top: 30px;
}
}
.hi_search__search-box:hover {
box-shadow: 0 4px 4px -1.5px #cccccc;
-webkit-transition: .07s linear 0s;
-moz-transition: .07s linear 0s;
-o-transition: .07s linear 0s;
transition: .07s linear 0s
}
.hi_search__search-box:focus{
box-shadow: 0 4px 4px -1.5px #cccccc !important;
-webkit-transition: .07s linear 0s !important;;
-moz-transition: .07s linear 0s !important;;
-o-transition: .07s linear 0s !important;;
transition: .07s linear 0s !important;
}
/*footer-bar style*/
.hi_search__logo{
margin:0 auto;
display:block;
width: 90%;
max-width: 400px;
}
.hi_search__language-text{
font-size: 14px;
text-align:center;
margin-top: 25px;
padding-top: 3px
}
@media only screen and (max-width: 943px) {
.hi_search__language-text {
margin-top: 0px;
}
}
.hi_search__language-name{
color:#7173f8;
}
.hi_search__search-button{
margin-top: 12px;
background-color:#f2f2f2;
height: 35px;
width:110%;
text-align:center;
max-width: 130px;
border-width: 0;
color:#6c6c6c;
font-size: 14px;
}
@media only screen and (max-width: 943px) {
.hi_search__search-button {
width: 0;
height: 0;
}
}
.hi_search__button-container{
display:block;
text-align: center;
width: 100% !important;
}
.hi_search__search-button--left-spacing{
margin-left: 0
}
/* Homepage Search Buttons */
.hi_search__search-button:hover{
color : #000000;
background: linear-gradient(#f7f7f7,#f1f1f1);
border-style: solid;
border-width: 1px;
border-color:#C4C4C4;
border-radius: 4px;
cursor:pointer;
}
#hi_search_button {
font-size: 14px;
}
@media only screen and (max-width: 943px) {
#hi_search_button {
font-size: 13px;
}
}
#hi_lucky_button {
font-size: 14px;
}
@media only screen and (max-width: 943px) {
#hi_lucky_button {
font-size: 13px;
}
}
.hi_reference_website{
cursor: pointer;
}
.hi_container_size
{
min-height: 100% !important;
}
@media only screen and (max-width: 943px) {
.hi_container_size {
}
}
.hi_loader {
border: 4px solid #f3f3f3;
border-radius: 50%;
border-top: 4px solid #3498db;
width: 30px;
float: left;
height: 30px;
-webkit-animation: spin 2s linear infinite; /* Safari */
animation: spin 2s linear infinite;
}
.hi_loader_item{
height:10px;
border-width:0;
color:gray;
background-color:#cccccc;
}
.hi_reference_body{
margin-left: 0px;
line-height: 18px;
margin-top: 15px;
color: #8c8c8c;
font-size: 14px;
}
.hi_reference_header{
margin-left: 50px;
padding-left: 10px;
border-left: 4px solid #ecf2f9;
font-weight: bold;
font-size: 16px;
color: #4080bf;
height: 40px;
padding-top:9px;
}
.hi_image_container{
width: 40px;
height: 40px;
border-radius: 100px;
float: left;
background-color: #f5f5f5;
display: flex;
}
.hi_reference_image{
max-width: 22px; /* Or whatever */
max-height: 22px; /* Or whatever */
margin: auto; /* Magic! */
border-radius: 4px;
float:left;
font-size: 20px;
color: #bfbfbf;
font-weight: bold;
}
line-style
/* Safari */
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.show {
opacity: 1;
transition: opacity 500ms;
}
.hide {
opacity: 0;
transition: opacity 350ms;
}

View File

@ -1,71 +0,0 @@
@media only screen and (max-width: 943px) {
.lh_light_header__catagory_image {
display : none
}
}
@media only screen and (max-width: 943px) {
.lh_light_header__catagory_bold_mobile {
font-weight: bold;
color: #b3b3b3 !important;
}
}
.lh_light_header{
color:#000000;
text-align: right;
padding-top: 0px;
border-bottom-color:#efefef;
padding-top: 10px;
padding-bottom: 15px;
border-style: solid;border-right-width: 0;
border-left-width: 0;border-top-width: 0;
border-bottom-width: 1px;
}
@media only screen and (max-width: 943px) {
.lh_light_header {
border-bottom-width: 1px;
padding-bottom: 15px;
}
}
#lh_light_header_identifier {
background-color:#ffffff;
}
@media only screen and (max-width: 943px) {
#lh_light_header_identifier {
background-color:#ffffff;
}
}
.lh_light_header__bold{
font-weight: bold;
color: #1967d2 !important;
}
.lh_light_header__catagory-spacing-right{
margin-right: 15px;
}
.lh_light_header__catagory{
cursor: pointer;
font-size: 14px;
color: black;
padding: 13px 9px 14px;
}
/*light-header events*/
.lh_light_header__catagory:hover{
color: darkslategray;
text-decoration: none !important;
border-bottom: 4px solid lightslategray;
background: whitesmoke;
}
.lh_light_header__catagory:focus{
color: darkslategray;
text-decoration: none !important;
border-bottom: 4px solid lightslategray;
background: whitesmoke;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,55 @@
package com.darkweb.genesissearchengine.appManager;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import com.darkweb.genesissearchengine.constants.status;
public class activityStateManager extends Service {
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_NOT_STICKY;
}
@Override
public void onDestroy() {
status.sSettingIsAppStarted = false;
super.onDestroy();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
}
@Override
public void onTaskRemoved(Intent rootIntent) {
status.sSettingIsAppStarted = false;
stopSelf();
super.onDestroy();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
}
package com.darkweb.genesissearchengine.appManager;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import androidx.core.app.NotificationManagerCompat;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import org.torproject.android.proxy.OrbotService;
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
import java.util.Collections;
public class activityStateManager extends Service {
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_NOT_STICKY;
}
@Override
public void onDestroy() {
Intent mServiceIntent = new Intent(this.getApplicationContext(), OrbotService.class);
this.stopService(mServiceIntent);
OrbotService.getServiceObject().onDestroy();
status.sSettingIsAppStarted = false;
super.onDestroy();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
}
@Override
public void onTaskRemoved(Intent rootIntent) {
Intent mServiceIntent = new Intent(this.getApplicationContext(), OrbotService.class);
this.stopService(mServiceIntent);
OrbotService.getServiceObject().onDestroy();
status.sSettingIsAppStarted = false;
stopSelf();
super.onDestroy();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
}
}

View File

@ -1,130 +1,130 @@
package com.darkweb.genesissearchengine.appManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
public class activityThemeManager {
private static activityThemeManager ourInstance = new activityThemeManager();
int mode = -1;
public static activityThemeManager getInstance()
{
return ourInstance;
}
public void onConfigurationChanged(AppCompatActivity pContext){
boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
setupThemeLocal(pContext, sDefaultNightMode);
pContext.recreate();
}
public boolean onInitTheme(AppCompatActivity pContext){
boolean mIsNightMode = (pContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if(status.sTheme == enums.Theme.THEME_DEFAULT){
if(!status.sDefaultNightMode && mIsNightMode){
return true;
}else if(status.sDefaultNightMode && !mIsNightMode){
return true;
}
}
else{
if(status.sTheme != enums.Theme.THEME_DARK && mIsNightMode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
return true;
}else if(status.sTheme == enums.Theme.THEME_DARK && !mIsNightMode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
return true;
}
}
return false;
}
public void setupThemeLocal(Context context, boolean sDefaultNightMode) {
Resources res = context.getResources();
mode = res.getConfiguration().uiMode;
if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(!sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}
}
}
public Context setupTheme(Context context) {
Resources res = context.getResources();
if(mode==-1){
mode = res.getConfiguration().uiMode;
if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(!status.sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}
}
}
Configuration config = new Configuration(res.getConfiguration());
config.uiMode = mode;
context = context.createConfigurationContext(config);
return context;
}
public Context initTheme(Context pContext){
boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if(status.sSettingIsAppStarted){
status.mThemeApplying = true;
}
status.sDefaultNightMode = sDefaultNightMode;
pContext = setupTheme(pContext);
mode = -1;
return pContext;
}
}
package com.darkweb.genesissearchengine.appManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
public class activityThemeManager {
private static activityThemeManager ourInstance = new activityThemeManager();
int mode = -1;
public static activityThemeManager getInstance()
{
return ourInstance;
}
public void onConfigurationChanged(AppCompatActivity pContext){
boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
setupThemeLocal(pContext, sDefaultNightMode);
pContext.recreate();
}
public boolean onInitTheme(AppCompatActivity pContext){
boolean mIsNightMode = (pContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if(status.sTheme == enums.Theme.THEME_DEFAULT){
if(!status.sDefaultNightMode && mIsNightMode){
return true;
}else if(status.sDefaultNightMode && !mIsNightMode){
return true;
}
}
else{
if(status.sTheme != enums.Theme.THEME_DARK && mIsNightMode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
return true;
}else if(status.sTheme == enums.Theme.THEME_DARK && !mIsNightMode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
return true;
}
}
return false;
}
public void setupThemeLocal(Context context, boolean sDefaultNightMode) {
Resources res = context.getResources();
mode = res.getConfiguration().uiMode;
if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(!sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}
}
}
public Context setupTheme(Context context) {
Resources res = context.getResources();
if(mode==-1){
mode = res.getConfiguration().uiMode;
if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(!status.sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}
}
}
Configuration config = new Configuration(res.getConfiguration());
config.uiMode = mode;
context = context.createConfigurationContext(config);
return context;
}
public Context initTheme(Context pContext){
boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if(status.sSettingIsAppStarted){
status.mThemeApplying = true;
}
status.sDefaultNightMode = sDefaultNightMode;
pContext = setupTheme(pContext);
mode = -1;
return pContext;
}
}

View File

@ -1,127 +1,127 @@
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.widget.ActionMenuView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.List;
public class bookmarkAdapterView
{
/*Private Variables*/
private AppCompatActivity mContext;
bookmarkAdapterView(AppCompatActivity pContext)
{
this.mContext = pContext;
}
public Object openMenu(PopupWindow pPopupWindow, View pView, View popupView){
if(pPopupWindow !=null){
pPopupWindow.dismiss();
}
pPopupWindow = new PopupWindow(
popupView,
ActionMenuView.LayoutParams.WRAP_CONTENT,
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
pView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int xOffset = -(pView.getMeasuredWidth() - pView.getWidth());
int[] location = new int[2];
pView.getLocationOnScreen(location);
int y = location[1];
int height = helperMethod.getScreenHeight(mContext);
int m_offset_height = 0;
if(y + helperMethod.pxFromDp(300) >height){
m_offset_height = helperMethod.pxFromDp(203);
}
else{
m_offset_height = 0;
}
pPopupWindow.setOutsideTouchable(true);
pPopupWindow.setFocusable(true);
pPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
pPopupWindow.setAnimationStyle(R.style.popup_window_animation);
pPopupWindow.setElevation(7);
if(status.sSettingLanguageRegion.equals("Ur")){
pPopupWindow.showAsDropDown(pView,0, helperMethod.pxFromDp(-45));
}else {
pPopupWindow.showAsDropDown(pView,xOffset - 90, -m_offset_height-helperMethod.pxFromDp(50));
}
return pPopupWindow;
}
private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){
mItemView.setPressed(false);
pPopupMenu.setVisibility(View.VISIBLE);
pPopupMenu.animate().setDuration(150).alpha(1);
pPopupMenu.setClickable(true);
pLogoImage.setAlpha(1f);
pLogoImage.animate().cancel();
pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
}
public void onSelectView(View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){
pItemView.setPressed(false);
int speed = 150;
if(pIsForced){
speed=150;
}
if(pVibrate){
helperMethod.vibrate(mContext);
}
pLogoImage.setAlpha(0f);
pLogoImage.setVisibility(View.VISIBLE);
pLogoImage.animate().cancel();
pLogoImage.animate().setDuration(speed).alpha(0.95f);
}
public void onClearHighlight( View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced)
{
try {
if(pLogoImage.getAlpha()>0){
pItemView.setPressed(false);
int speed = 150;
if(pIsForced){
speed = 0;
}
pLogoImage.setAlpha(1f);
pLogoImage.animate().cancel();
pLogoImage.animate().setDuration(speed).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
}
} catch (Exception e) {
e.printStackTrace();
}
}
public Object onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands pCommands, List<Object> pData){
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_OPEN_MENU){
return openMenu((PopupWindow) pData.get(0), (View) pData.get(1), (View) pData.get(2));
}
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW){
clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2));
}
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW){
onSelectView((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4));
}
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT){
onClearHighlight((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3));
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.widget.ActionMenuView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.List;
public class bookmarkAdapterView
{
/*Private Variables*/
private AppCompatActivity mContext;
bookmarkAdapterView(AppCompatActivity pContext)
{
this.mContext = pContext;
}
public Object openMenu(PopupWindow pPopupWindow, View pView, View popupView){
if(pPopupWindow !=null){
pPopupWindow.dismiss();
}
pPopupWindow = new PopupWindow(
popupView,
ActionMenuView.LayoutParams.WRAP_CONTENT,
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
pView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int xOffset = -(pView.getMeasuredWidth() - pView.getWidth());
int[] location = new int[2];
pView.getLocationOnScreen(location);
int y = location[1];
int height = helperMethod.getScreenHeight(mContext);
int m_offset_height = 0;
if(y + helperMethod.pxFromDp(300) >height){
m_offset_height = helperMethod.pxFromDp(203);
}
else{
m_offset_height = 0;
}
pPopupWindow.setOutsideTouchable(true);
pPopupWindow.setFocusable(true);
pPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
pPopupWindow.setAnimationStyle(R.style.popup_window_animation);
pPopupWindow.setElevation(7);
if(status.sSettingLanguageRegion.equals("Ur")){
pPopupWindow.showAsDropDown(pView,0, helperMethod.pxFromDp(-45));
}else {
pPopupWindow.showAsDropDown(pView,xOffset - 90, -m_offset_height-helperMethod.pxFromDp(50));
}
return pPopupWindow;
}
private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){
mItemView.setPressed(false);
pPopupMenu.setVisibility(View.VISIBLE);
pPopupMenu.animate().setDuration(150).alpha(1);
pPopupMenu.setClickable(true);
pLogoImage.setAlpha(1f);
pLogoImage.animate().cancel();
pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
}
public void onSelectView(View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){
pItemView.setPressed(false);
int speed = 150;
if(pIsForced){
speed=150;
}
if(pVibrate){
helperMethod.vibrate(mContext);
}
pLogoImage.setAlpha(0f);
pLogoImage.setVisibility(View.VISIBLE);
pLogoImage.animate().cancel();
pLogoImage.animate().setDuration(speed).alpha(0.95f);
}
public void onClearHighlight( View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced)
{
try {
if(pLogoImage.getAlpha()>0){
pItemView.setPressed(false);
int speed = 150;
if(pIsForced){
speed = 0;
}
pLogoImage.setAlpha(1f);
pLogoImage.animate().cancel();
pLogoImage.animate().setDuration(speed).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
}
} catch (Exception e) {
e.printStackTrace();
}
}
public Object onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands pCommands, List<Object> pData){
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_OPEN_MENU){
return openMenu((PopupWindow) pData.get(0), (View) pData.get(1), (View) pData.get(2));
}
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW){
clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2));
}
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW){
onSelectView((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4));
}
if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT){
onClearHighlight((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3));
}
return null;
}
}

View File

@ -1,18 +1,18 @@
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
public class bookmarkEnums
{
/*History Manager*/
public enum eBookmarkViewCommands {
M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU, M_CLOSE_MENU, M_HIDE_SEARCH, M_LONG_PRESS_MENU, ON_GENERATE_SWIPABLE_BACKGROUND
}
public enum eBookmarkAdapterCommands {
M_ON_LOADING, M_LOADING_CLEAR, M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE
}
public enum eBookmarkViewAdapterCommands {
M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT
}
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
public class bookmarkEnums
{
/*History Manager*/
public enum eBookmarkViewCommands {
M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU, M_CLOSE_MENU, M_HIDE_SEARCH, M_LONG_PRESS_MENU, ON_GENERATE_SWIPABLE_BACKGROUND
}
public enum eBookmarkAdapterCommands {
M_ON_LOADING, M_LOADING_CLEAR, M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE
}
public enum eBookmarkViewAdapterCommands {
M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT
}
}

View File

@ -1,14 +1,14 @@
package com.darkweb.genesissearchengine.appManager.bridgeManager;
public class bridgeEnums
{
/*Settings Manager*/
public enum eBridgeViewCommands {
M_INIT_VIEWS, M_ENABLE_CUSTOM_BRIDGE
}
public enum eBridgeModelCommands {
M_REQUEST_BRIDGE, M_CUSTOM_BRIDGE, M_MEEK_BRIDGE, M_OBFS_CHECK
}
package com.darkweb.genesissearchengine.appManager.bridgeManager;
public class bridgeEnums
{
/*Settings Manager*/
public enum eBridgeViewCommands {
M_INIT_VIEWS, M_ENABLE_CUSTOM_BRIDGE
}
public enum eBridgeModelCommands {
M_REQUEST_BRIDGE, M_CUSTOM_BRIDGE, M_MEEK_BRIDGE, M_OBFS_CHECK
}
}

View File

@ -1,85 +1,85 @@
package com.darkweb.genesissearchengine.appManager.bridgeManager;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import java.util.Arrays;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_MEEK;
import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
import static com.darkweb.genesissearchengine.constants.strings.GENERIC_EMPTY_STR;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_BRIDGE_MAIL;
class bridgeModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
/*Initializations*/
bridgeModel(eventObserver.eventListener mEvent, AppCompatActivity pContext){
this.mEvent = mEvent;
mContext = pContext;
}
/*Helper Methods*/
public void requestBridges(){
pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(constants.CONST_BACKEND_GOOGLE_URL, mContext), M_BRIDGE_MAIL);
}
public void onCustomChecked(String pBridge, String pType){
status.sBridgeCustomBridge = pBridge;
status.sBridgeCustomType = pType;
status.sBridgeGatewayManual = true;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual));
}
public void onMeekChecked(){
status.sBridgeCustomBridge = BRIDGE_CUSTOM_BRIDGE_MEEK;
status.sBridgeCustomType = GENERIC_EMPTY_STR;
status.sBridgeGatewayManual = false;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual));
}
public void onObfsChecked(){
status.sBridgeCustomBridge = BRIDGE_CUSTOM_BRIDGE_OBFS4;
status.sBridgeCustomType = GENERIC_EMPTY_STR;
status.sBridgeGatewayManual = false;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual));
}
public void onTrigger(bridgeEnums.eBridgeModelCommands pCommands, List<Object> pData){
if(pCommands == bridgeEnums.eBridgeModelCommands.M_REQUEST_BRIDGE){
requestBridges();
}
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_CUSTOM_BRIDGE){
onCustomChecked((String) pData.get(0), (String) pData.get(1));
}
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_MEEK_BRIDGE){
onMeekChecked();
}
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_OBFS_CHECK){
onObfsChecked();
}
}
}
package com.darkweb.genesissearchengine.appManager.bridgeManager;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import java.util.Arrays;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_MEEK;
import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
import static com.darkweb.genesissearchengine.constants.strings.GENERIC_EMPTY_STR;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_BRIDGE_MAIL;
class bridgeModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
/*Initializations*/
bridgeModel(eventObserver.eventListener mEvent, AppCompatActivity pContext){
this.mEvent = mEvent;
mContext = pContext;
}
/*Helper Methods*/
public void requestBridges(){
pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(constants.CONST_BACKEND_GOOGLE_URL, mContext), M_BRIDGE_MAIL);
}
public void onCustomChecked(String pBridge, String pType){
status.sBridgeCustomBridge = pBridge;
status.sBridgeCustomType = pType;
status.sBridgeGatewayManual = true;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual));
}
public void onMeekChecked(){
status.sBridgeCustomBridge = BRIDGE_CUSTOM_BRIDGE_MEEK;
status.sBridgeCustomType = GENERIC_EMPTY_STR;
status.sBridgeGatewayManual = false;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual));
}
public void onObfsChecked(){
status.sBridgeCustomBridge = BRIDGE_CUSTOM_BRIDGE_OBFS4;
status.sBridgeCustomType = GENERIC_EMPTY_STR;
status.sBridgeGatewayManual = false;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual));
}
public void onTrigger(bridgeEnums.eBridgeModelCommands pCommands, List<Object> pData){
if(pCommands == bridgeEnums.eBridgeModelCommands.M_REQUEST_BRIDGE){
requestBridges();
}
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_CUSTOM_BRIDGE){
onCustomChecked((String) pData.get(0), (String) pData.get(1));
}
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_MEEK_BRIDGE){
onMeekChecked();
}
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_OBFS_CHECK){
onObfsChecked();
}
}
}

View File

@ -1,66 +1,66 @@
package com.darkweb.genesissearchengine.appManager.externalCommandManager;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
public class externalShortcutController extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
status.sSettingIsAppStarted = false;
orbotLocalConstants.mIsTorInitialized = false;
boolean mConnect = false;
if (getIntent() != null && getIntent().getStringExtra("shortcut") != null) {
String bundleString = getIntent().getStringExtra("shortcut");
switch (bundleString) {
case "erase":
setContentView(R.layout.popup_data_cleared_shortcut);
panicExitInvoked();
new Handler().postDelayed(this::finish, 3000);
return;
case "erase_and_open":
panicExitInvoked();
mConnect = true;
break;
case "Restart":
break;
}
}
setContentView(R.layout.empty_view);
if(mConnect){
new Handler().postDelayed(() -> activityContextManager.getInstance().getHomeController().onStartApplication(null), 3000);
}
helperMethod.onDelayHandler(activityContextManager.getInstance().getHomeController(), 800, () -> {
/* Start Required Activity */
Intent intent = new Intent(this.getIntent());
intent.setClassName(this.getApplicationContext(), homeController.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
this.startActivity(intent);
overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang);
return null;
});
}
public void panicExitInvoked() {
dataController.getInstance().clearData(this);
}
package com.darkweb.genesissearchengine.appManager.externalCommandManager;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
public class externalShortcutController extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
status.sSettingIsAppStarted = false;
orbotLocalConstants.mIsTorInitialized = false;
boolean mConnect = false;
if (getIntent() != null && getIntent().getStringExtra("shortcut") != null) {
String bundleString = getIntent().getStringExtra("shortcut");
switch (bundleString) {
case "erase":
setContentView(R.layout.popup_data_cleared_shortcut);
panicExitInvoked();
new Handler().postDelayed(this::finish, 3000);
return;
case "erase_and_open":
panicExitInvoked();
mConnect = true;
break;
case "Restart":
break;
}
}
setContentView(R.layout.empty_view);
if(mConnect){
new Handler().postDelayed(() -> activityContextManager.getInstance().getHomeController().onStartApplication(null), 3000);
}
helperMethod.onDelayHandler(activityContextManager.getInstance().getHomeController(), 800, () -> {
/* Start Required Activity */
Intent intent = new Intent(this.getIntent());
intent.setClassName(this.getApplicationContext(), homeController.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
this.startActivity(intent);
overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang);
return null;
});
}
public void panicExitInvoked() {
dataController.getInstance().clearData(this);
}
}

View File

@ -1,78 +1,78 @@
package com.darkweb.genesissearchengine.appManager.externalCommandManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME;
public class externalURLNavigationContoller extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Uri data = externalURLNavigationContoller.this.getIntent().getData();
if(data == null || status.sSettingIsAppStarted){
/* Close Activity */
finish();
activityContextManager.getInstance().onClearStack();
/* Create Request Handler */
if(status.sSettingIsAppStarted && data!=null){
helperMethod.onDelayHandler(this, 250, () -> {
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString()));
activityContextManager.getInstance().getHomeController().onClearSelectionTab();
return null;
});
}
Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class);
bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(bringToForegroundIntent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
}
else if(status.sSettingIsAppRunning){
/* Refresh Intent Data */
finish();
status.sExternalWebsite = data.toString();
}else {
/* Start Required Activity */
Intent intent = new Intent(this.getIntent());
intent.setClassName(this.getApplicationContext(), homeController.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if(activityContextManager.getInstance().getHomeController()!=null){
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString());
}else {
status.sExternalWebsite = data.toString();
}
/* Bring Application To Front */
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
startActivity(launchIntent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
/* Close Activity */
helperMethod.onDelayHandler(this, 1000, () -> {
finish();
return null;
});
}
}
}
package com.darkweb.genesissearchengine.appManager.externalCommandManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME;
public class externalURLNavigationContoller extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Uri data = externalURLNavigationContoller.this.getIntent().getData();
if(data == null || status.sSettingIsAppStarted){
/* Close Activity */
finish();
activityContextManager.getInstance().onClearStack();
/* Create Request Handler */
if(status.sSettingIsAppStarted && data!=null){
helperMethod.onDelayHandler(this, 250, () -> {
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString()));
activityContextManager.getInstance().getHomeController().onClearSelectionTab();
return null;
});
}
Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class);
bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(bringToForegroundIntent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
}
else if(status.sSettingIsAppRunning){
/* Refresh Intent Data */
finish();
status.sExternalWebsite = data.toString();
}else {
/* Start Required Activity */
Intent intent = new Intent(this.getIntent());
intent.setClassName(this.getApplicationContext(), homeController.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if(activityContextManager.getInstance().getHomeController()!=null){
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString());
}else {
status.sExternalWebsite = data.toString();
}
/* Bring Application To Front */
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
startActivity(launchIntent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
/* Close Activity */
helperMethod.onDelayHandler(this, 1000, () -> {
finish();
return null;
});
}
}
}

View File

@ -1,44 +1,44 @@
package com.darkweb.genesissearchengine.appManager.helpManager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.eventObserver;
public class editViewController extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
Context mContext;
private eventObserver.eventListener mEvent = null;
public editViewController(@NonNull Context context) {
super(context);
mContext = context;
}
public editViewController(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
mContext = context;
}
public editViewController(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
}
public void setEventHandler(eventObserver.eventListener pEvent){
mEvent = pEvent;
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if(mEvent!=null){
mEvent.invokeObserver(null, enums.etype.ON_KEYBOARD_CLOSE);
}
}
return false;
}
}
package com.darkweb.genesissearchengine.appManager.helpManager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.eventObserver;
public class editViewController extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
Context mContext;
private eventObserver.eventListener mEvent = null;
public editViewController(@NonNull Context context) {
super(context);
mContext = context;
}
public editViewController(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
mContext = context;
}
public editViewController(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
}
public void setEventHandler(eventObserver.eventListener pEvent){
mEvent = pEvent;
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if(mEvent!=null){
mEvent.invokeObserver(null, enums.etype.ON_KEYBOARD_CLOSE);
}
}
return false;
}
}

View File

@ -1,157 +1,157 @@
package com.darkweb.genesissearchengine.appManager.helpManager;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.historyManager.historyEnums;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.List;
public class helpAdapter extends RecyclerView.Adapter<helpAdapter.helpViewHolder>{
private List<helpDataModel> mModelList = new ArrayList<>();
private List<helpDataModel> mCompleteModelList = new ArrayList<>();
private LinearLayout mPrevRow;
private Context mContext;
private int mCurrentPosition = -1;
private boolean mIsAnimating = false;
public helpAdapter(List<helpDataModel> pModelList, Context context) {
if(pModelList!=null){
this.mCompleteModelList.addAll(pModelList);
this.mModelList.addAll(pModelList);
}
this.mContext = context;
}
private void onSearchFilterInvoked(String pQuery){
pQuery = pQuery.toLowerCase();
this.mModelList.clear();
mCurrentPosition = -1;
for(int mCounter=0;mCounter<mCompleteModelList.size();mCounter++){
if(mCompleteModelList.get(mCounter).getHeader().toLowerCase().contains(pQuery) || mCompleteModelList.get(mCounter).getDescription().toLowerCase().contains(pQuery)){
mModelList.add(mCompleteModelList.get(mCounter));
}
}
notifyDataSetChanged();
}
@NonNull
@Override
public helpViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.help_row_view, parent, false);
return new helpViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull helpViewHolder holder, int position) {
holder.bindListView(mModelList.get(position));
}
@Override
public int getItemCount() {
return mModelList.size();
}
class helpViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView mRowHeader;
TextView mRowDescription;
ImageView mIcon;
ImageView mArrowNavigation;
LinearLayout linearLayout;
RelativeLayout mHelpRowContainer;
helpViewHolder(View itemView) {
super(itemView);
}
void bindListView(helpDataModel model) {
mRowHeader = itemView.findViewById(R.id.pRowHeader);
mIcon = itemView.findViewById(R.id.pIcon);
linearLayout = itemView.findViewById(R.id.linearLayout);
mArrowNavigation = itemView.findViewById(R.id.pArrowNavigation);
mHelpRowContainer = itemView.findViewById(R.id.pHelpRowContainer);
mRowDescription = itemView.findViewById(R.id.pRowDescription);
linearLayout.animate().setDuration(150).alpha(0);
mRowHeader.setText(model.getHeader());
mRowDescription.setText(Html.fromHtml(model.getDescription()));
Drawable mDrawable;
Resources res = itemView.getContext().getResources();
try {
int mImageID = helperMethod.getResId(model.getIconID(), R.xml.class);
mDrawable = Drawable.createFromXml(res, res.getXml(mImageID));
mIcon.setImageDrawable(mDrawable);
if (mCurrentPosition == getLayoutPosition()) {
mPrevRow = linearLayout;
linearLayout.animate().setDuration(300).setStartDelay(100).alpha(1);
linearLayout.setVisibility(View.VISIBLE);
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_keyboard_arrow_up));
mArrowNavigation.setImageDrawable(mDrawable);
}else {
linearLayout.setVisibility(View.GONE);
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_keyboard_arrow_down));
mArrowNavigation.setImageDrawable(mDrawable);
}
} catch (Exception ignored) { }
mHelpRowContainer.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(!mIsAnimating){
mIsAnimating = true;
if(mPrevRow !=null && mCurrentPosition !=-1){
try {
mPrevRow.animate().cancel();
mPrevRow.animate().alpha(0).setDuration(300);
onCollapse();
}catch (Exception ex){
mIsAnimating = false;
ex.printStackTrace();
}
}else {
onCollapse();
}
}
}
public void onCollapse(){
mIsAnimating = false;
int mPreviousItem = mCurrentPosition;
if(mCurrentPosition ==getLayoutPosition()){
mCurrentPosition = -1;
}else {
mCurrentPosition = getLayoutPosition();
notifyItemChanged(mCurrentPosition);
}
notifyItemChanged(mPreviousItem);
}
}
public Object onTrigger(helpEnums.eHelpAdapter pCommands, List<Object> pData){
if(pCommands == helpEnums.eHelpAdapter.M_INIT_FILTER){
onSearchFilterInvoked((String) pData.get(0));
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.helpManager;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.historyManager.historyEnums;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.List;
public class helpAdapter extends RecyclerView.Adapter<helpAdapter.helpViewHolder>{
private List<helpDataModel> mModelList = new ArrayList<>();
private List<helpDataModel> mCompleteModelList = new ArrayList<>();
private LinearLayout mPrevRow;
private Context mContext;
private int mCurrentPosition = -1;
private boolean mIsAnimating = false;
public helpAdapter(List<helpDataModel> pModelList, Context context) {
if(pModelList!=null){
this.mCompleteModelList.addAll(pModelList);
this.mModelList.addAll(pModelList);
}
this.mContext = context;
}
private void onSearchFilterInvoked(String pQuery){
pQuery = pQuery.toLowerCase();
this.mModelList.clear();
mCurrentPosition = -1;
for(int mCounter=0;mCounter<mCompleteModelList.size();mCounter++){
if(mCompleteModelList.get(mCounter).getHeader().toLowerCase().contains(pQuery) || mCompleteModelList.get(mCounter).getDescription().toLowerCase().contains(pQuery)){
mModelList.add(mCompleteModelList.get(mCounter));
}
}
notifyDataSetChanged();
}
@NonNull
@Override
public helpViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.help_row_view, parent, false);
return new helpViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull helpViewHolder holder, int position) {
holder.bindListView(mModelList.get(position));
}
@Override
public int getItemCount() {
return mModelList.size();
}
class helpViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView mRowHeader;
TextView mRowDescription;
ImageView mIcon;
ImageView mArrowNavigation;
LinearLayout linearLayout;
RelativeLayout mHelpRowContainer;
helpViewHolder(View itemView) {
super(itemView);
}
void bindListView(helpDataModel model) {
mRowHeader = itemView.findViewById(R.id.pRowHeader);
mIcon = itemView.findViewById(R.id.pIcon);
linearLayout = itemView.findViewById(R.id.linearLayout);
mArrowNavigation = itemView.findViewById(R.id.pArrowNavigation);
mHelpRowContainer = itemView.findViewById(R.id.pHelpRowContainer);
mRowDescription = itemView.findViewById(R.id.pRowDescription);
linearLayout.animate().setDuration(150).alpha(0);
mRowHeader.setText(model.getHeader());
mRowDescription.setText(Html.fromHtml(model.getDescription()));
Drawable mDrawable;
Resources res = itemView.getContext().getResources();
try {
int mImageID = helperMethod.getResId(model.getIconID(), R.xml.class);
mDrawable = Drawable.createFromXml(res, res.getXml(mImageID));
mIcon.setImageDrawable(mDrawable);
if (mCurrentPosition == getLayoutPosition()) {
mPrevRow = linearLayout;
linearLayout.animate().setDuration(300).setStartDelay(100).alpha(1);
linearLayout.setVisibility(View.VISIBLE);
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_keyboard_arrow_up));
mArrowNavigation.setImageDrawable(mDrawable);
}else {
linearLayout.setVisibility(View.GONE);
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_keyboard_arrow_down));
mArrowNavigation.setImageDrawable(mDrawable);
}
} catch (Exception ignored) { }
mHelpRowContainer.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(!mIsAnimating){
mIsAnimating = true;
if(mPrevRow !=null && mCurrentPosition !=-1){
try {
mPrevRow.animate().cancel();
mPrevRow.animate().alpha(0).setDuration(300);
onCollapse();
}catch (Exception ex){
mIsAnimating = false;
ex.printStackTrace();
}
}else {
onCollapse();
}
}
}
public void onCollapse(){
mIsAnimating = false;
int mPreviousItem = mCurrentPosition;
if(mCurrentPosition ==getLayoutPosition()){
mCurrentPosition = -1;
}else {
mCurrentPosition = getLayoutPosition();
notifyItemChanged(mCurrentPosition);
}
notifyItemChanged(mPreviousItem);
}
}
public Object onTrigger(helpEnums.eHelpAdapter pCommands, List<Object> pData){
if(pCommands == helpEnums.eHelpAdapter.M_INIT_FILTER){
onSearchFilterInvoked((String) pData.get(0));
}
return null;
}
}

View File

@ -1,26 +1,26 @@
package com.darkweb.genesissearchengine.appManager.helpManager;
public class helpDataModel {
private String mHeader;
private String mDescription;
private String mIcon;
public helpDataModel(String pHeader, String pDescription, String pIcon) {
this.mHeader = pHeader;
this.mDescription = pDescription;
this.mIcon = pIcon;
}
public String getHeader() {
return mHeader;
}
public String getDescription() {
return mDescription;
}
public String getIconID() {
return mIcon;
}
}
package com.darkweb.genesissearchengine.appManager.helpManager;
public class helpDataModel {
private String mHeader;
private String mDescription;
private String mIcon;
public helpDataModel(String pHeader, String pDescription, String pIcon) {
this.mHeader = pHeader;
this.mDescription = pDescription;
this.mIcon = pIcon;
}
public String getHeader() {
return mHeader;
}
public String getDescription() {
return mDescription;
}
public String getIconID() {
return mIcon;
}
}

View File

@ -1,24 +1,24 @@
package com.darkweb.genesissearchengine.appManager.helpManager;
class helpEnums
{
/*History Manager*/
public enum eHelpModel {
M_LOAD_HELP_DATA, M_IS_LOADED
}
public enum eHelpModelCallback {
M_LOAD_JSON_RESPONSE_SUCCESS, M_LOAD_JSON_RESPONSE_FAILURE
}
public enum eHelpViewController {
M_INIT_VIEWS, M_DATA_LOADED, M_LOAD_ERROR, M_RELOAD_DATA
}
public enum eHelpAdapter {
M_INIT_FILTER
}
public enum eHelpViewCallback {
}
package com.darkweb.genesissearchengine.appManager.helpManager;
class helpEnums
{
/*History Manager*/
public enum eHelpModel {
M_LOAD_HELP_DATA, M_IS_LOADED
}
public enum eHelpModelCallback {
M_LOAD_JSON_RESPONSE_SUCCESS, M_LOAD_JSON_RESPONSE_FAILURE
}
public enum eHelpViewController {
M_INIT_VIEWS, M_DATA_LOADED, M_LOAD_ERROR, M_RELOAD_DATA
}
public enum eHelpAdapter {
M_INIT_FILTER
}
public enum eHelpViewCallback {
}
}

View File

@ -1,93 +1,93 @@
package com.darkweb.genesissearchengine.appManager.helpManager;
import androidx.appcompat.app.AppCompatActivity;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.constants.*;
class helpModel
{
private eventObserver.eventListener mEvent;
private String mJsonPath;
private AppCompatActivity mContext;
private ArrayList<helpDataModel> mHelpListModel;
private boolean mIsLoaded = false;
public helpModel(AppCompatActivity pContext, eventObserver.eventListener pEvent){
this.mContext = pContext;
this.mEvent = pEvent;
this.mHelpListModel = new ArrayList<>();
if(status.sDeveloperBuild){
this.mJsonPath = CONST_SERVER_DEV;
}else {
this.mJsonPath = CONST_SERVER;
}
}
private void getHelpJSON(){
ArrayList<helpDataModel> mTempModel = (ArrayList<helpDataModel>)dataController.getInstance().invokeHelp(dataEnums.eHelpCommands.M_GET_HELP, null);
mHelpListModel.clear();
if(mTempModel.size()>0){
mIsLoaded = true;
mHelpListModel.addAll(mTempModel);
mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_SUCCESS);
}else {
StringRequest stringRequest = new StringRequest(Request.Method.GET, mJsonPath,
response -> {
try {
JSONArray jsonArray = new JSONArray(response);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject obj = jsonArray.getJSONObject(i);
helpDataModel hero = new helpDataModel(
obj.getString(CONST_HELP_MODEL_HEADER),
obj.getString(CONST_HELP_MODEL_DESCRIPTION),
obj.getString(CONST_HELP_MODEL_ICON));
mHelpListModel.add(hero);
dataController.getInstance().invokeHelp(dataEnums.eHelpCommands.M_SET_HELP, Collections.singletonList(mHelpListModel));
}
mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_SUCCESS);
} catch (JSONException e) {
mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_FAILURE);
e.printStackTrace();
}
},
error -> {
mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_FAILURE);
});
RequestQueue requestQueue = Volley.newRequestQueue(mContext/*, new ProxiedHurlStack()*/);
requestQueue.add(stringRequest);
}
}
private boolean IsLoaded(){
return mIsLoaded;
}
public Object onTrigger(helpEnums.eHelpModel pCommands, List<Object> pData){
if(pCommands.equals(helpEnums.eHelpModel.M_LOAD_HELP_DATA)){
getHelpJSON();
}
else if(pCommands.equals(helpEnums.eHelpModel.M_IS_LOADED)){
return IsLoaded();
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.helpManager;
import androidx.appcompat.app.AppCompatActivity;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.constants.*;
class helpModel
{
private eventObserver.eventListener mEvent;
private String mJsonPath;
private AppCompatActivity mContext;
private ArrayList<helpDataModel> mHelpListModel;
private boolean mIsLoaded = false;
public helpModel(AppCompatActivity pContext, eventObserver.eventListener pEvent){
this.mContext = pContext;
this.mEvent = pEvent;
this.mHelpListModel = new ArrayList<>();
if(status.sDeveloperBuild){
this.mJsonPath = CONST_SERVER_DEV;
}else {
this.mJsonPath = CONST_SERVER;
}
}
private void getHelpJSON(){
ArrayList<helpDataModel> mTempModel = (ArrayList<helpDataModel>)dataController.getInstance().invokeHelp(dataEnums.eHelpCommands.M_GET_HELP, null);
mHelpListModel.clear();
if(mTempModel.size()>0){
mIsLoaded = true;
mHelpListModel.addAll(mTempModel);
mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_SUCCESS);
}else {
StringRequest stringRequest = new StringRequest(Request.Method.GET, mJsonPath,
response -> {
try {
JSONArray jsonArray = new JSONArray(response);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject obj = jsonArray.getJSONObject(i);
helpDataModel hero = new helpDataModel(
obj.getString(CONST_HELP_MODEL_HEADER),
obj.getString(CONST_HELP_MODEL_DESCRIPTION),
obj.getString(CONST_HELP_MODEL_ICON));
mHelpListModel.add(hero);
dataController.getInstance().invokeHelp(dataEnums.eHelpCommands.M_SET_HELP, Collections.singletonList(mHelpListModel));
}
mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_SUCCESS);
} catch (JSONException e) {
mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_FAILURE);
e.printStackTrace();
}
},
error -> {
mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_FAILURE);
});
RequestQueue requestQueue = Volley.newRequestQueue(mContext/*, new ProxiedHurlStack()*/);
requestQueue.add(stringRequest);
}
}
private boolean IsLoaded(){
return mIsLoaded;
}
public Object onTrigger(helpEnums.eHelpModel pCommands, List<Object> pData){
if(pCommands.equals(helpEnums.eHelpModel.M_LOAD_HELP_DATA)){
getHelpJSON();
}
else if(pCommands.equals(helpEnums.eHelpModel.M_IS_LOADED)){
return IsLoaded();
}
return null;
}
}

View File

@ -1,128 +1,128 @@
package com.darkweb.genesissearchengine.appManager.historyManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.widget.ActionMenuView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.List;
public class historyAdapterView
{
/*Private Variables*/
private AppCompatActivity mContext;
historyAdapterView(AppCompatActivity pContext)
{
this.mContext = pContext;
}
public Object openMenu(PopupWindow pPopupWindow, View pView, View popupView){
if(pPopupWindow !=null){
pPopupWindow.dismiss();
}
pPopupWindow = new PopupWindow(
popupView,
ActionMenuView.LayoutParams.WRAP_CONTENT,
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
pView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int xOffset = -(pView.getMeasuredWidth() - pView.getWidth());
int[] location = new int[2];
pView.getLocationOnScreen(location);
int y = location[1];
int height = helperMethod.getScreenHeight(mContext);
int m_offset_height;
if(y + helperMethod.pxFromDp(300) >height){
m_offset_height = helperMethod.pxFromDp(203);
}
else{
m_offset_height = 0;
}
pPopupWindow.setOutsideTouchable(true);
pPopupWindow.setFocusable(true);
pPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
pPopupWindow.setAnimationStyle(R.style.popup_window_animation);
pPopupWindow.setElevation(7);
if(status.sSettingLanguageRegion.equals("Ur")){
pPopupWindow.showAsDropDown(pView,0, helperMethod.pxFromDp(-45));
}else {
pPopupWindow.showAsDropDown(pView,xOffset - 90, -m_offset_height-helperMethod.pxFromDp(50));
}
return pPopupWindow;
}
private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){
mItemView.setPressed(false);
pPopupMenu.setVisibility(View.GONE);
pPopupMenu.animate().setDuration(150).alpha(0);
pPopupMenu.setClickable(true);
pLogoImage.setAlpha(0f);
pLogoImage.animate().cancel();
pLogoImage.setVisibility(View.GONE);
pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
}
public void onSelectView(View pItemView, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){
pItemView.setPressed(false);
int speed = 150;
if(pIsForced){
speed=150;
}
if(pVibrate){
helperMethod.vibrate(mContext);
}
pLogoImage.setAlpha(0f);
pLogoImage.setVisibility(View.VISIBLE);
pLogoImage.animate().cancel();
pLogoImage.animate().setDuration(speed).alpha(0.95f);
}
public void onClearHighlight(View pItemView, ImageView pLogoImage, boolean pIsForced)
{
try {
if(pLogoImage.getAlpha()>0){
pItemView.setPressed(false);
int speed = 150;
if(pIsForced){
speed = 0;
}
pLogoImage.setAlpha(0f);
pLogoImage.animate().cancel();
pLogoImage.animate().setDuration(speed).alpha(0f).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
}
} catch (Exception e) {
e.printStackTrace();
}
}
public Object onTrigger(historyEnums.eHistoryViewAdapterCommands pCommands, List<Object> pData){
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_OPEN_MENU){
return openMenu((PopupWindow) pData.get(0), (View) pData.get(1), (View) pData.get(2));
}
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW){
clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2));
}
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW){
onSelectView((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4));
}
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT){
onClearHighlight((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3));
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.historyManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.widget.ActionMenuView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.List;
public class historyAdapterView
{
/*Private Variables*/
private AppCompatActivity mContext;
historyAdapterView(AppCompatActivity pContext)
{
this.mContext = pContext;
}
public Object openMenu(PopupWindow pPopupWindow, View pView, View popupView){
if(pPopupWindow !=null){
pPopupWindow.dismiss();
}
pPopupWindow = new PopupWindow(
popupView,
ActionMenuView.LayoutParams.WRAP_CONTENT,
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
pView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int xOffset = -(pView.getMeasuredWidth() - pView.getWidth());
int[] location = new int[2];
pView.getLocationOnScreen(location);
int y = location[1];
int height = helperMethod.getScreenHeight(mContext);
int m_offset_height;
if(y + helperMethod.pxFromDp(300) >height){
m_offset_height = helperMethod.pxFromDp(203);
}
else{
m_offset_height = 0;
}
pPopupWindow.setOutsideTouchable(true);
pPopupWindow.setFocusable(true);
pPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
pPopupWindow.setAnimationStyle(R.style.popup_window_animation);
pPopupWindow.setElevation(7);
if(status.sSettingLanguageRegion.equals("Ur")){
pPopupWindow.showAsDropDown(pView,0, helperMethod.pxFromDp(-45));
}else {
pPopupWindow.showAsDropDown(pView,xOffset - 90, -m_offset_height-helperMethod.pxFromDp(50));
}
return pPopupWindow;
}
private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){
mItemView.setPressed(false);
pPopupMenu.setVisibility(View.GONE);
pPopupMenu.animate().setDuration(150).alpha(0);
pPopupMenu.setClickable(true);
pLogoImage.setAlpha(0f);
pLogoImage.animate().cancel();
pLogoImage.setVisibility(View.GONE);
pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
}
public void onSelectView(View pItemView, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){
pItemView.setPressed(false);
int speed = 150;
if(pIsForced){
speed=150;
}
if(pVibrate){
helperMethod.vibrate(mContext);
}
pLogoImage.setAlpha(0f);
pLogoImage.setVisibility(View.VISIBLE);
pLogoImage.animate().cancel();
pLogoImage.animate().setDuration(speed).alpha(0.95f);
}
public void onClearHighlight(View pItemView, ImageView pLogoImage, boolean pIsForced)
{
try {
if(pLogoImage.getAlpha()>0){
pItemView.setPressed(false);
int speed = 150;
if(pIsForced){
speed = 0;
}
pLogoImage.setAlpha(0f);
pLogoImage.animate().cancel();
pLogoImage.animate().setDuration(speed).alpha(0f).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
}
} catch (Exception e) {
e.printStackTrace();
}
}
public Object onTrigger(historyEnums.eHistoryViewAdapterCommands pCommands, List<Object> pData){
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_OPEN_MENU){
return openMenu((PopupWindow) pData.get(0), (View) pData.get(1), (View) pData.get(2));
}
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW){
clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2));
}
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW){
onSelectView((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4));
}
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT){
onClearHighlight((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3));
}
return null;
}
}

View File

@ -1,18 +1,18 @@
package com.darkweb.genesissearchengine.appManager.historyManager;
public class historyEnums
{
/*History Manager*/
public enum eHistoryViewCommands {
M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU, M_CLOSE_MENU, M_HIDE_SEARCH, M_LONG_PRESS_MENU, ON_GENERATE_SWIPABLE_BACKGROUND
}
public enum eHistoryAdapterCommands {
M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE
}
public enum eHistoryViewAdapterCommands {
M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT
}
package com.darkweb.genesissearchengine.appManager.historyManager;
public class historyEnums
{
/*History Manager*/
public enum eHistoryViewCommands {
M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU, M_CLOSE_MENU, M_HIDE_SEARCH, M_LONG_PRESS_MENU, ON_GENERATE_SWIPABLE_BACKGROUND
}
public enum eHistoryAdapterCommands {
M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE
}
public enum eHistoryViewAdapterCommands {
M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT
}
}

View File

@ -1,10 +1,10 @@
package com.darkweb.genesissearchengine.appManager.homeManager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class FakeLauncherActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
package com.darkweb.genesissearchengine.appManager.homeManager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class FakeLauncherActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
}

View File

@ -1,156 +1,166 @@
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import android.content.Context;
import androidx.core.view.NestedScrollingChildHelper;
import androidx.core.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import org.mozilla.geckoview.GeckoView;
import java.util.Collections;
import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN;
import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_ALWAYS;
public class NestedGeckoView extends GeckoView {
private int mLastY;
private final int[] mScrollOffset = new int[2];
private final int[] mScrollConsumed = new int[2];
private int mNestedOffsetY;
private NestedScrollingChildHelper mChildHelper;
private eventObserver.eventListener mEvent;
public void onSetHomeEvent(eventObserver.eventListener pEvent){
mEvent = pEvent;
}
public void onDestroy() {
mEvent = null;
mChildHelper = null;
}
public NestedGeckoView(Context context, AttributeSet attrs) {
super(context.getApplicationContext(), attrs);
mChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
final MotionEvent event = MotionEvent.obtain(ev);
final int action = ev.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
mNestedOffsetY = 0;
}
final int eventY = (int) event.getY();
event.offsetLocation(0, mNestedOffsetY);
if(event.getPointerCount() > 1 && !status.sSettingEnableZoom) {
return true;
}
switch (action) {
case MotionEvent.ACTION_MOVE:
// mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
final boolean allowScroll = status.sFullScreenBrowsing;
int deltaY = mLastY - eventY;
if (allowScroll && dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) {
deltaY -= mScrollConsumed[1];
event.offsetLocation(0, -mScrollOffset[1]);
mNestedOffsetY += mScrollOffset[1];
}
mLastY = eventY - mScrollOffset[1];
if (allowScroll && dispatchNestedScroll(0, mScrollOffset[1], 0, deltaY, mScrollOffset)) {
mLastY -= mScrollOffset[1];
event.offsetLocation(0, mScrollOffset[1]);
mNestedOffsetY += mScrollOffset[1];
}
if(status.sFullScreenBrowsing){
Log.i("wow1", eventY + "");
}
break;
case MotionEvent.ACTION_DOWN:
mLastY = eventY;
startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL);
mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_DOWN);
break;
case MotionEvent.ACTION_UP:
mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_UP_ALWAYS);
case MotionEvent.ACTION_CANCEL:
// mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
stopNestedScroll();
break;
default:
// mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
}
// Execute event handler from parent class in all cases
boolean eventHandled = super.onTouchEvent(event);
// Recycle previously obtained event
event.recycle();
return eventHandled;
}
@Override
public void setNestedScrollingEnabled(boolean enabled) {
mChildHelper.setNestedScrollingEnabled(enabled);
}
@Override
public boolean isNestedScrollingEnabled() {
return mChildHelper.isNestedScrollingEnabled();
}
@Override
public boolean startNestedScroll(int axes) {
return mChildHelper.startNestedScroll(axes);
}
@Override
public void stopNestedScroll() {
mChildHelper.stopNestedScroll();
}
@Override
public boolean hasNestedScrollingParent() {
return mChildHelper.hasNestedScrollingParent();
}
@Override
public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) {
return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow);
}
@Override
public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) {
return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow);
}
@Override
public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) {
return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed);
}
public int getMaxY(){
return 1;
}
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import android.content.Context;
import androidx.core.view.NestedScrollingChildHelper;
import androidx.core.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import org.mozilla.geckoview.GeckoView;
import java.util.Collections;
import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN;
import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_ALWAYS;
public class NestedGeckoView extends GeckoView {
private int mLastY;
private final int[] mScrollOffset = new int[2];
private final int[] mScrollConsumed = new int[2];
private int mNestedOffsetY;
private NestedScrollingChildHelper mChildHelper;
private eventObserver.eventListener mEvent;
private boolean mScrollable = true;
private int mSwipeDistance = 0;
public void onSetHomeEvent(eventObserver.eventListener pEvent){
mEvent = pEvent;
}
public void onDestroy() {
mEvent = null;
mChildHelper = null;
}
public NestedGeckoView(Context context, AttributeSet attrs) {
super(context.getApplicationContext(), attrs);
mChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
final MotionEvent event = MotionEvent.obtain(ev);
final int action = ev.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
mNestedOffsetY = 0;
}
final int eventY = (int) event.getY();
event.offsetLocation(0, mNestedOffsetY);
if(event.getPointerCount() > 1 && !status.sSettingEnableZoom) {
return true;
}
switch (action) {
case MotionEvent.ACTION_MOVE:
// mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
int deltaY = mLastY - eventY;
mSwipeDistance += deltaY;
if(mSwipeDistance>=100 || mSwipeDistance<=-150){
mScrollable = true;
}
final boolean allowScroll = status.sFullScreenBrowsing && !status.sDisableExpandTemp && mScrollable;
if (allowScroll && dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) {
deltaY -= mScrollConsumed[1];
event.offsetLocation(0, -mScrollOffset[1]);
mNestedOffsetY += mScrollOffset[1];
}
mLastY = eventY - mScrollOffset[1];
if (allowScroll && dispatchNestedScroll(0, mScrollOffset[1], 0, deltaY, mScrollOffset)) {
mLastY -= mScrollOffset[1];
event.offsetLocation(0, mScrollOffset[1]);
mNestedOffsetY += mScrollOffset[1];
}
if(status.sFullScreenBrowsing){
Log.i("wow1", eventY + "");
}
break;
case MotionEvent.ACTION_DOWN:
mSwipeDistance = 0;
mScrollable = false;
mLastY = eventY;
startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL);
mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_DOWN);
break;
case MotionEvent.ACTION_UP:
mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_UP_ALWAYS);
case MotionEvent.ACTION_CANCEL:
// mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
stopNestedScroll();
break;
default:
// mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
}
// Execute event handler from parent class in all cases
boolean eventHandled = super.onTouchEvent(event);
// Recycle previously obtained event
event.recycle();
return eventHandled;
}
@Override
public void setNestedScrollingEnabled(boolean enabled) {
mChildHelper.setNestedScrollingEnabled(enabled);
}
@Override
public boolean isNestedScrollingEnabled() {
return mChildHelper.isNestedScrollingEnabled();
}
@Override
public boolean startNestedScroll(int axes) {
return mChildHelper.startNestedScroll(axes);
}
@Override
public void stopNestedScroll() {
mChildHelper.stopNestedScroll();
}
@Override
public boolean hasNestedScrollingParent() {
return mChildHelper.hasNestedScrollingParent();
}
@Override
public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) {
return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow);
}
@Override
public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) {
return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow);
}
@Override
public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) {
return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed);
}
public int getMaxY(){
return 1;
}
}

View File

@ -1,167 +1,167 @@
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import org.mozilla.geckoview.WebRequestError;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class errorHandler
{
private AppCompatActivity mContext;
private String mErrorTemplate;
public String createErrorPage(final int category, final int error,AppCompatActivity mContext,String url, InputStream mResourceURL) {
this.mContext = mContext;
if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder();
try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
mErrorTemplate = builder.toString();
} catch (IOException e) {
return null;
}
}
String title = helperMethod.getHost(url);
if(url==null){
url = "Hidden Error";
}
if(title==null){
title = "Hidden Error";
}
String replaceUrl = errorToString(error).replace("$URL",url);
String errorPage = createErrorPage("CODE : " + categoryToString(category) + " <br>TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL);
errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category));
return errorPage;
}
private String translateMessage(String message,String error){
message = message.replace("$ERROR_M1",mContext.getString(R.string.ERROR_M1));
message = message.replace("$ERROR_M2",mContext.getString(R.string.ERROR_M2));
message = message.replace("$ERROR_M3",mContext.getString(R.string.ERROR_M3));
message = message.replace("$ERROR_M4",mContext.getString(R.string.ERROR_M4));
message = message.replace("$ERROR_M5",mContext.getString(R.string.ERROR_M5));
message = message.replace("$ERROR_M6",mContext.getString(R.string.ERROR_M6));
message = message.replace("$ERROR", error);
return message;
}
private String errorToString(final int error) {
switch (error) {
case WebRequestError.ERROR_UNKNOWN:
return "ERROR_UNKNOWN" ;
case WebRequestError.ERROR_SECURITY_SSL:
return "ERROR_SECURITY_SSL";
case WebRequestError.ERROR_SECURITY_BAD_CERT:
return "ERROR_SECURITY_BAD_CERT";
case WebRequestError.ERROR_NET_RESET:
return "ERROR_NET_RESET";
case WebRequestError.ERROR_NET_INTERRUPT:
return "ERROR_NET_INTERRUPT";
case WebRequestError.ERROR_NET_TIMEOUT:
return "ERROR_NET_TIMEOUT";
case WebRequestError.ERROR_CONNECTION_REFUSED:
return "ERROR_CONNECTION_REFUSED";
case WebRequestError.ERROR_UNKNOWN_PROTOCOL:
return "ERROR_UNKNOWN_PROTOCOL";
case WebRequestError.ERROR_UNKNOWN_HOST:
return "ERROR_UNKNOWN_HOST";
case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE:
return "ERROR_UNKNOWN_SOCKET_TYPE";
case WebRequestError.ERROR_UNKNOWN_PROXY_HOST:
return "ERROR_UNKNOWN_PROXY_HOST";
case WebRequestError.ERROR_MALFORMED_URI:
return "ERROR_MALFORMED_URI";
case WebRequestError.ERROR_REDIRECT_LOOP:
return "ERROR_REDIRECT_LOOP";
case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI:
return "ERROR_SAFEBROWSING_PHISHING_URI";
case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI:
return "ERROR_SAFEBROWSING_MALWARE_URI";
case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI:
return "ERROR_SAFEBROWSING_UNWANTED_URI";
case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI:
return "ERROR_SAFEBROWSING_HARMFUL_URI";
case WebRequestError.ERROR_CONTENT_CRASHED:
return "ERROR_CONTENT_CRASHED";
case WebRequestError.ERROR_OFFLINE:
return "ERROR_OFFLINE";
case WebRequestError.ERROR_PORT_BLOCKED:
return "ERROR_PORT_BLOCKED";
case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED:
return "ERROR_PROXY_CONNECTION_REFUSED";
case WebRequestError.ERROR_FILE_NOT_FOUND:
return "ERROR_FILE_NOT_FOUND";
case WebRequestError.ERROR_FILE_ACCESS_DENIED:
return "ERROR_FILE_ACCESS_DENIED";
case WebRequestError.ERROR_INVALID_CONTENT_ENCODING:
return "ERROR_INVALID_CONTENT_ENCODING";
case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE:
return "ERROR_UNSAFE_CONTENT_TYPE";
case WebRequestError.ERROR_CORRUPTED_CONTENT:
return "ERROR_CORRUPTED_CONTENT";
default:
return "UNKNOWN";
}
}
private String categoryToString(final int category)
{
switch (category)
{
case WebRequestError.ERROR_CATEGORY_UNKNOWN:
return "ERROR_CATEGORY_UNKNOWN";
case WebRequestError.ERROR_CATEGORY_SECURITY:
return "ERROR_CATEGORY_SECURITY";
case WebRequestError.ERROR_CATEGORY_NETWORK:
return "ERROR_CATEGORY_NETWORK";
case WebRequestError.ERROR_CATEGORY_CONTENT:
return "ERROR_CATEGORY_CONTENT";
case WebRequestError.ERROR_CATEGORY_URI:
return "ERROR_CATEGORY_URI";
case WebRequestError.ERROR_CATEGORY_PROXY:
return "ERROR_CATEGORY_PROXY";
case WebRequestError.ERROR_CATEGORY_SAFEBROWSING:
return "ERROR_CATEGORY_SAFEBROWSING";
default:
return "UNKNOWN";
}
}
private String createErrorPage(final String error,String url, InputStream mResourceURL) {
if(error==null){
return strings.GENERIC_EMPTY_STR;
}
if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder();
try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
mErrorTemplate = builder.toString();
} catch (IOException e) {
return null;
}
}
String replaceUrl = mErrorTemplate.replace("$URL",url);
return replaceUrl;
}
}
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import org.mozilla.geckoview.WebRequestError;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class errorHandler
{
private AppCompatActivity mContext;
private String mErrorTemplate;
public String createErrorPage(final int category, final int error,AppCompatActivity mContext,String url, InputStream mResourceURL) {
this.mContext = mContext;
if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder();
try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
mErrorTemplate = builder.toString();
} catch (IOException e) {
return null;
}
}
String title = helperMethod.getHost(url);
if(url==null){
url = "Hidden Error";
}
if(title==null){
title = "Hidden Error";
}
String replaceUrl = errorToString(error).replace("$URL",url);
String errorPage = createErrorPage("CODE : " + categoryToString(category) + " <br>TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL);
errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category));
return errorPage;
}
private String translateMessage(String message,String error){
message = message.replace("$ERROR_M1",mContext.getString(R.string.ERROR_M1));
message = message.replace("$ERROR_M2",mContext.getString(R.string.ERROR_M2));
message = message.replace("$ERROR_M3",mContext.getString(R.string.ERROR_M3));
message = message.replace("$ERROR_M4",mContext.getString(R.string.ERROR_M4));
message = message.replace("$ERROR_M5",mContext.getString(R.string.ERROR_M5));
message = message.replace("$ERROR_M6",mContext.getString(R.string.ERROR_M6));
message = message.replace("$ERROR", error);
return message;
}
private String errorToString(final int error) {
switch (error) {
case WebRequestError.ERROR_UNKNOWN:
return "ERROR_UNKNOWN" ;
case WebRequestError.ERROR_SECURITY_SSL:
return "ERROR_SECURITY_SSL";
case WebRequestError.ERROR_SECURITY_BAD_CERT:
return "ERROR_SECURITY_BAD_CERT";
case WebRequestError.ERROR_NET_RESET:
return "ERROR_NET_RESET";
case WebRequestError.ERROR_NET_INTERRUPT:
return "ERROR_NET_INTERRUPT";
case WebRequestError.ERROR_NET_TIMEOUT:
return "ERROR_NET_TIMEOUT";
case WebRequestError.ERROR_CONNECTION_REFUSED:
return "ERROR_CONNECTION_REFUSED";
case WebRequestError.ERROR_UNKNOWN_PROTOCOL:
return "ERROR_UNKNOWN_PROTOCOL";
case WebRequestError.ERROR_UNKNOWN_HOST:
return "ERROR_UNKNOWN_HOST";
case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE:
return "ERROR_UNKNOWN_SOCKET_TYPE";
case WebRequestError.ERROR_UNKNOWN_PROXY_HOST:
return "ERROR_UNKNOWN_PROXY_HOST";
case WebRequestError.ERROR_MALFORMED_URI:
return "ERROR_MALFORMED_URI";
case WebRequestError.ERROR_REDIRECT_LOOP:
return "ERROR_REDIRECT_LOOP";
case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI:
return "ERROR_SAFEBROWSING_PHISHING_URI";
case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI:
return "ERROR_SAFEBROWSING_MALWARE_URI";
case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI:
return "ERROR_SAFEBROWSING_UNWANTED_URI";
case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI:
return "ERROR_SAFEBROWSING_HARMFUL_URI";
case WebRequestError.ERROR_CONTENT_CRASHED:
return "ERROR_CONTENT_CRASHED";
case WebRequestError.ERROR_OFFLINE:
return "ERROR_OFFLINE";
case WebRequestError.ERROR_PORT_BLOCKED:
return "ERROR_PORT_BLOCKED";
case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED:
return "ERROR_PROXY_CONNECTION_REFUSED";
case WebRequestError.ERROR_FILE_NOT_FOUND:
return "ERROR_FILE_NOT_FOUND";
case WebRequestError.ERROR_FILE_ACCESS_DENIED:
return "ERROR_FILE_ACCESS_DENIED";
case WebRequestError.ERROR_INVALID_CONTENT_ENCODING:
return "ERROR_INVALID_CONTENT_ENCODING";
case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE:
return "ERROR_UNSAFE_CONTENT_TYPE";
case WebRequestError.ERROR_CORRUPTED_CONTENT:
return "ERROR_CORRUPTED_CONTENT";
default:
return "UNKNOWN";
}
}
private String categoryToString(final int category)
{
switch (category)
{
case WebRequestError.ERROR_CATEGORY_UNKNOWN:
return "ERROR_CATEGORY_UNKNOWN";
case WebRequestError.ERROR_CATEGORY_SECURITY:
return "ERROR_CATEGORY_SECURITY";
case WebRequestError.ERROR_CATEGORY_NETWORK:
return "ERROR_CATEGORY_NETWORK";
case WebRequestError.ERROR_CATEGORY_CONTENT:
return "ERROR_CATEGORY_CONTENT";
case WebRequestError.ERROR_CATEGORY_URI:
return "ERROR_CATEGORY_URI";
case WebRequestError.ERROR_CATEGORY_PROXY:
return "ERROR_CATEGORY_PROXY";
case WebRequestError.ERROR_CATEGORY_SAFEBROWSING:
return "ERROR_CATEGORY_SAFEBROWSING";
default:
return "UNKNOWN";
}
}
private String createErrorPage(final String error,String url, InputStream mResourceURL) {
if(error==null){
return strings.GENERIC_EMPTY_STR;
}
if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder();
try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
mErrorTemplate = builder.toString();
} catch (IOException e) {
return null;
}
}
String replaceUrl = mErrorTemplate.replace("$URL",url);
return replaceUrl;
}
}

View File

@ -1,490 +1,490 @@
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import android.util.Log;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.BrowserIconManager;
import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.io.File;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
import static com.darkweb.genesissearchengine.constants.constants.CONST_REPORT_URL;
import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS;
import static org.mozilla.geckoview.StorageController.ClearFlags.COOKIES;
import static org.mozilla.geckoview.StorageController.ClearFlags.DOM_STORAGES;
import static org.mozilla.geckoview.StorageController.ClearFlags.IMAGE_CACHE;
import static org.mozilla.geckoview.StorageController.ClearFlags.NETWORK_CACHE;
import static org.mozilla.geckoview.StorageController.ClearFlags.PERMISSIONS;
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_DATA;
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_SETTINGS;
import org.mozilla.geckoview.ContentBlocking;
import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoView;
import org.mozilla.geckoview.WebResponse;
public class geckoClients
{
/*Gecko Variables*/
private geckoSession mSession = null;
private GeckoRuntime mRuntime = null;
private BrowserIconManager mIconManager;
private eventObserver.eventListener event;
/*Local Variable*/
private String mSessionID;
public void initialize(GeckoView geckoView, eventObserver.eventListener event, AppCompatActivity context, boolean isForced)
{
this.event = event;
mSessionID = helperMethod.createRandomID();
initRuntimeSettings(context);
if(!isForced && geckoView.getSession()!=null && geckoView.getSession().isOpen()){
mSession = (geckoSession) geckoView.getSession();
}
else {
geckoView.releaseSession();
mSession = new geckoSession(new geckoViewClientCallback(),mSessionID,context, geckoView);
mSession.open(mRuntime);
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mSession.getSettings().setFullAccessibilityTree(true);
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
geckoView.releaseSession();
geckoView.setSession(mSession);
}
mSession.onSetInitializeFromStartup();
onUpdateFont();
}
public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
boolean mStatus = mSession.onValidateInitializeFromStartup();
if(mStatus){
boolean mState = mSession.onRestoreState();
if(!mState){
new Handler().postDelayed(() ->
{
mSession.stop();
mSession.loadUri(mSession.getCurrentURL());
}, 500);
}else {
String mURL = mSession.getCurrentURL();
if(mURL.equals("https://genesishiddentechnologies.com") || mURL.startsWith(CONST_GENESIS_URL_CACHED) || mURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){
if(!mSession.canGoBack()){
mNestedGeckoView.releaseSession();
mSession.close();
mSession.open(mRuntime);
mNestedGeckoView.setSession(mSession);
}else {
mSession.goBack();
}
loadURL("genesishiddentechnologies.com", mNestedGeckoView, pcontext);
}
}
}
}
public geckoSession initFreeSession(GeckoView pGeckoView, AppCompatActivity pcontext, eventObserver.eventListener event){
this.event = event;
initRuntimeSettings(pcontext);
geckoSession mTempSession = new geckoSession(new geckoViewClientCallback(),mSessionID,pcontext, pGeckoView);
mTempSession.open(mRuntime);
mTempSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mTempSession.getSettings().setFullAccessibilityTree(true);
mTempSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
mTempSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
return mTempSession;
}
public void onDestroy(){
mSession.onDestroy();
mSession = null;
mRuntime = null;
mIconManager = null;
event = null;
}
public GeckoRuntime getmRuntime(){
return mRuntime;
}
public void onSessionReinit(){
mSession.onSessionReinit();
}
public void toogleUserAgent(){
mSession.toogleUserAgent();
}
public int getUserAgent(){
return mSession.getUserAgentMode();
}
@SuppressLint("WrongConstant")
public void initRuntimeSettings(AppCompatActivity context){
if(mRuntime==null){
mRuntime = GeckoRuntime.getDefault(context.getApplicationContext());
mRuntime.getSettings().setAboutConfigEnabled(true);
mRuntime.getSettings().setAutomaticFontSizeAdjustment(false);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
mRuntime.getSettings().setForceUserScalableEnabled(status.sSettingEnableZoom);
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT);
mIconManager = new BrowserIconManager();
if(status.sSettingTrackingProtection == 1){
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.DEFAULT);
}else if(status.sSettingTrackingProtection == 2){
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT);
}
}
}
public void onGetFavIcon(ImageView pImageView, String pURL, AppCompatActivity pcontext){
pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL));
mIconManager.onLoadIconIntoView(pcontext,mRuntime, pImageView, pURL);
}
public void onLoadFavIcon(AppCompatActivity pcontext){
BrowserIconManager mIconManager = new BrowserIconManager();
mIconManager.onLoadIcon(pcontext.getApplicationContext(), mRuntime);
}
private int getCookiesBehaviour(){
return status.sSettingCookieStatus;
}
@SuppressLint("WrongConstant")
public void updateSetting(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
mRuntime.getSettings().setRemoteDebuggingEnabled(false);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
mRuntime.getSettings().setAutomaticFontSizeAdjustment(false);
mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
mRuntime.getSettings().setForceUserScalableEnabled(status.sSettingEnableZoom);
mIconManager = new BrowserIconManager();
if(status.sSettingTrackingProtection == 1){
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.DEFAULT);
}else if(status.sSettingTrackingProtection == 2){
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT);
}
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mSession.getSettings().setFullAccessibilityTree(true);
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE );
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
onUpdateFont();
onReload(mNestedGeckoView, pcontext);
}
public void resetSession(){
mSessionID = strings.GENERIC_EMPTY_STR;
}
public String getTheme(){
if(mSessionID.equals(strings.GENERIC_EMPTY_STR)){
return null;
}else {
return mSession.getTheme();
}
}
public void initSession(geckoSession mSession){
mSessionID = mSession.getSessionID();
this.mSession = mSession;
}
public geckoSession getSession(){
return mSession;
}
public void onUploadRequest(int resultCode,Intent data){
mSession.onFileUploadRequest(resultCode,data);
}
public void setLoading(boolean status){
mSession.setLoading(status);
}
public void initURL(String url) {
mSession.initURL(url);
}
public void loadURL(String url, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext) {
mSession = (geckoSession)mNestedGeckoView.getSession();
if(mSession==null){
return;
}
if(mSession.onGetInitializeFromStartup()){
mSession.initURL(url);
if(!url.startsWith(CONST_REPORT_URL) && (url.startsWith("https://genesishiddentechnologies.com/?pG") || url.startsWith("https://genesishiddentechnologies.com?pG") || url.endsWith("genesishiddentechnologies.com") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED))){
try{
mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL);
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){
String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
mSession.getSettings().setAllowJavascript(true);
mSession.initURL(mURL);
mSession.loadUri(mURL);
}else {
String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
mSession.getSettings().setAllowJavascript(true);
mSession.loadUri(mURL);
}
}catch (Exception ex){
ex.printStackTrace();
}
}else if(url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)){
try{
mSession.initURL(constants.CONST_GENESIS_HELP_URL);
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){
mSession.getSettings().setAllowJavascript(true);
mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE);
}else {
mSession.getSettings().setAllowJavascript(true);
mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE_DARK);
}
}catch (Exception ex){
ex.printStackTrace();
}
}else {
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
mSession.loadUri(url);
}
}
}
public void onRedrawPixel(AppCompatActivity pcontext){
mSession.onRedrawPixel();
onLoadFavIcon(pcontext);
}
public boolean isLoaded(){
return mSession.isLoaded();
}
public void onClearSiteData(){
mRuntime.getStorageController().clearData(SITE_SETTINGS);
mRuntime.getStorageController().clearData(SITE_DATA);
}
public void onClearSession(){
mRuntime.getStorageController().clearData(AUTH_SESSIONS);
mRuntime.getStorageController().clearData(PERMISSIONS);
}
public void onClearCache(){
mRuntime.getStorageController().clearData(NETWORK_CACHE);
mRuntime.getStorageController().clearData(IMAGE_CACHE);
mRuntime.getStorageController().clearData(DOM_STORAGES);
}
public void onClearCookies(){
mRuntime.getStorageController().clearData(COOKIES);
}
public void onBackPressed(boolean isFinishAllowed, int mTabSize, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
if(mSession.canGoBack()){
mSession.goBackSession();
mSession.onUpdateBannerAdvert();
}
else if(isFinishAllowed){
if(mSession.getRemovableFromBackPressed() && mTabSize>1){
event.invokeObserver(null, enums.etype.M_CLOSE_TAB);
}else {
event.invokeObserver(null, enums.etype.back_list_empty);
}
}
}
public boolean wasPreviousErrorPage(){
return mSession.wasPreviousErrorPage();
}
public boolean canGoForward(){
return mSession.canGoForward();
}
public boolean isLoading(){
return mSession.isLoading();
}
public Uri getUriPermission(){
return mSession.getUriPermission();
}
public boolean getFullScreenStatus(){
return mSession.getFullScreenStatus();
}
public void onExitFullScreen(){
mSession.exitScreen();
}
public void onForwardPressed(){
if(mSession.canGoForward()){
mSession.goForwardSession();
}
}
public void onClose(){
mSession.onClose();
}
public void setRemovableFromBackPressed(boolean pStatus){
mSession.setRemovableFromBackPressed(pStatus);
}
public void onStop(){
mSession.stop();
}
public void onReload(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
mSession.stop();
String url = mSession.getCurrentURL();
if(url.startsWith("https://genesishiddentechnologies.com/?pG") || url.startsWith("https://genesishiddentechnologies.com?pG") || url.endsWith("genesishiddentechnologies.com") || url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)){
loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext);
}else{
mSession.reload();
}
}
public void onReloadStatic(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
///mSession.stop();
loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext);
}
public void manual_download(String url, AppCompatActivity context){
Uri downloadURL = Uri.parse(url);
File f = new File(url);
f.getName();
String downloadFile = f.getName();
/*EXTERNAL STORAGE REQUEST*/
if(helperMethod.checkPermissions(context)){
mSession.downloadRequestedFile(downloadURL,downloadFile);
}
}
public void manualDownloadWithName(String url, String file, AppCompatActivity context){
Uri downloadURL = Uri.parse(url);
/*EXTERNAL STORAGE REQUEST*/
if(helperMethod.checkPermissions(context)){
mSession.downloadRequestedFile(downloadURL,file);
}
}
public void downloadFile(AppCompatActivity pcontext)
{
if(helperMethod.checkPermissions(pcontext)){
mSession.downloadRequestedFile();
}
}
public void downloadFile(String mURL, AppCompatActivity pcontext)
{
if(helperMethod.checkPermissions(pcontext)){
mSession.downloadRequestedFile();
}
}
/*Session Updates*/
public void onUpdateFont(){
float font = (status.sSettingFontSize -100)/3+100;
mRuntime.getSettings().setFontSizeFactor(font/100);
}
public void reinitHomeTheme(){
String mURLFinal;
mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL);
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(activityContextManager.getInstance().getHomeController())){
String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
mSession.getSettings().setAllowJavascript(true);
mSession.initURL(mURL);
mURLFinal = mURL;
}else {
String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
mSession.getSettings().setAllowJavascript(true);
mSession.initURL(mURL);
mURLFinal = mURL;
}
if(!mSession.canGoBack()){
activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession();
mSession.close();
mSession.open(mRuntime);
activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession);
}else {
mSession.goBack();
}
new Handler().postDelayed(() ->
{
if(!mSession.canGoBack()){
mSession.close();
activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession();
mSession.open(mRuntime);
activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession);
}
mSession.loadUri(mURLFinal);
}, 10);
}
public class geckoViewClientCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
if(e_type.equals(enums.etype.M_CHANGE_HOME_THEME)){
reinitHomeTheme();
}
else if(mSession!=null && mSession.isClosed()){
return null;
}else if(mSession!=null) {
if(e_type.equals(enums.etype.SESSION_ID)){
return mSession.getSessionID();
}
else if (mSessionID!=null && mSessionID.equals(data.get(1)) || e_type.equals(enums.etype.M_RATE_COUNT) || e_type.equals(enums.etype.FINDER_RESULT_CALLBACK) || e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE) || e_type.equals(enums.etype.on_update_favicon) ||e_type.equals(enums.etype.on_update_history) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url))
{
if (e_type.equals(on_handle_external_intent))
{
try {
WebResponse responseInfo = (WebResponse)data.get(0);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.headers.get("Content-Type"));
activityContextManager.getInstance().getHomeController().startActivity(intent);
}catch (Exception ex){
Log.i("ex","ex");
}
} else
{
return event.invokeObserver(data, e_type);
}
}
}
return null;
}
}
}
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import android.util.Log;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.BrowserIconManager;
import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.io.File;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
import static com.darkweb.genesissearchengine.constants.constants.CONST_REPORT_URL;
import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS;
import static org.mozilla.geckoview.StorageController.ClearFlags.COOKIES;
import static org.mozilla.geckoview.StorageController.ClearFlags.DOM_STORAGES;
import static org.mozilla.geckoview.StorageController.ClearFlags.IMAGE_CACHE;
import static org.mozilla.geckoview.StorageController.ClearFlags.NETWORK_CACHE;
import static org.mozilla.geckoview.StorageController.ClearFlags.PERMISSIONS;
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_DATA;
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_SETTINGS;
import org.mozilla.geckoview.ContentBlocking;
import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoView;
import org.mozilla.geckoview.WebResponse;
public class geckoClients
{
/*Gecko Variables*/
private geckoSession mSession = null;
private GeckoRuntime mRuntime = null;
private BrowserIconManager mIconManager;
private eventObserver.eventListener event;
/*Local Variable*/
private String mSessionID;
public void initialize(GeckoView geckoView, eventObserver.eventListener event, AppCompatActivity context, boolean isForced)
{
this.event = event;
mSessionID = helperMethod.createRandomID();
initRuntimeSettings(context);
if(!isForced && geckoView.getSession()!=null && geckoView.getSession().isOpen()){
mSession = (geckoSession) geckoView.getSession();
}
else {
geckoView.releaseSession();
mSession = new geckoSession(new geckoViewClientCallback(),mSessionID,context, geckoView);
mSession.open(mRuntime);
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mSession.getSettings().setFullAccessibilityTree(true);
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
geckoView.setSession(mSession);
}
mSession.onSetInitializeFromStartup();
onUpdateFont();
}
public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
boolean mStatus = mSession.onValidateInitializeFromStartup();
if(mStatus){
boolean mState = mSession.onRestoreState();
if(!mState){
new Handler().postDelayed(() ->
{
mSession.stop();
mSession.loadUri(mSession.getCurrentURL());
}, 500);
}else {
String mURL = mSession.getCurrentURL();
if(mURL.equals("https://genesishiddentechnologies.com") || mURL.startsWith(CONST_GENESIS_URL_CACHED) || mURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){
if(!mSession.canGoBack()){
mNestedGeckoView.releaseSession();
mSession.close();
mSession.open(mRuntime);
mNestedGeckoView.setSession(mSession);
}else {
mSession.goBack();
}
loadURL("genesishiddentechnologies.com", mNestedGeckoView, pcontext);
}
}
}
}
public geckoSession initFreeSession(GeckoView pGeckoView, AppCompatActivity pcontext, eventObserver.eventListener event){
this.event = event;
initRuntimeSettings(pcontext);
geckoSession mTempSession = new geckoSession(new geckoViewClientCallback(),mSessionID,pcontext, pGeckoView);
mTempSession.open(mRuntime);
mTempSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mTempSession.getSettings().setFullAccessibilityTree(true);
mTempSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
mTempSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
return mTempSession;
}
public void onDestroy(){
mSession.onDestroy();
mSession = null;
mRuntime = null;
mIconManager = null;
event = null;
}
public GeckoRuntime getmRuntime(){
return mRuntime;
}
public void onSessionReinit(){
mSession.onSessionReinit();
}
public void toogleUserAgent(){
mSession.toogleUserAgent();
}
public int getUserAgent(){
return mSession.getUserAgentMode();
}
@SuppressLint("WrongConstant")
public void initRuntimeSettings(AppCompatActivity context){
if(mRuntime==null){
mRuntime = GeckoRuntime.getDefault(context.getApplicationContext());
mRuntime.getSettings().setAboutConfigEnabled(true);
mRuntime.getSettings().setAboutConfigEnabled(true);
mRuntime.getSettings().setAutomaticFontSizeAdjustment(false);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
mRuntime.getSettings().setForceUserScalableEnabled(status.sSettingEnableZoom);
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT);
mIconManager = new BrowserIconManager();
if(status.sSettingTrackingProtection == 1){
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.DEFAULT);
}else if(status.sSettingTrackingProtection == 2){
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT);
}
}
}
public void onGetFavIcon(ImageView pImageView, String pURL, AppCompatActivity pcontext){
pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL));
mIconManager.onLoadIconIntoView(pcontext,mRuntime, pImageView, pURL);
}
public void onLoadFavIcon(AppCompatActivity pcontext){
BrowserIconManager mIconManager = new BrowserIconManager();
mIconManager.onLoadIcon(pcontext.getApplicationContext(), mRuntime);
}
private int getCookiesBehaviour(){
return status.sSettingCookieStatus;
}
@SuppressLint("WrongConstant")
public void updateSetting(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
mRuntime.getSettings().setRemoteDebuggingEnabled(false);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
mRuntime.getSettings().setAutomaticFontSizeAdjustment(false);
mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
mRuntime.getSettings().setForceUserScalableEnabled(status.sSettingEnableZoom);
mIconManager = new BrowserIconManager();
if(status.sSettingTrackingProtection == 1){
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.DEFAULT);
}else if(status.sSettingTrackingProtection == 2){
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT);
}
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mSession.getSettings().setFullAccessibilityTree(true);
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE );
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
onUpdateFont();
onReload(mNestedGeckoView, pcontext);
}
public void resetSession(){
mSessionID = strings.GENERIC_EMPTY_STR;
}
public String getTheme(){
if(mSessionID.equals(strings.GENERIC_EMPTY_STR)){
return null;
}else {
return mSession.getTheme();
}
}
public void initSession(geckoSession mSession){
mSessionID = mSession.getSessionID();
this.mSession = mSession;
}
public geckoSession getSession(){
return mSession;
}
public void onUploadRequest(int resultCode,Intent data){
mSession.onFileUploadRequest(resultCode,data);
}
public void setLoading(boolean status){
mSession.setLoading(status);
}
public void initURL(String url) {
mSession.initURL(url);
}
public void loadURL(String url, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext) {
mSession = (geckoSession)mNestedGeckoView.getSession();
if(mSession==null){
return;
}
if(mSession.onGetInitializeFromStartup()){
mSession.initURL(url);
if(!url.startsWith(CONST_REPORT_URL) && (url.startsWith("https://genesishiddentechnologies.com/?pG") || url.startsWith("https://genesishiddentechnologies.com?pG") || url.endsWith("genesishiddentechnologies.com") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED))){
try{
mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL);
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){
String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
mSession.getSettings().setAllowJavascript(true);
mSession.initURL(mURL);
mSession.loadUri(mURL);
}else {
String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
mSession.getSettings().setAllowJavascript(true);
mSession.loadUri(mURL);
}
}catch (Exception ex){
ex.printStackTrace();
}
}else if(url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)){
try{
mSession.initURL(constants.CONST_GENESIS_HELP_URL);
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){
mSession.getSettings().setAllowJavascript(true);
mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE);
}else {
mSession.getSettings().setAllowJavascript(true);
mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE_DARK);
}
}catch (Exception ex){
ex.printStackTrace();
}
}else {
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
mSession.loadUri(url);
}
}
}
public void onRedrawPixel(AppCompatActivity pcontext){
mSession.onRedrawPixel();
onLoadFavIcon(pcontext);
}
public boolean isLoaded(){
return mSession.isLoaded();
}
public void onClearSiteData(){
mRuntime.getStorageController().clearData(SITE_SETTINGS);
mRuntime.getStorageController().clearData(SITE_DATA);
}
public void onClearSession(){
mRuntime.getStorageController().clearData(AUTH_SESSIONS);
mRuntime.getStorageController().clearData(PERMISSIONS);
}
public void onClearCache(){
mRuntime.getStorageController().clearData(NETWORK_CACHE);
mRuntime.getStorageController().clearData(IMAGE_CACHE);
mRuntime.getStorageController().clearData(DOM_STORAGES);
}
public void onClearCookies(){
mRuntime.getStorageController().clearData(COOKIES);
}
public void onBackPressed(boolean isFinishAllowed, int mTabSize, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
if(mSession.canGoBack()){
mSession.goBackSession();
mSession.onUpdateBannerAdvert();
}
else if(isFinishAllowed){
if(mSession.getRemovableFromBackPressed() && mTabSize>1){
event.invokeObserver(null, enums.etype.M_CLOSE_TAB);
}else {
event.invokeObserver(null, enums.etype.back_list_empty);
}
}
}
public boolean wasPreviousErrorPage(){
return mSession.wasPreviousErrorPage();
}
public boolean canGoForward(){
return mSession.canGoForward();
}
public boolean isLoading(){
return mSession.isLoading();
}
public Uri getUriPermission(){
return mSession.getUriPermission();
}
public boolean getFullScreenStatus(){
return mSession.getFullScreenStatus();
}
public void onExitFullScreen(){
mSession.exitScreen();
}
public void onForwardPressed(){
if(mSession.canGoForward()){
mSession.goForwardSession();
}
}
public void onClose(){
mSession.onClose();
}
public void setRemovableFromBackPressed(boolean pStatus){
mSession.setRemovableFromBackPressed(pStatus);
}
public void onStop(){
mSession.stop();
}
public void onReload(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
mSession.stop();
String url = mSession.getCurrentURL();
if(url.startsWith("https://genesishiddentechnologies.com/?pG") || url.startsWith("https://genesishiddentechnologies.com?pG") || url.endsWith("genesishiddentechnologies.com") || url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)){
loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext);
}else{
mSession.reload();
}
}
public void onReloadStatic(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
///mSession.stop();
loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext);
}
public void manual_download(String url, AppCompatActivity context){
Uri downloadURL = Uri.parse(url);
File f = new File(url);
f.getName();
String downloadFile = f.getName();
/*EXTERNAL STORAGE REQUEST*/
if(helperMethod.checkPermissions(context)){
mSession.downloadRequestedFile(downloadURL,downloadFile);
}
}
public void manualDownloadWithName(String url, String file, AppCompatActivity context){
Uri downloadURL = Uri.parse(url);
/*EXTERNAL STORAGE REQUEST*/
if(helperMethod.checkPermissions(context)){
mSession.downloadRequestedFile(downloadURL,file);
}
}
public void downloadFile(AppCompatActivity pcontext)
{
if(helperMethod.checkPermissions(pcontext)){
mSession.downloadRequestedFile();
}
}
public void downloadFile(String mURL, AppCompatActivity pcontext)
{
if(helperMethod.checkPermissions(pcontext)){
mSession.downloadRequestedFile();
}
}
/*Session Updates*/
public void onUpdateFont(){
float font = (status.sSettingFontSize -100)/3+100;
mRuntime.getSettings().setFontSizeFactor(font/100);
}
public void reinitHomeTheme(){
String mURLFinal;
mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL);
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(activityContextManager.getInstance().getHomeController())){
String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
mSession.getSettings().setAllowJavascript(true);
mSession.initURL(mURL);
mURLFinal = mURL;
}else {
String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
mSession.getSettings().setAllowJavascript(true);
mSession.initURL(mURL);
mURLFinal = mURL;
}
if(!mSession.canGoBack()){
activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession();
mSession.close();
mSession.open(mRuntime);
activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession);
}else {
mSession.goBack();
}
new Handler().postDelayed(() ->
{
if(!mSession.canGoBack()){
mSession.close();
activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession();
mSession.open(mRuntime);
activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession);
}
mSession.loadUri(mURLFinal);
}, 10);
}
public class geckoViewClientCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
if(e_type.equals(enums.etype.M_CHANGE_HOME_THEME)){
reinitHomeTheme();
}
else if(mSession!=null && mSession.isClosed()){
return null;
}else if(mSession!=null) {
if(e_type.equals(enums.etype.SESSION_ID)){
return mSession.getSessionID();
}
else if (mSessionID!=null && mSessionID.equals(data.get(1)) || e_type.equals(enums.etype.M_RATE_COUNT) || e_type.equals(enums.etype.FINDER_RESULT_CALLBACK) || e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE) || e_type.equals(enums.etype.on_update_favicon) ||e_type.equals(enums.etype.on_update_history) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url))
{
if (e_type.equals(on_handle_external_intent))
{
try {
WebResponse responseInfo = (WebResponse)data.get(0);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.headers.get("Content-Type"));
activityContextManager.getInstance().getHomeController().startActivity(intent);
}catch (Exception ex){
Log.i("ex","ex");
}
} else
{
return event.invokeObserver(data, e_type);
}
}
}
return null;
}
}
}

View File

@ -1,69 +1,69 @@
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import android.Manifest;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.eventObserver;
import org.mozilla.geckoview.WebResponse;
import java.util.Arrays;
import mozilla.components.support.utils.DownloadUtils;
class geckoDownloadManager
{
private Uri downloadURL;
private String downloadFile = strings.GENERIC_EMPTY_STR;
geckoDownloadManager(){
}
void downloadFile(WebResponse response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) {
session
.getUserAgent()
.accept(userAgent -> downloadFile(response, userAgent,context,session,event),
exception -> {
throw new IllegalStateException("Could not get UserAgent string.");
});
}
private void downloadFile(WebResponse response, String userAgent, AppCompatActivity context, geckoSession session, eventObserver.eventListener event) {
if (ContextCompat.checkSelfPermission(context,
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(context,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
3);
return;
}
try{
String mFileName = DownloadUtils.guessFileName(response.headers.get("Content-Disposition"),"",response.uri,null);
downloadURL = Uri.parse(response.uri);
downloadFile = mFileName;
}catch (Exception ex){
ex.printStackTrace();
Log.i("sadsad",ex.getMessage());
}
event.invokeObserver(Arrays.asList(0,session.getSessionID()), enums.etype.progress_update);
event.invokeObserver(Arrays.asList(downloadFile.toString(),session.getSessionID(),downloadURL.toString()), enums.etype.download_file_popup);
}
Uri getDownloadURL(){
return downloadURL;
}
String getDownloadFile(){
return downloadFile;
}
}
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import android.Manifest;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.eventObserver;
import org.mozilla.geckoview.WebResponse;
import java.util.Arrays;
import mozilla.components.support.utils.DownloadUtils;
class geckoDownloadManager
{
private Uri downloadURL;
private String downloadFile = strings.GENERIC_EMPTY_STR;
geckoDownloadManager(){
}
void downloadFile(WebResponse response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) {
session
.getUserAgent()
.accept(userAgent -> downloadFile(response, userAgent,context,session,event),
exception -> {
throw new IllegalStateException("Could not get UserAgent string.");
});
}
private void downloadFile(WebResponse response, String userAgent, AppCompatActivity context, geckoSession session, eventObserver.eventListener event) {
if (ContextCompat.checkSelfPermission(context,
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(context,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
3);
return;
}
try{
String mFileName = DownloadUtils.guessFileName(response.headers.get("Content-Disposition"),"",response.uri,null);
downloadURL = Uri.parse(response.uri);
downloadFile = mFileName;
}catch (Exception ex){
ex.printStackTrace();
Log.i("sadsad",ex.getMessage());
}
event.invokeObserver(Arrays.asList(0,session.getSessionID()), enums.etype.progress_update);
event.invokeObserver(Arrays.asList(downloadFile.toString(),session.getSessionID(),downloadURL.toString()), enums.etype.download_file_popup);
}
Uri getDownloadURL(){
return downloadURL;
}
String getDownloadFile(){
return downloadFile;
}
}

View File

@ -1,447 +1,448 @@
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import android.util.Log;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.GeckoSession;
/**
* Class that implements a basic SelectionActionDelegate. This class is used by GeckoView by
* default if the consumer does not explicitly set a SelectionActionDelegate.
*
* To provide custom actions, extend this class and override the following methods,
*
* 1) Override {@link #getAllActions} to include custom action IDs in the returned array. This
* array must include all actions, available or not, and must not change over the class lifetime.
*
* 2) Override {@link #isActionAvailable} to return whether a custom action is currently available.
*
* 3) Override {@link #prepareAction} to set custom title and/or icon for a custom action.
*
* 4) Override {@link #performAction} to perform a custom action when used.
*/
@UiThread
public class selectionActionDelegate implements ActionMode.Callback,
GeckoSession.SelectionActionDelegate {
private static final String LOGTAG = "BasicSelectionAction";
protected static final String ACTION_PROCESS_TEXT = Intent.ACTION_PROCESS_TEXT;
private static final String[] FLOATING_TOOLBAR_ACTIONS = new String[] {
ACTION_CUT, ACTION_COPY, ACTION_PASTE, ACTION_SELECT_ALL, ACTION_PROCESS_TEXT, "SEARCH"
};
private static final String[] FIXED_TOOLBAR_ACTIONS = new String[] {
ACTION_SELECT_ALL, ACTION_CUT, ACTION_COPY, ACTION_PASTE,"SEARCH"
};
protected final @NonNull Activity mActivity;
protected final boolean mUseFloatingToolbar;
protected final @NonNull Matrix mTempMatrix = new Matrix();
protected final @NonNull RectF mTempRect = new RectF();
private boolean mExternalActionsEnabled;
protected @Nullable ActionMode mActionMode;
protected @Nullable GeckoSession mSession;
protected @Nullable Selection mSelection;
protected boolean mRepopulatedMenu;
@TargetApi(Build.VERSION_CODES.M)
private class Callback2Wrapper extends ActionMode.Callback2 {
@Override
public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) {
return selectionActionDelegate.this.onCreateActionMode(actionMode, menu);
}
@Override
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
return selectionActionDelegate.this.onPrepareActionMode(actionMode, menu);
}
@Override
public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) {
return selectionActionDelegate.this.onActionItemClicked(actionMode, menuItem);
}
@Override
public void onDestroyActionMode(final ActionMode actionMode) {
selectionActionDelegate.this.onDestroyActionMode(actionMode);
}
@Override
public void onGetContentRect(final ActionMode mode, final View view, final Rect outRect) {
super.onGetContentRect(mode, view, outRect);
selectionActionDelegate.this.onGetContentRect(mode, view, outRect);
}
}
@SuppressWarnings("checkstyle:javadocmethod")
public selectionActionDelegate(final @NonNull Activity activity) {
this(activity, Build.VERSION.SDK_INT >= 23);
}
@SuppressWarnings("checkstyle:javadocmethod")
public selectionActionDelegate(final @NonNull Activity activity,
final boolean useFloatingToolbar) {
mActivity = activity;
mUseFloatingToolbar = useFloatingToolbar;
mExternalActionsEnabled = true;
}
/**
* Set whether to include text actions from other apps in the floating toolbar.
*
* @param enable True if external actions should be enabled.
*/
public void enableExternalActions(final boolean enable) {
ThreadUtils.assertOnUiThread();
mExternalActionsEnabled = enable;
if (mActionMode != null) {
mActionMode.invalidate();
}
}
/**
* Get whether text actions from other apps are enabled.
*
* @return True if external actions are enabled.
*/
public boolean areExternalActionsEnabled() {
return mExternalActionsEnabled;
}
/**
* Return list of all actions in proper order, regardless of their availability at present.
* Override to add to or remove from the default set.
*
* @return Array of action IDs in proper order.
*/
protected @NonNull String[] getAllActions() {
return mUseFloatingToolbar ? FLOATING_TOOLBAR_ACTIONS
: FIXED_TOOLBAR_ACTIONS;
}
/**
* Return whether an action is presently available. Override to indicate
* availability for custom actions.
*
* @param id Action ID.
* @return True if the action is presently available.
*/
protected boolean isActionAvailable(final @NonNull String id) {
if (mSelection == null) {
return false;
}
if (mExternalActionsEnabled && !mSelection.text.isEmpty() &&
ACTION_PROCESS_TEXT.equals(id)) {
final PackageManager pm = mActivity.getPackageManager();
return pm.resolveActivity(getProcessTextIntent(),
PackageManager.MATCH_DEFAULT_ONLY) != null;
}
if(id.equals("SEARCH")){
return true;
}
return mSelection.isActionAvailable(id);
}
/**
* Provides access to whether there are text selection actions available. Override to indicate
* availability for custom actions.
*
* @return True if there are text selection actions available.
*/
public boolean isActionAvailable() {
if (mSelection == null) {
return false;
}
return isActionAvailable(ACTION_PROCESS_TEXT) ||
!mSelection.availableActions.isEmpty();
}
/**
* Prepare a menu item corresponding to a certain action. Override to prepare
* menu item for custom action.
*
* @param id Action ID.
* @param item New menu item to prepare.
*/
protected void prepareAction(final @NonNull String id, final @NonNull MenuItem item) {
switch (id) {
case ACTION_CUT:
item.setTitle(android.R.string.cut);
break;
case ACTION_COPY:
item.setTitle(android.R.string.copy);
break;
case "SEARCH":
item.setTitle("Search");
break;
case ACTION_PASTE:
item.setTitle(android.R.string.paste);
break;
case ACTION_SELECT_ALL:
item.setTitle(android.R.string.selectAll);
break;
case ACTION_PROCESS_TEXT:
throw new IllegalStateException("Unexpected action");
}
}
/**
* Perform the specified action. Override to perform custom actions.
*
* @param id Action ID.
* @param item Nenu item for the action.
* @return True if the action was performed.
*/
protected boolean performAction(final @NonNull String id, final @NonNull MenuItem item) {
if (ACTION_PROCESS_TEXT.equals(id)) {
try {
mActivity.startActivity(item.getIntent());
} catch (final ActivityNotFoundException e) {
Log.e(LOGTAG, "Cannot perform action", e);
return false;
}
return true;
}
if (mSelection == null) {
return false;
}
if (id.equals("SEARCH")) {
activityContextManager.getInstance().getHomeController().onSearchString(mSelection.text);
mActionMode.finish();
return false;
}
mSelection.execute(id);
// Android behavior is to clear selection on copy.
if (ACTION_COPY.equals(id)) {
if (mUseFloatingToolbar) {
clearSelection();
} else {
mActionMode.finish();
}
}
return true;
}
/**
* Get the current selection object. This object should not be stored as it does not update
* when the selection becomes invalid. Stale actions are ignored.
*
* @return The {@link GeckoSession.SelectionActionDelegate.Selection} attached to the current
* action menu. <code>null</code> if no action menu is active.
*/
public @Nullable Selection getSelection() {
return mSelection;
}
/**
* Clear the current selection, if possible.
*/
public void clearSelection() {
if (mSelection == null) {
return;
}
if (isActionAvailable(ACTION_COLLAPSE_TO_END)) {
mSelection.collapseToEnd();
} else if (isActionAvailable(ACTION_UNSELECT)) {
mSelection.unselect();
} else {
mSelection.hide();
}
}
private Intent getProcessTextIntent() {
final Intent intent = new Intent(Intent.ACTION_PROCESS_TEXT);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_PROCESS_TEXT, mSelection.text);
// TODO: implement ability to replace text in Gecko for editable selection (bug 1453137).
intent.putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true);
return intent;
}
@Override
public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) {
ThreadUtils.assertOnUiThread();
final String[] allActions = getAllActions();
for (final String actionId : allActions) {
if (isActionAvailable(actionId)) {
if (!mUseFloatingToolbar && (
Build.VERSION.SDK_INT == 22 || Build.VERSION.SDK_INT == 23)) {
// Android bug where onPrepareActionMode is not called initially.
onPrepareActionMode(actionMode, menu);
}
return true;
}
}
return false;
}
@Override
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
ThreadUtils.assertOnUiThread();
final String[] allActions = getAllActions();
boolean changed = false;
// Whether we are repopulating an existing menu.
mRepopulatedMenu = menu.size() != 0;
// For each action, see if it's available at present, and if necessary,
// add to or remove from menu.
for (int i = 0; i < allActions.length; i++) {
final String actionId = allActions[i];
final int menuId = i + Menu.FIRST;
if (ACTION_PROCESS_TEXT.equals(actionId)) {
if (mExternalActionsEnabled && !mSelection.text.isEmpty()) {
menu.addIntentOptions(menuId, menuId, menuId,
mActivity.getComponentName(),
/* specifiec */ null, getProcessTextIntent(),
/* flags */ 0, /* items */ null);
changed = true;
} else if (menu.findItem(menuId) != null) {
menu.removeGroup(menuId);
changed = true;
}
continue;
}
if (isActionAvailable(actionId)) {
if (menu.findItem(menuId) == null) {
prepareAction(actionId, menu.add(/* group */ Menu.NONE, menuId,
menuId, /* title */ ""));
changed = true;
}
} else if (menu.findItem(menuId) != null) {
menu.removeItem(menuId);
changed = true;
}
}
return changed;
}
@Override
public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) {
ThreadUtils.assertOnUiThread();
MenuItem realMenuItem = null;
if (mRepopulatedMenu) {
// When we repopulate an existing menu, Android can sometimes give us an old,
// deleted MenuItem. Find the current MenuItem that corresponds to the old one.
final Menu menu = actionMode.getMenu();
final int size = menu.size();
for (int i = 0; i < size; i++) {
final MenuItem item = menu.getItem(i);
if (item == menuItem || (item.getItemId() == menuItem.getItemId() &&
item.getTitle().equals(menuItem.getTitle()))) {
realMenuItem = item;
break;
}
}
} else {
realMenuItem = menuItem;
}
if (realMenuItem == null) {
return false;
}
final String[] allActions = getAllActions();
return performAction(allActions[realMenuItem.getItemId() - Menu.FIRST], realMenuItem);
}
@Override
public void onDestroyActionMode(final ActionMode actionMode) {
ThreadUtils.assertOnUiThread();
if (!mUseFloatingToolbar) {
clearSelection();
}
mSession = null;
mSelection = null;
mActionMode = null;
}
@SuppressWarnings("checkstyle:javadocmethod")
public void onGetContentRect(final @Nullable ActionMode mode, final @Nullable View view,
final @NonNull Rect outRect) {
ThreadUtils.assertOnUiThread();
if (mSelection == null || mSelection.clientRect == null) {
return;
}
mSession.getClientToScreenMatrix(mTempMatrix);
mTempMatrix.mapRect(mTempRect, mSelection.clientRect);
mTempRect.roundOut(outRect);
}
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onShowActionRequest(final GeckoSession session, final Selection selection) {
ThreadUtils.assertOnUiThread();
mSession = session;
mSelection = selection;
if (mActionMode != null) {
if (isActionAvailable()) {
mActionMode.invalidate();
} else {
mActionMode.finish();
}
return;
}
if (mUseFloatingToolbar) {
mActionMode = mActivity.startActionMode(new Callback2Wrapper(),
ActionMode.TYPE_FLOATING);
} else {
mActionMode = mActivity.startActionMode(this);
}
}
@Override
public void onHideAction(final GeckoSession session, final int reason) {
ThreadUtils.assertOnUiThread();
if (mActionMode == null) {
return;
}
switch (reason) {
case HIDE_REASON_ACTIVE_SCROLL:
case HIDE_REASON_ACTIVE_SELECTION:
case HIDE_REASON_INVISIBLE_SELECTION:
if (mUseFloatingToolbar) {
// Hide the floating toolbar when scrolling/selecting.
mActionMode.finish();
}
break;
case HIDE_REASON_NO_SELECTION:
mActionMode.finish();
break;
}
}
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import android.util.Log;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.GeckoSession;
/**
* Class that implements a basic SelectionActionDelegate. This class is used by GeckoView by
* default if the consumer does not explicitly set a SelectionActionDelegate.
*
* To provide custom actions, extend this class and override the following methods,
*
* 1) Override {@link #getAllActions} to include custom action IDs in the returned array. This
* array must include all actions, available or not, and must not change over the class lifetime.
*
* 2) Override {@link #isActionAvailable} to return whether a custom action is currently available.
*
* 3) Override {@link #prepareAction} to set custom title and/or icon for a custom action.
*
* 4) Override {@link #performAction} to perform a custom action when used.
*/
@UiThread
public class selectionActionDelegate implements ActionMode.Callback,
GeckoSession.SelectionActionDelegate {
private static final String LOGTAG = "BasicSelectionAction";
protected static final String ACTION_PROCESS_TEXT = Intent.ACTION_PROCESS_TEXT;
private static final String[] FLOATING_TOOLBAR_ACTIONS = new String[] {
ACTION_CUT, ACTION_COPY, ACTION_PASTE, ACTION_SELECT_ALL, "SEARCH"
};
private static final String[] FIXED_TOOLBAR_ACTIONS = new String[] {
ACTION_SELECT_ALL, ACTION_CUT, ACTION_COPY, ACTION_PASTE,"SEARCH"
};
protected final @NonNull Activity mActivity;
protected final boolean mUseFloatingToolbar;
protected final @NonNull Matrix mTempMatrix = new Matrix();
protected final @NonNull RectF mTempRect = new RectF();
private boolean mExternalActionsEnabled;
protected @Nullable ActionMode mActionMode;
protected @Nullable GeckoSession mSession;
protected @Nullable Selection mSelection;
protected boolean mRepopulatedMenu;
@TargetApi(Build.VERSION_CODES.M)
private class Callback2Wrapper extends ActionMode.Callback2 {
@Override
public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) {
return selectionActionDelegate.this.onCreateActionMode(actionMode, menu);
}
@Override
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
return selectionActionDelegate.this.onPrepareActionMode(actionMode, menu);
}
@Override
public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) {
return selectionActionDelegate.this.onActionItemClicked(actionMode, menuItem);
}
@Override
public void onDestroyActionMode(final ActionMode actionMode) {
selectionActionDelegate.this.onDestroyActionMode(actionMode);
}
@Override
public void onGetContentRect(final ActionMode mode, final View view, final Rect outRect) {
super.onGetContentRect(mode, view, outRect);
selectionActionDelegate.this.onGetContentRect(mode, view, outRect);
}
}
@SuppressWarnings("checkstyle:javadocmethod")
public selectionActionDelegate(final @NonNull Activity activity) {
this(activity, Build.VERSION.SDK_INT >= 23);
}
@SuppressWarnings("checkstyle:javadocmethod")
public selectionActionDelegate(final @NonNull Activity activity,
final boolean useFloatingToolbar) {
mActivity = activity;
mUseFloatingToolbar = useFloatingToolbar;
mExternalActionsEnabled = true;
}
/**
* Set whether to include text actions from other apps in the floating toolbar.
*
* @param enable True if external actions should be enabled.
*/
public void enableExternalActions(final boolean enable) {
ThreadUtils.assertOnUiThread();
mExternalActionsEnabled = enable;
if (mActionMode != null) {
mActionMode.invalidate();
}
}
/**
* Get whether text actions from other apps are enabled.
*
* @return True if external actions are enabled.
*/
public boolean areExternalActionsEnabled() {
return mExternalActionsEnabled;
}
/**
* Return list of all actions in proper order, regardless of their availability at present.
* Override to add to or remove from the default set.
*
* @return Array of action IDs in proper order.
*/
protected @NonNull String[] getAllActions() {
return mUseFloatingToolbar ? FLOATING_TOOLBAR_ACTIONS
: FIXED_TOOLBAR_ACTIONS;
}
/**
* Return whether an action is presently available. Override to indicate
* availability for custom actions.
*
* @param id Action ID.
* @return True if the action is presently available.
*/
protected boolean isActionAvailable(final @NonNull String id) {
if (mSelection == null) {
return false;
}
if (mExternalActionsEnabled && !mSelection.text.isEmpty() &&
ACTION_PROCESS_TEXT.equals(id)) {
final PackageManager pm = mActivity.getPackageManager();
return pm.resolveActivity(getProcessTextIntent(),
PackageManager.MATCH_DEFAULT_ONLY) != null;
}
if(id.equals("SEARCH") && !mSelection.text.isEmpty() && mExternalActionsEnabled){
return true;
}
return mSelection.isActionAvailable(id);
}
/**
* Provides access to whether there are text selection actions available. Override to indicate
* availability for custom actions.
*
* @return True if there are text selection actions available.
*/
public boolean isActionAvailable() {
if (mSelection == null) {
return false;
}
return isActionAvailable(ACTION_PROCESS_TEXT) ||
!mSelection.availableActions.isEmpty();
}
/**
* Prepare a menu item corresponding to a certain action. Override to prepare
* menu item for custom action.
*
* @param id Action ID.
* @param item New menu item to prepare.
*/
protected void prepareAction(final @NonNull String id, final @NonNull MenuItem item) {
switch (id) {
case ACTION_CUT:
item.setTitle(android.R.string.cut);
break;
case ACTION_COPY:
item.setTitle(android.R.string.copy);
break;
case "SEARCH":
item.setTitle("Search");
break;
case ACTION_PASTE:
item.setTitle(android.R.string.paste);
break;
case ACTION_SELECT_ALL:
item.setTitle(android.R.string.selectAll);
break;
case ACTION_PROCESS_TEXT:
throw new IllegalStateException("Unexpected action");
}
}
/**
* Perform the specified action. Override to perform custom actions.
*
* @param id Action ID.
* @param item Nenu item for the action.
* @return True if the action was performed.
*/
protected boolean performAction(final @NonNull String id, final @NonNull MenuItem item) {
if (ACTION_PROCESS_TEXT.equals(id)) {
try {
mActivity.startActivity(item.getIntent());
} catch (final ActivityNotFoundException e) {
Log.e(LOGTAG, "Cannot perform action", e);
return false;
}
return true;
}
if (mSelection == null) {
return false;
}
if (id.equals("SEARCH")) {
activityContextManager.getInstance().getHomeController().onSearchString(mSelection.text);
clearSelection();
mActionMode.finish();
return false;
}
mSelection.execute(id);
// Android behavior is to clear selection on copy.
if (ACTION_COPY.equals(id)) {
if (mUseFloatingToolbar) {
clearSelection();
} else {
mActionMode.finish();
}
}
return true;
}
/**
* Get the current selection object. This object should not be stored as it does not update
* when the selection becomes invalid. Stale actions are ignored.
*
* @return The {@link GeckoSession.SelectionActionDelegate.Selection} attached to the current
* action menu. <code>null</code> if no action menu is active.
*/
public @Nullable Selection getSelection() {
return mSelection;
}
/**
* Clear the current selection, if possible.
*/
public void clearSelection() {
if (mSelection == null) {
return;
}
if (isActionAvailable(ACTION_COLLAPSE_TO_END)) {
mSelection.collapseToEnd();
} else if (isActionAvailable(ACTION_UNSELECT)) {
mSelection.unselect();
} else {
mSelection.hide();
}
}
private Intent getProcessTextIntent() {
final Intent intent = new Intent(Intent.ACTION_PROCESS_TEXT);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_PROCESS_TEXT, mSelection.text);
// TODO: implement ability to replace text in Gecko for editable selection (bug 1453137).
intent.putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true);
return intent;
}
@Override
public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) {
ThreadUtils.assertOnUiThread();
final String[] allActions = getAllActions();
for (final String actionId : allActions) {
if (isActionAvailable(actionId)) {
if (!mUseFloatingToolbar && (
Build.VERSION.SDK_INT == 22 || Build.VERSION.SDK_INT == 23)) {
// Android bug where onPrepareActionMode is not called initially.
onPrepareActionMode(actionMode, menu);
}
return true;
}
}
return false;
}
@Override
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
ThreadUtils.assertOnUiThread();
final String[] allActions = getAllActions();
boolean changed = false;
// Whether we are repopulating an existing menu.
mRepopulatedMenu = menu.size() != 0;
// For each action, see if it's available at present, and if necessary,
// add to or remove from menu.
for (int i = 0; i < allActions.length; i++) {
final String actionId = allActions[i];
final int menuId = i + Menu.FIRST;
if (ACTION_PROCESS_TEXT.equals(actionId)) {
if (mExternalActionsEnabled && !mSelection.text.isEmpty()) {
menu.addIntentOptions(menuId, menuId, menuId,
mActivity.getComponentName(),
/* specifiec */ null, getProcessTextIntent(),
/* flags */ 0, /* items */ null);
changed = true;
} else if (menu.findItem(menuId) != null) {
menu.removeGroup(menuId);
changed = true;
}
continue;
}
if (isActionAvailable(actionId)) {
if (menu.findItem(menuId) == null) {
prepareAction(actionId, menu.add(/* group */ Menu.NONE, menuId,
menuId, /* title */ ""));
changed = true;
}
} else if (menu.findItem(menuId) != null) {
menu.removeItem(menuId);
changed = true;
}
}
return changed;
}
@Override
public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) {
ThreadUtils.assertOnUiThread();
MenuItem realMenuItem = null;
if (mRepopulatedMenu) {
// When we repopulate an existing menu, Android can sometimes give us an old,
// deleted MenuItem. Find the current MenuItem that corresponds to the old one.
final Menu menu = actionMode.getMenu();
final int size = menu.size();
for (int i = 0; i < size; i++) {
final MenuItem item = menu.getItem(i);
if (item == menuItem || (item.getItemId() == menuItem.getItemId() &&
item.getTitle().equals(menuItem.getTitle()))) {
realMenuItem = item;
break;
}
}
} else {
realMenuItem = menuItem;
}
if (realMenuItem == null) {
return false;
}
final String[] allActions = getAllActions();
return performAction(allActions[realMenuItem.getItemId() - Menu.FIRST], realMenuItem);
}
@Override
public void onDestroyActionMode(final ActionMode actionMode) {
ThreadUtils.assertOnUiThread();
if (!mUseFloatingToolbar) {
clearSelection();
}
mSession = null;
mSelection = null;
mActionMode = null;
}
@SuppressWarnings("checkstyle:javadocmethod")
public void onGetContentRect(final @Nullable ActionMode mode, final @Nullable View view,
final @NonNull Rect outRect) {
ThreadUtils.assertOnUiThread();
if (mSelection == null || mSelection.clientRect == null) {
return;
}
mSession.getClientToScreenMatrix(mTempMatrix);
mTempMatrix.mapRect(mTempRect, mSelection.clientRect);
mTempRect.roundOut(outRect);
}
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onShowActionRequest(final GeckoSession session, final Selection selection) {
ThreadUtils.assertOnUiThread();
mSession = session;
mSelection = selection;
if (mActionMode != null) {
if (isActionAvailable()) {
mActionMode.invalidate();
} else {
mActionMode.finish();
}
return;
}
if (mUseFloatingToolbar) {
mActionMode = mActivity.startActionMode(new Callback2Wrapper(),
ActionMode.TYPE_FLOATING);
} else {
mActionMode = mActivity.startActionMode(this);
}
}
@Override
public void onHideAction(final GeckoSession session, final int reason) {
ThreadUtils.assertOnUiThread();
if (mActionMode == null) {
return;
}
switch (reason) {
case HIDE_REASON_ACTIVE_SCROLL:
case HIDE_REASON_ACTIVE_SELECTION:
case HIDE_REASON_INVISIBLE_SELECTION:
if (mUseFloatingToolbar) {
// Hide the floating toolbar when scrolling/selecting.
mActionMode.finish();
}
break;
case HIDE_REASON_NO_SELECTION:
mActionMode.finish();
break;
}
}
}

View File

@ -1,245 +1,245 @@
package com.darkweb.genesissearchengine.appManager.homeManager.hintManager;
import android.annotation.SuppressLint;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.dataManager.models.historyRowModel;
import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder>
{
/*Private Variables*/
private ArrayList<historyRowModel> mHintList;
private AppCompatActivity mContext;
private eventObserver.eventListener mEvent;
private Map<Integer, Drawable> mPastWebIcon = new HashMap<>();
private Map<Integer, String> mPastIconFlicker = new HashMap<>();
public hintAdapter(ArrayList<historyRowModel> pHintList, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pSearch) {
this.mHintList = new ArrayList();
int maxCounter=5;
if(pHintList.size()<maxCounter){
maxCounter = pHintList.size();
}
this.mHintList.addAll(pHintList.subList(0,maxCounter));
this.mContext = pContext;
this.mEvent = pEvent;
}
public void onUpdateAdapter(ArrayList<historyRowModel> pHintList, String pSearch){
mHintList = pHintList;
if(mHintList.size()==1 && mHintList.get(0).getHeader().equals("about:blank")) {
mHintList.clear();
mHintList.add( new historyRowModel("Genesis Search", "genesis.onion",-1));
}
notifyDataSetChanged();
}
public void onClearAdapter(){
//mPastWebIcon.clear();
mPastWebIcon.remove(0);
mPastWebIcon.remove(1);
mPastWebIcon.remove(2);
}
/*Initializations*/
@NonNull @Override
public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.hint_view, parent, false);
return new listViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull hintAdapter.listViewHolder holder, int position)
{
holder.bindListView(mHintList.get(position));
}
@Override
public int getItemCount() {
return mHintList.size();
}
/*Listeners*/
/*View Holder Extensions*/
class listViewHolder extends RecyclerView.ViewHolder implements View.OnTouchListener
{
TextView mHeader;
TextView mHeaderSingle;
TextView mURL;
ImageButton mMoveURL;
ImageView mHindTypeIcon;
ImageView mHintWebIcon = null;
LinearLayout mpHintListener;
ImageView mHindTypeIconTemp;
listViewHolder(View itemView) {
super(itemView);
}
@SuppressLint({"ClickableViewAccessibility", "UseCompatLoadingForDrawables"})
void bindListView(historyRowModel model) {
mHeader = itemView.findViewById(R.id.pHeader);
mHeaderSingle = itemView.findViewById(R.id.pHeaderSingle);
mURL = itemView.findViewById(R.id.pURL);
mHindTypeIcon = itemView.findViewById(R.id.pHindTypeIcon);
mpHintListener = itemView.findViewById(R.id.pHintListener);
mMoveURL = itemView.findViewById(R.id.pMoveURL);
mHintWebIcon = itemView.findViewById(R.id.pHintWebIcon);
mHindTypeIconTemp = new ImageView(mContext);
mHintWebIcon.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v6)));
if(mPastWebIcon.containsKey(getLayoutPosition())){
mHintWebIcon.setImageDrawable(mPastWebIcon.get(getLayoutPosition()));
mHintWebIcon.setImageTintList(null);
}else {
mHintWebIcon.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v8)));
Drawable mDrawable;
Resources res = itemView.getContext().getResources();
try {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_browser));
mMoveURL.setVisibility(View.VISIBLE);
mMoveURL.setOnTouchListener(listViewHolder.this);
mHintWebIcon.setImageDrawable(mDrawable);
} catch (Exception ignored) {
}
}
String mURLLink;
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){
mURLLink = model.getHeader();
mHeaderSingle.setText(model.getHeader().replace("+"," ").replace("%", "+"));
mHeaderSingle.setVisibility(View.VISIBLE);
mHeader.setVisibility(View.GONE);
mURL.setVisibility(View.GONE);
mHintWebIcon.setVisibility(View.GONE);
mHindTypeIcon.setVisibility(View.VISIBLE);
}else {
mURLLink = model.getDescription();
mHeaderSingle.setVisibility(View.GONE);
mHeader.setVisibility(View.VISIBLE);
mURL.setVisibility(View.VISIBLE);
mHintWebIcon.setVisibility(View.VISIBLE);
mHindTypeIcon.setVisibility(View.GONE);
}
mHeader.setText(model.getHeader());
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){
mMoveURL.setTag(model.getHeader());
}else {
mMoveURL.setTag(model.getDescription());
}
mURL.setText(model.getDescription());
Drawable mDrawable = null;
Resources res = itemView.getContext().getResources();
try {
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR) && !model.getHeader().contains(".")){
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_search));
mMoveURL.setVisibility(View.GONE);
}else {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_browser));
mMoveURL.setVisibility(View.VISIBLE);
mMoveURL.setOnTouchListener(listViewHolder.this);
}
} catch (Exception ignored) {
}
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){
mHindTypeIcon.setImageDrawable(mDrawable);
}
mpHintListener.setOnTouchListener(listViewHolder.this);
if(mURLLink.contains("genesishiddentechnologies.com") || mURLLink.contains("genesis.onion")){
mHintWebIcon.setImageTintList(null);
mHintWebIcon.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis));
mPastWebIcon.put(getLayoutPosition(),mHintWebIcon.getDrawable());
}else
{
new Thread(){
public void run(){
try {
String mURLPast = mURLLink;
mPastIconFlicker.put(getLayoutPosition(),mURLPast);
mHindTypeIconTemp.setImageDrawable(null);
mEvent.invokeObserver(Arrays.asList(mHindTypeIconTemp, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon);
sleep(200);
mContext.runOnUiThread(() -> new Handler().postDelayed(() ->
{
if(mHindTypeIconTemp.getDrawable() != null){
if(mURLPast.equals(mPastIconFlicker.get(getLayoutPosition()))){
mHintWebIcon.setImageTintList(null);
mHintWebIcon.setImageDrawable(mHindTypeIconTemp.getDrawable());
mPastWebIcon.put(getLayoutPosition(),mHintWebIcon.getDrawable());
}
if(getLayoutPosition() == 1){
Log.i("FUSSSS1111","FUSSSS4444");
}
}
}, 200));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
}
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent event) {
if(v.getId() == mpHintListener.getId() || v.getId() == mMoveURL.getId()){
if(event.getAction() == MotionEvent.ACTION_MOVE){
helperMethod.hideKeyboard(mContext);
}
}
return false;
}
}
public Object onTrigger(tabEnums.eTabAdapterCommands pCommands, List<Object> pData){
return null;
}
}
package com.darkweb.genesissearchengine.appManager.homeManager.hintManager;
import android.annotation.SuppressLint;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.dataManager.models.historyRowModel;
import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder>
{
/*Private Variables*/
private ArrayList<historyRowModel> mHintList;
private AppCompatActivity mContext;
private eventObserver.eventListener mEvent;
private Map<Integer, Drawable> mPastWebIcon = new HashMap<>();
private Map<Integer, String> mPastIconFlicker = new HashMap<>();
public hintAdapter(ArrayList<historyRowModel> pHintList, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pSearch) {
this.mHintList = new ArrayList();
int maxCounter=5;
if(pHintList.size()<maxCounter){
maxCounter = pHintList.size();
}
this.mHintList.addAll(pHintList.subList(0,maxCounter));
this.mContext = pContext;
this.mEvent = pEvent;
}
public void onUpdateAdapter(ArrayList<historyRowModel> pHintList, String pSearch){
mHintList = pHintList;
if(mHintList.size()==1 && mHintList.get(0).getHeader().equals("about:blank")) {
mHintList.clear();
mHintList.add( new historyRowModel("Genesis Search", "genesis.onion",-1));
}
notifyDataSetChanged();
}
public void onClearAdapter(){
//mPastWebIcon.clear();
mPastWebIcon.remove(0);
mPastWebIcon.remove(1);
mPastWebIcon.remove(2);
}
/*Initializations*/
@NonNull @Override
public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.hint_view, parent, false);
return new listViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull hintAdapter.listViewHolder holder, int position)
{
holder.bindListView(mHintList.get(position));
}
@Override
public int getItemCount() {
return mHintList.size();
}
/*Listeners*/
/*View Holder Extensions*/
class listViewHolder extends RecyclerView.ViewHolder implements View.OnTouchListener
{
TextView mHeader;
TextView mHeaderSingle;
TextView mURL;
ImageButton mMoveURL;
ImageView mHindTypeIcon;
ImageView mHintWebIcon = null;
LinearLayout mpHintListener;
ImageView mHindTypeIconTemp;
listViewHolder(View itemView) {
super(itemView);
}
@SuppressLint({"ClickableViewAccessibility", "UseCompatLoadingForDrawables"})
void bindListView(historyRowModel model) {
mHeader = itemView.findViewById(R.id.pHeader);
mHeaderSingle = itemView.findViewById(R.id.pHeaderSingle);
mURL = itemView.findViewById(R.id.pURL);
mHindTypeIcon = itemView.findViewById(R.id.pHindTypeIcon);
mpHintListener = itemView.findViewById(R.id.pHintListener);
mMoveURL = itemView.findViewById(R.id.pMoveURL);
mHintWebIcon = itemView.findViewById(R.id.pHintWebIcon);
mHindTypeIconTemp = new ImageView(mContext);
mHintWebIcon.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v6)));
if(mPastWebIcon.containsKey(getLayoutPosition())){
mHintWebIcon.setImageDrawable(mPastWebIcon.get(getLayoutPosition()));
mHintWebIcon.setImageTintList(null);
}else {
mHintWebIcon.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v8)));
Drawable mDrawable;
Resources res = itemView.getContext().getResources();
try {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_browser));
mMoveURL.setVisibility(View.VISIBLE);
mMoveURL.setOnTouchListener(listViewHolder.this);
mHintWebIcon.setImageDrawable(mDrawable);
} catch (Exception ignored) {
}
}
String mURLLink;
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){
mURLLink = model.getHeader();
mHeaderSingle.setText(model.getHeader().replace("+"," ").replace("%", "+"));
mHeaderSingle.setVisibility(View.VISIBLE);
mHeader.setVisibility(View.GONE);
mURL.setVisibility(View.GONE);
mHintWebIcon.setVisibility(View.GONE);
mHindTypeIcon.setVisibility(View.VISIBLE);
}else {
mURLLink = model.getDescription();
mHeaderSingle.setVisibility(View.GONE);
mHeader.setVisibility(View.VISIBLE);
mURL.setVisibility(View.VISIBLE);
mHintWebIcon.setVisibility(View.VISIBLE);
mHindTypeIcon.setVisibility(View.GONE);
}
mHeader.setText(model.getHeader());
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){
mMoveURL.setTag(model.getHeader());
}else {
mMoveURL.setTag(model.getDescription());
}
mURL.setText(model.getDescription());
Drawable mDrawable = null;
Resources res = itemView.getContext().getResources();
try {
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR) && !model.getHeader().contains(".")){
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_search));
mMoveURL.setVisibility(View.GONE);
}else {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_browser));
mMoveURL.setVisibility(View.VISIBLE);
mMoveURL.setOnTouchListener(listViewHolder.this);
}
} catch (Exception ignored) {
}
if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){
mHindTypeIcon.setImageDrawable(mDrawable);
}
mpHintListener.setOnTouchListener(listViewHolder.this);
if(mURLLink.contains("genesishiddentechnologies.com") || mURLLink.contains("genesis.onion")){
mHintWebIcon.setImageTintList(null);
mHintWebIcon.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis));
mPastWebIcon.put(getLayoutPosition(),mHintWebIcon.getDrawable());
}else
{
new Thread(){
public void run(){
try {
String mURLPast = mURLLink;
mPastIconFlicker.put(getLayoutPosition(),mURLPast);
mHindTypeIconTemp.setImageDrawable(null);
mEvent.invokeObserver(Arrays.asList(mHindTypeIconTemp, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon);
sleep(200);
mContext.runOnUiThread(() -> new Handler().postDelayed(() ->
{
if(mHindTypeIconTemp.getDrawable() != null){
if(mURLPast.equals(mPastIconFlicker.get(getLayoutPosition()))){
mHintWebIcon.setImageTintList(null);
mHintWebIcon.setImageDrawable(mHindTypeIconTemp.getDrawable());
mPastWebIcon.put(getLayoutPosition(),mHintWebIcon.getDrawable());
}
if(getLayoutPosition() == 1){
Log.i("FUSSSS1111","FUSSSS4444");
}
}
}, 200));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
}
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent event) {
if(v.getId() == mpHintListener.getId() || v.getId() == mMoveURL.getId()){
if(event.getAction() == MotionEvent.ACTION_MOVE){
helperMethod.hideKeyboard(mContext);
}
}
return false;
}
}
public Object onTrigger(tabEnums.eTabAdapterCommands pCommands, List<Object> pData){
return null;
}
}

View File

@ -1,23 +1,23 @@
package com.darkweb.genesissearchengine.appManager.homeManager.hintManager;
public class hintModel
{
/*Private Variables*/
private String mHeader;
private String mURL;
public hintModel(String pHeader, String pURL){
mHeader = pHeader;
mURL = pURL;
}
public String getHeader(){
return mHeader;
}
public String getURL(){
return mURL;
}
package com.darkweb.genesissearchengine.appManager.homeManager.hintManager;
public class hintModel
{
/*Private Variables*/
private String mHeader;
private String mURL;
public hintModel(String pHeader, String pURL){
mHeader = pHeader;
mURL = pURL;
}
public String getHeader(){
return mHeader;
}
public String getURL(){
return mURL;
}
}

View File

@ -1,46 +1,46 @@
package com.darkweb.genesissearchengine.appManager.homeManager.homeController;
import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.eventObserver;
public class editTextManager extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
Context mContext;
private eventObserver.eventListener mEvent = null;
public editTextManager(@NonNull Context context) {
super(context);
mContext = context;
}
public editTextManager(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
mContext = context;
}
public editTextManager(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
}
public void setEventHandler(eventObserver.eventListener pEvent){
mEvent = pEvent;
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if(mEvent!=null){
mEvent.invokeObserver(null, enums.etype.ON_KEYBOARD_CLOSE);
}
}
return false;
}
}
package com.darkweb.genesissearchengine.appManager.homeManager.homeController;
import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.eventObserver;
public class editTextManager extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
Context mContext;
private eventObserver.eventListener mEvent = null;
public editTextManager(@NonNull Context context) {
super(context);
mContext = context;
}
public editTextManager(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
mContext = context;
}
public editTextManager(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
}
public void setEventHandler(eventObserver.eventListener pEvent){
mEvent = pEvent;
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if(mEvent!=null){
mEvent.invokeObserver(null, enums.etype.ON_KEYBOARD_CLOSE);
}
}
return false;
}
}

View File

@ -1,43 +1,43 @@
package com.darkweb.genesissearchengine.appManager.homeManager.homeController;
import android.util.Patterns;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.net.URL;
class homeModel
{
String getSearchEngine(){
return status.sSettingSearchStatus;
}
String urlComplete(String pURL, String pSearchEngine){
if(pURL.equals("about:blank")){
return helperMethod.completeURL("genesishiddentechnologies.com");
}
else if(pURL.equals("about:config")){
return pURL;
}else {
try
{
String updateUrl = helperMethod.completeURL(pURL);
URL host = new URL(updateUrl);
boolean isUrlValid = Patterns.WEB_URL.matcher(updateUrl).matches();
if(isUrlValid && host.getHost().replace("www.","").contains("."))
{
return pURL;
}
}
catch (Exception ex){
ex.printStackTrace();
}
String mURL = pSearchEngine.replace("$s",pURL.replaceAll(" ","+"));
return mURL;
}
}
}
package com.darkweb.genesissearchengine.appManager.homeManager.homeController;
import android.util.Patterns;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.net.URL;
class homeModel
{
String getSearchEngine(){
return status.sSettingSearchStatus;
}
String urlComplete(String pURL, String pSearchEngine){
if(pURL.equals("about:blank")){
return helperMethod.completeURL("genesishiddentechnologies.com");
}
else if(pURL.equals("about:config")){
return pURL;
}else {
try
{
String updateUrl = helperMethod.completeURL(pURL);
URL host = new URL(updateUrl);
boolean isUrlValid = Patterns.WEB_URL.matcher(updateUrl).matches();
if(isUrlValid && host.getHost().replace("www.","").contains("."))
{
return pURL;
}
}
catch (Exception ex){
ex.printStackTrace();
}
String mURL = pSearchEngine.replace("$s",pURL.replaceAll(" ","+"));
return mURL;
}
}
}

View File

@ -1,25 +1,25 @@
package com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries
import android.content.Context
import android.widget.ImageView
import mozilla.components.browser.engine.gecko.fetch.GeckoViewFetchClient
import mozilla.components.browser.icons.BrowserIcons
import mozilla.components.browser.icons.IconRequest
import mozilla.components.browser.icons.generator.DefaultIconGenerator
import org.mozilla.geckoview.GeckoRuntime
import java.util.concurrent.TimeUnit
class BrowserIconManager {
fun onLoadIconIntoView(mContext: Context, mRuntime: GeckoRuntime, mView:ImageView, pURL:String) : BrowserIcons {
val fetchClient = GeckoViewFetchClient(mContext,mRuntime, Pair(10L, TimeUnit.MINUTES))
val mIcons = BrowserIcons(mContext, httpClient = fetchClient, generator = DefaultIconGenerator())
mIcons.loadIntoView(mView,IconRequest(pURL))
return mIcons
}
fun onLoadIcon(mContext: Context, mRuntime: GeckoRuntime) {
val fetchClient = GeckoViewFetchClient(mContext,mRuntime, Pair(10L, TimeUnit.MINUTES))
BrowserIcons(mContext, httpClient = fetchClient, generator = DefaultIconGenerator())
}
package com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries
import android.content.Context
import android.widget.ImageView
import mozilla.components.browser.engine.gecko.fetch.GeckoViewFetchClient
import mozilla.components.browser.icons.BrowserIcons
import mozilla.components.browser.icons.IconRequest
import mozilla.components.browser.icons.generator.DefaultIconGenerator
import org.mozilla.geckoview.GeckoRuntime
import java.util.concurrent.TimeUnit
class BrowserIconManager {
fun onLoadIconIntoView(mContext: Context, mRuntime: GeckoRuntime, mView:ImageView, pURL:String) : BrowserIcons {
val fetchClient = GeckoViewFetchClient(mContext,mRuntime, Pair(10L, TimeUnit.MINUTES))
val mIcons = BrowserIcons(mContext, httpClient = fetchClient, generator = DefaultIconGenerator())
mIcons.loadIntoView(mView,IconRequest(pURL))
return mIcons
}
fun onLoadIcon(mContext: Context, mRuntime: GeckoRuntime) {
val fetchClient = GeckoViewFetchClient(mContext,mRuntime, Pair(10L, TimeUnit.MINUTES))
BrowserIcons(mContext, httpClient = fetchClient, generator = DefaultIconGenerator())
}
}

View File

@ -1,151 +1,151 @@
package com.darkweb.genesissearchengine.appManager.languageManager;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.Arrays;
import static com.darkweb.genesissearchengine.appManager.languageManager.languageEnums.eLanguageAdapterCallback.*;
import static com.darkweb.genesissearchengine.constants.constants.CONST_LANGUAGE_DEFAULT_LANG;
import static com.darkweb.genesissearchengine.constants.strings.LANGUAGE_NOT_SUPPORTED;
public class languageAdapter extends RecyclerView.Adapter<languageAdapter.helpViewHolder>{
/*Private Variables*/
private ArrayList<languageDataModel> mModelList;
private Context mContext;
/*Private Local Variables*/
private String mCurrentLanguage;
private eventObserver.eventListener mEvent;
private int mCurrentIndex = 0;
private boolean mClickable = false;
public languageAdapter(ArrayList<languageDataModel> pModelList, Context pContext, String pCurrentLanguage, eventObserver.eventListener pEvent) {
this.mModelList = pModelList;
this.mContext = pContext;
this.mEvent = pEvent;
this.mCurrentLanguage = pCurrentLanguage;
}
@NonNull
@Override
public helpViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.lang_row_view, parent, false);
return new helpViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull helpViewHolder holder, int position) {
holder.bindListView(mModelList.get(position));
}
@Override
public int getItemCount() {
return mModelList.size();
}
class helpViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView mHeader;
TextView mDescription;
LinearLayout mContainer;
ImageView mMarker;
helpViewHolder(View itemView) {
super(itemView);
}
void bindListView(languageDataModel model) {
boolean mIsDefaultSupported = true;
mHeader = itemView.findViewById(R.id.pHeader);
mDescription = itemView.findViewById(R.id.pDescription);
mContainer = itemView.findViewById(R.id.pContainer);
mMarker = itemView.findViewById(R.id.pMarker);
mHeader.setText(model.getHeader());
mContainer.setTag(R.id.LaguageID,model.getTag());
mContainer.setTag(R.id.LaguageRegion,model.getCountry());
if(model.getTag().equals(CONST_LANGUAGE_DEFAULT_LANG) && status.sSettingLanguage.equals(CONST_LANGUAGE_DEFAULT_LANG)){
mDescription.setText((String)mEvent.invokeObserver(null, M_SYSTEM_LANGUAGE_SUPPORT_INFO));
if(mDescription.getText().toString().endsWith(LANGUAGE_NOT_SUPPORTED)){
mIsDefaultSupported = false;
}
}else {
mDescription.setText(model.getDescription());
}
if(mContainer.getTag(R.id.LaguageID).toString().equals(mCurrentLanguage)){
Drawable mDrawable;
Resources res = mContext.getResources();
try {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_border_left));
mContainer.setBackground(mDrawable);
mHeader.setTextColor(ContextCompat.getColor(mContext, R.color.white));
mDescription.setTextColor(ContextCompat.getColor(mContext, R.color.white_darker));
mMarker.setVisibility(View.VISIBLE);
mCurrentIndex = getLayoutPosition();
if(!mIsDefaultSupported){
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_cross));
mMarker.setImageDrawable(mDrawable);
}else {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_done));
mMarker.setImageDrawable(mDrawable);
}
} catch (Exception ignored) {
}
}else {
Drawable mDrawable;
Resources res = mContext.getResources();
try {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_ripple_gray));
mContainer.setBackground(mDrawable);
mHeader.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1));
mDescription.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v6));
mMarker.setVisibility(View.GONE);
} catch (Exception ex) {
ex.printStackTrace();
}
}
mContainer.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(v.getId() == R.id.pContainer){
boolean mSupportedStatus = (boolean)mEvent.invokeObserver(Arrays.asList(v.getTag(R.id.LaguageID).toString(), v.getTag(R.id.LaguageRegion).toString()),M_UPDATE_LANGUAGE);
if(mCurrentIndex!=getLayoutPosition() && mSupportedStatus){
if(!mClickable){
mClickable = true;
mEvent.invokeObserver(null,M_ENABLE_VIEW_CLICK);
// notifyItemChanged(mCurrentIndex);
mCurrentLanguage = v.getTag(R.id.LaguageID).toString();
mCurrentIndex = getLayoutPosition();
// notifyItemChanged(mCurrentIndex);
final Handler handler = new Handler();
handler.postDelayed(() -> {
mClickable = false;
mEvent.invokeObserver(null,M_DISABLE_VIEW_CLICK);
}, 100);
}
}
}
}
}
}
package com.darkweb.genesissearchengine.appManager.languageManager;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.Arrays;
import static com.darkweb.genesissearchengine.appManager.languageManager.languageEnums.eLanguageAdapterCallback.*;
import static com.darkweb.genesissearchengine.constants.constants.CONST_LANGUAGE_DEFAULT_LANG;
import static com.darkweb.genesissearchengine.constants.strings.LANGUAGE_NOT_SUPPORTED;
public class languageAdapter extends RecyclerView.Adapter<languageAdapter.helpViewHolder>{
/*Private Variables*/
private ArrayList<languageDataModel> mModelList;
private Context mContext;
/*Private Local Variables*/
private String mCurrentLanguage;
private eventObserver.eventListener mEvent;
private int mCurrentIndex = 0;
private boolean mClickable = false;
public languageAdapter(ArrayList<languageDataModel> pModelList, Context pContext, String pCurrentLanguage, eventObserver.eventListener pEvent) {
this.mModelList = pModelList;
this.mContext = pContext;
this.mEvent = pEvent;
this.mCurrentLanguage = pCurrentLanguage;
}
@NonNull
@Override
public helpViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.lang_row_view, parent, false);
return new helpViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull helpViewHolder holder, int position) {
holder.bindListView(mModelList.get(position));
}
@Override
public int getItemCount() {
return mModelList.size();
}
class helpViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView mHeader;
TextView mDescription;
LinearLayout mContainer;
ImageView mMarker;
helpViewHolder(View itemView) {
super(itemView);
}
void bindListView(languageDataModel model) {
boolean mIsDefaultSupported = true;
mHeader = itemView.findViewById(R.id.pHeader);
mDescription = itemView.findViewById(R.id.pDescription);
mContainer = itemView.findViewById(R.id.pContainer);
mMarker = itemView.findViewById(R.id.pMarker);
mHeader.setText(model.getHeader());
mContainer.setTag(R.id.LaguageID,model.getTag());
mContainer.setTag(R.id.LaguageRegion,model.getCountry());
if(model.getTag().equals(CONST_LANGUAGE_DEFAULT_LANG) && status.sSettingLanguage.equals(CONST_LANGUAGE_DEFAULT_LANG)){
mDescription.setText((String)mEvent.invokeObserver(null, M_SYSTEM_LANGUAGE_SUPPORT_INFO));
if(mDescription.getText().toString().endsWith(LANGUAGE_NOT_SUPPORTED)){
mIsDefaultSupported = false;
}
}else {
mDescription.setText(model.getDescription());
}
if(mContainer.getTag(R.id.LaguageID).toString().equals(mCurrentLanguage)){
Drawable mDrawable;
Resources res = mContext.getResources();
try {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_border_left));
mContainer.setBackground(mDrawable);
mHeader.setTextColor(ContextCompat.getColor(mContext, R.color.white));
mDescription.setTextColor(ContextCompat.getColor(mContext, R.color.white_darker));
mMarker.setVisibility(View.VISIBLE);
mCurrentIndex = getLayoutPosition();
if(!mIsDefaultSupported){
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_cross));
mMarker.setImageDrawable(mDrawable);
}else {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_done));
mMarker.setImageDrawable(mDrawable);
}
} catch (Exception ignored) {
}
}else {
Drawable mDrawable;
Resources res = mContext.getResources();
try {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_ripple_gray));
mContainer.setBackground(mDrawable);
mHeader.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1));
mDescription.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v6));
mMarker.setVisibility(View.GONE);
} catch (Exception ex) {
ex.printStackTrace();
}
}
mContainer.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(v.getId() == R.id.pContainer){
boolean mSupportedStatus = (boolean)mEvent.invokeObserver(Arrays.asList(v.getTag(R.id.LaguageID).toString(), v.getTag(R.id.LaguageRegion).toString()),M_UPDATE_LANGUAGE);
if(mCurrentIndex!=getLayoutPosition() && mSupportedStatus){
if(!mClickable){
mClickable = true;
mEvent.invokeObserver(null,M_ENABLE_VIEW_CLICK);
// notifyItemChanged(mCurrentIndex);
mCurrentLanguage = v.getTag(R.id.LaguageID).toString();
mCurrentIndex = getLayoutPosition();
// notifyItemChanged(mCurrentIndex);
final Handler handler = new Handler();
handler.postDelayed(() -> {
mClickable = false;
mEvent.invokeObserver(null,M_DISABLE_VIEW_CLICK);
}, 100);
}
}
}
}
}
}

View File

@ -154,7 +154,7 @@ public class languageController extends AppCompatActivity {
getIntent().putExtra("activity_restarted",((LinearLayoutManager) Objects.requireNonNull(mRecycleView.getLayoutManager())).findFirstCompletelyVisibleItemPosition());
helperMethod.restartActivity(getIntent(), this);
overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang);
pluginController.getInstance().onLanguageInvoke(Arrays.asList(this, status.sSettingLanguage, status.sSettingLanguageRegion, status.sTheme), pluginEnums.eLangManager.M_SET_LANGUAGE);
pluginController.getInstance().onLanguageInvoke(Arrays.asList(this, status.sSettingLanguage, status.sSettingLanguageRegion, status.mThemeApplying), pluginEnums.eLangManager.M_SET_LANGUAGE);
if(activityContextManager.getInstance().getSettingController()!=null && !activityContextManager.getInstance().getSettingController().isDestroyed()){
activityContextManager.getInstance().getSettingController().onRedrawXML();

View File

@ -1,31 +1,31 @@
package com.darkweb.genesissearchengine.appManager.languageManager;
public class languageDataModel {
private String mHeader;
private String mDescription;
private String mTag;
private String mCountry;
protected languageDataModel(String pHeader, String pDescription, String pTag, String pCountry) {
this.mHeader = pHeader;
this.mDescription = pDescription;
this.mTag = pTag;
this.mCountry = pCountry;
}
public String getHeader() {
return mHeader;
}
public String getDescription() {
return mDescription;
}
public String getTag() {
return mTag;
}
public String getCountry() {
return mCountry;
}
}
package com.darkweb.genesissearchengine.appManager.languageManager;
public class languageDataModel {
private String mHeader;
private String mDescription;
private String mTag;
private String mCountry;
protected languageDataModel(String pHeader, String pDescription, String pTag, String pCountry) {
this.mHeader = pHeader;
this.mDescription = pDescription;
this.mTag = pTag;
this.mCountry = pCountry;
}
public String getHeader() {
return mHeader;
}
public String getDescription() {
return mDescription;
}
public String getTag() {
return mTag;
}
public String getCountry() {
return mCountry;
}
}

View File

@ -1,17 +1,17 @@
package com.darkweb.genesissearchengine.appManager.languageManager;
class languageEnums
{
/*History Manager*/
public enum eLanguageModel {
M_SUPPORTED_LANGUAGE, M_ACTIVE_LANGUAGE
}
public enum eLanguagevViewController {
M_UPDATE_BLOCKER
}
public enum eLanguageAdapterCallback {
M_UPDATE_LANGUAGE, M_DISABLE_VIEW_CLICK, M_ENABLE_VIEW_CLICK, M_SYSTEM_LANGUAGE_SUPPORT_INFO
}
package com.darkweb.genesissearchengine.appManager.languageManager;
class languageEnums
{
/*History Manager*/
public enum eLanguageModel {
M_SUPPORTED_LANGUAGE, M_ACTIVE_LANGUAGE
}
public enum eLanguagevViewController {
M_UPDATE_BLOCKER
}
public enum eLanguageAdapterCallback {
M_UPDATE_LANGUAGE, M_DISABLE_VIEW_CLICK, M_ENABLE_VIEW_CLICK, M_SYSTEM_LANGUAGE_SUPPORT_INFO
}
}

View File

@ -1,60 +1,60 @@
package com.darkweb.genesissearchengine.appManager.languageManager;
import com.darkweb.genesissearchengine.constants.status;
import java.util.ArrayList;
import java.util.List;
class languageModel
{
private ArrayList<languageDataModel> mSupportedLanaguage;
public languageModel(){
mSupportedLanaguage = new ArrayList<>();
onInitLanguage();
}
private void onInitLanguage(){
mSupportedLanaguage.add(new languageDataModel("Follow Device Language","Default Language", "default","default"));
mSupportedLanaguage.add(new languageDataModel("English (United States)","United States", "en","Us"));
mSupportedLanaguage.add(new languageDataModel("Deutsche","German", "de","De"));
mSupportedLanaguage.add(new languageDataModel("Català","Catalan", "ca","Es"));
mSupportedLanaguage.add(new languageDataModel("中文(中国)","Chinese (China)", "zh","Cn"));
mSupportedLanaguage.add(new languageDataModel("čeština","Czech", "ch","Cz"));
mSupportedLanaguage.add(new languageDataModel("Dutch (Netherland)","Dutch (Netherland)", "nl","Nl"));
mSupportedLanaguage.add(new languageDataModel("France (francaise)","French (France)", "fr","Fr"));
mSupportedLanaguage.add(new languageDataModel("Ελληνικά","Greek", "el","Gr"));
mSupportedLanaguage.add(new languageDataModel("Magyar","Hungarian", "hu","Hu"));
mSupportedLanaguage.add(new languageDataModel("bahasa Indonesia","Indonesian", "in","Id"));
mSupportedLanaguage.add(new languageDataModel("Italiana","Italian", "it","It"));
mSupportedLanaguage.add(new languageDataModel("日本人","Japanese", "ja","Jp"));
mSupportedLanaguage.add(new languageDataModel("韓国語","Korean", "ko","Kr"));
mSupportedLanaguage.add(new languageDataModel("Português","Portuguese (Portugal)", "pt","Pt"));
mSupportedLanaguage.add(new languageDataModel("Română","Romanian", "ro","Ro"));
mSupportedLanaguage.add(new languageDataModel("Urdu (اردو)","Urdu", "ur","Ur"));
mSupportedLanaguage.add(new languageDataModel("русский","Russian", "ru","Ru"));
mSupportedLanaguage.add(new languageDataModel("ไทย","Thai", "th","Th"));
mSupportedLanaguage.add(new languageDataModel("Türk","Turkish", "tr","Tr"));
mSupportedLanaguage.add(new languageDataModel("Український","Ukrainian", "uk","Ua"));
mSupportedLanaguage.add(new languageDataModel("Tiếng Việt","Vietnamese", "vi","Vn"));
}
private int getActiveLanguageIndex(){
for(int mCounter=0;mCounter<mSupportedLanaguage.size();mCounter++){
if(mSupportedLanaguage.get(mCounter).getTag().equals(status.sSettingLanguage)){
return mCounter;
}
}
return -1;
}
public Object onTrigger(languageEnums.eLanguageModel pCommands, List<Object> pData){
if(pCommands.equals(languageEnums.eLanguageModel.M_SUPPORTED_LANGUAGE)){
return mSupportedLanaguage;
}
else if(pCommands.equals(languageEnums.eLanguageModel.M_ACTIVE_LANGUAGE)){
return getActiveLanguageIndex();
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.languageManager;
import com.darkweb.genesissearchengine.constants.status;
import java.util.ArrayList;
import java.util.List;
class languageModel
{
private ArrayList<languageDataModel> mSupportedLanaguage;
public languageModel(){
mSupportedLanaguage = new ArrayList<>();
onInitLanguage();
}
private void onInitLanguage(){
mSupportedLanaguage.add(new languageDataModel("Follow Device Language","Default Language", "default","default"));
mSupportedLanaguage.add(new languageDataModel("English (United States)","United States", "en","Us"));
mSupportedLanaguage.add(new languageDataModel("Deutsche","German", "de","De"));
mSupportedLanaguage.add(new languageDataModel("Català","Catalan", "ca","Es"));
mSupportedLanaguage.add(new languageDataModel("中文(中国)","Chinese (China)", "zh","Cn"));
mSupportedLanaguage.add(new languageDataModel("čeština","Czech", "ch","Cz"));
mSupportedLanaguage.add(new languageDataModel("Dutch (Netherland)","Dutch (Netherland)", "nl","Nl"));
mSupportedLanaguage.add(new languageDataModel("France (francaise)","French (France)", "fr","Fr"));
mSupportedLanaguage.add(new languageDataModel("Ελληνικά","Greek", "el","Gr"));
mSupportedLanaguage.add(new languageDataModel("Magyar","Hungarian", "hu","Hu"));
mSupportedLanaguage.add(new languageDataModel("bahasa Indonesia","Indonesian", "in","Id"));
mSupportedLanaguage.add(new languageDataModel("Italiana","Italian", "it","It"));
mSupportedLanaguage.add(new languageDataModel("日本人","Japanese", "ja","Jp"));
mSupportedLanaguage.add(new languageDataModel("韓国語","Korean", "ko","Kr"));
mSupportedLanaguage.add(new languageDataModel("Português","Portuguese (Portugal)", "pt","Pt"));
mSupportedLanaguage.add(new languageDataModel("Română","Romanian", "ro","Ro"));
mSupportedLanaguage.add(new languageDataModel("Urdu (اردو)","Urdu", "ur","Ur"));
mSupportedLanaguage.add(new languageDataModel("русский","Russian", "ru","Ru"));
mSupportedLanaguage.add(new languageDataModel("ไทย","Thai", "th","Th"));
mSupportedLanaguage.add(new languageDataModel("Türk","Turkish", "tr","Tr"));
mSupportedLanaguage.add(new languageDataModel("Український","Ukrainian", "uk","Ua"));
mSupportedLanaguage.add(new languageDataModel("Tiếng Việt","Vietnamese", "vi","Vn"));
}
private int getActiveLanguageIndex(){
for(int mCounter=0;mCounter<mSupportedLanaguage.size();mCounter++){
if(mSupportedLanaguage.get(mCounter).getTag().equals(status.sSettingLanguage)){
return mCounter;
}
}
return -1;
}
public Object onTrigger(languageEnums.eLanguageModel pCommands, List<Object> pData){
if(pCommands.equals(languageEnums.eLanguageModel.M_SUPPORTED_LANGUAGE)){
return mSupportedLanaguage;
}
else if(pCommands.equals(languageEnums.eLanguageModel.M_ACTIVE_LANGUAGE)){
return getActiveLanguageIndex();
}
return null;
}
}

View File

@ -1,84 +1,84 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import android.app.SearchManager;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import org.torproject.android.proxy.wrapper.logRowModel;
import java.util.ArrayList;
import java.util.List;
public class orbotLogAdapter extends RecyclerView.Adapter<orbotLogAdapter.listViewHolder>
{
/*Private Variables*/
private ArrayList<logRowModel> mModelList;
private eventObserver.eventListener mEvent;
orbotLogAdapter(ArrayList<logRowModel> pModelList, eventObserver.eventListener pEvent) {
this.mModelList = pModelList;
this.mEvent = pEvent;
}
@NonNull @Override
public orbotLogAdapter.listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.orbot_row_view, parent, false);
return new orbotLogAdapter.listViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull orbotLogAdapter.listViewHolder holder, int position)
{
holder.bindListView(mModelList.get(position));
}
@Override
public int getItemCount() {
return mModelList.size();
}
/*View Holder Extensions*/
class listViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView mHeader;
TextView mDescription;
ConstraintLayout mRowContainerInner;
listViewHolder(View itemView) {
super(itemView);
}
void bindListView(logRowModel model) {
mHeader = itemView.findViewById(R.id.pHeader);
mDescription = itemView.findViewById(R.id.pDescription);
mRowContainerInner = itemView.findViewById(R.id.pRowContainerInner);
mHeader.setText((this.getLayoutPosition() + ". " + model.getLog()));
mDescription.setText(model.getDate());
mRowContainerInner.setOnClickListener(this);
}
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_LOG_DUCKDUCK + Uri.encode(" " + mModelList.get(this.getLayoutPosition()).getLog())));
intent.putExtra(SearchManager.QUERY, mDescription.getText());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activityContextManager.getInstance().getHomeController().startActivity(intent);
}
}
public Object onTrigger(tabEnums.eTabAdapterCommands pCommands, List<Object> pData){
return null;
}
}
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import android.app.SearchManager;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import org.torproject.android.proxy.wrapper.logRowModel;
import java.util.ArrayList;
import java.util.List;
public class orbotLogAdapter extends RecyclerView.Adapter<orbotLogAdapter.listViewHolder>
{
/*Private Variables*/
private ArrayList<logRowModel> mModelList;
private eventObserver.eventListener mEvent;
orbotLogAdapter(ArrayList<logRowModel> pModelList, eventObserver.eventListener pEvent) {
this.mModelList = pModelList;
this.mEvent = pEvent;
}
@NonNull @Override
public orbotLogAdapter.listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.orbot_row_view, parent, false);
return new orbotLogAdapter.listViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull orbotLogAdapter.listViewHolder holder, int position)
{
holder.bindListView(mModelList.get(position));
}
@Override
public int getItemCount() {
return mModelList.size();
}
/*View Holder Extensions*/
class listViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView mHeader;
TextView mDescription;
ConstraintLayout mRowContainerInner;
listViewHolder(View itemView) {
super(itemView);
}
void bindListView(logRowModel model) {
mHeader = itemView.findViewById(R.id.pHeader);
mDescription = itemView.findViewById(R.id.pDescription);
mRowContainerInner = itemView.findViewById(R.id.pRowContainerInner);
mHeader.setText((this.getLayoutPosition() + ". " + model.getLog()));
mDescription.setText(model.getDate());
mRowContainerInner.setOnClickListener(this);
}
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_LOG_DUCKDUCK + Uri.encode(" " + mModelList.get(this.getLayoutPosition()).getLog())));
intent.putExtra(SearchManager.QUERY, mDescription.getText());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activityContextManager.getInstance().getHomeController().startActivity(intent);
}
}
public Object onTrigger(tabEnums.eTabAdapterCommands pCommands, List<Object> pData){
return null;
}
}

View File

@ -1,385 +1,385 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import android.annotation.SuppressLint;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.torproject.android.proxy.wrapper.logRowModel;
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST;
import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE;
import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE;
public class orbotLogController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private orbotLogModel mOrbotModel;
private orbotLogViewController mOrbotLogViewController;
private orbotLogAdapter mOrbotAdapter;
private boolean mActivityClosed = false;
private int mLogCounter = 1;
private boolean mIsRecycleviewInteracting = false;
/* UI VARIABLES */
private TextView mLogs;
private RecyclerView mLogRecycleView;
private NestedScrollView mNestedScrollView;
private FloatingActionButton mFloatingScroller;
/* INITIALIZATIONS */
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse);
activityContextManager.getInstance().setOrbotLogController(this);
activityContextManager.getInstance().onStack(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.orbot_log_view);
initializeViews();
initializeLogs();
initListener();
updateLogs();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
mNestedScrollView.stopNestedScroll();
helperMethod.onDelayHandler(orbotLogController.this, 150, () -> {
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
if(!orbotLogStatus.sUIInteracted && ((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1)){
if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
mNestedScrollView.stopNestedScroll();
onScrollBottom();
mNestedScrollView.stopNestedScroll();
orbotLogStatus.sScrollPosition = -1;
}
}else {
mNestedScrollView.stopNestedScroll();
mNestedScrollView.scrollTo(0,0);
mNestedScrollView.smoothScrollTo(0,0);
mNestedScrollView.stopNestedScroll();
orbotLogStatus.sScrollPosition = 0;
}
}
return null;
});
super.onConfigurationChanged(newConfig);
}
private void initializeViews() {
mLogRecycleView = findViewById(R.id.pLogRecycleView);
mLogs = findViewById(R.id.pLogs);
mNestedScrollView = findViewById(R.id.pNestedScrollView);
mFloatingScroller = findViewById(R.id.pFloatingScroller);
mOrbotLogViewController = new orbotLogViewController(this, new orbotLogViewCallback() , mLogs, mLogRecycleView, mNestedScrollView, mFloatingScroller);
mOrbotModel = new orbotLogModel();
}
private void initializeLogs(){
mLogCounter = 0;
mOrbotModel.setList(orbotLocalConstants.mTorLogsHistory);
if(status.sLogThemeStyleAdvanced){
mLogCounter = (int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);
LinearLayoutManager layoutManager = new LinearLayoutManager(orbotLogController.this);
orbotLogAdapter adapter = new orbotLogAdapter(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)),new orbotLogController.orbotModelCallback());
mOrbotAdapter = adapter;
layoutManager.setReverseLayout(true);
mLogRecycleView.setAdapter(adapter);
Objects.requireNonNull(mLogRecycleView.getItemAnimator()).setAddDuration(350);
mLogRecycleView.setNestedScrollingEnabled(false);
mLogRecycleView.setLayoutManager(new LinearLayoutManager(orbotLogController.this));
mOrbotAdapter.notifyDataSetChanged();
}else {
logToString();
}
mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS, Collections.singletonList(status.sLogThemeStyleAdvanced));
mLogRecycleView.smoothScrollToPosition((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE));
}
/* LISTENERS */
@RequiresApi(api = Build.VERSION_CODES.M)
@SuppressLint("ClickableViewAccessibility")
private void initListener(){
mLogRecycleView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@SuppressLint("NewApi") @SuppressWarnings("deprecation")
@Override
public void onGlobalLayout() {
if(orbotLogStatus.sOrientation==-1){
orbotLogStatus.sOrientation = getResources().getConfiguration().orientation;
}
if(orbotLogStatus.sOrientation != getResources().getConfiguration().orientation && orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sScrollPosition!=0){
mNestedScrollView.stopNestedScroll();
orbotLogStatus.sScrollPosition = 0;
mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition);
orbotLogStatus.sOrientation = getResources().getConfiguration().orientation;
}else {
if(orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sUIInteracted){
mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition);
}else if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
onScrollBottom();
}
}
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
orbotLogStatus.sScrollPosition = scrollY;
});
}
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
orbotLogStatus.sOrientation = getResources().getConfiguration().orientation;
}
});
mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
}
});
mLogRecycleView.setOnTouchListener((v, event) -> onTouch(event));
mNestedScrollView.setOnTouchListener((v, event) -> onTouch(event));
mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
}
});
mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> {
if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
if(!mIsRecycleviewInteracting){
orbotLogStatus.sUIInteracted = false;
}
}
if(mNestedScrollView.getScrollY() == 0){
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
});
}
public boolean onTouch(MotionEvent event){
if(event.getAction() == MotionEvent.ACTION_UP){
mIsRecycleviewInteracting = false;
if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
orbotLogStatus.sUIInteracted = true;
}
}else if(event.getAction() == MotionEvent.ACTION_DOWN){
mIsRecycleviewInteracting = true;
}
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
return false;
}
private void logToString(){
if((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1){
for(int mCounter=0;mCounter<(int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);mCounter++){
mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList<logRowModel>)mOrbotModel.onTrigger(M_GET_LIST)).get(mCounter).getLog()));
mLogCounter+=1;
}
}
}
private void updateLogs(){
new Thread(){
public void run(){
try {
sleep(1000);
while (!mActivityClosed){
if(status.sLogThemeStyleAdvanced){
sleep(800);
}else {
sleep(100);
}
if(mLogCounter>0){
runOnUiThread(() -> {
if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){
((ArrayList<logRowModel>)mOrbotModel.onTrigger(M_GET_LIST)).add(orbotLocalConstants.mTorLogsHistory.get(mLogCounter));
if(!status.sLogThemeStyleAdvanced){
mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList<logRowModel>)mOrbotModel.onTrigger(M_GET_LIST)).get(mLogCounter).getLog()));
}else {
if(mOrbotAdapter!=null){
mOrbotAdapter.notifyItemInserted((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)-1);
}
}
if(!orbotLogStatus.sUIInteracted){
helperMethod.onDelayHandler(orbotLogController.this, 150, () -> {
Log.i("SUPFUCK4", orbotLogStatus.sUIInteracted + "");
if(!orbotLogStatus.sUIInteracted){
onScrollBottomAnimated(null);
}
return null;
});
}
mLogCounter+=1;
}
});
}
}
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
}
private void onScrollBottom() {
mNestedScrollView.scrollTo(0,helperMethod.pxFromDp((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)*100));
}
/* View Callback */
public void onScrollBottomAnimated(View view) {
mNestedScrollView.fullScroll(View.FOCUS_DOWN);
orbotLogStatus.sUIInteracted = false;
Log.i("SUPFUCK5", orbotLogStatus.sUIInteracted + "");
if(view!=null){
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
}
public void onOpenInfo(View view) {
helperMethod.openActivity(settingLogController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onClose(View view){
finish();
activityContextManager.getInstance().onRemoveStack(this);
overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out);
mActivityClosed = true;
}
/* View Callback */
private class orbotLogViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/* Model Callback */
public class orbotModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onBackPressed() {
onClose(null);
}
@Override
protected void onDestroy() {
super.onDestroy();
activityContextManager.getInstance().onRemoveStack(this);
activityContextManager.getInstance().setOrbotLogController(null);
mActivityClosed = true;
}
/* External Calls */
public void onRefreshLayoutTheme(){
if(!orbotLogStatus.sUIInteracted){
orbotLogStatus.sScrollPosition = -1;
}else {
orbotLogStatus.sScrollPosition = 0;
}
mIsRecycleviewInteracting = false;
recreate();
}
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import android.annotation.SuppressLint;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.torproject.android.proxy.wrapper.logRowModel;
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST;
import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE;
import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE;
public class orbotLogController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private orbotLogModel mOrbotModel;
private orbotLogViewController mOrbotLogViewController;
private orbotLogAdapter mOrbotAdapter;
private boolean mActivityClosed = false;
private int mLogCounter = 1;
private boolean mIsRecycleviewInteracting = false;
/* UI VARIABLES */
private TextView mLogs;
private RecyclerView mLogRecycleView;
private NestedScrollView mNestedScrollView;
private FloatingActionButton mFloatingScroller;
/* INITIALIZATIONS */
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse);
activityContextManager.getInstance().setOrbotLogController(this);
activityContextManager.getInstance().onStack(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.orbot_log_view);
initializeViews();
initializeLogs();
initListener();
updateLogs();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
mNestedScrollView.stopNestedScroll();
helperMethod.onDelayHandler(orbotLogController.this, 150, () -> {
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
if(!orbotLogStatus.sUIInteracted && ((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1)){
if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
mNestedScrollView.stopNestedScroll();
onScrollBottom();
mNestedScrollView.stopNestedScroll();
orbotLogStatus.sScrollPosition = -1;
}
}else {
mNestedScrollView.stopNestedScroll();
mNestedScrollView.scrollTo(0,0);
mNestedScrollView.smoothScrollTo(0,0);
mNestedScrollView.stopNestedScroll();
orbotLogStatus.sScrollPosition = 0;
}
}
return null;
});
super.onConfigurationChanged(newConfig);
}
private void initializeViews() {
mLogRecycleView = findViewById(R.id.pLogRecycleView);
mLogs = findViewById(R.id.pLogs);
mNestedScrollView = findViewById(R.id.pNestedScrollView);
mFloatingScroller = findViewById(R.id.pFloatingScroller);
mOrbotLogViewController = new orbotLogViewController(this, new orbotLogViewCallback() , mLogs, mLogRecycleView, mNestedScrollView, mFloatingScroller);
mOrbotModel = new orbotLogModel();
}
private void initializeLogs(){
mLogCounter = 0;
mOrbotModel.setList(orbotLocalConstants.mTorLogsHistory);
if(status.sLogThemeStyleAdvanced){
mLogCounter = (int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);
LinearLayoutManager layoutManager = new LinearLayoutManager(orbotLogController.this);
orbotLogAdapter adapter = new orbotLogAdapter(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)),new orbotLogController.orbotModelCallback());
mOrbotAdapter = adapter;
layoutManager.setReverseLayout(true);
mLogRecycleView.setAdapter(adapter);
Objects.requireNonNull(mLogRecycleView.getItemAnimator()).setAddDuration(350);
mLogRecycleView.setNestedScrollingEnabled(false);
mLogRecycleView.setLayoutManager(new LinearLayoutManager(orbotLogController.this));
mOrbotAdapter.notifyDataSetChanged();
}else {
logToString();
}
mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS, Collections.singletonList(status.sLogThemeStyleAdvanced));
mLogRecycleView.smoothScrollToPosition((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE));
}
/* LISTENERS */
@RequiresApi(api = Build.VERSION_CODES.M)
@SuppressLint("ClickableViewAccessibility")
private void initListener(){
mLogRecycleView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@SuppressLint("NewApi") @SuppressWarnings("deprecation")
@Override
public void onGlobalLayout() {
if(orbotLogStatus.sOrientation==-1){
orbotLogStatus.sOrientation = getResources().getConfiguration().orientation;
}
if(orbotLogStatus.sOrientation != getResources().getConfiguration().orientation && orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sScrollPosition!=0){
mNestedScrollView.stopNestedScroll();
orbotLogStatus.sScrollPosition = 0;
mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition);
orbotLogStatus.sOrientation = getResources().getConfiguration().orientation;
}else {
if(orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sUIInteracted){
mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition);
}else if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
onScrollBottom();
}
}
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
orbotLogStatus.sScrollPosition = scrollY;
});
}
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
orbotLogStatus.sOrientation = getResources().getConfiguration().orientation;
}
});
mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
}
});
mLogRecycleView.setOnTouchListener((v, event) -> onTouch(event));
mNestedScrollView.setOnTouchListener((v, event) -> onTouch(event));
mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
}
});
mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> {
if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
if(!mIsRecycleviewInteracting){
orbotLogStatus.sUIInteracted = false;
}
}
if(mNestedScrollView.getScrollY() == 0){
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
});
}
public boolean onTouch(MotionEvent event){
if(event.getAction() == MotionEvent.ACTION_UP){
mIsRecycleviewInteracting = false;
if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
orbotLogStatus.sUIInteracted = true;
}
}else if(event.getAction() == MotionEvent.ACTION_DOWN){
mIsRecycleviewInteracting = true;
}
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
return false;
}
private void logToString(){
if((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1){
for(int mCounter=0;mCounter<(int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);mCounter++){
mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList<logRowModel>)mOrbotModel.onTrigger(M_GET_LIST)).get(mCounter).getLog()));
mLogCounter+=1;
}
}
}
private void updateLogs(){
new Thread(){
public void run(){
try {
sleep(1000);
while (!mActivityClosed){
if(status.sLogThemeStyleAdvanced){
sleep(800);
}else {
sleep(100);
}
if(mLogCounter>0){
runOnUiThread(() -> {
if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){
((ArrayList<logRowModel>)mOrbotModel.onTrigger(M_GET_LIST)).add(orbotLocalConstants.mTorLogsHistory.get(mLogCounter));
if(!status.sLogThemeStyleAdvanced){
mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList<logRowModel>)mOrbotModel.onTrigger(M_GET_LIST)).get(mLogCounter).getLog()));
}else {
if(mOrbotAdapter!=null){
mOrbotAdapter.notifyItemInserted((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)-1);
}
}
if(!orbotLogStatus.sUIInteracted){
helperMethod.onDelayHandler(orbotLogController.this, 150, () -> {
Log.i("SUPFUCK4", orbotLogStatus.sUIInteracted + "");
if(!orbotLogStatus.sUIInteracted){
onScrollBottomAnimated(null);
}
return null;
});
}
mLogCounter+=1;
}
});
}
}
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
}
private void onScrollBottom() {
mNestedScrollView.scrollTo(0,helperMethod.pxFromDp((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)*100));
}
/* View Callback */
public void onScrollBottomAnimated(View view) {
mNestedScrollView.fullScroll(View.FOCUS_DOWN);
orbotLogStatus.sUIInteracted = false;
Log.i("SUPFUCK5", orbotLogStatus.sUIInteracted + "");
if(view!=null){
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
}
public void onOpenInfo(View view) {
helperMethod.openActivity(settingLogController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onClose(View view){
finish();
activityContextManager.getInstance().onRemoveStack(this);
overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out);
mActivityClosed = true;
}
/* View Callback */
private class orbotLogViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/* Model Callback */
public class orbotModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onBackPressed() {
onClose(null);
}
@Override
protected void onDestroy() {
super.onDestroy();
activityContextManager.getInstance().onRemoveStack(this);
activityContextManager.getInstance().setOrbotLogController(null);
mActivityClosed = true;
}
/* External Calls */
public void onRefreshLayoutTheme(){
if(!orbotLogStatus.sUIInteracted){
orbotLogStatus.sScrollPosition = -1;
}else {
orbotLogStatus.sScrollPosition = 0;
}
mIsRecycleviewInteracting = false;
recreate();
}
}

View File

@ -1,16 +1,16 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
public class orbotLogEnums
{
/*Orbot Log View Manager*/
public enum eOrbotLogViewCommands {
M_UPDATE_LOGS, M_INIT_VIEWS, M_FLOAT_BUTTON_UPDATE
}
/*Orbot Log Model Manager*/
public enum eOrbotLogModelCommands {
M_GET_LIST, M_GET_LIST_SIZE
}
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
public class orbotLogEnums
{
/*Orbot Log View Manager*/
public enum eOrbotLogViewCommands {
M_UPDATE_LOGS, M_INIT_VIEWS, M_FLOAT_BUTTON_UPDATE
}
/*Orbot Log Model Manager*/
public enum eOrbotLogModelCommands {
M_GET_LIST, M_GET_LIST_SIZE
}
}

View File

@ -1,53 +1,53 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import org.torproject.android.proxy.wrapper.logRowModel;
import java.util.ArrayList;
import java.util.List;
class orbotLogModel
{
/*Private Variables*/
private ArrayList<logRowModel> mModelList = new ArrayList<>();
/*Helper Methods*/
void setList(ArrayList<logRowModel> pModel)
{
if(pModel.size()>0){
mModelList.clear();
mModelList.addAll(pModel);
}
else {
mModelList.add(new logRowModel(constants.CONST_LOGS_DEFAULT_MESSAGE, helperMethod.getCurrentTime()));
}
}
private ArrayList<logRowModel> getList()
{
return mModelList;
}
private int getListSize()
{
return mModelList.size();
}
/*Triggers*/
public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List<Object> pData){
}
public Object onTrigger(orbotLogEnums.eOrbotLogModelCommands pCommands){
if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST)){
return getList();
}
else if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE)){
return getListSize();
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import org.torproject.android.proxy.wrapper.logRowModel;
import java.util.ArrayList;
import java.util.List;
class orbotLogModel
{
/*Private Variables*/
private ArrayList<logRowModel> mModelList = new ArrayList<>();
/*Helper Methods*/
void setList(ArrayList<logRowModel> pModel)
{
if(pModel.size()>0){
mModelList.clear();
mModelList.addAll(pModel);
}
else {
mModelList.add(new logRowModel(constants.CONST_LOGS_DEFAULT_MESSAGE, helperMethod.getCurrentTime()));
}
}
private ArrayList<logRowModel> getList()
{
return mModelList;
}
private int getListSize()
{
return mModelList.size();
}
/*Triggers*/
public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List<Object> pData){
}
public Object onTrigger(orbotLogEnums.eOrbotLogModelCommands pCommands){
if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST)){
return getList();
}
else if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE)){
return getListSize();
}
return null;
}
}

View File

@ -1,8 +1,8 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
public class orbotLogStatus {
public static boolean sUIInteracted = false;
public static int sScrollPosition = -1;
public static int sOrientation = -1;
}
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
public class orbotLogStatus {
public static boolean sUIInteracted = false;
public static int sScrollPosition = -1;
public static int sOrientation = -1;
}

View File

@ -1,92 +1,92 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.sharedUIMethod;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.List;
class orbotLogViewController
{
/*Private Variables*/
private AppCompatActivity mContext;
private eventObserver.eventListener mEvent;
private TextView mLogs;
private RecyclerView mLogRecycleView;
private NestedScrollView mNestedScrollView;
private FloatingActionButton mFloatingScroller;
/*Initializations*/
orbotLogViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent, TextView pLogs, RecyclerView pLogRecycleView, NestedScrollView pNestedScrollView, FloatingActionButton pFloatingScroller)
{
this.mContext = pContext;
this.mLogs = pLogs;
this.mLogRecycleView = pLogRecycleView;
this.mNestedScrollView = pNestedScrollView;
this.mFloatingScroller = pFloatingScroller;
this.mEvent = pEvent;
initPostUI();
}
private void initViews(boolean pLogThemeStyleAdvanced){
if(pLogThemeStyleAdvanced){
mLogRecycleView.setVisibility(View.VISIBLE);
mLogs.setVisibility(View.GONE);
}else {
mLogRecycleView.setVisibility(View.GONE);
mLogs.setVisibility(View.VISIBLE);
}
}
/*Helper Methods*/
private void initPostUI(){
sharedUIMethod.updateStatusBar(mContext);
}
private void onUpdateLogs(String pLogs){
pLogs = "~ " + pLogs;
mLogs.setText(String.format("%s%s",mLogs.getText() , "\n\n" + pLogs ));
}
private void onFloatButtonUpdate(){
if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
mFloatingScroller.setVisibility(View.VISIBLE);
mFloatingScroller.animate().cancel();
mFloatingScroller.animate().setDuration(250).alpha(1);
}else {
mFloatingScroller.animate().cancel();
mFloatingScroller.animate().setDuration(250).alpha(0).withEndAction(() -> mFloatingScroller.setVisibility(View.GONE));
}
}
/*Triggers*/
public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List<Object> pData){
if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS)){
onUpdateLogs((String) pData.get(0));
}
else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS)){
initViews((boolean)pData.get(0));
}
else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE)){
onFloatButtonUpdate();
}
}
public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands){
onTrigger(pCommands, null);
}
}
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.sharedUIMethod;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.List;
class orbotLogViewController
{
/*Private Variables*/
private AppCompatActivity mContext;
private eventObserver.eventListener mEvent;
private TextView mLogs;
private RecyclerView mLogRecycleView;
private NestedScrollView mNestedScrollView;
private FloatingActionButton mFloatingScroller;
/*Initializations*/
orbotLogViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent, TextView pLogs, RecyclerView pLogRecycleView, NestedScrollView pNestedScrollView, FloatingActionButton pFloatingScroller)
{
this.mContext = pContext;
this.mLogs = pLogs;
this.mLogRecycleView = pLogRecycleView;
this.mNestedScrollView = pNestedScrollView;
this.mFloatingScroller = pFloatingScroller;
this.mEvent = pEvent;
initPostUI();
}
private void initViews(boolean pLogThemeStyleAdvanced){
if(pLogThemeStyleAdvanced){
mLogRecycleView.setVisibility(View.VISIBLE);
mLogs.setVisibility(View.GONE);
}else {
mLogRecycleView.setVisibility(View.GONE);
mLogs.setVisibility(View.VISIBLE);
}
}
/*Helper Methods*/
private void initPostUI(){
sharedUIMethod.updateStatusBar(mContext);
}
private void onUpdateLogs(String pLogs){
pLogs = "~ " + pLogs;
mLogs.setText(String.format("%s%s",mLogs.getText() , "\n\n" + pLogs ));
}
private void onFloatButtonUpdate(){
if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
mFloatingScroller.setVisibility(View.VISIBLE);
mFloatingScroller.animate().cancel();
mFloatingScroller.animate().setDuration(250).alpha(1);
}else {
mFloatingScroller.animate().cancel();
mFloatingScroller.animate().setDuration(250).alpha(0).withEndAction(() -> mFloatingScroller.setVisibility(View.GONE));
}
}
/*Triggers*/
public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List<Object> pData){
if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS)){
onUpdateLogs((String) pData.get(0));
}
else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS)){
initViews((boolean)pData.get(0));
}
else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE)){
onFloatButtonUpdate();
}
}
public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands){
onTrigger(pCommands, null);
}
}

View File

@ -1,13 +1,13 @@
package com.darkweb.genesissearchengine.appManager.orbotManager;
public class orbotEnums
{
/*Settings Manager*/
public enum eOrbotViewCommands {
M_UPDATE_BRIDGE_SETTINGS_VIEWS, M_INIT_POST_UI, M_INIT_UI, M_UPDATE_VPN, M_UPDATE_BRIDGES
}
public enum eOrbotModelCommands {
M_BRIDGE_SWITCH, M_VPN_SWITCH
}
package com.darkweb.genesissearchengine.appManager.orbotManager;
public class orbotEnums
{
/*Settings Manager*/
public enum eOrbotViewCommands {
M_UPDATE_BRIDGE_SETTINGS_VIEWS, M_INIT_POST_UI, M_INIT_UI, M_UPDATE_VPN, M_UPDATE_BRIDGES
}
public enum eOrbotModelCommands {
M_BRIDGE_SWITCH, M_VPN_SWITCH
}
}

View File

@ -1,46 +1,46 @@
package com.darkweb.genesissearchengine.appManager.orbotManager;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import java.util.Collections;
import java.util.List;
class orbotModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
orbotModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
public void onBridgeSwitch(boolean pStatus){
status.sBridgeStatus = pStatus;
pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.sBridgeStatus), pluginEnums.eOrbotManager.M_UPDATE_BRIDGES);
}
public void onVPNSwitch(boolean pStatus){
status.sVPNStatus = pStatus;
pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.sBridgeStatus), pluginEnums.eOrbotManager.M_UPDATE_VPN);
}
public void onTrigger(com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands pCommands, List<Object> pData){
if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_BRIDGE_SWITCH){
onBridgeSwitch((boolean) pData.get(0));
}
else if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_VPN_SWITCH){
onVPNSwitch((boolean) pData.get(0));
}
}
}
package com.darkweb.genesissearchengine.appManager.orbotManager;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import java.util.Collections;
import java.util.List;
class orbotModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
orbotModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
public void onBridgeSwitch(boolean pStatus){
status.sBridgeStatus = pStatus;
pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.sBridgeStatus), pluginEnums.eOrbotManager.M_UPDATE_BRIDGES);
}
public void onVPNSwitch(boolean pStatus){
status.sVPNStatus = pStatus;
pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.sBridgeStatus), pluginEnums.eOrbotManager.M_UPDATE_VPN);
}
public void onTrigger(com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands pCommands, List<Object> pData){
if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_BRIDGE_SWITCH){
onBridgeSwitch((boolean) pData.get(0));
}
else if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_VPN_SWITCH){
onVPNSwitch((boolean) pData.get(0));
}
}
}

View File

@ -1,124 +1,124 @@
package com.darkweb.genesissearchengine.appManager.proxyStatusManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class proxyStatusController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private proxyStatusModel mProxyStatusModel;
private proxyStatusViewController mProxyStatusViewController;
/* INITIALIZATIONS */
private TextView mOrbotStatus;
private SwitchMaterial mVpnStatus;
private SwitchMaterial mBridgeStatus;
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out);
super.onCreate(savedInstanceState);
setContentView(R.layout.proxy_status_view);
viewsInitializations();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
public void viewsInitializations() {
mOrbotStatus = findViewById(R.id.pOrbotStatus);
mVpnStatus = findViewById(R.id.pVpnStatus);
mBridgeStatus = findViewById(R.id.pBridgeStatus);
activityContextManager.getInstance().onStack(this);
mProxyStatusViewController = new proxyStatusViewController(this, mOrbotStatus, mVpnStatus, mBridgeStatus);
mProxyStatusViewController.onTrigger(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS, Arrays.asList(pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS), status.sVPNStatus,status.sBridgeStatus));
mProxyStatusModel = new proxyStatusModel(new proxyStatusModelCallback());
}
public void orbotLog(View view) {
helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void refreshOrbotStatus(View view) {
mProxyStatusViewController.onTrigger(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS, Arrays.asList(pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS), status.sVPNStatus,status.sBridgeStatus));
}
/* LISTENERS */
public class proxyStatusModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
public void onClose(View view){
finish();
activityContextManager.getInstance().onRemoveStack(this);
overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse);
}
/* LOCAL OVERRIDES */
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
@Override
public void onResume()
{
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
onClose(null);
}
@Override
protected void onStop() {
super.onStop();
}
package com.darkweb.genesissearchengine.appManager.proxyStatusManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class proxyStatusController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private proxyStatusModel mProxyStatusModel;
private proxyStatusViewController mProxyStatusViewController;
/* INITIALIZATIONS */
private TextView mOrbotStatus;
private SwitchMaterial mVpnStatus;
private SwitchMaterial mBridgeStatus;
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out);
super.onCreate(savedInstanceState);
setContentView(R.layout.proxy_status_view);
viewsInitializations();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
public void viewsInitializations() {
mOrbotStatus = findViewById(R.id.pOrbotStatus);
mVpnStatus = findViewById(R.id.pVpnStatus);
mBridgeStatus = findViewById(R.id.pBridgeStatus);
activityContextManager.getInstance().onStack(this);
mProxyStatusViewController = new proxyStatusViewController(this, mOrbotStatus, mVpnStatus, mBridgeStatus);
mProxyStatusViewController.onTrigger(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS, Arrays.asList(pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS), status.sVPNStatus,status.sBridgeStatus));
mProxyStatusModel = new proxyStatusModel(new proxyStatusModelCallback());
}
public void orbotLog(View view) {
helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void refreshOrbotStatus(View view) {
mProxyStatusViewController.onTrigger(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS, Arrays.asList(pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS), status.sVPNStatus,status.sBridgeStatus));
}
/* LISTENERS */
public class proxyStatusModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
public void onClose(View view){
finish();
activityContextManager.getInstance().onRemoveStack(this);
overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse);
}
/* LOCAL OVERRIDES */
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
@Override
public void onResume()
{
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
onClose(null);
}
@Override
protected void onStop() {
super.onStop();
}
}

View File

@ -1,12 +1,12 @@
package com.darkweb.genesissearchengine.appManager.proxyStatusManager;
public class proxyStatusEnums
{
/*Settings Manager*/
public enum eProxyStatusViewCommands {
M_INIT_VIEWS
}
public enum eProxyStatusModelCommands {
}
package com.darkweb.genesissearchengine.appManager.proxyStatusManager;
public class proxyStatusEnums
{
/*Settings Manager*/
public enum eProxyStatusViewCommands {
M_INIT_VIEWS
}
public enum eProxyStatusModelCommands {
}
}

View File

@ -1,17 +1,17 @@
package com.darkweb.genesissearchengine.appManager.proxyStatusManager;
import com.darkweb.genesissearchengine.eventObserver;
class proxyStatusModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
proxyStatusModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
}
package com.darkweb.genesissearchengine.appManager.proxyStatusManager;
import com.darkweb.genesissearchengine.eventObserver;
class proxyStatusModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
proxyStatusModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
}

View File

@ -1,70 +1,70 @@
package com.darkweb.genesissearchengine.appManager.proxyStatusManager;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List;
class proxyStatusViewController
{
/*Private Variables*/
private AppCompatActivity mContext;
private SwitchMaterial mBridgeSwitch;
private SwitchMaterial mVpnSwitch;
private LinearLayout mCustomizableBridgeMenu;
/*Initializations*/
private TextView mOrbotStatus;
private SwitchMaterial mVpnStatus;
private SwitchMaterial mBridgeStatus;
proxyStatusViewController(AppCompatActivity pContext, TextView pOrbotStatus, SwitchMaterial pVpnStatus, SwitchMaterial pBridgeStatus)
{
this.mContext = pContext;
this.mOrbotStatus = pOrbotStatus;
this.mVpnStatus = pVpnStatus;
this.mBridgeStatus = pBridgeStatus;
initPostUI();
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initViews(String pOrbotStatus, boolean pVPNStatus, boolean pGatewayStatus){
mOrbotStatus.setText(pOrbotStatus);
mVpnStatus.setChecked(pVPNStatus);
mBridgeStatus.setChecked(pGatewayStatus);
}
public void onTrigger(proxyStatusEnums.eProxyStatusViewCommands pCommands, List<Object> pData){
if(pCommands.equals(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS)){
initViews((String)pData.get(0),(boolean)pData.get(1),(boolean)pData.get(2));
}
}
}
package com.darkweb.genesissearchengine.appManager.proxyStatusManager;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List;
class proxyStatusViewController
{
/*Private Variables*/
private AppCompatActivity mContext;
private SwitchMaterial mBridgeSwitch;
private SwitchMaterial mVpnSwitch;
private LinearLayout mCustomizableBridgeMenu;
/*Initializations*/
private TextView mOrbotStatus;
private SwitchMaterial mVpnStatus;
private SwitchMaterial mBridgeStatus;
proxyStatusViewController(AppCompatActivity pContext, TextView pOrbotStatus, SwitchMaterial pVpnStatus, SwitchMaterial pBridgeStatus)
{
this.mContext = pContext;
this.mOrbotStatus = pOrbotStatus;
this.mVpnStatus = pVpnStatus;
this.mBridgeStatus = pBridgeStatus;
initPostUI();
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initViews(String pOrbotStatus, boolean pVPNStatus, boolean pGatewayStatus){
mOrbotStatus.setText(pOrbotStatus);
mVpnStatus.setChecked(pVPNStatus);
mBridgeStatus.setChecked(pGatewayStatus);
}
public void onTrigger(proxyStatusEnums.eProxyStatusViewCommands pCommands, List<Object> pData){
if(pCommands.equals(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS)){
initViews((String)pData.get(0),(boolean)pData.get(1),(boolean)pData.get(2));
}
}
}

View File

@ -1,189 +1,189 @@
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class settingAccessibilityController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private settingAccessibilityModel mSettingAccessibilityModel;
private settingAccessibilityViewController mSettingAccessibilityViewController;
private SwitchMaterial mZoom;
private SwitchMaterial mVoiceInput;
private SeekBar mSeekBar;
private TextView mSeekBarSample;
private TextView mScalePercentage;
/* PRIVATE LOCAL VARIABLES */
private boolean mIsSettingChanged = false;
private float mDefaultFontSize = status.sSettingFontSize;
/* Initializations */
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_accessibility_view);
viewsInitializations();
initializeListeners();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
private void viewsInitializations() {
mZoom = findViewById(R.id.pZoom);
mVoiceInput = findViewById(R.id.pVoiceInput);
mSeekBar = findViewById(R.id.pSeekBar);
mSeekBarSample = findViewById(R.id.pSeekBarSample);
mScalePercentage = findViewById(R.id.pScalePercentage);
activityContextManager.getInstance().onStack(this);
mSettingAccessibilityViewController = new settingAccessibilityViewController(this, new settingAccessibilityController.settingAccessibilityViewCallback(), mZoom, mVoiceInput, mSeekBar, mSeekBarSample, mScalePercentage);
mSettingAccessibilityModel = new settingAccessibilityModel(new settingAccessibilityController.settingAccessibilityModelCallback());
}
private void initializeListeners(){
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
mIsSettingChanged = true;
int percentage = ((progress+5)*10);
mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT, Collections.singletonList((int)((12.0*percentage)/100)));
mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE, Collections.singletonList((percentage+ constants.CONST_PERCENTAGE_SIGN)));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,percentage));
status.sSettingFontSize = percentage;
activityContextManager.getInstance().getHomeController().onLoadFont();
}
});
}
/*View Callbacks*/
private class settingAccessibilityViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/*Model Callbacks*/
private class settingAccessibilityModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
onClose(null);
}
/*UI Redirection*/
public void onOpenInfo(View view) {
helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onClose(View view){
activityContextManager.getInstance().onRemoveStack(this);
finish();
if(mIsSettingChanged && mDefaultFontSize!=status.sSettingFontSize){
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
}
}
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
public void onZoomSettingUpdate(View view){
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING, Collections.singletonList(!mZoom.isChecked()));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,status.sSettingEnableZoom));
mZoom.toggle();
new Handler().postDelayed(() ->
{
activityContextManager.getInstance().getHomeController().onReload(null);
}, 300);
}
public void onVoiceInputSettingUpdate(View view){
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING, Collections.singletonList(!mVoiceInput.isChecked()));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,status.sSettingEnableVoiceInput));
mVoiceInput.toggle();
}
}
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class settingAccessibilityController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private settingAccessibilityModel mSettingAccessibilityModel;
private settingAccessibilityViewController mSettingAccessibilityViewController;
private SwitchMaterial mZoom;
private SwitchMaterial mVoiceInput;
private SeekBar mSeekBar;
private TextView mSeekBarSample;
private TextView mScalePercentage;
/* PRIVATE LOCAL VARIABLES */
private boolean mIsSettingChanged = false;
private float mDefaultFontSize = status.sSettingFontSize;
/* Initializations */
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_accessibility_view);
viewsInitializations();
initializeListeners();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
private void viewsInitializations() {
mZoom = findViewById(R.id.pZoom);
mVoiceInput = findViewById(R.id.pVoiceInput);
mSeekBar = findViewById(R.id.pSeekBar);
mSeekBarSample = findViewById(R.id.pSeekBarSample);
mScalePercentage = findViewById(R.id.pScalePercentage);
activityContextManager.getInstance().onStack(this);
mSettingAccessibilityViewController = new settingAccessibilityViewController(this, new settingAccessibilityController.settingAccessibilityViewCallback(), mZoom, mVoiceInput, mSeekBar, mSeekBarSample, mScalePercentage);
mSettingAccessibilityModel = new settingAccessibilityModel(new settingAccessibilityController.settingAccessibilityModelCallback());
}
private void initializeListeners(){
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
mIsSettingChanged = true;
int percentage = ((progress+5)*10);
mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT, Collections.singletonList((int)((12.0*percentage)/100)));
mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE, Collections.singletonList((percentage+ constants.CONST_PERCENTAGE_SIGN)));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,percentage));
status.sSettingFontSize = percentage;
activityContextManager.getInstance().getHomeController().onLoadFont();
}
});
}
/*View Callbacks*/
private class settingAccessibilityViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/*Model Callbacks*/
private class settingAccessibilityModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
onClose(null);
}
/*UI Redirection*/
public void onOpenInfo(View view) {
helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onClose(View view){
activityContextManager.getInstance().onRemoveStack(this);
finish();
if(mIsSettingChanged && mDefaultFontSize!=status.sSettingFontSize){
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
}
}
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
public void onZoomSettingUpdate(View view){
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING, Collections.singletonList(!mZoom.isChecked()));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,status.sSettingEnableZoom));
mZoom.toggle();
new Handler().postDelayed(() ->
{
activityContextManager.getInstance().getHomeController().onReload(null);
}, 300);
}
public void onVoiceInputSettingUpdate(View view){
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING, Collections.singletonList(!mVoiceInput.isChecked()));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,status.sSettingEnableVoiceInput));
mVoiceInput.toggle();
}
}

View File

@ -1,14 +1,14 @@
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
class settingAccessibilityEnums
{
/*History Manager*/
public enum eAccessibilityModel {
M_UPDATE_SAMPLE_TEXT, M_UPDATE_PERCENTAGE
}
public enum eAccessibilityViewController {
M_ZOOM_SETTING, M_VOICE_INPUT_SETTING
}
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
class settingAccessibilityEnums
{
/*History Manager*/
public enum eAccessibilityModel {
M_UPDATE_SAMPLE_TEXT, M_UPDATE_PERCENTAGE
}
public enum eAccessibilityViewController {
M_ZOOM_SETTING, M_VOICE_INPUT_SETTING
}
}

View File

@ -1,38 +1,38 @@
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import java.util.List;
class settingAccessibilityModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingAccessibilityModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
private void onZoomSettingUpdate(boolean pStatus){
status.sSettingEnableZoom = pStatus;
}
private void onVoiceInputSettingUpdate(boolean pStatus){
status.sSettingEnableVoiceInput = pStatus;
}
public Object onTrigger(settingAccessibilityEnums.eAccessibilityViewController pCommands, List<Object> pData){
if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING)){
onZoomSettingUpdate((boolean)pData.get(0));
}
else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING)){
onVoiceInputSettingUpdate((boolean)pData.get(0));
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import java.util.List;
class settingAccessibilityModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingAccessibilityModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
private void onZoomSettingUpdate(boolean pStatus){
status.sSettingEnableZoom = pStatus;
}
private void onVoiceInputSettingUpdate(boolean pStatus){
status.sSettingEnableVoiceInput = pStatus;
}
public Object onTrigger(settingAccessibilityEnums.eAccessibilityViewController pCommands, List<Object> pData){
if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING)){
onZoomSettingUpdate((boolean)pData.get(0));
}
else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING)){
onVoiceInputSettingUpdate((boolean)pData.get(0));
}
return null;
}
}

View File

@ -1,112 +1,112 @@
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List;
class settingAccessibilityViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private SwitchMaterial mZoom;
private SwitchMaterial mVoiceInput;
private SeekBar mSeekBar;
private TextView mSeekBarSample;
private TextView mScalePercentage;
/*Initializations*/
settingAccessibilityViewController(settingAccessibilityController pContext, eventObserver.eventListener pEvent, SwitchMaterial pZoom, SwitchMaterial pVoiceInput, SeekBar pSeekBar, TextView mSeekBarSample, TextView pScalePercentage)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mZoom = pZoom;
this.mVoiceInput = pVoiceInput;
this.mSeekBar = pSeekBar;
this.mSeekBarSample = mSeekBarSample;
this.mScalePercentage = pScalePercentage;
initViews();
initPostUI();
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initViews()
{
if(status.sSettingEnableZoom){
mZoom.setChecked(true);
}else {
mZoom.setChecked(false);
}
if(status.sSettingEnableVoiceInput){
mVoiceInput.setChecked(true);
}else {
mVoiceInput.setChecked(false);
}
mSeekBar.setProgress((int)status.sSettingFontSize/10-5);
float percentage = status.sSettingFontSize;
if(status.sSettingFontSize<100){
mSeekBarSample.setTextSize((int)((12*percentage)/100));
}else if(status.sSettingFontSize>100){
mSeekBarSample.setTextSize((int)((12*percentage)/100));
}
mScalePercentage.setText(((int)percentage + constants.CONST_PERCENTAGE_SIGN));
mSeekBar.setAlpha(1f);
mScalePercentage.setAlpha(1f);
mSeekBarSample.setAlpha(1f);
mSeekBar.setEnabled(true);
}
private void updateSampleTextSize(int pText){
mSeekBarSample.setTextSize(pText);
}
private void updatePercentage(String pText){
mScalePercentage.setText(pText);
}
public Object onTrigger(settingAccessibilityEnums.eAccessibilityModel pCommands, List<Object> pData){
if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT)){
updateSampleTextSize((int)pData.get(0));
}
else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE)){
updatePercentage((String)pData.get(0));
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List;
class settingAccessibilityViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private SwitchMaterial mZoom;
private SwitchMaterial mVoiceInput;
private SeekBar mSeekBar;
private TextView mSeekBarSample;
private TextView mScalePercentage;
/*Initializations*/
settingAccessibilityViewController(settingAccessibilityController pContext, eventObserver.eventListener pEvent, SwitchMaterial pZoom, SwitchMaterial pVoiceInput, SeekBar pSeekBar, TextView mSeekBarSample, TextView pScalePercentage)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mZoom = pZoom;
this.mVoiceInput = pVoiceInput;
this.mSeekBar = pSeekBar;
this.mSeekBarSample = mSeekBarSample;
this.mScalePercentage = pScalePercentage;
initViews();
initPostUI();
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initViews()
{
if(status.sSettingEnableZoom){
mZoom.setChecked(true);
}else {
mZoom.setChecked(false);
}
if(status.sSettingEnableVoiceInput){
mVoiceInput.setChecked(true);
}else {
mVoiceInput.setChecked(false);
}
mSeekBar.setProgress((int)status.sSettingFontSize/10-5);
float percentage = status.sSettingFontSize;
if(status.sSettingFontSize<100){
mSeekBarSample.setTextSize((int)((12*percentage)/100));
}else if(status.sSettingFontSize>100){
mSeekBarSample.setTextSize((int)((12*percentage)/100));
}
mScalePercentage.setText(((int)percentage + constants.CONST_PERCENTAGE_SIGN));
mSeekBar.setAlpha(1f);
mScalePercentage.setAlpha(1f);
mSeekBarSample.setAlpha(1f);
mSeekBar.setEnabled(true);
}
private void updateSampleTextSize(int pText){
mSeekBarSample.setTextSize(pText);
}
private void updatePercentage(String pText){
mScalePercentage.setText(pText);
}
public Object onTrigger(settingAccessibilityEnums.eAccessibilityModel pCommands, List<Object> pData){
if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT)){
updateSampleTextSize((int)pData.get(0));
}
else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE)){
updatePercentage((String)pData.get(0));
}
return null;
}
}

View File

@ -1,185 +1,185 @@
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class settingAdvanceController extends AppCompatActivity {
/* Private Variables */
private settingAdvanceModel mSettingAdvanceModel;
private settingAdvanceViewController mSettingAdvanceViewController;
private SwitchMaterial mRestoreTabs;
private SwitchMaterial mShowWebFonts;
private SwitchMaterial mToolbarTheme;
private ArrayList<RadioButton> mImageOption = new ArrayList<>();
private ArrayList<RadioButton> mTabLayoutOption = new ArrayList<>();
private boolean mIsChanged = false;
/* Initializations */
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_advance_view);
viewsInitializations();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
public void viewsInitializations() {
mRestoreTabs = findViewById(R.id.pRestoreTabs);
mShowWebFonts = findViewById(R.id.pShowWebFonts);
mToolbarTheme = findViewById(R.id.pToolbarTheme);
mImageOption.add(findViewById(R.id.pAdvanceImageOption1));
mImageOption.add(findViewById(R.id.pAdvanceImageOption2));
mTabLayoutOption.add(findViewById(R.id.pAdvanceGridOption1));
mTabLayoutOption.add(findViewById(R.id.pAdvanceGridOption2));
activityContextManager.getInstance().onStack(this);
mSettingAdvanceViewController = new settingAdvanceViewController(this, new settingAdvanceViewCallback(), mRestoreTabs, mShowWebFonts, mToolbarTheme, mImageOption, mTabLayoutOption);
mSettingAdvanceModel = new settingAdvanceModel(new settingAdvanceModelCallback());
}
public void onOpenInfo(View view) {
helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true);
}
/*View Callbacks*/
public class settingAdvanceViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/*Model Callbacks*/
public class settingAdvanceModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
int notificationStatus = (int)pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_NOTIFICATION_STATUS);
if(notificationStatus==0){
pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION);
} else if(notificationStatus==1){
pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION);
}
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
onClose(null);
activityContextManager.getInstance().onRemoveStack(this);
}
/*UI Redirection*/
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
public void onClose(View view){
if(mIsChanged){
pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sShowImages, status.sClearOnExit), pluginEnums.eOrbotManager.M_UPDATE_PRIVACY);
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
}
finish();
}
public void onRestoreTabs(View view) {
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB, Collections.singletonList(!mRestoreTabs.isChecked()));
mRestoreTabs.toggle();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB, status.sRestoreTabs));
}
public void onShowImages(View view) {
mIsChanged = true;
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE, Collections.singletonList(null));
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE, Collections.singletonList(view));
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE, Collections.singletonList(view));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,status.sShowImages));
}
public void onGridView(View view) {
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_GRID, Collections.singletonList(null));
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_TAB_GRID, Collections.singletonList(view));
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_SET_GRID, Collections.singletonList(view));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,status.sTabGridLayoutEnabled));
}
public void onShowWebFonts(View view) {
mIsChanged = true;
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS, Collections.singletonList(!mShowWebFonts.isChecked()));
mShowWebFonts.toggle();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,status.sShowWebFonts));
}
public void onToolbarTheme(View view) {
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_TOOLBAR_THEME, Collections.singletonList(!mToolbarTheme.isChecked()));
mToolbarTheme.toggle();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,status.sToolbarTheme));
activityContextManager.getInstance().getHomeController().onUpdateStatusBarTheme();
}
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class settingAdvanceController extends AppCompatActivity {
/* Private Variables */
private settingAdvanceModel mSettingAdvanceModel;
private settingAdvanceViewController mSettingAdvanceViewController;
private SwitchMaterial mRestoreTabs;
private SwitchMaterial mShowWebFonts;
private SwitchMaterial mToolbarTheme;
private ArrayList<RadioButton> mImageOption = new ArrayList<>();
private ArrayList<RadioButton> mTabLayoutOption = new ArrayList<>();
private boolean mIsChanged = false;
/* Initializations */
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_advance_view);
viewsInitializations();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
public void viewsInitializations() {
mRestoreTabs = findViewById(R.id.pRestoreTabs);
mShowWebFonts = findViewById(R.id.pShowWebFonts);
mToolbarTheme = findViewById(R.id.pToolbarTheme);
mImageOption.add(findViewById(R.id.pAdvanceImageOption1));
mImageOption.add(findViewById(R.id.pAdvanceImageOption2));
mTabLayoutOption.add(findViewById(R.id.pAdvanceGridOption1));
mTabLayoutOption.add(findViewById(R.id.pAdvanceGridOption2));
activityContextManager.getInstance().onStack(this);
mSettingAdvanceViewController = new settingAdvanceViewController(this, new settingAdvanceViewCallback(), mRestoreTabs, mShowWebFonts, mToolbarTheme, mImageOption, mTabLayoutOption);
mSettingAdvanceModel = new settingAdvanceModel(new settingAdvanceModelCallback());
}
public void onOpenInfo(View view) {
helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true);
}
/*View Callbacks*/
public class settingAdvanceViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/*Model Callbacks*/
public class settingAdvanceModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
int notificationStatus = (int)pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_NOTIFICATION_STATUS);
if(notificationStatus==0){
pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION);
} else if(notificationStatus==1){
pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION);
}
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
onClose(null);
activityContextManager.getInstance().onRemoveStack(this);
}
/*UI Redirection*/
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
public void onClose(View view){
if(mIsChanged){
pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sShowImages, status.sClearOnExit), pluginEnums.eOrbotManager.M_UPDATE_PRIVACY);
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
}
finish();
}
public void onRestoreTabs(View view) {
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB, Collections.singletonList(!mRestoreTabs.isChecked()));
mRestoreTabs.toggle();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB, status.sRestoreTabs));
}
public void onShowImages(View view) {
mIsChanged = true;
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE, Collections.singletonList(null));
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE, Collections.singletonList(view));
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE, Collections.singletonList(view));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,status.sShowImages));
}
public void onGridView(View view) {
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_GRID, Collections.singletonList(null));
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_TAB_GRID, Collections.singletonList(view));
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_SET_GRID, Collections.singletonList(view));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,status.sTabGridLayoutEnabled));
}
public void onShowWebFonts(View view) {
mIsChanged = true;
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS, Collections.singletonList(!mShowWebFonts.isChecked()));
mShowWebFonts.toggle();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,status.sShowWebFonts));
}
public void onToolbarTheme(View view) {
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_TOOLBAR_THEME, Collections.singletonList(!mToolbarTheme.isChecked()));
mToolbarTheme.toggle();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,status.sToolbarTheme));
activityContextManager.getInstance().getHomeController().onUpdateStatusBarTheme();
}
}

View File

@ -1,14 +1,14 @@
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
class settingAdvanceEnums
{
/*History Manager*/
public enum eAdvanceModel {
M_RESTORE_TAB, M_SHOW_IMAGE, M_SHOW_TAB_GRID, M_SHOW_WEB_FONTS, M_TOOLBAR_THEME
}
public enum eAdvanceViewController {
M_CLEAR_IMAGE, M_SET_IMAGE, M_CLEAR_GRID, M_SET_GRID
}
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
class settingAdvanceEnums
{
/*History Manager*/
public enum eAdvanceModel {
M_RESTORE_TAB, M_SHOW_IMAGE, M_SHOW_TAB_GRID, M_SHOW_WEB_FONTS, M_TOOLBAR_THEME
}
public enum eAdvanceViewController {
M_CLEAR_IMAGE, M_SET_IMAGE, M_CLEAR_GRID, M_SET_GRID
}
}

View File

@ -1,76 +1,76 @@
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
import android.view.View;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import java.util.List;
class settingAdvanceModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingAdvanceModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
private void onRestoreTabs(boolean pStatus) {
status.sRestoreTabs = pStatus;
}
private void onShowImages(View pView) {
if(pView.getId() == R.id.pAdvanceOption1){
status.sShowImages = 0;
}
else if(pView.getId() == R.id.pAdvanceOption2){
status.sShowImages = 2;
}
}
private void onShowTabGrid(View pView) {
if(pView.getId() == R.id.pGridOption1){
status.sTabGridLayoutEnabled = true;
}
else if(pView.getId() == R.id.pGridOption2){
status.sTabGridLayoutEnabled = false;
}
}
private void onShowWebFonts(boolean pStatus) {
status.sShowWebFonts = pStatus;
}
private void onToolbarThemeChange(boolean pStatus) {
status.sToolbarTheme = pStatus;
}
public Object onTrigger(settingAdvanceEnums.eAdvanceModel pCommands, List<Object> pData){
if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB)){
onRestoreTabs((boolean)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE)){
onShowImages((View)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS)){
onShowWebFonts((boolean)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_TOOLBAR_THEME)){
onToolbarThemeChange((boolean)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_TAB_GRID)){
onShowTabGrid((View)pData.get(0));
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
import android.view.View;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import java.util.List;
class settingAdvanceModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingAdvanceModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
private void onRestoreTabs(boolean pStatus) {
status.sRestoreTabs = pStatus;
}
private void onShowImages(View pView) {
if(pView.getId() == R.id.pAdvanceOption1){
status.sShowImages = 0;
}
else if(pView.getId() == R.id.pAdvanceOption2){
status.sShowImages = 2;
}
}
private void onShowTabGrid(View pView) {
if(pView.getId() == R.id.pGridOption1){
status.sTabGridLayoutEnabled = true;
}
else if(pView.getId() == R.id.pGridOption2){
status.sTabGridLayoutEnabled = false;
}
}
private void onShowWebFonts(boolean pStatus) {
status.sShowWebFonts = pStatus;
}
private void onToolbarThemeChange(boolean pStatus) {
status.sToolbarTheme = pStatus;
}
public Object onTrigger(settingAdvanceEnums.eAdvanceModel pCommands, List<Object> pData){
if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB)){
onRestoreTabs((boolean)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE)){
onShowImages((View)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS)){
onShowWebFonts((boolean)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_TOOLBAR_THEME)){
onToolbarThemeChange((boolean)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_TAB_GRID)){
onShowTabGrid((View)pData.get(0));
}
return null;
}
}

View File

@ -1,162 +1,162 @@
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RadioButton;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.List;
class settingAdvanceViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private SwitchMaterial mRestoreTabs;
private SwitchMaterial mShowWebFonts;
private SwitchMaterial mToolbarTheme;
private ArrayList<RadioButton> mImageOption;
private ArrayList<RadioButton> mTabLayoutOption;
/*Initializations*/
settingAdvanceViewController(settingAdvanceController pContext, eventObserver.eventListener pEvent, SwitchMaterial pRestoreTabs, SwitchMaterial pShowWebFonts, SwitchMaterial pToolbarTheme, ArrayList<RadioButton> pImageOption, ArrayList<RadioButton> pTabLayoutOption)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mRestoreTabs = pRestoreTabs;
this.mShowWebFonts = pShowWebFonts;
this.mToolbarTheme = pToolbarTheme;
this.mImageOption = pImageOption;
this.mTabLayoutOption = pTabLayoutOption;
initViews();
initPostUI();
}
private void initViews()
{
if(status.sRestoreTabs){
mRestoreTabs.setChecked(true);
}else {
mRestoreTabs.setChecked(false);
}
if(status.sShowWebFonts){
mShowWebFonts.setChecked(true);
}else {
mShowWebFonts.setChecked(false);
}
if(status.sToolbarTheme){
mToolbarTheme.setChecked(true);
}else {
mToolbarTheme.setChecked(false);
}
clearImageOptions();
if(status.sShowImages == 0){
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(0).setChecked(true);
}
else if(status.sShowImages == 2){
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(1).setChecked(true);
}
if(status.sTabGridLayoutEnabled){
mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mTabLayoutOption.get(0).setChecked(true);
}
else{
mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mTabLayoutOption.get(1).setChecked(true);
}
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void clearImageOptions(){
mImageOption.get(0).setChecked(false);
mImageOption.get(1).setChecked(false);
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
}
private void clearGridOptions(){
mTabLayoutOption.get(0).setChecked(false);
mTabLayoutOption.get(1).setChecked(false);
mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
}
private void setImageOptions(View pView){
clearImageOptions();
if(pView.getId() == R.id.pAdvanceOption1){
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(0).setChecked(true);
}
else if(pView.getId() == R.id.pAdvanceOption2){
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(1).setChecked(true);
}
}
private void setGridOptions(View pView){
clearGridOptions();
if(pView.getId() == R.id.pGridOption1){
mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mTabLayoutOption.get(0).setChecked(true);
}
else if(pView.getId() == R.id.pGridOption2){
mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mTabLayoutOption.get(1).setChecked(true);
}
}
public Object onTrigger(settingAdvanceEnums.eAdvanceViewController pCommands, List<Object> pData){
if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE)){
clearImageOptions();
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_GRID)){
clearGridOptions();
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE)){
setImageOptions((View) pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_SET_GRID)){
setGridOptions((View) pData.get(0));
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RadioButton;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.List;
class settingAdvanceViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private SwitchMaterial mRestoreTabs;
private SwitchMaterial mShowWebFonts;
private SwitchMaterial mToolbarTheme;
private ArrayList<RadioButton> mImageOption;
private ArrayList<RadioButton> mTabLayoutOption;
/*Initializations*/
settingAdvanceViewController(settingAdvanceController pContext, eventObserver.eventListener pEvent, SwitchMaterial pRestoreTabs, SwitchMaterial pShowWebFonts, SwitchMaterial pToolbarTheme, ArrayList<RadioButton> pImageOption, ArrayList<RadioButton> pTabLayoutOption)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mRestoreTabs = pRestoreTabs;
this.mShowWebFonts = pShowWebFonts;
this.mToolbarTheme = pToolbarTheme;
this.mImageOption = pImageOption;
this.mTabLayoutOption = pTabLayoutOption;
initViews();
initPostUI();
}
private void initViews()
{
if(status.sRestoreTabs){
mRestoreTabs.setChecked(true);
}else {
mRestoreTabs.setChecked(false);
}
if(status.sShowWebFonts){
mShowWebFonts.setChecked(true);
}else {
mShowWebFonts.setChecked(false);
}
if(status.sToolbarTheme){
mToolbarTheme.setChecked(true);
}else {
mToolbarTheme.setChecked(false);
}
clearImageOptions();
if(status.sShowImages == 0){
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(0).setChecked(true);
}
else if(status.sShowImages == 2){
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(1).setChecked(true);
}
if(status.sTabGridLayoutEnabled){
mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mTabLayoutOption.get(0).setChecked(true);
}
else{
mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mTabLayoutOption.get(1).setChecked(true);
}
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void clearImageOptions(){
mImageOption.get(0).setChecked(false);
mImageOption.get(1).setChecked(false);
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
}
private void clearGridOptions(){
mTabLayoutOption.get(0).setChecked(false);
mTabLayoutOption.get(1).setChecked(false);
mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
}
private void setImageOptions(View pView){
clearImageOptions();
if(pView.getId() == R.id.pAdvanceOption1){
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(0).setChecked(true);
}
else if(pView.getId() == R.id.pAdvanceOption2){
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(1).setChecked(true);
}
}
private void setGridOptions(View pView){
clearGridOptions();
if(pView.getId() == R.id.pGridOption1){
mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mTabLayoutOption.get(0).setChecked(true);
}
else if(pView.getId() == R.id.pGridOption2){
mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mTabLayoutOption.get(1).setChecked(true);
}
}
public Object onTrigger(settingAdvanceEnums.eAdvanceViewController pCommands, List<Object> pData){
if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE)){
clearImageOptions();
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_GRID)){
clearGridOptions();
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE)){
setImageOptions((View) pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_SET_GRID)){
setGridOptions((View) pData.get(0));
}
return null;
}
}

View File

@ -1,277 +1,277 @@
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeEnums;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import org.mozilla.geckoview.ContentBlocking;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_BOOKMARK;
import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_DATA_CLEARED;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
public class settingClearController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private settingClearModel mSettingClearModel;
private settingClearViewController mSettingClearViewController;
private ArrayList<CheckBox> mCheckBoxList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_clear_view);
viewsInitializations();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
public void viewsInitializations() {
mCheckBoxList.add(findViewById(R.id.pClearChecked_1));
mCheckBoxList.add(findViewById(R.id.pClearChecked_2));
mCheckBoxList.add(findViewById(R.id.pClearChecked_3));
mCheckBoxList.add(findViewById(R.id.pClearChecked_4));
mCheckBoxList.add(findViewById(R.id.pClearChecked_5));
mCheckBoxList.add(findViewById(R.id.pClearChecked_6));
mCheckBoxList.add(findViewById(R.id.pClearChecked_7));
mCheckBoxList.add(findViewById(R.id.pClearChecked_8));
activityContextManager.getInstance().onStack(this);
mSettingClearViewController = new settingClearViewController(this, new settingClearController.settingClearViewCallback(), mCheckBoxList);
mSettingClearModel = new settingClearModel(new settingClearController.settingClearModelCallback());
}
/*View Callbacks*/
private class settingClearViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/*Model Callbacks*/
private class settingClearModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
public void onClearData(View view){
boolean mHomeInvoked = false;
if(mCheckBoxList.get(0).isChecked()){
mCheckBoxList.get(0).setChecked(false);
mCheckBoxList.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mHomeInvoked = true;
}
if(mCheckBoxList.get(1).isChecked()){
mCheckBoxList.get(1).setChecked(false);
mCheckBoxList.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null));
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null);
}
if(mCheckBoxList.get(2).isChecked()){
mCheckBoxList.get(2).setChecked(false);
mCheckBoxList.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_BOOKMARK,null));
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,null);
}
if(mCheckBoxList.get(3).isChecked()){
mCheckBoxList.get(3).setChecked(false);
mCheckBoxList.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearCache();
}
if(mCheckBoxList.get(4).isChecked()){
mCheckBoxList.get(4).setChecked(false);
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mCheckBoxList.get(4).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearSiteData();
mHomeInvoked = true;
}
if(mCheckBoxList.get(5).isChecked()){
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mCheckBoxList.get(5).setChecked(false);
mCheckBoxList.get(5).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearSession();
mHomeInvoked = true;
}
if(mCheckBoxList.get(6).isChecked()){
mCheckBoxList.get(6).setChecked(false);
mCheckBoxList.get(6).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearCookies();
}
if(mCheckBoxList.get(7).isChecked()){
mCheckBoxList.get(7).setChecked(false);
mCheckBoxList.get(7).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
onClearSettings();
status.initStatus(activityContextManager.getInstance().getHomeController());
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mHomeInvoked = true;
}
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_DATA_CLEARED);
if(mHomeInvoked){
activityContextManager.getInstance().getHomeController().onClearSettings();
}
}
private void onClearSettings(){
boolean mIsThemeChangable = false;
if(!status.sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mIsThemeChangable = true;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mIsThemeChangable = true;
}
}
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE, strings.SETTING_DEFAULT_LANGUAGE));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
if(mIsThemeChangable) {
status.mThemeApplying = true;
onBackPressed();
overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang);
activityContextManager.getInstance().getHomeController().onReInitTheme();
activityContextManager.getInstance().getSettingController().onReInitTheme();
helperMethod.openActivity(settingClearController.class, constants.CONST_LIST_HISTORY, settingClearController.this, true);
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
onClose(null);
}
/*UI Redirection*/
public void onOpenInfo(View view) {
helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onCheckBoxTriggered(View view){
if(view!=null && view.getTag()!=null){
mSettingClearViewController.onTrigger(settingClearEnums.eClearViewController.M_CHECK_INVOKE, Arrays.asList(view.getTag(),!mCheckBoxList.get(Integer.parseInt(view.getTag().toString())).isChecked()));
}
}
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
public void onClose(View view){
activityContextManager.getInstance().onRemoveStack(this);
finish();
}
}
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeEnums;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import org.mozilla.geckoview.ContentBlocking;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_BOOKMARK;
import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_DATA_CLEARED;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
public class settingClearController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private settingClearModel mSettingClearModel;
private settingClearViewController mSettingClearViewController;
private ArrayList<CheckBox> mCheckBoxList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_clear_view);
viewsInitializations();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
public void viewsInitializations() {
mCheckBoxList.add(findViewById(R.id.pClearChecked_1));
mCheckBoxList.add(findViewById(R.id.pClearChecked_2));
mCheckBoxList.add(findViewById(R.id.pClearChecked_3));
mCheckBoxList.add(findViewById(R.id.pClearChecked_4));
mCheckBoxList.add(findViewById(R.id.pClearChecked_5));
mCheckBoxList.add(findViewById(R.id.pClearChecked_6));
mCheckBoxList.add(findViewById(R.id.pClearChecked_7));
mCheckBoxList.add(findViewById(R.id.pClearChecked_8));
activityContextManager.getInstance().onStack(this);
mSettingClearViewController = new settingClearViewController(this, new settingClearController.settingClearViewCallback(), mCheckBoxList);
mSettingClearModel = new settingClearModel(new settingClearController.settingClearModelCallback());
}
/*View Callbacks*/
private class settingClearViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/*Model Callbacks*/
private class settingClearModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
public void onClearData(View view){
boolean mHomeInvoked = false;
if(mCheckBoxList.get(0).isChecked()){
mCheckBoxList.get(0).setChecked(false);
mCheckBoxList.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mHomeInvoked = true;
}
if(mCheckBoxList.get(1).isChecked()){
mCheckBoxList.get(1).setChecked(false);
mCheckBoxList.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null));
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null);
}
if(mCheckBoxList.get(2).isChecked()){
mCheckBoxList.get(2).setChecked(false);
mCheckBoxList.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_BOOKMARK,null));
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,null);
}
if(mCheckBoxList.get(3).isChecked()){
mCheckBoxList.get(3).setChecked(false);
mCheckBoxList.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearCache();
}
if(mCheckBoxList.get(4).isChecked()){
mCheckBoxList.get(4).setChecked(false);
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mCheckBoxList.get(4).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearSiteData();
mHomeInvoked = true;
}
if(mCheckBoxList.get(5).isChecked()){
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mCheckBoxList.get(5).setChecked(false);
mCheckBoxList.get(5).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearSession();
mHomeInvoked = true;
}
if(mCheckBoxList.get(6).isChecked()){
mCheckBoxList.get(6).setChecked(false);
mCheckBoxList.get(6).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearCookies();
}
if(mCheckBoxList.get(7).isChecked()){
mCheckBoxList.get(7).setChecked(false);
mCheckBoxList.get(7).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
onClearSettings();
status.initStatus(activityContextManager.getInstance().getHomeController());
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mHomeInvoked = true;
}
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_DATA_CLEARED);
if(mHomeInvoked){
activityContextManager.getInstance().getHomeController().onClearSettings();
}
}
private void onClearSettings(){
boolean mIsThemeChangable = false;
if(!status.sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mIsThemeChangable = true;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mIsThemeChangable = true;
}
}
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE, strings.SETTING_DEFAULT_LANGUAGE));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
if(mIsThemeChangable) {
status.mThemeApplying = true;
onBackPressed();
overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang);
activityContextManager.getInstance().getHomeController().onReInitTheme();
activityContextManager.getInstance().getSettingController().onReInitTheme();
helperMethod.openActivity(settingClearController.class, constants.CONST_LIST_HISTORY, settingClearController.this, true);
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
onClose(null);
}
/*UI Redirection*/
public void onOpenInfo(View view) {
helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onCheckBoxTriggered(View view){
if(view!=null && view.getTag()!=null){
mSettingClearViewController.onTrigger(settingClearEnums.eClearViewController.M_CHECK_INVOKE, Arrays.asList(view.getTag(),!mCheckBoxList.get(Integer.parseInt(view.getTag().toString())).isChecked()));
}
}
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
public void onClose(View view){
activityContextManager.getInstance().onRemoveStack(this);
finish();
}
}

View File

@ -1,13 +1,13 @@
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
class settingClearEnums
{
/*History Manager*/
public enum eClearModel {
}
public enum eClearViewController {
M_CHECK_INVOKE
}
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
class settingClearEnums
{
/*History Manager*/
public enum eClearModel {
}
public enum eClearViewController {
M_CHECK_INVOKE
}
}

View File

@ -1,20 +1,20 @@
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
import com.darkweb.genesissearchengine.eventObserver;
class settingClearModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingClearModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
}
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
import com.darkweb.genesissearchengine.eventObserver;
class settingClearModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingClearModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
}

View File

@ -1,69 +1,69 @@
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CheckBox;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.List;
class settingClearViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private ArrayList<CheckBox> mCheckBoxList;
/*Initializations*/
settingClearViewController(settingClearController pContext, eventObserver.eventListener pEvent, ArrayList<CheckBox> pCheckBoxList)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mCheckBoxList = pCheckBoxList;
initPostUI();
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void onClearCheckbox(int pIndex, boolean pStatus){
mCheckBoxList.get(pIndex).setChecked(pStatus);
if(pStatus){
mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint)));
}else {
mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint_default)));
}
}
public Object onTrigger(settingClearEnums.eClearViewController pCommands, List<Object> pData){
if(pCommands.equals(settingClearEnums.eClearViewController.M_CHECK_INVOKE)){
onClearCheckbox(Integer.parseInt(pData.get(0).toString()), (boolean)pData.get(1));
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CheckBox;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.List;
class settingClearViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private ArrayList<CheckBox> mCheckBoxList;
/*Initializations*/
settingClearViewController(settingClearController pContext, eventObserver.eventListener pEvent, ArrayList<CheckBox> pCheckBoxList)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mCheckBoxList = pCheckBoxList;
initPostUI();
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void onClearCheckbox(int pIndex, boolean pStatus){
mCheckBoxList.get(pIndex).setChecked(pStatus);
if(pStatus){
mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint)));
}else {
mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint_default)));
}
}
public Object onTrigger(settingClearEnums.eClearViewController pCommands, List<Object> pData){
if(pCommands.equals(settingClearEnums.eClearViewController.M_CHECK_INVOKE)){
onClearCheckbox(Integer.parseInt(pData.get(0).toString()), (boolean)pData.get(1));
}
return null;
}
}

View File

@ -1,253 +1,253 @@
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.appManager.languageManager.languageController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class settingGeneralController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private settingGeneralModel mSettingGeneralModel;
private settingGeneralViewController mSettingGeneralViewController;
private SwitchMaterial mFullScreenMode;
private SwitchMaterial mOpenURLInNewTab;
private RadioButton mThemeLight;
private RadioButton mThemeDark;
private RadioButton mThemeDefault;
private TextView mHomePageText;
/* PRIVATE LOCAL VARIABLES */
private Boolean mIsThemeChanging = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState);
if(!status.mThemeApplying){
activityContextManager.getInstance().onStack(this);
}
setContentView(R.layout.setting_general_view);
activityContextManager.getInstance().setSettingGeneralController(this);
viewsInitializations();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if(!mIsThemeChanging){
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
}
private void viewsInitializations() {
mFullScreenMode = findViewById(R.id.pJSStatus);
mThemeLight = findViewById(R.id.pThemeLight);
mThemeDark = findViewById(R.id.pThemeDark);
mThemeDefault = findViewById(R.id.pThemeDefault);
mHomePageText = findViewById(R.id.pHomePageText);
mOpenURLInNewTab = findViewById(R.id.pOpenURLInNewTab);
mSettingGeneralViewController = new settingGeneralViewController(this, new settingGeneralViewCallback(), mFullScreenMode, mThemeLight, mThemeDark, mThemeDefault, mHomePageText, mOpenURLInNewTab);
mSettingGeneralModel = new settingGeneralModel(new settingGeneralModelCallback());
}
/*View Callbacks*/
private class settingGeneralViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
if(settingGeneralEnums.eGeneralViewCallback.M_RESET_THEME_INVOKED_BACK.equals(e_type))
{
boolean mIsThemeChangable = false;
if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mIsThemeChangable = true;
}
}
else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mIsThemeChangable = true;
}
}else {
if(!status.sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mIsThemeChangable = true;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mIsThemeChangable = true;
}
}
}
if(mIsThemeChangable){
status.mThemeApplying = true;
onBackPressed();
overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang);
activityContextManager.getInstance().getHomeController().onReInitTheme();
activityContextManager.getInstance().getSettingController().onReInitTheme();
helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, settingGeneralController.this,true);
}
}
return null;
}
}
/*Model Callbacks*/
private class settingGeneralModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
if(status.mThemeApplying){
// activityContextManager.getInstance().onStack(this);
}
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
finish();
}
/*External Redirection*/
public void onLanguageChanged(){
setContentView(R.layout.setting_general_view);
}
/*UI Redirection*/
public void onClose(View view){
finish();
}
@Override
protected void onDestroy() {
if(!status.mThemeApplying){
activityContextManager.getInstance().onRemoveStack(this);
}
activityContextManager.getInstance().setSettingGeneralController(null);
super.onDestroy();
}
public void onManageLanguage(View view) {
helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onFullScreenBrowsing(View view){
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING, Collections.singletonList(!mFullScreenMode.isChecked()));
mFullScreenMode.toggle();
activityContextManager.getInstance().getHomeController().onFullScreenSettingChanged();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,status.sFullScreenBrowsing));
}
public void onSelectTheme(View view){
if(!mIsThemeChanging){
mIsThemeChanging = true;
if(view.getId() == R.id.pOption1){
if(status.sTheme != enums.Theme.THEME_DARK) {
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DARK));
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DARK));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DARK));
mIsThemeChanging = false;
}else {
mIsThemeChanging = false;
}
}else if(view.getId() == R.id.pOption2) {
if(status.sTheme != enums.Theme.THEME_LIGHT) {
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT));
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_LIGHT));
mIsThemeChanging = false;
}else {
mIsThemeChanging = false;
}
}else {
if(status.sTheme != enums.Theme.THEME_DEFAULT) {
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT));
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DEFAULT));
mIsThemeChanging = false;
}else {
mIsThemeChanging = false;
}
}
}
}
public void onOpenInfo(View view) {
helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onURLInNewTab(View view) {
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB, Collections.singletonList(!mOpenURLInNewTab.isChecked()));
mOpenURLInNewTab.toggle();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,status.sOpenURLInNewTab));
}
}
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.appManager.languageManager.languageController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class settingGeneralController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private settingGeneralModel mSettingGeneralModel;
private settingGeneralViewController mSettingGeneralViewController;
private SwitchMaterial mFullScreenMode;
private SwitchMaterial mOpenURLInNewTab;
private RadioButton mThemeLight;
private RadioButton mThemeDark;
private RadioButton mThemeDefault;
private TextView mHomePageText;
/* PRIVATE LOCAL VARIABLES */
private Boolean mIsThemeChanging = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState);
if(!status.mThemeApplying){
activityContextManager.getInstance().onStack(this);
}
setContentView(R.layout.setting_general_view);
activityContextManager.getInstance().setSettingGeneralController(this);
viewsInitializations();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if(!mIsThemeChanging){
if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
}
private void viewsInitializations() {
mFullScreenMode = findViewById(R.id.pJSStatus);
mThemeLight = findViewById(R.id.pThemeLight);
mThemeDark = findViewById(R.id.pThemeDark);
mThemeDefault = findViewById(R.id.pThemeDefault);
mHomePageText = findViewById(R.id.pHomePageText);
mOpenURLInNewTab = findViewById(R.id.pOpenURLInNewTab);
mSettingGeneralViewController = new settingGeneralViewController(this, new settingGeneralViewCallback(), mFullScreenMode, mThemeLight, mThemeDark, mThemeDefault, mHomePageText, mOpenURLInNewTab);
mSettingGeneralModel = new settingGeneralModel(new settingGeneralModelCallback());
}
/*View Callbacks*/
private class settingGeneralViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
if(settingGeneralEnums.eGeneralViewCallback.M_RESET_THEME_INVOKED_BACK.equals(e_type))
{
boolean mIsThemeChangable = false;
if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mIsThemeChangable = true;
}
}
else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mIsThemeChangable = true;
}
}else {
if(!status.sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mIsThemeChangable = true;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mIsThemeChangable = true;
}
}
}
if(mIsThemeChangable){
status.mThemeApplying = true;
onBackPressed();
overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang);
activityContextManager.getInstance().getHomeController().onReInitTheme();
activityContextManager.getInstance().getSettingController().onReInitTheme();
helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, settingGeneralController.this,true);
}
}
return null;
}
}
/*Model Callbacks*/
private class settingGeneralModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
if(status.mThemeApplying){
// activityContextManager.getInstance().onStack(this);
}
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
finish();
}
/*External Redirection*/
public void onLanguageChanged(){
setContentView(R.layout.setting_general_view);
}
/*UI Redirection*/
public void onClose(View view){
finish();
}
@Override
protected void onDestroy() {
if(!status.mThemeApplying){
activityContextManager.getInstance().onRemoveStack(this);
}
activityContextManager.getInstance().setSettingGeneralController(null);
super.onDestroy();
}
public void onManageLanguage(View view) {
helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onFullScreenBrowsing(View view){
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING, Collections.singletonList(!mFullScreenMode.isChecked()));
mFullScreenMode.toggle();
activityContextManager.getInstance().getHomeController().onFullScreenSettingChanged();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,status.sFullScreenBrowsing));
}
public void onSelectTheme(View view){
if(!mIsThemeChanging){
mIsThemeChanging = true;
if(view.getId() == R.id.pOption1){
if(status.sTheme != enums.Theme.THEME_DARK) {
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DARK));
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DARK));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DARK));
mIsThemeChanging = false;
}else {
mIsThemeChanging = false;
}
}else if(view.getId() == R.id.pOption2) {
if(status.sTheme != enums.Theme.THEME_LIGHT) {
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT));
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_LIGHT));
mIsThemeChanging = false;
}else {
mIsThemeChanging = false;
}
}else {
if(status.sTheme != enums.Theme.THEME_DEFAULT) {
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT));
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme));
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DEFAULT));
mIsThemeChanging = false;
}else {
mIsThemeChanging = false;
}
}
}
}
public void onOpenInfo(View view) {
helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onURLInNewTab(View view) {
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB, Collections.singletonList(!mOpenURLInNewTab.isChecked()));
mOpenURLInNewTab.toggle();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,status.sOpenURLInNewTab));
}
}

View File

@ -1,17 +1,17 @@
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
class settingGeneralEnums
{
/*History Manager*/
public enum eGeneralModel {
M_FULL_SCREEN_BROWSING, M_SELECT_THEME, M_URL_NEW_TAB
}
public enum eGeneralViewController {
M_SET_THEME, M_RESET_THEME, M_UPDATE_THEME_BLOCKER
}
public enum eGeneralViewCallback {
M_RESET_THEME_INVOKED_BACK
}
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
class settingGeneralEnums
{
/*History Manager*/
public enum eGeneralModel {
M_FULL_SCREEN_BROWSING, M_SELECT_THEME, M_URL_NEW_TAB
}
public enum eGeneralViewController {
M_SET_THEME, M_RESET_THEME, M_UPDATE_THEME_BLOCKER
}
public enum eGeneralViewCallback {
M_RESET_THEME_INVOKED_BACK
}
}

View File

@ -1,45 +1,45 @@
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import java.util.List;
class settingGeneralModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingGeneralModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
private void onFullScreenBrowsing(boolean pStatus){
status.sFullScreenBrowsing = pStatus;
}
private void onSelectThemeLight(int pStatus){
status.sTheme = pStatus;
}
private void onURLInNewTab(boolean pStatus) {
status.sOpenURLInNewTab = pStatus;
}
public Object onTrigger(settingGeneralEnums.eGeneralModel pCommands, List<Object> pData){
if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING)){
onFullScreenBrowsing((boolean)pData.get(0));
}
else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_SELECT_THEME)){
onSelectThemeLight((int)pData.get(0));
}
else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB)){
onURLInNewTab((boolean)pData.get(0));
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import java.util.List;
class settingGeneralModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingGeneralModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
private void onFullScreenBrowsing(boolean pStatus){
status.sFullScreenBrowsing = pStatus;
}
private void onSelectThemeLight(int pStatus){
status.sTheme = pStatus;
}
private void onURLInNewTab(boolean pStatus) {
status.sOpenURLInNewTab = pStatus;
}
public Object onTrigger(settingGeneralEnums.eGeneralModel pCommands, List<Object> pData){
if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING)){
onFullScreenBrowsing((boolean)pData.get(0));
}
else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_SELECT_THEME)){
onSelectThemeLight((int)pData.get(0));
}
else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB)){
onURLInNewTab((boolean)pData.get(0));
}
return null;
}
}

View File

@ -1,145 +1,145 @@
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Collections;
import java.util.List;
import static com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralEnums.eGeneralViewCallback.M_RESET_THEME_INVOKED_BACK;
class settingGeneralViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private SwitchMaterial mFullScreenMode;
private SwitchMaterial mOpenURLInNewTab;
private RadioButton mThemeLight;
private RadioButton mThemeDark;
private RadioButton mThemeDefault;
private TextView mHomePageText;
/*Initializations*/
settingGeneralViewController(settingGeneralController pContext, eventObserver.eventListener pEvent, SwitchMaterial pFullScreenMode, RadioButton pThemeLight, RadioButton pThemeDark, RadioButton pThemeDefault, TextView pHomePageText, SwitchMaterial pOpenURLInNewTab)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mFullScreenMode = pFullScreenMode;
this.mThemeLight = pThemeLight;
this.mThemeDark = pThemeDark;
this.mThemeDefault = pThemeDefault;
this.mHomePageText = pHomePageText;
this.mOpenURLInNewTab = pOpenURLInNewTab;
initViews();
initPostUI();
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initViews()
{
resetThemeSelection();
if(status.sTheme == enums.Theme.THEME_LIGHT){
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeLight.setChecked(true);
}else if(status.sTheme == enums.Theme.THEME_DARK){
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDark.setChecked(true);
}else{
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDefault.setChecked(true);
}
if(status.sFullScreenBrowsing){
mFullScreenMode.setChecked(true);
}else {
mFullScreenMode.setChecked(false);
}
if(status.sOpenURLInNewTab){
mOpenURLInNewTab.setChecked(true);
}else {
mOpenURLInNewTab.setChecked(false);
}
mHomePageText.setText(helperMethod.getDomainName(status.sSettingSearchStatus.replace("genesishiddentechnologies.com","genesis.onion")));
}
private void updateThemeChanger(){
mEvent.invokeObserver(Collections.singletonList(status.sTheme), M_RESET_THEME_INVOKED_BACK);
}
private void resetThemeSelection(){
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mThemeDark.setChecked(false);
mThemeLight.setChecked(false);
mThemeDefault.setChecked(false);
}
private void setTheme(int pTheme){
if(pTheme == enums.Theme.THEME_LIGHT){
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeLight.setChecked(true);
}else if(pTheme == enums.Theme.THEME_DARK){
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDark.setChecked(true);
}else{
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDefault.setChecked(true);
}
}
public Object onTrigger(settingGeneralEnums.eGeneralViewController pCommands, List<Object> pData){
if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_SET_THEME)){
setTheme((int)pData.get(0));
}
else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_RESET_THEME)){
resetThemeSelection();
}
else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER)){
updateThemeChanger();
}
return null;
}
}
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Collections;
import java.util.List;
import static com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralEnums.eGeneralViewCallback.M_RESET_THEME_INVOKED_BACK;
class settingGeneralViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private SwitchMaterial mFullScreenMode;
private SwitchMaterial mOpenURLInNewTab;
private RadioButton mThemeLight;
private RadioButton mThemeDark;
private RadioButton mThemeDefault;
private TextView mHomePageText;
/*Initializations*/
settingGeneralViewController(settingGeneralController pContext, eventObserver.eventListener pEvent, SwitchMaterial pFullScreenMode, RadioButton pThemeLight, RadioButton pThemeDark, RadioButton pThemeDefault, TextView pHomePageText, SwitchMaterial pOpenURLInNewTab)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mFullScreenMode = pFullScreenMode;
this.mThemeLight = pThemeLight;
this.mThemeDark = pThemeDark;
this.mThemeDefault = pThemeDefault;
this.mHomePageText = pHomePageText;
this.mOpenURLInNewTab = pOpenURLInNewTab;
initViews();
initPostUI();
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initViews()
{
resetThemeSelection();
if(status.sTheme == enums.Theme.THEME_LIGHT){
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeLight.setChecked(true);
}else if(status.sTheme == enums.Theme.THEME_DARK){
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDark.setChecked(true);
}else{
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDefault.setChecked(true);
}
if(status.sFullScreenBrowsing){
mFullScreenMode.setChecked(true);
}else {
mFullScreenMode.setChecked(false);
}
if(status.sOpenURLInNewTab){
mOpenURLInNewTab.setChecked(true);
}else {
mOpenURLInNewTab.setChecked(false);
}
mHomePageText.setText(helperMethod.getDomainName(status.sSettingSearchStatus.replace("genesishiddentechnologies.com","genesis.onion")));
}
private void updateThemeChanger(){
mEvent.invokeObserver(Collections.singletonList(status.sTheme), M_RESET_THEME_INVOKED_BACK);
}
private void resetThemeSelection(){
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mThemeDark.setChecked(false);
mThemeLight.setChecked(false);
mThemeDefault.setChecked(false);
}
private void setTheme(int pTheme){
if(pTheme == enums.Theme.THEME_LIGHT){
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeLight.setChecked(true);
}else if(pTheme == enums.Theme.THEME_DARK){
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDark.setChecked(true);
}else{
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDefault.setChecked(true);
}
}
public Object onTrigger(settingGeneralEnums.eGeneralViewController pCommands, List<Object> pData){
if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_SET_THEME)){
setTheme((int)pData.get(0));
}
else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_RESET_THEME)){
resetThemeSelection();
}
else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER)){
updateThemeChanger();
}
return null;
}
}

Some files were not shown because too many files have changed in this diff Show More