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 *.iml
.gradle .gradle
/local.properties /local.properties
/.idea/caches /.idea/caches
/.idea/libraries /.idea/libraries
/.idea/modules.xml /.idea/modules.xml
/.idea/workspace.xml /.idea/workspace.xml
/.idea/navEditor.xml /.idea/navEditor.xml
/.idea/assetWizardSettings.xml /.idea/assetWizardSettings.xml
.DS_Store .DS_Store
/build /build
/captures /captures
.externalNativeBuild .externalNativeBuild
java_pid10832.hprof java_pid10832.hprof
java_pid17480.hprof java_pid17480.hprof
java_pid21508.hprof java_pid21508.hprof

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,47 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="NullableNotNullManager"> <component name="NullableNotNullManager">
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" /> <option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
<option name="myDefaultNotNull" value="androidx.annotation.NonNull" /> <option name="myDefaultNotNull" value="androidx.annotation.NonNull" />
<option name="myNullables"> <option name="myNullables">
<value> <value>
<list size="14"> <list size="14">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> <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="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="2" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="3" class="java.lang.String" itemvalue="androidx.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="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="5" class="java.lang.String" itemvalue="com.android.annotations.Nullable" /> <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="6" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="7" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" /> <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="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="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="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="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="12" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
<item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" /> <item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
</list> </list>
</value> </value>
</option> </option>
<option name="myNotNulls"> <option name="myNotNulls">
<value> <value>
<list size="13"> <list size="13">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> <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="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="2" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="3" class="java.lang.String" itemvalue="androidx.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="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="5" class="java.lang.String" itemvalue="com.android.annotations.NonNull" /> <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="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="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="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="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="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="11" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
<item index="12" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" /> <item index="12" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
</list> </list>
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project> </project>

View File

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

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </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 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 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 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 827b905e ensure we are putting the right value in
144a4ed5 small change to attempt to address localization glitches 144a4ed5 small change to attempt to address localization glitches
c4062678 Merge branch 'master' of github.com:n8fr8/orbot 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 **/ /** 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 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 9050 (Since their hardware model is i9 * 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 **/ /** 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 98ea6d5 update changelog
5776a87 update to 14.0.0-RC3 5776a87 update to 14.0.0-RC3
bf6a1da update state when service connects 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 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 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 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 *** *** How to use ***
Currently, Orbot will work with any application that supports using Currently, Orbot will work with any application that supports using
an HTTP or SOCKS Proxy. Once you start Tor using Orbot, you can then 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. IP 127.0.0.1.
If you have root access, and a version of Android with iptables that 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-engine-gecko:73.0.8"
implementation "org.mozilla.components:browser-icons:73.0.9" 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-fetch:73.0.9"
implementation "org.mozilla.components:concept-base:73.0.9" implementation "org.mozilla.components:concept-base:73.0.9"
implementation 'com.coolerfall:android-http-download-manager:1.6.3' 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. #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 #Wed May 01 00:42:45 PKT 2019
apiSecret=042501af0b2390b9f064ff9a0823e52a2dd04b2280c9b675925cebbb9620ecbf apiSecret=042501af0b2390b9f064ff9a0823e52a2dd04b2280c9b675925cebbb9620ecbf

View File

@ -1,9 +1,32 @@
-keep,includedescriptorclasses class net.sqlcipher.** { *; } -keep,includedescriptorclasses class net.sqlcipher.** { *; }
-keep,includedescriptorclasses interface net.sqlcipher.** { *; } -keep,includedescriptorclasses interface net.sqlcipher.** { *; }
-dontwarn javax.annotation.** -dontwarn javax.annotation.**
-dontwarn org.codehaus.mojo.animal_sniffer.* -dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.ConscryptPlatform -dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn org.conscrypt.ConscryptHostnameVerifier -dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn okhttp3.* -dontwarn okhttp3.*
-dontwarn org.chromium.net.* -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 package com.example.myapplication
import android.support.test.InstrumentationRegistry import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4 import android.support.test.runner.AndroidJUnit4
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.junit.Assert.* import org.junit.Assert.*
/** /**
* Instrumented test, which will execute on an Android device. * Instrumented test, which will execute on an Android device.
* *
* See [testing documentation](http://d.android.com/tools/testing). * See [testing documentation](http://d.android.com/tools/testing).
*/ */
@RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest { class ExampleInstrumentedTest {
@Test @Test
fun useAppContext() { fun useAppContext() {
// Context of the app under test. // Context of the app under test.
val appContext = InstrumentationRegistry.getTargetContext() val appContext = InstrumentationRegistry.getTargetContext()
assertEquals("com.example.myapplication", appContext.packageName) assertEquals("com.example.myapplication", appContext.packageName)
} }
} }

View File

@ -196,7 +196,7 @@
<!-- Live Build --> <!-- Live Build -->
<!-- --> <meta-data <!-- --> <meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID" 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 --> <!-- Development Build -->
<!-- <meta-data <!-- <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; package com.darkweb.genesissearchengine.appManager;
import android.app.Service; import android.app.Service;
import android.content.Intent; import android.content.Intent;
import android.os.IBinder; import android.os.IBinder;
import com.darkweb.genesissearchengine.constants.status;
import androidx.core.app.NotificationManagerCompat;
public class activityStateManager extends Service {
import com.darkweb.genesissearchengine.constants.status;
@Override import com.darkweb.genesissearchengine.pluginManager.pluginController;
public IBinder onBind(Intent intent) { import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
return null;
} import org.torproject.android.proxy.OrbotService;
import org.torproject.android.proxy.wrapper.orbotLocalConstants;
@Override
public int onStartCommand(Intent intent, int flags, int startId) { import java.util.Collections;
return START_NOT_STICKY;
} public class activityStateManager extends Service {
@Override @Override
public void onDestroy() { public IBinder onBind(Intent intent) {
status.sSettingIsAppStarted = false; return null;
super.onDestroy(); }
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1); @Override
} public int onStartCommand(Intent intent, int flags, int startId) {
return START_NOT_STICKY;
@Override }
public void onTaskRemoved(Intent rootIntent) {
status.sSettingIsAppStarted = false; @Override
stopSelf(); public void onDestroy() {
super.onDestroy(); Intent mServiceIntent = new Intent(this.getApplicationContext(), OrbotService.class);
android.os.Process.killProcess(android.os.Process.myPid()); this.stopService(mServiceIntent);
System.exit(1); 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; package com.darkweb.genesissearchengine.appManager;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
public class activityThemeManager { public class activityThemeManager {
private static activityThemeManager ourInstance = new activityThemeManager(); private static activityThemeManager ourInstance = new activityThemeManager();
int mode = -1; int mode = -1;
public static activityThemeManager getInstance() public static activityThemeManager getInstance()
{ {
return ourInstance; return ourInstance;
} }
public void onConfigurationChanged(AppCompatActivity pContext){ public void onConfigurationChanged(AppCompatActivity pContext){
boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
setupThemeLocal(pContext, sDefaultNightMode); setupThemeLocal(pContext, sDefaultNightMode);
pContext.recreate(); pContext.recreate();
} }
public boolean onInitTheme(AppCompatActivity pContext){ public boolean onInitTheme(AppCompatActivity pContext){
boolean mIsNightMode = (pContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; 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.sTheme == enums.Theme.THEME_DEFAULT){
if(!status.sDefaultNightMode && mIsNightMode){ if(!status.sDefaultNightMode && mIsNightMode){
return true; return true;
}else if(status.sDefaultNightMode && !mIsNightMode){ }else if(status.sDefaultNightMode && !mIsNightMode){
return true; return true;
} }
} }
else{ else{
if(status.sTheme != enums.Theme.THEME_DARK && mIsNightMode){ if(status.sTheme != enums.Theme.THEME_DARK && mIsNightMode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
return true; return true;
}else if(status.sTheme == enums.Theme.THEME_DARK && !mIsNightMode){ }else if(status.sTheme == enums.Theme.THEME_DARK && !mIsNightMode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
return true; return true;
} }
} }
return false; return false;
} }
public void setupThemeLocal(Context context, boolean sDefaultNightMode) { public void setupThemeLocal(Context context, boolean sDefaultNightMode) {
Resources res = context.getResources(); Resources res = context.getResources();
mode = res.getConfiguration().uiMode; mode = res.getConfiguration().uiMode;
if(status.sTheme == enums.Theme.THEME_DARK){ if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES; mode = Configuration.UI_MODE_NIGHT_YES;
} }
}else if(status.sTheme == enums.Theme.THEME_LIGHT){ }else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO; mode = Configuration.UI_MODE_NIGHT_NO;
} }
}else { }else {
if(!sDefaultNightMode){ if(!sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO; mode = Configuration.UI_MODE_NIGHT_NO;
} }
}else { }else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES; mode = Configuration.UI_MODE_NIGHT_YES;
} }
} }
} }
} }
public Context setupTheme(Context context) { public Context setupTheme(Context context) {
Resources res = context.getResources(); Resources res = context.getResources();
if(mode==-1){ if(mode==-1){
mode = res.getConfiguration().uiMode; mode = res.getConfiguration().uiMode;
if(status.sTheme == enums.Theme.THEME_DARK){ if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES; mode = Configuration.UI_MODE_NIGHT_YES;
} }
}else if(status.sTheme == enums.Theme.THEME_LIGHT){ }else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO; mode = Configuration.UI_MODE_NIGHT_NO;
} }
}else { }else {
if(!status.sDefaultNightMode){ if(!status.sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO; mode = Configuration.UI_MODE_NIGHT_NO;
} }
}else { }else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES; mode = Configuration.UI_MODE_NIGHT_YES;
} }
} }
} }
} }
Configuration config = new Configuration(res.getConfiguration()); Configuration config = new Configuration(res.getConfiguration());
config.uiMode = mode; config.uiMode = mode;
context = context.createConfigurationContext(config); context = context.createConfigurationContext(config);
return context; return context;
} }
public Context initTheme(Context pContext){ public Context initTheme(Context pContext){
boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if(status.sSettingIsAppStarted){ if(status.sSettingIsAppStarted){
status.mThemeApplying = true; status.mThemeApplying = true;
} }
status.sDefaultNightMode = sDefaultNightMode; status.sDefaultNightMode = sDefaultNightMode;
pContext = setupTheme(pContext); pContext = setupTheme(pContext);
mode = -1; mode = -1;
return pContext; return pContext;
} }
} }

View File

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

View File

@ -1,18 +1,18 @@
package com.darkweb.genesissearchengine.appManager.bookmarkManager; package com.darkweb.genesissearchengine.appManager.bookmarkManager;
public class bookmarkEnums public class bookmarkEnums
{ {
/*History Manager*/ /*History Manager*/
public enum eBookmarkViewCommands { 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 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 { 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 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 { public enum eBookmarkViewAdapterCommands {
M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT 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; package com.darkweb.genesissearchengine.appManager.bridgeManager;
public class bridgeEnums public class bridgeEnums
{ {
/*Settings Manager*/ /*Settings Manager*/
public enum eBridgeViewCommands { public enum eBridgeViewCommands {
M_INIT_VIEWS, M_ENABLE_CUSTOM_BRIDGE M_INIT_VIEWS, M_ENABLE_CUSTOM_BRIDGE
} }
public enum eBridgeModelCommands { public enum eBridgeModelCommands {
M_REQUEST_BRIDGE, M_CUSTOM_BRIDGE, M_MEEK_BRIDGE, M_OBFS_CHECK M_REQUEST_BRIDGE, M_CUSTOM_BRIDGE, M_MEEK_BRIDGE, M_OBFS_CHECK
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,18 +1,18 @@
package com.darkweb.genesissearchengine.appManager.historyManager; package com.darkweb.genesissearchengine.appManager.historyManager;
public class historyEnums public class historyEnums
{ {
/*History Manager*/ /*History Manager*/
public enum eHistoryViewCommands { 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 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 { public enum eHistoryAdapterCommands {
M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE
} }
public enum eHistoryViewAdapterCommands { public enum eHistoryViewAdapterCommands {
M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT 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 package com.darkweb.genesissearchengine.appManager.homeManager
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle import android.os.Bundle
class FakeLauncherActivity : AppCompatActivity() { class FakeLauncherActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
} }

View File

@ -1,156 +1,166 @@
package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import android.content.Context; import android.content.Context;
import androidx.core.view.NestedScrollingChildHelper; import androidx.core.view.NestedScrollingChildHelper;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import org.mozilla.geckoview.GeckoView; import org.mozilla.geckoview.GeckoView;
import java.util.Collections; 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_DOWN;
import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_ALWAYS; import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_ALWAYS;
public class NestedGeckoView extends GeckoView { public class NestedGeckoView extends GeckoView {
private int mLastY; private int mLastY;
private final int[] mScrollOffset = new int[2]; private final int[] mScrollOffset = new int[2];
private final int[] mScrollConsumed = new int[2]; private final int[] mScrollConsumed = new int[2];
private int mNestedOffsetY; private int mNestedOffsetY;
private NestedScrollingChildHelper mChildHelper; private NestedScrollingChildHelper mChildHelper;
private eventObserver.eventListener mEvent; private eventObserver.eventListener mEvent;
private boolean mScrollable = true;
private int mSwipeDistance = 0;
public void onSetHomeEvent(eventObserver.eventListener pEvent){
mEvent = pEvent; public void onSetHomeEvent(eventObserver.eventListener pEvent){
} mEvent = pEvent;
}
public void onDestroy() {
mEvent = null; public void onDestroy() {
mChildHelper = null; mEvent = null;
} mChildHelper = null;
}
public NestedGeckoView(Context context, AttributeSet attrs) {
super(context.getApplicationContext(), attrs); public NestedGeckoView(Context context, AttributeSet attrs) {
super(context.getApplicationContext(), attrs);
mChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true); mChildHelper = new NestedScrollingChildHelper(this);
} setNestedScrollingEnabled(true);
}
@Override
public boolean onTouchEvent(MotionEvent ev) { @Override
final MotionEvent event = MotionEvent.obtain(ev); public boolean onTouchEvent(MotionEvent ev) {
final int action = ev.getActionMasked(); final MotionEvent event = MotionEvent.obtain(ev);
final int action = ev.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
mNestedOffsetY = 0; if (action == MotionEvent.ACTION_DOWN) {
} mNestedOffsetY = 0;
}
final int eventY = (int) event.getY();
event.offsetLocation(0, mNestedOffsetY); final int eventY = (int) event.getY();
event.offsetLocation(0, mNestedOffsetY);
if(event.getPointerCount() > 1 && !status.sSettingEnableZoom) {
return true; if(event.getPointerCount() > 1 && !status.sSettingEnableZoom) {
} return true;
}
switch (action) {
case MotionEvent.ACTION_MOVE: switch (action) {
// mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); case MotionEvent.ACTION_MOVE:
final boolean allowScroll = status.sFullScreenBrowsing; // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
int deltaY = mLastY - eventY;
int deltaY = mLastY - eventY;
mSwipeDistance += deltaY;
if (allowScroll && dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) {
deltaY -= mScrollConsumed[1]; if(mSwipeDistance>=100 || mSwipeDistance<=-150){
event.offsetLocation(0, -mScrollOffset[1]); mScrollable = true;
mNestedOffsetY += mScrollOffset[1]; }
}
final boolean allowScroll = status.sFullScreenBrowsing && !status.sDisableExpandTemp && mScrollable;
mLastY = eventY - mScrollOffset[1];
if (allowScroll && dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) {
if (allowScroll && dispatchNestedScroll(0, mScrollOffset[1], 0, deltaY, mScrollOffset)) { deltaY -= mScrollConsumed[1];
mLastY -= mScrollOffset[1]; event.offsetLocation(0, -mScrollOffset[1]);
event.offsetLocation(0, mScrollOffset[1]); mNestedOffsetY += mScrollOffset[1];
mNestedOffsetY += mScrollOffset[1]; }
}
if(status.sFullScreenBrowsing){ mLastY = eventY - mScrollOffset[1];
Log.i("wow1", eventY + "");
} if (allowScroll && dispatchNestedScroll(0, mScrollOffset[1], 0, deltaY, mScrollOffset)) {
mLastY -= mScrollOffset[1];
break; event.offsetLocation(0, mScrollOffset[1]);
mNestedOffsetY += mScrollOffset[1];
case MotionEvent.ACTION_DOWN: }
mLastY = eventY;
startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); if(status.sFullScreenBrowsing){
mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_DOWN); Log.i("wow1", eventY + "");
break; }
case MotionEvent.ACTION_UP: break;
mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_UP_ALWAYS);
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_DOWN:
// mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); mSwipeDistance = 0;
stopNestedScroll(); mScrollable = false;
break; mLastY = eventY;
startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL);
default: mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_DOWN);
// mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); break;
}
case MotionEvent.ACTION_UP:
// Execute event handler from parent class in all cases mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_UP_ALWAYS);
boolean eventHandled = super.onTouchEvent(event); case MotionEvent.ACTION_CANCEL:
// mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
// Recycle previously obtained event stopNestedScroll();
event.recycle(); break;
return eventHandled; default:
} // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
}
@Override
public void setNestedScrollingEnabled(boolean enabled) { // Execute event handler from parent class in all cases
mChildHelper.setNestedScrollingEnabled(enabled); boolean eventHandled = super.onTouchEvent(event);
}
// Recycle previously obtained event
@Override event.recycle();
public boolean isNestedScrollingEnabled() {
return mChildHelper.isNestedScrollingEnabled(); return eventHandled;
} }
@Override @Override
public boolean startNestedScroll(int axes) { public void setNestedScrollingEnabled(boolean enabled) {
return mChildHelper.startNestedScroll(axes); mChildHelper.setNestedScrollingEnabled(enabled);
} }
@Override @Override
public void stopNestedScroll() { public boolean isNestedScrollingEnabled() {
mChildHelper.stopNestedScroll(); return mChildHelper.isNestedScrollingEnabled();
} }
@Override @Override
public boolean hasNestedScrollingParent() { public boolean startNestedScroll(int axes) {
return mChildHelper.hasNestedScrollingParent(); return mChildHelper.startNestedScroll(axes);
} }
@Override @Override
public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) { public void stopNestedScroll() {
return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow); mChildHelper.stopNestedScroll();
} }
@Override @Override
public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) { public boolean hasNestedScrollingParent() {
return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); return mChildHelper.hasNestedScrollingParent();
} }
@Override @Override
public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) { public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) {
return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed); return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow);
} }
public int getMaxY(){ @Override
return 1; 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; package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R; import com.example.myapplication.R;
import org.mozilla.geckoview.WebRequestError; import org.mozilla.geckoview.WebRequestError;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
public class errorHandler public class errorHandler
{ {
private AppCompatActivity mContext; private AppCompatActivity mContext;
private String mErrorTemplate; private String mErrorTemplate;
public String createErrorPage(final int category, final int error,AppCompatActivity mContext,String url, InputStream mResourceURL) { public String createErrorPage(final int category, final int error,AppCompatActivity mContext,String url, InputStream mResourceURL) {
this.mContext = mContext; this.mContext = mContext;
if (mErrorTemplate == null) { if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
builder.append(line); builder.append(line);
builder.append("\n"); builder.append("\n");
} }
mErrorTemplate = builder.toString(); mErrorTemplate = builder.toString();
} catch (IOException e) { } catch (IOException e) {
return null; return null;
} }
} }
String title = helperMethod.getHost(url); String title = helperMethod.getHost(url);
if(url==null){ if(url==null){
url = "Hidden Error"; url = "Hidden Error";
} }
if(title==null){ if(title==null){
title = "Hidden Error"; title = "Hidden Error";
} }
String replaceUrl = errorToString(error).replace("$URL",url); String replaceUrl = errorToString(error).replace("$URL",url);
String errorPage = createErrorPage("CODE : " + categoryToString(category) + " <br>TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL); String errorPage = createErrorPage("CODE : " + categoryToString(category) + " <br>TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL);
errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category)); errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category));
return errorPage; return errorPage;
} }
private String translateMessage(String message,String error){ private String translateMessage(String message,String error){
message = message.replace("$ERROR_M1",mContext.getString(R.string.ERROR_M1)); 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_M2",mContext.getString(R.string.ERROR_M2));
message = message.replace("$ERROR_M3",mContext.getString(R.string.ERROR_M3)); 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_M4",mContext.getString(R.string.ERROR_M4));
message = message.replace("$ERROR_M5",mContext.getString(R.string.ERROR_M5)); 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_M6",mContext.getString(R.string.ERROR_M6));
message = message.replace("$ERROR", error); message = message.replace("$ERROR", error);
return message; return message;
} }
private String errorToString(final int error) { private String errorToString(final int error) {
switch (error) { switch (error) {
case WebRequestError.ERROR_UNKNOWN: case WebRequestError.ERROR_UNKNOWN:
return "ERROR_UNKNOWN" ; return "ERROR_UNKNOWN" ;
case WebRequestError.ERROR_SECURITY_SSL: case WebRequestError.ERROR_SECURITY_SSL:
return "ERROR_SECURITY_SSL"; return "ERROR_SECURITY_SSL";
case WebRequestError.ERROR_SECURITY_BAD_CERT: case WebRequestError.ERROR_SECURITY_BAD_CERT:
return "ERROR_SECURITY_BAD_CERT"; return "ERROR_SECURITY_BAD_CERT";
case WebRequestError.ERROR_NET_RESET: case WebRequestError.ERROR_NET_RESET:
return "ERROR_NET_RESET"; return "ERROR_NET_RESET";
case WebRequestError.ERROR_NET_INTERRUPT: case WebRequestError.ERROR_NET_INTERRUPT:
return "ERROR_NET_INTERRUPT"; return "ERROR_NET_INTERRUPT";
case WebRequestError.ERROR_NET_TIMEOUT: case WebRequestError.ERROR_NET_TIMEOUT:
return "ERROR_NET_TIMEOUT"; return "ERROR_NET_TIMEOUT";
case WebRequestError.ERROR_CONNECTION_REFUSED: case WebRequestError.ERROR_CONNECTION_REFUSED:
return "ERROR_CONNECTION_REFUSED"; return "ERROR_CONNECTION_REFUSED";
case WebRequestError.ERROR_UNKNOWN_PROTOCOL: case WebRequestError.ERROR_UNKNOWN_PROTOCOL:
return "ERROR_UNKNOWN_PROTOCOL"; return "ERROR_UNKNOWN_PROTOCOL";
case WebRequestError.ERROR_UNKNOWN_HOST: case WebRequestError.ERROR_UNKNOWN_HOST:
return "ERROR_UNKNOWN_HOST"; return "ERROR_UNKNOWN_HOST";
case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE: case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE:
return "ERROR_UNKNOWN_SOCKET_TYPE"; return "ERROR_UNKNOWN_SOCKET_TYPE";
case WebRequestError.ERROR_UNKNOWN_PROXY_HOST: case WebRequestError.ERROR_UNKNOWN_PROXY_HOST:
return "ERROR_UNKNOWN_PROXY_HOST"; return "ERROR_UNKNOWN_PROXY_HOST";
case WebRequestError.ERROR_MALFORMED_URI: case WebRequestError.ERROR_MALFORMED_URI:
return "ERROR_MALFORMED_URI"; return "ERROR_MALFORMED_URI";
case WebRequestError.ERROR_REDIRECT_LOOP: case WebRequestError.ERROR_REDIRECT_LOOP:
return "ERROR_REDIRECT_LOOP"; return "ERROR_REDIRECT_LOOP";
case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI: case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI:
return "ERROR_SAFEBROWSING_PHISHING_URI"; return "ERROR_SAFEBROWSING_PHISHING_URI";
case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI: case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI:
return "ERROR_SAFEBROWSING_MALWARE_URI"; return "ERROR_SAFEBROWSING_MALWARE_URI";
case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI: case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI:
return "ERROR_SAFEBROWSING_UNWANTED_URI"; return "ERROR_SAFEBROWSING_UNWANTED_URI";
case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI: case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI:
return "ERROR_SAFEBROWSING_HARMFUL_URI"; return "ERROR_SAFEBROWSING_HARMFUL_URI";
case WebRequestError.ERROR_CONTENT_CRASHED: case WebRequestError.ERROR_CONTENT_CRASHED:
return "ERROR_CONTENT_CRASHED"; return "ERROR_CONTENT_CRASHED";
case WebRequestError.ERROR_OFFLINE: case WebRequestError.ERROR_OFFLINE:
return "ERROR_OFFLINE"; return "ERROR_OFFLINE";
case WebRequestError.ERROR_PORT_BLOCKED: case WebRequestError.ERROR_PORT_BLOCKED:
return "ERROR_PORT_BLOCKED"; return "ERROR_PORT_BLOCKED";
case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED: case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED:
return "ERROR_PROXY_CONNECTION_REFUSED"; return "ERROR_PROXY_CONNECTION_REFUSED";
case WebRequestError.ERROR_FILE_NOT_FOUND: case WebRequestError.ERROR_FILE_NOT_FOUND:
return "ERROR_FILE_NOT_FOUND"; return "ERROR_FILE_NOT_FOUND";
case WebRequestError.ERROR_FILE_ACCESS_DENIED: case WebRequestError.ERROR_FILE_ACCESS_DENIED:
return "ERROR_FILE_ACCESS_DENIED"; return "ERROR_FILE_ACCESS_DENIED";
case WebRequestError.ERROR_INVALID_CONTENT_ENCODING: case WebRequestError.ERROR_INVALID_CONTENT_ENCODING:
return "ERROR_INVALID_CONTENT_ENCODING"; return "ERROR_INVALID_CONTENT_ENCODING";
case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE: case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE:
return "ERROR_UNSAFE_CONTENT_TYPE"; return "ERROR_UNSAFE_CONTENT_TYPE";
case WebRequestError.ERROR_CORRUPTED_CONTENT: case WebRequestError.ERROR_CORRUPTED_CONTENT:
return "ERROR_CORRUPTED_CONTENT"; return "ERROR_CORRUPTED_CONTENT";
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
} }
private String categoryToString(final int category) private String categoryToString(final int category)
{ {
switch (category) switch (category)
{ {
case WebRequestError.ERROR_CATEGORY_UNKNOWN: case WebRequestError.ERROR_CATEGORY_UNKNOWN:
return "ERROR_CATEGORY_UNKNOWN"; return "ERROR_CATEGORY_UNKNOWN";
case WebRequestError.ERROR_CATEGORY_SECURITY: case WebRequestError.ERROR_CATEGORY_SECURITY:
return "ERROR_CATEGORY_SECURITY"; return "ERROR_CATEGORY_SECURITY";
case WebRequestError.ERROR_CATEGORY_NETWORK: case WebRequestError.ERROR_CATEGORY_NETWORK:
return "ERROR_CATEGORY_NETWORK"; return "ERROR_CATEGORY_NETWORK";
case WebRequestError.ERROR_CATEGORY_CONTENT: case WebRequestError.ERROR_CATEGORY_CONTENT:
return "ERROR_CATEGORY_CONTENT"; return "ERROR_CATEGORY_CONTENT";
case WebRequestError.ERROR_CATEGORY_URI: case WebRequestError.ERROR_CATEGORY_URI:
return "ERROR_CATEGORY_URI"; return "ERROR_CATEGORY_URI";
case WebRequestError.ERROR_CATEGORY_PROXY: case WebRequestError.ERROR_CATEGORY_PROXY:
return "ERROR_CATEGORY_PROXY"; return "ERROR_CATEGORY_PROXY";
case WebRequestError.ERROR_CATEGORY_SAFEBROWSING: case WebRequestError.ERROR_CATEGORY_SAFEBROWSING:
return "ERROR_CATEGORY_SAFEBROWSING"; return "ERROR_CATEGORY_SAFEBROWSING";
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
} }
private String createErrorPage(final String error,String url, InputStream mResourceURL) { private String createErrorPage(final String error,String url, InputStream mResourceURL) {
if(error==null){ if(error==null){
return strings.GENERIC_EMPTY_STR; return strings.GENERIC_EMPTY_STR;
} }
if (mErrorTemplate == null) { if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
builder.append(line); builder.append(line);
builder.append("\n"); builder.append("\n");
} }
mErrorTemplate = builder.toString(); mErrorTemplate = builder.toString();
} catch (IOException e) { } catch (IOException e) {
return null; return null;
} }
} }
String replaceUrl = mErrorTemplate.replace("$URL",url); String replaceUrl = mErrorTemplate.replace("$URL",url);
return replaceUrl; return replaceUrl;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -154,7 +154,7 @@ public class languageController extends AppCompatActivity {
getIntent().putExtra("activity_restarted",((LinearLayoutManager) Objects.requireNonNull(mRecycleView.getLayoutManager())).findFirstCompletelyVisibleItemPosition()); getIntent().putExtra("activity_restarted",((LinearLayoutManager) Objects.requireNonNull(mRecycleView.getLayoutManager())).findFirstCompletelyVisibleItemPosition());
helperMethod.restartActivity(getIntent(), this); helperMethod.restartActivity(getIntent(), this);
overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); 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()){ if(activityContextManager.getInstance().getSettingController()!=null && !activityContextManager.getInstance().getSettingController().isDestroyed()){
activityContextManager.getInstance().getSettingController().onRedrawXML(); activityContextManager.getInstance().getSettingController().onRedrawXML();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,70 +1,70 @@
package com.darkweb.genesissearchengine.appManager.proxyStatusManager; package com.darkweb.genesissearchengine.appManager.proxyStatusManager;
import android.os.Build; import android.os.Build;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.example.myapplication.R; import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List; import java.util.List;
class proxyStatusViewController class proxyStatusViewController
{ {
/*Private Variables*/ /*Private Variables*/
private AppCompatActivity mContext; private AppCompatActivity mContext;
private SwitchMaterial mBridgeSwitch; private SwitchMaterial mBridgeSwitch;
private SwitchMaterial mVpnSwitch; private SwitchMaterial mVpnSwitch;
private LinearLayout mCustomizableBridgeMenu; private LinearLayout mCustomizableBridgeMenu;
/*Initializations*/ /*Initializations*/
private TextView mOrbotStatus; private TextView mOrbotStatus;
private SwitchMaterial mVpnStatus; private SwitchMaterial mVpnStatus;
private SwitchMaterial mBridgeStatus; private SwitchMaterial mBridgeStatus;
proxyStatusViewController(AppCompatActivity pContext, TextView pOrbotStatus, SwitchMaterial pVpnStatus, SwitchMaterial pBridgeStatus) proxyStatusViewController(AppCompatActivity pContext, TextView pOrbotStatus, SwitchMaterial pVpnStatus, SwitchMaterial pBridgeStatus)
{ {
this.mContext = pContext; this.mContext = pContext;
this.mOrbotStatus = pOrbotStatus; this.mOrbotStatus = pOrbotStatus;
this.mVpnStatus = pVpnStatus; this.mVpnStatus = pVpnStatus;
this.mBridgeStatus = pBridgeStatus; this.mBridgeStatus = pBridgeStatus;
initPostUI(); initPostUI();
} }
private void initPostUI(){ private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow(); Window window = mContext.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
} }
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
} }
} }
} }
private void initViews(String pOrbotStatus, boolean pVPNStatus, boolean pGatewayStatus){ private void initViews(String pOrbotStatus, boolean pVPNStatus, boolean pGatewayStatus){
mOrbotStatus.setText(pOrbotStatus); mOrbotStatus.setText(pOrbotStatus);
mVpnStatus.setChecked(pVPNStatus); mVpnStatus.setChecked(pVPNStatus);
mBridgeStatus.setChecked(pGatewayStatus); mBridgeStatus.setChecked(pGatewayStatus);
} }
public void onTrigger(proxyStatusEnums.eProxyStatusViewCommands pCommands, List<Object> pData){ public void onTrigger(proxyStatusEnums.eProxyStatusViewCommands pCommands, List<Object> pData){
if(pCommands.equals(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS)){ if(pCommands.equals(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS)){
initViews((String)pData.get(0),(boolean)pData.get(1),(boolean)pData.get(2)); 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; package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.view.View; import android.view.View;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController; import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
public class settingAccessibilityController extends AppCompatActivity { public class settingAccessibilityController extends AppCompatActivity {
/* PRIVATE VARIABLES */ /* PRIVATE VARIABLES */
private settingAccessibilityModel mSettingAccessibilityModel; private settingAccessibilityModel mSettingAccessibilityModel;
private settingAccessibilityViewController mSettingAccessibilityViewController; private settingAccessibilityViewController mSettingAccessibilityViewController;
private SwitchMaterial mZoom; private SwitchMaterial mZoom;
private SwitchMaterial mVoiceInput; private SwitchMaterial mVoiceInput;
private SeekBar mSeekBar; private SeekBar mSeekBar;
private TextView mSeekBarSample; private TextView mSeekBarSample;
private TextView mScalePercentage; private TextView mScalePercentage;
/* PRIVATE LOCAL VARIABLES */ /* PRIVATE LOCAL VARIABLES */
private boolean mIsSettingChanged = false; private boolean mIsSettingChanged = false;
private float mDefaultFontSize = status.sSettingFontSize; private float mDefaultFontSize = status.sSettingFontSize;
/* Initializations */ /* Initializations */
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.setting_accessibility_view); setContentView(R.layout.setting_accessibility_view);
viewsInitializations(); viewsInitializations();
initializeListeners(); initializeListeners();
} }
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }
private void viewsInitializations() { private void viewsInitializations() {
mZoom = findViewById(R.id.pZoom); mZoom = findViewById(R.id.pZoom);
mVoiceInput = findViewById(R.id.pVoiceInput); mVoiceInput = findViewById(R.id.pVoiceInput);
mSeekBar = findViewById(R.id.pSeekBar); mSeekBar = findViewById(R.id.pSeekBar);
mSeekBarSample = findViewById(R.id.pSeekBarSample); mSeekBarSample = findViewById(R.id.pSeekBarSample);
mScalePercentage = findViewById(R.id.pScalePercentage); mScalePercentage = findViewById(R.id.pScalePercentage);
activityContextManager.getInstance().onStack(this); activityContextManager.getInstance().onStack(this);
mSettingAccessibilityViewController = new settingAccessibilityViewController(this, new settingAccessibilityController.settingAccessibilityViewCallback(), mZoom, mVoiceInput, mSeekBar, mSeekBarSample, mScalePercentage); mSettingAccessibilityViewController = new settingAccessibilityViewController(this, new settingAccessibilityController.settingAccessibilityViewCallback(), mZoom, mVoiceInput, mSeekBar, mSeekBarSample, mScalePercentage);
mSettingAccessibilityModel = new settingAccessibilityModel(new settingAccessibilityController.settingAccessibilityModelCallback()); mSettingAccessibilityModel = new settingAccessibilityModel(new settingAccessibilityController.settingAccessibilityModelCallback());
} }
private void initializeListeners(){ private void initializeListeners(){
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override @Override
public void onStopTrackingTouch(SeekBar seekBar) { public void onStopTrackingTouch(SeekBar seekBar) {
} }
@Override @Override
public void onStartTrackingTouch(SeekBar seekBar) { public void onStartTrackingTouch(SeekBar seekBar) {
} }
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
mIsSettingChanged = true; mIsSettingChanged = true;
int percentage = ((progress+5)*10); 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_SAMPLE_TEXT, Collections.singletonList((int)((12.0*percentage)/100)));
mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE, Collections.singletonList((percentage+ constants.CONST_PERCENTAGE_SIGN))); 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)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,percentage));
status.sSettingFontSize = percentage; status.sSettingFontSize = percentage;
activityContextManager.getInstance().getHomeController().onLoadFont(); activityContextManager.getInstance().getHomeController().onLoadFont();
} }
}); });
} }
/*View Callbacks*/ /*View Callbacks*/
private class settingAccessibilityViewCallback implements eventObserver.eventListener{ private class settingAccessibilityViewCallback implements eventObserver.eventListener{
@Override @Override
public Object invokeObserver(List<Object> data, Object e_type) public Object invokeObserver(List<Object> data, Object e_type)
{ {
return null; return null;
} }
} }
/*Model Callbacks*/ /*Model Callbacks*/
private class settingAccessibilityModelCallback implements eventObserver.eventListener{ private class settingAccessibilityModelCallback implements eventObserver.eventListener{
@Override @Override
public Object invokeObserver(List<Object> data, Object e_type) public Object invokeObserver(List<Object> data, Object e_type)
{ {
return null; return null;
} }
} }
/* LOCAL OVERRIDES */ /* LOCAL OVERRIDES */
@Override @Override
public void onResume() public void onResume()
{ {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this); activityContextManager.getInstance().setCurrentActivity(this);
super.onResume(); super.onResume();
} }
@Override @Override
public void onPause() public void onPause()
{ {
super.onPause(); super.onPause();
} }
@Override @Override
public void onBackPressed() { public void onBackPressed() {
onClose(null); onClose(null);
} }
/*UI Redirection*/ /*UI Redirection*/
public void onOpenInfo(View view) { public void onOpenInfo(View view) {
helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true);
} }
public void onClose(View view){ public void onClose(View view){
activityContextManager.getInstance().onRemoveStack(this); activityContextManager.getInstance().onRemoveStack(this);
finish(); finish();
if(mIsSettingChanged && mDefaultFontSize!=status.sSettingFontSize){ if(mIsSettingChanged && mDefaultFontSize!=status.sSettingFontSize){
activityContextManager.getInstance().getHomeController().initRuntimeSettings(); activityContextManager.getInstance().getHomeController().initRuntimeSettings();
} }
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this); activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy(); super.onDestroy();
} }
public void onZoomSettingUpdate(View view){ public void onZoomSettingUpdate(View view){
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING, Collections.singletonList(!mZoom.isChecked())); 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)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,status.sSettingEnableZoom));
mZoom.toggle(); mZoom.toggle();
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
activityContextManager.getInstance().getHomeController().onReload(null); activityContextManager.getInstance().getHomeController().onReload(null);
}, 300); }, 300);
} }
public void onVoiceInputSettingUpdate(View view){ public void onVoiceInputSettingUpdate(View view){
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING, Collections.singletonList(!mVoiceInput.isChecked())); 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)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,status.sSettingEnableVoiceInput));
mVoiceInput.toggle(); mVoiceInput.toggle();
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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