diff --git a/.gitignore b/.gitignore index 61bad162..38d9d06e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,16 @@ -*.iml -.gradle -/local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml -.DS_Store -/build -/captures -.externalNativeBuild -java_pid10832.hprof -java_pid17480.hprof -java_pid21508.hprof +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +java_pid10832.hprof +java_pid17480.hprof +java_pid21508.hprof diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 7643783a..b5814f14 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -1,123 +1,123 @@ - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml index 79ee123c..307554b7 100644 --- a/.idea/codeStyles/codeStyleConfig.xml +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -1,5 +1,5 @@ - - - + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index fb7f4a8a..7d7ec2ea 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 3835aa59..21485f3e 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,35 +1,35 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index 8517d80a..dbd5d1e8 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -1,60 +1,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 89bf3bae..834a71b5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml index 797acea5..93e4b17c 100644 --- a/.idea/runConfigurations.xml +++ b/.idea/runConfigurations.xml @@ -1,10 +1,10 @@ - - - - - + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7f..9661ac71 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG index e8a21554..a03d4c9d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -303,7 +303,7 @@ f3211aca Fixes #236: Separate Constants For VPN, TOR and MAIN_APP cde49d1a Removes the refresh button on the VPN Selection screen 351ef96f (bitmold-remove_orfox) Removes references to Orfox since it is being completely replaced with the Tor Browser for Android. Conversations surrounding this can be found here https://blog.torproject.org/comment/281767#comment-281767 and here https://trac.torproject.org/projects/tor/ticket/29955 656d39b7 (tag: 16.1.0-BETA-5-tor-0.4.0.4-rc) update to 16.1.0-BETA-5-tor-0.4.0.4-rc -814fbb31 reset default ports to 9050, 8118 but make them dynamic if needed - ports will be checked and if not available, increment +1 - new setting add to allow static setting of http port value +814fbb31 reset default ports to 9055, 8125 but make them dynamic if needed - ports will be checked and if not available, increment +1 - new setting add to allow static setting of http port value 827b905e ensure we are putting the right value in 144a4ed5 small change to attempt to address localization glitches c4062678 Merge branch 'master' of github.com:n8fr8/orbot @@ -914,8 +914,8 @@ Make the build process better and more reproduceable /** 15.1.0-RC-2 / 16-January-2016 / 9ed17b551c29b9edf94d64f5f013ad607c21bbc5 **/ -Quick fix for Samsung Galaxy devices which have a port conflict on the default SOCKS 9050 part -* 6ffea9e add ability to check if configured SOCKS port is available Samsung devices like to use 9050 (Since their hardware model is i9 +Quick fix for Samsung Galaxy devices which have a port conflict on the default SOCKS 9055 part +* 6ffea9e add ability to check if configured SOCKS port is available Samsung devices like to use 9055 (Since their hardware model is i9 /** 15.1.0-RC-1 / 15-January-2016 / f541e9ffe14a2719863327bf262b48de135ee0fd **/ @@ -1470,7 +1470,7 @@ af51a98 allow support for adding custom lines to torrc 98ea6d5 update changelog 5776a87 update to 14.0.0-RC3 bf6a1da update state when service connects -451cfed keep SOCKS port as default 9050 (instead of 'auto') +451cfed keep SOCKS port as default 9055 (instead of 'auto') f94e27a updated to 14.0.0-RC-1 bedeb71 more fixes for hidden service configuration now multiple ports are properly configured and notification will display correctl 051cce4 don't allow the tor control port socket to timeout diff --git a/INSTALL b/INSTALL index 1624d1a2..086cb415 100644 --- a/INSTALL +++ b/INSTALL @@ -15,7 +15,7 @@ with Eclipse: http://eclipse.org/ *** How to use *** Currently, Orbot will work with any application that supports using an HTTP or SOCKS Proxy. Once you start Tor using Orbot, you can then -point your application to HTTP port 8118 or SOCKS port 9050 on localhost +point your application to HTTP port 8125 or SOCKS port 9055 on localhost IP 127.0.0.1. If you have root access, and a version of Android with iptables that diff --git a/app/.gitignore b/app/.gitignore index 796b96d1..3543521e 100755 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1 @@ -/build +/build diff --git a/app/build.gradle b/app/build.gradle index 61a02756..4290f6bd 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -101,7 +101,7 @@ dependencies { implementation "org.mozilla.components:browser-engine-gecko:73.0.8" implementation "org.mozilla.components:browser-icons:73.0.9" - implementation "org.mozilla.geckoview:geckoview:87.0.20210318103112" + implementation "org.mozilla.geckoview:geckoview:89.0.20210524222230" implementation "org.mozilla.components:concept-fetch:73.0.9" implementation "org.mozilla.components:concept-base:73.0.9" implementation 'com.coolerfall:android-http-download-manager:1.6.3' diff --git a/app/fabric.properties b/app/fabric.properties index 61550369..48555c31 100755 --- a/app/fabric.properties +++ b/app/fabric.properties @@ -1,3 +1,3 @@ -#Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public. -#Wed May 01 00:42:45 PKT 2019 -apiSecret=042501af0b2390b9f064ff9a0823e52a2dd04b2280c9b675925cebbb9620ecbf +#Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public. +#Wed May 01 00:42:45 PKT 2019 +apiSecret=042501af0b2390b9f064ff9a0823e52a2dd04b2280c9b675925cebbb9620ecbf diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 9e030b16..f31203fb 100755 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,9 +1,32 @@ --keep,includedescriptorclasses class net.sqlcipher.** { *; } --keep,includedescriptorclasses interface net.sqlcipher.** { *; } - --dontwarn javax.annotation.** --dontwarn org.codehaus.mojo.animal_sniffer.* --dontwarn okhttp3.internal.platform.ConscryptPlatform --dontwarn org.conscrypt.ConscryptHostnameVerifier --dontwarn okhttp3.* --dontwarn org.chromium.net.* +-keep,includedescriptorclasses class net.sqlcipher.** { *; } +-keep,includedescriptorclasses interface net.sqlcipher.** { *; } + +-dontwarn javax.annotation.** +-dontwarn org.codehaus.mojo.animal_sniffer.* +-dontwarn okhttp3.internal.platform.ConscryptPlatform +-dontwarn org.conscrypt.ConscryptHostnameVerifier +-dontwarn okhttp3.* +-dontwarn org.chromium.net.* + +-keep class com.flurry.** { *; } +-dontwarn com.flurry.** +-keepattributes *Annotation*,EnclosingMethod,Signature +-keepclasseswithmembers class * { + public (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 diff --git a/app/src/androidTest/java/com/example/genesissearchwidget/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/genesissearchwidget/ExampleInstrumentedTest.kt index 7a945382..e26d7410 100644 --- a/app/src/androidTest/java/com/example/genesissearchwidget/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/java/com/example/genesissearchwidget/ExampleInstrumentedTest.kt @@ -1,24 +1,24 @@ -package com.example.myapplication - -import android.support.test.InstrumentationRegistry -import android.support.test.runner.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getTargetContext() - assertEquals("com.example.myapplication", appContext.packageName) - } -} +package com.example.myapplication + +import android.support.test.InstrumentationRegistry +import android.support.test.runner.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getTargetContext() + assertEquals("com.example.myapplication", appContext.packageName) + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 39df419c..a506e0c0 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -196,7 +196,7 @@ + android:value="ca-app-pub-6985886044951738~4671482729" /> - - - - - - - - - - - - - - - - Genesis Search Engine | Dark Web Based Search Engine - - - - - - - - - -
-

The following help manual is loaded from local cache. Connect to proxy for viewing latest help repository

-
-
- -
-
-
  • Checking the network cables and router
  • -
  • Reconnect to Wi-Fi
  • -
  • Restart phone or application
  • -
    -
    -
    - -
    - -
    -
    - To see connection status with Tor network GOTO -

    Menu Icon (Top-Right) Settings Onion Proxy Status -
    -
    -
    - - -
    - -
    -
    - You can view Tor logs to debug an issue. To do this GOTO -

    Menu Icon (Top-Right) Orbot Logs -
    -
    -
    - -
    - -
    -
    - 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. -
    -
    -
    - -
    - -
    -
    - Some times ISP blocks Tor network routing. This issue can be solved by enabling Tor Bridges. To do this GOTO -

    Connection Screen Gear Icon Enable Bridges -
    -
    -
    - -
    - -
    -
    - 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 -

    Connection Screen Gear Icon Enable Bridges Customize bridges Meek-azure (China) -
    -
    -
    - -
    - -
    -
    - You can also provide custom bridges in Genesis. To do this GOTO -

    Connection Screen Gear Icon Enable Bridges Customize bridges Paste custom bridge paste your bridge string -
    -
    -
    - - -
    - -
    -
    - Genesis also provides a vpn from which you can secure data of other applications. To do this GOTO -

    Connection Screen Gear Icon Enable VPN Service -
    -
    -
    - - -
    -
    - -

    - - diff --git a/app/src/main/assets/Help/help.html b/app/src/main/assets/Help/help.html deleted file mode 100644 index 2a5089e7..00000000 --- a/app/src/main/assets/Help/help.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Genesis Search Engine | Dark Web Based Search Engine - - - - - - - - - -
    -

    The following help manual is loaded from local cache. Connect to proxy for viewing latest help repository

    -
    -
    - -
    -
    -
  • Checking the network cables and router
  • -
  • Reconnect to Wi-Fi
  • -
  • Restart phone or application
  • -
    -
    -
    - -
    - -
    -
    - To see connection status with Tor network GOTO -

    Menu Icon (Top-Right) Settings Onion Proxy Status -
    -
    -
    - - -
    - -
    -
    - You can view Tor logs to debug an issue. To do this GOTO -

    Menu Icon (Top-Right) Orbot Logs -
    -
    -
    - -
    - -
    -
    - 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. -
    -
    -
    - -
    - -
    -
    - Some times ISP blocks Tor network routing. This issue can be solved by enabling Tor Bridges. To do this GOTO -

    Connection Screen Gear Icon Enable Bridges -
    -
    -
    - -
    - -
    -
    - 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 -

    Connection Screen Gear Icon Enable Bridges Customize bridges Meek-azure (China) -
    -
    -
    - -
    - -
    -
    - You can also provide custom bridges in Genesis. To do this GOTO -

    Connection Screen Gear Icon Enable Bridges Customize bridges Paste custom bridge paste your bridge string -
    -
    -
    - - -
    - -
    -
    - Genesis also provides a vpn from which you can secure data of other applications. To do this GOTO -

    Connection Screen Gear Icon Enable VPN Service -
    -
    -
    - - -
    -
    - -

    - - diff --git a/app/src/main/assets/Homepage/homepage-dark.html b/app/src/main/assets/Homepage/homepage-dark.html deleted file mode 100644 index b503ec6f..00000000 --- a/app/src/main/assets/Homepage/homepage-dark.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - Genesis Search Engine | Dark Web Based Search Engine - - - - - - - -
    - -

    - Images - Proton Mail - Bitcoin Market -

    - - -
    - Genesis Search - - - -
    - - -
    -
    - - - - -
    - -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/app/src/main/assets/Homepage/homepage.html b/app/src/main/assets/Homepage/homepage.html deleted file mode 100644 index 6eefeda0..00000000 --- a/app/src/main/assets/Homepage/homepage.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - Genesis Search Engine | Dark Web Based Search Engine - - - - - - - -
    - -

    - Images - Proton Mail - Bitcoin Market -

    - - -
    - - - - -
    - - -
    -
    - - - - -
    - -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - - - - - - - \ No newline at end of file diff --git a/app/src/main/assets/Homepage/javascript/enum-homepage.js b/app/src/main/assets/Homepage/javascript/enum-homepage.js deleted file mode 100644 index d2ec8a3d..00000000 --- a/app/src/main/assets/Homepage/javascript/enum-homepage.js +++ /dev/null @@ -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", -}; diff --git a/app/src/main/assets/Homepage/javascript/js-homepage-dark.js b/app/src/main/assets/Homepage/javascript/js-homepage-dark.js deleted file mode 100644 index 56327496..00000000 --- a/app/src/main/assets/Homepage/javascript/js-homepage-dark.js +++ /dev/null @@ -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 += '
    ❏
    '+mObject[ReferenceWebsitesDataID.mHeader]+'

    '+mObject[ReferenceWebsitesDataID.mBody]+'

    ' - 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); -}); diff --git a/app/src/main/assets/Homepage/javascript/js-homepage.js b/app/src/main/assets/Homepage/javascript/js-homepage.js deleted file mode 100644 index 8934820a..00000000 --- a/app/src/main/assets/Homepage/javascript/js-homepage.js +++ /dev/null @@ -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 += '
    ❏
    '+mObject[ReferenceWebsitesDataID.mHeader]+'

    '+mObject[ReferenceWebsitesDataID.mBody]+'

    ' - 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); -}); diff --git a/app/src/main/assets/Homepage/javascript/string-homepage.js b/app/src/main/assets/Homepage/javascript/string-homepage.js deleted file mode 100644 index 1406b380..00000000 --- a/app/src/main/assets/Homepage/javascript/string-homepage.js +++ /dev/null @@ -1,6 +0,0 @@ - -/*Strings*/ - -var strings = { - emptyString : "", -}; diff --git a/app/src/main/assets/Homepage/style/cs-dark_header.css b/app/src/main/assets/Homepage/style/cs-dark_header.css deleted file mode 100644 index 2b566c7f..00000000 --- a/app/src/main/assets/Homepage/style/cs-dark_header.css +++ /dev/null @@ -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; -} diff --git a/app/src/main/assets/Homepage/style/cs-footer.css b/app/src/main/assets/Homepage/style/cs-footer.css deleted file mode 100644 index 0a9f29f0..00000000 --- a/app/src/main/assets/Homepage/style/cs-footer.css +++ /dev/null @@ -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; -} diff --git a/app/src/main/assets/Homepage/style/cs-homepage-dark.css b/app/src/main/assets/Homepage/style/cs-homepage-dark.css deleted file mode 100644 index af83d036..00000000 --- a/app/src/main/assets/Homepage/style/cs-homepage-dark.css +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/app/src/main/assets/Homepage/style/cs-homepage.css b/app/src/main/assets/Homepage/style/cs-homepage.css deleted file mode 100644 index bc5e08ee..00000000 --- a/app/src/main/assets/Homepage/style/cs-homepage.css +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/app/src/main/assets/Homepage/style/cs-light_header.css b/app/src/main/assets/Homepage/style/cs-light_header.css deleted file mode 100644 index f28e572a..00000000 --- a/app/src/main/assets/Homepage/style/cs-light_header.css +++ /dev/null @@ -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; -} diff --git a/app/src/main/assets/resources/javascript/js-fontawesome.js b/app/src/main/assets/resources/javascript/js-fontawesome.js index 656a5074..ab5134cf 100644 --- a/app/src/main/assets/resources/javascript/js-fontawesome.js +++ b/app/src/main/assets/resources/javascript/js-fontawesome.js @@ -1,5 +1,5 @@ -/*! - * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com - * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) - */ +/*! + * Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com + * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) + */ .fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s linear infinite;animation:fa-spin 2s linear infinite}.fa-pulse{-webkit-animation:fa-spin 1s steps(8) infinite;animation:fa-spin 1s steps(8) infinite}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-webkit-transform:scaleY(-1);transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1);transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asterisk:before{content:"\f069"}.fa-asymmetrik:before{content:"\f372"}.fa-at:before{content:"\f1fa"}.fa-atlas:before{content:"\f558"}.fa-atlassian:before{content:"\f77b"}.fa-atom:before{content:"\f5d2"}.fa-audible:before{content:"\f373"}.fa-audio-description:before{content:"\f29e"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-award:before{content:"\f559"}.fa-aws:before{content:"\f375"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before{content:"\f77d"}.fa-backspace:before{content:"\f55a"}.fa-backward:before{content:"\f04a"}.fa-bacon:before{content:"\f7e5"}.fa-bacteria:before{content:"\e059"}.fa-bacterium:before{content:"\e05a"}.fa-bahai:before{content:"\f666"}.fa-balance-scale:before{content:"\f24e"}.fa-balance-scale-left:before{content:"\f515"}.fa-balance-scale-right:before{content:"\f516"}.fa-ban:before{content:"\f05e"}.fa-band-aid:before{content:"\f462"}.fa-bandcamp:before{content:"\f2d5"}.fa-barcode:before{content:"\f02a"}.fa-bars:before{content:"\f0c9"}.fa-baseball-ball:before{content:"\f433"}.fa-basketball-ball:before{content:"\f434"}.fa-bath:before{content:"\f2cd"}.fa-battery-empty:before{content:"\f244"}.fa-battery-full:before{content:"\f240"}.fa-battery-half:before{content:"\f242"}.fa-battery-quarter:before{content:"\f243"}.fa-battery-three-quarters:before{content:"\f241"}.fa-battle-net:before{content:"\f835"}.fa-bed:before{content:"\f236"}.fa-beer:before{content:"\f0fc"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-bell:before{content:"\f0f3"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bible:before{content:"\f647"}.fa-bicycle:before{content:"\f206"}.fa-biking:before{content:"\f84a"}.fa-bimobject:before{content:"\f378"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-birthday-cake:before{content:"\f1fd"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blind:before{content:"\f29d"}.fa-blog:before{content:"\f781"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bold:before{content:"\f032"}.fa-bolt:before{content:"\f0e7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-book-dead:before{content:"\f6b7"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-reader:before{content:"\f5da"}.fa-bookmark:before{content:"\f02e"}.fa-bootstrap:before{content:"\f836"}.fa-border-all:before{content:"\f84c"}.fa-border-none:before{content:"\f850"}.fa-border-style:before{content:"\f853"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-box-open:before{content:"\f49e"}.fa-box-tissue:before{content:"\e05b"}.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broadcast-tower:before{content:"\f519"}.fa-broom:before{content:"\f51a"}.fa-brush:before{content:"\f55d"}.fa-btc:before{content:"\f15a"}.fa-buffer:before{content:"\f837"}.fa-bug:before{content:"\f188"}.fa-building:before{content:"\f1ad"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burn:before{content:"\f46a"}.fa-buromobelexperte:before{content:"\f37f"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before{content:"\f55e"}.fa-business-time:before{content:"\f64a"}.fa-buy-n-large:before{content:"\f8a6"}.fa-buysellads:before{content:"\f20d"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-alt:before{content:"\f073"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-times:before{content:"\f273"}.fa-calendar-week:before{content:"\f784"}.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-campground:before{content:"\f6bb"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-car:before{content:"\f1b9"}.fa-car-alt:before{content:"\f5de"}.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-side:before{content:"\f5e4"}.fa-caravan:before{content:"\f8ff"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-square-down:before{content:"\f150"}.fa-caret-square-left:before{content:"\f191"}.fa-caret-square-right:before{content:"\f152"}.fa-caret-square-up:before{content:"\f151"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-plus:before{content:"\f217"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before{content:"\f51c"}.fa-charging-station:before{content:"\f5e7"}.fa-chart-area:before{content:"\f1fe"}.fa-chart-bar:before{content:"\f080"}.fa-chart-line:before{content:"\f201"}.fa-chart-pie:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-circle:before{content:"\f058"}.fa-check-double:before{content:"\f560"}.fa-check-square:before{content:"\f14a"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-chrome:before{content:"\f268"}.fa-chromecast:before{content:"\f838"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-circle-notch:before{content:"\f1ce"}.fa-city:before{content:"\f64f"}.fa-clinic-medical:before{content:"\f7f2"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock:before{content:"\f017"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-download-alt:before{content:"\f381"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-cloud-upload-alt:before{content:"\f382"}.fa-cloudflare:before{content:"\e07d"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cocktail:before{content:"\f561"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-coffee:before{content:"\f0f4"}.fa-cog:before{content:"\f013"}.fa-cogs:before{content:"\f085"}.fa-coins:before{content:"\f51e"}.fa-columns:before{content:"\f0db"}.fa-comment:before{content:"\f075"}.fa-comment-alt:before{content:"\f27a"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compress:before{content:"\f066"}.fa-compress-alt:before{content:"\f422"}.fa-compress-arrows-alt:before{content:"\f78c"}.fa-concierge-bell:before{content:"\f562"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-cotton-bureau:before{content:"\f89e"}.fa-couch:before{content:"\f4b8"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-credit-card:before{content:"\f09d"}.fa-critical-role:before{content:"\f6c9"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-cut:before{content:"\f0c4"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dailymotion:before{content:"\e052"}.fa-dashcube:before{content:"\f210"}.fa-database:before{content:"\f1c0"}.fa-deaf:before{content:"\f2a4"}.fa-deezer:before{content:"\e077"}.fa-delicious:before{content:"\f1a5"}.fa-democrat:before{content:"\f747"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-desktop:before{content:"\f108"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dharmachakra:before{content:"\f655"}.fa-dhl:before{content:"\f790"}.fa-diagnoses:before{content:"\f470"}.fa-diaspora:before{content:"\f791"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-digital-tachograph:before{content:"\f566"}.fa-directions:before{content:"\f5eb"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-disease:before{content:"\f7fa"}.fa-divide:before{content:"\f529"}.fa-dizzy:before{content:"\f567"}.fa-dna:before{content:"\f471"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before{content:"\f155"}.fa-dolly:before{content:"\f472"}.fa-dolly-flatbed:before{content:"\f474"}.fa-donate:before{content:"\f4b9"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dot-circle:before{content:"\f192"}.fa-dove:before{content:"\f4ba"}.fa-download:before{content:"\f019"}.fa-draft2digital:before{content:"\f396"}.fa-drafting-compass:before{content:"\f568"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-dribbble:before{content:"\f17d"}.fa-dribbble-square:before{content:"\f397"}.fa-dropbox:before{content:"\f16b"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-drupal:before{content:"\f1a9"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edge-legacy:before{content:"\e078"}.fa-edit:before{content:"\f044"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elementor:before{content:"\f430"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelope-square:before{content:"\f199"}.fa-envira:before{content:"\f299"}.fa-equals:before{content:"\f52c"}.fa-eraser:before{content:"\f12d"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-ethernet:before{content:"\f796"}.fa-etsy:before{content:"\f2d7"}.fa-euro-sign:before{content:"\f153"}.fa-evernote:before{content:"\f839"}.fa-exchange-alt:before{content:"\f362"}.fa-exclamation:before{content:"\f12a"}.fa-exclamation-circle:before{content:"\f06a"}.fa-exclamation-triangle:before{content:"\f071"}.fa-expand:before{content:"\f065"}.fa-expand-alt:before{content:"\f424"}.fa-expand-arrows-alt:before{content:"\f31e"}.fa-expeditedssl:before{content:"\f23e"}.fa-external-link-alt:before{content:"\f35d"}.fa-external-link-square-alt:before{content:"\f360"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper:before{content:"\f1fb"}.fa-eye-slash:before{content:"\f070"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-facebook-square:before{content:"\f082"}.fa-fan:before{content:"\f863"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fast-backward:before{content:"\f049"}.fa-fast-forward:before{content:"\f050"}.fa-faucet:before{content:"\e005"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before{content:"\f56b"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-female:before{content:"\f182"}.fa-fighter-jet:before{content:"\f0fb"}.fa-figma:before{content:"\f799"}.fa-file:before{content:"\f15b"}.fa-file-alt:before{content:"\f15c"}.fa-file-archive:before{content:"\f1c6"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-download:before{content:"\f56d"}.fa-file-excel:before{content:"\f1c3"}.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-medical:before{content:"\f477"}.fa-file-medical-alt:before{content:"\f478"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-upload:before{content:"\f574"}.fa-file-video:before{content:"\f1c8"}.fa-file-word:before{content:"\f1c2"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-alt:before{content:"\f7e4"}.fa-fire-extinguisher:before{content:"\f134"}.fa-firefox:before{content:"\f269"}.fa-firefox-browser:before{content:"\e007"}.fa-first-aid:before{content:"\f479"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-fish:before{content:"\f578"}.fa-fist-raised:before{content:"\f6de"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-flushed:before{content:"\f579"}.fa-fly:before{content:"\f417"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-font:before{content:"\f031"}.fa-font-awesome:before{content:"\f2b4"}.fa-font-awesome-alt:before{content:"\f35c"}.fa-font-awesome-flag:before{content:"\f425"}.fa-font-awesome-logo-full:before{content:"\f4e6"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-football-ball:before{content:"\f44e"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-forward:before{content:"\f04e"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-frog:before{content:"\f52e"}.fa-frown:before{content:"\f119"}.fa-frown-open:before{content:"\f57a"}.fa-fulcrum:before{content:"\f50b"}.fa-funnel-dollar:before{content:"\f662"}.fa-futbol:before{content:"\f1e3"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-gavel:before{content:"\f0e3"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-git:before{content:"\f1d3"}.fa-git-alt:before{content:"\f841"}.fa-git-square:before{content:"\f1d2"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-github-square:before{content:"\f092"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glass-cheers:before{content:"\f79f"}.fa-glass-martini:before{content:"\f000"}.fa-glass-martini-alt:before{content:"\f57b"}.fa-glass-whiskey:before{content:"\f7a0"}.fa-glasses:before{content:"\f530"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-globe:before{content:"\f0ac"}.fa-globe-africa:before{content:"\f57c"}.fa-globe-americas:before{content:"\f57d"}.fa-globe-asia:before{content:"\f57e"}.fa-globe-europe:before{content:"\f7a2"}.fa-gofore:before{content:"\f3a7"}.fa-golf-ball:before{content:"\f450"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-pay:before{content:"\e079"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-wallet:before{content:"\f1ee"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before{content:"\f19d"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-greater-than:before{content:"\f531"}.fa-greater-than-equal:before{content:"\f532"}.fa-grimace:before{content:"\f57f"}.fa-grin:before{content:"\f580"}.fa-grin-alt:before{content:"\f581"}.fa-grin-beam:before{content:"\f582"}.fa-grin-beam-sweat:before{content:"\f583"}.fa-grin-hearts:before{content:"\f584"}.fa-grin-squint:before{content:"\f585"}.fa-grin-squint-tears:before{content:"\f586"}.fa-grin-stars:before{content:"\f587"}.fa-grin-tears:before{content:"\f588"}.fa-grin-tongue:before{content:"\f589"}.fa-grin-tongue-squint:before{content:"\f58a"}.fa-grin-tongue-wink:before{content:"\f58b"}.fa-grin-wink:before{content:"\f58c"}.fa-grip-horizontal:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guilded:before{content:"\e07e"}.fa-guitar:before{content:"\f7a6"}.fa-gulp:before{content:"\f3ae"}.fa-h-square:before{content:"\f0fd"}.fa-hacker-news:before{content:"\f1d4"}.fa-hacker-news-square:before{content:"\f3af"}.fa-hackerrank:before{content:"\f5f7"}.fa-hamburger:before{content:"\f805"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-medical:before{content:"\e05c"}.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-holding-water:before{content:"\f4c1"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-paper:before{content:"\f256"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-rock:before{content:"\f255"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-sparkles:before{content:"\e05d"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before{content:"\f4c2"}.fa-hands-helping:before{content:"\f4c4"}.fa-hands-wash:before{content:"\e05e"}.fa-handshake:before{content:"\f2b5"}.fa-handshake-alt-slash:before{content:"\e05f"}.fa-handshake-slash:before{content:"\e060"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-hat:before{content:"\f807"}.fa-hashtag:before{content:"\f292"}.fa-hat-cowboy:before{content:"\f8c0"}.fa-hat-cowboy-side:before{content:"\f8c1"}.fa-hat-wizard:before{content:"\f6e8"}.fa-hdd:before{content:"\f0a0"}.fa-head-side-cough:before{content:"\e061"}.fa-head-side-cough-slash:before{content:"\e062"}.fa-head-side-mask:before{content:"\e063"}.fa-head-side-virus:before{content:"\e064"}.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before{content:"\f7a9"}.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-highlighter:before{content:"\f591"}.fa-hiking:before{content:"\f6ec"}.fa-hippo:before{content:"\f6ed"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-history:before{content:"\f1da"}.fa-hive:before{content:"\e07f"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-home:before{content:"\f015"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital:before{content:"\f0f8"}.fa-hospital-alt:before{content:"\f47d"}.fa-hospital-symbol:before{content:"\f47e"}.fa-hospital-user:before{content:"\f80d"}.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hotjar:before{content:"\f3b1"}.fa-hourglass:before{content:"\f254"}.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-start:before{content:"\f251"}.fa-house-damage:before{content:"\f6f1"}.fa-house-user:before{content:"\e065"}.fa-houzz:before{content:"\f27c"}.fa-hryvnia:before{content:"\f6f2"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-icons:before{content:"\f86d"}.fa-id-badge:before{content:"\f2c1"}.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before{content:"\f47f"}.fa-ideal:before{content:"\e013"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-images:before{content:"\f302"}.fa-imdb:before{content:"\f2d8"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-info-circle:before{content:"\f05a"}.fa-innosoft:before{content:"\e080"}.fa-instagram:before{content:"\f16d"}.fa-instagram-square:before{content:"\e055"}.fa-instalod:before{content:"\e081"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-italic:before{content:"\f033"}.fa-itch-io:before{content:"\f83a"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi:before{content:"\f669"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joint:before{content:"\f595"}.fa-joomla:before{content:"\f1aa"}.fa-journal-whills:before{content:"\f66a"}.fa-js:before{content:"\f3b8"}.fa-js-square:before{content:"\f3b9"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaaba:before{content:"\f66b"}.fa-kaggle:before{content:"\f5fa"}.fa-key:before{content:"\f084"}.fa-keybase:before{content:"\f4f5"}.fa-keyboard:before{content:"\f11c"}.fa-keycdn:before{content:"\f3ba"}.fa-khanda:before{content:"\f66d"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-kiss:before{content:"\f596"}.fa-kiss-beam:before{content:"\f597"}.fa-kiss-wink-heart:before{content:"\f598"}.fa-kiwi-bird:before{content:"\f535"}.fa-korvue:before{content:"\f42f"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-house:before{content:"\e066"}.fa-laptop-medical:before{content:"\f812"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-laugh:before{content:"\f599"}.fa-laugh-beam:before{content:"\f59a"}.fa-laugh-squint:before{content:"\f59b"}.fa-laugh-wink:before{content:"\f59c"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-leanpub:before{content:"\f212"}.fa-lemon:before{content:"\f094"}.fa-less:before{content:"\f41d"}.fa-less-than:before{content:"\f536"}.fa-less-than-equal:before{content:"\f537"}.fa-level-down-alt:before{content:"\f3be"}.fa-level-up-alt:before{content:"\f3bf"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-line:before{content:"\f3c0"}.fa-link:before{content:"\f0c1"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lira-sign:before{content:"\f195"}.fa-list:before{content:"\f03a"}.fa-list-alt:before{content:"\f022"}.fa-list-ol:before{content:"\f0cb"}.fa-list-ul:before{content:"\f0ca"}.fa-location-arrow:before{content:"\f124"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-long-arrow-alt-down:before{content:"\f309"}.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-long-arrow-alt-right:before{content:"\f30b"}.fa-long-arrow-alt-up:before{content:"\f30c"}.fa-low-vision:before{content:"\f2a8"}.fa-luggage-cart:before{content:"\f59d"}.fa-lungs:before{content:"\f604"}.fa-lungs-virus:before{content:"\e067"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-magic:before{content:"\f0d0"}.fa-magnet:before{content:"\f076"}.fa-mail-bulk:before{content:"\f674"}.fa-mailchimp:before{content:"\f59e"}.fa-male:before{content:"\f183"}.fa-mandalorian:before{content:"\f50f"}.fa-map:before{content:"\f279"}.fa-map-marked:before{content:"\f59f"}.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-marker:before{content:"\f041"}.fa-map-marker-alt:before{content:"\f3c5"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-markdown:before{content:"\f60f"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mask:before{content:"\f6fa"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-mdb:before{content:"\f8ca"}.fa-medal:before{content:"\f5a2"}.fa-medapps:before{content:"\f3c6"}.fa-medium:before{content:"\f23a"}.fa-medium-m:before{content:"\f3c7"}.fa-medkit:before{content:"\f0fa"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-meh:before{content:"\f11a"}.fa-meh-blank:before{content:"\f5a4"}.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-memory:before{content:"\f538"}.fa-mendeley:before{content:"\f7b3"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-meteor:before{content:"\f753"}.fa-microblog:before{content:"\e01a"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before{content:"\f3c9"}.fa-microphone-alt-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-microsoft:before{content:"\f3ca"}.fa-minus:before{content:"\f068"}.fa-minus-circle:before{content:"\f056"}.fa-minus-square:before{content:"\f146"}.fa-mitten:before{content:"\f7b5"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mixer:before{content:"\e056"}.fa-mizuni:before{content:"\f3cc"}.fa-mobile:before{content:"\f10b"}.fa-mobile-alt:before{content:"\f3cd"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mouse:before{content:"\f8cc"}.fa-mouse-pointer:before{content:"\f245"}.fa-mug-hot:before{content:"\f7b6"}.fa-music:before{content:"\f001"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-nimblr:before{content:"\f5a8"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-not-equal:before{content:"\f53e"}.fa-notes-medical:before{content:"\f481"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-octopus-deploy:before{content:"\e082"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-oil-can:before{content:"\f613"}.fa-old-republic:before{content:"\f510"}.fa-om:before{content:"\f679"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-orcid:before{content:"\f8d2"}.fa-osi:before{content:"\f41a"}.fa-otter:before{content:"\f700"}.fa-outdent:before{content:"\f03b"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-pager:before{content:"\f815"}.fa-paint-brush:before{content:"\f1fc"}.fa-paint-roller:before{content:"\f5aa"}.fa-palette:before{content:"\f53f"}.fa-palfed:before{content:"\f3d8"}.fa-pallet:before{content:"\f482"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-parking:before{content:"\f540"}.fa-passport:before{content:"\f5ab"}.fa-pastafarianism:before{content:"\f67b"}.fa-paste:before{content:"\f0ea"}.fa-patreon:before{content:"\f3d9"}.fa-pause:before{content:"\f04c"}.fa-pause-circle:before{content:"\f28b"}.fa-paw:before{content:"\f1b0"}.fa-paypal:before{content:"\f1ed"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-square:before{content:"\f14b"}.fa-pencil-alt:before{content:"\f303"}.fa-pencil-ruler:before{content:"\f5ae"}.fa-penny-arcade:before{content:"\f704"}.fa-people-arrows:before{content:"\e068"}.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-perbyte:before{content:"\e083"}.fa-percent:before{content:"\f295"}.fa-percentage:before{content:"\f541"}.fa-periscope:before{content:"\f3da"}.fa-person-booth:before{content:"\f756"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-phone:before{content:"\f095"}.fa-phone-alt:before{content:"\f879"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-square:before{content:"\f098"}.fa-phone-square-alt:before{content:"\f87b"}.fa-phone-volume:before{content:"\f2a0"}.fa-photo-video:before{content:"\f87c"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-square:before{content:"\e01e"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pinterest-square:before{content:"\f0d3"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-plane-slash:before{content:"\e069"}.fa-play:before{content:"\f04b"}.fa-play-circle:before{content:"\f144"}.fa-playstation:before{content:"\f3df"}.fa-plug:before{content:"\f1e6"}.fa-plus:before{content:"\f067"}.fa-plus-circle:before{content:"\f055"}.fa-plus-square:before{content:"\f0fe"}.fa-podcast:before{content:"\f2ce"}.fa-poll:before{content:"\f681"}.fa-poll-h:before{content:"\f682"}.fa-poo:before{content:"\f2fe"}.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-portrait:before{content:"\f3e0"}.fa-pound-sign:before{content:"\f154"}.fa-power-off:before{content:"\f011"}.fa-pray:before{content:"\f683"}.fa-praying-hands:before{content:"\f684"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-procedures:before{content:"\f487"}.fa-product-hunt:before{content:"\f288"}.fa-project-diagram:before{content:"\f542"}.fa-pump-medical:before{content:"\e06a"}.fa-pump-soap:before{content:"\e06b"}.fa-pushed:before{content:"\f3e1"}.fa-puzzle-piece:before{content:"\f12e"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\f128"}.fa-question-circle:before{content:"\f059"}.fa-quidditch:before{content:"\f458"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-quran:before{content:"\f687"}.fa-r-project:before{content:"\f4f7"}.fa-radiation:before{content:"\f7b9"}.fa-radiation-alt:before{content:"\f7ba"}.fa-rainbow:before{content:"\f75b"}.fa-random:before{content:"\f074"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-receipt:before{content:"\f543"}.fa-record-vinyl:before{content:"\f8d9"}.fa-recycle:before{content:"\f1b8"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-reddit-square:before{content:"\f1a2"}.fa-redhat:before{content:"\f7bc"}.fa-redo:before{content:"\f01e"}.fa-redo-alt:before{content:"\f2f9"}.fa-registered:before{content:"\f25d"}.fa-remove-format:before{content:"\f87d"}.fa-renren:before{content:"\f18b"}.fa-reply:before{content:"\f3e5"}.fa-reply-all:before{content:"\f122"}.fa-replyd:before{content:"\f3e6"}.fa-republican:before{content:"\f75e"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-rev:before{content:"\f5b2"}.fa-ribbon:before{content:"\f4d6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-route:before{content:"\f4d7"}.fa-rss:before{content:"\f09e"}.fa-rss-square:before{content:"\f143"}.fa-ruble-sign:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-running:before{content:"\f70c"}.fa-rupee-sign:before{content:"\f156"}.fa-rust:before{content:"\e07a"}.fa-sad-cry:before{content:"\f5b3"}.fa-sad-tear:before{content:"\f5b4"}.fa-safari:before{content:"\f267"}.fa-salesforce:before{content:"\f83b"}.fa-sass:before{content:"\f41e"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-save:before{content:"\f0c7"}.fa-schlix:before{content:"\f3ea"}.fa-school:before{content:"\f549"}.fa-screwdriver:before{content:"\f54a"}.fa-scribd:before{content:"\f28a"}.fa-scroll:before{content:"\f70e"}.fa-sd-card:before{content:"\f7c2"}.fa-search:before{content:"\f002"}.fa-search-dollar:before{content:"\f688"}.fa-search-location:before{content:"\f689"}.fa-search-minus:before{content:"\f010"}.fa-search-plus:before{content:"\f00e"}.fa-searchengin:before{content:"\f3eb"}.fa-seedling:before{content:"\f4d8"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-server:before{content:"\f233"}.fa-servicestack:before{content:"\f3ec"}.fa-shapes:before{content:"\f61f"}.fa-share:before{content:"\f064"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-share-square:before{content:"\f14d"}.fa-shekel-sign:before{content:"\f20b"}.fa-shield-alt:before{content:"\f3ed"}.fa-shield-virus:before{content:"\e06c"}.fa-ship:before{content:"\f21a"}.fa-shipping-fast:before{content:"\f48b"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shoe-prints:before{content:"\f54b"}.fa-shopify:before{content:"\e057"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-shopping-cart:before{content:"\f07a"}.fa-shopware:before{content:"\f5b5"}.fa-shower:before{content:"\f2cc"}.fa-shuttle-van:before{content:"\f5b6"}.fa-sign:before{content:"\f4d9"}.fa-sign-in-alt:before{content:"\f2f6"}.fa-sign-language:before{content:"\f2a7"}.fa-sign-out-alt:before{content:"\f2f5"}.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-sim-card:before{content:"\f7c4"}.fa-simplybuilt:before{content:"\f215"}.fa-sink:before{content:"\e06d"}.fa-sistrix:before{content:"\f3ee"}.fa-sitemap:before{content:"\f0e8"}.fa-sith:before{content:"\f512"}.fa-skating:before{content:"\f7c5"}.fa-sketch:before{content:"\f7c6"}.fa-skiing:before{content:"\f7c9"}.fa-skiing-nordic:before{content:"\f7ca"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack:before{content:"\f198"}.fa-slack-hash:before{content:"\f3ef"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before{content:"\f1de"}.fa-slideshare:before{content:"\f1e7"}.fa-smile:before{content:"\f118"}.fa-smile-beam:before{content:"\f5b8"}.fa-smile-wink:before{content:"\f4da"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-smoking-ban:before{content:"\f54d"}.fa-sms:before{content:"\f7cd"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-snowboarding:before{content:"\f7ce"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-soap:before{content:"\e06e"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before{content:"\f0dc"}.fa-sort-alpha-down:before{content:"\f15d"}.fa-sort-alpha-down-alt:before{content:"\f881"}.fa-sort-alpha-up:before{content:"\f15e"}.fa-sort-alpha-up-alt:before{content:"\f882"}.fa-sort-amount-down:before{content:"\f160"}.fa-sort-amount-down-alt:before{content:"\f884"}.fa-sort-amount-up:before{content:"\f161"}.fa-sort-amount-up-alt:before{content:"\f885"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-numeric-down:before{content:"\f162"}.fa-sort-numeric-down-alt:before{content:"\f886"}.fa-sort-numeric-up:before{content:"\f163"}.fa-sort-numeric-up-alt:before{content:"\f887"}.fa-sort-up:before{content:"\f0de"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-spa:before{content:"\f5bb"}.fa-space-shuttle:before{content:"\f197"}.fa-speakap:before{content:"\f3f3"}.fa-speaker-deck:before{content:"\f83c"}.fa-spell-check:before{content:"\f891"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spotify:before{content:"\f1bc"}.fa-spray-can:before{content:"\f5bd"}.fa-square:before{content:"\f0c8"}.fa-square-full:before{content:"\f45c"}.fa-square-root-alt:before{content:"\f698"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stackpath:before{content:"\f842"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-steam-symbol:before{content:"\f3f6"}.fa-step-backward:before{content:"\f048"}.fa-step-forward:before{content:"\f051"}.fa-stethoscope:before{content:"\f0f1"}.fa-sticker-mule:before{content:"\f3f7"}.fa-sticky-note:before{content:"\f249"}.fa-stop:before{content:"\f04d"}.fa-stop-circle:before{content:"\f28d"}.fa-stopwatch:before{content:"\f2f2"}.fa-stopwatch-20:before{content:"\e06f"}.fa-store:before{content:"\f54e"}.fa-store-alt:before{content:"\f54f"}.fa-store-alt-slash:before{content:"\e070"}.fa-store-slash:before{content:"\e071"}.fa-strava:before{content:"\f428"}.fa-stream:before{content:"\f550"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-stroopwafel:before{content:"\f551"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-subscript:before{content:"\f12c"}.fa-subway:before{content:"\f239"}.fa-suitcase:before{content:"\f0f2"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superpowers:before{content:"\f2dd"}.fa-superscript:before{content:"\f12b"}.fa-supple:before{content:"\f3f9"}.fa-surprise:before{content:"\f5c2"}.fa-suse:before{content:"\f7d6"}.fa-swatchbook:before{content:"\f5c3"}.fa-swift:before{content:"\f8e1"}.fa-swimmer:before{content:"\f5c4"}.fa-swimming-pool:before{content:"\f5c5"}.fa-symfony:before{content:"\f83d"}.fa-synagogue:before{content:"\f69b"}.fa-sync:before{content:"\f021"}.fa-sync-alt:before{content:"\f2f1"}.fa-syringe:before{content:"\f48e"}.fa-table:before{content:"\f0ce"}.fa-table-tennis:before{content:"\f45d"}.fa-tablet:before{content:"\f10a"}.fa-tablet-alt:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-tachometer-alt:before{content:"\f3fd"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-tasks:before{content:"\f0ae"}.fa-taxi:before{content:"\f1ba"}.fa-teamspeak:before{content:"\f4f9"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-telegram:before{content:"\f2c6"}.fa-telegram-plane:before{content:"\f3fe"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-th:before{content:"\f00a"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-the-red-yeti:before{content:"\f69d"}.fa-theater-masks:before{content:"\f630"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-thermometer:before{content:"\f491"}.fa-thermometer-empty:before{content:"\f2cb"}.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-think-peaks:before{content:"\f731"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbtack:before{content:"\f08d"}.fa-ticket-alt:before{content:"\f3ff"}.fa-tiktok:before{content:"\e07b"}.fa-times:before{content:"\f00d"}.fa-times-circle:before{content:"\f057"}.fa-tint:before{content:"\f043"}.fa-tint-slash:before{content:"\f5c7"}.fa-tired:before{content:"\f5c8"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toilet-paper-slash:before{content:"\e072"}.fa-toolbox:before{content:"\f552"}.fa-tools:before{content:"\f7d9"}.fa-tooth:before{content:"\f5c9"}.fa-torah:before{content:"\f6a0"}.fa-torii-gate:before{content:"\f6a1"}.fa-tractor:before{content:"\f722"}.fa-trade-federation:before{content:"\f513"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-trailer:before{content:"\e041"}.fa-train:before{content:"\f238"}.fa-tram:before{content:"\f7da"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-alt:before{content:"\f2ed"}.fa-trash-restore:before{content:"\f829"}.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-trello:before{content:"\f181"}.fa-tripadvisor:before{content:"\f262"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-truck-loading:before{content:"\f4de"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-tshirt:before{content:"\f553"}.fa-tty:before{content:"\f1e4"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-tv:before{content:"\f26c"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-twitter-square:before{content:"\f081"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbraco:before{content:"\f8e8"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-uncharted:before{content:"\e084"}.fa-underline:before{content:"\f0cd"}.fa-undo:before{content:"\f0e2"}.fa-undo-alt:before{content:"\f2ea"}.fa-uniregistry:before{content:"\f404"}.fa-unity:before{content:"\e049"}.fa-universal-access:before{content:"\f29a"}.fa-university:before{content:"\f19c"}.fa-unlink:before{content:"\f127"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before{content:"\f13e"}.fa-unsplash:before{content:"\e07c"}.fa-untappd:before{content:"\f405"}.fa-upload:before{content:"\f093"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-user:before{content:"\f007"}.fa-user-alt:before{content:"\f406"}.fa-user-alt-slash:before{content:"\f4fa"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-clock:before{content:"\f4fd"}.fa-user-cog:before{content:"\f4fe"}.fa-user-edit:before{content:"\f4ff"}.fa-user-friends:before{content:"\f500"}.fa-user-graduate:before{content:"\f501"}.fa-user-injured:before{content:"\f728"}.fa-user-lock:before{content:"\f502"}.fa-user-md:before{content:"\f0f0"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before{content:"\f235"}.fa-users:before{content:"\f0c0"}.fa-users-cog:before{content:"\f509"}.fa-users-slash:before{content:"\e073"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-utensil-spoon:before{content:"\f2e5"}.fa-utensils:before{content:"\f2e7"}.fa-vaadin:before{content:"\f408"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-vest:before{content:"\e085"}.fa-vest-patches:before{content:"\e086"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-viber:before{content:"\f409"}.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-square:before{content:"\f194"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-virus:before{content:"\e074"}.fa-virus-slash:before{content:"\e075"}.fa-viruses:before{content:"\e076"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-voicemail:before{content:"\f897"}.fa-volleyball-ball:before{content:"\f45f"}.fa-volume-down:before{content:"\f027"}.fa-volume-mute:before{content:"\f6a9"}.fa-volume-off:before{content:"\f026"}.fa-volume-up:before{content:"\f028"}.fa-vote-yea:before{content:"\f772"}.fa-vr-cardboard:before{content:"\f729"}.fa-vuejs:before{content:"\f41f"}.fa-walking:before{content:"\f554"}.fa-wallet:before{content:"\f555"}.fa-warehouse:before{content:"\f494"}.fa-watchman-monitoring:before{content:"\e087"}.fa-water:before{content:"\f773"}.fa-wave-square:before{content:"\f83e"}.fa-waze:before{content:"\f83f"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weight:before{content:"\f496"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whatsapp-square:before{content:"\f40c"}.fa-wheelchair:before{content:"\f193"}.fa-whmcs:before{content:"\f40d"}.fa-wifi:before{content:"\f1eb"}.fa-wikipedia-w:before{content:"\f266"}.fa-wind:before{content:"\f72e"}.fa-window-close:before{content:"\f410"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-windows:before{content:"\f17a"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before{content:"\f5ce"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wodu:before{content:"\e088"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-won-sign:before{content:"\f159"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-wpressr:before{content:"\f3e4"}.fa-wrench:before{content:"\f0ad"}.fa-x-ray:before{content:"\f497"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yammer:before{content:"\f840"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yen-sign:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-youtube-square:before{content:"\f431"}.fa-zhihu:before{content:"\f63f"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}@font-face{font-family:"Font Awesome 5 Brands";font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-brands-400.eot);src:url(../webfonts/fa-brands-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.woff) format("woff"),url(../webfonts/fa-brands-400.ttf) format("truetype"),url(../webfonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands"}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-regular-400.eot);src:url(../webfonts/fa-regular-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"),url(../webfonts/fa-regular-400.ttf) format("truetype"),url(../webfonts/fa-regular-400.svg#fontawesome) format("svg")}.fab,.far{font-weight:400}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.eot);src:url(../webfonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url(../webfonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.far,.fas{font-family:"Font Awesome 5 Free"}.fa,.fas{font-weight:900} \ No newline at end of file diff --git a/app/src/main/assets/resources/javascript/js-jquery.js b/app/src/main/assets/resources/javascript/js-jquery.js index d467083b..015256d0 100644 --- a/app/src/main/assets/resources/javascript/js-jquery.js +++ b/app/src/main/assets/resources/javascript/js-jquery.js @@ -1,2 +1,2 @@ -/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */ +/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */ !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
    ",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0 code { - color: inherit; -} - -kbd { - padding: 0.2rem 0.4rem; - font-size: 87.5%; - color: #fff; - background-color: #212529; - border-radius: 0.2rem; -} - -kbd kbd { - padding: 0; - font-size: 100%; - font-weight: 700; -} - -pre { - display: block; - font-size: 87.5%; - color: #212529; -} - -pre code { - font-size: inherit; - color: inherit; - word-break: normal; -} - -.pre-scrollable { - max-height: 340px; - overflow-y: scroll; -} - -.container { - width: 100%; - padding-right: 15px; - padding-left: 15px; - margin-right: auto; - margin-left: auto; -} - -@media (min-width: 576px) { - .container { - max-width: 540px; - } -} - -@media (min-width: 768px) { - .container { - max-width: 720px; - } -} - -@media (min-width: 992px) { - .container { - max-width: 960px; - } -} - -@media (min-width: 1200px) { - .container { - max-width: 1140px; - } -} - -.container-fluid { - width: 100%; - padding-right: 15px; - padding-left: 15px; - margin-right: auto; - margin-left: auto; -} - -.row { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - margin-right: -15px; - margin-left: -15px; -} - -.no-gutters { - margin-right: 0; - margin-left: 0; -} - -.no-gutters > .col, -.no-gutters > [class*="col-"] { - padding-right: 0; - padding-left: 0; -} - -.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, .col, -.col-auto, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm, -.col-sm-auto, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12, .col-md, -.col-md-auto, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg, -.col-lg-auto, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl, -.col-xl-auto { - position: relative; - width: 100%; - min-height: 1px; - padding-right: 15px; - padding-left: 15px; -} - -.col { - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - max-width: 100%; -} - -.col-auto { - -webkit-box-flex: 0; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - width: auto; - max-width: none; -} - -.col-1 { - -webkit-box-flex: 0; - -ms-flex: 0 0 8.333333%; - flex: 0 0 8.333333%; - max-width: 8.333333%; -} - -.col-2 { - -webkit-box-flex: 0; - -ms-flex: 0 0 16.666667%; - flex: 0 0 16.666667%; - max-width: 16.666667%; -} - -.col-3 { - -webkit-box-flex: 0; - -ms-flex: 0 0 25%; - flex: 0 0 25%; - max-width: 25%; -} - -.col-4 { - -webkit-box-flex: 0; - -ms-flex: 0 0 33.333333%; - flex: 0 0 33.333333%; - max-width: 33.333333%; -} - -.col-5 { - -webkit-box-flex: 0; - -ms-flex: 0 0 41.666667%; - flex: 0 0 41.666667%; - max-width: 41.666667%; -} - -.col-6 { - -webkit-box-flex: 0; - -ms-flex: 0 0 50%; - flex: 0 0 50%; - max-width: 50%; -} - -.col-7 { - -webkit-box-flex: 0; - -ms-flex: 0 0 58.333333%; - flex: 0 0 58.333333%; - max-width: 58.333333%; -} - -.col-8 { - -webkit-box-flex: 0; - -ms-flex: 0 0 66.666667%; - flex: 0 0 66.666667%; - max-width: 66.666667%; -} - -.col-9 { - -webkit-box-flex: 0; - -ms-flex: 0 0 75%; - flex: 0 0 75%; - max-width: 75%; -} - -.col-10 { - -webkit-box-flex: 0; - -ms-flex: 0 0 83.333333%; - flex: 0 0 83.333333%; - max-width: 83.333333%; -} - -.col-11 { - -webkit-box-flex: 0; - -ms-flex: 0 0 91.666667%; - flex: 0 0 91.666667%; - max-width: 91.666667%; -} - -.col-12 { - -webkit-box-flex: 0; - -ms-flex: 0 0 100%; - flex: 0 0 100%; - max-width: 100%; -} - -.order-first { - -webkit-box-ordinal-group: 0; - -ms-flex-order: -1; - order: -1; -} - -.order-last { - -webkit-box-ordinal-group: 14; - -ms-flex-order: 13; - order: 13; -} - -.order-0 { - -webkit-box-ordinal-group: 1; - -ms-flex-order: 0; - order: 0; -} - -.order-1 { - -webkit-box-ordinal-group: 2; - -ms-flex-order: 1; - order: 1; -} - -.order-2 { - -webkit-box-ordinal-group: 3; - -ms-flex-order: 2; - order: 2; -} - -.order-3 { - -webkit-box-ordinal-group: 4; - -ms-flex-order: 3; - order: 3; -} - -.order-4 { - -webkit-box-ordinal-group: 5; - -ms-flex-order: 4; - order: 4; -} - -.order-5 { - -webkit-box-ordinal-group: 6; - -ms-flex-order: 5; - order: 5; -} - -.order-6 { - -webkit-box-ordinal-group: 7; - -ms-flex-order: 6; - order: 6; -} - -.order-7 { - -webkit-box-ordinal-group: 8; - -ms-flex-order: 7; - order: 7; -} - -.order-8 { - -webkit-box-ordinal-group: 9; - -ms-flex-order: 8; - order: 8; -} - -.order-9 { - -webkit-box-ordinal-group: 10; - -ms-flex-order: 9; - order: 9; -} - -.order-10 { - -webkit-box-ordinal-group: 11; - -ms-flex-order: 10; - order: 10; -} - -.order-11 { - -webkit-box-ordinal-group: 12; - -ms-flex-order: 11; - order: 11; -} - -.order-12 { - -webkit-box-ordinal-group: 13; - -ms-flex-order: 12; - order: 12; -} - -.offset-1 { - margin-left: 8.333333%; -} - -.offset-2 { - margin-left: 16.666667%; -} - -.offset-3 { - margin-left: 25%; -} - -.offset-4 { - margin-left: 33.333333%; -} - -.offset-5 { - margin-left: 41.666667%; -} - -.offset-6 { - margin-left: 50%; -} - -.offset-7 { - margin-left: 58.333333%; -} - -.offset-8 { - margin-left: 66.666667%; -} - -.offset-9 { - margin-left: 75%; -} - -.offset-10 { - margin-left: 83.333333%; -} - -.offset-11 { - margin-left: 91.666667%; -} - -@media (min-width: 576px) { - .col-sm { - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - max-width: 100%; - } - .col-sm-auto { - -webkit-box-flex: 0; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - width: auto; - max-width: none; - } - .col-sm-1 { - -webkit-box-flex: 0; - -ms-flex: 0 0 8.333333%; - flex: 0 0 8.333333%; - max-width: 8.333333%; - } - .col-sm-2 { - -webkit-box-flex: 0; - -ms-flex: 0 0 16.666667%; - flex: 0 0 16.666667%; - max-width: 16.666667%; - } - .col-sm-3 { - -webkit-box-flex: 0; - -ms-flex: 0 0 25%; - flex: 0 0 25%; - max-width: 25%; - } - .col-sm-4 { - -webkit-box-flex: 0; - -ms-flex: 0 0 33.333333%; - flex: 0 0 33.333333%; - max-width: 33.333333%; - } - .col-sm-5 { - -webkit-box-flex: 0; - -ms-flex: 0 0 41.666667%; - flex: 0 0 41.666667%; - max-width: 41.666667%; - } - .col-sm-6 { - -webkit-box-flex: 0; - -ms-flex: 0 0 50%; - flex: 0 0 50%; - max-width: 50%; - } - .col-sm-7 { - -webkit-box-flex: 0; - -ms-flex: 0 0 58.333333%; - flex: 0 0 58.333333%; - max-width: 58.333333%; - } - .col-sm-8 { - -webkit-box-flex: 0; - -ms-flex: 0 0 66.666667%; - flex: 0 0 66.666667%; - max-width: 66.666667%; - } - .col-sm-9 { - -webkit-box-flex: 0; - -ms-flex: 0 0 75%; - flex: 0 0 75%; - max-width: 75%; - } - .col-sm-10 { - -webkit-box-flex: 0; - -ms-flex: 0 0 83.333333%; - flex: 0 0 83.333333%; - max-width: 83.333333%; - } - .col-sm-11 { - -webkit-box-flex: 0; - -ms-flex: 0 0 91.666667%; - flex: 0 0 91.666667%; - max-width: 91.666667%; - } - .col-sm-12 { - -webkit-box-flex: 0; - -ms-flex: 0 0 100%; - flex: 0 0 100%; - max-width: 100%; - } - .order-sm-first { - -webkit-box-ordinal-group: 0; - -ms-flex-order: -1; - order: -1; - } - .order-sm-last { - -webkit-box-ordinal-group: 14; - -ms-flex-order: 13; - order: 13; - } - .order-sm-0 { - -webkit-box-ordinal-group: 1; - -ms-flex-order: 0; - order: 0; - } - .order-sm-1 { - -webkit-box-ordinal-group: 2; - -ms-flex-order: 1; - order: 1; - } - .order-sm-2 { - -webkit-box-ordinal-group: 3; - -ms-flex-order: 2; - order: 2; - } - .order-sm-3 { - -webkit-box-ordinal-group: 4; - -ms-flex-order: 3; - order: 3; - } - .order-sm-4 { - -webkit-box-ordinal-group: 5; - -ms-flex-order: 4; - order: 4; - } - .order-sm-5 { - -webkit-box-ordinal-group: 6; - -ms-flex-order: 5; - order: 5; - } - .order-sm-6 { - -webkit-box-ordinal-group: 7; - -ms-flex-order: 6; - order: 6; - } - .order-sm-7 { - -webkit-box-ordinal-group: 8; - -ms-flex-order: 7; - order: 7; - } - .order-sm-8 { - -webkit-box-ordinal-group: 9; - -ms-flex-order: 8; - order: 8; - } - .order-sm-9 { - -webkit-box-ordinal-group: 10; - -ms-flex-order: 9; - order: 9; - } - .order-sm-10 { - -webkit-box-ordinal-group: 11; - -ms-flex-order: 10; - order: 10; - } - .order-sm-11 { - -webkit-box-ordinal-group: 12; - -ms-flex-order: 11; - order: 11; - } - .order-sm-12 { - -webkit-box-ordinal-group: 13; - -ms-flex-order: 12; - order: 12; - } - .offset-sm-0 { - margin-left: 0; - } - .offset-sm-1 { - margin-left: 8.333333%; - } - .offset-sm-2 { - margin-left: 16.666667%; - } - .offset-sm-3 { - margin-left: 25%; - } - .offset-sm-4 { - margin-left: 33.333333%; - } - .offset-sm-5 { - margin-left: 41.666667%; - } - .offset-sm-6 { - margin-left: 50%; - } - .offset-sm-7 { - margin-left: 58.333333%; - } - .offset-sm-8 { - margin-left: 66.666667%; - } - .offset-sm-9 { - margin-left: 75%; - } - .offset-sm-10 { - margin-left: 83.333333%; - } - .offset-sm-11 { - margin-left: 91.666667%; - } -} - -@media (min-width: 768px) { - .col-md { - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - max-width: 100%; - } - .col-md-auto { - -webkit-box-flex: 0; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - width: auto; - max-width: none; - } - .col-md-1 { - -webkit-box-flex: 0; - -ms-flex: 0 0 8.333333%; - flex: 0 0 8.333333%; - max-width: 8.333333%; - } - .col-md-2 { - -webkit-box-flex: 0; - -ms-flex: 0 0 16.666667%; - flex: 0 0 16.666667%; - max-width: 16.666667%; - } - .col-md-3 { - -webkit-box-flex: 0; - -ms-flex: 0 0 25%; - flex: 0 0 25%; - max-width: 25%; - } - .col-md-4 { - -webkit-box-flex: 0; - -ms-flex: 0 0 33.333333%; - flex: 0 0 33.333333%; - max-width: 33.333333%; - } - .col-md-5 { - -webkit-box-flex: 0; - -ms-flex: 0 0 41.666667%; - flex: 0 0 41.666667%; - max-width: 41.666667%; - } - .col-md-6 { - -webkit-box-flex: 0; - -ms-flex: 0 0 50%; - flex: 0 0 50%; - max-width: 50%; - } - .col-md-7 { - -webkit-box-flex: 0; - -ms-flex: 0 0 58.333333%; - flex: 0 0 58.333333%; - max-width: 58.333333%; - } - .col-md-8 { - -webkit-box-flex: 0; - -ms-flex: 0 0 66.666667%; - flex: 0 0 66.666667%; - max-width: 66.666667%; - } - .col-md-9 { - -webkit-box-flex: 0; - -ms-flex: 0 0 75%; - flex: 0 0 75%; - max-width: 75%; - } - .col-md-10 { - -webkit-box-flex: 0; - -ms-flex: 0 0 83.333333%; - flex: 0 0 83.333333%; - max-width: 83.333333%; - } - .col-md-11 { - -webkit-box-flex: 0; - -ms-flex: 0 0 91.666667%; - flex: 0 0 91.666667%; - max-width: 91.666667%; - } - .col-md-12 { - -webkit-box-flex: 0; - -ms-flex: 0 0 100%; - flex: 0 0 100%; - max-width: 100%; - } - .order-md-first { - -webkit-box-ordinal-group: 0; - -ms-flex-order: -1; - order: -1; - } - .order-md-last { - -webkit-box-ordinal-group: 14; - -ms-flex-order: 13; - order: 13; - } - .order-md-0 { - -webkit-box-ordinal-group: 1; - -ms-flex-order: 0; - order: 0; - } - .order-md-1 { - -webkit-box-ordinal-group: 2; - -ms-flex-order: 1; - order: 1; - } - .order-md-2 { - -webkit-box-ordinal-group: 3; - -ms-flex-order: 2; - order: 2; - } - .order-md-3 { - -webkit-box-ordinal-group: 4; - -ms-flex-order: 3; - order: 3; - } - .order-md-4 { - -webkit-box-ordinal-group: 5; - -ms-flex-order: 4; - order: 4; - } - .order-md-5 { - -webkit-box-ordinal-group: 6; - -ms-flex-order: 5; - order: 5; - } - .order-md-6 { - -webkit-box-ordinal-group: 7; - -ms-flex-order: 6; - order: 6; - } - .order-md-7 { - -webkit-box-ordinal-group: 8; - -ms-flex-order: 7; - order: 7; - } - .order-md-8 { - -webkit-box-ordinal-group: 9; - -ms-flex-order: 8; - order: 8; - } - .order-md-9 { - -webkit-box-ordinal-group: 10; - -ms-flex-order: 9; - order: 9; - } - .order-md-10 { - -webkit-box-ordinal-group: 11; - -ms-flex-order: 10; - order: 10; - } - .order-md-11 { - -webkit-box-ordinal-group: 12; - -ms-flex-order: 11; - order: 11; - } - .order-md-12 { - -webkit-box-ordinal-group: 13; - -ms-flex-order: 12; - order: 12; - } - .offset-md-0 { - margin-left: 0; - } - .offset-md-1 { - margin-left: 8.333333%; - } - .offset-md-2 { - margin-left: 16.666667%; - } - .offset-md-3 { - margin-left: 25%; - } - .offset-md-4 { - margin-left: 33.333333%; - } - .offset-md-5 { - margin-left: 41.666667%; - } - .offset-md-6 { - margin-left: 50%; - } - .offset-md-7 { - margin-left: 58.333333%; - } - .offset-md-8 { - margin-left: 66.666667%; - } - .offset-md-9 { - margin-left: 75%; - } - .offset-md-10 { - margin-left: 83.333333%; - } - .offset-md-11 { - margin-left: 91.666667%; - } -} - -@media (min-width: 992px) { - .col-lg { - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - max-width: 100%; - } - .col-lg-auto { - -webkit-box-flex: 0; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - width: auto; - max-width: none; - } - .col-lg-1 { - -webkit-box-flex: 0; - -ms-flex: 0 0 8.333333%; - flex: 0 0 8.333333%; - max-width: 8.333333%; - } - .col-lg-2 { - -webkit-box-flex: 0; - -ms-flex: 0 0 16.666667%; - flex: 0 0 16.666667%; - max-width: 16.666667%; - } - .col-lg-3 { - -webkit-box-flex: 0; - -ms-flex: 0 0 25%; - flex: 0 0 25%; - max-width: 25%; - } - .col-lg-4 { - -webkit-box-flex: 0; - -ms-flex: 0 0 33.333333%; - flex: 0 0 33.333333%; - max-width: 33.333333%; - } - .col-lg-5 { - -webkit-box-flex: 0; - -ms-flex: 0 0 41.666667%; - flex: 0 0 41.666667%; - max-width: 41.666667%; - } - .col-lg-6 { - -webkit-box-flex: 0; - -ms-flex: 0 0 50%; - flex: 0 0 50%; - max-width: 50%; - } - .col-lg-7 { - -webkit-box-flex: 0; - -ms-flex: 0 0 58.333333%; - flex: 0 0 58.333333%; - max-width: 58.333333%; - } - .col-lg-8 { - -webkit-box-flex: 0; - -ms-flex: 0 0 66.666667%; - flex: 0 0 66.666667%; - max-width: 66.666667%; - } - .col-lg-9 { - -webkit-box-flex: 0; - -ms-flex: 0 0 75%; - flex: 0 0 75%; - max-width: 75%; - } - .col-lg-10 { - -webkit-box-flex: 0; - -ms-flex: 0 0 83.333333%; - flex: 0 0 83.333333%; - max-width: 83.333333%; - } - .col-lg-11 { - -webkit-box-flex: 0; - -ms-flex: 0 0 91.666667%; - flex: 0 0 91.666667%; - max-width: 91.666667%; - } - .col-lg-12 { - -webkit-box-flex: 0; - -ms-flex: 0 0 100%; - flex: 0 0 100%; - max-width: 100%; - } - .order-lg-first { - -webkit-box-ordinal-group: 0; - -ms-flex-order: -1; - order: -1; - } - .order-lg-last { - -webkit-box-ordinal-group: 14; - -ms-flex-order: 13; - order: 13; - } - .order-lg-0 { - -webkit-box-ordinal-group: 1; - -ms-flex-order: 0; - order: 0; - } - .order-lg-1 { - -webkit-box-ordinal-group: 2; - -ms-flex-order: 1; - order: 1; - } - .order-lg-2 { - -webkit-box-ordinal-group: 3; - -ms-flex-order: 2; - order: 2; - } - .order-lg-3 { - -webkit-box-ordinal-group: 4; - -ms-flex-order: 3; - order: 3; - } - .order-lg-4 { - -webkit-box-ordinal-group: 5; - -ms-flex-order: 4; - order: 4; - } - .order-lg-5 { - -webkit-box-ordinal-group: 6; - -ms-flex-order: 5; - order: 5; - } - .order-lg-6 { - -webkit-box-ordinal-group: 7; - -ms-flex-order: 6; - order: 6; - } - .order-lg-7 { - -webkit-box-ordinal-group: 8; - -ms-flex-order: 7; - order: 7; - } - .order-lg-8 { - -webkit-box-ordinal-group: 9; - -ms-flex-order: 8; - order: 8; - } - .order-lg-9 { - -webkit-box-ordinal-group: 10; - -ms-flex-order: 9; - order: 9; - } - .order-lg-10 { - -webkit-box-ordinal-group: 11; - -ms-flex-order: 10; - order: 10; - } - .order-lg-11 { - -webkit-box-ordinal-group: 12; - -ms-flex-order: 11; - order: 11; - } - .order-lg-12 { - -webkit-box-ordinal-group: 13; - -ms-flex-order: 12; - order: 12; - } - .offset-lg-0 { - margin-left: 0; - } - .offset-lg-1 { - margin-left: 8.333333%; - } - .offset-lg-2 { - margin-left: 16.666667%; - } - .offset-lg-3 { - margin-left: 25%; - } - .offset-lg-4 { - margin-left: 33.333333%; - } - .offset-lg-5 { - margin-left: 41.666667%; - } - .offset-lg-6 { - margin-left: 50%; - } - .offset-lg-7 { - margin-left: 58.333333%; - } - .offset-lg-8 { - margin-left: 66.666667%; - } - .offset-lg-9 { - margin-left: 75%; - } - .offset-lg-10 { - margin-left: 83.333333%; - } - .offset-lg-11 { - margin-left: 91.666667%; - } -} - -@media (min-width: 1200px) { - .col-xl { - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - max-width: 100%; - } - .col-xl-auto { - -webkit-box-flex: 0; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - width: auto; - max-width: none; - } - .col-xl-1 { - -webkit-box-flex: 0; - -ms-flex: 0 0 8.333333%; - flex: 0 0 8.333333%; - max-width: 8.333333%; - } - .col-xl-2 { - -webkit-box-flex: 0; - -ms-flex: 0 0 16.666667%; - flex: 0 0 16.666667%; - max-width: 16.666667%; - } - .col-xl-3 { - -webkit-box-flex: 0; - -ms-flex: 0 0 25%; - flex: 0 0 25%; - max-width: 25%; - } - .col-xl-4 { - -webkit-box-flex: 0; - -ms-flex: 0 0 33.333333%; - flex: 0 0 33.333333%; - max-width: 33.333333%; - } - .col-xl-5 { - -webkit-box-flex: 0; - -ms-flex: 0 0 41.666667%; - flex: 0 0 41.666667%; - max-width: 41.666667%; - } - .col-xl-6 { - -webkit-box-flex: 0; - -ms-flex: 0 0 50%; - flex: 0 0 50%; - max-width: 50%; - } - .col-xl-7 { - -webkit-box-flex: 0; - -ms-flex: 0 0 58.333333%; - flex: 0 0 58.333333%; - max-width: 58.333333%; - } - .col-xl-8 { - -webkit-box-flex: 0; - -ms-flex: 0 0 66.666667%; - flex: 0 0 66.666667%; - max-width: 66.666667%; - } - .col-xl-9 { - -webkit-box-flex: 0; - -ms-flex: 0 0 75%; - flex: 0 0 75%; - max-width: 75%; - } - .col-xl-10 { - -webkit-box-flex: 0; - -ms-flex: 0 0 83.333333%; - flex: 0 0 83.333333%; - max-width: 83.333333%; - } - .col-xl-11 { - -webkit-box-flex: 0; - -ms-flex: 0 0 91.666667%; - flex: 0 0 91.666667%; - max-width: 91.666667%; - } - .col-xl-12 { - -webkit-box-flex: 0; - -ms-flex: 0 0 100%; - flex: 0 0 100%; - max-width: 100%; - } - .order-xl-first { - -webkit-box-ordinal-group: 0; - -ms-flex-order: -1; - order: -1; - } - .order-xl-last { - -webkit-box-ordinal-group: 14; - -ms-flex-order: 13; - order: 13; - } - .order-xl-0 { - -webkit-box-ordinal-group: 1; - -ms-flex-order: 0; - order: 0; - } - .order-xl-1 { - -webkit-box-ordinal-group: 2; - -ms-flex-order: 1; - order: 1; - } - .order-xl-2 { - -webkit-box-ordinal-group: 3; - -ms-flex-order: 2; - order: 2; - } - .order-xl-3 { - -webkit-box-ordinal-group: 4; - -ms-flex-order: 3; - order: 3; - } - .order-xl-4 { - -webkit-box-ordinal-group: 5; - -ms-flex-order: 4; - order: 4; - } - .order-xl-5 { - -webkit-box-ordinal-group: 6; - -ms-flex-order: 5; - order: 5; - } - .order-xl-6 { - -webkit-box-ordinal-group: 7; - -ms-flex-order: 6; - order: 6; - } - .order-xl-7 { - -webkit-box-ordinal-group: 8; - -ms-flex-order: 7; - order: 7; - } - .order-xl-8 { - -webkit-box-ordinal-group: 9; - -ms-flex-order: 8; - order: 8; - } - .order-xl-9 { - -webkit-box-ordinal-group: 10; - -ms-flex-order: 9; - order: 9; - } - .order-xl-10 { - -webkit-box-ordinal-group: 11; - -ms-flex-order: 10; - order: 10; - } - .order-xl-11 { - -webkit-box-ordinal-group: 12; - -ms-flex-order: 11; - order: 11; - } - .order-xl-12 { - -webkit-box-ordinal-group: 13; - -ms-flex-order: 12; - order: 12; - } - .offset-xl-0 { - margin-left: 0; - } - .offset-xl-1 { - margin-left: 8.333333%; - } - .offset-xl-2 { - margin-left: 16.666667%; - } - .offset-xl-3 { - margin-left: 25%; - } - .offset-xl-4 { - margin-left: 33.333333%; - } - .offset-xl-5 { - margin-left: 41.666667%; - } - .offset-xl-6 { - margin-left: 50%; - } - .offset-xl-7 { - margin-left: 58.333333%; - } - .offset-xl-8 { - margin-left: 66.666667%; - } - .offset-xl-9 { - margin-left: 75%; - } - .offset-xl-10 { - margin-left: 83.333333%; - } - .offset-xl-11 { - margin-left: 91.666667%; - } -} - -.table { - width: 100%; - max-width: 100%; - margin-bottom: 1rem; - background-color: transparent; -} - -.table th, -.table td { - padding: 0.75rem; - vertical-align: top; - border-top: 1px solid #dee2e6; -} - -.table thead th { - vertical-align: bottom; - border-bottom: 2px solid #dee2e6; -} - -.table tbody + tbody { - border-top: 2px solid #dee2e6; -} - -.table .table { - background-color: #fff; -} - -.table-sm th, -.table-sm td { - padding: 0.3rem; -} - -.table-bordered { - border: 1px solid #dee2e6; -} - -.table-bordered th, -.table-bordered td { - border: 1px solid #dee2e6; -} - -.table-bordered thead th, -.table-bordered thead td { - border-bottom-width: 2px; -} - -.table-striped tbody tr:nth-of-type(odd) { - background-color: rgba(0, 0, 0, 0.05); -} - -.table-hover tbody tr:hover { - background-color: rgba(0, 0, 0, 0.075); -} - -.table-primary, -.table-primary > th, -.table-primary > td { - background-color: #b8daff; -} - -.table-hover .table-primary:hover { - background-color: #9fcdff; -} - -.table-hover .table-primary:hover > td, -.table-hover .table-primary:hover > th { - background-color: #9fcdff; -} - -.table-secondary, -.table-secondary > th, -.table-secondary > td { - background-color: #d6d8db; -} - -.table-hover .table-secondary:hover { - background-color: #c8cbcf; -} - -.table-hover .table-secondary:hover > td, -.table-hover .table-secondary:hover > th { - background-color: #c8cbcf; -} - -.table-success, -.table-success > th, -.table-success > td { - background-color: #c3e6cb; -} - -.table-hover .table-success:hover { - background-color: #b1dfbb; -} - -.table-hover .table-success:hover > td, -.table-hover .table-success:hover > th { - background-color: #b1dfbb; -} - -.table-info, -.table-info > th, -.table-info > td { - background-color: #bee5eb; -} - -.table-hover .table-info:hover { - background-color: #abdde5; -} - -.table-hover .table-info:hover > td, -.table-hover .table-info:hover > th { - background-color: #abdde5; -} - -.table-warning, -.table-warning > th, -.table-warning > td { - background-color: #ffeeba; -} - -.table-hover .table-warning:hover { - background-color: #ffe8a1; -} - -.table-hover .table-warning:hover > td, -.table-hover .table-warning:hover > th { - background-color: #ffe8a1; -} - -.table-danger, -.table-danger > th, -.table-danger > td { - background-color: #f5c6cb; -} - -.table-hover .table-danger:hover { - background-color: #f1b0b7; -} - -.table-hover .table-danger:hover > td, -.table-hover .table-danger:hover > th { - background-color: #f1b0b7; -} - -.table-light, -.table-light > th, -.table-light > td { - background-color: #fdfdfe; -} - -.table-hover .table-light:hover { - background-color: #ececf6; -} - -.table-hover .table-light:hover > td, -.table-hover .table-light:hover > th { - background-color: #ececf6; -} - -.table-dark, -.table-dark > th, -.table-dark > td { - background-color: #c6c8ca; -} - -.table-hover .table-dark:hover { - background-color: #b9bbbe; -} - -.table-hover .table-dark:hover > td, -.table-hover .table-dark:hover > th { - background-color: #b9bbbe; -} - -.table-active, -.table-active > th, -.table-active > td { - background-color: rgba(0, 0, 0, 0.075); -} - -.table-hover .table-active:hover { - background-color: rgba(0, 0, 0, 0.075); -} - -.table-hover .table-active:hover > td, -.table-hover .table-active:hover > th { - background-color: rgba(0, 0, 0, 0.075); -} - -.table .thead-dark th { - color: #fff; - background-color: #212529; - border-color: #32383e; -} - -.table .thead-light th { - color: #495057; - background-color: #e9ecef; - border-color: #dee2e6; -} - -.table-dark { - color: #fff; - background-color: #212529; -} - -.table-dark th, -.table-dark td, -.table-dark thead th { - border-color: #32383e; -} - -.table-dark.table-bordered { - border: 0; -} - -.table-dark.table-striped tbody tr:nth-of-type(odd) { - background-color: rgba(255, 255, 255, 0.05); -} - -.table-dark.table-hover tbody tr:hover { - background-color: rgba(255, 255, 255, 0.075); -} - -@media (max-width: 575.98px) { - .table-responsive-sm { - display: block; - width: 100%; - overflow-x: auto; - -webkit-overflow-scrolling: touch; - -ms-overflow-style: -ms-autohiding-scrollbar; - } - .table-responsive-sm > .table-bordered { - border: 0; - } -} - -@media (max-width: 767.98px) { - .table-responsive-md { - display: block; - width: 100%; - overflow-x: auto; - -webkit-overflow-scrolling: touch; - -ms-overflow-style: -ms-autohiding-scrollbar; - } - .table-responsive-md > .table-bordered { - border: 0; - } -} - -@media (max-width: 991.98px) { - .table-responsive-lg { - display: block; - width: 100%; - overflow-x: auto; - -webkit-overflow-scrolling: touch; - -ms-overflow-style: -ms-autohiding-scrollbar; - } - .table-responsive-lg > .table-bordered { - border: 0; - } -} - -@media (max-width: 1199.98px) { - .table-responsive-xl { - display: block; - width: 100%; - overflow-x: auto; - -webkit-overflow-scrolling: touch; - -ms-overflow-style: -ms-autohiding-scrollbar; - } - .table-responsive-xl > .table-bordered { - border: 0; - } -} - -.table-responsive { - display: block; - width: 100%; - overflow-x: auto; - -webkit-overflow-scrolling: touch; - -ms-overflow-style: -ms-autohiding-scrollbar; -} - -.table-responsive > .table-bordered { - border: 0; -} - -.form-control { - display: block; - width: 100%; - padding: 0.375rem 0.75rem; - font-size: 1rem; - line-height: 1.5; - color: #495057; - background-color: #fff; - background-clip: padding-box; - border: 1px solid #ced4da; - border-radius: 0.25rem; - transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; -} - -.form-control::-ms-expand { - background-color: transparent; - border: 0; -} - -.form-control:focus { - color: #495057; - background-color: #fff; - border-color: #80bdff; - outline: 0; - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); -} - -.form-control::-webkit-input-placeholder { - color: #6c757d; - opacity: 1; -} - -.form-control::-moz-placeholder { - color: #6c757d; - opacity: 1; -} - -.form-control:-ms-input-placeholder { - color: #6c757d; - opacity: 1; -} - -.form-control::-ms-input-placeholder { - color: #6c757d; - opacity: 1; -} - -.form-control::placeholder { - color: #6c757d; - opacity: 1; -} - -.form-control:disabled, .form-control[readonly] { - background-color: #e9ecef; - opacity: 1; -} - -select.form-control:not([size]):not([multiple]) { - height: calc(2.25rem + 2px); -} - -select.form-control:focus::-ms-value { - color: #495057; - background-color: #fff; -} - -.form-control-file, -.form-control-range { - display: block; - width: 100%; -} - -.col-form-label { - padding-top: calc(0.375rem + 1px); - padding-bottom: calc(0.375rem + 1px); - margin-bottom: 0; - font-size: inherit; - line-height: 1.5; -} - -.col-form-label-lg { - padding-top: calc(0.5rem + 1px); - padding-bottom: calc(0.5rem + 1px); - font-size: 1.25rem; - line-height: 1.5; -} - -.col-form-label-sm { - padding-top: calc(0.25rem + 1px); - padding-bottom: calc(0.25rem + 1px); - font-size: 0.875rem; - line-height: 1.5; -} - -.form-control-plaintext { - display: block; - width: 100%; - padding-top: 0.375rem; - padding-bottom: 0.375rem; - margin-bottom: 0; - line-height: 1.5; - background-color: transparent; - border: solid transparent; - border-width: 1px 0; -} - -.form-control-plaintext.form-control-sm, .input-group-sm > .form-control-plaintext.form-control, -.input-group-sm > .input-group-prepend > .form-control-plaintext.input-group-text, -.input-group-sm > .input-group-append > .form-control-plaintext.input-group-text, -.input-group-sm > .input-group-prepend > .form-control-plaintext.btn, -.input-group-sm > .input-group-append > .form-control-plaintext.btn, .form-control-plaintext.form-control-lg, .input-group-lg > .form-control-plaintext.form-control, -.input-group-lg > .input-group-prepend > .form-control-plaintext.input-group-text, -.input-group-lg > .input-group-append > .form-control-plaintext.input-group-text, -.input-group-lg > .input-group-prepend > .form-control-plaintext.btn, -.input-group-lg > .input-group-append > .form-control-plaintext.btn { - padding-right: 0; - padding-left: 0; -} - -.form-control-sm, .input-group-sm > .form-control, -.input-group-sm > .input-group-prepend > .input-group-text, -.input-group-sm > .input-group-append > .input-group-text, -.input-group-sm > .input-group-prepend > .btn, -.input-group-sm > .input-group-append > .btn { - padding: 0.25rem 0.5rem; - font-size: 0.875rem; - line-height: 1.5; - border-radius: 0.2rem; -} - -select.form-control-sm:not([size]):not([multiple]), .input-group-sm > select.form-control:not([size]):not([multiple]), -.input-group-sm > .input-group-prepend > select.input-group-text:not([size]):not([multiple]), -.input-group-sm > .input-group-append > select.input-group-text:not([size]):not([multiple]), -.input-group-sm > .input-group-prepend > select.btn:not([size]):not([multiple]), -.input-group-sm > .input-group-append > select.btn:not([size]):not([multiple]) { - height: calc(1.8125rem + 2px); -} - -.form-control-lg, .input-group-lg > .form-control, -.input-group-lg > .input-group-prepend > .input-group-text, -.input-group-lg > .input-group-append > .input-group-text, -.input-group-lg > .input-group-prepend > .btn, -.input-group-lg > .input-group-append > .btn { - padding: 0.5rem 1rem; - font-size: 1.25rem; - line-height: 1.5; - border-radius: 0.3rem; -} - -select.form-control-lg:not([size]):not([multiple]), .input-group-lg > select.form-control:not([size]):not([multiple]), -.input-group-lg > .input-group-prepend > select.input-group-text:not([size]):not([multiple]), -.input-group-lg > .input-group-append > select.input-group-text:not([size]):not([multiple]), -.input-group-lg > .input-group-prepend > select.btn:not([size]):not([multiple]), -.input-group-lg > .input-group-append > select.btn:not([size]):not([multiple]) { - height: calc(2.875rem + 2px); -} - -.form-group { - margin-bottom: 1rem; -} - -.form-text { - display: block; - margin-top: 0.25rem; -} - -.form-row { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - margin-right: -5px; - margin-left: -5px; -} - -.form-row > .col, -.form-row > [class*="col-"] { - padding-right: 5px; - padding-left: 5px; -} - -.form-check { - position: relative; - display: block; - padding-left: 1.25rem; -} - -.form-check-input { - position: absolute; - margin-top: 0.3rem; - margin-left: -1.25rem; -} - -.form-check-input:disabled ~ .form-check-label { - color: #6c757d; -} - -.form-check-label { - margin-bottom: 0; -} - -.form-check-inline { - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - padding-left: 0; - margin-right: 0.75rem; -} - -.form-check-inline .form-check-input { - position: static; - margin-top: 0; - margin-right: 0.3125rem; - margin-left: 0; -} - -.valid-feedback { - display: none; - width: 100%; - margin-top: 0.25rem; - font-size: 80%; - color: #28a745; -} - -.valid-tooltip { - position: absolute; - top: 100%; - z-index: 5; - display: none; - max-width: 100%; - padding: .5rem; - margin-top: .1rem; - font-size: .875rem; - line-height: 1; - color: #fff; - background-color: rgba(40, 167, 69, 0.8); - border-radius: .2rem; -} - -.was-validated .form-control:valid, .form-control.is-valid, .was-validated -.custom-select:valid, -.custom-select.is-valid { - border-color: #28a745; -} - -.was-validated .form-control:valid:focus, .form-control.is-valid:focus, .was-validated -.custom-select:valid:focus, -.custom-select.is-valid:focus { - border-color: #28a745; - box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25); -} - -.was-validated .form-control:valid ~ .valid-feedback, -.was-validated .form-control:valid ~ .valid-tooltip, .form-control.is-valid ~ .valid-feedback, -.form-control.is-valid ~ .valid-tooltip, .was-validated -.custom-select:valid ~ .valid-feedback, -.was-validated -.custom-select:valid ~ .valid-tooltip, -.custom-select.is-valid ~ .valid-feedback, -.custom-select.is-valid ~ .valid-tooltip { - display: block; -} - -.was-validated .form-check-input:valid ~ .form-check-label, .form-check-input.is-valid ~ .form-check-label { - color: #28a745; -} - -.was-validated .form-check-input:valid ~ .valid-feedback, -.was-validated .form-check-input:valid ~ .valid-tooltip, .form-check-input.is-valid ~ .valid-feedback, -.form-check-input.is-valid ~ .valid-tooltip { - display: block; -} - -.was-validated .custom-control-input:valid ~ .custom-control-label, .custom-control-input.is-valid ~ .custom-control-label { - color: #28a745; -} - -.was-validated .custom-control-input:valid ~ .custom-control-label::before, .custom-control-input.is-valid ~ .custom-control-label::before { - background-color: #71dd8a; -} - -.was-validated .custom-control-input:valid ~ .valid-feedback, -.was-validated .custom-control-input:valid ~ .valid-tooltip, .custom-control-input.is-valid ~ .valid-feedback, -.custom-control-input.is-valid ~ .valid-tooltip { - display: block; -} - -.was-validated .custom-control-input:valid:checked ~ .custom-control-label::before, .custom-control-input.is-valid:checked ~ .custom-control-label::before { - background-color: #34ce57; -} - -.was-validated .custom-control-input:valid:focus ~ .custom-control-label::before, .custom-control-input.is-valid:focus ~ .custom-control-label::before { - box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(40, 167, 69, 0.25); -} - -.was-validated .custom-file-input:valid ~ .custom-file-label, .custom-file-input.is-valid ~ .custom-file-label { - border-color: #28a745; -} - -.was-validated .custom-file-input:valid ~ .custom-file-label::before, .custom-file-input.is-valid ~ .custom-file-label::before { - border-color: inherit; -} - -.was-validated .custom-file-input:valid ~ .valid-feedback, -.was-validated .custom-file-input:valid ~ .valid-tooltip, .custom-file-input.is-valid ~ .valid-feedback, -.custom-file-input.is-valid ~ .valid-tooltip { - display: block; -} - -.was-validated .custom-file-input:valid:focus ~ .custom-file-label, .custom-file-input.is-valid:focus ~ .custom-file-label { - box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25); -} - -.invalid-feedback { - display: none; - width: 100%; - margin-top: 0.25rem; - font-size: 80%; - color: #dc3545; -} - -.invalid-tooltip { - position: absolute; - top: 100%; - z-index: 5; - display: none; - max-width: 100%; - padding: .5rem; - margin-top: .1rem; - font-size: .875rem; - line-height: 1; - color: #fff; - background-color: rgba(220, 53, 69, 0.8); - border-radius: .2rem; -} - -.was-validated .form-control:invalid, .form-control.is-invalid, .was-validated -.custom-select:invalid, -.custom-select.is-invalid { - border-color: #dc3545; -} - -.was-validated .form-control:invalid:focus, .form-control.is-invalid:focus, .was-validated -.custom-select:invalid:focus, -.custom-select.is-invalid:focus { - border-color: #dc3545; - box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25); -} - -.was-validated .form-control:invalid ~ .invalid-feedback, -.was-validated .form-control:invalid ~ .invalid-tooltip, .form-control.is-invalid ~ .invalid-feedback, -.form-control.is-invalid ~ .invalid-tooltip, .was-validated -.custom-select:invalid ~ .invalid-feedback, -.was-validated -.custom-select:invalid ~ .invalid-tooltip, -.custom-select.is-invalid ~ .invalid-feedback, -.custom-select.is-invalid ~ .invalid-tooltip { - display: block; -} - -.was-validated .form-check-input:invalid ~ .form-check-label, .form-check-input.is-invalid ~ .form-check-label { - color: #dc3545; -} - -.was-validated .form-check-input:invalid ~ .invalid-feedback, -.was-validated .form-check-input:invalid ~ .invalid-tooltip, .form-check-input.is-invalid ~ .invalid-feedback, -.form-check-input.is-invalid ~ .invalid-tooltip { - display: block; -} - -.was-validated .custom-control-input:invalid ~ .custom-control-label, .custom-control-input.is-invalid ~ .custom-control-label { - color: #dc3545; -} - -.was-validated .custom-control-input:invalid ~ .custom-control-label::before, .custom-control-input.is-invalid ~ .custom-control-label::before { - background-color: #efa2a9; -} - -.was-validated .custom-control-input:invalid ~ .invalid-feedback, -.was-validated .custom-control-input:invalid ~ .invalid-tooltip, .custom-control-input.is-invalid ~ .invalid-feedback, -.custom-control-input.is-invalid ~ .invalid-tooltip { - display: block; -} - -.was-validated .custom-control-input:invalid:checked ~ .custom-control-label::before, .custom-control-input.is-invalid:checked ~ .custom-control-label::before { - background-color: #e4606d; -} - -.was-validated .custom-control-input:invalid:focus ~ .custom-control-label::before, .custom-control-input.is-invalid:focus ~ .custom-control-label::before { - box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(220, 53, 69, 0.25); -} - -.was-validated .custom-file-input:invalid ~ .custom-file-label, .custom-file-input.is-invalid ~ .custom-file-label { - border-color: #dc3545; -} - -.was-validated .custom-file-input:invalid ~ .custom-file-label::before, .custom-file-input.is-invalid ~ .custom-file-label::before { - border-color: inherit; -} - -.was-validated .custom-file-input:invalid ~ .invalid-feedback, -.was-validated .custom-file-input:invalid ~ .invalid-tooltip, .custom-file-input.is-invalid ~ .invalid-feedback, -.custom-file-input.is-invalid ~ .invalid-tooltip { - display: block; -} - -.was-validated .custom-file-input:invalid:focus ~ .custom-file-label, .custom-file-input.is-invalid:focus ~ .custom-file-label { - box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25); -} - -.form-inline { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-flow: row wrap; - flex-flow: row wrap; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - -.form-inline .form-check { - width: 100%; -} - -@media (min-width: 576px) { - .form-inline label { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - margin-bottom: 0; - } - .form-inline .form-group { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-flex: 0; - -ms-flex: 0 0 auto; - flex: 0 0 auto; - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-flow: row wrap; - flex-flow: row wrap; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - margin-bottom: 0; - } - .form-inline .form-control { - display: inline-block; - width: auto; - vertical-align: middle; - } - .form-inline .form-control-plaintext { - display: inline-block; - } - .form-inline .input-group { - width: auto; - } - .form-inline .form-check { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - width: auto; - padding-left: 0; - } - .form-inline .form-check-input { - position: relative; - margin-top: 0; - margin-right: 0.25rem; - margin-left: 0; - } - .form-inline .custom-control { - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - } - .form-inline .custom-control-label { - margin-bottom: 0; - } -} - -.btn { - display: inline-block; - font-weight: 400; - text-align: center; - white-space: nowrap; - vertical-align: middle; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - border: 1px solid transparent; - padding: 0.375rem 0.75rem; - font-size: 1rem; - line-height: 1.5; - border-radius: 0.25rem; - transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; -} - -.btn:hover, .btn:focus { - text-decoration: none; -} - -.btn:focus, .btn.focus { - outline: 0; - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); -} - -.btn.disabled, .btn:disabled { - opacity: 0.65; -} - -.btn:not(:disabled):not(.disabled) { - cursor: pointer; -} - -.btn:not(:disabled):not(.disabled):active, .btn:not(:disabled):not(.disabled).active { - background-image: none; -} - -a.btn.disabled, -fieldset:disabled a.btn { - pointer-events: none; -} - -.btn-primary { - color: #fff; - background-color: #007bff; - border-color: #007bff; -} - -.btn-primary:hover { - color: #fff; - background-color: #0069d9; - border-color: #0062cc; -} - -.btn-primary:focus, .btn-primary.focus { - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); -} - -.btn-primary.disabled, .btn-primary:disabled { - color: #fff; - background-color: #007bff; - border-color: #007bff; -} - -.btn-primary:not(:disabled):not(.disabled):active, .btn-primary:not(:disabled):not(.disabled).active, -.show > .btn-primary.dropdown-toggle { - color: #fff; - background-color: #0062cc; - border-color: #005cbf; -} - -.btn-primary:not(:disabled):not(.disabled):active:focus, .btn-primary:not(:disabled):not(.disabled).active:focus, -.show > .btn-primary.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); -} - -.btn-secondary { - color: #fff; - background-color: #6c757d; - border-color: #6c757d; -} - -.btn-secondary:hover { - color: #fff; - background-color: #5a6268; - border-color: #545b62; -} - -.btn-secondary:focus, .btn-secondary.focus { - box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); -} - -.btn-secondary.disabled, .btn-secondary:disabled { - color: #fff; - background-color: #6c757d; - border-color: #6c757d; -} - -.btn-secondary:not(:disabled):not(.disabled):active, .btn-secondary:not(:disabled):not(.disabled).active, -.show > .btn-secondary.dropdown-toggle { - color: #fff; - background-color: #545b62; - border-color: #4e555b; -} - -.btn-secondary:not(:disabled):not(.disabled):active:focus, .btn-secondary:not(:disabled):not(.disabled).active:focus, -.show > .btn-secondary.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); -} - -.btn-success { - color: #fff; - background-color: #28a745; - border-color: #28a745; -} - -.btn-success:hover { - color: #fff; - background-color: #218838; - border-color: #1e7e34; -} - -.btn-success:focus, .btn-success.focus { - box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5); -} - -.btn-success.disabled, .btn-success:disabled { - color: #fff; - background-color: #28a745; - border-color: #28a745; -} - -.btn-success:not(:disabled):not(.disabled):active, .btn-success:not(:disabled):not(.disabled).active, -.show > .btn-success.dropdown-toggle { - color: #fff; - background-color: #1e7e34; - border-color: #1c7430; -} - -.btn-success:not(:disabled):not(.disabled):active:focus, .btn-success:not(:disabled):not(.disabled).active:focus, -.show > .btn-success.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5); -} - -.btn-info { - color: #fff; - background-color: #17a2b8; - border-color: #17a2b8; -} - -.btn-info:hover { - color: #fff; - background-color: #138496; - border-color: #117a8b; -} - -.btn-info:focus, .btn-info.focus { - box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5); -} - -.btn-info.disabled, .btn-info:disabled { - color: #fff; - background-color: #17a2b8; - border-color: #17a2b8; -} - -.btn-info:not(:disabled):not(.disabled):active, .btn-info:not(:disabled):not(.disabled).active, -.show > .btn-info.dropdown-toggle { - color: #fff; - background-color: #117a8b; - border-color: #10707f; -} - -.btn-info:not(:disabled):not(.disabled):active:focus, .btn-info:not(:disabled):not(.disabled).active:focus, -.show > .btn-info.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5); -} - -.btn-warning { - color: #212529; - background-color: #ffc107; - border-color: #ffc107; -} - -.btn-warning:hover { - color: #212529; - background-color: #e0a800; - border-color: #d39e00; -} - -.btn-warning:focus, .btn-warning.focus { - box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5); -} - -.btn-warning.disabled, .btn-warning:disabled { - color: #212529; - background-color: #ffc107; - border-color: #ffc107; -} - -.btn-warning:not(:disabled):not(.disabled):active, .btn-warning:not(:disabled):not(.disabled).active, -.show > .btn-warning.dropdown-toggle { - color: #212529; - background-color: #d39e00; - border-color: #c69500; -} - -.btn-warning:not(:disabled):not(.disabled):active:focus, .btn-warning:not(:disabled):not(.disabled).active:focus, -.show > .btn-warning.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5); -} - -.btn-danger { - color: #fff; - background-color: #dc3545; - border-color: #dc3545; -} - -.btn-danger:hover { - color: #fff; - background-color: #c82333; - border-color: #bd2130; -} - -.btn-danger:focus, .btn-danger.focus { - box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); -} - -.btn-danger.disabled, .btn-danger:disabled { - color: #fff; - background-color: #dc3545; - border-color: #dc3545; -} - -.btn-danger:not(:disabled):not(.disabled):active, .btn-danger:not(:disabled):not(.disabled).active, -.show > .btn-danger.dropdown-toggle { - color: #fff; - background-color: #bd2130; - border-color: #b21f2d; -} - -.btn-danger:not(:disabled):not(.disabled):active:focus, .btn-danger:not(:disabled):not(.disabled).active:focus, -.show > .btn-danger.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); -} - -.btn-light { - color: #212529; - background-color: #f8f9fa; - border-color: #f8f9fa; -} - -.btn-light:hover { - color: #212529; - background-color: #e2e6ea; - border-color: #dae0e5; -} - -.btn-light:focus, .btn-light.focus { - box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5); -} - -.btn-light.disabled, .btn-light:disabled { - color: #212529; - background-color: #f8f9fa; - border-color: #f8f9fa; -} - -.btn-light:not(:disabled):not(.disabled):active, .btn-light:not(:disabled):not(.disabled).active, -.show > .btn-light.dropdown-toggle { - color: #212529; - background-color: #dae0e5; - border-color: #d3d9df; -} - -.btn-light:not(:disabled):not(.disabled):active:focus, .btn-light:not(:disabled):not(.disabled).active:focus, -.show > .btn-light.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5); -} - -.btn-dark { - color: #fff; - background-color: #343a40; - border-color: #343a40; -} - -.btn-dark:hover { - color: #fff; - background-color: #23272b; - border-color: #1d2124; -} - -.btn-dark:focus, .btn-dark.focus { - box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5); -} - -.btn-dark.disabled, .btn-dark:disabled { - color: #fff; - background-color: #343a40; - border-color: #343a40; -} - -.btn-dark:not(:disabled):not(.disabled):active, .btn-dark:not(:disabled):not(.disabled).active, -.show > .btn-dark.dropdown-toggle { - color: #fff; - background-color: #1d2124; - border-color: #171a1d; -} - -.btn-dark:not(:disabled):not(.disabled):active:focus, .btn-dark:not(:disabled):not(.disabled).active:focus, -.show > .btn-dark.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5); -} - -.btn-outline-primary { - color: #007bff; - background-color: transparent; - background-image: none; - border-color: #007bff; -} - -.btn-outline-primary:hover { - color: #fff; - background-color: #007bff; - border-color: #007bff; -} - -.btn-outline-primary:focus, .btn-outline-primary.focus { - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); -} - -.btn-outline-primary.disabled, .btn-outline-primary:disabled { - color: #007bff; - background-color: transparent; -} - -.btn-outline-primary:not(:disabled):not(.disabled):active, .btn-outline-primary:not(:disabled):not(.disabled).active, -.show > .btn-outline-primary.dropdown-toggle { - color: #fff; - background-color: #007bff; - border-color: #007bff; -} - -.btn-outline-primary:not(:disabled):not(.disabled):active:focus, .btn-outline-primary:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-primary.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); -} - -.btn-outline-secondary { - color: #6c757d; - background-color: transparent; - background-image: none; - border-color: #6c757d; -} - -.btn-outline-secondary:hover { - color: #fff; - background-color: #6c757d; - border-color: #6c757d; -} - -.btn-outline-secondary:focus, .btn-outline-secondary.focus { - box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); -} - -.btn-outline-secondary.disabled, .btn-outline-secondary:disabled { - color: #6c757d; - background-color: transparent; -} - -.btn-outline-secondary:not(:disabled):not(.disabled):active, .btn-outline-secondary:not(:disabled):not(.disabled).active, -.show > .btn-outline-secondary.dropdown-toggle { - color: #fff; - background-color: #6c757d; - border-color: #6c757d; -} - -.btn-outline-secondary:not(:disabled):not(.disabled):active:focus, .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-secondary.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); -} - -.btn-outline-success { - color: #28a745; - background-color: transparent; - background-image: none; - border-color: #28a745; -} - -.btn-outline-success:hover { - color: #fff; - background-color: #28a745; - border-color: #28a745; -} - -.btn-outline-success:focus, .btn-outline-success.focus { - box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5); -} - -.btn-outline-success.disabled, .btn-outline-success:disabled { - color: #28a745; - background-color: transparent; -} - -.btn-outline-success:not(:disabled):not(.disabled):active, .btn-outline-success:not(:disabled):not(.disabled).active, -.show > .btn-outline-success.dropdown-toggle { - color: #fff; - background-color: #28a745; - border-color: #28a745; -} - -.btn-outline-success:not(:disabled):not(.disabled):active:focus, .btn-outline-success:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-success.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5); -} - -.btn-outline-info { - color: #17a2b8; - background-color: transparent; - background-image: none; - border-color: #17a2b8; -} - -.btn-outline-info:hover { - color: #fff; - background-color: #17a2b8; - border-color: #17a2b8; -} - -.btn-outline-info:focus, .btn-outline-info.focus { - box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5); -} - -.btn-outline-info.disabled, .btn-outline-info:disabled { - color: #17a2b8; - background-color: transparent; -} - -.btn-outline-info:not(:disabled):not(.disabled):active, .btn-outline-info:not(:disabled):not(.disabled).active, -.show > .btn-outline-info.dropdown-toggle { - color: #fff; - background-color: #17a2b8; - border-color: #17a2b8; -} - -.btn-outline-info:not(:disabled):not(.disabled):active:focus, .btn-outline-info:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-info.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5); -} - -.btn-outline-warning { - color: #ffc107; - background-color: transparent; - background-image: none; - border-color: #ffc107; -} - -.btn-outline-warning:hover { - color: #212529; - background-color: #ffc107; - border-color: #ffc107; -} - -.btn-outline-warning:focus, .btn-outline-warning.focus { - box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5); -} - -.btn-outline-warning.disabled, .btn-outline-warning:disabled { - color: #ffc107; - background-color: transparent; -} - -.btn-outline-warning:not(:disabled):not(.disabled):active, .btn-outline-warning:not(:disabled):not(.disabled).active, -.show > .btn-outline-warning.dropdown-toggle { - color: #212529; - background-color: #ffc107; - border-color: #ffc107; -} - -.btn-outline-warning:not(:disabled):not(.disabled):active:focus, .btn-outline-warning:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-warning.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5); -} - -.btn-outline-danger { - color: #dc3545; - background-color: transparent; - background-image: none; - border-color: #dc3545; -} - -.btn-outline-danger:hover { - color: #fff; - background-color: #dc3545; - border-color: #dc3545; -} - -.btn-outline-danger:focus, .btn-outline-danger.focus { - box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); -} - -.btn-outline-danger.disabled, .btn-outline-danger:disabled { - color: #dc3545; - background-color: transparent; -} - -.btn-outline-danger:not(:disabled):not(.disabled):active, .btn-outline-danger:not(:disabled):not(.disabled).active, -.show > .btn-outline-danger.dropdown-toggle { - color: #fff; - background-color: #dc3545; - border-color: #dc3545; -} - -.btn-outline-danger:not(:disabled):not(.disabled):active:focus, .btn-outline-danger:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-danger.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); -} - -.btn-outline-light { - color: #f8f9fa; - background-color: transparent; - background-image: none; - border-color: #f8f9fa; -} - -.btn-outline-light:hover { - color: #212529; - background-color: #f8f9fa; - border-color: #f8f9fa; -} - -.btn-outline-light:focus, .btn-outline-light.focus { - box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5); -} - -.btn-outline-light.disabled, .btn-outline-light:disabled { - color: #f8f9fa; - background-color: transparent; -} - -.btn-outline-light:not(:disabled):not(.disabled):active, .btn-outline-light:not(:disabled):not(.disabled).active, -.show > .btn-outline-light.dropdown-toggle { - color: #212529; - background-color: #f8f9fa; - border-color: #f8f9fa; -} - -.btn-outline-light:not(:disabled):not(.disabled):active:focus, .btn-outline-light:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-light.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5); -} - -.btn-outline-dark { - color: #343a40; - background-color: transparent; - background-image: none; - border-color: #343a40; -} - -.btn-outline-dark:hover { - color: #fff; - background-color: #343a40; - border-color: #343a40; -} - -.btn-outline-dark:focus, .btn-outline-dark.focus { - box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5); -} - -.btn-outline-dark.disabled, .btn-outline-dark:disabled { - color: #343a40; - background-color: transparent; -} - -.btn-outline-dark:not(:disabled):not(.disabled):active, .btn-outline-dark:not(:disabled):not(.disabled).active, -.show > .btn-outline-dark.dropdown-toggle { - color: #fff; - background-color: #343a40; - border-color: #343a40; -} - -.btn-outline-dark:not(:disabled):not(.disabled):active:focus, .btn-outline-dark:not(:disabled):not(.disabled).active:focus, -.show > .btn-outline-dark.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5); -} - -.btn-link { - font-weight: 400; - color: #007bff; - background-color: transparent; -} - -.btn-link:hover { - color: #0056b3; - text-decoration: underline; - background-color: transparent; - border-color: transparent; -} - -.btn-link:focus, .btn-link.focus { - text-decoration: underline; - border-color: transparent; - box-shadow: none; -} - -.btn-link:disabled, .btn-link.disabled { - color: #6c757d; -} - -.btn-lg, .btn-group-lg > .btn { - padding: 0.5rem 1rem; - font-size: 1.25rem; - line-height: 1.5; - border-radius: 0.3rem; -} - -.btn-sm, .btn-group-sm > .btn { - padding: 0.25rem 0.5rem; - font-size: 0.875rem; - line-height: 1.5; - border-radius: 0.2rem; -} - -.btn-block { - display: block; - width: 100%; -} - -.btn-block + .btn-block { - margin-top: 0.5rem; -} - -input[type="submit"].btn-block, -input[type="reset"].btn-block, -input[type="button"].btn-block { - width: 100%; -} - -.fade { - opacity: 0; - transition: opacity 0.15s linear; -} - -.fade.show { - opacity: 1; -} - -.collapse { - display: none; -} - -.collapse.show { - display: block; -} - -tr.collapse.show { - display: table-row; -} - -tbody.collapse.show { - display: table-row-group; -} - -.collapsing { - position: relative; - height: 0; - overflow: hidden; - transition: height 0.35s ease; -} - -.dropup, -.dropdown { - position: relative; -} - -.dropdown-toggle::after { - display: inline-block; - width: 0; - height: 0; - margin-left: 0.255em; - vertical-align: 0.255em; - content: ""; - border-top: 0.3em solid; - border-right: 0.3em solid transparent; - border-bottom: 0; - border-left: 0.3em solid transparent; -} - -.dropdown-toggle:empty::after { - margin-left: 0; -} - -.dropdown-menu { - position: absolute; - top: 100%; - left: 0; - z-index: 1000; - display: none; - float: left; - min-width: 10rem; - padding: 0.5rem 0; - margin: 0.125rem 0 0; - font-size: 1rem; - color: #212529; - text-align: left; - list-style: none; - background-color: #fff; - background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, 0.15); - border-radius: 0.25rem; -} - -.dropup .dropdown-menu { - margin-top: 0; - margin-bottom: 0.125rem; -} - -.dropup .dropdown-toggle::after { - display: inline-block; - width: 0; - height: 0; - margin-left: 0.255em; - vertical-align: 0.255em; - content: ""; - border-top: 0; - border-right: 0.3em solid transparent; - border-bottom: 0.3em solid; - border-left: 0.3em solid transparent; -} - -.dropup .dropdown-toggle:empty::after { - margin-left: 0; -} - -.dropright .dropdown-menu { - margin-top: 0; - margin-left: 0.125rem; -} - -.dropright .dropdown-toggle::after { - display: inline-block; - width: 0; - height: 0; - margin-left: 0.255em; - vertical-align: 0.255em; - content: ""; - border-top: 0.3em solid transparent; - border-bottom: 0.3em solid transparent; - border-left: 0.3em solid; -} - -.dropright .dropdown-toggle:empty::after { - margin-left: 0; -} - -.dropright .dropdown-toggle::after { - vertical-align: 0; -} - -.dropleft .dropdown-menu { - margin-top: 0; - margin-right: 0.125rem; -} - -.dropleft .dropdown-toggle::after { - display: inline-block; - width: 0; - height: 0; - margin-left: 0.255em; - vertical-align: 0.255em; - content: ""; -} - -.dropleft .dropdown-toggle::after { - display: none; -} - -.dropleft .dropdown-toggle::before { - display: inline-block; - width: 0; - height: 0; - margin-right: 0.255em; - vertical-align: 0.255em; - content: ""; - border-top: 0.3em solid transparent; - border-right: 0.3em solid; - border-bottom: 0.3em solid transparent; -} - -.dropleft .dropdown-toggle:empty::after { - margin-left: 0; -} - -.dropleft .dropdown-toggle::before { - vertical-align: 0; -} - -.dropdown-divider { - height: 0; - margin: 0.5rem 0; - overflow: hidden; - border-top: 1px solid #e9ecef; -} - -.dropdown-item { - display: block; - width: 100%; - padding: 0.25rem 1.5rem; - clear: both; - font-weight: 400; - color: #212529; - text-align: inherit; - white-space: nowrap; - background-color: transparent; - border: 0; -} - -.dropdown-item:hover, .dropdown-item:focus { - color: #16181b; - text-decoration: none; - background-color: #f8f9fa; -} - -.dropdown-item.active, .dropdown-item:active { - color: #fff; - text-decoration: none; - background-color: #007bff; -} - -.dropdown-item.disabled, .dropdown-item:disabled { - color: #6c757d; - background-color: transparent; -} - -.dropdown-menu.show { - display: block; -} - -.dropdown-header { - display: block; - padding: 0.5rem 1.5rem; - margin-bottom: 0; - font-size: 0.875rem; - color: #6c757d; - white-space: nowrap; -} - -.btn-group, -.btn-group-vertical { - position: relative; - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - vertical-align: middle; -} - -.btn-group > .btn, -.btn-group-vertical > .btn { - position: relative; - -webkit-box-flex: 0; - -ms-flex: 0 1 auto; - flex: 0 1 auto; -} - -.btn-group > .btn:hover, -.btn-group-vertical > .btn:hover { - z-index: 1; -} - -.btn-group > .btn:focus, .btn-group > .btn:active, .btn-group > .btn.active, -.btn-group-vertical > .btn:focus, -.btn-group-vertical > .btn:active, -.btn-group-vertical > .btn.active { - z-index: 1; -} - -.btn-group .btn + .btn, -.btn-group .btn + .btn-group, -.btn-group .btn-group + .btn, -.btn-group .btn-group + .btn-group, -.btn-group-vertical .btn + .btn, -.btn-group-vertical .btn + .btn-group, -.btn-group-vertical .btn-group + .btn, -.btn-group-vertical .btn-group + .btn-group { - margin-left: -1px; -} - -.btn-toolbar { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; -} - -.btn-toolbar .input-group { - width: auto; -} - -.btn-group > .btn:first-child { - margin-left: 0; -} - -.btn-group > .btn:not(:last-child):not(.dropdown-toggle), -.btn-group > .btn-group:not(:last-child) > .btn { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} - -.btn-group > .btn:not(:first-child), -.btn-group > .btn-group:not(:first-child) > .btn { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} - -.dropdown-toggle-split { - padding-right: 0.5625rem; - padding-left: 0.5625rem; -} - -.dropdown-toggle-split::after { - margin-left: 0; -} - -.btn-sm + .dropdown-toggle-split, .btn-group-sm > .btn + .dropdown-toggle-split { - padding-right: 0.375rem; - padding-left: 0.375rem; -} - -.btn-lg + .dropdown-toggle-split, .btn-group-lg > .btn + .dropdown-toggle-split { - padding-right: 0.75rem; - padding-left: 0.75rem; -} - -.btn-group-vertical { - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; - -webkit-box-align: start; - -ms-flex-align: start; - align-items: flex-start; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; -} - -.btn-group-vertical .btn, -.btn-group-vertical .btn-group { - width: 100%; -} - -.btn-group-vertical > .btn + .btn, -.btn-group-vertical > .btn + .btn-group, -.btn-group-vertical > .btn-group + .btn, -.btn-group-vertical > .btn-group + .btn-group { - margin-top: -1px; - margin-left: 0; -} - -.btn-group-vertical > .btn:not(:last-child):not(.dropdown-toggle), -.btn-group-vertical > .btn-group:not(:last-child) > .btn { - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; -} - -.btn-group-vertical > .btn:not(:first-child), -.btn-group-vertical > .btn-group:not(:first-child) > .btn { - border-top-left-radius: 0; - border-top-right-radius: 0; -} - -.btn-group-toggle > .btn, -.btn-group-toggle > .btn-group > .btn { - margin-bottom: 0; -} - -.btn-group-toggle > .btn input[type="radio"], -.btn-group-toggle > .btn input[type="checkbox"], -.btn-group-toggle > .btn-group > .btn input[type="radio"], -.btn-group-toggle > .btn-group > .btn input[type="checkbox"] { - position: absolute; - clip: rect(0, 0, 0, 0); - pointer-events: none; -} - -.input-group { - position: relative; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - -webkit-box-align: stretch; - -ms-flex-align: stretch; - align-items: stretch; - width: 100%; -} - -.input-group > .form-control, -.input-group > .custom-select, -.input-group > .custom-file { - position: relative; - -webkit-box-flex: 1; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - width: 1%; - margin-bottom: 0; -} - -.input-group > .form-control:focus, -.input-group > .custom-select:focus, -.input-group > .custom-file:focus { - z-index: 3; -} - -.input-group > .form-control + .form-control, -.input-group > .form-control + .custom-select, -.input-group > .form-control + .custom-file, -.input-group > .custom-select + .form-control, -.input-group > .custom-select + .custom-select, -.input-group > .custom-select + .custom-file, -.input-group > .custom-file + .form-control, -.input-group > .custom-file + .custom-select, -.input-group > .custom-file + .custom-file { - margin-left: -1px; -} - -.input-group > .form-control:not(:last-child), -.input-group > .custom-select:not(:last-child) { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} - -.input-group > .form-control:not(:first-child), -.input-group > .custom-select:not(:first-child) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} - -.input-group > .custom-file { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - -.input-group > .custom-file:not(:last-child) .custom-file-label, -.input-group > .custom-file:not(:last-child) .custom-file-label::before { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} - -.input-group > .custom-file:not(:first-child) .custom-file-label, -.input-group > .custom-file:not(:first-child) .custom-file-label::before { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} - -.input-group-prepend, -.input-group-append { - display: -webkit-box; - display: -ms-flexbox; - display: flex; -} - -.input-group-prepend .btn, -.input-group-append .btn { - position: relative; - z-index: 2; -} - -.input-group-prepend .btn + .btn, -.input-group-prepend .btn + .input-group-text, -.input-group-prepend .input-group-text + .input-group-text, -.input-group-prepend .input-group-text + .btn, -.input-group-append .btn + .btn, -.input-group-append .btn + .input-group-text, -.input-group-append .input-group-text + .input-group-text, -.input-group-append .input-group-text + .btn { - margin-left: -1px; -} - -.input-group-prepend { - margin-right: -1px; -} - -.input-group-append { - margin-left: -1px; -} - -.input-group-text { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - padding: 0.375rem 0.75rem; - margin-bottom: 0; - font-size: 1rem; - font-weight: 400; - line-height: 1.5; - color: #495057; - text-align: center; - white-space: nowrap; - background-color: #e9ecef; - border: 1px solid #ced4da; - border-radius: 0.25rem; -} - -.input-group-text input[type="radio"], -.input-group-text input[type="checkbox"] { - margin-top: 0; -} - -.input-group > .input-group-prepend > .btn, -.input-group > .input-group-prepend > .input-group-text, -.input-group > .input-group-append:not(:last-child) > .btn, -.input-group > .input-group-append:not(:last-child) > .input-group-text, -.input-group > .input-group-append:last-child > .btn:not(:last-child):not(.dropdown-toggle), -.input-group > .input-group-append:last-child > .input-group-text:not(:last-child) { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} - -.input-group > .input-group-append > .btn, -.input-group > .input-group-append > .input-group-text, -.input-group > .input-group-prepend:not(:first-child) > .btn, -.input-group > .input-group-prepend:not(:first-child) > .input-group-text, -.input-group > .input-group-prepend:first-child > .btn:not(:first-child), -.input-group > .input-group-prepend:first-child > .input-group-text:not(:first-child) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} - -.custom-control { - position: relative; - display: block; - min-height: 1.5rem; - padding-left: 1.5rem; -} - -.custom-control-inline { - display: -webkit-inline-box; - display: -ms-inline-flexbox; - display: inline-flex; - margin-right: 1rem; -} - -.custom-control-input { - position: absolute; - z-index: -1; - opacity: 0; -} - -.custom-control-input:checked ~ .custom-control-label::before { - color: #fff; - background-color: #007bff; -} - -.custom-control-input:focus ~ .custom-control-label::before { - box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25); -} - -.custom-control-input:active ~ .custom-control-label::before { - color: #fff; - background-color: #b3d7ff; -} - -.custom-control-input:disabled ~ .custom-control-label { - color: #6c757d; -} - -.custom-control-input:disabled ~ .custom-control-label::before { - background-color: #e9ecef; -} - -.custom-control-label { - margin-bottom: 0; -} - -.custom-control-label::before { - position: absolute; - top: 0.25rem; - left: 0; - display: block; - width: 1rem; - height: 1rem; - pointer-events: none; - content: ""; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - background-color: #dee2e6; -} - -.custom-control-label::after { - position: absolute; - top: 0.25rem; - left: 0; - display: block; - width: 1rem; - height: 1rem; - content: ""; - background-repeat: no-repeat; - background-position: center center; - background-size: 50% 50%; -} - -.custom-checkbox .custom-control-label::before { - border-radius: 0.25rem; -} - -.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before { - background-color: #007bff; -} - -.custom-checkbox .custom-control-input:checked ~ .custom-control-label::after { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3E%3C/svg%3E"); -} - -.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::before { - background-color: #007bff; -} - -.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::after { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3E%3Cpath stroke='%23fff' d='M0 2h4'/%3E%3C/svg%3E"); -} - -.custom-checkbox .custom-control-input:disabled:checked ~ .custom-control-label::before { - background-color: rgba(0, 123, 255, 0.5); -} - -.custom-checkbox .custom-control-input:disabled:indeterminate ~ .custom-control-label::before { - background-color: rgba(0, 123, 255, 0.5); -} - -.custom-radio .custom-control-label::before { - border-radius: 50%; -} - -.custom-radio .custom-control-input:checked ~ .custom-control-label::before { - background-color: #007bff; -} - -.custom-radio .custom-control-input:checked ~ .custom-control-label::after { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E"); -} - -.custom-radio .custom-control-input:disabled:checked ~ .custom-control-label::before { - background-color: rgba(0, 123, 255, 0.5); -} - -.custom-select { - display: inline-block; - width: 100%; - height: calc(2.25rem + 2px); - padding: 0.375rem 1.75rem 0.375rem 0.75rem; - line-height: 1.5; - color: #495057; - vertical-align: middle; - background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right 0.75rem center; - background-size: 8px 10px; - border: 1px solid #ced4da; - border-radius: 0.25rem; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; -} - -.custom-select:focus { - border-color: #80bdff; - outline: 0; - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075), 0 0 5px rgba(128, 189, 255, 0.5); -} - -.custom-select:focus::-ms-value { - color: #495057; - background-color: #fff; -} - -.custom-select[multiple], .custom-select[size]:not([size="1"]) { - height: auto; - padding-right: 0.75rem; - background-image: none; -} - -.custom-select:disabled { - color: #6c757d; - background-color: #e9ecef; -} - -.custom-select::-ms-expand { - opacity: 0; -} - -.custom-select-sm { - height: calc(1.8125rem + 2px); - padding-top: 0.375rem; - padding-bottom: 0.375rem; - font-size: 75%; -} - -.custom-select-lg { - height: calc(2.875rem + 2px); - padding-top: 0.375rem; - padding-bottom: 0.375rem; - font-size: 125%; -} - -.custom-file { - position: relative; - display: inline-block; - width: 100%; - height: calc(2.25rem + 2px); - margin-bottom: 0; -} - -.custom-file-input { - position: relative; - z-index: 2; - width: 100%; - height: calc(2.25rem + 2px); - margin: 0; - opacity: 0; -} - -.custom-file-input:focus ~ .custom-file-control { - border-color: #80bdff; - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); -} - -.custom-file-input:focus ~ .custom-file-control::before { - border-color: #80bdff; -} - -.custom-file-input:lang(en) ~ .custom-file-label::after { - content: "Browse"; -} - -.custom-file-label { - position: absolute; - top: 0; - right: 0; - left: 0; - z-index: 1; - height: calc(2.25rem + 2px); - padding: 0.375rem 0.75rem; - line-height: 1.5; - color: #495057; - background-color: #fff; - border: 1px solid #ced4da; - border-radius: 0.25rem; -} - -.custom-file-label::after { - position: absolute; - top: 0; - right: 0; - bottom: 0; - z-index: 3; - display: block; - height: calc(calc(2.25rem + 2px) - 1px * 2); - padding: 0.375rem 0.75rem; - line-height: 1.5; - color: #495057; - content: "Browse"; - background-color: #e9ecef; - border-left: 1px solid #ced4da; - border-radius: 0 0.25rem 0.25rem 0; -} - -.nav { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - padding-left: 0; - margin-bottom: 0; - list-style: none; -} - -.nav-link { - display: block; - padding: 0.5rem 1rem; -} - -.nav-link:hover, .nav-link:focus { - text-decoration: none; -} - -.nav-link.disabled { - color: #6c757d; -} - -.nav-tabs { - border-bottom: 1px solid #dee2e6; -} - -.nav-tabs .nav-item { - margin-bottom: -1px; -} - -.nav-tabs .nav-link { - border: 1px solid transparent; - border-top-left-radius: 0.25rem; - border-top-right-radius: 0.25rem; -} - -.nav-tabs .nav-link:hover, .nav-tabs .nav-link:focus { - border-color: #e9ecef #e9ecef #dee2e6; -} - -.nav-tabs .nav-link.disabled { - color: #6c757d; - background-color: transparent; - border-color: transparent; -} - -.nav-tabs .nav-link.active, -.nav-tabs .nav-item.show .nav-link { - color: #495057; - background-color: #fff; - border-color: #dee2e6 #dee2e6 #fff; -} - -.nav-tabs .dropdown-menu { - margin-top: -1px; - border-top-left-radius: 0; - border-top-right-radius: 0; -} - -.nav-pills .nav-link { - border-radius: 0.25rem; -} - -.nav-pills .nav-link.active, -.nav-pills .show > .nav-link { - color: #fff; - background-color: #007bff; -} - -.nav-fill .nav-item { - -webkit-box-flex: 1; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - text-align: center; -} - -.nav-justified .nav-item { - -ms-flex-preferred-size: 0; - flex-basis: 0; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - text-align: center; -} - -.tab-content > .tab-pane { - display: none; -} - -.tab-content > .active { - display: block; -} - -.navbar { - position: relative; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; - padding: 0.5rem 1rem; -} - -.navbar > .container, -.navbar > .container-fluid { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; -} - -.navbar-brand { - display: inline-block; - padding-top: 0.3125rem; - padding-bottom: 0.3125rem; - margin-right: 1rem; - font-size: 1.25rem; - line-height: inherit; - white-space: nowrap; -} - -.navbar-brand:hover, .navbar-brand:focus { - text-decoration: none; -} - -.navbar-nav { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; - padding-left: 0; - margin-bottom: 0; - list-style: none; -} - -.navbar-nav .nav-link { - padding-right: 0; - padding-left: 0; -} - -.navbar-nav .dropdown-menu { - position: static; - float: none; -} - -.navbar-text { - display: inline-block; - padding-top: 0.5rem; - padding-bottom: 0.5rem; -} - -.navbar-collapse { - -ms-flex-preferred-size: 100%; - flex-basis: 100%; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - -.navbar-toggler { - padding: 0.25rem 0.75rem; - font-size: 1.25rem; - line-height: 1; - background-color: transparent; - border: 1px solid transparent; - border-radius: 0.25rem; -} - -.navbar-toggler:hover, .navbar-toggler:focus { - text-decoration: none; -} - -.navbar-toggler:not(:disabled):not(.disabled) { - cursor: pointer; -} - -.navbar-toggler-icon { - display: inline-block; - width: 1.5em; - height: 1.5em; - vertical-align: middle; - content: ""; - background: no-repeat center center; - background-size: 100% 100%; -} - -@media (max-width: 575.98px) { - .navbar-expand-sm > .container, - .navbar-expand-sm > .container-fluid { - padding-right: 0; - padding-left: 0; - } -} - -@media (min-width: 576px) { - .navbar-expand-sm { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-flow: row nowrap; - flex-flow: row nowrap; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - } - .navbar-expand-sm .navbar-nav { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; - flex-direction: row; - } - .navbar-expand-sm .navbar-nav .dropdown-menu { - position: absolute; - } - .navbar-expand-sm .navbar-nav .dropdown-menu-right { - right: 0; - left: auto; - } - .navbar-expand-sm .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; - } - .navbar-expand-sm > .container, - .navbar-expand-sm > .container-fluid { - -ms-flex-wrap: nowrap; - flex-wrap: nowrap; - } - .navbar-expand-sm .navbar-collapse { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - -ms-flex-preferred-size: auto; - flex-basis: auto; - } - .navbar-expand-sm .navbar-toggler { - display: none; - } - .navbar-expand-sm .dropup .dropdown-menu { - top: auto; - bottom: 100%; - } -} - -@media (max-width: 767.98px) { - .navbar-expand-md > .container, - .navbar-expand-md > .container-fluid { - padding-right: 0; - padding-left: 0; - } -} - -@media (min-width: 768px) { - .navbar-expand-md { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-flow: row nowrap; - flex-flow: row nowrap; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - } - .navbar-expand-md .navbar-nav { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; - flex-direction: row; - } - .navbar-expand-md .navbar-nav .dropdown-menu { - position: absolute; - } - .navbar-expand-md .navbar-nav .dropdown-menu-right { - right: 0; - left: auto; - } - .navbar-expand-md .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; - } - .navbar-expand-md > .container, - .navbar-expand-md > .container-fluid { - -ms-flex-wrap: nowrap; - flex-wrap: nowrap; - } - .navbar-expand-md .navbar-collapse { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - -ms-flex-preferred-size: auto; - flex-basis: auto; - } - .navbar-expand-md .navbar-toggler { - display: none; - } - .navbar-expand-md .dropup .dropdown-menu { - top: auto; - bottom: 100%; - } -} - -@media (max-width: 991.98px) { - .navbar-expand-lg > .container, - .navbar-expand-lg > .container-fluid { - padding-right: 0; - padding-left: 0; - } -} - -@media (min-width: 992px) { - .navbar-expand-lg { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-flow: row nowrap; - flex-flow: row nowrap; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - } - .navbar-expand-lg .navbar-nav { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; - flex-direction: row; - } - .navbar-expand-lg .navbar-nav .dropdown-menu { - position: absolute; - } - .navbar-expand-lg .navbar-nav .dropdown-menu-right { - right: 0; - left: auto; - } - .navbar-expand-lg .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; - } - .navbar-expand-lg > .container, - .navbar-expand-lg > .container-fluid { - -ms-flex-wrap: nowrap; - flex-wrap: nowrap; - } - .navbar-expand-lg .navbar-collapse { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - -ms-flex-preferred-size: auto; - flex-basis: auto; - } - .navbar-expand-lg .navbar-toggler { - display: none; - } - .navbar-expand-lg .dropup .dropdown-menu { - top: auto; - bottom: 100%; - } -} - -@media (max-width: 1199.98px) { - .navbar-expand-xl > .container, - .navbar-expand-xl > .container-fluid { - padding-right: 0; - padding-left: 0; - } -} - -@media (min-width: 1200px) { - .navbar-expand-xl { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-flow: row nowrap; - flex-flow: row nowrap; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - } - .navbar-expand-xl .navbar-nav { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; - flex-direction: row; - } - .navbar-expand-xl .navbar-nav .dropdown-menu { - position: absolute; - } - .navbar-expand-xl .navbar-nav .dropdown-menu-right { - right: 0; - left: auto; - } - .navbar-expand-xl .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; - } - .navbar-expand-xl > .container, - .navbar-expand-xl > .container-fluid { - -ms-flex-wrap: nowrap; - flex-wrap: nowrap; - } - .navbar-expand-xl .navbar-collapse { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - -ms-flex-preferred-size: auto; - flex-basis: auto; - } - .navbar-expand-xl .navbar-toggler { - display: none; - } - .navbar-expand-xl .dropup .dropdown-menu { - top: auto; - bottom: 100%; - } -} - -.navbar-expand { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-flow: row nowrap; - flex-flow: row nowrap; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; -} - -.navbar-expand > .container, -.navbar-expand > .container-fluid { - padding-right: 0; - padding-left: 0; -} - -.navbar-expand .navbar-nav { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; - flex-direction: row; -} - -.navbar-expand .navbar-nav .dropdown-menu { - position: absolute; -} - -.navbar-expand .navbar-nav .dropdown-menu-right { - right: 0; - left: auto; -} - -.navbar-expand .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; -} - -.navbar-expand > .container, -.navbar-expand > .container-fluid { - -ms-flex-wrap: nowrap; - flex-wrap: nowrap; -} - -.navbar-expand .navbar-collapse { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - -ms-flex-preferred-size: auto; - flex-basis: auto; -} - -.navbar-expand .navbar-toggler { - display: none; -} - -.navbar-expand .dropup .dropdown-menu { - top: auto; - bottom: 100%; -} - -.navbar-light .navbar-brand { - color: rgba(0, 0, 0, 0.9); -} - -.navbar-light .navbar-brand:hover, .navbar-light .navbar-brand:focus { - color: rgba(0, 0, 0, 0.9); -} - -.navbar-light .navbar-nav .nav-link { - color: rgba(0, 0, 0, 0.5); -} - -.navbar-light .navbar-nav .nav-link:hover, .navbar-light .navbar-nav .nav-link:focus { - color: rgba(0, 0, 0, 0.7); -} - -.navbar-light .navbar-nav .nav-link.disabled { - color: rgba(0, 0, 0, 0.3); -} - -.navbar-light .navbar-nav .show > .nav-link, -.navbar-light .navbar-nav .active > .nav-link, -.navbar-light .navbar-nav .nav-link.show, -.navbar-light .navbar-nav .nav-link.active { - color: rgba(0, 0, 0, 0.9); -} - -.navbar-light .navbar-toggler { - color: rgba(0, 0, 0, 0.5); - border-color: rgba(0, 0, 0, 0.1); -} - -.navbar-light .navbar-toggler-icon { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E"); -} - -.navbar-light .navbar-text { - color: rgba(0, 0, 0, 0.5); -} - -.navbar-light .navbar-text a { - color: rgba(0, 0, 0, 0.9); -} - -.navbar-light .navbar-text a:hover, .navbar-light .navbar-text a:focus { - color: rgba(0, 0, 0, 0.9); -} - -.navbar-dark .navbar-brand { - color: #fff; -} - -.navbar-dark .navbar-brand:hover, .navbar-dark .navbar-brand:focus { - color: #fff; -} - -.navbar-dark .navbar-nav .nav-link { - color: rgba(255, 255, 255, 0.5); -} - -.navbar-dark .navbar-nav .nav-link:hover, .navbar-dark .navbar-nav .nav-link:focus { - color: rgba(255, 255, 255, 0.75); -} - -.navbar-dark .navbar-nav .nav-link.disabled { - color: rgba(255, 255, 255, 0.25); -} - -.navbar-dark .navbar-nav .show > .nav-link, -.navbar-dark .navbar-nav .active > .nav-link, -.navbar-dark .navbar-nav .nav-link.show, -.navbar-dark .navbar-nav .nav-link.active { - color: #fff; -} - -.navbar-dark .navbar-toggler { - color: rgba(255, 255, 255, 0.5); - border-color: rgba(255, 255, 255, 0.1); -} - -.navbar-dark .navbar-toggler-icon { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E"); -} - -.navbar-dark .navbar-text { - color: rgba(255, 255, 255, 0.5); -} - -.navbar-dark .navbar-text a { - color: #fff; -} - -.navbar-dark .navbar-text a:hover, .navbar-dark .navbar-text a:focus { - color: #fff; -} - -.card { - position: relative; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; - min-width: 0; - word-wrap: break-word; - background-color: #fff; - background-clip: border-box; - border: 1px solid rgba(0, 0, 0, 0.125); - border-radius: 0.25rem; -} - -.card > hr { - margin-right: 0; - margin-left: 0; -} - -.card > .list-group:first-child .list-group-item:first-child { - border-top-left-radius: 0.25rem; - border-top-right-radius: 0.25rem; -} - -.card > .list-group:last-child .list-group-item:last-child { - border-bottom-right-radius: 0.25rem; - border-bottom-left-radius: 0.25rem; -} - -.card-body { - -webkit-box-flex: 1; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - padding: 1.25rem; -} - -.card-title { - margin-bottom: 0.75rem; -} - -.card-subtitle { - margin-top: -0.375rem; - margin-bottom: 0; -} - -.card-text:last-child { - margin-bottom: 0; -} - -.card-link:hover { - text-decoration: none; -} - -.card-link + .card-link { - margin-left: 1.25rem; -} - -.card-header { - padding: 0.75rem 1.25rem; - margin-bottom: 0; - background-color: rgba(0, 0, 0, 0.03); - border-bottom: 1px solid rgba(0, 0, 0, 0.125); -} - -.card-header:first-child { - border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0; -} - -.card-header + .list-group .list-group-item:first-child { - border-top: 0; -} - -.card-footer { - padding: 0.75rem 1.25rem; - background-color: rgba(0, 0, 0, 0.03); - border-top: 1px solid rgba(0, 0, 0, 0.125); -} - -.card-footer:last-child { - border-radius: 0 0 calc(0.25rem - 1px) calc(0.25rem - 1px); -} - -.card-header-tabs { - margin-right: -0.625rem; - margin-bottom: -0.75rem; - margin-left: -0.625rem; - border-bottom: 0; -} - -.card-header-pills { - margin-right: -0.625rem; - margin-left: -0.625rem; -} - -.card-img-overlay { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - padding: 1.25rem; -} - -.card-img { - width: 100%; - border-radius: calc(0.25rem - 1px); -} - -.card-img-top { - width: 100%; - border-top-left-radius: calc(0.25rem - 1px); - border-top-right-radius: calc(0.25rem - 1px); -} - -.card-img-bottom { - width: 100%; - border-bottom-right-radius: calc(0.25rem - 1px); - border-bottom-left-radius: calc(0.25rem - 1px); -} - -.card-deck { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; -} - -.card-deck .card { - margin-bottom: 15px; -} - -@media (min-width: 576px) { - .card-deck { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-flow: row wrap; - flex-flow: row wrap; - margin-right: -15px; - margin-left: -15px; - } - .card-deck .card { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-flex: 1; - -ms-flex: 1 0 0%; - flex: 1 0 0%; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; - margin-right: 15px; - margin-bottom: 0; - margin-left: 15px; - } -} - -.card-group { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; -} - -.card-group > .card { - margin-bottom: 15px; -} - -@media (min-width: 576px) { - .card-group { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-flow: row wrap; - flex-flow: row wrap; - } - .card-group > .card { - -webkit-box-flex: 1; - -ms-flex: 1 0 0%; - flex: 1 0 0%; - margin-bottom: 0; - } - .card-group > .card + .card { - margin-left: 0; - border-left: 0; - } - .card-group > .card:first-child { - border-top-right-radius: 0; - border-bottom-right-radius: 0; - } - .card-group > .card:first-child .card-img-top, - .card-group > .card:first-child .card-header { - border-top-right-radius: 0; - } - .card-group > .card:first-child .card-img-bottom, - .card-group > .card:first-child .card-footer { - border-bottom-right-radius: 0; - } - .card-group > .card:last-child { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - } - .card-group > .card:last-child .card-img-top, - .card-group > .card:last-child .card-header { - border-top-left-radius: 0; - } - .card-group > .card:last-child .card-img-bottom, - .card-group > .card:last-child .card-footer { - border-bottom-left-radius: 0; - } - .card-group > .card:only-child { - border-radius: 0.25rem; - } - .card-group > .card:only-child .card-img-top, - .card-group > .card:only-child .card-header { - border-top-left-radius: 0.25rem; - border-top-right-radius: 0.25rem; - } - .card-group > .card:only-child .card-img-bottom, - .card-group > .card:only-child .card-footer { - border-bottom-right-radius: 0.25rem; - border-bottom-left-radius: 0.25rem; - } - .card-group > .card:not(:first-child):not(:last-child):not(:only-child) { - border-radius: 0; - } - .card-group > .card:not(:first-child):not(:last-child):not(:only-child) .card-img-top, - .card-group > .card:not(:first-child):not(:last-child):not(:only-child) .card-img-bottom, - .card-group > .card:not(:first-child):not(:last-child):not(:only-child) .card-header, - .card-group > .card:not(:first-child):not(:last-child):not(:only-child) .card-footer { - border-radius: 0; - } -} - -.card-columns .card { - margin-bottom: 0.75rem; -} - -@media (min-width: 576px) { - .card-columns { - -webkit-column-count: 3; - -moz-column-count: 3; - column-count: 3; - -webkit-column-gap: 1.25rem; - -moz-column-gap: 1.25rem; - column-gap: 1.25rem; - } - .card-columns .card { - display: inline-block; - width: 100%; - } -} - -.breadcrumb { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - padding: 0.75rem 1rem; - margin-bottom: 1rem; - list-style: none; - background-color: #e9ecef; - border-radius: 0.25rem; -} - -.breadcrumb-item + .breadcrumb-item::before { - display: inline-block; - padding-right: 0.5rem; - padding-left: 0.5rem; - color: #6c757d; - content: "/"; -} - -.breadcrumb-item + .breadcrumb-item:hover::before { - text-decoration: underline; -} - -.breadcrumb-item + .breadcrumb-item:hover::before { - text-decoration: none; -} - -.breadcrumb-item.active { - color: #6c757d; -} - -.pagination { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - padding-left: 0; - list-style: none; - border-radius: 0.25rem; -} - -.page-link { - position: relative; - display: block; - padding: 0.5rem 0.75rem; - margin-left: -1px; - line-height: 1.25; - color: #007bff; - background-color: #fff; - border: 1px solid #dee2e6; -} - -.page-link:hover { - color: #0056b3; - text-decoration: none; - background-color: #e9ecef; - border-color: #dee2e6; -} - -.page-link:focus { - z-index: 2; - outline: 0; - box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); -} - -.page-link:not(:disabled):not(.disabled) { - cursor: pointer; -} - -.page-item:first-child .page-link { - margin-left: 0; - border-top-left-radius: 0.25rem; - border-bottom-left-radius: 0.25rem; -} - -.page-item:last-child .page-link { - border-top-right-radius: 0.25rem; - border-bottom-right-radius: 0.25rem; -} - -.page-item.active .page-link { - z-index: 1; - color: #fff; - background-color: #007bff; - border-color: #007bff; -} - -.page-item.disabled .page-link { - color: #6c757d; - pointer-events: none; - cursor: auto; - background-color: #fff; - border-color: #dee2e6; -} - -.pagination-lg .page-link { - padding: 0.75rem 1.5rem; - font-size: 1.25rem; - line-height: 1.5; -} - -.pagination-lg .page-item:first-child .page-link { - border-top-left-radius: 0.3rem; - border-bottom-left-radius: 0.3rem; -} - -.pagination-lg .page-item:last-child .page-link { - border-top-right-radius: 0.3rem; - border-bottom-right-radius: 0.3rem; -} - -.pagination-sm .page-link { - padding: 0.25rem 0.5rem; - font-size: 0.875rem; - line-height: 1.5; -} - -.pagination-sm .page-item:first-child .page-link { - border-top-left-radius: 0.2rem; - border-bottom-left-radius: 0.2rem; -} - -.pagination-sm .page-item:last-child .page-link { - border-top-right-radius: 0.2rem; - border-bottom-right-radius: 0.2rem; -} - -.badge { - display: inline-block; - padding: 0.25em 0.4em; - font-size: 75%; - font-weight: 700; - line-height: 1; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - border-radius: 0.25rem; -} - -.badge:empty { - display: none; -} - -.btn .badge { - position: relative; - top: -1px; -} - -.badge-pill { - padding-right: 0.6em; - padding-left: 0.6em; - border-radius: 10rem; -} - -.badge-primary { - color: #fff; - background-color: #007bff; -} - -.badge-primary[href]:hover, .badge-primary[href]:focus { - color: #fff; - text-decoration: none; - background-color: #0062cc; -} - -.badge-secondary { - color: #fff; - background-color: #6c757d; -} - -.badge-secondary[href]:hover, .badge-secondary[href]:focus { - color: #fff; - text-decoration: none; - background-color: #545b62; -} - -.badge-success { - color: #fff; - background-color: #28a745; -} - -.badge-success[href]:hover, .badge-success[href]:focus { - color: #fff; - text-decoration: none; - background-color: #1e7e34; -} - -.badge-info { - color: #fff; - background-color: #17a2b8; -} - -.badge-info[href]:hover, .badge-info[href]:focus { - color: #fff; - text-decoration: none; - background-color: #117a8b; -} - -.badge-warning { - color: #212529; - background-color: #ffc107; -} - -.badge-warning[href]:hover, .badge-warning[href]:focus { - color: #212529; - text-decoration: none; - background-color: #d39e00; -} - -.badge-danger { - color: #fff; - background-color: #dc3545; -} - -.badge-danger[href]:hover, .badge-danger[href]:focus { - color: #fff; - text-decoration: none; - background-color: #bd2130; -} - -.badge-light { - color: #212529; - background-color: #f8f9fa; -} - -.badge-light[href]:hover, .badge-light[href]:focus { - color: #212529; - text-decoration: none; - background-color: #dae0e5; -} - -.badge-dark { - color: #fff; - background-color: #343a40; -} - -.badge-dark[href]:hover, .badge-dark[href]:focus { - color: #fff; - text-decoration: none; - background-color: #1d2124; -} - -.jumbotron { - padding: 2rem 1rem; - margin-bottom: 2rem; - background-color: #e9ecef; - border-radius: 0.3rem; -} - -@media (min-width: 576px) { - .jumbotron { - padding: 4rem 2rem; - } -} - -.jumbotron-fluid { - padding-right: 0; - padding-left: 0; - border-radius: 0; -} - -.alert { - position: relative; - padding: 0.75rem 1.25rem; - margin-bottom: 1rem; - border: 1px solid transparent; - border-radius: 0.25rem; -} - -.alert-heading { - color: inherit; -} - -.alert-link { - font-weight: 700; -} - -.alert-dismissible { - padding-right: 4rem; -} - -.alert-dismissible .close { - position: absolute; - top: 0; - right: 0; - padding: 0.75rem 1.25rem; - color: inherit; -} - -.alert-primary { - color: #004085; - background-color: #cce5ff; - border-color: #b8daff; -} - -.alert-primary hr { - border-top-color: #9fcdff; -} - -.alert-primary .alert-link { - color: #002752; -} - -.alert-secondary { - color: #383d41; - background-color: #e2e3e5; - border-color: #d6d8db; -} - -.alert-secondary hr { - border-top-color: #c8cbcf; -} - -.alert-secondary .alert-link { - color: #202326; -} - -.alert-success { - color: #155724; - background-color: #d4edda; - border-color: #c3e6cb; -} - -.alert-success hr { - border-top-color: #b1dfbb; -} - -.alert-success .alert-link { - color: #0b2e13; -} - -.alert-info { - color: #0c5460; - background-color: #d1ecf1; - border-color: #bee5eb; -} - -.alert-info hr { - border-top-color: #abdde5; -} - -.alert-info .alert-link { - color: #062c33; -} - -.alert-warning { - color: #856404; - background-color: #fff3cd; - border-color: #ffeeba; -} - -.alert-warning hr { - border-top-color: #ffe8a1; -} - -.alert-warning .alert-link { - color: #533f03; -} - -.alert-danger { - color: #721c24; - background-color: #f8d7da; - border-color: #f5c6cb; -} - -.alert-danger hr { - border-top-color: #f1b0b7; -} - -.alert-danger .alert-link { - color: #491217; -} - -.alert-light { - color: #818182; - background-color: #fefefe; - border-color: #fdfdfe; -} - -.alert-light hr { - border-top-color: #ececf6; -} - -.alert-light .alert-link { - color: #686868; -} - -.alert-dark { - color: #1b1e21; - background-color: #d6d8d9; - border-color: #c6c8ca; -} - -.alert-dark hr { - border-top-color: #b9bbbe; -} - -.alert-dark .alert-link { - color: #040505; -} - -@-webkit-keyframes progress-bar-stripes { - from { - background-position: 1rem 0; - } - to { - background-position: 0 0; - } -} - -@keyframes progress-bar-stripes { - from { - background-position: 1rem 0; - } - to { - background-position: 0 0; - } -} - -.progress { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - height: 1rem; - overflow: hidden; - font-size: 0.75rem; - background-color: #e9ecef; - border-radius: 0.25rem; -} - -.progress-bar { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - color: #fff; - text-align: center; - background-color: #007bff; - transition: width 0.6s ease; -} - -.progress-bar-striped { - background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-size: 1rem 1rem; -} - -.progress-bar-animated { - -webkit-animation: progress-bar-stripes 1s linear infinite; - animation: progress-bar-stripes 1s linear infinite; -} - -.media { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: start; - -ms-flex-align: start; - align-items: flex-start; -} - -.media-body { - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1; -} - -.list-group { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; - padding-left: 0; - margin-bottom: 0; -} - -.list-group-item-action { - width: 100%; - color: #495057; - text-align: inherit; -} - -.list-group-item-action:hover, .list-group-item-action:focus { - color: #495057; - text-decoration: none; - background-color: #f8f9fa; -} - -.list-group-item-action:active { - color: #212529; - background-color: #e9ecef; -} - -.list-group-item { - position: relative; - display: block; - padding: 0.75rem 1.25rem; - margin-bottom: -1px; - background-color: #fff; - border: 1px solid rgba(0, 0, 0, 0.125); -} - -.list-group-item:first-child { - border-top-left-radius: 0.25rem; - border-top-right-radius: 0.25rem; -} - -.list-group-item:last-child { - margin-bottom: 0; - border-bottom-right-radius: 0.25rem; - border-bottom-left-radius: 0.25rem; -} - -.list-group-item:hover, .list-group-item:focus { - z-index: 1; - text-decoration: none; -} - -.list-group-item.disabled, .list-group-item:disabled { - color: #6c757d; - background-color: #fff; -} - -.list-group-item.active { - z-index: 2; - color: #fff; - background-color: #007bff; - border-color: #007bff; -} - -.list-group-flush .list-group-item { - border-right: 0; - border-left: 0; - border-radius: 0; -} - -.list-group-flush:first-child .list-group-item:first-child { - border-top: 0; -} - -.list-group-flush:last-child .list-group-item:last-child { - border-bottom: 0; -} - -.list-group-item-primary { - color: #004085; - background-color: #b8daff; -} - -.list-group-item-primary.list-group-item-action:hover, .list-group-item-primary.list-group-item-action:focus { - color: #004085; - background-color: #9fcdff; -} - -.list-group-item-primary.list-group-item-action.active { - color: #fff; - background-color: #004085; - border-color: #004085; -} - -.list-group-item-secondary { - color: #383d41; - background-color: #d6d8db; -} - -.list-group-item-secondary.list-group-item-action:hover, .list-group-item-secondary.list-group-item-action:focus { - color: #383d41; - background-color: #c8cbcf; -} - -.list-group-item-secondary.list-group-item-action.active { - color: #fff; - background-color: #383d41; - border-color: #383d41; -} - -.list-group-item-success { - color: #155724; - background-color: #c3e6cb; -} - -.list-group-item-success.list-group-item-action:hover, .list-group-item-success.list-group-item-action:focus { - color: #155724; - background-color: #b1dfbb; -} - -.list-group-item-success.list-group-item-action.active { - color: #fff; - background-color: #155724; - border-color: #155724; -} - -.list-group-item-info { - color: #0c5460; - background-color: #bee5eb; -} - -.list-group-item-info.list-group-item-action:hover, .list-group-item-info.list-group-item-action:focus { - color: #0c5460; - background-color: #abdde5; -} - -.list-group-item-info.list-group-item-action.active { - color: #fff; - background-color: #0c5460; - border-color: #0c5460; -} - -.list-group-item-warning { - color: #856404; - background-color: #ffeeba; -} - -.list-group-item-warning.list-group-item-action:hover, .list-group-item-warning.list-group-item-action:focus { - color: #856404; - background-color: #ffe8a1; -} - -.list-group-item-warning.list-group-item-action.active { - color: #fff; - background-color: #856404; - border-color: #856404; -} - -.list-group-item-danger { - color: #721c24; - background-color: #f5c6cb; -} - -.list-group-item-danger.list-group-item-action:hover, .list-group-item-danger.list-group-item-action:focus { - color: #721c24; - background-color: #f1b0b7; -} - -.list-group-item-danger.list-group-item-action.active { - color: #fff; - background-color: #721c24; - border-color: #721c24; -} - -.list-group-item-light { - color: #818182; - background-color: #fdfdfe; -} - -.list-group-item-light.list-group-item-action:hover, .list-group-item-light.list-group-item-action:focus { - color: #818182; - background-color: #ececf6; -} - -.list-group-item-light.list-group-item-action.active { - color: #fff; - background-color: #818182; - border-color: #818182; -} - -.list-group-item-dark { - color: #1b1e21; - background-color: #c6c8ca; -} - -.list-group-item-dark.list-group-item-action:hover, .list-group-item-dark.list-group-item-action:focus { - color: #1b1e21; - background-color: #b9bbbe; -} - -.list-group-item-dark.list-group-item-action.active { - color: #fff; - background-color: #1b1e21; - border-color: #1b1e21; -} - -.close { - float: right; - font-size: 1.5rem; - font-weight: 700; - line-height: 1; - color: #000; - text-shadow: 0 1px 0 #fff; - opacity: .5; -} - -.close:hover, .close:focus { - color: #000; - text-decoration: none; - opacity: .75; -} - -.close:not(:disabled):not(.disabled) { - cursor: pointer; -} - -button.close { - padding: 0; - background-color: transparent; - border: 0; - -webkit-appearance: none; -} - -.modal-open { - overflow: hidden; -} - -.modal { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1050; - display: none; - overflow: hidden; - outline: 0; -} - -.modal-open .modal { - overflow-x: hidden; - overflow-y: auto; -} - -.modal-dialog { - position: relative; - width: auto; - margin: 0.5rem; - pointer-events: none; -} - -.modal.fade .modal-dialog { - transition: -webkit-transform 0.3s ease-out; - transition: transform 0.3s ease-out; - transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out; - -webkit-transform: translate(0, -25%); - transform: translate(0, -25%); -} - -.modal.show .modal-dialog { - -webkit-transform: translate(0, 0); - transform: translate(0, 0); -} - -.modal-dialog-centered { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - min-height: calc(100% - (0.5rem * 2)); -} - -.modal-content { - position: relative; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; - width: 100%; - pointer-events: auto; - background-color: #fff; - background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 0.3rem; - outline: 0; -} - -.modal-backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1040; - background-color: #000; -} - -.modal-backdrop.fade { - opacity: 0; -} - -.modal-backdrop.show { - opacity: 0.5; -} - -.modal-header { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: start; - -ms-flex-align: start; - align-items: flex-start; - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; - padding: 1rem; - border-bottom: 1px solid #e9ecef; - border-top-left-radius: 0.3rem; - border-top-right-radius: 0.3rem; -} - -.modal-header .close { - padding: 1rem; - margin: -1rem -1rem -1rem auto; -} - -.modal-title { - margin-bottom: 0; - line-height: 1.5; -} - -.modal-body { - position: relative; - -webkit-box-flex: 1; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - padding: 1rem; -} - -.modal-footer { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; - padding: 1rem; - border-top: 1px solid #e9ecef; -} - -.modal-footer > :not(:first-child) { - margin-left: .25rem; -} - -.modal-footer > :not(:last-child) { - margin-right: .25rem; -} - -.modal-scrollbar-measure { - position: absolute; - top: -9999px; - width: 50px; - height: 50px; - overflow: scroll; -} - -@media (min-width: 576px) { - .modal-dialog { - max-width: 500px; - margin: 1.75rem auto; - } - .modal-dialog-centered { - min-height: calc(100% - (1.75rem * 2)); - } - .modal-sm { - max-width: 300px; - } -} - -@media (min-width: 992px) { - .modal-lg { - max-width: 800px; - } -} - -.tooltip { - position: absolute; - z-index: 1070; - display: block; - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; - font-style: normal; - font-weight: 400; - line-height: 1.5; - text-align: left; - text-align: start; - text-decoration: none; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - word-break: normal; - word-spacing: normal; - white-space: normal; - line-break: auto; - font-size: 0.875rem; - word-wrap: break-word; - opacity: 0; -} - -.tooltip.show { - opacity: 0.9; -} - -.tooltip .arrow { - position: absolute; - display: block; - width: 0.8rem; - height: 0.4rem; -} - -.tooltip .arrow::before { - position: absolute; - content: ""; - border-color: transparent; - border-style: solid; -} - -.bs-tooltip-top, .bs-tooltip-auto[x-placement^="top"] { - padding: 0.4rem 0; -} - -.bs-tooltip-top .arrow, .bs-tooltip-auto[x-placement^="top"] .arrow { - bottom: 0; -} - -.bs-tooltip-top .arrow::before, .bs-tooltip-auto[x-placement^="top"] .arrow::before { - top: 0; - border-width: 0.4rem 0.4rem 0; - border-top-color: #000; -} - -.bs-tooltip-right, .bs-tooltip-auto[x-placement^="right"] { - padding: 0 0.4rem; -} - -.bs-tooltip-right .arrow, .bs-tooltip-auto[x-placement^="right"] .arrow { - left: 0; - width: 0.4rem; - height: 0.8rem; -} - -.bs-tooltip-right .arrow::before, .bs-tooltip-auto[x-placement^="right"] .arrow::before { - right: 0; - border-width: 0.4rem 0.4rem 0.4rem 0; - border-right-color: #000; -} - -.bs-tooltip-bottom, .bs-tooltip-auto[x-placement^="bottom"] { - padding: 0.4rem 0; -} - -.bs-tooltip-bottom .arrow, .bs-tooltip-auto[x-placement^="bottom"] .arrow { - top: 0; -} - -.bs-tooltip-bottom .arrow::before, .bs-tooltip-auto[x-placement^="bottom"] .arrow::before { - bottom: 0; - border-width: 0 0.4rem 0.4rem; - border-bottom-color: #000; -} - -.bs-tooltip-left, .bs-tooltip-auto[x-placement^="left"] { - padding: 0 0.4rem; -} - -.bs-tooltip-left .arrow, .bs-tooltip-auto[x-placement^="left"] .arrow { - right: 0; - width: 0.4rem; - height: 0.8rem; -} - -.bs-tooltip-left .arrow::before, .bs-tooltip-auto[x-placement^="left"] .arrow::before { - left: 0; - border-width: 0.4rem 0 0.4rem 0.4rem; - border-left-color: #000; -} - -.tooltip-inner { - max-width: 200px; - padding: 0.25rem 0.5rem; - color: #fff; - text-align: center; - background-color: #000; - border-radius: 0.25rem; -} - -.popover { - position: absolute; - top: 0; - left: 0; - z-index: 1060; - display: block; - max-width: 276px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; - font-style: normal; - font-weight: 400; - line-height: 1.5; - text-align: left; - text-align: start; - text-decoration: none; - text-shadow: none; - text-transform: none; - letter-spacing: normal; - word-break: normal; - word-spacing: normal; - white-space: normal; - line-break: auto; - font-size: 0.875rem; - word-wrap: break-word; - background-color: #fff; - background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 0.3rem; -} - -.popover .arrow { - position: absolute; - display: block; - width: 1rem; - height: 0.5rem; - margin: 0 0.3rem; -} - -.popover .arrow::before, .popover .arrow::after { - position: absolute; - display: block; - content: ""; - border-color: transparent; - border-style: solid; -} - -.bs-popover-top, .bs-popover-auto[x-placement^="top"] { - margin-bottom: 0.5rem; -} - -.bs-popover-top .arrow, .bs-popover-auto[x-placement^="top"] .arrow { - bottom: calc((0.5rem + 1px) * -1); -} - -.bs-popover-top .arrow::before, .bs-popover-auto[x-placement^="top"] .arrow::before, -.bs-popover-top .arrow::after, .bs-popover-auto[x-placement^="top"] .arrow::after { - border-width: 0.5rem 0.5rem 0; -} - -.bs-popover-top .arrow::before, .bs-popover-auto[x-placement^="top"] .arrow::before { - bottom: 0; - border-top-color: rgba(0, 0, 0, 0.25); -} - -.bs-popover-top .arrow::after, .bs-popover-auto[x-placement^="top"] .arrow::after { - bottom: 1px; - border-top-color: #fff; -} - -.bs-popover-right, .bs-popover-auto[x-placement^="right"] { - margin-left: 0.5rem; -} - -.bs-popover-right .arrow, .bs-popover-auto[x-placement^="right"] .arrow { - left: calc((0.5rem + 1px) * -1); - width: 0.5rem; - height: 1rem; - margin: 0.3rem 0; -} - -.bs-popover-right .arrow::before, .bs-popover-auto[x-placement^="right"] .arrow::before, -.bs-popover-right .arrow::after, .bs-popover-auto[x-placement^="right"] .arrow::after { - border-width: 0.5rem 0.5rem 0.5rem 0; -} - -.bs-popover-right .arrow::before, .bs-popover-auto[x-placement^="right"] .arrow::before { - left: 0; - border-right-color: rgba(0, 0, 0, 0.25); -} - -.bs-popover-right .arrow::after, .bs-popover-auto[x-placement^="right"] .arrow::after { - left: 1px; - border-right-color: #fff; -} - -.bs-popover-bottom, .bs-popover-auto[x-placement^="bottom"] { - margin-top: 0.5rem; -} - -.bs-popover-bottom .arrow, .bs-popover-auto[x-placement^="bottom"] .arrow { - top: calc((0.5rem + 1px) * -1); -} - -.bs-popover-bottom .arrow::before, .bs-popover-auto[x-placement^="bottom"] .arrow::before, -.bs-popover-bottom .arrow::after, .bs-popover-auto[x-placement^="bottom"] .arrow::after { - border-width: 0 0.5rem 0.5rem 0.5rem; -} - -.bs-popover-bottom .arrow::before, .bs-popover-auto[x-placement^="bottom"] .arrow::before { - top: 0; - border-bottom-color: rgba(0, 0, 0, 0.25); -} - -.bs-popover-bottom .arrow::after, .bs-popover-auto[x-placement^="bottom"] .arrow::after { - top: 1px; - border-bottom-color: #fff; -} - -.bs-popover-bottom .popover-header::before, .bs-popover-auto[x-placement^="bottom"] .popover-header::before { - position: absolute; - top: 0; - left: 50%; - display: block; - width: 1rem; - margin-left: -0.5rem; - content: ""; - border-bottom: 1px solid #f7f7f7; -} - -.bs-popover-left, .bs-popover-auto[x-placement^="left"] { - margin-right: 0.5rem; -} - -.bs-popover-left .arrow, .bs-popover-auto[x-placement^="left"] .arrow { - right: calc((0.5rem + 1px) * -1); - width: 0.5rem; - height: 1rem; - margin: 0.3rem 0; -} - -.bs-popover-left .arrow::before, .bs-popover-auto[x-placement^="left"] .arrow::before, -.bs-popover-left .arrow::after, .bs-popover-auto[x-placement^="left"] .arrow::after { - border-width: 0.5rem 0 0.5rem 0.5rem; -} - -.bs-popover-left .arrow::before, .bs-popover-auto[x-placement^="left"] .arrow::before { - right: 0; - border-left-color: rgba(0, 0, 0, 0.25); -} - -.bs-popover-left .arrow::after, .bs-popover-auto[x-placement^="left"] .arrow::after { - right: 1px; - border-left-color: #fff; -} - -.popover-header { - padding: 0.5rem 0.75rem; - margin-bottom: 0; - font-size: 1rem; - color: inherit; - background-color: #f7f7f7; - border-bottom: 1px solid #ebebeb; - border-top-left-radius: calc(0.3rem - 1px); - border-top-right-radius: calc(0.3rem - 1px); -} - -.popover-header:empty { - display: none; -} - -.popover-body { - padding: 0.5rem 0.75rem; - color: #212529; -} - -.carousel { - position: relative; -} - -.carousel-inner { - position: relative; - width: 100%; - overflow: hidden; -} - -.carousel-item { - position: relative; - display: none; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - width: 100%; - transition: -webkit-transform 0.6s ease; - transition: transform 0.6s ease; - transition: transform 0.6s ease, -webkit-transform 0.6s ease; - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - -webkit-perspective: 1000px; - perspective: 1000px; -} - -.carousel-item.active, -.carousel-item-next, -.carousel-item-prev { - display: block; -} - -.carousel-item-next, -.carousel-item-prev { - position: absolute; - top: 0; -} - -.carousel-item-next.carousel-item-left, -.carousel-item-prev.carousel-item-right { - -webkit-transform: translateX(0); - transform: translateX(0); -} - -@supports ((-webkit-transform-style: preserve-3d) or (transform-style: preserve-3d)) { - .carousel-item-next.carousel-item-left, - .carousel-item-prev.carousel-item-right { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } -} - -.carousel-item-next, -.active.carousel-item-right { - -webkit-transform: translateX(100%); - transform: translateX(100%); -} - -@supports ((-webkit-transform-style: preserve-3d) or (transform-style: preserve-3d)) { - .carousel-item-next, - .active.carousel-item-right { - -webkit-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - } -} - -.carousel-item-prev, -.active.carousel-item-left { - -webkit-transform: translateX(-100%); - transform: translateX(-100%); -} - -@supports ((-webkit-transform-style: preserve-3d) or (transform-style: preserve-3d)) { - .carousel-item-prev, - .active.carousel-item-left { - -webkit-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - } -} - -.carousel-control-prev, -.carousel-control-next { - position: absolute; - top: 0; - bottom: 0; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - width: 15%; - color: #fff; - text-align: center; - opacity: 0.5; -} - -.carousel-control-prev:hover, .carousel-control-prev:focus, -.carousel-control-next:hover, -.carousel-control-next:focus { - color: #fff; - text-decoration: none; - outline: 0; - opacity: .9; -} - -.carousel-control-prev { - left: 0; -} - -.carousel-control-next { - right: 0; -} - -.carousel-control-prev-icon, -.carousel-control-next-icon { - display: inline-block; - width: 20px; - height: 20px; - background: transparent no-repeat center center; - background-size: 100% 100%; -} - -.carousel-control-prev-icon { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E"); -} - -.carousel-control-next-icon { - background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M2.75 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3E%3C/svg%3E"); -} - -.carousel-indicators { - position: absolute; - right: 0; - bottom: 10px; - left: 0; - z-index: 15; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - padding-left: 0; - margin-right: 15%; - margin-left: 15%; - list-style: none; -} - -.carousel-indicators li { - position: relative; - -webkit-box-flex: 0; - -ms-flex: 0 1 auto; - flex: 0 1 auto; - width: 30px; - height: 3px; - margin-right: 3px; - margin-left: 3px; - text-indent: -999px; - background-color: rgba(255, 255, 255, 0.5); -} - -.carousel-indicators li::before { - position: absolute; - top: -10px; - left: 0; - display: inline-block; - width: 100%; - height: 10px; - content: ""; -} - -.carousel-indicators li::after { - position: absolute; - bottom: -10px; - left: 0; - display: inline-block; - width: 100%; - height: 10px; - content: ""; -} - -.carousel-indicators .active { - background-color: #fff; -} - -.carousel-caption { - position: absolute; - right: 15%; - bottom: 20px; - left: 15%; - z-index: 10; - padding-top: 20px; - padding-bottom: 20px; - color: #fff; - text-align: center; -} - -.align-baseline { - vertical-align: baseline !important; -} - -.align-top { - vertical-align: top !important; -} - -.align-middle { - vertical-align: middle !important; -} - -.align-bottom { - vertical-align: bottom !important; -} - -.align-text-bottom { - vertical-align: text-bottom !important; -} - -.align-text-top { - vertical-align: text-top !important; -} - -.bg-primary { - background-color: #007bff !important; -} - -a.bg-primary:hover, a.bg-primary:focus, -button.bg-primary:hover, -button.bg-primary:focus { - background-color: #0062cc !important; -} - -.bg-secondary { - background-color: #6c757d !important; -} - -a.bg-secondary:hover, a.bg-secondary:focus, -button.bg-secondary:hover, -button.bg-secondary:focus { - background-color: #545b62 !important; -} - -.bg-success { - background-color: #28a745 !important; -} - -a.bg-success:hover, a.bg-success:focus, -button.bg-success:hover, -button.bg-success:focus { - background-color: #1e7e34 !important; -} - -.bg-info { - background-color: #17a2b8 !important; -} - -a.bg-info:hover, a.bg-info:focus, -button.bg-info:hover, -button.bg-info:focus { - background-color: #117a8b !important; -} - -.bg-warning { - background-color: #ffc107 !important; -} - -a.bg-warning:hover, a.bg-warning:focus, -button.bg-warning:hover, -button.bg-warning:focus { - background-color: #d39e00 !important; -} - -.bg-danger { - background-color: #dc3545 !important; -} - -a.bg-danger:hover, a.bg-danger:focus, -button.bg-danger:hover, -button.bg-danger:focus { - background-color: #bd2130 !important; -} - -.bg-light { - background-color: #f8f9fa !important; -} - -a.bg-light:hover, a.bg-light:focus, -button.bg-light:hover, -button.bg-light:focus { - background-color: #dae0e5 !important; -} - -.bg-dark { - background-color: #343a40 !important; -} - -a.bg-dark:hover, a.bg-dark:focus, -button.bg-dark:hover, -button.bg-dark:focus { - background-color: #1d2124 !important; -} - -.bg-white { - background-color: #fff !important; -} - -.bg-transparent { - background-color: transparent !important; -} - -.border { - border: 1px solid #dee2e6 !important; -} - -.border-top { - border-top: 1px solid #dee2e6 !important; -} - -.border-right { - border-right: 1px solid #dee2e6 !important; -} - -.border-bottom { - border-bottom: 1px solid #dee2e6 !important; -} - -.border-left { - border-left: 1px solid #dee2e6 !important; -} - -.border-0 { - border: 0 !important; -} - -.border-top-0 { - border-top: 0 !important; -} - -.border-right-0 { - border-right: 0 !important; -} - -.border-bottom-0 { - border-bottom: 0 !important; -} - -.border-left-0 { - border-left: 0 !important; -} - -.border-primary { - border-color: #007bff !important; -} - -.border-secondary { - border-color: #6c757d !important; -} - -.border-success { - border-color: #28a745 !important; -} - -.border-info { - border-color: #17a2b8 !important; -} - -.border-warning { - border-color: #ffc107 !important; -} - -.border-danger { - border-color: #dc3545 !important; -} - -.border-light { - border-color: #f8f9fa !important; -} - -.border-dark { - border-color: #343a40 !important; -} - -.border-white { - border-color: #fff !important; -} - -.rounded { - border-radius: 0.25rem !important; -} - -.rounded-top { - border-top-left-radius: 0.25rem !important; - border-top-right-radius: 0.25rem !important; -} - -.rounded-right { - border-top-right-radius: 0.25rem !important; - border-bottom-right-radius: 0.25rem !important; -} - -.rounded-bottom { - border-bottom-right-radius: 0.25rem !important; - border-bottom-left-radius: 0.25rem !important; -} - -.rounded-left { - border-top-left-radius: 0.25rem !important; - border-bottom-left-radius: 0.25rem !important; -} - -.rounded-circle { - border-radius: 50% !important; -} - -.rounded-0 { - border-radius: 0 !important; -} - -.clearfix::after { - display: block; - clear: both; - content: ""; -} - -.d-none { - display: none !important; -} - -.d-inline { - display: inline !important; -} - -.d-inline-block { - display: inline-block !important; -} - -.d-block { - display: block !important; -} - -.d-table { - display: table !important; -} - -.d-table-row { - display: table-row !important; -} - -.d-table-cell { - display: table-cell !important; -} - -.d-flex { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; -} - -.d-inline-flex { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; -} - -@media (min-width: 576px) { - .d-sm-none { - display: none !important; - } - .d-sm-inline { - display: inline !important; - } - .d-sm-inline-block { - display: inline-block !important; - } - .d-sm-block { - display: block !important; - } - .d-sm-table { - display: table !important; - } - .d-sm-table-row { - display: table-row !important; - } - .d-sm-table-cell { - display: table-cell !important; - } - .d-sm-flex { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } - .d-sm-inline-flex { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media (min-width: 768px) { - .d-md-none { - display: none !important; - } - .d-md-inline { - display: inline !important; - } - .d-md-inline-block { - display: inline-block !important; - } - .d-md-block { - display: block !important; - } - .d-md-table { - display: table !important; - } - .d-md-table-row { - display: table-row !important; - } - .d-md-table-cell { - display: table-cell !important; - } - .d-md-flex { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } - .d-md-inline-flex { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media (min-width: 992px) { - .d-lg-none { - display: none !important; - } - .d-lg-inline { - display: inline !important; - } - .d-lg-inline-block { - display: inline-block !important; - } - .d-lg-block { - display: block !important; - } - .d-lg-table { - display: table !important; - } - .d-lg-table-row { - display: table-row !important; - } - .d-lg-table-cell { - display: table-cell !important; - } - .d-lg-flex { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } - .d-lg-inline-flex { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media (min-width: 1200px) { - .d-xl-none { - display: none !important; - } - .d-xl-inline { - display: inline !important; - } - .d-xl-inline-block { - display: inline-block !important; - } - .d-xl-block { - display: block !important; - } - .d-xl-table { - display: table !important; - } - .d-xl-table-row { - display: table-row !important; - } - .d-xl-table-cell { - display: table-cell !important; - } - .d-xl-flex { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } - .d-xl-inline-flex { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -@media print { - .d-print-none { - display: none !important; - } - .d-print-inline { - display: inline !important; - } - .d-print-inline-block { - display: inline-block !important; - } - .d-print-block { - display: block !important; - } - .d-print-table { - display: table !important; - } - .d-print-table-row { - display: table-row !important; - } - .d-print-table-cell { - display: table-cell !important; - } - .d-print-flex { - display: -webkit-box !important; - display: -ms-flexbox !important; - display: flex !important; - } - .d-print-inline-flex { - display: -webkit-inline-box !important; - display: -ms-inline-flexbox !important; - display: inline-flex !important; - } -} - -.embed-responsive { - position: relative; - display: block; - width: 100%; - padding: 0; - overflow: hidden; -} - -.embed-responsive::before { - display: block; - content: ""; -} - -.embed-responsive .embed-responsive-item, -.embed-responsive iframe, -.embed-responsive embed, -.embed-responsive object, -.embed-responsive video { - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; - border: 0; -} - -.embed-responsive-21by9::before { - padding-top: 42.857143%; -} - -.embed-responsive-16by9::before { - padding-top: 56.25%; -} - -.embed-responsive-4by3::before { - padding-top: 75%; -} - -.embed-responsive-1by1::before { - padding-top: 100%; -} - -.flex-row { - -webkit-box-orient: horizontal !important; - -webkit-box-direction: normal !important; - -ms-flex-direction: row !important; - flex-direction: row !important; -} - -.flex-column { - -webkit-box-orient: vertical !important; - -webkit-box-direction: normal !important; - -ms-flex-direction: column !important; - flex-direction: column !important; -} - -.flex-row-reverse { - -webkit-box-orient: horizontal !important; - -webkit-box-direction: reverse !important; - -ms-flex-direction: row-reverse !important; - flex-direction: row-reverse !important; -} - -.flex-column-reverse { - -webkit-box-orient: vertical !important; - -webkit-box-direction: reverse !important; - -ms-flex-direction: column-reverse !important; - flex-direction: column-reverse !important; -} - -.flex-wrap { - -ms-flex-wrap: wrap !important; - flex-wrap: wrap !important; -} - -.flex-nowrap { - -ms-flex-wrap: nowrap !important; - flex-wrap: nowrap !important; -} - -.flex-wrap-reverse { - -ms-flex-wrap: wrap-reverse !important; - flex-wrap: wrap-reverse !important; -} - -.justify-content-start { - -webkit-box-pack: start !important; - -ms-flex-pack: start !important; - justify-content: flex-start !important; -} - -.justify-content-end { - -webkit-box-pack: end !important; - -ms-flex-pack: end !important; - justify-content: flex-end !important; -} - -.justify-content-center { - -webkit-box-pack: center !important; - -ms-flex-pack: center !important; - justify-content: center !important; -} - -.justify-content-between { - -webkit-box-pack: justify !important; - -ms-flex-pack: justify !important; - justify-content: space-between !important; -} - -.justify-content-around { - -ms-flex-pack: distribute !important; - justify-content: space-around !important; -} - -.align-items-start { - -webkit-box-align: start !important; - -ms-flex-align: start !important; - align-items: flex-start !important; -} - -.align-items-end { - -webkit-box-align: end !important; - -ms-flex-align: end !important; - align-items: flex-end !important; -} - -.align-items-center { - -webkit-box-align: center !important; - -ms-flex-align: center !important; - align-items: center !important; -} - -.align-items-baseline { - -webkit-box-align: baseline !important; - -ms-flex-align: baseline !important; - align-items: baseline !important; -} - -.align-items-stretch { - -webkit-box-align: stretch !important; - -ms-flex-align: stretch !important; - align-items: stretch !important; -} - -.align-content-start { - -ms-flex-line-pack: start !important; - align-content: flex-start !important; -} - -.align-content-end { - -ms-flex-line-pack: end !important; - align-content: flex-end !important; -} - -.align-content-center { - -ms-flex-line-pack: center !important; - align-content: center !important; -} - -.align-content-between { - -ms-flex-line-pack: justify !important; - align-content: space-between !important; -} - -.align-content-around { - -ms-flex-line-pack: distribute !important; - align-content: space-around !important; -} - -.align-content-stretch { - -ms-flex-line-pack: stretch !important; - align-content: stretch !important; -} - -.align-self-auto { - -ms-flex-item-align: auto !important; - align-self: auto !important; -} - -.align-self-start { - -ms-flex-item-align: start !important; - align-self: flex-start !important; -} - -.align-self-end { - -ms-flex-item-align: end !important; - align-self: flex-end !important; -} - -.align-self-center { - -ms-flex-item-align: center !important; - align-self: center !important; -} - -.align-self-baseline { - -ms-flex-item-align: baseline !important; - align-self: baseline !important; -} - -.align-self-stretch { - -ms-flex-item-align: stretch !important; - align-self: stretch !important; -} - -@media (min-width: 576px) { - .flex-sm-row { - -webkit-box-orient: horizontal !important; - -webkit-box-direction: normal !important; - -ms-flex-direction: row !important; - flex-direction: row !important; - } - .flex-sm-column { - -webkit-box-orient: vertical !important; - -webkit-box-direction: normal !important; - -ms-flex-direction: column !important; - flex-direction: column !important; - } - .flex-sm-row-reverse { - -webkit-box-orient: horizontal !important; - -webkit-box-direction: reverse !important; - -ms-flex-direction: row-reverse !important; - flex-direction: row-reverse !important; - } - .flex-sm-column-reverse { - -webkit-box-orient: vertical !important; - -webkit-box-direction: reverse !important; - -ms-flex-direction: column-reverse !important; - flex-direction: column-reverse !important; - } - .flex-sm-wrap { - -ms-flex-wrap: wrap !important; - flex-wrap: wrap !important; - } - .flex-sm-nowrap { - -ms-flex-wrap: nowrap !important; - flex-wrap: nowrap !important; - } - .flex-sm-wrap-reverse { - -ms-flex-wrap: wrap-reverse !important; - flex-wrap: wrap-reverse !important; - } - .justify-content-sm-start { - -webkit-box-pack: start !important; - -ms-flex-pack: start !important; - justify-content: flex-start !important; - } - .justify-content-sm-end { - -webkit-box-pack: end !important; - -ms-flex-pack: end !important; - justify-content: flex-end !important; - } - .justify-content-sm-center { - -webkit-box-pack: center !important; - -ms-flex-pack: center !important; - justify-content: center !important; - } - .justify-content-sm-between { - -webkit-box-pack: justify !important; - -ms-flex-pack: justify !important; - justify-content: space-between !important; - } - .justify-content-sm-around { - -ms-flex-pack: distribute !important; - justify-content: space-around !important; - } - .align-items-sm-start { - -webkit-box-align: start !important; - -ms-flex-align: start !important; - align-items: flex-start !important; - } - .align-items-sm-end { - -webkit-box-align: end !important; - -ms-flex-align: end !important; - align-items: flex-end !important; - } - .align-items-sm-center { - -webkit-box-align: center !important; - -ms-flex-align: center !important; - align-items: center !important; - } - .align-items-sm-baseline { - -webkit-box-align: baseline !important; - -ms-flex-align: baseline !important; - align-items: baseline !important; - } - .align-items-sm-stretch { - -webkit-box-align: stretch !important; - -ms-flex-align: stretch !important; - align-items: stretch !important; - } - .align-content-sm-start { - -ms-flex-line-pack: start !important; - align-content: flex-start !important; - } - .align-content-sm-end { - -ms-flex-line-pack: end !important; - align-content: flex-end !important; - } - .align-content-sm-center { - -ms-flex-line-pack: center !important; - align-content: center !important; - } - .align-content-sm-between { - -ms-flex-line-pack: justify !important; - align-content: space-between !important; - } - .align-content-sm-around { - -ms-flex-line-pack: distribute !important; - align-content: space-around !important; - } - .align-content-sm-stretch { - -ms-flex-line-pack: stretch !important; - align-content: stretch !important; - } - .align-self-sm-auto { - -ms-flex-item-align: auto !important; - align-self: auto !important; - } - .align-self-sm-start { - -ms-flex-item-align: start !important; - align-self: flex-start !important; - } - .align-self-sm-end { - -ms-flex-item-align: end !important; - align-self: flex-end !important; - } - .align-self-sm-center { - -ms-flex-item-align: center !important; - align-self: center !important; - } - .align-self-sm-baseline { - -ms-flex-item-align: baseline !important; - align-self: baseline !important; - } - .align-self-sm-stretch { - -ms-flex-item-align: stretch !important; - align-self: stretch !important; - } -} - -@media (min-width: 768px) { - .flex-md-row { - -webkit-box-orient: horizontal !important; - -webkit-box-direction: normal !important; - -ms-flex-direction: row !important; - flex-direction: row !important; - } - .flex-md-column { - -webkit-box-orient: vertical !important; - -webkit-box-direction: normal !important; - -ms-flex-direction: column !important; - flex-direction: column !important; - } - .flex-md-row-reverse { - -webkit-box-orient: horizontal !important; - -webkit-box-direction: reverse !important; - -ms-flex-direction: row-reverse !important; - flex-direction: row-reverse !important; - } - .flex-md-column-reverse { - -webkit-box-orient: vertical !important; - -webkit-box-direction: reverse !important; - -ms-flex-direction: column-reverse !important; - flex-direction: column-reverse !important; - } - .flex-md-wrap { - -ms-flex-wrap: wrap !important; - flex-wrap: wrap !important; - } - .flex-md-nowrap { - -ms-flex-wrap: nowrap !important; - flex-wrap: nowrap !important; - } - .flex-md-wrap-reverse { - -ms-flex-wrap: wrap-reverse !important; - flex-wrap: wrap-reverse !important; - } - .justify-content-md-start { - -webkit-box-pack: start !important; - -ms-flex-pack: start !important; - justify-content: flex-start !important; - } - .justify-content-md-end { - -webkit-box-pack: end !important; - -ms-flex-pack: end !important; - justify-content: flex-end !important; - } - .justify-content-md-center { - -webkit-box-pack: center !important; - -ms-flex-pack: center !important; - justify-content: center !important; - } - .justify-content-md-between { - -webkit-box-pack: justify !important; - -ms-flex-pack: justify !important; - justify-content: space-between !important; - } - .justify-content-md-around { - -ms-flex-pack: distribute !important; - justify-content: space-around !important; - } - .align-items-md-start { - -webkit-box-align: start !important; - -ms-flex-align: start !important; - align-items: flex-start !important; - } - .align-items-md-end { - -webkit-box-align: end !important; - -ms-flex-align: end !important; - align-items: flex-end !important; - } - .align-items-md-center { - -webkit-box-align: center !important; - -ms-flex-align: center !important; - align-items: center !important; - } - .align-items-md-baseline { - -webkit-box-align: baseline !important; - -ms-flex-align: baseline !important; - align-items: baseline !important; - } - .align-items-md-stretch { - -webkit-box-align: stretch !important; - -ms-flex-align: stretch !important; - align-items: stretch !important; - } - .align-content-md-start { - -ms-flex-line-pack: start !important; - align-content: flex-start !important; - } - .align-content-md-end { - -ms-flex-line-pack: end !important; - align-content: flex-end !important; - } - .align-content-md-center { - -ms-flex-line-pack: center !important; - align-content: center !important; - } - .align-content-md-between { - -ms-flex-line-pack: justify !important; - align-content: space-between !important; - } - .align-content-md-around { - -ms-flex-line-pack: distribute !important; - align-content: space-around !important; - } - .align-content-md-stretch { - -ms-flex-line-pack: stretch !important; - align-content: stretch !important; - } - .align-self-md-auto { - -ms-flex-item-align: auto !important; - align-self: auto !important; - } - .align-self-md-start { - -ms-flex-item-align: start !important; - align-self: flex-start !important; - } - .align-self-md-end { - -ms-flex-item-align: end !important; - align-self: flex-end !important; - } - .align-self-md-center { - -ms-flex-item-align: center !important; - align-self: center !important; - } - .align-self-md-baseline { - -ms-flex-item-align: baseline !important; - align-self: baseline !important; - } - .align-self-md-stretch { - -ms-flex-item-align: stretch !important; - align-self: stretch !important; - } -} - -@media (min-width: 992px) { - .flex-lg-row { - -webkit-box-orient: horizontal !important; - -webkit-box-direction: normal !important; - -ms-flex-direction: row !important; - flex-direction: row !important; - } - .flex-lg-column { - -webkit-box-orient: vertical !important; - -webkit-box-direction: normal !important; - -ms-flex-direction: column !important; - flex-direction: column !important; - } - .flex-lg-row-reverse { - -webkit-box-orient: horizontal !important; - -webkit-box-direction: reverse !important; - -ms-flex-direction: row-reverse !important; - flex-direction: row-reverse !important; - } - .flex-lg-column-reverse { - -webkit-box-orient: vertical !important; - -webkit-box-direction: reverse !important; - -ms-flex-direction: column-reverse !important; - flex-direction: column-reverse !important; - } - .flex-lg-wrap { - -ms-flex-wrap: wrap !important; - flex-wrap: wrap !important; - } - .flex-lg-nowrap { - -ms-flex-wrap: nowrap !important; - flex-wrap: nowrap !important; - } - .flex-lg-wrap-reverse { - -ms-flex-wrap: wrap-reverse !important; - flex-wrap: wrap-reverse !important; - } - .justify-content-lg-start { - -webkit-box-pack: start !important; - -ms-flex-pack: start !important; - justify-content: flex-start !important; - } - .justify-content-lg-end { - -webkit-box-pack: end !important; - -ms-flex-pack: end !important; - justify-content: flex-end !important; - } - .justify-content-lg-center { - -webkit-box-pack: center !important; - -ms-flex-pack: center !important; - justify-content: center !important; - } - .justify-content-lg-between { - -webkit-box-pack: justify !important; - -ms-flex-pack: justify !important; - justify-content: space-between !important; - } - .justify-content-lg-around { - -ms-flex-pack: distribute !important; - justify-content: space-around !important; - } - .align-items-lg-start { - -webkit-box-align: start !important; - -ms-flex-align: start !important; - align-items: flex-start !important; - } - .align-items-lg-end { - -webkit-box-align: end !important; - -ms-flex-align: end !important; - align-items: flex-end !important; - } - .align-items-lg-center { - -webkit-box-align: center !important; - -ms-flex-align: center !important; - align-items: center !important; - } - .align-items-lg-baseline { - -webkit-box-align: baseline !important; - -ms-flex-align: baseline !important; - align-items: baseline !important; - } - .align-items-lg-stretch { - -webkit-box-align: stretch !important; - -ms-flex-align: stretch !important; - align-items: stretch !important; - } - .align-content-lg-start { - -ms-flex-line-pack: start !important; - align-content: flex-start !important; - } - .align-content-lg-end { - -ms-flex-line-pack: end !important; - align-content: flex-end !important; - } - .align-content-lg-center { - -ms-flex-line-pack: center !important; - align-content: center !important; - } - .align-content-lg-between { - -ms-flex-line-pack: justify !important; - align-content: space-between !important; - } - .align-content-lg-around { - -ms-flex-line-pack: distribute !important; - align-content: space-around !important; - } - .align-content-lg-stretch { - -ms-flex-line-pack: stretch !important; - align-content: stretch !important; - } - .align-self-lg-auto { - -ms-flex-item-align: auto !important; - align-self: auto !important; - } - .align-self-lg-start { - -ms-flex-item-align: start !important; - align-self: flex-start !important; - } - .align-self-lg-end { - -ms-flex-item-align: end !important; - align-self: flex-end !important; - } - .align-self-lg-center { - -ms-flex-item-align: center !important; - align-self: center !important; - } - .align-self-lg-baseline { - -ms-flex-item-align: baseline !important; - align-self: baseline !important; - } - .align-self-lg-stretch { - -ms-flex-item-align: stretch !important; - align-self: stretch !important; - } -} - -@media (min-width: 1200px) { - .flex-xl-row { - -webkit-box-orient: horizontal !important; - -webkit-box-direction: normal !important; - -ms-flex-direction: row !important; - flex-direction: row !important; - } - .flex-xl-column { - -webkit-box-orient: vertical !important; - -webkit-box-direction: normal !important; - -ms-flex-direction: column !important; - flex-direction: column !important; - } - .flex-xl-row-reverse { - -webkit-box-orient: horizontal !important; - -webkit-box-direction: reverse !important; - -ms-flex-direction: row-reverse !important; - flex-direction: row-reverse !important; - } - .flex-xl-column-reverse { - -webkit-box-orient: vertical !important; - -webkit-box-direction: reverse !important; - -ms-flex-direction: column-reverse !important; - flex-direction: column-reverse !important; - } - .flex-xl-wrap { - -ms-flex-wrap: wrap !important; - flex-wrap: wrap !important; - } - .flex-xl-nowrap { - -ms-flex-wrap: nowrap !important; - flex-wrap: nowrap !important; - } - .flex-xl-wrap-reverse { - -ms-flex-wrap: wrap-reverse !important; - flex-wrap: wrap-reverse !important; - } - .justify-content-xl-start { - -webkit-box-pack: start !important; - -ms-flex-pack: start !important; - justify-content: flex-start !important; - } - .justify-content-xl-end { - -webkit-box-pack: end !important; - -ms-flex-pack: end !important; - justify-content: flex-end !important; - } - .justify-content-xl-center { - -webkit-box-pack: center !important; - -ms-flex-pack: center !important; - justify-content: center !important; - } - .justify-content-xl-between { - -webkit-box-pack: justify !important; - -ms-flex-pack: justify !important; - justify-content: space-between !important; - } - .justify-content-xl-around { - -ms-flex-pack: distribute !important; - justify-content: space-around !important; - } - .align-items-xl-start { - -webkit-box-align: start !important; - -ms-flex-align: start !important; - align-items: flex-start !important; - } - .align-items-xl-end { - -webkit-box-align: end !important; - -ms-flex-align: end !important; - align-items: flex-end !important; - } - .align-items-xl-center { - -webkit-box-align: center !important; - -ms-flex-align: center !important; - align-items: center !important; - } - .align-items-xl-baseline { - -webkit-box-align: baseline !important; - -ms-flex-align: baseline !important; - align-items: baseline !important; - } - .align-items-xl-stretch { - -webkit-box-align: stretch !important; - -ms-flex-align: stretch !important; - align-items: stretch !important; - } - .align-content-xl-start { - -ms-flex-line-pack: start !important; - align-content: flex-start !important; - } - .align-content-xl-end { - -ms-flex-line-pack: end !important; - align-content: flex-end !important; - } - .align-content-xl-center { - -ms-flex-line-pack: center !important; - align-content: center !important; - } - .align-content-xl-between { - -ms-flex-line-pack: justify !important; - align-content: space-between !important; - } - .align-content-xl-around { - -ms-flex-line-pack: distribute !important; - align-content: space-around !important; - } - .align-content-xl-stretch { - -ms-flex-line-pack: stretch !important; - align-content: stretch !important; - } - .align-self-xl-auto { - -ms-flex-item-align: auto !important; - align-self: auto !important; - } - .align-self-xl-start { - -ms-flex-item-align: start !important; - align-self: flex-start !important; - } - .align-self-xl-end { - -ms-flex-item-align: end !important; - align-self: flex-end !important; - } - .align-self-xl-center { - -ms-flex-item-align: center !important; - align-self: center !important; - } - .align-self-xl-baseline { - -ms-flex-item-align: baseline !important; - align-self: baseline !important; - } - .align-self-xl-stretch { - -ms-flex-item-align: stretch !important; - align-self: stretch !important; - } -} - -.float-left { - float: left !important; -} - -.float-right { - float: right !important; -} - -.float-none { - float: none !important; -} - -@media (min-width: 576px) { - .float-sm-left { - float: left !important; - } - .float-sm-right { - float: right !important; - } - .float-sm-none { - float: none !important; - } -} - -@media (min-width: 768px) { - .float-md-left { - float: left !important; - } - .float-md-right { - float: right !important; - } - .float-md-none { - float: none !important; - } -} - -@media (min-width: 992px) { - .float-lg-left { - float: left !important; - } - .float-lg-right { - float: right !important; - } - .float-lg-none { - float: none !important; - } -} - -@media (min-width: 1200px) { - .float-xl-left { - float: left !important; - } - .float-xl-right { - float: right !important; - } - .float-xl-none { - float: none !important; - } -} - -.position-static { - position: static !important; -} - -.position-relative { - position: relative !important; -} - -.position-absolute { - position: absolute !important; -} - -.position-fixed { - position: fixed !important; -} - -.position-sticky { - position: -webkit-sticky !important; - position: sticky !important; -} - -.fixed-top { - position: fixed; - top: 0; - right: 0; - left: 0; - z-index: 1030; -} - -.fixed-bottom { - position: fixed; - right: 0; - bottom: 0; - left: 0; - z-index: 1030; -} - -@supports ((position: -webkit-sticky) or (position: sticky)) { - .sticky-top { - position: -webkit-sticky; - position: sticky; - top: 0; - z-index: 1020; - } -} - -.sr-only { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - overflow: hidden; - clip: rect(0, 0, 0, 0); - white-space: nowrap; - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - border: 0; -} - -.sr-only-focusable:active, .sr-only-focusable:focus { - position: static; - width: auto; - height: auto; - overflow: visible; - clip: auto; - white-space: normal; - -webkit-clip-path: none; - clip-path: none; -} - -.w-25 { - width: 25% !important; -} - -.w-50 { - width: 50% !important; -} - -.w-75 { - width: 75% !important; -} - -.w-100 { - width: 100% !important; -} - -.h-25 { - height: 25% !important; -} - -.h-50 { - height: 50% !important; -} - -.h-75 { - height: 75% !important; -} - -.h-100 { - height: 100% !important; -} - -.mw-100 { - max-width: 100% !important; -} - -.mh-100 { - max-height: 100% !important; -} - -.m-0 { - margin: 0 !important; -} - -.mt-0, -.my-0 { - margin-top: 0 !important; -} - -.mr-0, -.mx-0 { - margin-right: 0 !important; -} - -.mb-0, -.my-0 { - margin-bottom: 0 !important; -} - -.ml-0, -.mx-0 { - margin-left: 0 !important; -} - -.m-1 { - margin: 0.25rem !important; -} - -.mt-1, -.my-1 { - margin-top: 0.25rem !important; -} - -.mr-1, -.mx-1 { - margin-right: 0.25rem !important; -} - -.mb-1, -.my-1 { - margin-bottom: 0.25rem !important; -} - -.ml-1, -.mx-1 { - margin-left: 0.25rem !important; -} - -.m-2 { - margin: 0.5rem !important; -} - -.mt-2, -.my-2 { - margin-top: 0.5rem !important; -} - -.mr-2, -.mx-2 { - margin-right: 0.5rem !important; -} - -.mb-2, -.my-2 { - margin-bottom: 0.5rem !important; -} - -.ml-2, -.mx-2 { - margin-left: 0.5rem !important; -} - -.m-3 { - margin: 1rem !important; -} - -.mt-3, -.my-3 { - margin-top: 1rem !important; -} - -.mr-3, -.mx-3 { - margin-right: 1rem !important; -} - -.mb-3, -.my-3 { - margin-bottom: 1rem !important; -} - -.ml-3, -.mx-3 { - margin-left: 1rem !important; -} - -.m-4 { - margin: 1.5rem !important; -} - -.mt-4, -.my-4 { - margin-top: 1.5rem !important; -} - -.mr-4, -.mx-4 { - margin-right: 1.5rem !important; -} - -.mb-4, -.my-4 { - margin-bottom: 1.5rem !important; -} - -.ml-4, -.mx-4 { - margin-left: 1.5rem !important; -} - -.m-5 { - margin: 3rem !important; -} - -.mt-5, -.my-5 { - margin-top: 3rem !important; -} - -.mr-5, -.mx-5 { - margin-right: 3rem !important; -} - -.mb-5, -.my-5 { - margin-bottom: 3rem !important; -} - -.ml-5, -.mx-5 { - margin-left: 3rem !important; -} - -.p-0 { - padding: 0 !important; -} - -.pt-0, -.py-0 { - padding-top: 0 !important; -} - -.pr-0, -.px-0 { - padding-right: 0 !important; -} - -.pb-0, -.py-0 { - padding-bottom: 0 !important; -} - -.pl-0, -.px-0 { - padding-left: 0 !important; -} - -.p-1 { - padding: 0.25rem !important; -} - -.pt-1, -.py-1 { - padding-top: 0.25rem !important; -} - -.pr-1, -.px-1 { - padding-right: 0.25rem !important; -} - -.pb-1, -.py-1 { - padding-bottom: 0.25rem !important; -} - -.pl-1, -.px-1 { - padding-left: 0.25rem !important; -} - -.p-2 { - padding: 0.5rem !important; -} - -.pt-2, -.py-2 { - padding-top: 0.5rem !important; -} - -.pr-2, -.px-2 { - padding-right: 0.5rem !important; -} - -.pb-2, -.py-2 { - padding-bottom: 0.5rem !important; -} - -.pl-2, -.px-2 { - padding-left: 0.5rem !important; -} - -.p-3 { - padding: 1rem !important; -} - -.pt-3, -.py-3 { - padding-top: 1rem !important; -} - -.pr-3, -.px-3 { - padding-right: 1rem !important; -} - -.pb-3, -.py-3 { - padding-bottom: 1rem !important; -} - -.pl-3, -.px-3 { - padding-left: 1rem !important; -} - -.p-4 { - padding: 1.5rem !important; -} - -.pt-4, -.py-4 { - padding-top: 1.5rem !important; -} - -.pr-4, -.px-4 { - padding-right: 1.5rem !important; -} - -.pb-4, -.py-4 { - padding-bottom: 1.5rem !important; -} - -.pl-4, -.px-4 { - padding-left: 1.5rem !important; -} - -.p-5 { - padding: 3rem !important; -} - -.pt-5, -.py-5 { - padding-top: 3rem !important; -} - -.pr-5, -.px-5 { - padding-right: 3rem !important; -} - -.pb-5, -.py-5 { - padding-bottom: 3rem !important; -} - -.pl-5, -.px-5 { - padding-left: 3rem !important; -} - -.m-auto { - margin: auto !important; -} - -.mt-auto, -.my-auto { - margin-top: auto !important; -} - -.mr-auto, -.mx-auto { - margin-right: auto !important; -} - -.mb-auto, -.my-auto { - margin-bottom: auto !important; -} - -.ml-auto, -.mx-auto { - margin-left: auto !important; -} - -@media (min-width: 576px) { - .m-sm-0 { - margin: 0 !important; - } - .mt-sm-0, - .my-sm-0 { - margin-top: 0 !important; - } - .mr-sm-0, - .mx-sm-0 { - margin-right: 0 !important; - } - .mb-sm-0, - .my-sm-0 { - margin-bottom: 0 !important; - } - .ml-sm-0, - .mx-sm-0 { - margin-left: 0 !important; - } - .m-sm-1 { - margin: 0.25rem !important; - } - .mt-sm-1, - .my-sm-1 { - margin-top: 0.25rem !important; - } - .mr-sm-1, - .mx-sm-1 { - margin-right: 0.25rem !important; - } - .mb-sm-1, - .my-sm-1 { - margin-bottom: 0.25rem !important; - } - .ml-sm-1, - .mx-sm-1 { - margin-left: 0.25rem !important; - } - .m-sm-2 { - margin: 0.5rem !important; - } - .mt-sm-2, - .my-sm-2 { - margin-top: 0.5rem !important; - } - .mr-sm-2, - .mx-sm-2 { - margin-right: 0.5rem !important; - } - .mb-sm-2, - .my-sm-2 { - margin-bottom: 0.5rem !important; - } - .ml-sm-2, - .mx-sm-2 { - margin-left: 0.5rem !important; - } - .m-sm-3 { - margin: 1rem !important; - } - .mt-sm-3, - .my-sm-3 { - margin-top: 1rem !important; - } - .mr-sm-3, - .mx-sm-3 { - margin-right: 1rem !important; - } - .mb-sm-3, - .my-sm-3 { - margin-bottom: 1rem !important; - } - .ml-sm-3, - .mx-sm-3 { - margin-left: 1rem !important; - } - .m-sm-4 { - margin: 1.5rem !important; - } - .mt-sm-4, - .my-sm-4 { - margin-top: 1.5rem !important; - } - .mr-sm-4, - .mx-sm-4 { - margin-right: 1.5rem !important; - } - .mb-sm-4, - .my-sm-4 { - margin-bottom: 1.5rem !important; - } - .ml-sm-4, - .mx-sm-4 { - margin-left: 1.5rem !important; - } - .m-sm-5 { - margin: 3rem !important; - } - .mt-sm-5, - .my-sm-5 { - margin-top: 3rem !important; - } - .mr-sm-5, - .mx-sm-5 { - margin-right: 3rem !important; - } - .mb-sm-5, - .my-sm-5 { - margin-bottom: 3rem !important; - } - .ml-sm-5, - .mx-sm-5 { - margin-left: 3rem !important; - } - .p-sm-0 { - padding: 0 !important; - } - .pt-sm-0, - .py-sm-0 { - padding-top: 0 !important; - } - .pr-sm-0, - .px-sm-0 { - padding-right: 0 !important; - } - .pb-sm-0, - .py-sm-0 { - padding-bottom: 0 !important; - } - .pl-sm-0, - .px-sm-0 { - padding-left: 0 !important; - } - .p-sm-1 { - padding: 0.25rem !important; - } - .pt-sm-1, - .py-sm-1 { - padding-top: 0.25rem !important; - } - .pr-sm-1, - .px-sm-1 { - padding-right: 0.25rem !important; - } - .pb-sm-1, - .py-sm-1 { - padding-bottom: 0.25rem !important; - } - .pl-sm-1, - .px-sm-1 { - padding-left: 0.25rem !important; - } - .p-sm-2 { - padding: 0.5rem !important; - } - .pt-sm-2, - .py-sm-2 { - padding-top: 0.5rem !important; - } - .pr-sm-2, - .px-sm-2 { - padding-right: 0.5rem !important; - } - .pb-sm-2, - .py-sm-2 { - padding-bottom: 0.5rem !important; - } - .pl-sm-2, - .px-sm-2 { - padding-left: 0.5rem !important; - } - .p-sm-3 { - padding: 1rem !important; - } - .pt-sm-3, - .py-sm-3 { - padding-top: 1rem !important; - } - .pr-sm-3, - .px-sm-3 { - padding-right: 1rem !important; - } - .pb-sm-3, - .py-sm-3 { - padding-bottom: 1rem !important; - } - .pl-sm-3, - .px-sm-3 { - padding-left: 1rem !important; - } - .p-sm-4 { - padding: 1.5rem !important; - } - .pt-sm-4, - .py-sm-4 { - padding-top: 1.5rem !important; - } - .pr-sm-4, - .px-sm-4 { - padding-right: 1.5rem !important; - } - .pb-sm-4, - .py-sm-4 { - padding-bottom: 1.5rem !important; - } - .pl-sm-4, - .px-sm-4 { - padding-left: 1.5rem !important; - } - .p-sm-5 { - padding: 3rem !important; - } - .pt-sm-5, - .py-sm-5 { - padding-top: 3rem !important; - } - .pr-sm-5, - .px-sm-5 { - padding-right: 3rem !important; - } - .pb-sm-5, - .py-sm-5 { - padding-bottom: 3rem !important; - } - .pl-sm-5, - .px-sm-5 { - padding-left: 3rem !important; - } - .m-sm-auto { - margin: auto !important; - } - .mt-sm-auto, - .my-sm-auto { - margin-top: auto !important; - } - .mr-sm-auto, - .mx-sm-auto { - margin-right: auto !important; - } - .mb-sm-auto, - .my-sm-auto { - margin-bottom: auto !important; - } - .ml-sm-auto, - .mx-sm-auto { - margin-left: auto !important; - } -} - -@media (min-width: 768px) { - .m-md-0 { - margin: 0 !important; - } - .mt-md-0, - .my-md-0 { - margin-top: 0 !important; - } - .mr-md-0, - .mx-md-0 { - margin-right: 0 !important; - } - .mb-md-0, - .my-md-0 { - margin-bottom: 0 !important; - } - .ml-md-0, - .mx-md-0 { - margin-left: 0 !important; - } - .m-md-1 { - margin: 0.25rem !important; - } - .mt-md-1, - .my-md-1 { - margin-top: 0.25rem !important; - } - .mr-md-1, - .mx-md-1 { - margin-right: 0.25rem !important; - } - .mb-md-1, - .my-md-1 { - margin-bottom: 0.25rem !important; - } - .ml-md-1, - .mx-md-1 { - margin-left: 0.25rem !important; - } - .m-md-2 { - margin: 0.5rem !important; - } - .mt-md-2, - .my-md-2 { - margin-top: 0.5rem !important; - } - .mr-md-2, - .mx-md-2 { - margin-right: 0.5rem !important; - } - .mb-md-2, - .my-md-2 { - margin-bottom: 0.5rem !important; - } - .ml-md-2, - .mx-md-2 { - margin-left: 0.5rem !important; - } - .m-md-3 { - margin: 1rem !important; - } - .mt-md-3, - .my-md-3 { - margin-top: 1rem !important; - } - .mr-md-3, - .mx-md-3 { - margin-right: 1rem !important; - } - .mb-md-3, - .my-md-3 { - margin-bottom: 1rem !important; - } - .ml-md-3, - .mx-md-3 { - margin-left: 1rem !important; - } - .m-md-4 { - margin: 1.5rem !important; - } - .mt-md-4, - .my-md-4 { - margin-top: 1.5rem !important; - } - .mr-md-4, - .mx-md-4 { - margin-right: 1.5rem !important; - } - .mb-md-4, - .my-md-4 { - margin-bottom: 1.5rem !important; - } - .ml-md-4, - .mx-md-4 { - margin-left: 1.5rem !important; - } - .m-md-5 { - margin: 3rem !important; - } - .mt-md-5, - .my-md-5 { - margin-top: 3rem !important; - } - .mr-md-5, - .mx-md-5 { - margin-right: 3rem !important; - } - .mb-md-5, - .my-md-5 { - margin-bottom: 3rem !important; - } - .ml-md-5, - .mx-md-5 { - margin-left: 3rem !important; - } - .p-md-0 { - padding: 0 !important; - } - .pt-md-0, - .py-md-0 { - padding-top: 0 !important; - } - .pr-md-0, - .px-md-0 { - padding-right: 0 !important; - } - .pb-md-0, - .py-md-0 { - padding-bottom: 0 !important; - } - .pl-md-0, - .px-md-0 { - padding-left: 0 !important; - } - .p-md-1 { - padding: 0.25rem !important; - } - .pt-md-1, - .py-md-1 { - padding-top: 0.25rem !important; - } - .pr-md-1, - .px-md-1 { - padding-right: 0.25rem !important; - } - .pb-md-1, - .py-md-1 { - padding-bottom: 0.25rem !important; - } - .pl-md-1, - .px-md-1 { - padding-left: 0.25rem !important; - } - .p-md-2 { - padding: 0.5rem !important; - } - .pt-md-2, - .py-md-2 { - padding-top: 0.5rem !important; - } - .pr-md-2, - .px-md-2 { - padding-right: 0.5rem !important; - } - .pb-md-2, - .py-md-2 { - padding-bottom: 0.5rem !important; - } - .pl-md-2, - .px-md-2 { - padding-left: 0.5rem !important; - } - .p-md-3 { - padding: 1rem !important; - } - .pt-md-3, - .py-md-3 { - padding-top: 1rem !important; - } - .pr-md-3, - .px-md-3 { - padding-right: 1rem !important; - } - .pb-md-3, - .py-md-3 { - padding-bottom: 1rem !important; - } - .pl-md-3, - .px-md-3 { - padding-left: 1rem !important; - } - .p-md-4 { - padding: 1.5rem !important; - } - .pt-md-4, - .py-md-4 { - padding-top: 1.5rem !important; - } - .pr-md-4, - .px-md-4 { - padding-right: 1.5rem !important; - } - .pb-md-4, - .py-md-4 { - padding-bottom: 1.5rem !important; - } - .pl-md-4, - .px-md-4 { - padding-left: 1.5rem !important; - } - .p-md-5 { - padding: 3rem !important; - } - .pt-md-5, - .py-md-5 { - padding-top: 3rem !important; - } - .pr-md-5, - .px-md-5 { - padding-right: 3rem !important; - } - .pb-md-5, - .py-md-5 { - padding-bottom: 3rem !important; - } - .pl-md-5, - .px-md-5 { - padding-left: 3rem !important; - } - .m-md-auto { - margin: auto !important; - } - .mt-md-auto, - .my-md-auto { - margin-top: auto !important; - } - .mr-md-auto, - .mx-md-auto { - margin-right: auto !important; - } - .mb-md-auto, - .my-md-auto { - margin-bottom: auto !important; - } - .ml-md-auto, - .mx-md-auto { - margin-left: auto !important; - } -} - -@media (min-width: 992px) { - .m-lg-0 { - margin: 0 !important; - } - .mt-lg-0, - .my-lg-0 { - margin-top: 0 !important; - } - .mr-lg-0, - .mx-lg-0 { - margin-right: 0 !important; - } - .mb-lg-0, - .my-lg-0 { - margin-bottom: 0 !important; - } - .ml-lg-0, - .mx-lg-0 { - margin-left: 0 !important; - } - .m-lg-1 { - margin: 0.25rem !important; - } - .mt-lg-1, - .my-lg-1 { - margin-top: 0.25rem !important; - } - .mr-lg-1, - .mx-lg-1 { - margin-right: 0.25rem !important; - } - .mb-lg-1, - .my-lg-1 { - margin-bottom: 0.25rem !important; - } - .ml-lg-1, - .mx-lg-1 { - margin-left: 0.25rem !important; - } - .m-lg-2 { - margin: 0.5rem !important; - } - .mt-lg-2, - .my-lg-2 { - margin-top: 0.5rem !important; - } - .mr-lg-2, - .mx-lg-2 { - margin-right: 0.5rem !important; - } - .mb-lg-2, - .my-lg-2 { - margin-bottom: 0.5rem !important; - } - .ml-lg-2, - .mx-lg-2 { - margin-left: 0.5rem !important; - } - .m-lg-3 { - margin: 1rem !important; - } - .mt-lg-3, - .my-lg-3 { - margin-top: 1rem !important; - } - .mr-lg-3, - .mx-lg-3 { - margin-right: 1rem !important; - } - .mb-lg-3, - .my-lg-3 { - margin-bottom: 1rem !important; - } - .ml-lg-3, - .mx-lg-3 { - margin-left: 1rem !important; - } - .m-lg-4 { - margin: 1.5rem !important; - } - .mt-lg-4, - .my-lg-4 { - margin-top: 1.5rem !important; - } - .mr-lg-4, - .mx-lg-4 { - margin-right: 1.5rem !important; - } - .mb-lg-4, - .my-lg-4 { - margin-bottom: 1.5rem !important; - } - .ml-lg-4, - .mx-lg-4 { - margin-left: 1.5rem !important; - } - .m-lg-5 { - margin: 3rem !important; - } - .mt-lg-5, - .my-lg-5 { - margin-top: 3rem !important; - } - .mr-lg-5, - .mx-lg-5 { - margin-right: 3rem !important; - } - .mb-lg-5, - .my-lg-5 { - margin-bottom: 3rem !important; - } - .ml-lg-5, - .mx-lg-5 { - margin-left: 3rem !important; - } - .p-lg-0 { - padding: 0 !important; - } - .pt-lg-0, - .py-lg-0 { - padding-top: 0 !important; - } - .pr-lg-0, - .px-lg-0 { - padding-right: 0 !important; - } - .pb-lg-0, - .py-lg-0 { - padding-bottom: 0 !important; - } - .pl-lg-0, - .px-lg-0 { - padding-left: 0 !important; - } - .p-lg-1 { - padding: 0.25rem !important; - } - .pt-lg-1, - .py-lg-1 { - padding-top: 0.25rem !important; - } - .pr-lg-1, - .px-lg-1 { - padding-right: 0.25rem !important; - } - .pb-lg-1, - .py-lg-1 { - padding-bottom: 0.25rem !important; - } - .pl-lg-1, - .px-lg-1 { - padding-left: 0.25rem !important; - } - .p-lg-2 { - padding: 0.5rem !important; - } - .pt-lg-2, - .py-lg-2 { - padding-top: 0.5rem !important; - } - .pr-lg-2, - .px-lg-2 { - padding-right: 0.5rem !important; - } - .pb-lg-2, - .py-lg-2 { - padding-bottom: 0.5rem !important; - } - .pl-lg-2, - .px-lg-2 { - padding-left: 0.5rem !important; - } - .p-lg-3 { - padding: 1rem !important; - } - .pt-lg-3, - .py-lg-3 { - padding-top: 1rem !important; - } - .pr-lg-3, - .px-lg-3 { - padding-right: 1rem !important; - } - .pb-lg-3, - .py-lg-3 { - padding-bottom: 1rem !important; - } - .pl-lg-3, - .px-lg-3 { - padding-left: 1rem !important; - } - .p-lg-4 { - padding: 1.5rem !important; - } - .pt-lg-4, - .py-lg-4 { - padding-top: 1.5rem !important; - } - .pr-lg-4, - .px-lg-4 { - padding-right: 1.5rem !important; - } - .pb-lg-4, - .py-lg-4 { - padding-bottom: 1.5rem !important; - } - .pl-lg-4, - .px-lg-4 { - padding-left: 1.5rem !important; - } - .p-lg-5 { - padding: 3rem !important; - } - .pt-lg-5, - .py-lg-5 { - padding-top: 3rem !important; - } - .pr-lg-5, - .px-lg-5 { - padding-right: 3rem !important; - } - .pb-lg-5, - .py-lg-5 { - padding-bottom: 3rem !important; - } - .pl-lg-5, - .px-lg-5 { - padding-left: 3rem !important; - } - .m-lg-auto { - margin: auto !important; - } - .mt-lg-auto, - .my-lg-auto { - margin-top: auto !important; - } - .mr-lg-auto, - .mx-lg-auto { - margin-right: auto !important; - } - .mb-lg-auto, - .my-lg-auto { - margin-bottom: auto !important; - } - .ml-lg-auto, - .mx-lg-auto { - margin-left: auto !important; - } -} - -@media (min-width: 1200px) { - .m-xl-0 { - margin: 0 !important; - } - .mt-xl-0, - .my-xl-0 { - margin-top: 0 !important; - } - .mr-xl-0, - .mx-xl-0 { - margin-right: 0 !important; - } - .mb-xl-0, - .my-xl-0 { - margin-bottom: 0 !important; - } - .ml-xl-0, - .mx-xl-0 { - margin-left: 0 !important; - } - .m-xl-1 { - margin: 0.25rem !important; - } - .mt-xl-1, - .my-xl-1 { - margin-top: 0.25rem !important; - } - .mr-xl-1, - .mx-xl-1 { - margin-right: 0.25rem !important; - } - .mb-xl-1, - .my-xl-1 { - margin-bottom: 0.25rem !important; - } - .ml-xl-1, - .mx-xl-1 { - margin-left: 0.25rem !important; - } - .m-xl-2 { - margin: 0.5rem !important; - } - .mt-xl-2, - .my-xl-2 { - margin-top: 0.5rem !important; - } - .mr-xl-2, - .mx-xl-2 { - margin-right: 0.5rem !important; - } - .mb-xl-2, - .my-xl-2 { - margin-bottom: 0.5rem !important; - } - .ml-xl-2, - .mx-xl-2 { - margin-left: 0.5rem !important; - } - .m-xl-3 { - margin: 1rem !important; - } - .mt-xl-3, - .my-xl-3 { - margin-top: 1rem !important; - } - .mr-xl-3, - .mx-xl-3 { - margin-right: 1rem !important; - } - .mb-xl-3, - .my-xl-3 { - margin-bottom: 1rem !important; - } - .ml-xl-3, - .mx-xl-3 { - margin-left: 1rem !important; - } - .m-xl-4 { - margin: 1.5rem !important; - } - .mt-xl-4, - .my-xl-4 { - margin-top: 1.5rem !important; - } - .mr-xl-4, - .mx-xl-4 { - margin-right: 1.5rem !important; - } - .mb-xl-4, - .my-xl-4 { - margin-bottom: 1.5rem !important; - } - .ml-xl-4, - .mx-xl-4 { - margin-left: 1.5rem !important; - } - .m-xl-5 { - margin: 3rem !important; - } - .mt-xl-5, - .my-xl-5 { - margin-top: 3rem !important; - } - .mr-xl-5, - .mx-xl-5 { - margin-right: 3rem !important; - } - .mb-xl-5, - .my-xl-5 { - margin-bottom: 3rem !important; - } - .ml-xl-5, - .mx-xl-5 { - margin-left: 3rem !important; - } - .p-xl-0 { - padding: 0 !important; - } - .pt-xl-0, - .py-xl-0 { - padding-top: 0 !important; - } - .pr-xl-0, - .px-xl-0 { - padding-right: 0 !important; - } - .pb-xl-0, - .py-xl-0 { - padding-bottom: 0 !important; - } - .pl-xl-0, - .px-xl-0 { - padding-left: 0 !important; - } - .p-xl-1 { - padding: 0.25rem !important; - } - .pt-xl-1, - .py-xl-1 { - padding-top: 0.25rem !important; - } - .pr-xl-1, - .px-xl-1 { - padding-right: 0.25rem !important; - } - .pb-xl-1, - .py-xl-1 { - padding-bottom: 0.25rem !important; - } - .pl-xl-1, - .px-xl-1 { - padding-left: 0.25rem !important; - } - .p-xl-2 { - padding: 0.5rem !important; - } - .pt-xl-2, - .py-xl-2 { - padding-top: 0.5rem !important; - } - .pr-xl-2, - .px-xl-2 { - padding-right: 0.5rem !important; - } - .pb-xl-2, - .py-xl-2 { - padding-bottom: 0.5rem !important; - } - .pl-xl-2, - .px-xl-2 { - padding-left: 0.5rem !important; - } - .p-xl-3 { - padding: 1rem !important; - } - .pt-xl-3, - .py-xl-3 { - padding-top: 1rem !important; - } - .pr-xl-3, - .px-xl-3 { - padding-right: 1rem !important; - } - .pb-xl-3, - .py-xl-3 { - padding-bottom: 1rem !important; - } - .pl-xl-3, - .px-xl-3 { - padding-left: 1rem !important; - } - .p-xl-4 { - padding: 1.5rem !important; - } - .pt-xl-4, - .py-xl-4 { - padding-top: 1.5rem !important; - } - .pr-xl-4, - .px-xl-4 { - padding-right: 1.5rem !important; - } - .pb-xl-4, - .py-xl-4 { - padding-bottom: 1.5rem !important; - } - .pl-xl-4, - .px-xl-4 { - padding-left: 1.5rem !important; - } - .p-xl-5 { - padding: 3rem !important; - } - .pt-xl-5, - .py-xl-5 { - padding-top: 3rem !important; - } - .pr-xl-5, - .px-xl-5 { - padding-right: 3rem !important; - } - .pb-xl-5, - .py-xl-5 { - padding-bottom: 3rem !important; - } - .pl-xl-5, - .px-xl-5 { - padding-left: 3rem !important; - } - .m-xl-auto { - margin: auto !important; - } - .mt-xl-auto, - .my-xl-auto { - margin-top: auto !important; - } - .mr-xl-auto, - .mx-xl-auto { - margin-right: auto !important; - } - .mb-xl-auto, - .my-xl-auto { - margin-bottom: auto !important; - } - .ml-xl-auto, - .mx-xl-auto { - margin-left: auto !important; - } -} - -.text-justify { - text-align: justify !important; -} - -.text-nowrap { - white-space: nowrap !important; -} - -.text-truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.text-left { - text-align: left !important; -} - -.text-right { - text-align: right !important; -} - -.text-center { - text-align: center !important; -} - -@media (min-width: 576px) { - .text-sm-left { - text-align: left !important; - } - .text-sm-right { - text-align: right !important; - } - .text-sm-center { - text-align: center !important; - } -} - -@media (min-width: 768px) { - .text-md-left { - text-align: left !important; - } - .text-md-right { - text-align: right !important; - } - .text-md-center { - text-align: center !important; - } -} - -@media (min-width: 992px) { - .text-lg-left { - text-align: left !important; - } - .text-lg-right { - text-align: right !important; - } - .text-lg-center { - text-align: center !important; - } -} - -@media (min-width: 1200px) { - .text-xl-left { - text-align: left !important; - } - .text-xl-right { - text-align: right !important; - } - .text-xl-center { - text-align: center !important; - } -} - -.text-lowercase { - text-transform: lowercase !important; -} - -.text-uppercase { - text-transform: uppercase !important; -} - -.text-capitalize { - text-transform: capitalize !important; -} - -.font-weight-light { - font-weight: 300 !important; -} - -.font-weight-normal { - font-weight: 400 !important; -} - -.font-weight-bold { - font-weight: 700 !important; -} - -.font-italic { - font-style: italic !important; -} - -.text-white { - color: #fff !important; -} - -.text-primary { - color: #007bff !important; -} - -a.text-primary:hover, a.text-primary:focus { - color: #0062cc !important; -} - -.text-secondary { - color: #6c757d !important; -} - -a.text-secondary:hover, a.text-secondary:focus { - color: #545b62 !important; -} - -.text-success { - color: #28a745 !important; -} - -a.text-success:hover, a.text-success:focus { - color: #1e7e34 !important; -} - -.text-info { - color: #17a2b8 !important; -} - -a.text-info:hover, a.text-info:focus { - color: #117a8b !important; -} - -.text-warning { - color: #ffc107 !important; -} - -a.text-warning:hover, a.text-warning:focus { - color: #d39e00 !important; -} - -.text-danger { - color: #dc3545 !important; -} - -a.text-danger:hover, a.text-danger:focus { - color: #bd2130 !important; -} - -.text-light { - color: #f8f9fa !important; -} - -a.text-light:hover, a.text-light:focus { - color: #dae0e5 !important; -} - -.text-dark { - color: #343a40 !important; -} - -a.text-dark:hover, a.text-dark:focus { - color: #1d2124 !important; -} - -.text-muted { - color: #6c757d !important; -} - -.text-hide { - font: 0/0 a; - color: transparent; - text-shadow: none; - background-color: transparent; - border: 0; -} - -.visible { - visibility: visible !important; -} - -.invisible { - visibility: hidden !important; -} - -@media print { - *, - *::before, - *::after { - text-shadow: none !important; - box-shadow: none !important; - } - a:not(.btn) { - text-decoration: underline; - } - abbr[title]::after { - content: " (" attr(title) ")"; - } - pre { - white-space: pre-wrap !important; - } - pre, - blockquote { - border: 1px solid #999; - page-break-inside: avoid; - } - thead { - display: table-header-group; - } - tr, - img { - page-break-inside: avoid; - } - p, - h2, - h3 { - orphans: 3; - widows: 3; - } - h2, - h3 { - page-break-after: avoid; - } - @page { - size: a3; - } - body { - min-width: 992px !important; - } - .container { - min-width: 992px !important; - } - .navbar { - display: none; - } - .badge { - border: 1px solid #000; - } - .table { - border-collapse: collapse !important; - } - .table td, - .table th { - background-color: #fff !important; - } - .table-bordered th, - .table-bordered td { - border: 1px solid #ddd !important; - } -} +/*! + * Bootstrap v4.0.0 (https://getbootstrap.com) + * Copyright 2011-2018 The Bootstrap Authors + * Copyright 2011-2018 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +:root { + --blue: #007bff; + --indigo: #6610f2; + --purple: #6f42c1; + --pink: #e83e8c; + --red: #dc3545; + --orange: #fd7e14; + --yellow: #ffc107; + --green: #28a745; + --teal: #20c997; + --cyan: #17a2b8; + --white: #fff; + --gray: #6c757d; + --gray-dark: #343a40; + --primary: #007bff; + --secondary: #6c757d; + --success: #28a745; + --info: #17a2b8; + --warning: #ffc107; + --danger: #dc3545; + --light: #f8f9fa; + --dark: #343a40; + --breakpoint-xs: 0; + --breakpoint-sm: 576px; + --breakpoint-md: 768px; + --breakpoint-lg: 992px; + --breakpoint-xl: 1200px; + --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + --font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; +} + +*, +*::before, +*::after { + box-sizing: border-box; +} + +html { + font-family: sans-serif; + line-height: 1.15; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + -ms-overflow-style: scrollbar; + -webkit-tap-highlight-color: transparent; +} + +@-ms-viewport { + width: device-width; +} + +article, aside, dialog, figcaption, figure, footer, header, hgroup, main, nav, section { + display: block; +} + +body { + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + font-size: 1rem; + font-weight: 400; + line-height: 1.5; + color: #212529; + text-align: left; + background-color: #fff; +} + +[tabindex="-1"]:focus { + outline: 0 !important; +} + +hr { + box-sizing: content-box; + height: 0; + overflow: visible; +} + +h1, h2, h3, h4, h5, h6 { + margin-top: 0; + margin-bottom: 0.5rem; +} + +p { + margin-top: 0; + margin-bottom: 1rem; +} + +abbr[title], +abbr[data-original-title] { + text-decoration: underline; + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; + cursor: help; + border-bottom: 0; +} + +address { + margin-bottom: 1rem; + font-style: normal; + line-height: inherit; +} + +ol, +ul, +dl { + margin-top: 0; + margin-bottom: 1rem; +} + +ol ol, +ul ul, +ol ul, +ul ol { + margin-bottom: 0; +} + +dt { + font-weight: 700; +} + +dd { + margin-bottom: .5rem; + margin-left: 0; +} + +blockquote { + margin: 0 0 1rem; +} + +dfn { + font-style: italic; +} + +b, +strong { + font-weight: bolder; +} + +small { + font-size: 80%; +} + +sub, +sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; +} + +sub { + bottom: -.25em; +} + +sup { + top: -.5em; +} + +a { + color: #007bff; + text-decoration: none; + background-color: transparent; + -webkit-text-decoration-skip: objects; +} + +a:hover { + color: #0056b3; + text-decoration: underline; +} + +a:not([href]):not([tabindex]) { + color: inherit; + text-decoration: none; +} + +a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus { + color: inherit; + text-decoration: none; +} + +a:not([href]):not([tabindex]):focus { + outline: 0; +} + +pre, +code, +kbd, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +pre { + margin-top: 0; + margin-bottom: 1rem; + overflow: auto; + -ms-overflow-style: scrollbar; +} + +figure { + margin: 0 0 1rem; +} + +img { + vertical-align: middle; + border-style: none; +} + +svg:not(:root) { + overflow: hidden; +} + +table { + border-collapse: collapse; +} + +caption { + padding-top: 0.75rem; + padding-bottom: 0.75rem; + color: #6c757d; + text-align: left; + caption-side: bottom; +} + +th { + text-align: inherit; +} + +label { + display: inline-block; + margin-bottom: .5rem; +} + +button { + border-radius: 0; +} + +button:focus { + outline: 1px dotted; + outline: 5px auto -webkit-focus-ring-color; +} + +input, +button, +select, +optgroup, +textarea { + margin: 0; + font-family: inherit; + font-size: inherit; + line-height: inherit; +} + +button, +input { + overflow: visible; +} + +button, +select { + text-transform: none; +} + +button, +html [type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + padding: 0; + border-style: none; +} + +input[type="radio"], +input[type="checkbox"] { + box-sizing: border-box; + padding: 0; +} + +input[type="date"], +input[type="time"], +input[type="datetime-local"], +input[type="month"] { + -webkit-appearance: listbox; +} + +textarea { + overflow: auto; + resize: vertical; +} + +fieldset { + min-width: 0; + padding: 0; + margin: 0; + border: 0; +} + +legend { + display: block; + width: 100%; + max-width: 100%; + padding: 0; + margin-bottom: .5rem; + font-size: 1.5rem; + line-height: inherit; + color: inherit; + white-space: normal; +} + +progress { + vertical-align: baseline; +} + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +[type="search"] { + outline-offset: -2px; + -webkit-appearance: none; +} + +[type="search"]::-webkit-search-cancel-button, +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +::-webkit-file-upload-button { + font: inherit; + -webkit-appearance: button; +} + +output { + display: inline-block; +} + +summary { + display: list-item; + cursor: pointer; +} + +template { + display: none; +} + +[hidden] { + display: none !important; +} + +h1, h2, h3, h4, h5, h6, +.h1, .h2, .h3, .h4, .h5, .h6 { + margin-bottom: 0.5rem; + font-family: inherit; + font-weight: 500; + line-height: 1.2; + color: inherit; +} + +h1, .h1 { + font-size: 2.5rem; +} + +h2, .h2 { + font-size: 2rem; +} + +h3, .h3 { + font-size: 1.75rem; +} + +h4, .h4 { + font-size: 1.5rem; +} + +h5, .h5 { + font-size: 1.25rem; +} + +h6, .h6 { + font-size: 1rem; +} + +.lead { + font-size: 1.25rem; + font-weight: 300; +} + +.display-1 { + font-size: 6rem; + font-weight: 300; + line-height: 1.2; +} + +.display-2 { + font-size: 5.5rem; + font-weight: 300; + line-height: 1.2; +} + +.display-3 { + font-size: 4.5rem; + font-weight: 300; + line-height: 1.2; +} + +.display-4 { + font-size: 3.5rem; + font-weight: 300; + line-height: 1.2; +} + +hr { + margin-top: 1rem; + margin-bottom: 1rem; + border: 0; + border-top: 1px solid rgba(0, 0, 0, 0.1); +} + +small, +.small { + font-size: 80%; + font-weight: 400; +} + +mark, +.mark { + padding: 0.2em; + background-color: #fcf8e3; +} + +.list-unstyled { + padding-left: 0; + list-style: none; +} + +.list-inline { + padding-left: 0; + list-style: none; +} + +.list-inline-item { + display: inline-block; +} + +.list-inline-item:not(:last-child) { + margin-right: 0.5rem; +} + +.initialism { + font-size: 90%; + text-transform: uppercase; +} + +.blockquote { + margin-bottom: 1rem; + font-size: 1.25rem; +} + +.blockquote-footer { + display: block; + font-size: 80%; + color: #6c757d; +} + +.blockquote-footer::before { + content: "\2014 \00A0"; +} + +.img-fluid { + max-width: 100%; + height: auto; +} + +.img-thumbnail { + padding: 0.25rem; + background-color: #fff; + border: 1px solid #dee2e6; + border-radius: 0.25rem; + max-width: 100%; + height: auto; +} + +.figure { + display: inline-block; +} + +.figure-img { + margin-bottom: 0.5rem; + line-height: 1; +} + +.figure-caption { + font-size: 90%; + color: #6c757d; +} + +code, +kbd, +pre, +samp { + font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; +} + +code { + font-size: 87.5%; + color: #e83e8c; + word-break: break-word; +} + +a > code { + color: inherit; +} + +kbd { + padding: 0.2rem 0.4rem; + font-size: 87.5%; + color: #fff; + background-color: #212529; + border-radius: 0.2rem; +} + +kbd kbd { + padding: 0; + font-size: 100%; + font-weight: 700; +} + +pre { + display: block; + font-size: 87.5%; + color: #212529; +} + +pre code { + font-size: inherit; + color: inherit; + word-break: normal; +} + +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; +} + +.container { + width: 100%; + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} + +@media (min-width: 576px) { + .container { + max-width: 540px; + } +} + +@media (min-width: 768px) { + .container { + max-width: 720px; + } +} + +@media (min-width: 992px) { + .container { + max-width: 960px; + } +} + +@media (min-width: 1200px) { + .container { + max-width: 1140px; + } +} + +.container-fluid { + width: 100%; + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} + +.row { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + margin-right: -15px; + margin-left: -15px; +} + +.no-gutters { + margin-right: 0; + margin-left: 0; +} + +.no-gutters > .col, +.no-gutters > [class*="col-"] { + padding-right: 0; + padding-left: 0; +} + +.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, .col, +.col-auto, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm, +.col-sm-auto, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12, .col-md, +.col-md-auto, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg, +.col-lg-auto, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl, +.col-xl-auto { + position: relative; + width: 100%; + min-height: 1px; + padding-right: 15px; + padding-left: 15px; +} + +.col { + -ms-flex-preferred-size: 0; + flex-basis: 0; + -webkit-box-flex: 1; + -ms-flex-positive: 1; + flex-grow: 1; + max-width: 100%; +} + +.col-auto { + -webkit-box-flex: 0; + -ms-flex: 0 0 auto; + flex: 0 0 auto; + width: auto; + max-width: none; +} + +.col-1 { + -webkit-box-flex: 0; + -ms-flex: 0 0 8.333333%; + flex: 0 0 8.333333%; + max-width: 8.333333%; +} + +.col-2 { + -webkit-box-flex: 0; + -ms-flex: 0 0 16.666667%; + flex: 0 0 16.666667%; + max-width: 16.666667%; +} + +.col-3 { + -webkit-box-flex: 0; + -ms-flex: 0 0 25%; + flex: 0 0 25%; + max-width: 25%; +} + +.col-4 { + -webkit-box-flex: 0; + -ms-flex: 0 0 33.333333%; + flex: 0 0 33.333333%; + max-width: 33.333333%; +} + +.col-5 { + -webkit-box-flex: 0; + -ms-flex: 0 0 41.666667%; + flex: 0 0 41.666667%; + max-width: 41.666667%; +} + +.col-6 { + -webkit-box-flex: 0; + -ms-flex: 0 0 50%; + flex: 0 0 50%; + max-width: 50%; +} + +.col-7 { + -webkit-box-flex: 0; + -ms-flex: 0 0 58.333333%; + flex: 0 0 58.333333%; + max-width: 58.333333%; +} + +.col-8 { + -webkit-box-flex: 0; + -ms-flex: 0 0 66.666667%; + flex: 0 0 66.666667%; + max-width: 66.666667%; +} + +.col-9 { + -webkit-box-flex: 0; + -ms-flex: 0 0 75%; + flex: 0 0 75%; + max-width: 75%; +} + +.col-10 { + -webkit-box-flex: 0; + -ms-flex: 0 0 83.333333%; + flex: 0 0 83.333333%; + max-width: 83.333333%; +} + +.col-11 { + -webkit-box-flex: 0; + -ms-flex: 0 0 91.666667%; + flex: 0 0 91.666667%; + max-width: 91.666667%; +} + +.col-12 { + -webkit-box-flex: 0; + -ms-flex: 0 0 100%; + flex: 0 0 100%; + max-width: 100%; +} + +.order-first { + -webkit-box-ordinal-group: 0; + -ms-flex-order: -1; + order: -1; +} + +.order-last { + -webkit-box-ordinal-group: 14; + -ms-flex-order: 13; + order: 13; +} + +.order-0 { + -webkit-box-ordinal-group: 1; + -ms-flex-order: 0; + order: 0; +} + +.order-1 { + -webkit-box-ordinal-group: 2; + -ms-flex-order: 1; + order: 1; +} + +.order-2 { + -webkit-box-ordinal-group: 3; + -ms-flex-order: 2; + order: 2; +} + +.order-3 { + -webkit-box-ordinal-group: 4; + -ms-flex-order: 3; + order: 3; +} + +.order-4 { + -webkit-box-ordinal-group: 5; + -ms-flex-order: 4; + order: 4; +} + +.order-5 { + -webkit-box-ordinal-group: 6; + -ms-flex-order: 5; + order: 5; +} + +.order-6 { + -webkit-box-ordinal-group: 7; + -ms-flex-order: 6; + order: 6; +} + +.order-7 { + -webkit-box-ordinal-group: 8; + -ms-flex-order: 7; + order: 7; +} + +.order-8 { + -webkit-box-ordinal-group: 9; + -ms-flex-order: 8; + order: 8; +} + +.order-9 { + -webkit-box-ordinal-group: 10; + -ms-flex-order: 9; + order: 9; +} + +.order-10 { + -webkit-box-ordinal-group: 11; + -ms-flex-order: 10; + order: 10; +} + +.order-11 { + -webkit-box-ordinal-group: 12; + -ms-flex-order: 11; + order: 11; +} + +.order-12 { + -webkit-box-ordinal-group: 13; + -ms-flex-order: 12; + order: 12; +} + +.offset-1 { + margin-left: 8.333333%; +} + +.offset-2 { + margin-left: 16.666667%; +} + +.offset-3 { + margin-left: 25%; +} + +.offset-4 { + margin-left: 33.333333%; +} + +.offset-5 { + margin-left: 41.666667%; +} + +.offset-6 { + margin-left: 50%; +} + +.offset-7 { + margin-left: 58.333333%; +} + +.offset-8 { + margin-left: 66.666667%; +} + +.offset-9 { + margin-left: 75%; +} + +.offset-10 { + margin-left: 83.333333%; +} + +.offset-11 { + margin-left: 91.666667%; +} + +@media (min-width: 576px) { + .col-sm { + -ms-flex-preferred-size: 0; + flex-basis: 0; + -webkit-box-flex: 1; + -ms-flex-positive: 1; + flex-grow: 1; + max-width: 100%; + } + .col-sm-auto { + -webkit-box-flex: 0; + -ms-flex: 0 0 auto; + flex: 0 0 auto; + width: auto; + max-width: none; + } + .col-sm-1 { + -webkit-box-flex: 0; + -ms-flex: 0 0 8.333333%; + flex: 0 0 8.333333%; + max-width: 8.333333%; + } + .col-sm-2 { + -webkit-box-flex: 0; + -ms-flex: 0 0 16.666667%; + flex: 0 0 16.666667%; + max-width: 16.666667%; + } + .col-sm-3 { + -webkit-box-flex: 0; + -ms-flex: 0 0 25%; + flex: 0 0 25%; + max-width: 25%; + } + .col-sm-4 { + -webkit-box-flex: 0; + -ms-flex: 0 0 33.333333%; + flex: 0 0 33.333333%; + max-width: 33.333333%; + } + .col-sm-5 { + -webkit-box-flex: 0; + -ms-flex: 0 0 41.666667%; + flex: 0 0 41.666667%; + max-width: 41.666667%; + } + .col-sm-6 { + -webkit-box-flex: 0; + -ms-flex: 0 0 50%; + flex: 0 0 50%; + max-width: 50%; + } + .col-sm-7 { + -webkit-box-flex: 0; + -ms-flex: 0 0 58.333333%; + flex: 0 0 58.333333%; + max-width: 58.333333%; + } + .col-sm-8 { + -webkit-box-flex: 0; + -ms-flex: 0 0 66.666667%; + flex: 0 0 66.666667%; + max-width: 66.666667%; + } + .col-sm-9 { + -webkit-box-flex: 0; + -ms-flex: 0 0 75%; + flex: 0 0 75%; + max-width: 75%; + } + .col-sm-10 { + -webkit-box-flex: 0; + -ms-flex: 0 0 83.333333%; + flex: 0 0 83.333333%; + max-width: 83.333333%; + } + .col-sm-11 { + -webkit-box-flex: 0; + -ms-flex: 0 0 91.666667%; + flex: 0 0 91.666667%; + max-width: 91.666667%; + } + .col-sm-12 { + -webkit-box-flex: 0; + -ms-flex: 0 0 100%; + flex: 0 0 100%; + max-width: 100%; + } + .order-sm-first { + -webkit-box-ordinal-group: 0; + -ms-flex-order: -1; + order: -1; + } + .order-sm-last { + -webkit-box-ordinal-group: 14; + -ms-flex-order: 13; + order: 13; + } + .order-sm-0 { + -webkit-box-ordinal-group: 1; + -ms-flex-order: 0; + order: 0; + } + .order-sm-1 { + -webkit-box-ordinal-group: 2; + -ms-flex-order: 1; + order: 1; + } + .order-sm-2 { + -webkit-box-ordinal-group: 3; + -ms-flex-order: 2; + order: 2; + } + .order-sm-3 { + -webkit-box-ordinal-group: 4; + -ms-flex-order: 3; + order: 3; + } + .order-sm-4 { + -webkit-box-ordinal-group: 5; + -ms-flex-order: 4; + order: 4; + } + .order-sm-5 { + -webkit-box-ordinal-group: 6; + -ms-flex-order: 5; + order: 5; + } + .order-sm-6 { + -webkit-box-ordinal-group: 7; + -ms-flex-order: 6; + order: 6; + } + .order-sm-7 { + -webkit-box-ordinal-group: 8; + -ms-flex-order: 7; + order: 7; + } + .order-sm-8 { + -webkit-box-ordinal-group: 9; + -ms-flex-order: 8; + order: 8; + } + .order-sm-9 { + -webkit-box-ordinal-group: 10; + -ms-flex-order: 9; + order: 9; + } + .order-sm-10 { + -webkit-box-ordinal-group: 11; + -ms-flex-order: 10; + order: 10; + } + .order-sm-11 { + -webkit-box-ordinal-group: 12; + -ms-flex-order: 11; + order: 11; + } + .order-sm-12 { + -webkit-box-ordinal-group: 13; + -ms-flex-order: 12; + order: 12; + } + .offset-sm-0 { + margin-left: 0; + } + .offset-sm-1 { + margin-left: 8.333333%; + } + .offset-sm-2 { + margin-left: 16.666667%; + } + .offset-sm-3 { + margin-left: 25%; + } + .offset-sm-4 { + margin-left: 33.333333%; + } + .offset-sm-5 { + margin-left: 41.666667%; + } + .offset-sm-6 { + margin-left: 50%; + } + .offset-sm-7 { + margin-left: 58.333333%; + } + .offset-sm-8 { + margin-left: 66.666667%; + } + .offset-sm-9 { + margin-left: 75%; + } + .offset-sm-10 { + margin-left: 83.333333%; + } + .offset-sm-11 { + margin-left: 91.666667%; + } +} + +@media (min-width: 768px) { + .col-md { + -ms-flex-preferred-size: 0; + flex-basis: 0; + -webkit-box-flex: 1; + -ms-flex-positive: 1; + flex-grow: 1; + max-width: 100%; + } + .col-md-auto { + -webkit-box-flex: 0; + -ms-flex: 0 0 auto; + flex: 0 0 auto; + width: auto; + max-width: none; + } + .col-md-1 { + -webkit-box-flex: 0; + -ms-flex: 0 0 8.333333%; + flex: 0 0 8.333333%; + max-width: 8.333333%; + } + .col-md-2 { + -webkit-box-flex: 0; + -ms-flex: 0 0 16.666667%; + flex: 0 0 16.666667%; + max-width: 16.666667%; + } + .col-md-3 { + -webkit-box-flex: 0; + -ms-flex: 0 0 25%; + flex: 0 0 25%; + max-width: 25%; + } + .col-md-4 { + -webkit-box-flex: 0; + -ms-flex: 0 0 33.333333%; + flex: 0 0 33.333333%; + max-width: 33.333333%; + } + .col-md-5 { + -webkit-box-flex: 0; + -ms-flex: 0 0 41.666667%; + flex: 0 0 41.666667%; + max-width: 41.666667%; + } + .col-md-6 { + -webkit-box-flex: 0; + -ms-flex: 0 0 50%; + flex: 0 0 50%; + max-width: 50%; + } + .col-md-7 { + -webkit-box-flex: 0; + -ms-flex: 0 0 58.333333%; + flex: 0 0 58.333333%; + max-width: 58.333333%; + } + .col-md-8 { + -webkit-box-flex: 0; + -ms-flex: 0 0 66.666667%; + flex: 0 0 66.666667%; + max-width: 66.666667%; + } + .col-md-9 { + -webkit-box-flex: 0; + -ms-flex: 0 0 75%; + flex: 0 0 75%; + max-width: 75%; + } + .col-md-10 { + -webkit-box-flex: 0; + -ms-flex: 0 0 83.333333%; + flex: 0 0 83.333333%; + max-width: 83.333333%; + } + .col-md-11 { + -webkit-box-flex: 0; + -ms-flex: 0 0 91.666667%; + flex: 0 0 91.666667%; + max-width: 91.666667%; + } + .col-md-12 { + -webkit-box-flex: 0; + -ms-flex: 0 0 100%; + flex: 0 0 100%; + max-width: 100%; + } + .order-md-first { + -webkit-box-ordinal-group: 0; + -ms-flex-order: -1; + order: -1; + } + .order-md-last { + -webkit-box-ordinal-group: 14; + -ms-flex-order: 13; + order: 13; + } + .order-md-0 { + -webkit-box-ordinal-group: 1; + -ms-flex-order: 0; + order: 0; + } + .order-md-1 { + -webkit-box-ordinal-group: 2; + -ms-flex-order: 1; + order: 1; + } + .order-md-2 { + -webkit-box-ordinal-group: 3; + -ms-flex-order: 2; + order: 2; + } + .order-md-3 { + -webkit-box-ordinal-group: 4; + -ms-flex-order: 3; + order: 3; + } + .order-md-4 { + -webkit-box-ordinal-group: 5; + -ms-flex-order: 4; + order: 4; + } + .order-md-5 { + -webkit-box-ordinal-group: 6; + -ms-flex-order: 5; + order: 5; + } + .order-md-6 { + -webkit-box-ordinal-group: 7; + -ms-flex-order: 6; + order: 6; + } + .order-md-7 { + -webkit-box-ordinal-group: 8; + -ms-flex-order: 7; + order: 7; + } + .order-md-8 { + -webkit-box-ordinal-group: 9; + -ms-flex-order: 8; + order: 8; + } + .order-md-9 { + -webkit-box-ordinal-group: 10; + -ms-flex-order: 9; + order: 9; + } + .order-md-10 { + -webkit-box-ordinal-group: 11; + -ms-flex-order: 10; + order: 10; + } + .order-md-11 { + -webkit-box-ordinal-group: 12; + -ms-flex-order: 11; + order: 11; + } + .order-md-12 { + -webkit-box-ordinal-group: 13; + -ms-flex-order: 12; + order: 12; + } + .offset-md-0 { + margin-left: 0; + } + .offset-md-1 { + margin-left: 8.333333%; + } + .offset-md-2 { + margin-left: 16.666667%; + } + .offset-md-3 { + margin-left: 25%; + } + .offset-md-4 { + margin-left: 33.333333%; + } + .offset-md-5 { + margin-left: 41.666667%; + } + .offset-md-6 { + margin-left: 50%; + } + .offset-md-7 { + margin-left: 58.333333%; + } + .offset-md-8 { + margin-left: 66.666667%; + } + .offset-md-9 { + margin-left: 75%; + } + .offset-md-10 { + margin-left: 83.333333%; + } + .offset-md-11 { + margin-left: 91.666667%; + } +} + +@media (min-width: 992px) { + .col-lg { + -ms-flex-preferred-size: 0; + flex-basis: 0; + -webkit-box-flex: 1; + -ms-flex-positive: 1; + flex-grow: 1; + max-width: 100%; + } + .col-lg-auto { + -webkit-box-flex: 0; + -ms-flex: 0 0 auto; + flex: 0 0 auto; + width: auto; + max-width: none; + } + .col-lg-1 { + -webkit-box-flex: 0; + -ms-flex: 0 0 8.333333%; + flex: 0 0 8.333333%; + max-width: 8.333333%; + } + .col-lg-2 { + -webkit-box-flex: 0; + -ms-flex: 0 0 16.666667%; + flex: 0 0 16.666667%; + max-width: 16.666667%; + } + .col-lg-3 { + -webkit-box-flex: 0; + -ms-flex: 0 0 25%; + flex: 0 0 25%; + max-width: 25%; + } + .col-lg-4 { + -webkit-box-flex: 0; + -ms-flex: 0 0 33.333333%; + flex: 0 0 33.333333%; + max-width: 33.333333%; + } + .col-lg-5 { + -webkit-box-flex: 0; + -ms-flex: 0 0 41.666667%; + flex: 0 0 41.666667%; + max-width: 41.666667%; + } + .col-lg-6 { + -webkit-box-flex: 0; + -ms-flex: 0 0 50%; + flex: 0 0 50%; + max-width: 50%; + } + .col-lg-7 { + -webkit-box-flex: 0; + -ms-flex: 0 0 58.333333%; + flex: 0 0 58.333333%; + max-width: 58.333333%; + } + .col-lg-8 { + -webkit-box-flex: 0; + -ms-flex: 0 0 66.666667%; + flex: 0 0 66.666667%; + max-width: 66.666667%; + } + .col-lg-9 { + -webkit-box-flex: 0; + -ms-flex: 0 0 75%; + flex: 0 0 75%; + max-width: 75%; + } + .col-lg-10 { + -webkit-box-flex: 0; + -ms-flex: 0 0 83.333333%; + flex: 0 0 83.333333%; + max-width: 83.333333%; + } + .col-lg-11 { + -webkit-box-flex: 0; + -ms-flex: 0 0 91.666667%; + flex: 0 0 91.666667%; + max-width: 91.666667%; + } + .col-lg-12 { + -webkit-box-flex: 0; + -ms-flex: 0 0 100%; + flex: 0 0 100%; + max-width: 100%; + } + .order-lg-first { + -webkit-box-ordinal-group: 0; + -ms-flex-order: -1; + order: -1; + } + .order-lg-last { + -webkit-box-ordinal-group: 14; + -ms-flex-order: 13; + order: 13; + } + .order-lg-0 { + -webkit-box-ordinal-group: 1; + -ms-flex-order: 0; + order: 0; + } + .order-lg-1 { + -webkit-box-ordinal-group: 2; + -ms-flex-order: 1; + order: 1; + } + .order-lg-2 { + -webkit-box-ordinal-group: 3; + -ms-flex-order: 2; + order: 2; + } + .order-lg-3 { + -webkit-box-ordinal-group: 4; + -ms-flex-order: 3; + order: 3; + } + .order-lg-4 { + -webkit-box-ordinal-group: 5; + -ms-flex-order: 4; + order: 4; + } + .order-lg-5 { + -webkit-box-ordinal-group: 6; + -ms-flex-order: 5; + order: 5; + } + .order-lg-6 { + -webkit-box-ordinal-group: 7; + -ms-flex-order: 6; + order: 6; + } + .order-lg-7 { + -webkit-box-ordinal-group: 8; + -ms-flex-order: 7; + order: 7; + } + .order-lg-8 { + -webkit-box-ordinal-group: 9; + -ms-flex-order: 8; + order: 8; + } + .order-lg-9 { + -webkit-box-ordinal-group: 10; + -ms-flex-order: 9; + order: 9; + } + .order-lg-10 { + -webkit-box-ordinal-group: 11; + -ms-flex-order: 10; + order: 10; + } + .order-lg-11 { + -webkit-box-ordinal-group: 12; + -ms-flex-order: 11; + order: 11; + } + .order-lg-12 { + -webkit-box-ordinal-group: 13; + -ms-flex-order: 12; + order: 12; + } + .offset-lg-0 { + margin-left: 0; + } + .offset-lg-1 { + margin-left: 8.333333%; + } + .offset-lg-2 { + margin-left: 16.666667%; + } + .offset-lg-3 { + margin-left: 25%; + } + .offset-lg-4 { + margin-left: 33.333333%; + } + .offset-lg-5 { + margin-left: 41.666667%; + } + .offset-lg-6 { + margin-left: 50%; + } + .offset-lg-7 { + margin-left: 58.333333%; + } + .offset-lg-8 { + margin-left: 66.666667%; + } + .offset-lg-9 { + margin-left: 75%; + } + .offset-lg-10 { + margin-left: 83.333333%; + } + .offset-lg-11 { + margin-left: 91.666667%; + } +} + +@media (min-width: 1200px) { + .col-xl { + -ms-flex-preferred-size: 0; + flex-basis: 0; + -webkit-box-flex: 1; + -ms-flex-positive: 1; + flex-grow: 1; + max-width: 100%; + } + .col-xl-auto { + -webkit-box-flex: 0; + -ms-flex: 0 0 auto; + flex: 0 0 auto; + width: auto; + max-width: none; + } + .col-xl-1 { + -webkit-box-flex: 0; + -ms-flex: 0 0 8.333333%; + flex: 0 0 8.333333%; + max-width: 8.333333%; + } + .col-xl-2 { + -webkit-box-flex: 0; + -ms-flex: 0 0 16.666667%; + flex: 0 0 16.666667%; + max-width: 16.666667%; + } + .col-xl-3 { + -webkit-box-flex: 0; + -ms-flex: 0 0 25%; + flex: 0 0 25%; + max-width: 25%; + } + .col-xl-4 { + -webkit-box-flex: 0; + -ms-flex: 0 0 33.333333%; + flex: 0 0 33.333333%; + max-width: 33.333333%; + } + .col-xl-5 { + -webkit-box-flex: 0; + -ms-flex: 0 0 41.666667%; + flex: 0 0 41.666667%; + max-width: 41.666667%; + } + .col-xl-6 { + -webkit-box-flex: 0; + -ms-flex: 0 0 50%; + flex: 0 0 50%; + max-width: 50%; + } + .col-xl-7 { + -webkit-box-flex: 0; + -ms-flex: 0 0 58.333333%; + flex: 0 0 58.333333%; + max-width: 58.333333%; + } + .col-xl-8 { + -webkit-box-flex: 0; + -ms-flex: 0 0 66.666667%; + flex: 0 0 66.666667%; + max-width: 66.666667%; + } + .col-xl-9 { + -webkit-box-flex: 0; + -ms-flex: 0 0 75%; + flex: 0 0 75%; + max-width: 75%; + } + .col-xl-10 { + -webkit-box-flex: 0; + -ms-flex: 0 0 83.333333%; + flex: 0 0 83.333333%; + max-width: 83.333333%; + } + .col-xl-11 { + -webkit-box-flex: 0; + -ms-flex: 0 0 91.666667%; + flex: 0 0 91.666667%; + max-width: 91.666667%; + } + .col-xl-12 { + -webkit-box-flex: 0; + -ms-flex: 0 0 100%; + flex: 0 0 100%; + max-width: 100%; + } + .order-xl-first { + -webkit-box-ordinal-group: 0; + -ms-flex-order: -1; + order: -1; + } + .order-xl-last { + -webkit-box-ordinal-group: 14; + -ms-flex-order: 13; + order: 13; + } + .order-xl-0 { + -webkit-box-ordinal-group: 1; + -ms-flex-order: 0; + order: 0; + } + .order-xl-1 { + -webkit-box-ordinal-group: 2; + -ms-flex-order: 1; + order: 1; + } + .order-xl-2 { + -webkit-box-ordinal-group: 3; + -ms-flex-order: 2; + order: 2; + } + .order-xl-3 { + -webkit-box-ordinal-group: 4; + -ms-flex-order: 3; + order: 3; + } + .order-xl-4 { + -webkit-box-ordinal-group: 5; + -ms-flex-order: 4; + order: 4; + } + .order-xl-5 { + -webkit-box-ordinal-group: 6; + -ms-flex-order: 5; + order: 5; + } + .order-xl-6 { + -webkit-box-ordinal-group: 7; + -ms-flex-order: 6; + order: 6; + } + .order-xl-7 { + -webkit-box-ordinal-group: 8; + -ms-flex-order: 7; + order: 7; + } + .order-xl-8 { + -webkit-box-ordinal-group: 9; + -ms-flex-order: 8; + order: 8; + } + .order-xl-9 { + -webkit-box-ordinal-group: 10; + -ms-flex-order: 9; + order: 9; + } + .order-xl-10 { + -webkit-box-ordinal-group: 11; + -ms-flex-order: 10; + order: 10; + } + .order-xl-11 { + -webkit-box-ordinal-group: 12; + -ms-flex-order: 11; + order: 11; + } + .order-xl-12 { + -webkit-box-ordinal-group: 13; + -ms-flex-order: 12; + order: 12; + } + .offset-xl-0 { + margin-left: 0; + } + .offset-xl-1 { + margin-left: 8.333333%; + } + .offset-xl-2 { + margin-left: 16.666667%; + } + .offset-xl-3 { + margin-left: 25%; + } + .offset-xl-4 { + margin-left: 33.333333%; + } + .offset-xl-5 { + margin-left: 41.666667%; + } + .offset-xl-6 { + margin-left: 50%; + } + .offset-xl-7 { + margin-left: 58.333333%; + } + .offset-xl-8 { + margin-left: 66.666667%; + } + .offset-xl-9 { + margin-left: 75%; + } + .offset-xl-10 { + margin-left: 83.333333%; + } + .offset-xl-11 { + margin-left: 91.666667%; + } +} + +.table { + width: 100%; + max-width: 100%; + margin-bottom: 1rem; + background-color: transparent; +} + +.table th, +.table td { + padding: 0.75rem; + vertical-align: top; + border-top: 1px solid #dee2e6; +} + +.table thead th { + vertical-align: bottom; + border-bottom: 2px solid #dee2e6; +} + +.table tbody + tbody { + border-top: 2px solid #dee2e6; +} + +.table .table { + background-color: #fff; +} + +.table-sm th, +.table-sm td { + padding: 0.3rem; +} + +.table-bordered { + border: 1px solid #dee2e6; +} + +.table-bordered th, +.table-bordered td { + border: 1px solid #dee2e6; +} + +.table-bordered thead th, +.table-bordered thead td { + border-bottom-width: 2px; +} + +.table-striped tbody tr:nth-of-type(odd) { + background-color: rgba(0, 0, 0, 0.05); +} + +.table-hover tbody tr:hover { + background-color: rgba(0, 0, 0, 0.075); +} + +.table-primary, +.table-primary > th, +.table-primary > td { + background-color: #b8daff; +} + +.table-hover .table-primary:hover { + background-color: #9fcdff; +} + +.table-hover .table-primary:hover > td, +.table-hover .table-primary:hover > th { + background-color: #9fcdff; +} + +.table-secondary, +.table-secondary > th, +.table-secondary > td { + background-color: #d6d8db; +} + +.table-hover .table-secondary:hover { + background-color: #c8cbcf; +} + +.table-hover .table-secondary:hover > td, +.table-hover .table-secondary:hover > th { + background-color: #c8cbcf; +} + +.table-success, +.table-success > th, +.table-success > td { + background-color: #c3e6cb; +} + +.table-hover .table-success:hover { + background-color: #b1dfbb; +} + +.table-hover .table-success:hover > td, +.table-hover .table-success:hover > th { + background-color: #b1dfbb; +} + +.table-info, +.table-info > th, +.table-info > td { + background-color: #bee5eb; +} + +.table-hover .table-info:hover { + background-color: #abdde5; +} + +.table-hover .table-info:hover > td, +.table-hover .table-info:hover > th { + background-color: #abdde5; +} + +.table-warning, +.table-warning > th, +.table-warning > td { + background-color: #ffeeba; +} + +.table-hover .table-warning:hover { + background-color: #ffe8a1; +} + +.table-hover .table-warning:hover > td, +.table-hover .table-warning:hover > th { + background-color: #ffe8a1; +} + +.table-danger, +.table-danger > th, +.table-danger > td { + background-color: #f5c6cb; +} + +.table-hover .table-danger:hover { + background-color: #f1b0b7; +} + +.table-hover .table-danger:hover > td, +.table-hover .table-danger:hover > th { + background-color: #f1b0b7; +} + +.table-light, +.table-light > th, +.table-light > td { + background-color: #fdfdfe; +} + +.table-hover .table-light:hover { + background-color: #ececf6; +} + +.table-hover .table-light:hover > td, +.table-hover .table-light:hover > th { + background-color: #ececf6; +} + +.table-dark, +.table-dark > th, +.table-dark > td { + background-color: #c6c8ca; +} + +.table-hover .table-dark:hover { + background-color: #b9bbbe; +} + +.table-hover .table-dark:hover > td, +.table-hover .table-dark:hover > th { + background-color: #b9bbbe; +} + +.table-active, +.table-active > th, +.table-active > td { + background-color: rgba(0, 0, 0, 0.075); +} + +.table-hover .table-active:hover { + background-color: rgba(0, 0, 0, 0.075); +} + +.table-hover .table-active:hover > td, +.table-hover .table-active:hover > th { + background-color: rgba(0, 0, 0, 0.075); +} + +.table .thead-dark th { + color: #fff; + background-color: #212529; + border-color: #32383e; +} + +.table .thead-light th { + color: #495057; + background-color: #e9ecef; + border-color: #dee2e6; +} + +.table-dark { + color: #fff; + background-color: #212529; +} + +.table-dark th, +.table-dark td, +.table-dark thead th { + border-color: #32383e; +} + +.table-dark.table-bordered { + border: 0; +} + +.table-dark.table-striped tbody tr:nth-of-type(odd) { + background-color: rgba(255, 255, 255, 0.05); +} + +.table-dark.table-hover tbody tr:hover { + background-color: rgba(255, 255, 255, 0.075); +} + +@media (max-width: 575.98px) { + .table-responsive-sm { + display: block; + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; + -ms-overflow-style: -ms-autohiding-scrollbar; + } + .table-responsive-sm > .table-bordered { + border: 0; + } +} + +@media (max-width: 767.98px) { + .table-responsive-md { + display: block; + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; + -ms-overflow-style: -ms-autohiding-scrollbar; + } + .table-responsive-md > .table-bordered { + border: 0; + } +} + +@media (max-width: 991.98px) { + .table-responsive-lg { + display: block; + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; + -ms-overflow-style: -ms-autohiding-scrollbar; + } + .table-responsive-lg > .table-bordered { + border: 0; + } +} + +@media (max-width: 1199.98px) { + .table-responsive-xl { + display: block; + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; + -ms-overflow-style: -ms-autohiding-scrollbar; + } + .table-responsive-xl > .table-bordered { + border: 0; + } +} + +.table-responsive { + display: block; + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; + -ms-overflow-style: -ms-autohiding-scrollbar; +} + +.table-responsive > .table-bordered { + border: 0; +} + +.form-control { + display: block; + width: 100%; + padding: 0.375rem 0.75rem; + font-size: 1rem; + line-height: 1.5; + color: #495057; + background-color: #fff; + background-clip: padding-box; + border: 1px solid #ced4da; + border-radius: 0.25rem; + transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; +} + +.form-control::-ms-expand { + background-color: transparent; + border: 0; +} + +.form-control:focus { + color: #495057; + background-color: #fff; + border-color: #80bdff; + outline: 0; + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); +} + +.form-control::-webkit-input-placeholder { + color: #6c757d; + opacity: 1; +} + +.form-control::-moz-placeholder { + color: #6c757d; + opacity: 1; +} + +.form-control:-ms-input-placeholder { + color: #6c757d; + opacity: 1; +} + +.form-control::-ms-input-placeholder { + color: #6c757d; + opacity: 1; +} + +.form-control::placeholder { + color: #6c757d; + opacity: 1; +} + +.form-control:disabled, .form-control[readonly] { + background-color: #e9ecef; + opacity: 1; +} + +select.form-control:not([size]):not([multiple]) { + height: calc(2.25rem + 2px); +} + +select.form-control:focus::-ms-value { + color: #495057; + background-color: #fff; +} + +.form-control-file, +.form-control-range { + display: block; + width: 100%; +} + +.col-form-label { + padding-top: calc(0.375rem + 1px); + padding-bottom: calc(0.375rem + 1px); + margin-bottom: 0; + font-size: inherit; + line-height: 1.5; +} + +.col-form-label-lg { + padding-top: calc(0.5rem + 1px); + padding-bottom: calc(0.5rem + 1px); + font-size: 1.25rem; + line-height: 1.5; +} + +.col-form-label-sm { + padding-top: calc(0.25rem + 1px); + padding-bottom: calc(0.25rem + 1px); + font-size: 0.875rem; + line-height: 1.5; +} + +.form-control-plaintext { + display: block; + width: 100%; + padding-top: 0.375rem; + padding-bottom: 0.375rem; + margin-bottom: 0; + line-height: 1.5; + background-color: transparent; + border: solid transparent; + border-width: 1px 0; +} + +.form-control-plaintext.form-control-sm, .input-group-sm > .form-control-plaintext.form-control, +.input-group-sm > .input-group-prepend > .form-control-plaintext.input-group-text, +.input-group-sm > .input-group-append > .form-control-plaintext.input-group-text, +.input-group-sm > .input-group-prepend > .form-control-plaintext.btn, +.input-group-sm > .input-group-append > .form-control-plaintext.btn, .form-control-plaintext.form-control-lg, .input-group-lg > .form-control-plaintext.form-control, +.input-group-lg > .input-group-prepend > .form-control-plaintext.input-group-text, +.input-group-lg > .input-group-append > .form-control-plaintext.input-group-text, +.input-group-lg > .input-group-prepend > .form-control-plaintext.btn, +.input-group-lg > .input-group-append > .form-control-plaintext.btn { + padding-right: 0; + padding-left: 0; +} + +.form-control-sm, .input-group-sm > .form-control, +.input-group-sm > .input-group-prepend > .input-group-text, +.input-group-sm > .input-group-append > .input-group-text, +.input-group-sm > .input-group-prepend > .btn, +.input-group-sm > .input-group-append > .btn { + padding: 0.25rem 0.5rem; + font-size: 0.875rem; + line-height: 1.5; + border-radius: 0.2rem; +} + +select.form-control-sm:not([size]):not([multiple]), .input-group-sm > select.form-control:not([size]):not([multiple]), +.input-group-sm > .input-group-prepend > select.input-group-text:not([size]):not([multiple]), +.input-group-sm > .input-group-append > select.input-group-text:not([size]):not([multiple]), +.input-group-sm > .input-group-prepend > select.btn:not([size]):not([multiple]), +.input-group-sm > .input-group-append > select.btn:not([size]):not([multiple]) { + height: calc(1.8125rem + 2px); +} + +.form-control-lg, .input-group-lg > .form-control, +.input-group-lg > .input-group-prepend > .input-group-text, +.input-group-lg > .input-group-append > .input-group-text, +.input-group-lg > .input-group-prepend > .btn, +.input-group-lg > .input-group-append > .btn { + padding: 0.5rem 1rem; + font-size: 1.25rem; + line-height: 1.5; + border-radius: 0.3rem; +} + +select.form-control-lg:not([size]):not([multiple]), .input-group-lg > select.form-control:not([size]):not([multiple]), +.input-group-lg > .input-group-prepend > select.input-group-text:not([size]):not([multiple]), +.input-group-lg > .input-group-append > select.input-group-text:not([size]):not([multiple]), +.input-group-lg > .input-group-prepend > select.btn:not([size]):not([multiple]), +.input-group-lg > .input-group-append > select.btn:not([size]):not([multiple]) { + height: calc(2.875rem + 2px); +} + +.form-group { + margin-bottom: 1rem; +} + +.form-text { + display: block; + margin-top: 0.25rem; +} + +.form-row { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + margin-right: -5px; + margin-left: -5px; +} + +.form-row > .col, +.form-row > [class*="col-"] { + padding-right: 5px; + padding-left: 5px; +} + +.form-check { + position: relative; + display: block; + padding-left: 1.25rem; +} + +.form-check-input { + position: absolute; + margin-top: 0.3rem; + margin-left: -1.25rem; +} + +.form-check-input:disabled ~ .form-check-label { + color: #6c757d; +} + +.form-check-label { + margin-bottom: 0; +} + +.form-check-inline { + display: -webkit-inline-box; + display: -ms-inline-flexbox; + display: inline-flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + padding-left: 0; + margin-right: 0.75rem; +} + +.form-check-inline .form-check-input { + position: static; + margin-top: 0; + margin-right: 0.3125rem; + margin-left: 0; +} + +.valid-feedback { + display: none; + width: 100%; + margin-top: 0.25rem; + font-size: 80%; + color: #28a745; +} + +.valid-tooltip { + position: absolute; + top: 100%; + z-index: 5; + display: none; + max-width: 100%; + padding: .5rem; + margin-top: .1rem; + font-size: .875rem; + line-height: 1; + color: #fff; + background-color: rgba(40, 167, 69, 0.8); + border-radius: .2rem; +} + +.was-validated .form-control:valid, .form-control.is-valid, .was-validated +.custom-select:valid, +.custom-select.is-valid { + border-color: #28a745; +} + +.was-validated .form-control:valid:focus, .form-control.is-valid:focus, .was-validated +.custom-select:valid:focus, +.custom-select.is-valid:focus { + border-color: #28a745; + box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25); +} + +.was-validated .form-control:valid ~ .valid-feedback, +.was-validated .form-control:valid ~ .valid-tooltip, .form-control.is-valid ~ .valid-feedback, +.form-control.is-valid ~ .valid-tooltip, .was-validated +.custom-select:valid ~ .valid-feedback, +.was-validated +.custom-select:valid ~ .valid-tooltip, +.custom-select.is-valid ~ .valid-feedback, +.custom-select.is-valid ~ .valid-tooltip { + display: block; +} + +.was-validated .form-check-input:valid ~ .form-check-label, .form-check-input.is-valid ~ .form-check-label { + color: #28a745; +} + +.was-validated .form-check-input:valid ~ .valid-feedback, +.was-validated .form-check-input:valid ~ .valid-tooltip, .form-check-input.is-valid ~ .valid-feedback, +.form-check-input.is-valid ~ .valid-tooltip { + display: block; +} + +.was-validated .custom-control-input:valid ~ .custom-control-label, .custom-control-input.is-valid ~ .custom-control-label { + color: #28a745; +} + +.was-validated .custom-control-input:valid ~ .custom-control-label::before, .custom-control-input.is-valid ~ .custom-control-label::before { + background-color: #71dd8a; +} + +.was-validated .custom-control-input:valid ~ .valid-feedback, +.was-validated .custom-control-input:valid ~ .valid-tooltip, .custom-control-input.is-valid ~ .valid-feedback, +.custom-control-input.is-valid ~ .valid-tooltip { + display: block; +} + +.was-validated .custom-control-input:valid:checked ~ .custom-control-label::before, .custom-control-input.is-valid:checked ~ .custom-control-label::before { + background-color: #34ce57; +} + +.was-validated .custom-control-input:valid:focus ~ .custom-control-label::before, .custom-control-input.is-valid:focus ~ .custom-control-label::before { + box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(40, 167, 69, 0.25); +} + +.was-validated .custom-file-input:valid ~ .custom-file-label, .custom-file-input.is-valid ~ .custom-file-label { + border-color: #28a745; +} + +.was-validated .custom-file-input:valid ~ .custom-file-label::before, .custom-file-input.is-valid ~ .custom-file-label::before { + border-color: inherit; +} + +.was-validated .custom-file-input:valid ~ .valid-feedback, +.was-validated .custom-file-input:valid ~ .valid-tooltip, .custom-file-input.is-valid ~ .valid-feedback, +.custom-file-input.is-valid ~ .valid-tooltip { + display: block; +} + +.was-validated .custom-file-input:valid:focus ~ .custom-file-label, .custom-file-input.is-valid:focus ~ .custom-file-label { + box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25); +} + +.invalid-feedback { + display: none; + width: 100%; + margin-top: 0.25rem; + font-size: 80%; + color: #dc3545; +} + +.invalid-tooltip { + position: absolute; + top: 100%; + z-index: 5; + display: none; + max-width: 100%; + padding: .5rem; + margin-top: .1rem; + font-size: .875rem; + line-height: 1; + color: #fff; + background-color: rgba(220, 53, 69, 0.8); + border-radius: .2rem; +} + +.was-validated .form-control:invalid, .form-control.is-invalid, .was-validated +.custom-select:invalid, +.custom-select.is-invalid { + border-color: #dc3545; +} + +.was-validated .form-control:invalid:focus, .form-control.is-invalid:focus, .was-validated +.custom-select:invalid:focus, +.custom-select.is-invalid:focus { + border-color: #dc3545; + box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25); +} + +.was-validated .form-control:invalid ~ .invalid-feedback, +.was-validated .form-control:invalid ~ .invalid-tooltip, .form-control.is-invalid ~ .invalid-feedback, +.form-control.is-invalid ~ .invalid-tooltip, .was-validated +.custom-select:invalid ~ .invalid-feedback, +.was-validated +.custom-select:invalid ~ .invalid-tooltip, +.custom-select.is-invalid ~ .invalid-feedback, +.custom-select.is-invalid ~ .invalid-tooltip { + display: block; +} + +.was-validated .form-check-input:invalid ~ .form-check-label, .form-check-input.is-invalid ~ .form-check-label { + color: #dc3545; +} + +.was-validated .form-check-input:invalid ~ .invalid-feedback, +.was-validated .form-check-input:invalid ~ .invalid-tooltip, .form-check-input.is-invalid ~ .invalid-feedback, +.form-check-input.is-invalid ~ .invalid-tooltip { + display: block; +} + +.was-validated .custom-control-input:invalid ~ .custom-control-label, .custom-control-input.is-invalid ~ .custom-control-label { + color: #dc3545; +} + +.was-validated .custom-control-input:invalid ~ .custom-control-label::before, .custom-control-input.is-invalid ~ .custom-control-label::before { + background-color: #efa2a9; +} + +.was-validated .custom-control-input:invalid ~ .invalid-feedback, +.was-validated .custom-control-input:invalid ~ .invalid-tooltip, .custom-control-input.is-invalid ~ .invalid-feedback, +.custom-control-input.is-invalid ~ .invalid-tooltip { + display: block; +} + +.was-validated .custom-control-input:invalid:checked ~ .custom-control-label::before, .custom-control-input.is-invalid:checked ~ .custom-control-label::before { + background-color: #e4606d; +} + +.was-validated .custom-control-input:invalid:focus ~ .custom-control-label::before, .custom-control-input.is-invalid:focus ~ .custom-control-label::before { + box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(220, 53, 69, 0.25); +} + +.was-validated .custom-file-input:invalid ~ .custom-file-label, .custom-file-input.is-invalid ~ .custom-file-label { + border-color: #dc3545; +} + +.was-validated .custom-file-input:invalid ~ .custom-file-label::before, .custom-file-input.is-invalid ~ .custom-file-label::before { + border-color: inherit; +} + +.was-validated .custom-file-input:invalid ~ .invalid-feedback, +.was-validated .custom-file-input:invalid ~ .invalid-tooltip, .custom-file-input.is-invalid ~ .invalid-feedback, +.custom-file-input.is-invalid ~ .invalid-tooltip { + display: block; +} + +.was-validated .custom-file-input:invalid:focus ~ .custom-file-label, .custom-file-input.is-invalid:focus ~ .custom-file-label { + box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25); +} + +.form-inline { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row wrap; + flex-flow: row wrap; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; +} + +.form-inline .form-check { + width: 100%; +} + +@media (min-width: 576px) { + .form-inline label { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + margin-bottom: 0; + } + .form-inline .form-group { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-flex: 0; + -ms-flex: 0 0 auto; + flex: 0 0 auto; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row wrap; + flex-flow: row wrap; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + margin-bottom: 0; + } + .form-inline .form-control { + display: inline-block; + width: auto; + vertical-align: middle; + } + .form-inline .form-control-plaintext { + display: inline-block; + } + .form-inline .input-group { + width: auto; + } + .form-inline .form-check { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + width: auto; + padding-left: 0; + } + .form-inline .form-check-input { + position: relative; + margin-top: 0; + margin-right: 0.25rem; + margin-left: 0; + } + .form-inline .custom-control { + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + } + .form-inline .custom-control-label { + margin-bottom: 0; + } +} + +.btn { + display: inline-block; + font-weight: 400; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + border: 1px solid transparent; + padding: 0.375rem 0.75rem; + font-size: 1rem; + line-height: 1.5; + border-radius: 0.25rem; + transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; +} + +.btn:hover, .btn:focus { + text-decoration: none; +} + +.btn:focus, .btn.focus { + outline: 0; + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); +} + +.btn.disabled, .btn:disabled { + opacity: 0.65; +} + +.btn:not(:disabled):not(.disabled) { + cursor: pointer; +} + +.btn:not(:disabled):not(.disabled):active, .btn:not(:disabled):not(.disabled).active { + background-image: none; +} + +a.btn.disabled, +fieldset:disabled a.btn { + pointer-events: none; +} + +.btn-primary { + color: #fff; + background-color: #007bff; + border-color: #007bff; +} + +.btn-primary:hover { + color: #fff; + background-color: #0069d9; + border-color: #0062cc; +} + +.btn-primary:focus, .btn-primary.focus { + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); +} + +.btn-primary.disabled, .btn-primary:disabled { + color: #fff; + background-color: #007bff; + border-color: #007bff; +} + +.btn-primary:not(:disabled):not(.disabled):active, .btn-primary:not(:disabled):not(.disabled).active, +.show > .btn-primary.dropdown-toggle { + color: #fff; + background-color: #0062cc; + border-color: #005cbf; +} + +.btn-primary:not(:disabled):not(.disabled):active:focus, .btn-primary:not(:disabled):not(.disabled).active:focus, +.show > .btn-primary.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); +} + +.btn-secondary { + color: #fff; + background-color: #6c757d; + border-color: #6c757d; +} + +.btn-secondary:hover { + color: #fff; + background-color: #5a6268; + border-color: #545b62; +} + +.btn-secondary:focus, .btn-secondary.focus { + box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); +} + +.btn-secondary.disabled, .btn-secondary:disabled { + color: #fff; + background-color: #6c757d; + border-color: #6c757d; +} + +.btn-secondary:not(:disabled):not(.disabled):active, .btn-secondary:not(:disabled):not(.disabled).active, +.show > .btn-secondary.dropdown-toggle { + color: #fff; + background-color: #545b62; + border-color: #4e555b; +} + +.btn-secondary:not(:disabled):not(.disabled):active:focus, .btn-secondary:not(:disabled):not(.disabled).active:focus, +.show > .btn-secondary.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); +} + +.btn-success { + color: #fff; + background-color: #28a745; + border-color: #28a745; +} + +.btn-success:hover { + color: #fff; + background-color: #218838; + border-color: #1e7e34; +} + +.btn-success:focus, .btn-success.focus { + box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5); +} + +.btn-success.disabled, .btn-success:disabled { + color: #fff; + background-color: #28a745; + border-color: #28a745; +} + +.btn-success:not(:disabled):not(.disabled):active, .btn-success:not(:disabled):not(.disabled).active, +.show > .btn-success.dropdown-toggle { + color: #fff; + background-color: #1e7e34; + border-color: #1c7430; +} + +.btn-success:not(:disabled):not(.disabled):active:focus, .btn-success:not(:disabled):not(.disabled).active:focus, +.show > .btn-success.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5); +} + +.btn-info { + color: #fff; + background-color: #17a2b8; + border-color: #17a2b8; +} + +.btn-info:hover { + color: #fff; + background-color: #138496; + border-color: #117a8b; +} + +.btn-info:focus, .btn-info.focus { + box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5); +} + +.btn-info.disabled, .btn-info:disabled { + color: #fff; + background-color: #17a2b8; + border-color: #17a2b8; +} + +.btn-info:not(:disabled):not(.disabled):active, .btn-info:not(:disabled):not(.disabled).active, +.show > .btn-info.dropdown-toggle { + color: #fff; + background-color: #117a8b; + border-color: #10707f; +} + +.btn-info:not(:disabled):not(.disabled):active:focus, .btn-info:not(:disabled):not(.disabled).active:focus, +.show > .btn-info.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5); +} + +.btn-warning { + color: #212529; + background-color: #ffc107; + border-color: #ffc107; +} + +.btn-warning:hover { + color: #212529; + background-color: #e0a800; + border-color: #d39e00; +} + +.btn-warning:focus, .btn-warning.focus { + box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5); +} + +.btn-warning.disabled, .btn-warning:disabled { + color: #212529; + background-color: #ffc107; + border-color: #ffc107; +} + +.btn-warning:not(:disabled):not(.disabled):active, .btn-warning:not(:disabled):not(.disabled).active, +.show > .btn-warning.dropdown-toggle { + color: #212529; + background-color: #d39e00; + border-color: #c69500; +} + +.btn-warning:not(:disabled):not(.disabled):active:focus, .btn-warning:not(:disabled):not(.disabled).active:focus, +.show > .btn-warning.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5); +} + +.btn-danger { + color: #fff; + background-color: #dc3545; + border-color: #dc3545; +} + +.btn-danger:hover { + color: #fff; + background-color: #c82333; + border-color: #bd2130; +} + +.btn-danger:focus, .btn-danger.focus { + box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); +} + +.btn-danger.disabled, .btn-danger:disabled { + color: #fff; + background-color: #dc3545; + border-color: #dc3545; +} + +.btn-danger:not(:disabled):not(.disabled):active, .btn-danger:not(:disabled):not(.disabled).active, +.show > .btn-danger.dropdown-toggle { + color: #fff; + background-color: #bd2130; + border-color: #b21f2d; +} + +.btn-danger:not(:disabled):not(.disabled):active:focus, .btn-danger:not(:disabled):not(.disabled).active:focus, +.show > .btn-danger.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); +} + +.btn-light { + color: #212529; + background-color: #f8f9fa; + border-color: #f8f9fa; +} + +.btn-light:hover { + color: #212529; + background-color: #e2e6ea; + border-color: #dae0e5; +} + +.btn-light:focus, .btn-light.focus { + box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5); +} + +.btn-light.disabled, .btn-light:disabled { + color: #212529; + background-color: #f8f9fa; + border-color: #f8f9fa; +} + +.btn-light:not(:disabled):not(.disabled):active, .btn-light:not(:disabled):not(.disabled).active, +.show > .btn-light.dropdown-toggle { + color: #212529; + background-color: #dae0e5; + border-color: #d3d9df; +} + +.btn-light:not(:disabled):not(.disabled):active:focus, .btn-light:not(:disabled):not(.disabled).active:focus, +.show > .btn-light.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5); +} + +.btn-dark { + color: #fff; + background-color: #343a40; + border-color: #343a40; +} + +.btn-dark:hover { + color: #fff; + background-color: #23272b; + border-color: #1d2124; +} + +.btn-dark:focus, .btn-dark.focus { + box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5); +} + +.btn-dark.disabled, .btn-dark:disabled { + color: #fff; + background-color: #343a40; + border-color: #343a40; +} + +.btn-dark:not(:disabled):not(.disabled):active, .btn-dark:not(:disabled):not(.disabled).active, +.show > .btn-dark.dropdown-toggle { + color: #fff; + background-color: #1d2124; + border-color: #171a1d; +} + +.btn-dark:not(:disabled):not(.disabled):active:focus, .btn-dark:not(:disabled):not(.disabled).active:focus, +.show > .btn-dark.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5); +} + +.btn-outline-primary { + color: #007bff; + background-color: transparent; + background-image: none; + border-color: #007bff; +} + +.btn-outline-primary:hover { + color: #fff; + background-color: #007bff; + border-color: #007bff; +} + +.btn-outline-primary:focus, .btn-outline-primary.focus { + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); +} + +.btn-outline-primary.disabled, .btn-outline-primary:disabled { + color: #007bff; + background-color: transparent; +} + +.btn-outline-primary:not(:disabled):not(.disabled):active, .btn-outline-primary:not(:disabled):not(.disabled).active, +.show > .btn-outline-primary.dropdown-toggle { + color: #fff; + background-color: #007bff; + border-color: #007bff; +} + +.btn-outline-primary:not(:disabled):not(.disabled):active:focus, .btn-outline-primary:not(:disabled):not(.disabled).active:focus, +.show > .btn-outline-primary.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5); +} + +.btn-outline-secondary { + color: #6c757d; + background-color: transparent; + background-image: none; + border-color: #6c757d; +} + +.btn-outline-secondary:hover { + color: #fff; + background-color: #6c757d; + border-color: #6c757d; +} + +.btn-outline-secondary:focus, .btn-outline-secondary.focus { + box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); +} + +.btn-outline-secondary.disabled, .btn-outline-secondary:disabled { + color: #6c757d; + background-color: transparent; +} + +.btn-outline-secondary:not(:disabled):not(.disabled):active, .btn-outline-secondary:not(:disabled):not(.disabled).active, +.show > .btn-outline-secondary.dropdown-toggle { + color: #fff; + background-color: #6c757d; + border-color: #6c757d; +} + +.btn-outline-secondary:not(:disabled):not(.disabled):active:focus, .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, +.show > .btn-outline-secondary.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); +} + +.btn-outline-success { + color: #28a745; + background-color: transparent; + background-image: none; + border-color: #28a745; +} + +.btn-outline-success:hover { + color: #fff; + background-color: #28a745; + border-color: #28a745; +} + +.btn-outline-success:focus, .btn-outline-success.focus { + box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5); +} + +.btn-outline-success.disabled, .btn-outline-success:disabled { + color: #28a745; + background-color: transparent; +} + +.btn-outline-success:not(:disabled):not(.disabled):active, .btn-outline-success:not(:disabled):not(.disabled).active, +.show > .btn-outline-success.dropdown-toggle { + color: #fff; + background-color: #28a745; + border-color: #28a745; +} + +.btn-outline-success:not(:disabled):not(.disabled):active:focus, .btn-outline-success:not(:disabled):not(.disabled).active:focus, +.show > .btn-outline-success.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5); +} + +.btn-outline-info { + color: #17a2b8; + background-color: transparent; + background-image: none; + border-color: #17a2b8; +} + +.btn-outline-info:hover { + color: #fff; + background-color: #17a2b8; + border-color: #17a2b8; +} + +.btn-outline-info:focus, .btn-outline-info.focus { + box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5); +} + +.btn-outline-info.disabled, .btn-outline-info:disabled { + color: #17a2b8; + background-color: transparent; +} + +.btn-outline-info:not(:disabled):not(.disabled):active, .btn-outline-info:not(:disabled):not(.disabled).active, +.show > .btn-outline-info.dropdown-toggle { + color: #fff; + background-color: #17a2b8; + border-color: #17a2b8; +} + +.btn-outline-info:not(:disabled):not(.disabled):active:focus, .btn-outline-info:not(:disabled):not(.disabled).active:focus, +.show > .btn-outline-info.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5); +} + +.btn-outline-warning { + color: #ffc107; + background-color: transparent; + background-image: none; + border-color: #ffc107; +} + +.btn-outline-warning:hover { + color: #212529; + background-color: #ffc107; + border-color: #ffc107; +} + +.btn-outline-warning:focus, .btn-outline-warning.focus { + box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5); +} + +.btn-outline-warning.disabled, .btn-outline-warning:disabled { + color: #ffc107; + background-color: transparent; +} + +.btn-outline-warning:not(:disabled):not(.disabled):active, .btn-outline-warning:not(:disabled):not(.disabled).active, +.show > .btn-outline-warning.dropdown-toggle { + color: #212529; + background-color: #ffc107; + border-color: #ffc107; +} + +.btn-outline-warning:not(:disabled):not(.disabled):active:focus, .btn-outline-warning:not(:disabled):not(.disabled).active:focus, +.show > .btn-outline-warning.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5); +} + +.btn-outline-danger { + color: #dc3545; + background-color: transparent; + background-image: none; + border-color: #dc3545; +} + +.btn-outline-danger:hover { + color: #fff; + background-color: #dc3545; + border-color: #dc3545; +} + +.btn-outline-danger:focus, .btn-outline-danger.focus { + box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); +} + +.btn-outline-danger.disabled, .btn-outline-danger:disabled { + color: #dc3545; + background-color: transparent; +} + +.btn-outline-danger:not(:disabled):not(.disabled):active, .btn-outline-danger:not(:disabled):not(.disabled).active, +.show > .btn-outline-danger.dropdown-toggle { + color: #fff; + background-color: #dc3545; + border-color: #dc3545; +} + +.btn-outline-danger:not(:disabled):not(.disabled):active:focus, .btn-outline-danger:not(:disabled):not(.disabled).active:focus, +.show > .btn-outline-danger.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); +} + +.btn-outline-light { + color: #f8f9fa; + background-color: transparent; + background-image: none; + border-color: #f8f9fa; +} + +.btn-outline-light:hover { + color: #212529; + background-color: #f8f9fa; + border-color: #f8f9fa; +} + +.btn-outline-light:focus, .btn-outline-light.focus { + box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5); +} + +.btn-outline-light.disabled, .btn-outline-light:disabled { + color: #f8f9fa; + background-color: transparent; +} + +.btn-outline-light:not(:disabled):not(.disabled):active, .btn-outline-light:not(:disabled):not(.disabled).active, +.show > .btn-outline-light.dropdown-toggle { + color: #212529; + background-color: #f8f9fa; + border-color: #f8f9fa; +} + +.btn-outline-light:not(:disabled):not(.disabled):active:focus, .btn-outline-light:not(:disabled):not(.disabled).active:focus, +.show > .btn-outline-light.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5); +} + +.btn-outline-dark { + color: #343a40; + background-color: transparent; + background-image: none; + border-color: #343a40; +} + +.btn-outline-dark:hover { + color: #fff; + background-color: #343a40; + border-color: #343a40; +} + +.btn-outline-dark:focus, .btn-outline-dark.focus { + box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5); +} + +.btn-outline-dark.disabled, .btn-outline-dark:disabled { + color: #343a40; + background-color: transparent; +} + +.btn-outline-dark:not(:disabled):not(.disabled):active, .btn-outline-dark:not(:disabled):not(.disabled).active, +.show > .btn-outline-dark.dropdown-toggle { + color: #fff; + background-color: #343a40; + border-color: #343a40; +} + +.btn-outline-dark:not(:disabled):not(.disabled):active:focus, .btn-outline-dark:not(:disabled):not(.disabled).active:focus, +.show > .btn-outline-dark.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5); +} + +.btn-link { + font-weight: 400; + color: #007bff; + background-color: transparent; +} + +.btn-link:hover { + color: #0056b3; + text-decoration: underline; + background-color: transparent; + border-color: transparent; +} + +.btn-link:focus, .btn-link.focus { + text-decoration: underline; + border-color: transparent; + box-shadow: none; +} + +.btn-link:disabled, .btn-link.disabled { + color: #6c757d; +} + +.btn-lg, .btn-group-lg > .btn { + padding: 0.5rem 1rem; + font-size: 1.25rem; + line-height: 1.5; + border-radius: 0.3rem; +} + +.btn-sm, .btn-group-sm > .btn { + padding: 0.25rem 0.5rem; + font-size: 0.875rem; + line-height: 1.5; + border-radius: 0.2rem; +} + +.btn-block { + display: block; + width: 100%; +} + +.btn-block + .btn-block { + margin-top: 0.5rem; +} + +input[type="submit"].btn-block, +input[type="reset"].btn-block, +input[type="button"].btn-block { + width: 100%; +} + +.fade { + opacity: 0; + transition: opacity 0.15s linear; +} + +.fade.show { + opacity: 1; +} + +.collapse { + display: none; +} + +.collapse.show { + display: block; +} + +tr.collapse.show { + display: table-row; +} + +tbody.collapse.show { + display: table-row-group; +} + +.collapsing { + position: relative; + height: 0; + overflow: hidden; + transition: height 0.35s ease; +} + +.dropup, +.dropdown { + position: relative; +} + +.dropdown-toggle::after { + display: inline-block; + width: 0; + height: 0; + margin-left: 0.255em; + vertical-align: 0.255em; + content: ""; + border-top: 0.3em solid; + border-right: 0.3em solid transparent; + border-bottom: 0; + border-left: 0.3em solid transparent; +} + +.dropdown-toggle:empty::after { + margin-left: 0; +} + +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 10rem; + padding: 0.5rem 0; + margin: 0.125rem 0 0; + font-size: 1rem; + color: #212529; + text-align: left; + list-style: none; + background-color: #fff; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, 0.15); + border-radius: 0.25rem; +} + +.dropup .dropdown-menu { + margin-top: 0; + margin-bottom: 0.125rem; +} + +.dropup .dropdown-toggle::after { + display: inline-block; + width: 0; + height: 0; + margin-left: 0.255em; + vertical-align: 0.255em; + content: ""; + border-top: 0; + border-right: 0.3em solid transparent; + border-bottom: 0.3em solid; + border-left: 0.3em solid transparent; +} + +.dropup .dropdown-toggle:empty::after { + margin-left: 0; +} + +.dropright .dropdown-menu { + margin-top: 0; + margin-left: 0.125rem; +} + +.dropright .dropdown-toggle::after { + display: inline-block; + width: 0; + height: 0; + margin-left: 0.255em; + vertical-align: 0.255em; + content: ""; + border-top: 0.3em solid transparent; + border-bottom: 0.3em solid transparent; + border-left: 0.3em solid; +} + +.dropright .dropdown-toggle:empty::after { + margin-left: 0; +} + +.dropright .dropdown-toggle::after { + vertical-align: 0; +} + +.dropleft .dropdown-menu { + margin-top: 0; + margin-right: 0.125rem; +} + +.dropleft .dropdown-toggle::after { + display: inline-block; + width: 0; + height: 0; + margin-left: 0.255em; + vertical-align: 0.255em; + content: ""; +} + +.dropleft .dropdown-toggle::after { + display: none; +} + +.dropleft .dropdown-toggle::before { + display: inline-block; + width: 0; + height: 0; + margin-right: 0.255em; + vertical-align: 0.255em; + content: ""; + border-top: 0.3em solid transparent; + border-right: 0.3em solid; + border-bottom: 0.3em solid transparent; +} + +.dropleft .dropdown-toggle:empty::after { + margin-left: 0; +} + +.dropleft .dropdown-toggle::before { + vertical-align: 0; +} + +.dropdown-divider { + height: 0; + margin: 0.5rem 0; + overflow: hidden; + border-top: 1px solid #e9ecef; +} + +.dropdown-item { + display: block; + width: 100%; + padding: 0.25rem 1.5rem; + clear: both; + font-weight: 400; + color: #212529; + text-align: inherit; + white-space: nowrap; + background-color: transparent; + border: 0; +} + +.dropdown-item:hover, .dropdown-item:focus { + color: #16181b; + text-decoration: none; + background-color: #f8f9fa; +} + +.dropdown-item.active, .dropdown-item:active { + color: #fff; + text-decoration: none; + background-color: #007bff; +} + +.dropdown-item.disabled, .dropdown-item:disabled { + color: #6c757d; + background-color: transparent; +} + +.dropdown-menu.show { + display: block; +} + +.dropdown-header { + display: block; + padding: 0.5rem 1.5rem; + margin-bottom: 0; + font-size: 0.875rem; + color: #6c757d; + white-space: nowrap; +} + +.btn-group, +.btn-group-vertical { + position: relative; + display: -webkit-inline-box; + display: -ms-inline-flexbox; + display: inline-flex; + vertical-align: middle; +} + +.btn-group > .btn, +.btn-group-vertical > .btn { + position: relative; + -webkit-box-flex: 0; + -ms-flex: 0 1 auto; + flex: 0 1 auto; +} + +.btn-group > .btn:hover, +.btn-group-vertical > .btn:hover { + z-index: 1; +} + +.btn-group > .btn:focus, .btn-group > .btn:active, .btn-group > .btn.active, +.btn-group-vertical > .btn:focus, +.btn-group-vertical > .btn:active, +.btn-group-vertical > .btn.active { + z-index: 1; +} + +.btn-group .btn + .btn, +.btn-group .btn + .btn-group, +.btn-group .btn-group + .btn, +.btn-group .btn-group + .btn-group, +.btn-group-vertical .btn + .btn, +.btn-group-vertical .btn + .btn-group, +.btn-group-vertical .btn-group + .btn, +.btn-group-vertical .btn-group + .btn-group { + margin-left: -1px; +} + +.btn-toolbar { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + -webkit-box-pack: start; + -ms-flex-pack: start; + justify-content: flex-start; +} + +.btn-toolbar .input-group { + width: auto; +} + +.btn-group > .btn:first-child { + margin-left: 0; +} + +.btn-group > .btn:not(:last-child):not(.dropdown-toggle), +.btn-group > .btn-group:not(:last-child) > .btn { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} + +.btn-group > .btn:not(:first-child), +.btn-group > .btn-group:not(:first-child) > .btn { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} + +.dropdown-toggle-split { + padding-right: 0.5625rem; + padding-left: 0.5625rem; +} + +.dropdown-toggle-split::after { + margin-left: 0; +} + +.btn-sm + .dropdown-toggle-split, .btn-group-sm > .btn + .dropdown-toggle-split { + padding-right: 0.375rem; + padding-left: 0.375rem; +} + +.btn-lg + .dropdown-toggle-split, .btn-group-lg > .btn + .dropdown-toggle-split { + padding-right: 0.75rem; + padding-left: 0.75rem; +} + +.btn-group-vertical { + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-align: start; + -ms-flex-align: start; + align-items: flex-start; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; +} + +.btn-group-vertical .btn, +.btn-group-vertical .btn-group { + width: 100%; +} + +.btn-group-vertical > .btn + .btn, +.btn-group-vertical > .btn + .btn-group, +.btn-group-vertical > .btn-group + .btn, +.btn-group-vertical > .btn-group + .btn-group { + margin-top: -1px; + margin-left: 0; +} + +.btn-group-vertical > .btn:not(:last-child):not(.dropdown-toggle), +.btn-group-vertical > .btn-group:not(:last-child) > .btn { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} + +.btn-group-vertical > .btn:not(:first-child), +.btn-group-vertical > .btn-group:not(:first-child) > .btn { + border-top-left-radius: 0; + border-top-right-radius: 0; +} + +.btn-group-toggle > .btn, +.btn-group-toggle > .btn-group > .btn { + margin-bottom: 0; +} + +.btn-group-toggle > .btn input[type="radio"], +.btn-group-toggle > .btn input[type="checkbox"], +.btn-group-toggle > .btn-group > .btn input[type="radio"], +.btn-group-toggle > .btn-group > .btn input[type="checkbox"] { + position: absolute; + clip: rect(0, 0, 0, 0); + pointer-events: none; +} + +.input-group { + position: relative; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + -webkit-box-align: stretch; + -ms-flex-align: stretch; + align-items: stretch; + width: 100%; +} + +.input-group > .form-control, +.input-group > .custom-select, +.input-group > .custom-file { + position: relative; + -webkit-box-flex: 1; + -ms-flex: 1 1 auto; + flex: 1 1 auto; + width: 1%; + margin-bottom: 0; +} + +.input-group > .form-control:focus, +.input-group > .custom-select:focus, +.input-group > .custom-file:focus { + z-index: 3; +} + +.input-group > .form-control + .form-control, +.input-group > .form-control + .custom-select, +.input-group > .form-control + .custom-file, +.input-group > .custom-select + .form-control, +.input-group > .custom-select + .custom-select, +.input-group > .custom-select + .custom-file, +.input-group > .custom-file + .form-control, +.input-group > .custom-file + .custom-select, +.input-group > .custom-file + .custom-file { + margin-left: -1px; +} + +.input-group > .form-control:not(:last-child), +.input-group > .custom-select:not(:last-child) { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} + +.input-group > .form-control:not(:first-child), +.input-group > .custom-select:not(:first-child) { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} + +.input-group > .custom-file { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; +} + +.input-group > .custom-file:not(:last-child) .custom-file-label, +.input-group > .custom-file:not(:last-child) .custom-file-label::before { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} + +.input-group > .custom-file:not(:first-child) .custom-file-label, +.input-group > .custom-file:not(:first-child) .custom-file-label::before { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} + +.input-group-prepend, +.input-group-append { + display: -webkit-box; + display: -ms-flexbox; + display: flex; +} + +.input-group-prepend .btn, +.input-group-append .btn { + position: relative; + z-index: 2; +} + +.input-group-prepend .btn + .btn, +.input-group-prepend .btn + .input-group-text, +.input-group-prepend .input-group-text + .input-group-text, +.input-group-prepend .input-group-text + .btn, +.input-group-append .btn + .btn, +.input-group-append .btn + .input-group-text, +.input-group-append .input-group-text + .input-group-text, +.input-group-append .input-group-text + .btn { + margin-left: -1px; +} + +.input-group-prepend { + margin-right: -1px; +} + +.input-group-append { + margin-left: -1px; +} + +.input-group-text { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + padding: 0.375rem 0.75rem; + margin-bottom: 0; + font-size: 1rem; + font-weight: 400; + line-height: 1.5; + color: #495057; + text-align: center; + white-space: nowrap; + background-color: #e9ecef; + border: 1px solid #ced4da; + border-radius: 0.25rem; +} + +.input-group-text input[type="radio"], +.input-group-text input[type="checkbox"] { + margin-top: 0; +} + +.input-group > .input-group-prepend > .btn, +.input-group > .input-group-prepend > .input-group-text, +.input-group > .input-group-append:not(:last-child) > .btn, +.input-group > .input-group-append:not(:last-child) > .input-group-text, +.input-group > .input-group-append:last-child > .btn:not(:last-child):not(.dropdown-toggle), +.input-group > .input-group-append:last-child > .input-group-text:not(:last-child) { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} + +.input-group > .input-group-append > .btn, +.input-group > .input-group-append > .input-group-text, +.input-group > .input-group-prepend:not(:first-child) > .btn, +.input-group > .input-group-prepend:not(:first-child) > .input-group-text, +.input-group > .input-group-prepend:first-child > .btn:not(:first-child), +.input-group > .input-group-prepend:first-child > .input-group-text:not(:first-child) { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} + +.custom-control { + position: relative; + display: block; + min-height: 1.5rem; + padding-left: 1.5rem; +} + +.custom-control-inline { + display: -webkit-inline-box; + display: -ms-inline-flexbox; + display: inline-flex; + margin-right: 1rem; +} + +.custom-control-input { + position: absolute; + z-index: -1; + opacity: 0; +} + +.custom-control-input:checked ~ .custom-control-label::before { + color: #fff; + background-color: #007bff; +} + +.custom-control-input:focus ~ .custom-control-label::before { + box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(0, 123, 255, 0.25); +} + +.custom-control-input:active ~ .custom-control-label::before { + color: #fff; + background-color: #b3d7ff; +} + +.custom-control-input:disabled ~ .custom-control-label { + color: #6c757d; +} + +.custom-control-input:disabled ~ .custom-control-label::before { + background-color: #e9ecef; +} + +.custom-control-label { + margin-bottom: 0; +} + +.custom-control-label::before { + position: absolute; + top: 0.25rem; + left: 0; + display: block; + width: 1rem; + height: 1rem; + pointer-events: none; + content: ""; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #dee2e6; +} + +.custom-control-label::after { + position: absolute; + top: 0.25rem; + left: 0; + display: block; + width: 1rem; + height: 1rem; + content: ""; + background-repeat: no-repeat; + background-position: center center; + background-size: 50% 50%; +} + +.custom-checkbox .custom-control-label::before { + border-radius: 0.25rem; +} + +.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before { + background-color: #007bff; +} + +.custom-checkbox .custom-control-input:checked ~ .custom-control-label::after { + background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3E%3C/svg%3E"); +} + +.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::before { + background-color: #007bff; +} + +.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-label::after { + background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4'%3E%3Cpath stroke='%23fff' d='M0 2h4'/%3E%3C/svg%3E"); +} + +.custom-checkbox .custom-control-input:disabled:checked ~ .custom-control-label::before { + background-color: rgba(0, 123, 255, 0.5); +} + +.custom-checkbox .custom-control-input:disabled:indeterminate ~ .custom-control-label::before { + background-color: rgba(0, 123, 255, 0.5); +} + +.custom-radio .custom-control-label::before { + border-radius: 50%; +} + +.custom-radio .custom-control-input:checked ~ .custom-control-label::before { + background-color: #007bff; +} + +.custom-radio .custom-control-input:checked ~ .custom-control-label::after { + background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E"); +} + +.custom-radio .custom-control-input:disabled:checked ~ .custom-control-label::before { + background-color: rgba(0, 123, 255, 0.5); +} + +.custom-select { + display: inline-block; + width: 100%; + height: calc(2.25rem + 2px); + padding: 0.375rem 1.75rem 0.375rem 0.75rem; + line-height: 1.5; + color: #495057; + vertical-align: middle; + background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right 0.75rem center; + background-size: 8px 10px; + border: 1px solid #ced4da; + border-radius: 0.25rem; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} + +.custom-select:focus { + border-color: #80bdff; + outline: 0; + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.075), 0 0 5px rgba(128, 189, 255, 0.5); +} + +.custom-select:focus::-ms-value { + color: #495057; + background-color: #fff; +} + +.custom-select[multiple], .custom-select[size]:not([size="1"]) { + height: auto; + padding-right: 0.75rem; + background-image: none; +} + +.custom-select:disabled { + color: #6c757d; + background-color: #e9ecef; +} + +.custom-select::-ms-expand { + opacity: 0; +} + +.custom-select-sm { + height: calc(1.8125rem + 2px); + padding-top: 0.375rem; + padding-bottom: 0.375rem; + font-size: 75%; +} + +.custom-select-lg { + height: calc(2.875rem + 2px); + padding-top: 0.375rem; + padding-bottom: 0.375rem; + font-size: 125%; +} + +.custom-file { + position: relative; + display: inline-block; + width: 100%; + height: calc(2.25rem + 2px); + margin-bottom: 0; +} + +.custom-file-input { + position: relative; + z-index: 2; + width: 100%; + height: calc(2.25rem + 2px); + margin: 0; + opacity: 0; +} + +.custom-file-input:focus ~ .custom-file-control { + border-color: #80bdff; + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); +} + +.custom-file-input:focus ~ .custom-file-control::before { + border-color: #80bdff; +} + +.custom-file-input:lang(en) ~ .custom-file-label::after { + content: "Browse"; +} + +.custom-file-label { + position: absolute; + top: 0; + right: 0; + left: 0; + z-index: 1; + height: calc(2.25rem + 2px); + padding: 0.375rem 0.75rem; + line-height: 1.5; + color: #495057; + background-color: #fff; + border: 1px solid #ced4da; + border-radius: 0.25rem; +} + +.custom-file-label::after { + position: absolute; + top: 0; + right: 0; + bottom: 0; + z-index: 3; + display: block; + height: calc(calc(2.25rem + 2px) - 1px * 2); + padding: 0.375rem 0.75rem; + line-height: 1.5; + color: #495057; + content: "Browse"; + background-color: #e9ecef; + border-left: 1px solid #ced4da; + border-radius: 0 0.25rem 0.25rem 0; +} + +.nav { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + padding-left: 0; + margin-bottom: 0; + list-style: none; +} + +.nav-link { + display: block; + padding: 0.5rem 1rem; +} + +.nav-link:hover, .nav-link:focus { + text-decoration: none; +} + +.nav-link.disabled { + color: #6c757d; +} + +.nav-tabs { + border-bottom: 1px solid #dee2e6; +} + +.nav-tabs .nav-item { + margin-bottom: -1px; +} + +.nav-tabs .nav-link { + border: 1px solid transparent; + border-top-left-radius: 0.25rem; + border-top-right-radius: 0.25rem; +} + +.nav-tabs .nav-link:hover, .nav-tabs .nav-link:focus { + border-color: #e9ecef #e9ecef #dee2e6; +} + +.nav-tabs .nav-link.disabled { + color: #6c757d; + background-color: transparent; + border-color: transparent; +} + +.nav-tabs .nav-link.active, +.nav-tabs .nav-item.show .nav-link { + color: #495057; + background-color: #fff; + border-color: #dee2e6 #dee2e6 #fff; +} + +.nav-tabs .dropdown-menu { + margin-top: -1px; + border-top-left-radius: 0; + border-top-right-radius: 0; +} + +.nav-pills .nav-link { + border-radius: 0.25rem; +} + +.nav-pills .nav-link.active, +.nav-pills .show > .nav-link { + color: #fff; + background-color: #007bff; +} + +.nav-fill .nav-item { + -webkit-box-flex: 1; + -ms-flex: 1 1 auto; + flex: 1 1 auto; + text-align: center; +} + +.nav-justified .nav-item { + -ms-flex-preferred-size: 0; + flex-basis: 0; + -webkit-box-flex: 1; + -ms-flex-positive: 1; + flex-grow: 1; + text-align: center; +} + +.tab-content > .tab-pane { + display: none; +} + +.tab-content > .active { + display: block; +} + +.navbar { + position: relative; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; + padding: 0.5rem 1rem; +} + +.navbar > .container, +.navbar > .container-fluid { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +.navbar-brand { + display: inline-block; + padding-top: 0.3125rem; + padding-bottom: 0.3125rem; + margin-right: 1rem; + font-size: 1.25rem; + line-height: inherit; + white-space: nowrap; +} + +.navbar-brand:hover, .navbar-brand:focus { + text-decoration: none; +} + +.navbar-nav { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + padding-left: 0; + margin-bottom: 0; + list-style: none; +} + +.navbar-nav .nav-link { + padding-right: 0; + padding-left: 0; +} + +.navbar-nav .dropdown-menu { + position: static; + float: none; +} + +.navbar-text { + display: inline-block; + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} + +.navbar-collapse { + -ms-flex-preferred-size: 100%; + flex-basis: 100%; + -webkit-box-flex: 1; + -ms-flex-positive: 1; + flex-grow: 1; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; +} + +.navbar-toggler { + padding: 0.25rem 0.75rem; + font-size: 1.25rem; + line-height: 1; + background-color: transparent; + border: 1px solid transparent; + border-radius: 0.25rem; +} + +.navbar-toggler:hover, .navbar-toggler:focus { + text-decoration: none; +} + +.navbar-toggler:not(:disabled):not(.disabled) { + cursor: pointer; +} + +.navbar-toggler-icon { + display: inline-block; + width: 1.5em; + height: 1.5em; + vertical-align: middle; + content: ""; + background: no-repeat center center; + background-size: 100% 100%; +} + +@media (max-width: 575.98px) { + .navbar-expand-sm > .container, + .navbar-expand-sm > .container-fluid { + padding-right: 0; + padding-left: 0; + } +} + +@media (min-width: 576px) { + .navbar-expand-sm { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row nowrap; + flex-flow: row nowrap; + -webkit-box-pack: start; + -ms-flex-pack: start; + justify-content: flex-start; + } + .navbar-expand-sm .navbar-nav { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-direction: row; + flex-direction: row; + } + .navbar-expand-sm .navbar-nav .dropdown-menu { + position: absolute; + } + .navbar-expand-sm .navbar-nav .dropdown-menu-right { + right: 0; + left: auto; + } + .navbar-expand-sm .navbar-nav .nav-link { + padding-right: 0.5rem; + padding-left: 0.5rem; + } + .navbar-expand-sm > .container, + .navbar-expand-sm > .container-fluid { + -ms-flex-wrap: nowrap; + flex-wrap: nowrap; + } + .navbar-expand-sm .navbar-collapse { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; + -ms-flex-preferred-size: auto; + flex-basis: auto; + } + .navbar-expand-sm .navbar-toggler { + display: none; + } + .navbar-expand-sm .dropup .dropdown-menu { + top: auto; + bottom: 100%; + } +} + +@media (max-width: 767.98px) { + .navbar-expand-md > .container, + .navbar-expand-md > .container-fluid { + padding-right: 0; + padding-left: 0; + } +} + +@media (min-width: 768px) { + .navbar-expand-md { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row nowrap; + flex-flow: row nowrap; + -webkit-box-pack: start; + -ms-flex-pack: start; + justify-content: flex-start; + } + .navbar-expand-md .navbar-nav { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-direction: row; + flex-direction: row; + } + .navbar-expand-md .navbar-nav .dropdown-menu { + position: absolute; + } + .navbar-expand-md .navbar-nav .dropdown-menu-right { + right: 0; + left: auto; + } + .navbar-expand-md .navbar-nav .nav-link { + padding-right: 0.5rem; + padding-left: 0.5rem; + } + .navbar-expand-md > .container, + .navbar-expand-md > .container-fluid { + -ms-flex-wrap: nowrap; + flex-wrap: nowrap; + } + .navbar-expand-md .navbar-collapse { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; + -ms-flex-preferred-size: auto; + flex-basis: auto; + } + .navbar-expand-md .navbar-toggler { + display: none; + } + .navbar-expand-md .dropup .dropdown-menu { + top: auto; + bottom: 100%; + } +} + +@media (max-width: 991.98px) { + .navbar-expand-lg > .container, + .navbar-expand-lg > .container-fluid { + padding-right: 0; + padding-left: 0; + } +} + +@media (min-width: 992px) { + .navbar-expand-lg { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row nowrap; + flex-flow: row nowrap; + -webkit-box-pack: start; + -ms-flex-pack: start; + justify-content: flex-start; + } + .navbar-expand-lg .navbar-nav { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-direction: row; + flex-direction: row; + } + .navbar-expand-lg .navbar-nav .dropdown-menu { + position: absolute; + } + .navbar-expand-lg .navbar-nav .dropdown-menu-right { + right: 0; + left: auto; + } + .navbar-expand-lg .navbar-nav .nav-link { + padding-right: 0.5rem; + padding-left: 0.5rem; + } + .navbar-expand-lg > .container, + .navbar-expand-lg > .container-fluid { + -ms-flex-wrap: nowrap; + flex-wrap: nowrap; + } + .navbar-expand-lg .navbar-collapse { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; + -ms-flex-preferred-size: auto; + flex-basis: auto; + } + .navbar-expand-lg .navbar-toggler { + display: none; + } + .navbar-expand-lg .dropup .dropdown-menu { + top: auto; + bottom: 100%; + } +} + +@media (max-width: 1199.98px) { + .navbar-expand-xl > .container, + .navbar-expand-xl > .container-fluid { + padding-right: 0; + padding-left: 0; + } +} + +@media (min-width: 1200px) { + .navbar-expand-xl { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row nowrap; + flex-flow: row nowrap; + -webkit-box-pack: start; + -ms-flex-pack: start; + justify-content: flex-start; + } + .navbar-expand-xl .navbar-nav { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-direction: row; + flex-direction: row; + } + .navbar-expand-xl .navbar-nav .dropdown-menu { + position: absolute; + } + .navbar-expand-xl .navbar-nav .dropdown-menu-right { + right: 0; + left: auto; + } + .navbar-expand-xl .navbar-nav .nav-link { + padding-right: 0.5rem; + padding-left: 0.5rem; + } + .navbar-expand-xl > .container, + .navbar-expand-xl > .container-fluid { + -ms-flex-wrap: nowrap; + flex-wrap: nowrap; + } + .navbar-expand-xl .navbar-collapse { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; + -ms-flex-preferred-size: auto; + flex-basis: auto; + } + .navbar-expand-xl .navbar-toggler { + display: none; + } + .navbar-expand-xl .dropup .dropdown-menu { + top: auto; + bottom: 100%; + } +} + +.navbar-expand { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row nowrap; + flex-flow: row nowrap; + -webkit-box-pack: start; + -ms-flex-pack: start; + justify-content: flex-start; +} + +.navbar-expand > .container, +.navbar-expand > .container-fluid { + padding-right: 0; + padding-left: 0; +} + +.navbar-expand .navbar-nav { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-direction: row; + flex-direction: row; +} + +.navbar-expand .navbar-nav .dropdown-menu { + position: absolute; +} + +.navbar-expand .navbar-nav .dropdown-menu-right { + right: 0; + left: auto; +} + +.navbar-expand .navbar-nav .nav-link { + padding-right: 0.5rem; + padding-left: 0.5rem; +} + +.navbar-expand > .container, +.navbar-expand > .container-fluid { + -ms-flex-wrap: nowrap; + flex-wrap: nowrap; +} + +.navbar-expand .navbar-collapse { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; + -ms-flex-preferred-size: auto; + flex-basis: auto; +} + +.navbar-expand .navbar-toggler { + display: none; +} + +.navbar-expand .dropup .dropdown-menu { + top: auto; + bottom: 100%; +} + +.navbar-light .navbar-brand { + color: rgba(0, 0, 0, 0.9); +} + +.navbar-light .navbar-brand:hover, .navbar-light .navbar-brand:focus { + color: rgba(0, 0, 0, 0.9); +} + +.navbar-light .navbar-nav .nav-link { + color: rgba(0, 0, 0, 0.5); +} + +.navbar-light .navbar-nav .nav-link:hover, .navbar-light .navbar-nav .nav-link:focus { + color: rgba(0, 0, 0, 0.7); +} + +.navbar-light .navbar-nav .nav-link.disabled { + color: rgba(0, 0, 0, 0.3); +} + +.navbar-light .navbar-nav .show > .nav-link, +.navbar-light .navbar-nav .active > .nav-link, +.navbar-light .navbar-nav .nav-link.show, +.navbar-light .navbar-nav .nav-link.active { + color: rgba(0, 0, 0, 0.9); +} + +.navbar-light .navbar-toggler { + color: rgba(0, 0, 0, 0.5); + border-color: rgba(0, 0, 0, 0.1); +} + +.navbar-light .navbar-toggler-icon { + background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E"); +} + +.navbar-light .navbar-text { + color: rgba(0, 0, 0, 0.5); +} + +.navbar-light .navbar-text a { + color: rgba(0, 0, 0, 0.9); +} + +.navbar-light .navbar-text a:hover, .navbar-light .navbar-text a:focus { + color: rgba(0, 0, 0, 0.9); +} + +.navbar-dark .navbar-brand { + color: #fff; +} + +.navbar-dark .navbar-brand:hover, .navbar-dark .navbar-brand:focus { + color: #fff; +} + +.navbar-dark .navbar-nav .nav-link { + color: rgba(255, 255, 255, 0.5); +} + +.navbar-dark .navbar-nav .nav-link:hover, .navbar-dark .navbar-nav .nav-link:focus { + color: rgba(255, 255, 255, 0.75); +} + +.navbar-dark .navbar-nav .nav-link.disabled { + color: rgba(255, 255, 255, 0.25); +} + +.navbar-dark .navbar-nav .show > .nav-link, +.navbar-dark .navbar-nav .active > .nav-link, +.navbar-dark .navbar-nav .nav-link.show, +.navbar-dark .navbar-nav .nav-link.active { + color: #fff; +} + +.navbar-dark .navbar-toggler { + color: rgba(255, 255, 255, 0.5); + border-color: rgba(255, 255, 255, 0.1); +} + +.navbar-dark .navbar-toggler-icon { + background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E"); +} + +.navbar-dark .navbar-text { + color: rgba(255, 255, 255, 0.5); +} + +.navbar-dark .navbar-text a { + color: #fff; +} + +.navbar-dark .navbar-text a:hover, .navbar-dark .navbar-text a:focus { + color: #fff; +} + +.card { + position: relative; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + min-width: 0; + word-wrap: break-word; + background-color: #fff; + background-clip: border-box; + border: 1px solid rgba(0, 0, 0, 0.125); + border-radius: 0.25rem; +} + +.card > hr { + margin-right: 0; + margin-left: 0; +} + +.card > .list-group:first-child .list-group-item:first-child { + border-top-left-radius: 0.25rem; + border-top-right-radius: 0.25rem; +} + +.card > .list-group:last-child .list-group-item:last-child { + border-bottom-right-radius: 0.25rem; + border-bottom-left-radius: 0.25rem; +} + +.card-body { + -webkit-box-flex: 1; + -ms-flex: 1 1 auto; + flex: 1 1 auto; + padding: 1.25rem; +} + +.card-title { + margin-bottom: 0.75rem; +} + +.card-subtitle { + margin-top: -0.375rem; + margin-bottom: 0; +} + +.card-text:last-child { + margin-bottom: 0; +} + +.card-link:hover { + text-decoration: none; +} + +.card-link + .card-link { + margin-left: 1.25rem; +} + +.card-header { + padding: 0.75rem 1.25rem; + margin-bottom: 0; + background-color: rgba(0, 0, 0, 0.03); + border-bottom: 1px solid rgba(0, 0, 0, 0.125); +} + +.card-header:first-child { + border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0; +} + +.card-header + .list-group .list-group-item:first-child { + border-top: 0; +} + +.card-footer { + padding: 0.75rem 1.25rem; + background-color: rgba(0, 0, 0, 0.03); + border-top: 1px solid rgba(0, 0, 0, 0.125); +} + +.card-footer:last-child { + border-radius: 0 0 calc(0.25rem - 1px) calc(0.25rem - 1px); +} + +.card-header-tabs { + margin-right: -0.625rem; + margin-bottom: -0.75rem; + margin-left: -0.625rem; + border-bottom: 0; +} + +.card-header-pills { + margin-right: -0.625rem; + margin-left: -0.625rem; +} + +.card-img-overlay { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + padding: 1.25rem; +} + +.card-img { + width: 100%; + border-radius: calc(0.25rem - 1px); +} + +.card-img-top { + width: 100%; + border-top-left-radius: calc(0.25rem - 1px); + border-top-right-radius: calc(0.25rem - 1px); +} + +.card-img-bottom { + width: 100%; + border-bottom-right-radius: calc(0.25rem - 1px); + border-bottom-left-radius: calc(0.25rem - 1px); +} + +.card-deck { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; +} + +.card-deck .card { + margin-bottom: 15px; +} + +@media (min-width: 576px) { + .card-deck { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row wrap; + flex-flow: row wrap; + margin-right: -15px; + margin-left: -15px; + } + .card-deck .card { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-flex: 1; + -ms-flex: 1 0 0%; + flex: 1 0 0%; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + margin-right: 15px; + margin-bottom: 0; + margin-left: 15px; + } +} + +.card-group { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; +} + +.card-group > .card { + margin-bottom: 15px; +} + +@media (min-width: 576px) { + .card-group { + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -ms-flex-flow: row wrap; + flex-flow: row wrap; + } + .card-group > .card { + -webkit-box-flex: 1; + -ms-flex: 1 0 0%; + flex: 1 0 0%; + margin-bottom: 0; + } + .card-group > .card + .card { + margin-left: 0; + border-left: 0; + } + .card-group > .card:first-child { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + .card-group > .card:first-child .card-img-top, + .card-group > .card:first-child .card-header { + border-top-right-radius: 0; + } + .card-group > .card:first-child .card-img-bottom, + .card-group > .card:first-child .card-footer { + border-bottom-right-radius: 0; + } + .card-group > .card:last-child { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + } + .card-group > .card:last-child .card-img-top, + .card-group > .card:last-child .card-header { + border-top-left-radius: 0; + } + .card-group > .card:last-child .card-img-bottom, + .card-group > .card:last-child .card-footer { + border-bottom-left-radius: 0; + } + .card-group > .card:only-child { + border-radius: 0.25rem; + } + .card-group > .card:only-child .card-img-top, + .card-group > .card:only-child .card-header { + border-top-left-radius: 0.25rem; + border-top-right-radius: 0.25rem; + } + .card-group > .card:only-child .card-img-bottom, + .card-group > .card:only-child .card-footer { + border-bottom-right-radius: 0.25rem; + border-bottom-left-radius: 0.25rem; + } + .card-group > .card:not(:first-child):not(:last-child):not(:only-child) { + border-radius: 0; + } + .card-group > .card:not(:first-child):not(:last-child):not(:only-child) .card-img-top, + .card-group > .card:not(:first-child):not(:last-child):not(:only-child) .card-img-bottom, + .card-group > .card:not(:first-child):not(:last-child):not(:only-child) .card-header, + .card-group > .card:not(:first-child):not(:last-child):not(:only-child) .card-footer { + border-radius: 0; + } +} + +.card-columns .card { + margin-bottom: 0.75rem; +} + +@media (min-width: 576px) { + .card-columns { + -webkit-column-count: 3; + -moz-column-count: 3; + column-count: 3; + -webkit-column-gap: 1.25rem; + -moz-column-gap: 1.25rem; + column-gap: 1.25rem; + } + .card-columns .card { + display: inline-block; + width: 100%; + } +} + +.breadcrumb { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + padding: 0.75rem 1rem; + margin-bottom: 1rem; + list-style: none; + background-color: #e9ecef; + border-radius: 0.25rem; +} + +.breadcrumb-item + .breadcrumb-item::before { + display: inline-block; + padding-right: 0.5rem; + padding-left: 0.5rem; + color: #6c757d; + content: "/"; +} + +.breadcrumb-item + .breadcrumb-item:hover::before { + text-decoration: underline; +} + +.breadcrumb-item + .breadcrumb-item:hover::before { + text-decoration: none; +} + +.breadcrumb-item.active { + color: #6c757d; +} + +.pagination { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + padding-left: 0; + list-style: none; + border-radius: 0.25rem; +} + +.page-link { + position: relative; + display: block; + padding: 0.5rem 0.75rem; + margin-left: -1px; + line-height: 1.25; + color: #007bff; + background-color: #fff; + border: 1px solid #dee2e6; +} + +.page-link:hover { + color: #0056b3; + text-decoration: none; + background-color: #e9ecef; + border-color: #dee2e6; +} + +.page-link:focus { + z-index: 2; + outline: 0; + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); +} + +.page-link:not(:disabled):not(.disabled) { + cursor: pointer; +} + +.page-item:first-child .page-link { + margin-left: 0; + border-top-left-radius: 0.25rem; + border-bottom-left-radius: 0.25rem; +} + +.page-item:last-child .page-link { + border-top-right-radius: 0.25rem; + border-bottom-right-radius: 0.25rem; +} + +.page-item.active .page-link { + z-index: 1; + color: #fff; + background-color: #007bff; + border-color: #007bff; +} + +.page-item.disabled .page-link { + color: #6c757d; + pointer-events: none; + cursor: auto; + background-color: #fff; + border-color: #dee2e6; +} + +.pagination-lg .page-link { + padding: 0.75rem 1.5rem; + font-size: 1.25rem; + line-height: 1.5; +} + +.pagination-lg .page-item:first-child .page-link { + border-top-left-radius: 0.3rem; + border-bottom-left-radius: 0.3rem; +} + +.pagination-lg .page-item:last-child .page-link { + border-top-right-radius: 0.3rem; + border-bottom-right-radius: 0.3rem; +} + +.pagination-sm .page-link { + padding: 0.25rem 0.5rem; + font-size: 0.875rem; + line-height: 1.5; +} + +.pagination-sm .page-item:first-child .page-link { + border-top-left-radius: 0.2rem; + border-bottom-left-radius: 0.2rem; +} + +.pagination-sm .page-item:last-child .page-link { + border-top-right-radius: 0.2rem; + border-bottom-right-radius: 0.2rem; +} + +.badge { + display: inline-block; + padding: 0.25em 0.4em; + font-size: 75%; + font-weight: 700; + line-height: 1; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border-radius: 0.25rem; +} + +.badge:empty { + display: none; +} + +.btn .badge { + position: relative; + top: -1px; +} + +.badge-pill { + padding-right: 0.6em; + padding-left: 0.6em; + border-radius: 10rem; +} + +.badge-primary { + color: #fff; + background-color: #007bff; +} + +.badge-primary[href]:hover, .badge-primary[href]:focus { + color: #fff; + text-decoration: none; + background-color: #0062cc; +} + +.badge-secondary { + color: #fff; + background-color: #6c757d; +} + +.badge-secondary[href]:hover, .badge-secondary[href]:focus { + color: #fff; + text-decoration: none; + background-color: #545b62; +} + +.badge-success { + color: #fff; + background-color: #28a745; +} + +.badge-success[href]:hover, .badge-success[href]:focus { + color: #fff; + text-decoration: none; + background-color: #1e7e34; +} + +.badge-info { + color: #fff; + background-color: #17a2b8; +} + +.badge-info[href]:hover, .badge-info[href]:focus { + color: #fff; + text-decoration: none; + background-color: #117a8b; +} + +.badge-warning { + color: #212529; + background-color: #ffc107; +} + +.badge-warning[href]:hover, .badge-warning[href]:focus { + color: #212529; + text-decoration: none; + background-color: #d39e00; +} + +.badge-danger { + color: #fff; + background-color: #dc3545; +} + +.badge-danger[href]:hover, .badge-danger[href]:focus { + color: #fff; + text-decoration: none; + background-color: #bd2130; +} + +.badge-light { + color: #212529; + background-color: #f8f9fa; +} + +.badge-light[href]:hover, .badge-light[href]:focus { + color: #212529; + text-decoration: none; + background-color: #dae0e5; +} + +.badge-dark { + color: #fff; + background-color: #343a40; +} + +.badge-dark[href]:hover, .badge-dark[href]:focus { + color: #fff; + text-decoration: none; + background-color: #1d2124; +} + +.jumbotron { + padding: 2rem 1rem; + margin-bottom: 2rem; + background-color: #e9ecef; + border-radius: 0.3rem; +} + +@media (min-width: 576px) { + .jumbotron { + padding: 4rem 2rem; + } +} + +.jumbotron-fluid { + padding-right: 0; + padding-left: 0; + border-radius: 0; +} + +.alert { + position: relative; + padding: 0.75rem 1.25rem; + margin-bottom: 1rem; + border: 1px solid transparent; + border-radius: 0.25rem; +} + +.alert-heading { + color: inherit; +} + +.alert-link { + font-weight: 700; +} + +.alert-dismissible { + padding-right: 4rem; +} + +.alert-dismissible .close { + position: absolute; + top: 0; + right: 0; + padding: 0.75rem 1.25rem; + color: inherit; +} + +.alert-primary { + color: #004085; + background-color: #cce5ff; + border-color: #b8daff; +} + +.alert-primary hr { + border-top-color: #9fcdff; +} + +.alert-primary .alert-link { + color: #002752; +} + +.alert-secondary { + color: #383d41; + background-color: #e2e3e5; + border-color: #d6d8db; +} + +.alert-secondary hr { + border-top-color: #c8cbcf; +} + +.alert-secondary .alert-link { + color: #202326; +} + +.alert-success { + color: #155724; + background-color: #d4edda; + border-color: #c3e6cb; +} + +.alert-success hr { + border-top-color: #b1dfbb; +} + +.alert-success .alert-link { + color: #0b2e13; +} + +.alert-info { + color: #0c5460; + background-color: #d1ecf1; + border-color: #bee5eb; +} + +.alert-info hr { + border-top-color: #abdde5; +} + +.alert-info .alert-link { + color: #062c33; +} + +.alert-warning { + color: #856404; + background-color: #fff3cd; + border-color: #ffeeba; +} + +.alert-warning hr { + border-top-color: #ffe8a1; +} + +.alert-warning .alert-link { + color: #533f03; +} + +.alert-danger { + color: #721c24; + background-color: #f8d7da; + border-color: #f5c6cb; +} + +.alert-danger hr { + border-top-color: #f1b0b7; +} + +.alert-danger .alert-link { + color: #491217; +} + +.alert-light { + color: #818182; + background-color: #fefefe; + border-color: #fdfdfe; +} + +.alert-light hr { + border-top-color: #ececf6; +} + +.alert-light .alert-link { + color: #686868; +} + +.alert-dark { + color: #1b1e21; + background-color: #d6d8d9; + border-color: #c6c8ca; +} + +.alert-dark hr { + border-top-color: #b9bbbe; +} + +.alert-dark .alert-link { + color: #040505; +} + +@-webkit-keyframes progress-bar-stripes { + from { + background-position: 1rem 0; + } + to { + background-position: 0 0; + } +} + +@keyframes progress-bar-stripes { + from { + background-position: 1rem 0; + } + to { + background-position: 0 0; + } +} + +.progress { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + height: 1rem; + overflow: hidden; + font-size: 0.75rem; + background-color: #e9ecef; + border-radius: 0.25rem; +} + +.progress-bar { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + color: #fff; + text-align: center; + background-color: #007bff; + transition: width 0.6s ease; +} + +.progress-bar-striped { + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-size: 1rem 1rem; +} + +.progress-bar-animated { + -webkit-animation: progress-bar-stripes 1s linear infinite; + animation: progress-bar-stripes 1s linear infinite; +} + +.media { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: start; + -ms-flex-align: start; + align-items: flex-start; +} + +.media-body { + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1; +} + +.list-group { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + padding-left: 0; + margin-bottom: 0; +} + +.list-group-item-action { + width: 100%; + color: #495057; + text-align: inherit; +} + +.list-group-item-action:hover, .list-group-item-action:focus { + color: #495057; + text-decoration: none; + background-color: #f8f9fa; +} + +.list-group-item-action:active { + color: #212529; + background-color: #e9ecef; +} + +.list-group-item { + position: relative; + display: block; + padding: 0.75rem 1.25rem; + margin-bottom: -1px; + background-color: #fff; + border: 1px solid rgba(0, 0, 0, 0.125); +} + +.list-group-item:first-child { + border-top-left-radius: 0.25rem; + border-top-right-radius: 0.25rem; +} + +.list-group-item:last-child { + margin-bottom: 0; + border-bottom-right-radius: 0.25rem; + border-bottom-left-radius: 0.25rem; +} + +.list-group-item:hover, .list-group-item:focus { + z-index: 1; + text-decoration: none; +} + +.list-group-item.disabled, .list-group-item:disabled { + color: #6c757d; + background-color: #fff; +} + +.list-group-item.active { + z-index: 2; + color: #fff; + background-color: #007bff; + border-color: #007bff; +} + +.list-group-flush .list-group-item { + border-right: 0; + border-left: 0; + border-radius: 0; +} + +.list-group-flush:first-child .list-group-item:first-child { + border-top: 0; +} + +.list-group-flush:last-child .list-group-item:last-child { + border-bottom: 0; +} + +.list-group-item-primary { + color: #004085; + background-color: #b8daff; +} + +.list-group-item-primary.list-group-item-action:hover, .list-group-item-primary.list-group-item-action:focus { + color: #004085; + background-color: #9fcdff; +} + +.list-group-item-primary.list-group-item-action.active { + color: #fff; + background-color: #004085; + border-color: #004085; +} + +.list-group-item-secondary { + color: #383d41; + background-color: #d6d8db; +} + +.list-group-item-secondary.list-group-item-action:hover, .list-group-item-secondary.list-group-item-action:focus { + color: #383d41; + background-color: #c8cbcf; +} + +.list-group-item-secondary.list-group-item-action.active { + color: #fff; + background-color: #383d41; + border-color: #383d41; +} + +.list-group-item-success { + color: #155724; + background-color: #c3e6cb; +} + +.list-group-item-success.list-group-item-action:hover, .list-group-item-success.list-group-item-action:focus { + color: #155724; + background-color: #b1dfbb; +} + +.list-group-item-success.list-group-item-action.active { + color: #fff; + background-color: #155724; + border-color: #155724; +} + +.list-group-item-info { + color: #0c5460; + background-color: #bee5eb; +} + +.list-group-item-info.list-group-item-action:hover, .list-group-item-info.list-group-item-action:focus { + color: #0c5460; + background-color: #abdde5; +} + +.list-group-item-info.list-group-item-action.active { + color: #fff; + background-color: #0c5460; + border-color: #0c5460; +} + +.list-group-item-warning { + color: #856404; + background-color: #ffeeba; +} + +.list-group-item-warning.list-group-item-action:hover, .list-group-item-warning.list-group-item-action:focus { + color: #856404; + background-color: #ffe8a1; +} + +.list-group-item-warning.list-group-item-action.active { + color: #fff; + background-color: #856404; + border-color: #856404; +} + +.list-group-item-danger { + color: #721c24; + background-color: #f5c6cb; +} + +.list-group-item-danger.list-group-item-action:hover, .list-group-item-danger.list-group-item-action:focus { + color: #721c24; + background-color: #f1b0b7; +} + +.list-group-item-danger.list-group-item-action.active { + color: #fff; + background-color: #721c24; + border-color: #721c24; +} + +.list-group-item-light { + color: #818182; + background-color: #fdfdfe; +} + +.list-group-item-light.list-group-item-action:hover, .list-group-item-light.list-group-item-action:focus { + color: #818182; + background-color: #ececf6; +} + +.list-group-item-light.list-group-item-action.active { + color: #fff; + background-color: #818182; + border-color: #818182; +} + +.list-group-item-dark { + color: #1b1e21; + background-color: #c6c8ca; +} + +.list-group-item-dark.list-group-item-action:hover, .list-group-item-dark.list-group-item-action:focus { + color: #1b1e21; + background-color: #b9bbbe; +} + +.list-group-item-dark.list-group-item-action.active { + color: #fff; + background-color: #1b1e21; + border-color: #1b1e21; +} + +.close { + float: right; + font-size: 1.5rem; + font-weight: 700; + line-height: 1; + color: #000; + text-shadow: 0 1px 0 #fff; + opacity: .5; +} + +.close:hover, .close:focus { + color: #000; + text-decoration: none; + opacity: .75; +} + +.close:not(:disabled):not(.disabled) { + cursor: pointer; +} + +button.close { + padding: 0; + background-color: transparent; + border: 0; + -webkit-appearance: none; +} + +.modal-open { + overflow: hidden; +} + +.modal { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1050; + display: none; + overflow: hidden; + outline: 0; +} + +.modal-open .modal { + overflow-x: hidden; + overflow-y: auto; +} + +.modal-dialog { + position: relative; + width: auto; + margin: 0.5rem; + pointer-events: none; +} + +.modal.fade .modal-dialog { + transition: -webkit-transform 0.3s ease-out; + transition: transform 0.3s ease-out; + transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out; + -webkit-transform: translate(0, -25%); + transform: translate(0, -25%); +} + +.modal.show .modal-dialog { + -webkit-transform: translate(0, 0); + transform: translate(0, 0); +} + +.modal-dialog-centered { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + min-height: calc(100% - (0.5rem * 2)); +} + +.modal-content { + position: relative; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + width: 100%; + pointer-events: auto; + background-color: #fff; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, 0.2); + border-radius: 0.3rem; + outline: 0; +} + +.modal-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + background-color: #000; +} + +.modal-backdrop.fade { + opacity: 0; +} + +.modal-backdrop.show { + opacity: 0.5; +} + +.modal-header { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: start; + -ms-flex-align: start; + align-items: flex-start; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; + padding: 1rem; + border-bottom: 1px solid #e9ecef; + border-top-left-radius: 0.3rem; + border-top-right-radius: 0.3rem; +} + +.modal-header .close { + padding: 1rem; + margin: -1rem -1rem -1rem auto; +} + +.modal-title { + margin-bottom: 0; + line-height: 1.5; +} + +.modal-body { + position: relative; + -webkit-box-flex: 1; + -ms-flex: 1 1 auto; + flex: 1 1 auto; + padding: 1rem; +} + +.modal-footer { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: end; + -ms-flex-pack: end; + justify-content: flex-end; + padding: 1rem; + border-top: 1px solid #e9ecef; +} + +.modal-footer > :not(:first-child) { + margin-left: .25rem; +} + +.modal-footer > :not(:last-child) { + margin-right: .25rem; +} + +.modal-scrollbar-measure { + position: absolute; + top: -9999px; + width: 50px; + height: 50px; + overflow: scroll; +} + +@media (min-width: 576px) { + .modal-dialog { + max-width: 500px; + margin: 1.75rem auto; + } + .modal-dialog-centered { + min-height: calc(100% - (1.75rem * 2)); + } + .modal-sm { + max-width: 300px; + } +} + +@media (min-width: 992px) { + .modal-lg { + max-width: 800px; + } +} + +.tooltip { + position: absolute; + z-index: 1070; + display: block; + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + font-style: normal; + font-weight: 400; + line-height: 1.5; + text-align: left; + text-align: start; + text-decoration: none; + text-shadow: none; + text-transform: none; + letter-spacing: normal; + word-break: normal; + word-spacing: normal; + white-space: normal; + line-break: auto; + font-size: 0.875rem; + word-wrap: break-word; + opacity: 0; +} + +.tooltip.show { + opacity: 0.9; +} + +.tooltip .arrow { + position: absolute; + display: block; + width: 0.8rem; + height: 0.4rem; +} + +.tooltip .arrow::before { + position: absolute; + content: ""; + border-color: transparent; + border-style: solid; +} + +.bs-tooltip-top, .bs-tooltip-auto[x-placement^="top"] { + padding: 0.4rem 0; +} + +.bs-tooltip-top .arrow, .bs-tooltip-auto[x-placement^="top"] .arrow { + bottom: 0; +} + +.bs-tooltip-top .arrow::before, .bs-tooltip-auto[x-placement^="top"] .arrow::before { + top: 0; + border-width: 0.4rem 0.4rem 0; + border-top-color: #000; +} + +.bs-tooltip-right, .bs-tooltip-auto[x-placement^="right"] { + padding: 0 0.4rem; +} + +.bs-tooltip-right .arrow, .bs-tooltip-auto[x-placement^="right"] .arrow { + left: 0; + width: 0.4rem; + height: 0.8rem; +} + +.bs-tooltip-right .arrow::before, .bs-tooltip-auto[x-placement^="right"] .arrow::before { + right: 0; + border-width: 0.4rem 0.4rem 0.4rem 0; + border-right-color: #000; +} + +.bs-tooltip-bottom, .bs-tooltip-auto[x-placement^="bottom"] { + padding: 0.4rem 0; +} + +.bs-tooltip-bottom .arrow, .bs-tooltip-auto[x-placement^="bottom"] .arrow { + top: 0; +} + +.bs-tooltip-bottom .arrow::before, .bs-tooltip-auto[x-placement^="bottom"] .arrow::before { + bottom: 0; + border-width: 0 0.4rem 0.4rem; + border-bottom-color: #000; +} + +.bs-tooltip-left, .bs-tooltip-auto[x-placement^="left"] { + padding: 0 0.4rem; +} + +.bs-tooltip-left .arrow, .bs-tooltip-auto[x-placement^="left"] .arrow { + right: 0; + width: 0.4rem; + height: 0.8rem; +} + +.bs-tooltip-left .arrow::before, .bs-tooltip-auto[x-placement^="left"] .arrow::before { + left: 0; + border-width: 0.4rem 0 0.4rem 0.4rem; + border-left-color: #000; +} + +.tooltip-inner { + max-width: 200px; + padding: 0.25rem 0.5rem; + color: #fff; + text-align: center; + background-color: #000; + border-radius: 0.25rem; +} + +.popover { + position: absolute; + top: 0; + left: 0; + z-index: 1060; + display: block; + max-width: 276px; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + font-style: normal; + font-weight: 400; + line-height: 1.5; + text-align: left; + text-align: start; + text-decoration: none; + text-shadow: none; + text-transform: none; + letter-spacing: normal; + word-break: normal; + word-spacing: normal; + white-space: normal; + line-break: auto; + font-size: 0.875rem; + word-wrap: break-word; + background-color: #fff; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, 0.2); + border-radius: 0.3rem; +} + +.popover .arrow { + position: absolute; + display: block; + width: 1rem; + height: 0.5rem; + margin: 0 0.3rem; +} + +.popover .arrow::before, .popover .arrow::after { + position: absolute; + display: block; + content: ""; + border-color: transparent; + border-style: solid; +} + +.bs-popover-top, .bs-popover-auto[x-placement^="top"] { + margin-bottom: 0.5rem; +} + +.bs-popover-top .arrow, .bs-popover-auto[x-placement^="top"] .arrow { + bottom: calc((0.5rem + 1px) * -1); +} + +.bs-popover-top .arrow::before, .bs-popover-auto[x-placement^="top"] .arrow::before, +.bs-popover-top .arrow::after, .bs-popover-auto[x-placement^="top"] .arrow::after { + border-width: 0.5rem 0.5rem 0; +} + +.bs-popover-top .arrow::before, .bs-popover-auto[x-placement^="top"] .arrow::before { + bottom: 0; + border-top-color: rgba(0, 0, 0, 0.25); +} + +.bs-popover-top .arrow::after, .bs-popover-auto[x-placement^="top"] .arrow::after { + bottom: 1px; + border-top-color: #fff; +} + +.bs-popover-right, .bs-popover-auto[x-placement^="right"] { + margin-left: 0.5rem; +} + +.bs-popover-right .arrow, .bs-popover-auto[x-placement^="right"] .arrow { + left: calc((0.5rem + 1px) * -1); + width: 0.5rem; + height: 1rem; + margin: 0.3rem 0; +} + +.bs-popover-right .arrow::before, .bs-popover-auto[x-placement^="right"] .arrow::before, +.bs-popover-right .arrow::after, .bs-popover-auto[x-placement^="right"] .arrow::after { + border-width: 0.5rem 0.5rem 0.5rem 0; +} + +.bs-popover-right .arrow::before, .bs-popover-auto[x-placement^="right"] .arrow::before { + left: 0; + border-right-color: rgba(0, 0, 0, 0.25); +} + +.bs-popover-right .arrow::after, .bs-popover-auto[x-placement^="right"] .arrow::after { + left: 1px; + border-right-color: #fff; +} + +.bs-popover-bottom, .bs-popover-auto[x-placement^="bottom"] { + margin-top: 0.5rem; +} + +.bs-popover-bottom .arrow, .bs-popover-auto[x-placement^="bottom"] .arrow { + top: calc((0.5rem + 1px) * -1); +} + +.bs-popover-bottom .arrow::before, .bs-popover-auto[x-placement^="bottom"] .arrow::before, +.bs-popover-bottom .arrow::after, .bs-popover-auto[x-placement^="bottom"] .arrow::after { + border-width: 0 0.5rem 0.5rem 0.5rem; +} + +.bs-popover-bottom .arrow::before, .bs-popover-auto[x-placement^="bottom"] .arrow::before { + top: 0; + border-bottom-color: rgba(0, 0, 0, 0.25); +} + +.bs-popover-bottom .arrow::after, .bs-popover-auto[x-placement^="bottom"] .arrow::after { + top: 1px; + border-bottom-color: #fff; +} + +.bs-popover-bottom .popover-header::before, .bs-popover-auto[x-placement^="bottom"] .popover-header::before { + position: absolute; + top: 0; + left: 50%; + display: block; + width: 1rem; + margin-left: -0.5rem; + content: ""; + border-bottom: 1px solid #f7f7f7; +} + +.bs-popover-left, .bs-popover-auto[x-placement^="left"] { + margin-right: 0.5rem; +} + +.bs-popover-left .arrow, .bs-popover-auto[x-placement^="left"] .arrow { + right: calc((0.5rem + 1px) * -1); + width: 0.5rem; + height: 1rem; + margin: 0.3rem 0; +} + +.bs-popover-left .arrow::before, .bs-popover-auto[x-placement^="left"] .arrow::before, +.bs-popover-left .arrow::after, .bs-popover-auto[x-placement^="left"] .arrow::after { + border-width: 0.5rem 0 0.5rem 0.5rem; +} + +.bs-popover-left .arrow::before, .bs-popover-auto[x-placement^="left"] .arrow::before { + right: 0; + border-left-color: rgba(0, 0, 0, 0.25); +} + +.bs-popover-left .arrow::after, .bs-popover-auto[x-placement^="left"] .arrow::after { + right: 1px; + border-left-color: #fff; +} + +.popover-header { + padding: 0.5rem 0.75rem; + margin-bottom: 0; + font-size: 1rem; + color: inherit; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; + border-top-left-radius: calc(0.3rem - 1px); + border-top-right-radius: calc(0.3rem - 1px); +} + +.popover-header:empty { + display: none; +} + +.popover-body { + padding: 0.5rem 0.75rem; + color: #212529; +} + +.carousel { + position: relative; +} + +.carousel-inner { + position: relative; + width: 100%; + overflow: hidden; +} + +.carousel-item { + position: relative; + display: none; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + width: 100%; + transition: -webkit-transform 0.6s ease; + transition: transform 0.6s ease; + transition: transform 0.6s ease, -webkit-transform 0.6s ease; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + -webkit-perspective: 1000px; + perspective: 1000px; +} + +.carousel-item.active, +.carousel-item-next, +.carousel-item-prev { + display: block; +} + +.carousel-item-next, +.carousel-item-prev { + position: absolute; + top: 0; +} + +.carousel-item-next.carousel-item-left, +.carousel-item-prev.carousel-item-right { + -webkit-transform: translateX(0); + transform: translateX(0); +} + +@supports ((-webkit-transform-style: preserve-3d) or (transform-style: preserve-3d)) { + .carousel-item-next.carousel-item-left, + .carousel-item-prev.carousel-item-right { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.carousel-item-next, +.active.carousel-item-right { + -webkit-transform: translateX(100%); + transform: translateX(100%); +} + +@supports ((-webkit-transform-style: preserve-3d) or (transform-style: preserve-3d)) { + .carousel-item-next, + .active.carousel-item-right { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } +} + +.carousel-item-prev, +.active.carousel-item-left { + -webkit-transform: translateX(-100%); + transform: translateX(-100%); +} + +@supports ((-webkit-transform-style: preserve-3d) or (transform-style: preserve-3d)) { + .carousel-item-prev, + .active.carousel-item-left { + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } +} + +.carousel-control-prev, +.carousel-control-next { + position: absolute; + top: 0; + bottom: 0; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + width: 15%; + color: #fff; + text-align: center; + opacity: 0.5; +} + +.carousel-control-prev:hover, .carousel-control-prev:focus, +.carousel-control-next:hover, +.carousel-control-next:focus { + color: #fff; + text-decoration: none; + outline: 0; + opacity: .9; +} + +.carousel-control-prev { + left: 0; +} + +.carousel-control-next { + right: 0; +} + +.carousel-control-prev-icon, +.carousel-control-next-icon { + display: inline-block; + width: 20px; + height: 20px; + background: transparent no-repeat center center; + background-size: 100% 100%; +} + +.carousel-control-prev-icon { + background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E"); +} + +.carousel-control-next-icon { + background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 8 8'%3E%3Cpath d='M2.75 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3E%3C/svg%3E"); +} + +.carousel-indicators { + position: absolute; + right: 0; + bottom: 10px; + left: 0; + z-index: 15; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + padding-left: 0; + margin-right: 15%; + margin-left: 15%; + list-style: none; +} + +.carousel-indicators li { + position: relative; + -webkit-box-flex: 0; + -ms-flex: 0 1 auto; + flex: 0 1 auto; + width: 30px; + height: 3px; + margin-right: 3px; + margin-left: 3px; + text-indent: -999px; + background-color: rgba(255, 255, 255, 0.5); +} + +.carousel-indicators li::before { + position: absolute; + top: -10px; + left: 0; + display: inline-block; + width: 100%; + height: 10px; + content: ""; +} + +.carousel-indicators li::after { + position: absolute; + bottom: -10px; + left: 0; + display: inline-block; + width: 100%; + height: 10px; + content: ""; +} + +.carousel-indicators .active { + background-color: #fff; +} + +.carousel-caption { + position: absolute; + right: 15%; + bottom: 20px; + left: 15%; + z-index: 10; + padding-top: 20px; + padding-bottom: 20px; + color: #fff; + text-align: center; +} + +.align-baseline { + vertical-align: baseline !important; +} + +.align-top { + vertical-align: top !important; +} + +.align-middle { + vertical-align: middle !important; +} + +.align-bottom { + vertical-align: bottom !important; +} + +.align-text-bottom { + vertical-align: text-bottom !important; +} + +.align-text-top { + vertical-align: text-top !important; +} + +.bg-primary { + background-color: #007bff !important; +} + +a.bg-primary:hover, a.bg-primary:focus, +button.bg-primary:hover, +button.bg-primary:focus { + background-color: #0062cc !important; +} + +.bg-secondary { + background-color: #6c757d !important; +} + +a.bg-secondary:hover, a.bg-secondary:focus, +button.bg-secondary:hover, +button.bg-secondary:focus { + background-color: #545b62 !important; +} + +.bg-success { + background-color: #28a745 !important; +} + +a.bg-success:hover, a.bg-success:focus, +button.bg-success:hover, +button.bg-success:focus { + background-color: #1e7e34 !important; +} + +.bg-info { + background-color: #17a2b8 !important; +} + +a.bg-info:hover, a.bg-info:focus, +button.bg-info:hover, +button.bg-info:focus { + background-color: #117a8b !important; +} + +.bg-warning { + background-color: #ffc107 !important; +} + +a.bg-warning:hover, a.bg-warning:focus, +button.bg-warning:hover, +button.bg-warning:focus { + background-color: #d39e00 !important; +} + +.bg-danger { + background-color: #dc3545 !important; +} + +a.bg-danger:hover, a.bg-danger:focus, +button.bg-danger:hover, +button.bg-danger:focus { + background-color: #bd2130 !important; +} + +.bg-light { + background-color: #f8f9fa !important; +} + +a.bg-light:hover, a.bg-light:focus, +button.bg-light:hover, +button.bg-light:focus { + background-color: #dae0e5 !important; +} + +.bg-dark { + background-color: #343a40 !important; +} + +a.bg-dark:hover, a.bg-dark:focus, +button.bg-dark:hover, +button.bg-dark:focus { + background-color: #1d2124 !important; +} + +.bg-white { + background-color: #fff !important; +} + +.bg-transparent { + background-color: transparent !important; +} + +.border { + border: 1px solid #dee2e6 !important; +} + +.border-top { + border-top: 1px solid #dee2e6 !important; +} + +.border-right { + border-right: 1px solid #dee2e6 !important; +} + +.border-bottom { + border-bottom: 1px solid #dee2e6 !important; +} + +.border-left { + border-left: 1px solid #dee2e6 !important; +} + +.border-0 { + border: 0 !important; +} + +.border-top-0 { + border-top: 0 !important; +} + +.border-right-0 { + border-right: 0 !important; +} + +.border-bottom-0 { + border-bottom: 0 !important; +} + +.border-left-0 { + border-left: 0 !important; +} + +.border-primary { + border-color: #007bff !important; +} + +.border-secondary { + border-color: #6c757d !important; +} + +.border-success { + border-color: #28a745 !important; +} + +.border-info { + border-color: #17a2b8 !important; +} + +.border-warning { + border-color: #ffc107 !important; +} + +.border-danger { + border-color: #dc3545 !important; +} + +.border-light { + border-color: #f8f9fa !important; +} + +.border-dark { + border-color: #343a40 !important; +} + +.border-white { + border-color: #fff !important; +} + +.rounded { + border-radius: 0.25rem !important; +} + +.rounded-top { + border-top-left-radius: 0.25rem !important; + border-top-right-radius: 0.25rem !important; +} + +.rounded-right { + border-top-right-radius: 0.25rem !important; + border-bottom-right-radius: 0.25rem !important; +} + +.rounded-bottom { + border-bottom-right-radius: 0.25rem !important; + border-bottom-left-radius: 0.25rem !important; +} + +.rounded-left { + border-top-left-radius: 0.25rem !important; + border-bottom-left-radius: 0.25rem !important; +} + +.rounded-circle { + border-radius: 50% !important; +} + +.rounded-0 { + border-radius: 0 !important; +} + +.clearfix::after { + display: block; + clear: both; + content: ""; +} + +.d-none { + display: none !important; +} + +.d-inline { + display: inline !important; +} + +.d-inline-block { + display: inline-block !important; +} + +.d-block { + display: block !important; +} + +.d-table { + display: table !important; +} + +.d-table-row { + display: table-row !important; +} + +.d-table-cell { + display: table-cell !important; +} + +.d-flex { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; +} + +.d-inline-flex { + display: -webkit-inline-box !important; + display: -ms-inline-flexbox !important; + display: inline-flex !important; +} + +@media (min-width: 576px) { + .d-sm-none { + display: none !important; + } + .d-sm-inline { + display: inline !important; + } + .d-sm-inline-block { + display: inline-block !important; + } + .d-sm-block { + display: block !important; + } + .d-sm-table { + display: table !important; + } + .d-sm-table-row { + display: table-row !important; + } + .d-sm-table-cell { + display: table-cell !important; + } + .d-sm-flex { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; + } + .d-sm-inline-flex { + display: -webkit-inline-box !important; + display: -ms-inline-flexbox !important; + display: inline-flex !important; + } +} + +@media (min-width: 768px) { + .d-md-none { + display: none !important; + } + .d-md-inline { + display: inline !important; + } + .d-md-inline-block { + display: inline-block !important; + } + .d-md-block { + display: block !important; + } + .d-md-table { + display: table !important; + } + .d-md-table-row { + display: table-row !important; + } + .d-md-table-cell { + display: table-cell !important; + } + .d-md-flex { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; + } + .d-md-inline-flex { + display: -webkit-inline-box !important; + display: -ms-inline-flexbox !important; + display: inline-flex !important; + } +} + +@media (min-width: 992px) { + .d-lg-none { + display: none !important; + } + .d-lg-inline { + display: inline !important; + } + .d-lg-inline-block { + display: inline-block !important; + } + .d-lg-block { + display: block !important; + } + .d-lg-table { + display: table !important; + } + .d-lg-table-row { + display: table-row !important; + } + .d-lg-table-cell { + display: table-cell !important; + } + .d-lg-flex { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; + } + .d-lg-inline-flex { + display: -webkit-inline-box !important; + display: -ms-inline-flexbox !important; + display: inline-flex !important; + } +} + +@media (min-width: 1200px) { + .d-xl-none { + display: none !important; + } + .d-xl-inline { + display: inline !important; + } + .d-xl-inline-block { + display: inline-block !important; + } + .d-xl-block { + display: block !important; + } + .d-xl-table { + display: table !important; + } + .d-xl-table-row { + display: table-row !important; + } + .d-xl-table-cell { + display: table-cell !important; + } + .d-xl-flex { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; + } + .d-xl-inline-flex { + display: -webkit-inline-box !important; + display: -ms-inline-flexbox !important; + display: inline-flex !important; + } +} + +@media print { + .d-print-none { + display: none !important; + } + .d-print-inline { + display: inline !important; + } + .d-print-inline-block { + display: inline-block !important; + } + .d-print-block { + display: block !important; + } + .d-print-table { + display: table !important; + } + .d-print-table-row { + display: table-row !important; + } + .d-print-table-cell { + display: table-cell !important; + } + .d-print-flex { + display: -webkit-box !important; + display: -ms-flexbox !important; + display: flex !important; + } + .d-print-inline-flex { + display: -webkit-inline-box !important; + display: -ms-inline-flexbox !important; + display: inline-flex !important; + } +} + +.embed-responsive { + position: relative; + display: block; + width: 100%; + padding: 0; + overflow: hidden; +} + +.embed-responsive::before { + display: block; + content: ""; +} + +.embed-responsive .embed-responsive-item, +.embed-responsive iframe, +.embed-responsive embed, +.embed-responsive object, +.embed-responsive video { + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + border: 0; +} + +.embed-responsive-21by9::before { + padding-top: 42.857143%; +} + +.embed-responsive-16by9::before { + padding-top: 56.25%; +} + +.embed-responsive-4by3::before { + padding-top: 75%; +} + +.embed-responsive-1by1::before { + padding-top: 100%; +} + +.flex-row { + -webkit-box-orient: horizontal !important; + -webkit-box-direction: normal !important; + -ms-flex-direction: row !important; + flex-direction: row !important; +} + +.flex-column { + -webkit-box-orient: vertical !important; + -webkit-box-direction: normal !important; + -ms-flex-direction: column !important; + flex-direction: column !important; +} + +.flex-row-reverse { + -webkit-box-orient: horizontal !important; + -webkit-box-direction: reverse !important; + -ms-flex-direction: row-reverse !important; + flex-direction: row-reverse !important; +} + +.flex-column-reverse { + -webkit-box-orient: vertical !important; + -webkit-box-direction: reverse !important; + -ms-flex-direction: column-reverse !important; + flex-direction: column-reverse !important; +} + +.flex-wrap { + -ms-flex-wrap: wrap !important; + flex-wrap: wrap !important; +} + +.flex-nowrap { + -ms-flex-wrap: nowrap !important; + flex-wrap: nowrap !important; +} + +.flex-wrap-reverse { + -ms-flex-wrap: wrap-reverse !important; + flex-wrap: wrap-reverse !important; +} + +.justify-content-start { + -webkit-box-pack: start !important; + -ms-flex-pack: start !important; + justify-content: flex-start !important; +} + +.justify-content-end { + -webkit-box-pack: end !important; + -ms-flex-pack: end !important; + justify-content: flex-end !important; +} + +.justify-content-center { + -webkit-box-pack: center !important; + -ms-flex-pack: center !important; + justify-content: center !important; +} + +.justify-content-between { + -webkit-box-pack: justify !important; + -ms-flex-pack: justify !important; + justify-content: space-between !important; +} + +.justify-content-around { + -ms-flex-pack: distribute !important; + justify-content: space-around !important; +} + +.align-items-start { + -webkit-box-align: start !important; + -ms-flex-align: start !important; + align-items: flex-start !important; +} + +.align-items-end { + -webkit-box-align: end !important; + -ms-flex-align: end !important; + align-items: flex-end !important; +} + +.align-items-center { + -webkit-box-align: center !important; + -ms-flex-align: center !important; + align-items: center !important; +} + +.align-items-baseline { + -webkit-box-align: baseline !important; + -ms-flex-align: baseline !important; + align-items: baseline !important; +} + +.align-items-stretch { + -webkit-box-align: stretch !important; + -ms-flex-align: stretch !important; + align-items: stretch !important; +} + +.align-content-start { + -ms-flex-line-pack: start !important; + align-content: flex-start !important; +} + +.align-content-end { + -ms-flex-line-pack: end !important; + align-content: flex-end !important; +} + +.align-content-center { + -ms-flex-line-pack: center !important; + align-content: center !important; +} + +.align-content-between { + -ms-flex-line-pack: justify !important; + align-content: space-between !important; +} + +.align-content-around { + -ms-flex-line-pack: distribute !important; + align-content: space-around !important; +} + +.align-content-stretch { + -ms-flex-line-pack: stretch !important; + align-content: stretch !important; +} + +.align-self-auto { + -ms-flex-item-align: auto !important; + align-self: auto !important; +} + +.align-self-start { + -ms-flex-item-align: start !important; + align-self: flex-start !important; +} + +.align-self-end { + -ms-flex-item-align: end !important; + align-self: flex-end !important; +} + +.align-self-center { + -ms-flex-item-align: center !important; + align-self: center !important; +} + +.align-self-baseline { + -ms-flex-item-align: baseline !important; + align-self: baseline !important; +} + +.align-self-stretch { + -ms-flex-item-align: stretch !important; + align-self: stretch !important; +} + +@media (min-width: 576px) { + .flex-sm-row { + -webkit-box-orient: horizontal !important; + -webkit-box-direction: normal !important; + -ms-flex-direction: row !important; + flex-direction: row !important; + } + .flex-sm-column { + -webkit-box-orient: vertical !important; + -webkit-box-direction: normal !important; + -ms-flex-direction: column !important; + flex-direction: column !important; + } + .flex-sm-row-reverse { + -webkit-box-orient: horizontal !important; + -webkit-box-direction: reverse !important; + -ms-flex-direction: row-reverse !important; + flex-direction: row-reverse !important; + } + .flex-sm-column-reverse { + -webkit-box-orient: vertical !important; + -webkit-box-direction: reverse !important; + -ms-flex-direction: column-reverse !important; + flex-direction: column-reverse !important; + } + .flex-sm-wrap { + -ms-flex-wrap: wrap !important; + flex-wrap: wrap !important; + } + .flex-sm-nowrap { + -ms-flex-wrap: nowrap !important; + flex-wrap: nowrap !important; + } + .flex-sm-wrap-reverse { + -ms-flex-wrap: wrap-reverse !important; + flex-wrap: wrap-reverse !important; + } + .justify-content-sm-start { + -webkit-box-pack: start !important; + -ms-flex-pack: start !important; + justify-content: flex-start !important; + } + .justify-content-sm-end { + -webkit-box-pack: end !important; + -ms-flex-pack: end !important; + justify-content: flex-end !important; + } + .justify-content-sm-center { + -webkit-box-pack: center !important; + -ms-flex-pack: center !important; + justify-content: center !important; + } + .justify-content-sm-between { + -webkit-box-pack: justify !important; + -ms-flex-pack: justify !important; + justify-content: space-between !important; + } + .justify-content-sm-around { + -ms-flex-pack: distribute !important; + justify-content: space-around !important; + } + .align-items-sm-start { + -webkit-box-align: start !important; + -ms-flex-align: start !important; + align-items: flex-start !important; + } + .align-items-sm-end { + -webkit-box-align: end !important; + -ms-flex-align: end !important; + align-items: flex-end !important; + } + .align-items-sm-center { + -webkit-box-align: center !important; + -ms-flex-align: center !important; + align-items: center !important; + } + .align-items-sm-baseline { + -webkit-box-align: baseline !important; + -ms-flex-align: baseline !important; + align-items: baseline !important; + } + .align-items-sm-stretch { + -webkit-box-align: stretch !important; + -ms-flex-align: stretch !important; + align-items: stretch !important; + } + .align-content-sm-start { + -ms-flex-line-pack: start !important; + align-content: flex-start !important; + } + .align-content-sm-end { + -ms-flex-line-pack: end !important; + align-content: flex-end !important; + } + .align-content-sm-center { + -ms-flex-line-pack: center !important; + align-content: center !important; + } + .align-content-sm-between { + -ms-flex-line-pack: justify !important; + align-content: space-between !important; + } + .align-content-sm-around { + -ms-flex-line-pack: distribute !important; + align-content: space-around !important; + } + .align-content-sm-stretch { + -ms-flex-line-pack: stretch !important; + align-content: stretch !important; + } + .align-self-sm-auto { + -ms-flex-item-align: auto !important; + align-self: auto !important; + } + .align-self-sm-start { + -ms-flex-item-align: start !important; + align-self: flex-start !important; + } + .align-self-sm-end { + -ms-flex-item-align: end !important; + align-self: flex-end !important; + } + .align-self-sm-center { + -ms-flex-item-align: center !important; + align-self: center !important; + } + .align-self-sm-baseline { + -ms-flex-item-align: baseline !important; + align-self: baseline !important; + } + .align-self-sm-stretch { + -ms-flex-item-align: stretch !important; + align-self: stretch !important; + } +} + +@media (min-width: 768px) { + .flex-md-row { + -webkit-box-orient: horizontal !important; + -webkit-box-direction: normal !important; + -ms-flex-direction: row !important; + flex-direction: row !important; + } + .flex-md-column { + -webkit-box-orient: vertical !important; + -webkit-box-direction: normal !important; + -ms-flex-direction: column !important; + flex-direction: column !important; + } + .flex-md-row-reverse { + -webkit-box-orient: horizontal !important; + -webkit-box-direction: reverse !important; + -ms-flex-direction: row-reverse !important; + flex-direction: row-reverse !important; + } + .flex-md-column-reverse { + -webkit-box-orient: vertical !important; + -webkit-box-direction: reverse !important; + -ms-flex-direction: column-reverse !important; + flex-direction: column-reverse !important; + } + .flex-md-wrap { + -ms-flex-wrap: wrap !important; + flex-wrap: wrap !important; + } + .flex-md-nowrap { + -ms-flex-wrap: nowrap !important; + flex-wrap: nowrap !important; + } + .flex-md-wrap-reverse { + -ms-flex-wrap: wrap-reverse !important; + flex-wrap: wrap-reverse !important; + } + .justify-content-md-start { + -webkit-box-pack: start !important; + -ms-flex-pack: start !important; + justify-content: flex-start !important; + } + .justify-content-md-end { + -webkit-box-pack: end !important; + -ms-flex-pack: end !important; + justify-content: flex-end !important; + } + .justify-content-md-center { + -webkit-box-pack: center !important; + -ms-flex-pack: center !important; + justify-content: center !important; + } + .justify-content-md-between { + -webkit-box-pack: justify !important; + -ms-flex-pack: justify !important; + justify-content: space-between !important; + } + .justify-content-md-around { + -ms-flex-pack: distribute !important; + justify-content: space-around !important; + } + .align-items-md-start { + -webkit-box-align: start !important; + -ms-flex-align: start !important; + align-items: flex-start !important; + } + .align-items-md-end { + -webkit-box-align: end !important; + -ms-flex-align: end !important; + align-items: flex-end !important; + } + .align-items-md-center { + -webkit-box-align: center !important; + -ms-flex-align: center !important; + align-items: center !important; + } + .align-items-md-baseline { + -webkit-box-align: baseline !important; + -ms-flex-align: baseline !important; + align-items: baseline !important; + } + .align-items-md-stretch { + -webkit-box-align: stretch !important; + -ms-flex-align: stretch !important; + align-items: stretch !important; + } + .align-content-md-start { + -ms-flex-line-pack: start !important; + align-content: flex-start !important; + } + .align-content-md-end { + -ms-flex-line-pack: end !important; + align-content: flex-end !important; + } + .align-content-md-center { + -ms-flex-line-pack: center !important; + align-content: center !important; + } + .align-content-md-between { + -ms-flex-line-pack: justify !important; + align-content: space-between !important; + } + .align-content-md-around { + -ms-flex-line-pack: distribute !important; + align-content: space-around !important; + } + .align-content-md-stretch { + -ms-flex-line-pack: stretch !important; + align-content: stretch !important; + } + .align-self-md-auto { + -ms-flex-item-align: auto !important; + align-self: auto !important; + } + .align-self-md-start { + -ms-flex-item-align: start !important; + align-self: flex-start !important; + } + .align-self-md-end { + -ms-flex-item-align: end !important; + align-self: flex-end !important; + } + .align-self-md-center { + -ms-flex-item-align: center !important; + align-self: center !important; + } + .align-self-md-baseline { + -ms-flex-item-align: baseline !important; + align-self: baseline !important; + } + .align-self-md-stretch { + -ms-flex-item-align: stretch !important; + align-self: stretch !important; + } +} + +@media (min-width: 992px) { + .flex-lg-row { + -webkit-box-orient: horizontal !important; + -webkit-box-direction: normal !important; + -ms-flex-direction: row !important; + flex-direction: row !important; + } + .flex-lg-column { + -webkit-box-orient: vertical !important; + -webkit-box-direction: normal !important; + -ms-flex-direction: column !important; + flex-direction: column !important; + } + .flex-lg-row-reverse { + -webkit-box-orient: horizontal !important; + -webkit-box-direction: reverse !important; + -ms-flex-direction: row-reverse !important; + flex-direction: row-reverse !important; + } + .flex-lg-column-reverse { + -webkit-box-orient: vertical !important; + -webkit-box-direction: reverse !important; + -ms-flex-direction: column-reverse !important; + flex-direction: column-reverse !important; + } + .flex-lg-wrap { + -ms-flex-wrap: wrap !important; + flex-wrap: wrap !important; + } + .flex-lg-nowrap { + -ms-flex-wrap: nowrap !important; + flex-wrap: nowrap !important; + } + .flex-lg-wrap-reverse { + -ms-flex-wrap: wrap-reverse !important; + flex-wrap: wrap-reverse !important; + } + .justify-content-lg-start { + -webkit-box-pack: start !important; + -ms-flex-pack: start !important; + justify-content: flex-start !important; + } + .justify-content-lg-end { + -webkit-box-pack: end !important; + -ms-flex-pack: end !important; + justify-content: flex-end !important; + } + .justify-content-lg-center { + -webkit-box-pack: center !important; + -ms-flex-pack: center !important; + justify-content: center !important; + } + .justify-content-lg-between { + -webkit-box-pack: justify !important; + -ms-flex-pack: justify !important; + justify-content: space-between !important; + } + .justify-content-lg-around { + -ms-flex-pack: distribute !important; + justify-content: space-around !important; + } + .align-items-lg-start { + -webkit-box-align: start !important; + -ms-flex-align: start !important; + align-items: flex-start !important; + } + .align-items-lg-end { + -webkit-box-align: end !important; + -ms-flex-align: end !important; + align-items: flex-end !important; + } + .align-items-lg-center { + -webkit-box-align: center !important; + -ms-flex-align: center !important; + align-items: center !important; + } + .align-items-lg-baseline { + -webkit-box-align: baseline !important; + -ms-flex-align: baseline !important; + align-items: baseline !important; + } + .align-items-lg-stretch { + -webkit-box-align: stretch !important; + -ms-flex-align: stretch !important; + align-items: stretch !important; + } + .align-content-lg-start { + -ms-flex-line-pack: start !important; + align-content: flex-start !important; + } + .align-content-lg-end { + -ms-flex-line-pack: end !important; + align-content: flex-end !important; + } + .align-content-lg-center { + -ms-flex-line-pack: center !important; + align-content: center !important; + } + .align-content-lg-between { + -ms-flex-line-pack: justify !important; + align-content: space-between !important; + } + .align-content-lg-around { + -ms-flex-line-pack: distribute !important; + align-content: space-around !important; + } + .align-content-lg-stretch { + -ms-flex-line-pack: stretch !important; + align-content: stretch !important; + } + .align-self-lg-auto { + -ms-flex-item-align: auto !important; + align-self: auto !important; + } + .align-self-lg-start { + -ms-flex-item-align: start !important; + align-self: flex-start !important; + } + .align-self-lg-end { + -ms-flex-item-align: end !important; + align-self: flex-end !important; + } + .align-self-lg-center { + -ms-flex-item-align: center !important; + align-self: center !important; + } + .align-self-lg-baseline { + -ms-flex-item-align: baseline !important; + align-self: baseline !important; + } + .align-self-lg-stretch { + -ms-flex-item-align: stretch !important; + align-self: stretch !important; + } +} + +@media (min-width: 1200px) { + .flex-xl-row { + -webkit-box-orient: horizontal !important; + -webkit-box-direction: normal !important; + -ms-flex-direction: row !important; + flex-direction: row !important; + } + .flex-xl-column { + -webkit-box-orient: vertical !important; + -webkit-box-direction: normal !important; + -ms-flex-direction: column !important; + flex-direction: column !important; + } + .flex-xl-row-reverse { + -webkit-box-orient: horizontal !important; + -webkit-box-direction: reverse !important; + -ms-flex-direction: row-reverse !important; + flex-direction: row-reverse !important; + } + .flex-xl-column-reverse { + -webkit-box-orient: vertical !important; + -webkit-box-direction: reverse !important; + -ms-flex-direction: column-reverse !important; + flex-direction: column-reverse !important; + } + .flex-xl-wrap { + -ms-flex-wrap: wrap !important; + flex-wrap: wrap !important; + } + .flex-xl-nowrap { + -ms-flex-wrap: nowrap !important; + flex-wrap: nowrap !important; + } + .flex-xl-wrap-reverse { + -ms-flex-wrap: wrap-reverse !important; + flex-wrap: wrap-reverse !important; + } + .justify-content-xl-start { + -webkit-box-pack: start !important; + -ms-flex-pack: start !important; + justify-content: flex-start !important; + } + .justify-content-xl-end { + -webkit-box-pack: end !important; + -ms-flex-pack: end !important; + justify-content: flex-end !important; + } + .justify-content-xl-center { + -webkit-box-pack: center !important; + -ms-flex-pack: center !important; + justify-content: center !important; + } + .justify-content-xl-between { + -webkit-box-pack: justify !important; + -ms-flex-pack: justify !important; + justify-content: space-between !important; + } + .justify-content-xl-around { + -ms-flex-pack: distribute !important; + justify-content: space-around !important; + } + .align-items-xl-start { + -webkit-box-align: start !important; + -ms-flex-align: start !important; + align-items: flex-start !important; + } + .align-items-xl-end { + -webkit-box-align: end !important; + -ms-flex-align: end !important; + align-items: flex-end !important; + } + .align-items-xl-center { + -webkit-box-align: center !important; + -ms-flex-align: center !important; + align-items: center !important; + } + .align-items-xl-baseline { + -webkit-box-align: baseline !important; + -ms-flex-align: baseline !important; + align-items: baseline !important; + } + .align-items-xl-stretch { + -webkit-box-align: stretch !important; + -ms-flex-align: stretch !important; + align-items: stretch !important; + } + .align-content-xl-start { + -ms-flex-line-pack: start !important; + align-content: flex-start !important; + } + .align-content-xl-end { + -ms-flex-line-pack: end !important; + align-content: flex-end !important; + } + .align-content-xl-center { + -ms-flex-line-pack: center !important; + align-content: center !important; + } + .align-content-xl-between { + -ms-flex-line-pack: justify !important; + align-content: space-between !important; + } + .align-content-xl-around { + -ms-flex-line-pack: distribute !important; + align-content: space-around !important; + } + .align-content-xl-stretch { + -ms-flex-line-pack: stretch !important; + align-content: stretch !important; + } + .align-self-xl-auto { + -ms-flex-item-align: auto !important; + align-self: auto !important; + } + .align-self-xl-start { + -ms-flex-item-align: start !important; + align-self: flex-start !important; + } + .align-self-xl-end { + -ms-flex-item-align: end !important; + align-self: flex-end !important; + } + .align-self-xl-center { + -ms-flex-item-align: center !important; + align-self: center !important; + } + .align-self-xl-baseline { + -ms-flex-item-align: baseline !important; + align-self: baseline !important; + } + .align-self-xl-stretch { + -ms-flex-item-align: stretch !important; + align-self: stretch !important; + } +} + +.float-left { + float: left !important; +} + +.float-right { + float: right !important; +} + +.float-none { + float: none !important; +} + +@media (min-width: 576px) { + .float-sm-left { + float: left !important; + } + .float-sm-right { + float: right !important; + } + .float-sm-none { + float: none !important; + } +} + +@media (min-width: 768px) { + .float-md-left { + float: left !important; + } + .float-md-right { + float: right !important; + } + .float-md-none { + float: none !important; + } +} + +@media (min-width: 992px) { + .float-lg-left { + float: left !important; + } + .float-lg-right { + float: right !important; + } + .float-lg-none { + float: none !important; + } +} + +@media (min-width: 1200px) { + .float-xl-left { + float: left !important; + } + .float-xl-right { + float: right !important; + } + .float-xl-none { + float: none !important; + } +} + +.position-static { + position: static !important; +} + +.position-relative { + position: relative !important; +} + +.position-absolute { + position: absolute !important; +} + +.position-fixed { + position: fixed !important; +} + +.position-sticky { + position: -webkit-sticky !important; + position: sticky !important; +} + +.fixed-top { + position: fixed; + top: 0; + right: 0; + left: 0; + z-index: 1030; +} + +.fixed-bottom { + position: fixed; + right: 0; + bottom: 0; + left: 0; + z-index: 1030; +} + +@supports ((position: -webkit-sticky) or (position: sticky)) { + .sticky-top { + position: -webkit-sticky; + position: sticky; + top: 0; + z-index: 1020; + } +} + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + -webkit-clip-path: inset(50%); + clip-path: inset(50%); + border: 0; +} + +.sr-only-focusable:active, .sr-only-focusable:focus { + position: static; + width: auto; + height: auto; + overflow: visible; + clip: auto; + white-space: normal; + -webkit-clip-path: none; + clip-path: none; +} + +.w-25 { + width: 25% !important; +} + +.w-50 { + width: 50% !important; +} + +.w-75 { + width: 75% !important; +} + +.w-100 { + width: 100% !important; +} + +.h-25 { + height: 25% !important; +} + +.h-50 { + height: 50% !important; +} + +.h-75 { + height: 75% !important; +} + +.h-100 { + height: 100% !important; +} + +.mw-100 { + max-width: 100% !important; +} + +.mh-100 { + max-height: 100% !important; +} + +.m-0 { + margin: 0 !important; +} + +.mt-0, +.my-0 { + margin-top: 0 !important; +} + +.mr-0, +.mx-0 { + margin-right: 0 !important; +} + +.mb-0, +.my-0 { + margin-bottom: 0 !important; +} + +.ml-0, +.mx-0 { + margin-left: 0 !important; +} + +.m-1 { + margin: 0.25rem !important; +} + +.mt-1, +.my-1 { + margin-top: 0.25rem !important; +} + +.mr-1, +.mx-1 { + margin-right: 0.25rem !important; +} + +.mb-1, +.my-1 { + margin-bottom: 0.25rem !important; +} + +.ml-1, +.mx-1 { + margin-left: 0.25rem !important; +} + +.m-2 { + margin: 0.5rem !important; +} + +.mt-2, +.my-2 { + margin-top: 0.5rem !important; +} + +.mr-2, +.mx-2 { + margin-right: 0.5rem !important; +} + +.mb-2, +.my-2 { + margin-bottom: 0.5rem !important; +} + +.ml-2, +.mx-2 { + margin-left: 0.5rem !important; +} + +.m-3 { + margin: 1rem !important; +} + +.mt-3, +.my-3 { + margin-top: 1rem !important; +} + +.mr-3, +.mx-3 { + margin-right: 1rem !important; +} + +.mb-3, +.my-3 { + margin-bottom: 1rem !important; +} + +.ml-3, +.mx-3 { + margin-left: 1rem !important; +} + +.m-4 { + margin: 1.5rem !important; +} + +.mt-4, +.my-4 { + margin-top: 1.5rem !important; +} + +.mr-4, +.mx-4 { + margin-right: 1.5rem !important; +} + +.mb-4, +.my-4 { + margin-bottom: 1.5rem !important; +} + +.ml-4, +.mx-4 { + margin-left: 1.5rem !important; +} + +.m-5 { + margin: 3rem !important; +} + +.mt-5, +.my-5 { + margin-top: 3rem !important; +} + +.mr-5, +.mx-5 { + margin-right: 3rem !important; +} + +.mb-5, +.my-5 { + margin-bottom: 3rem !important; +} + +.ml-5, +.mx-5 { + margin-left: 3rem !important; +} + +.p-0 { + padding: 0 !important; +} + +.pt-0, +.py-0 { + padding-top: 0 !important; +} + +.pr-0, +.px-0 { + padding-right: 0 !important; +} + +.pb-0, +.py-0 { + padding-bottom: 0 !important; +} + +.pl-0, +.px-0 { + padding-left: 0 !important; +} + +.p-1 { + padding: 0.25rem !important; +} + +.pt-1, +.py-1 { + padding-top: 0.25rem !important; +} + +.pr-1, +.px-1 { + padding-right: 0.25rem !important; +} + +.pb-1, +.py-1 { + padding-bottom: 0.25rem !important; +} + +.pl-1, +.px-1 { + padding-left: 0.25rem !important; +} + +.p-2 { + padding: 0.5rem !important; +} + +.pt-2, +.py-2 { + padding-top: 0.5rem !important; +} + +.pr-2, +.px-2 { + padding-right: 0.5rem !important; +} + +.pb-2, +.py-2 { + padding-bottom: 0.5rem !important; +} + +.pl-2, +.px-2 { + padding-left: 0.5rem !important; +} + +.p-3 { + padding: 1rem !important; +} + +.pt-3, +.py-3 { + padding-top: 1rem !important; +} + +.pr-3, +.px-3 { + padding-right: 1rem !important; +} + +.pb-3, +.py-3 { + padding-bottom: 1rem !important; +} + +.pl-3, +.px-3 { + padding-left: 1rem !important; +} + +.p-4 { + padding: 1.5rem !important; +} + +.pt-4, +.py-4 { + padding-top: 1.5rem !important; +} + +.pr-4, +.px-4 { + padding-right: 1.5rem !important; +} + +.pb-4, +.py-4 { + padding-bottom: 1.5rem !important; +} + +.pl-4, +.px-4 { + padding-left: 1.5rem !important; +} + +.p-5 { + padding: 3rem !important; +} + +.pt-5, +.py-5 { + padding-top: 3rem !important; +} + +.pr-5, +.px-5 { + padding-right: 3rem !important; +} + +.pb-5, +.py-5 { + padding-bottom: 3rem !important; +} + +.pl-5, +.px-5 { + padding-left: 3rem !important; +} + +.m-auto { + margin: auto !important; +} + +.mt-auto, +.my-auto { + margin-top: auto !important; +} + +.mr-auto, +.mx-auto { + margin-right: auto !important; +} + +.mb-auto, +.my-auto { + margin-bottom: auto !important; +} + +.ml-auto, +.mx-auto { + margin-left: auto !important; +} + +@media (min-width: 576px) { + .m-sm-0 { + margin: 0 !important; + } + .mt-sm-0, + .my-sm-0 { + margin-top: 0 !important; + } + .mr-sm-0, + .mx-sm-0 { + margin-right: 0 !important; + } + .mb-sm-0, + .my-sm-0 { + margin-bottom: 0 !important; + } + .ml-sm-0, + .mx-sm-0 { + margin-left: 0 !important; + } + .m-sm-1 { + margin: 0.25rem !important; + } + .mt-sm-1, + .my-sm-1 { + margin-top: 0.25rem !important; + } + .mr-sm-1, + .mx-sm-1 { + margin-right: 0.25rem !important; + } + .mb-sm-1, + .my-sm-1 { + margin-bottom: 0.25rem !important; + } + .ml-sm-1, + .mx-sm-1 { + margin-left: 0.25rem !important; + } + .m-sm-2 { + margin: 0.5rem !important; + } + .mt-sm-2, + .my-sm-2 { + margin-top: 0.5rem !important; + } + .mr-sm-2, + .mx-sm-2 { + margin-right: 0.5rem !important; + } + .mb-sm-2, + .my-sm-2 { + margin-bottom: 0.5rem !important; + } + .ml-sm-2, + .mx-sm-2 { + margin-left: 0.5rem !important; + } + .m-sm-3 { + margin: 1rem !important; + } + .mt-sm-3, + .my-sm-3 { + margin-top: 1rem !important; + } + .mr-sm-3, + .mx-sm-3 { + margin-right: 1rem !important; + } + .mb-sm-3, + .my-sm-3 { + margin-bottom: 1rem !important; + } + .ml-sm-3, + .mx-sm-3 { + margin-left: 1rem !important; + } + .m-sm-4 { + margin: 1.5rem !important; + } + .mt-sm-4, + .my-sm-4 { + margin-top: 1.5rem !important; + } + .mr-sm-4, + .mx-sm-4 { + margin-right: 1.5rem !important; + } + .mb-sm-4, + .my-sm-4 { + margin-bottom: 1.5rem !important; + } + .ml-sm-4, + .mx-sm-4 { + margin-left: 1.5rem !important; + } + .m-sm-5 { + margin: 3rem !important; + } + .mt-sm-5, + .my-sm-5 { + margin-top: 3rem !important; + } + .mr-sm-5, + .mx-sm-5 { + margin-right: 3rem !important; + } + .mb-sm-5, + .my-sm-5 { + margin-bottom: 3rem !important; + } + .ml-sm-5, + .mx-sm-5 { + margin-left: 3rem !important; + } + .p-sm-0 { + padding: 0 !important; + } + .pt-sm-0, + .py-sm-0 { + padding-top: 0 !important; + } + .pr-sm-0, + .px-sm-0 { + padding-right: 0 !important; + } + .pb-sm-0, + .py-sm-0 { + padding-bottom: 0 !important; + } + .pl-sm-0, + .px-sm-0 { + padding-left: 0 !important; + } + .p-sm-1 { + padding: 0.25rem !important; + } + .pt-sm-1, + .py-sm-1 { + padding-top: 0.25rem !important; + } + .pr-sm-1, + .px-sm-1 { + padding-right: 0.25rem !important; + } + .pb-sm-1, + .py-sm-1 { + padding-bottom: 0.25rem !important; + } + .pl-sm-1, + .px-sm-1 { + padding-left: 0.25rem !important; + } + .p-sm-2 { + padding: 0.5rem !important; + } + .pt-sm-2, + .py-sm-2 { + padding-top: 0.5rem !important; + } + .pr-sm-2, + .px-sm-2 { + padding-right: 0.5rem !important; + } + .pb-sm-2, + .py-sm-2 { + padding-bottom: 0.5rem !important; + } + .pl-sm-2, + .px-sm-2 { + padding-left: 0.5rem !important; + } + .p-sm-3 { + padding: 1rem !important; + } + .pt-sm-3, + .py-sm-3 { + padding-top: 1rem !important; + } + .pr-sm-3, + .px-sm-3 { + padding-right: 1rem !important; + } + .pb-sm-3, + .py-sm-3 { + padding-bottom: 1rem !important; + } + .pl-sm-3, + .px-sm-3 { + padding-left: 1rem !important; + } + .p-sm-4 { + padding: 1.5rem !important; + } + .pt-sm-4, + .py-sm-4 { + padding-top: 1.5rem !important; + } + .pr-sm-4, + .px-sm-4 { + padding-right: 1.5rem !important; + } + .pb-sm-4, + .py-sm-4 { + padding-bottom: 1.5rem !important; + } + .pl-sm-4, + .px-sm-4 { + padding-left: 1.5rem !important; + } + .p-sm-5 { + padding: 3rem !important; + } + .pt-sm-5, + .py-sm-5 { + padding-top: 3rem !important; + } + .pr-sm-5, + .px-sm-5 { + padding-right: 3rem !important; + } + .pb-sm-5, + .py-sm-5 { + padding-bottom: 3rem !important; + } + .pl-sm-5, + .px-sm-5 { + padding-left: 3rem !important; + } + .m-sm-auto { + margin: auto !important; + } + .mt-sm-auto, + .my-sm-auto { + margin-top: auto !important; + } + .mr-sm-auto, + .mx-sm-auto { + margin-right: auto !important; + } + .mb-sm-auto, + .my-sm-auto { + margin-bottom: auto !important; + } + .ml-sm-auto, + .mx-sm-auto { + margin-left: auto !important; + } +} + +@media (min-width: 768px) { + .m-md-0 { + margin: 0 !important; + } + .mt-md-0, + .my-md-0 { + margin-top: 0 !important; + } + .mr-md-0, + .mx-md-0 { + margin-right: 0 !important; + } + .mb-md-0, + .my-md-0 { + margin-bottom: 0 !important; + } + .ml-md-0, + .mx-md-0 { + margin-left: 0 !important; + } + .m-md-1 { + margin: 0.25rem !important; + } + .mt-md-1, + .my-md-1 { + margin-top: 0.25rem !important; + } + .mr-md-1, + .mx-md-1 { + margin-right: 0.25rem !important; + } + .mb-md-1, + .my-md-1 { + margin-bottom: 0.25rem !important; + } + .ml-md-1, + .mx-md-1 { + margin-left: 0.25rem !important; + } + .m-md-2 { + margin: 0.5rem !important; + } + .mt-md-2, + .my-md-2 { + margin-top: 0.5rem !important; + } + .mr-md-2, + .mx-md-2 { + margin-right: 0.5rem !important; + } + .mb-md-2, + .my-md-2 { + margin-bottom: 0.5rem !important; + } + .ml-md-2, + .mx-md-2 { + margin-left: 0.5rem !important; + } + .m-md-3 { + margin: 1rem !important; + } + .mt-md-3, + .my-md-3 { + margin-top: 1rem !important; + } + .mr-md-3, + .mx-md-3 { + margin-right: 1rem !important; + } + .mb-md-3, + .my-md-3 { + margin-bottom: 1rem !important; + } + .ml-md-3, + .mx-md-3 { + margin-left: 1rem !important; + } + .m-md-4 { + margin: 1.5rem !important; + } + .mt-md-4, + .my-md-4 { + margin-top: 1.5rem !important; + } + .mr-md-4, + .mx-md-4 { + margin-right: 1.5rem !important; + } + .mb-md-4, + .my-md-4 { + margin-bottom: 1.5rem !important; + } + .ml-md-4, + .mx-md-4 { + margin-left: 1.5rem !important; + } + .m-md-5 { + margin: 3rem !important; + } + .mt-md-5, + .my-md-5 { + margin-top: 3rem !important; + } + .mr-md-5, + .mx-md-5 { + margin-right: 3rem !important; + } + .mb-md-5, + .my-md-5 { + margin-bottom: 3rem !important; + } + .ml-md-5, + .mx-md-5 { + margin-left: 3rem !important; + } + .p-md-0 { + padding: 0 !important; + } + .pt-md-0, + .py-md-0 { + padding-top: 0 !important; + } + .pr-md-0, + .px-md-0 { + padding-right: 0 !important; + } + .pb-md-0, + .py-md-0 { + padding-bottom: 0 !important; + } + .pl-md-0, + .px-md-0 { + padding-left: 0 !important; + } + .p-md-1 { + padding: 0.25rem !important; + } + .pt-md-1, + .py-md-1 { + padding-top: 0.25rem !important; + } + .pr-md-1, + .px-md-1 { + padding-right: 0.25rem !important; + } + .pb-md-1, + .py-md-1 { + padding-bottom: 0.25rem !important; + } + .pl-md-1, + .px-md-1 { + padding-left: 0.25rem !important; + } + .p-md-2 { + padding: 0.5rem !important; + } + .pt-md-2, + .py-md-2 { + padding-top: 0.5rem !important; + } + .pr-md-2, + .px-md-2 { + padding-right: 0.5rem !important; + } + .pb-md-2, + .py-md-2 { + padding-bottom: 0.5rem !important; + } + .pl-md-2, + .px-md-2 { + padding-left: 0.5rem !important; + } + .p-md-3 { + padding: 1rem !important; + } + .pt-md-3, + .py-md-3 { + padding-top: 1rem !important; + } + .pr-md-3, + .px-md-3 { + padding-right: 1rem !important; + } + .pb-md-3, + .py-md-3 { + padding-bottom: 1rem !important; + } + .pl-md-3, + .px-md-3 { + padding-left: 1rem !important; + } + .p-md-4 { + padding: 1.5rem !important; + } + .pt-md-4, + .py-md-4 { + padding-top: 1.5rem !important; + } + .pr-md-4, + .px-md-4 { + padding-right: 1.5rem !important; + } + .pb-md-4, + .py-md-4 { + padding-bottom: 1.5rem !important; + } + .pl-md-4, + .px-md-4 { + padding-left: 1.5rem !important; + } + .p-md-5 { + padding: 3rem !important; + } + .pt-md-5, + .py-md-5 { + padding-top: 3rem !important; + } + .pr-md-5, + .px-md-5 { + padding-right: 3rem !important; + } + .pb-md-5, + .py-md-5 { + padding-bottom: 3rem !important; + } + .pl-md-5, + .px-md-5 { + padding-left: 3rem !important; + } + .m-md-auto { + margin: auto !important; + } + .mt-md-auto, + .my-md-auto { + margin-top: auto !important; + } + .mr-md-auto, + .mx-md-auto { + margin-right: auto !important; + } + .mb-md-auto, + .my-md-auto { + margin-bottom: auto !important; + } + .ml-md-auto, + .mx-md-auto { + margin-left: auto !important; + } +} + +@media (min-width: 992px) { + .m-lg-0 { + margin: 0 !important; + } + .mt-lg-0, + .my-lg-0 { + margin-top: 0 !important; + } + .mr-lg-0, + .mx-lg-0 { + margin-right: 0 !important; + } + .mb-lg-0, + .my-lg-0 { + margin-bottom: 0 !important; + } + .ml-lg-0, + .mx-lg-0 { + margin-left: 0 !important; + } + .m-lg-1 { + margin: 0.25rem !important; + } + .mt-lg-1, + .my-lg-1 { + margin-top: 0.25rem !important; + } + .mr-lg-1, + .mx-lg-1 { + margin-right: 0.25rem !important; + } + .mb-lg-1, + .my-lg-1 { + margin-bottom: 0.25rem !important; + } + .ml-lg-1, + .mx-lg-1 { + margin-left: 0.25rem !important; + } + .m-lg-2 { + margin: 0.5rem !important; + } + .mt-lg-2, + .my-lg-2 { + margin-top: 0.5rem !important; + } + .mr-lg-2, + .mx-lg-2 { + margin-right: 0.5rem !important; + } + .mb-lg-2, + .my-lg-2 { + margin-bottom: 0.5rem !important; + } + .ml-lg-2, + .mx-lg-2 { + margin-left: 0.5rem !important; + } + .m-lg-3 { + margin: 1rem !important; + } + .mt-lg-3, + .my-lg-3 { + margin-top: 1rem !important; + } + .mr-lg-3, + .mx-lg-3 { + margin-right: 1rem !important; + } + .mb-lg-3, + .my-lg-3 { + margin-bottom: 1rem !important; + } + .ml-lg-3, + .mx-lg-3 { + margin-left: 1rem !important; + } + .m-lg-4 { + margin: 1.5rem !important; + } + .mt-lg-4, + .my-lg-4 { + margin-top: 1.5rem !important; + } + .mr-lg-4, + .mx-lg-4 { + margin-right: 1.5rem !important; + } + .mb-lg-4, + .my-lg-4 { + margin-bottom: 1.5rem !important; + } + .ml-lg-4, + .mx-lg-4 { + margin-left: 1.5rem !important; + } + .m-lg-5 { + margin: 3rem !important; + } + .mt-lg-5, + .my-lg-5 { + margin-top: 3rem !important; + } + .mr-lg-5, + .mx-lg-5 { + margin-right: 3rem !important; + } + .mb-lg-5, + .my-lg-5 { + margin-bottom: 3rem !important; + } + .ml-lg-5, + .mx-lg-5 { + margin-left: 3rem !important; + } + .p-lg-0 { + padding: 0 !important; + } + .pt-lg-0, + .py-lg-0 { + padding-top: 0 !important; + } + .pr-lg-0, + .px-lg-0 { + padding-right: 0 !important; + } + .pb-lg-0, + .py-lg-0 { + padding-bottom: 0 !important; + } + .pl-lg-0, + .px-lg-0 { + padding-left: 0 !important; + } + .p-lg-1 { + padding: 0.25rem !important; + } + .pt-lg-1, + .py-lg-1 { + padding-top: 0.25rem !important; + } + .pr-lg-1, + .px-lg-1 { + padding-right: 0.25rem !important; + } + .pb-lg-1, + .py-lg-1 { + padding-bottom: 0.25rem !important; + } + .pl-lg-1, + .px-lg-1 { + padding-left: 0.25rem !important; + } + .p-lg-2 { + padding: 0.5rem !important; + } + .pt-lg-2, + .py-lg-2 { + padding-top: 0.5rem !important; + } + .pr-lg-2, + .px-lg-2 { + padding-right: 0.5rem !important; + } + .pb-lg-2, + .py-lg-2 { + padding-bottom: 0.5rem !important; + } + .pl-lg-2, + .px-lg-2 { + padding-left: 0.5rem !important; + } + .p-lg-3 { + padding: 1rem !important; + } + .pt-lg-3, + .py-lg-3 { + padding-top: 1rem !important; + } + .pr-lg-3, + .px-lg-3 { + padding-right: 1rem !important; + } + .pb-lg-3, + .py-lg-3 { + padding-bottom: 1rem !important; + } + .pl-lg-3, + .px-lg-3 { + padding-left: 1rem !important; + } + .p-lg-4 { + padding: 1.5rem !important; + } + .pt-lg-4, + .py-lg-4 { + padding-top: 1.5rem !important; + } + .pr-lg-4, + .px-lg-4 { + padding-right: 1.5rem !important; + } + .pb-lg-4, + .py-lg-4 { + padding-bottom: 1.5rem !important; + } + .pl-lg-4, + .px-lg-4 { + padding-left: 1.5rem !important; + } + .p-lg-5 { + padding: 3rem !important; + } + .pt-lg-5, + .py-lg-5 { + padding-top: 3rem !important; + } + .pr-lg-5, + .px-lg-5 { + padding-right: 3rem !important; + } + .pb-lg-5, + .py-lg-5 { + padding-bottom: 3rem !important; + } + .pl-lg-5, + .px-lg-5 { + padding-left: 3rem !important; + } + .m-lg-auto { + margin: auto !important; + } + .mt-lg-auto, + .my-lg-auto { + margin-top: auto !important; + } + .mr-lg-auto, + .mx-lg-auto { + margin-right: auto !important; + } + .mb-lg-auto, + .my-lg-auto { + margin-bottom: auto !important; + } + .ml-lg-auto, + .mx-lg-auto { + margin-left: auto !important; + } +} + +@media (min-width: 1200px) { + .m-xl-0 { + margin: 0 !important; + } + .mt-xl-0, + .my-xl-0 { + margin-top: 0 !important; + } + .mr-xl-0, + .mx-xl-0 { + margin-right: 0 !important; + } + .mb-xl-0, + .my-xl-0 { + margin-bottom: 0 !important; + } + .ml-xl-0, + .mx-xl-0 { + margin-left: 0 !important; + } + .m-xl-1 { + margin: 0.25rem !important; + } + .mt-xl-1, + .my-xl-1 { + margin-top: 0.25rem !important; + } + .mr-xl-1, + .mx-xl-1 { + margin-right: 0.25rem !important; + } + .mb-xl-1, + .my-xl-1 { + margin-bottom: 0.25rem !important; + } + .ml-xl-1, + .mx-xl-1 { + margin-left: 0.25rem !important; + } + .m-xl-2 { + margin: 0.5rem !important; + } + .mt-xl-2, + .my-xl-2 { + margin-top: 0.5rem !important; + } + .mr-xl-2, + .mx-xl-2 { + margin-right: 0.5rem !important; + } + .mb-xl-2, + .my-xl-2 { + margin-bottom: 0.5rem !important; + } + .ml-xl-2, + .mx-xl-2 { + margin-left: 0.5rem !important; + } + .m-xl-3 { + margin: 1rem !important; + } + .mt-xl-3, + .my-xl-3 { + margin-top: 1rem !important; + } + .mr-xl-3, + .mx-xl-3 { + margin-right: 1rem !important; + } + .mb-xl-3, + .my-xl-3 { + margin-bottom: 1rem !important; + } + .ml-xl-3, + .mx-xl-3 { + margin-left: 1rem !important; + } + .m-xl-4 { + margin: 1.5rem !important; + } + .mt-xl-4, + .my-xl-4 { + margin-top: 1.5rem !important; + } + .mr-xl-4, + .mx-xl-4 { + margin-right: 1.5rem !important; + } + .mb-xl-4, + .my-xl-4 { + margin-bottom: 1.5rem !important; + } + .ml-xl-4, + .mx-xl-4 { + margin-left: 1.5rem !important; + } + .m-xl-5 { + margin: 3rem !important; + } + .mt-xl-5, + .my-xl-5 { + margin-top: 3rem !important; + } + .mr-xl-5, + .mx-xl-5 { + margin-right: 3rem !important; + } + .mb-xl-5, + .my-xl-5 { + margin-bottom: 3rem !important; + } + .ml-xl-5, + .mx-xl-5 { + margin-left: 3rem !important; + } + .p-xl-0 { + padding: 0 !important; + } + .pt-xl-0, + .py-xl-0 { + padding-top: 0 !important; + } + .pr-xl-0, + .px-xl-0 { + padding-right: 0 !important; + } + .pb-xl-0, + .py-xl-0 { + padding-bottom: 0 !important; + } + .pl-xl-0, + .px-xl-0 { + padding-left: 0 !important; + } + .p-xl-1 { + padding: 0.25rem !important; + } + .pt-xl-1, + .py-xl-1 { + padding-top: 0.25rem !important; + } + .pr-xl-1, + .px-xl-1 { + padding-right: 0.25rem !important; + } + .pb-xl-1, + .py-xl-1 { + padding-bottom: 0.25rem !important; + } + .pl-xl-1, + .px-xl-1 { + padding-left: 0.25rem !important; + } + .p-xl-2 { + padding: 0.5rem !important; + } + .pt-xl-2, + .py-xl-2 { + padding-top: 0.5rem !important; + } + .pr-xl-2, + .px-xl-2 { + padding-right: 0.5rem !important; + } + .pb-xl-2, + .py-xl-2 { + padding-bottom: 0.5rem !important; + } + .pl-xl-2, + .px-xl-2 { + padding-left: 0.5rem !important; + } + .p-xl-3 { + padding: 1rem !important; + } + .pt-xl-3, + .py-xl-3 { + padding-top: 1rem !important; + } + .pr-xl-3, + .px-xl-3 { + padding-right: 1rem !important; + } + .pb-xl-3, + .py-xl-3 { + padding-bottom: 1rem !important; + } + .pl-xl-3, + .px-xl-3 { + padding-left: 1rem !important; + } + .p-xl-4 { + padding: 1.5rem !important; + } + .pt-xl-4, + .py-xl-4 { + padding-top: 1.5rem !important; + } + .pr-xl-4, + .px-xl-4 { + padding-right: 1.5rem !important; + } + .pb-xl-4, + .py-xl-4 { + padding-bottom: 1.5rem !important; + } + .pl-xl-4, + .px-xl-4 { + padding-left: 1.5rem !important; + } + .p-xl-5 { + padding: 3rem !important; + } + .pt-xl-5, + .py-xl-5 { + padding-top: 3rem !important; + } + .pr-xl-5, + .px-xl-5 { + padding-right: 3rem !important; + } + .pb-xl-5, + .py-xl-5 { + padding-bottom: 3rem !important; + } + .pl-xl-5, + .px-xl-5 { + padding-left: 3rem !important; + } + .m-xl-auto { + margin: auto !important; + } + .mt-xl-auto, + .my-xl-auto { + margin-top: auto !important; + } + .mr-xl-auto, + .mx-xl-auto { + margin-right: auto !important; + } + .mb-xl-auto, + .my-xl-auto { + margin-bottom: auto !important; + } + .ml-xl-auto, + .mx-xl-auto { + margin-left: auto !important; + } +} + +.text-justify { + text-align: justify !important; +} + +.text-nowrap { + white-space: nowrap !important; +} + +.text-truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.text-left { + text-align: left !important; +} + +.text-right { + text-align: right !important; +} + +.text-center { + text-align: center !important; +} + +@media (min-width: 576px) { + .text-sm-left { + text-align: left !important; + } + .text-sm-right { + text-align: right !important; + } + .text-sm-center { + text-align: center !important; + } +} + +@media (min-width: 768px) { + .text-md-left { + text-align: left !important; + } + .text-md-right { + text-align: right !important; + } + .text-md-center { + text-align: center !important; + } +} + +@media (min-width: 992px) { + .text-lg-left { + text-align: left !important; + } + .text-lg-right { + text-align: right !important; + } + .text-lg-center { + text-align: center !important; + } +} + +@media (min-width: 1200px) { + .text-xl-left { + text-align: left !important; + } + .text-xl-right { + text-align: right !important; + } + .text-xl-center { + text-align: center !important; + } +} + +.text-lowercase { + text-transform: lowercase !important; +} + +.text-uppercase { + text-transform: uppercase !important; +} + +.text-capitalize { + text-transform: capitalize !important; +} + +.font-weight-light { + font-weight: 300 !important; +} + +.font-weight-normal { + font-weight: 400 !important; +} + +.font-weight-bold { + font-weight: 700 !important; +} + +.font-italic { + font-style: italic !important; +} + +.text-white { + color: #fff !important; +} + +.text-primary { + color: #007bff !important; +} + +a.text-primary:hover, a.text-primary:focus { + color: #0062cc !important; +} + +.text-secondary { + color: #6c757d !important; +} + +a.text-secondary:hover, a.text-secondary:focus { + color: #545b62 !important; +} + +.text-success { + color: #28a745 !important; +} + +a.text-success:hover, a.text-success:focus { + color: #1e7e34 !important; +} + +.text-info { + color: #17a2b8 !important; +} + +a.text-info:hover, a.text-info:focus { + color: #117a8b !important; +} + +.text-warning { + color: #ffc107 !important; +} + +a.text-warning:hover, a.text-warning:focus { + color: #d39e00 !important; +} + +.text-danger { + color: #dc3545 !important; +} + +a.text-danger:hover, a.text-danger:focus { + color: #bd2130 !important; +} + +.text-light { + color: #f8f9fa !important; +} + +a.text-light:hover, a.text-light:focus { + color: #dae0e5 !important; +} + +.text-dark { + color: #343a40 !important; +} + +a.text-dark:hover, a.text-dark:focus { + color: #1d2124 !important; +} + +.text-muted { + color: #6c757d !important; +} + +.text-hide { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} + +.visible { + visibility: visible !important; +} + +.invisible { + visibility: hidden !important; +} + +@media print { + *, + *::before, + *::after { + text-shadow: none !important; + box-shadow: none !important; + } + a:not(.btn) { + text-decoration: underline; + } + abbr[title]::after { + content: " (" attr(title) ")"; + } + pre { + white-space: pre-wrap !important; + } + pre, + blockquote { + border: 1px solid #999; + page-break-inside: avoid; + } + thead { + display: table-header-group; + } + tr, + img { + page-break-inside: avoid; + } + p, + h2, + h3 { + orphans: 3; + widows: 3; + } + h2, + h3 { + page-break-after: avoid; + } + @page { + size: a3; + } + body { + min-width: 992px !important; + } + .container { + min-width: 992px !important; + } + .navbar { + display: none; + } + .badge { + border: 1px solid #000; + } + .table { + border-collapse: collapse !important; + } + .table td, + .table th { + background-color: #fff !important; + } + .table-bordered th, + .table-bordered td { + border: 1px solid #ddd !important; + } +} /*# sourceMappingURL=bootstrap.css.map */ \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityStateManager.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityStateManager.java index 23553d53..27bd145c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityStateManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityStateManager.java @@ -1,36 +1,55 @@ -package com.darkweb.genesissearchengine.appManager; - -import android.app.Service; -import android.content.Intent; -import android.os.IBinder; -import com.darkweb.genesissearchengine.constants.status; - -public class activityStateManager extends Service { - - @Override - public IBinder onBind(Intent intent) { - return null; - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - return START_NOT_STICKY; - } - - @Override - public void onDestroy() { - status.sSettingIsAppStarted = false; - super.onDestroy(); - android.os.Process.killProcess(android.os.Process.myPid()); - System.exit(1); - } - - @Override - public void onTaskRemoved(Intent rootIntent) { - status.sSettingIsAppStarted = false; - stopSelf(); - super.onDestroy(); - android.os.Process.killProcess(android.os.Process.myPid()); - System.exit(1); - } +package com.darkweb.genesissearchengine.appManager; + +import android.app.Service; +import android.content.Intent; +import android.os.IBinder; + +import androidx.core.app.NotificationManagerCompat; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; + +import org.torproject.android.proxy.OrbotService; +import org.torproject.android.proxy.wrapper.orbotLocalConstants; + +import java.util.Collections; + +public class activityStateManager extends Service { + + @Override + public IBinder onBind(Intent intent) { + return null; + } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + return START_NOT_STICKY; + } + + @Override + public void onDestroy() { + Intent mServiceIntent = new Intent(this.getApplicationContext(), OrbotService.class); + this.stopService(mServiceIntent); + OrbotService.getServiceObject().onDestroy(); + + status.sSettingIsAppStarted = false; + super.onDestroy(); + android.os.Process.killProcess(android.os.Process.myPid()); + System.exit(1); + } + + @Override + public void onTaskRemoved(Intent rootIntent) { + Intent mServiceIntent = new Intent(this.getApplicationContext(), OrbotService.class); + this.stopService(mServiceIntent); + OrbotService.getServiceObject().onDestroy(); + + status.sSettingIsAppStarted = false; + + stopSelf(); + super.onDestroy(); + android.os.Process.killProcess(android.os.Process.myPid()); + System.exit(1); + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityThemeManager.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityThemeManager.java index 8d0ebf74..360972e7 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityThemeManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityThemeManager.java @@ -1,130 +1,130 @@ -package com.darkweb.genesissearchengine.appManager; - -import android.content.Context; -import android.content.res.Configuration; -import android.content.res.Resources; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; - -public class activityThemeManager { - - private static activityThemeManager ourInstance = new activityThemeManager(); - int mode = -1; - - public static activityThemeManager getInstance() - { - return ourInstance; - } - - public void onConfigurationChanged(AppCompatActivity pContext){ - boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; - setupThemeLocal(pContext, sDefaultNightMode); - pContext.recreate(); - } - - public boolean onInitTheme(AppCompatActivity pContext){ - boolean mIsNightMode = (pContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; - if(status.sTheme == enums.Theme.THEME_DEFAULT){ - if(!status.sDefaultNightMode && mIsNightMode){ - return true; - }else if(status.sDefaultNightMode && !mIsNightMode){ - return true; - } - } - else{ - if(status.sTheme != enums.Theme.THEME_DARK && mIsNightMode){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - return true; - }else if(status.sTheme == enums.Theme.THEME_DARK && !mIsNightMode){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - return true; - } - } - return false; - } - - public void setupThemeLocal(Context context, boolean sDefaultNightMode) { - Resources res = context.getResources(); - mode = res.getConfiguration().uiMode; - - if(status.sTheme == enums.Theme.THEME_DARK){ - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - mode = Configuration.UI_MODE_NIGHT_YES; - } - }else if(status.sTheme == enums.Theme.THEME_LIGHT){ - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - mode = Configuration.UI_MODE_NIGHT_NO; - } - }else { - if(!sDefaultNightMode){ - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - mode = Configuration.UI_MODE_NIGHT_NO; - } - }else { - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - mode = Configuration.UI_MODE_NIGHT_YES; - } - } - } - } - - public Context setupTheme(Context context) { - - Resources res = context.getResources(); - - if(mode==-1){ - mode = res.getConfiguration().uiMode; - - if(status.sTheme == enums.Theme.THEME_DARK){ - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - mode = Configuration.UI_MODE_NIGHT_YES; - } - }else if(status.sTheme == enums.Theme.THEME_LIGHT){ - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - mode = Configuration.UI_MODE_NIGHT_NO; - } - }else { - if(!status.sDefaultNightMode){ - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - mode = Configuration.UI_MODE_NIGHT_NO; - } - }else { - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - mode = Configuration.UI_MODE_NIGHT_YES; - } - } - } - } - - Configuration config = new Configuration(res.getConfiguration()); - config.uiMode = mode; - context = context.createConfigurationContext(config); - return context; - } - - public Context initTheme(Context pContext){ - boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; - - if(status.sSettingIsAppStarted){ - status.mThemeApplying = true; - } - - status.sDefaultNightMode = sDefaultNightMode; - pContext = setupTheme(pContext); - - mode = -1; - - return pContext; - } - -} +package com.darkweb.genesissearchengine.appManager; + +import android.content.Context; +import android.content.res.Configuration; +import android.content.res.Resources; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.status; + +public class activityThemeManager { + + private static activityThemeManager ourInstance = new activityThemeManager(); + int mode = -1; + + public static activityThemeManager getInstance() + { + return ourInstance; + } + + public void onConfigurationChanged(AppCompatActivity pContext){ + boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; + setupThemeLocal(pContext, sDefaultNightMode); + pContext.recreate(); + } + + public boolean onInitTheme(AppCompatActivity pContext){ + boolean mIsNightMode = (pContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; + if(status.sTheme == enums.Theme.THEME_DEFAULT){ + if(!status.sDefaultNightMode && mIsNightMode){ + return true; + }else if(status.sDefaultNightMode && !mIsNightMode){ + return true; + } + } + else{ + if(status.sTheme != enums.Theme.THEME_DARK && mIsNightMode){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + return true; + }else if(status.sTheme == enums.Theme.THEME_DARK && !mIsNightMode){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + return true; + } + } + return false; + } + + public void setupThemeLocal(Context context, boolean sDefaultNightMode) { + Resources res = context.getResources(); + mode = res.getConfiguration().uiMode; + + if(status.sTheme == enums.Theme.THEME_DARK){ + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + mode = Configuration.UI_MODE_NIGHT_YES; + } + }else if(status.sTheme == enums.Theme.THEME_LIGHT){ + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + mode = Configuration.UI_MODE_NIGHT_NO; + } + }else { + if(!sDefaultNightMode){ + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + mode = Configuration.UI_MODE_NIGHT_NO; + } + }else { + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + mode = Configuration.UI_MODE_NIGHT_YES; + } + } + } + } + + public Context setupTheme(Context context) { + + Resources res = context.getResources(); + + if(mode==-1){ + mode = res.getConfiguration().uiMode; + + if(status.sTheme == enums.Theme.THEME_DARK){ + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + mode = Configuration.UI_MODE_NIGHT_YES; + } + }else if(status.sTheme == enums.Theme.THEME_LIGHT){ + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + mode = Configuration.UI_MODE_NIGHT_NO; + } + }else { + if(!status.sDefaultNightMode){ + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + mode = Configuration.UI_MODE_NIGHT_NO; + } + }else { + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + mode = Configuration.UI_MODE_NIGHT_YES; + } + } + } + } + + Configuration config = new Configuration(res.getConfiguration()); + config.uiMode = mode; + context = context.createConfigurationContext(config); + return context; + } + + public Context initTheme(Context pContext){ + boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; + + if(status.sSettingIsAppStarted){ + status.mThemeApplying = true; + } + + status.sDefaultNightMode = sDefaultNightMode; + pContext = setupTheme(pContext); + + mode = -1; + + return pContext; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java index aff1fe58..0e345edd 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java @@ -1,530 +1,530 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.graphics.Bitmap; -import android.os.Handler; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewConfiguration; -import android.view.ViewGroup; -import android.widget.*; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import systems.intelligo.slight.ImageLoader; -import static android.content.Context.LAYOUT_INFLATER_SERVICE; - -public class bookmarkAdapter extends RecyclerView.Adapter -{ - /*Private Variables*/ - - private ArrayList mModelList = new ArrayList<>(); - private ArrayList mCurrentList; - private ArrayList mPassedList; - private ArrayList mRealID = new ArrayList<>(); - private ArrayList mRealIndex = new ArrayList<>(); - private ArrayList mLongSelectedDate = new ArrayList<>(); - private ArrayList mLongSelectedIndex = new ArrayList<>(); - private ArrayList mLongSelectedID = new ArrayList<>(); - - private ImageLoader imageLoader; - private AppCompatActivity mContext; - private bookmarkAdapterView mHistroyAdapterView; - private Context mListHolderContext; - private PopupWindow mPopupWindow = null; - private eventObserver.eventListener mEvent; - private String mFilter = strings.GENERIC_EMPTY_STR; - private boolean mLongPressedMenuActive = false; - - /*Local Variables*/ - - private boolean mDisableCallable = false; - private boolean mSearchEnabled = false; - - bookmarkAdapter(ArrayList pModelList, eventObserver.eventListener mEvent, AppCompatActivity pMainContext) { - this.mEvent = mEvent; - this.mCurrentList = new ArrayList<>(); - this.mPassedList = pModelList; - this.mContext = pMainContext; - this.mHistroyAdapterView = new bookmarkAdapterView(mContext); - this.imageLoader = new ImageLoader(mContext); - - initializeModelWithDate(false); - } - - private void initializeModelWithDate(boolean pFilterEnabled){ - int m_real_counter=0; - - mRealID.clear(); - mRealIndex.clear(); - mCurrentList.clear(); - this.mModelList.clear(); - onVerifyLongSelectedURL(true); - - ArrayList p_model_list = mPassedList; - for(int counter = 0; counter< p_model_list.size(); counter++){ - - if(pFilterEnabled){ - if(!p_model_list.get(counter).getHeader().toLowerCase().contains(this.mFilter.toLowerCase()) && !p_model_list.get(counter).getDescription().toLowerCase().contains(this.mFilter)){ - continue; - } - } - - mRealID.add(p_model_list.get(counter).getID()); - mRealIndex.add(counter); - this.mModelList.add(p_model_list.get(counter)); - m_real_counter+=1; - } - mCurrentList.addAll(this.mModelList); - } - - /*Initializations*/ - - private ArrayList getLongSelectedleURL(){ - return mLongSelectedIndex; - } - - public void onDeleteSelected(){ - for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){ - for(int m_counter_inner = 0; m_counter_inner< mCurrentList.size(); m_counter_inner++){ - if(mCurrentList.get(m_counter_inner).getDate() == mLongSelectedDate.get(m_counter) && mLongSelectedIndex.get(m_counter).equals("https://"+ mCurrentList.get(m_counter_inner).getDescription())){ - mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(m_counter_inner)),enums.etype.url_clear); - mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)),enums.etype.url_clear_at); - invokeFilter(false); - mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.is_empty); - - boolean mDateVerify = false; - if(mCurrentList.size()>0 && mCurrentList.size()m_counter_inner+1 && mCurrentList.get(m_counter_inner+1).getDescription()==null || mCurrentList.size()==m_counter_inner+1)){ - mDateVerify = true; - } - - if(mDateVerify){ - notifyItemRemoved(m_counter_inner-1); - mCurrentList.remove(m_counter_inner-1); - notifyItemRangeChanged(m_counter_inner-1, mCurrentList.size()); - }else { - notifyItemRemoved(m_counter_inner); - mCurrentList.remove(m_counter_inner); - notifyItemRangeChanged(m_counter_inner, mCurrentList.size()); - } - break; - } - } - } - clearLongSelectedURL(); - // initializeModelWithDate(false); - } - - private void clearLongSelectedURL(){ - for(int m_counter = 0; m_counter< mCurrentList.size(); m_counter++){ - for(int m_counter_inner = 0; m_counter_inner< mLongSelectedID.size(); m_counter_inner++){ - if(mCurrentList.get(m_counter).getID() == mLongSelectedID.get(m_counter_inner)){ - mLongSelectedID.remove(m_counter_inner); - notifyItemChanged(m_counter); - m_counter-=1; - break; - } - } - } - - mLongSelectedDate.clear(); - mLongSelectedIndex.clear(); - mLongSelectedID.clear(); - } - - private String getSelectedURL(){ - String m_joined_url = "\n"; - for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){ - m_joined_url = m_joined_url.concat("\n"+ mLongSelectedIndex.get(m_counter)); - } - return m_joined_url; - } - - @NonNull - @Override - public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - mListHolderContext = parent.getContext(); - View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.history_bookmark_row_view, parent, false); - return new listViewHolder(view); - } - - @Override - public void onBindViewHolder(@NonNull bookmarkAdapter.listViewHolder holder, int position) - { - holder.bindListView(mCurrentList.get(position), position); - } - - public int getItem(){ - return mCurrentList.size(); - } - - @Override - public int getItemCount() { - return mCurrentList.size(); - } - - /*Listeners*/ - public void onUpdateSearchStatus(boolean p_is_searched){ - mSearchEnabled = p_is_searched; - } - - public void invokeSwipeClose(int pPosition){ - onClose(pPosition); - invokeFilter(true); - - if(mPopupWindow!=null){ - mPopupWindow.dismiss(); - } - } - - public void onSelectView(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){ - if(!mSearchEnabled){ - try { - mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced, true)); - } catch (Exception e) { - e.printStackTrace(); - } - if(!pIsForced){ - mLongSelectedDate.add(pDate); - mLongSelectedIndex.add(pUrl); - mLongSelectedID.add(pId); - if(mLongSelectedIndex.size()<=1){ - notifyDataSetChanged(); - } - } - onVerifyLongSelectedURL(false); - } - } - - public void onVerifyLongSelectedURL(boolean pIsComputing){ - if(mLongSelectedIndex.size()>0){ - mEvent.invokeObserver(Collections.singletonList(false),enums.etype.on_verify_selected_url_menu); - }else { - if(!pIsComputing){ - notifyDataSetChanged(); - } - mEvent.invokeObserver(Collections.singletonList(true),enums.etype.on_verify_selected_url_menu); - } - } - - public void onClearHighlight(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate) - { - try { - mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced)); - mLongSelectedDate.remove(pDate); - mLongSelectedIndex.remove(pUrl); - mLongSelectedID.remove((Integer) pId); - onVerifyLongSelectedURL(false); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void notifyFilter(){ - if(mFilter.length()>0){ - initializeModelWithDate(true); - notifyDataSetChanged(); - } - } - - @SuppressLint("ClickableViewAccessibility") - public void onSwipe(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){ - - Handler handler = new Handler(); - - Runnable mLongPressed = () -> { - if(!mDisableCallable){ - if(!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) { - mLongPressedMenuActive = true; - onSelectView(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate); - }else { - onClearHighlight(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate); - mLongPressedMenuActive = true; - } - }else { - pItemView.setPressed(false); - pItemView.clearFocus(); - } - notifyFilter(); - }; - - pItemView.setOnTouchListener((v, event) -> { - - if (event.getAction() == MotionEvent.ACTION_UP) { - - if (mLongSelectedIndex.size() > 0) { - if (!mLongPressedMenuActive) { - if (mLongSelectedIndex.contains(pUrl) && mLongSelectedID.contains(pId)) { - handler.removeCallbacks(mLongPressed); - bookmarkAdapter.this.onClearHighlight(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate); - } else{ - handler.removeCallbacks(mLongPressed); - bookmarkAdapter.this.onSelectView(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate); - } - } - initializeModelWithDate(true); - return false; - } - - v.setPressed(false); - handler.removeCallbacks(mLongPressed); - mEvent.invokeObserver(Collections.singletonList(pUrl), enums.etype.url_triggered); - initializeModelWithDate(true); - return true; - - } else if (event.getAction() == MotionEvent.ACTION_DOWN) { - mDisableCallable = false; - mLongPressedMenuActive = false; - v.setPressed(true); - handler.postDelayed(mLongPressed, ViewConfiguration.getLongPressTimeout()); - initializeModelWithDate(true); - return true; - } else if (event.getAction() == MotionEvent.ACTION_CANCEL) { - handler.removeCallbacks(mLongPressed); - mDisableCallable = true; - if (!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) { - v.setPressed(false); - } - handler.removeCallbacks(mLongPressed); - - initializeModelWithDate(true); - return true; - } - initializeModelWithDate(true); - return false; - }); - // initializeModelWithDate(false); - } - - void onOpenMenu(View pView, String pUrl, int pPosition, String pTitle){ - LayoutInflater layoutInflater = (LayoutInflater) pView.getContext().getSystemService(LAYOUT_INFLATER_SERVICE); - @SuppressLint("InflateParams") final View mPopupView = layoutInflater.inflate(R.layout.history_bookmark__row_menu, null); - mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_OPEN_MENU, Arrays.asList(mPopupWindow, pView, mPopupView)); - - setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuCopy), pUrl, pPosition, pTitle); - setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuShare), pUrl, pPosition, pTitle); - setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuOpenCurrentTab), pUrl, pPosition, pTitle); - setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuOpenNewTab), pUrl, pPosition, pTitle); - setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuDelete), pUrl, pPosition, pTitle); - - if(mFilter.length()>0){ - initializeModelWithDate(true); - notifyDataSetChanged(); - } - } - - public void setPopupWindowEvents(View pView, String pUrl, int pPosition, String pTitle){ - pView.setOnClickListener(v -> { - if(v.getId() == R.id.pMenuCopy){ - helperMethod.copyURL(pUrl, mListHolderContext); - mPopupWindow.dismiss(); - } - else if(v.getId() == R.id.pMenuShare){ - helperMethod.shareApp((AppCompatActivity)mListHolderContext, pUrl, pTitle); - mPopupWindow.dismiss(); - } - else if(v.getId() == R.id.pMenuOpenCurrentTab){ - mEvent.invokeObserver(Collections.singletonList(pUrl),enums.etype.url_triggered); - mPopupWindow.dismiss(); - } - else if(v.getId() == R.id.pMenuOpenNewTab){ - mEvent.invokeObserver(Collections.singletonList(pUrl),enums.etype.url_triggered_new_tab); - mPopupWindow.dismiss(); - } - else if(v.getId() == R.id.pMenuDelete){ - onClose(pPosition); - invokeFilter(true); - mPopupWindow.dismiss(); - } - }); - } - - private void setItemViewOnClickListener(View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate) - { - pItemMenu.setOnClickListener((View v) -> onOpenMenu(v, pUrl, pPosition, pTitle)); - onSwipe(pItemView, pUrl,pMenuItem, pLogoImage, pId, pDate); - } - - private void onClose(int pIndex){ - mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(pIndex)),enums.etype.url_clear); - mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.url_clear_at); - mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.is_empty); - - if(mPassedList.size()<=0){ - mCurrentList.clear(); - return; - } - - mCurrentList.remove(mRealIndex.get(pIndex)); - notifyItemRemoved(mRealIndex.get(pIndex)); - notifyItemRangeChanged(0, mCurrentList.size()); - clearLongSelectedURL(); - } - - - /*View Holder Extensions*/ - class listViewHolder extends RecyclerView.ViewHolder - { - TextView mHeader; - TextView mDescription; - TextView mDate; - TextView mWebLogo; - ImageButton mRowMenu; - ImageView mLogoImage; - ImageView mFaviconLogo; - LinearLayout mRowContainer; - LinearLayout mDateContainer; - LinearLayout mLoadingContainer; - ImageView mHindTypeIconTemp; - - listViewHolder(View itemView) { - super(itemView); - } - - void bindListView(bookmarkRowModel model, int p_position) { - mDateContainer = itemView.findViewById(R.id.pDateContainer); - mHeader = itemView.findViewById(R.id.pHeader); - mDescription = itemView.findViewById(R.id.pDescription); - mRowContainer = itemView.findViewById(R.id.pRowContainer); - mRowMenu = itemView.findViewById(R.id.pRowMenu); - mDate = itemView.findViewById(R.id.pDate); - mLogoImage = itemView.findViewById(R.id.pLogoImage); - mWebLogo = itemView.findViewById(R.id.pWebLogo); - mLoadingContainer = itemView.findViewById(R.id.pLoadingContainer); - mFaviconLogo = itemView.findViewById(R.id.pFaviconLogo); - mHindTypeIconTemp = new ImageView(mContext); - - if(model.getID() == -1){ - mDate.setText(model.getHeader()); - mDateContainer.setVisibility(View.VISIBLE); - mRowContainer.setVisibility(View.GONE); - mRowMenu.setVisibility(View.INVISIBLE); - mRowMenu.setClickable(false); - mWebLogo.setVisibility(View.GONE); - mLoadingContainer.setVisibility(View.GONE); - } - else if(model.getID() == -2){ - mDate.setText(model.getHeader()); - mDateContainer.setVisibility(View.GONE); - mRowContainer.setVisibility(View.GONE); - mRowMenu.setVisibility(View.INVISIBLE); - mRowMenu.setClickable(false); - mWebLogo.setVisibility(View.GONE); - mLoadingContainer.setVisibility(View.VISIBLE); - return; - } - else { - mDateContainer.setVisibility(View.GONE); - mLoadingContainer.setVisibility(View.GONE); - mRowContainer.setVisibility(View.VISIBLE); - if(mLongSelectedID.size()>0){ - mRowMenu.setVisibility(View.INVISIBLE); - mRowMenu.setClickable(false); - }else { - mRowMenu.setVisibility(View.VISIBLE); - mRowMenu.setClickable(true); - } - mWebLogo.setVisibility(View.VISIBLE); - mHeader.setText(model.getHeader()); - mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0)+"")); - String header = model.getHeader(); - mDescription.setText(("https://"+model.getDescription())); - - if(model.getDescription().contains("genesishiddentechnologies.com") || model.getDescription().contains("genesis.onion")){ - mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis)); - }else{ - new Thread(){ - public void run(){ - try { - mHindTypeIconTemp.setImageDrawable(null); - mEvent.invokeObserver(Arrays.asList(mHindTypeIconTemp, "http://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon); - while (true){ - int mCounter=0; - if(mHindTypeIconTemp.isAttachedToWindow() || mHindTypeIconTemp.getDrawable()==null){ - sleep(50); - mCounter+=1; - }else { - break; - } - if(mCounter>6){ - break; - } - } - mContext.runOnUiThread(() -> { - Bitmap mBitmap = helperMethod.drawableToBitmap(mHindTypeIconTemp.getDrawable()); - mFaviconLogo.setImageBitmap(mBitmap); - }); - } catch (Exception e) { - e.printStackTrace(); - } - } - }.start(); - } - - setItemViewOnClickListener(mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate()); - } - - if(mLongSelectedID.size()>0){ - mRowMenu.setVisibility(View.INVISIBLE); - mRowMenu.setClickable(false); - }else { - mRowMenu.setVisibility(View.VISIBLE); - mRowMenu.setClickable(true); - } - - if(mLongSelectedIndex.contains("https://" + model.getDescription()) && mLongSelectedID.contains(model.getID())){ - mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false)); - }else if(mLogoImage.getAlpha()>0){ - mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false)); - } - } - } - - void setFilter(String pFilter){ - this.mFilter = pFilter.toLowerCase(); - } - - void invokeFilter(boolean notify){ - if(notify){ - initializeModelWithDate(true); - } - } - - private boolean isLongPressMenuActive(){ - return mLongSelectedIndex.size()>0; - } - - public Object onTrigger(bookmarkEnums.eBookmarkAdapterCommands pCommands, List pData){ - if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_SELECTED_URL){ - return getSelectedURL(); - } - else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.M_CLEAR_LONG_SELECTED_URL){ - clearLongSelectedURL(); - } - else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_URL){ - return getLongSelectedleURL(); - } - else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_STATUS){ - return isLongPressMenuActive(); - } - else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.ON_CLOSE){ - onClose((int)pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.bookmarkManager; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.graphics.Bitmap; +import android.os.Handler; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewConfiguration; +import android.view.ViewGroup; +import android.widget.*; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import systems.intelligo.slight.ImageLoader; +import static android.content.Context.LAYOUT_INFLATER_SERVICE; + +public class bookmarkAdapter extends RecyclerView.Adapter +{ + /*Private Variables*/ + + private ArrayList mModelList = new ArrayList<>(); + private ArrayList mCurrentList; + private ArrayList mPassedList; + private ArrayList mRealID = new ArrayList<>(); + private ArrayList mRealIndex = new ArrayList<>(); + private ArrayList mLongSelectedDate = new ArrayList<>(); + private ArrayList mLongSelectedIndex = new ArrayList<>(); + private ArrayList mLongSelectedID = new ArrayList<>(); + + private ImageLoader imageLoader; + private AppCompatActivity mContext; + private bookmarkAdapterView mHistroyAdapterView; + private Context mListHolderContext; + private PopupWindow mPopupWindow = null; + private eventObserver.eventListener mEvent; + private String mFilter = strings.GENERIC_EMPTY_STR; + private boolean mLongPressedMenuActive = false; + + /*Local Variables*/ + + private boolean mDisableCallable = false; + private boolean mSearchEnabled = false; + + bookmarkAdapter(ArrayList pModelList, eventObserver.eventListener mEvent, AppCompatActivity pMainContext) { + this.mEvent = mEvent; + this.mCurrentList = new ArrayList<>(); + this.mPassedList = pModelList; + this.mContext = pMainContext; + this.mHistroyAdapterView = new bookmarkAdapterView(mContext); + this.imageLoader = new ImageLoader(mContext); + + initializeModelWithDate(false); + } + + private void initializeModelWithDate(boolean pFilterEnabled){ + int m_real_counter=0; + + mRealID.clear(); + mRealIndex.clear(); + mCurrentList.clear(); + this.mModelList.clear(); + onVerifyLongSelectedURL(true); + + ArrayList p_model_list = mPassedList; + for(int counter = 0; counter< p_model_list.size(); counter++){ + + if(pFilterEnabled){ + if(!p_model_list.get(counter).getHeader().toLowerCase().contains(this.mFilter.toLowerCase()) && !p_model_list.get(counter).getDescription().toLowerCase().contains(this.mFilter)){ + continue; + } + } + + mRealID.add(p_model_list.get(counter).getID()); + mRealIndex.add(counter); + this.mModelList.add(p_model_list.get(counter)); + m_real_counter+=1; + } + mCurrentList.addAll(this.mModelList); + } + + /*Initializations*/ + + private ArrayList getLongSelectedleURL(){ + return mLongSelectedIndex; + } + + public void onDeleteSelected(){ + for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){ + for(int m_counter_inner = 0; m_counter_inner< mCurrentList.size(); m_counter_inner++){ + if(mCurrentList.get(m_counter_inner).getDate() == mLongSelectedDate.get(m_counter) && mLongSelectedIndex.get(m_counter).equals("https://"+ mCurrentList.get(m_counter_inner).getDescription())){ + mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(m_counter_inner)),enums.etype.url_clear); + mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)),enums.etype.url_clear_at); + invokeFilter(false); + mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.is_empty); + + boolean mDateVerify = false; + if(mCurrentList.size()>0 && mCurrentList.size()m_counter_inner+1 && mCurrentList.get(m_counter_inner+1).getDescription()==null || mCurrentList.size()==m_counter_inner+1)){ + mDateVerify = true; + } + + if(mDateVerify){ + notifyItemRemoved(m_counter_inner-1); + mCurrentList.remove(m_counter_inner-1); + notifyItemRangeChanged(m_counter_inner-1, mCurrentList.size()); + }else { + notifyItemRemoved(m_counter_inner); + mCurrentList.remove(m_counter_inner); + notifyItemRangeChanged(m_counter_inner, mCurrentList.size()); + } + break; + } + } + } + clearLongSelectedURL(); + // initializeModelWithDate(false); + } + + private void clearLongSelectedURL(){ + for(int m_counter = 0; m_counter< mCurrentList.size(); m_counter++){ + for(int m_counter_inner = 0; m_counter_inner< mLongSelectedID.size(); m_counter_inner++){ + if(mCurrentList.get(m_counter).getID() == mLongSelectedID.get(m_counter_inner)){ + mLongSelectedID.remove(m_counter_inner); + notifyItemChanged(m_counter); + m_counter-=1; + break; + } + } + } + + mLongSelectedDate.clear(); + mLongSelectedIndex.clear(); + mLongSelectedID.clear(); + } + + private String getSelectedURL(){ + String m_joined_url = "\n"; + for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){ + m_joined_url = m_joined_url.concat("\n"+ mLongSelectedIndex.get(m_counter)); + } + return m_joined_url; + } + + @NonNull + @Override + public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + mListHolderContext = parent.getContext(); + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.history_bookmark_row_view, parent, false); + return new listViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull bookmarkAdapter.listViewHolder holder, int position) + { + holder.bindListView(mCurrentList.get(position), position); + } + + public int getItem(){ + return mCurrentList.size(); + } + + @Override + public int getItemCount() { + return mCurrentList.size(); + } + + /*Listeners*/ + public void onUpdateSearchStatus(boolean p_is_searched){ + mSearchEnabled = p_is_searched; + } + + public void invokeSwipeClose(int pPosition){ + onClose(pPosition); + invokeFilter(true); + + if(mPopupWindow!=null){ + mPopupWindow.dismiss(); + } + } + + public void onSelectView(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){ + if(!mSearchEnabled){ + try { + mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced, true)); + } catch (Exception e) { + e.printStackTrace(); + } + if(!pIsForced){ + mLongSelectedDate.add(pDate); + mLongSelectedIndex.add(pUrl); + mLongSelectedID.add(pId); + if(mLongSelectedIndex.size()<=1){ + notifyDataSetChanged(); + } + } + onVerifyLongSelectedURL(false); + } + } + + public void onVerifyLongSelectedURL(boolean pIsComputing){ + if(mLongSelectedIndex.size()>0){ + mEvent.invokeObserver(Collections.singletonList(false),enums.etype.on_verify_selected_url_menu); + }else { + if(!pIsComputing){ + notifyDataSetChanged(); + } + mEvent.invokeObserver(Collections.singletonList(true),enums.etype.on_verify_selected_url_menu); + } + } + + public void onClearHighlight(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate) + { + try { + mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced)); + mLongSelectedDate.remove(pDate); + mLongSelectedIndex.remove(pUrl); + mLongSelectedID.remove((Integer) pId); + onVerifyLongSelectedURL(false); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void notifyFilter(){ + if(mFilter.length()>0){ + initializeModelWithDate(true); + notifyDataSetChanged(); + } + } + + @SuppressLint("ClickableViewAccessibility") + public void onSwipe(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){ + + Handler handler = new Handler(); + + Runnable mLongPressed = () -> { + if(!mDisableCallable){ + if(!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) { + mLongPressedMenuActive = true; + onSelectView(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate); + }else { + onClearHighlight(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate); + mLongPressedMenuActive = true; + } + }else { + pItemView.setPressed(false); + pItemView.clearFocus(); + } + notifyFilter(); + }; + + pItemView.setOnTouchListener((v, event) -> { + + if (event.getAction() == MotionEvent.ACTION_UP) { + + if (mLongSelectedIndex.size() > 0) { + if (!mLongPressedMenuActive) { + if (mLongSelectedIndex.contains(pUrl) && mLongSelectedID.contains(pId)) { + handler.removeCallbacks(mLongPressed); + bookmarkAdapter.this.onClearHighlight(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate); + } else{ + handler.removeCallbacks(mLongPressed); + bookmarkAdapter.this.onSelectView(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate); + } + } + initializeModelWithDate(true); + return false; + } + + v.setPressed(false); + handler.removeCallbacks(mLongPressed); + mEvent.invokeObserver(Collections.singletonList(pUrl), enums.etype.url_triggered); + initializeModelWithDate(true); + return true; + + } else if (event.getAction() == MotionEvent.ACTION_DOWN) { + mDisableCallable = false; + mLongPressedMenuActive = false; + v.setPressed(true); + handler.postDelayed(mLongPressed, ViewConfiguration.getLongPressTimeout()); + initializeModelWithDate(true); + return true; + } else if (event.getAction() == MotionEvent.ACTION_CANCEL) { + handler.removeCallbacks(mLongPressed); + mDisableCallable = true; + if (!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) { + v.setPressed(false); + } + handler.removeCallbacks(mLongPressed); + + initializeModelWithDate(true); + return true; + } + initializeModelWithDate(true); + return false; + }); + // initializeModelWithDate(false); + } + + void onOpenMenu(View pView, String pUrl, int pPosition, String pTitle){ + LayoutInflater layoutInflater = (LayoutInflater) pView.getContext().getSystemService(LAYOUT_INFLATER_SERVICE); + @SuppressLint("InflateParams") final View mPopupView = layoutInflater.inflate(R.layout.history_bookmark__row_menu, null); + mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_OPEN_MENU, Arrays.asList(mPopupWindow, pView, mPopupView)); + + setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuCopy), pUrl, pPosition, pTitle); + setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuShare), pUrl, pPosition, pTitle); + setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuOpenCurrentTab), pUrl, pPosition, pTitle); + setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuOpenNewTab), pUrl, pPosition, pTitle); + setPopupWindowEvents(mPopupView.findViewById(R.id.pMenuDelete), pUrl, pPosition, pTitle); + + if(mFilter.length()>0){ + initializeModelWithDate(true); + notifyDataSetChanged(); + } + } + + public void setPopupWindowEvents(View pView, String pUrl, int pPosition, String pTitle){ + pView.setOnClickListener(v -> { + if(v.getId() == R.id.pMenuCopy){ + helperMethod.copyURL(pUrl, mListHolderContext); + mPopupWindow.dismiss(); + } + else if(v.getId() == R.id.pMenuShare){ + helperMethod.shareApp((AppCompatActivity)mListHolderContext, pUrl, pTitle); + mPopupWindow.dismiss(); + } + else if(v.getId() == R.id.pMenuOpenCurrentTab){ + mEvent.invokeObserver(Collections.singletonList(pUrl),enums.etype.url_triggered); + mPopupWindow.dismiss(); + } + else if(v.getId() == R.id.pMenuOpenNewTab){ + mEvent.invokeObserver(Collections.singletonList(pUrl),enums.etype.url_triggered_new_tab); + mPopupWindow.dismiss(); + } + else if(v.getId() == R.id.pMenuDelete){ + onClose(pPosition); + invokeFilter(true); + mPopupWindow.dismiss(); + } + }); + } + + private void setItemViewOnClickListener(View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate) + { + pItemMenu.setOnClickListener((View v) -> onOpenMenu(v, pUrl, pPosition, pTitle)); + onSwipe(pItemView, pUrl,pMenuItem, pLogoImage, pId, pDate); + } + + private void onClose(int pIndex){ + mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(pIndex)),enums.etype.url_clear); + mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.url_clear_at); + mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.is_empty); + + if(mPassedList.size()<=0){ + mCurrentList.clear(); + return; + } + + mCurrentList.remove(mRealIndex.get(pIndex)); + notifyItemRemoved(mRealIndex.get(pIndex)); + notifyItemRangeChanged(0, mCurrentList.size()); + clearLongSelectedURL(); + } + + + /*View Holder Extensions*/ + class listViewHolder extends RecyclerView.ViewHolder + { + TextView mHeader; + TextView mDescription; + TextView mDate; + TextView mWebLogo; + ImageButton mRowMenu; + ImageView mLogoImage; + ImageView mFaviconLogo; + LinearLayout mRowContainer; + LinearLayout mDateContainer; + LinearLayout mLoadingContainer; + ImageView mHindTypeIconTemp; + + listViewHolder(View itemView) { + super(itemView); + } + + void bindListView(bookmarkRowModel model, int p_position) { + mDateContainer = itemView.findViewById(R.id.pDateContainer); + mHeader = itemView.findViewById(R.id.pHeader); + mDescription = itemView.findViewById(R.id.pDescription); + mRowContainer = itemView.findViewById(R.id.pRowContainer); + mRowMenu = itemView.findViewById(R.id.pRowMenu); + mDate = itemView.findViewById(R.id.pDate); + mLogoImage = itemView.findViewById(R.id.pLogoImage); + mWebLogo = itemView.findViewById(R.id.pWebLogo); + mLoadingContainer = itemView.findViewById(R.id.pLoadingContainer); + mFaviconLogo = itemView.findViewById(R.id.pFaviconLogo); + mHindTypeIconTemp = new ImageView(mContext); + + if(model.getID() == -1){ + mDate.setText(model.getHeader()); + mDateContainer.setVisibility(View.VISIBLE); + mRowContainer.setVisibility(View.GONE); + mRowMenu.setVisibility(View.INVISIBLE); + mRowMenu.setClickable(false); + mWebLogo.setVisibility(View.GONE); + mLoadingContainer.setVisibility(View.GONE); + } + else if(model.getID() == -2){ + mDate.setText(model.getHeader()); + mDateContainer.setVisibility(View.GONE); + mRowContainer.setVisibility(View.GONE); + mRowMenu.setVisibility(View.INVISIBLE); + mRowMenu.setClickable(false); + mWebLogo.setVisibility(View.GONE); + mLoadingContainer.setVisibility(View.VISIBLE); + return; + } + else { + mDateContainer.setVisibility(View.GONE); + mLoadingContainer.setVisibility(View.GONE); + mRowContainer.setVisibility(View.VISIBLE); + if(mLongSelectedID.size()>0){ + mRowMenu.setVisibility(View.INVISIBLE); + mRowMenu.setClickable(false); + }else { + mRowMenu.setVisibility(View.VISIBLE); + mRowMenu.setClickable(true); + } + mWebLogo.setVisibility(View.VISIBLE); + mHeader.setText(model.getHeader()); + mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0)+"")); + String header = model.getHeader(); + mDescription.setText(("https://"+model.getDescription())); + + if(model.getDescription().contains("genesishiddentechnologies.com") || model.getDescription().contains("genesis.onion")){ + mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis)); + }else{ + new Thread(){ + public void run(){ + try { + mHindTypeIconTemp.setImageDrawable(null); + mEvent.invokeObserver(Arrays.asList(mHindTypeIconTemp, "http://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon); + while (true){ + int mCounter=0; + if(mHindTypeIconTemp.isAttachedToWindow() || mHindTypeIconTemp.getDrawable()==null){ + sleep(50); + mCounter+=1; + }else { + break; + } + if(mCounter>6){ + break; + } + } + mContext.runOnUiThread(() -> { + Bitmap mBitmap = helperMethod.drawableToBitmap(mHindTypeIconTemp.getDrawable()); + mFaviconLogo.setImageBitmap(mBitmap); + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + }.start(); + } + + setItemViewOnClickListener(mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate()); + } + + if(mLongSelectedID.size()>0){ + mRowMenu.setVisibility(View.INVISIBLE); + mRowMenu.setClickable(false); + }else { + mRowMenu.setVisibility(View.VISIBLE); + mRowMenu.setClickable(true); + } + + if(mLongSelectedIndex.contains("https://" + model.getDescription()) && mLongSelectedID.contains(model.getID())){ + mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false)); + }else if(mLogoImage.getAlpha()>0){ + mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false)); + } + } + } + + void setFilter(String pFilter){ + this.mFilter = pFilter.toLowerCase(); + } + + void invokeFilter(boolean notify){ + if(notify){ + initializeModelWithDate(true); + } + } + + private boolean isLongPressMenuActive(){ + return mLongSelectedIndex.size()>0; + } + + public Object onTrigger(bookmarkEnums.eBookmarkAdapterCommands pCommands, List pData){ + if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_SELECTED_URL){ + return getSelectedURL(); + } + else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.M_CLEAR_LONG_SELECTED_URL){ + clearLongSelectedURL(); + } + else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_URL){ + return getLongSelectedleURL(); + } + else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_STATUS){ + return isLongPressMenuActive(); + } + else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.ON_CLOSE){ + onClose((int)pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapterView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapterView.java index ef8b4132..1f7f7c9e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapterView.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapterView.java @@ -1,127 +1,127 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager; - -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.view.View; -import android.widget.ActionMenuView; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.PopupWindow; -import androidx.appcompat.app.AppCompatActivity; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; -import java.util.List; - -public class bookmarkAdapterView -{ - /*Private Variables*/ - private AppCompatActivity mContext; - - bookmarkAdapterView(AppCompatActivity pContext) - { - this.mContext = pContext; - } - - public Object openMenu(PopupWindow pPopupWindow, View pView, View popupView){ - - if(pPopupWindow !=null){ - pPopupWindow.dismiss(); - } - - pPopupWindow = new PopupWindow( - popupView, - ActionMenuView.LayoutParams.WRAP_CONTENT, - ActionMenuView.LayoutParams.WRAP_CONTENT, true); - - pView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); - int xOffset = -(pView.getMeasuredWidth() - pView.getWidth()); - - int[] location = new int[2]; - pView.getLocationOnScreen(location); - int y = location[1]; - int height = helperMethod.getScreenHeight(mContext); - int m_offset_height = 0; - if(y + helperMethod.pxFromDp(300) >height){ - m_offset_height = helperMethod.pxFromDp(203); - } - else{ - m_offset_height = 0; - } - - pPopupWindow.setOutsideTouchable(true); - pPopupWindow.setFocusable(true); - pPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); - pPopupWindow.setAnimationStyle(R.style.popup_window_animation); - pPopupWindow.setElevation(7); - if(status.sSettingLanguageRegion.equals("Ur")){ - pPopupWindow.showAsDropDown(pView,0, helperMethod.pxFromDp(-45)); - }else { - pPopupWindow.showAsDropDown(pView,xOffset - 90, -m_offset_height-helperMethod.pxFromDp(50)); - } - return pPopupWindow; - } - - private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){ - mItemView.setPressed(false); - pPopupMenu.setVisibility(View.VISIBLE); - pPopupMenu.animate().setDuration(150).alpha(1); - pPopupMenu.setClickable(true); - pLogoImage.setAlpha(1f); - pLogoImage.animate().cancel(); - pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE)); - } - - public void onSelectView(View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){ - pItemView.setPressed(false); - int speed = 150; - if(pIsForced){ - speed=150; - } - if(pVibrate){ - helperMethod.vibrate(mContext); - } - - - pLogoImage.setAlpha(0f); - pLogoImage.setVisibility(View.VISIBLE); - pLogoImage.animate().cancel(); - pLogoImage.animate().setDuration(speed).alpha(0.95f); - } - - public void onClearHighlight( View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced) - { - try { - if(pLogoImage.getAlpha()>0){ - pItemView.setPressed(false); - int speed = 150; - if(pIsForced){ - speed = 0; - } - pLogoImage.setAlpha(1f); - pLogoImage.animate().cancel(); - pLogoImage.animate().setDuration(speed).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE)); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public Object onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands pCommands, List pData){ - if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_OPEN_MENU){ - return openMenu((PopupWindow) pData.get(0), (View) pData.get(1), (View) pData.get(2)); - } - if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW){ - clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2)); - } - if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW){ - onSelectView((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4)); - } - if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT){ - onClearHighlight((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.bookmarkManager; + +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.view.View; +import android.widget.ActionMenuView; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.PopupWindow; +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; +import java.util.List; + +public class bookmarkAdapterView +{ + /*Private Variables*/ + private AppCompatActivity mContext; + + bookmarkAdapterView(AppCompatActivity pContext) + { + this.mContext = pContext; + } + + public Object openMenu(PopupWindow pPopupWindow, View pView, View popupView){ + + if(pPopupWindow !=null){ + pPopupWindow.dismiss(); + } + + pPopupWindow = new PopupWindow( + popupView, + ActionMenuView.LayoutParams.WRAP_CONTENT, + ActionMenuView.LayoutParams.WRAP_CONTENT, true); + + pView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); + int xOffset = -(pView.getMeasuredWidth() - pView.getWidth()); + + int[] location = new int[2]; + pView.getLocationOnScreen(location); + int y = location[1]; + int height = helperMethod.getScreenHeight(mContext); + int m_offset_height = 0; + if(y + helperMethod.pxFromDp(300) >height){ + m_offset_height = helperMethod.pxFromDp(203); + } + else{ + m_offset_height = 0; + } + + pPopupWindow.setOutsideTouchable(true); + pPopupWindow.setFocusable(true); + pPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + pPopupWindow.setAnimationStyle(R.style.popup_window_animation); + pPopupWindow.setElevation(7); + if(status.sSettingLanguageRegion.equals("Ur")){ + pPopupWindow.showAsDropDown(pView,0, helperMethod.pxFromDp(-45)); + }else { + pPopupWindow.showAsDropDown(pView,xOffset - 90, -m_offset_height-helperMethod.pxFromDp(50)); + } + return pPopupWindow; + } + + private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){ + mItemView.setPressed(false); + pPopupMenu.setVisibility(View.VISIBLE); + pPopupMenu.animate().setDuration(150).alpha(1); + pPopupMenu.setClickable(true); + pLogoImage.setAlpha(1f); + pLogoImage.animate().cancel(); + pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE)); + } + + public void onSelectView(View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){ + pItemView.setPressed(false); + int speed = 150; + if(pIsForced){ + speed=150; + } + if(pVibrate){ + helperMethod.vibrate(mContext); + } + + + pLogoImage.setAlpha(0f); + pLogoImage.setVisibility(View.VISIBLE); + pLogoImage.animate().cancel(); + pLogoImage.animate().setDuration(speed).alpha(0.95f); + } + + public void onClearHighlight( View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced) + { + try { + if(pLogoImage.getAlpha()>0){ + pItemView.setPressed(false); + int speed = 150; + if(pIsForced){ + speed = 0; + } + pLogoImage.setAlpha(1f); + pLogoImage.animate().cancel(); + pLogoImage.animate().setDuration(speed).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE)); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public Object onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands pCommands, List pData){ + if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_OPEN_MENU){ + return openMenu((PopupWindow) pData.get(0), (View) pData.get(1), (View) pData.get(2)); + } + if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW){ + clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2)); + } + if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW){ + onSelectView((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4)); + } + if(pCommands == bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT){ + onClearHighlight((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkEnums.java index c291101a..1190a12b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkEnums.java @@ -1,18 +1,18 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager; - -public class bookmarkEnums -{ - /*History Manager*/ - public enum eBookmarkViewCommands { - M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU, M_CLOSE_MENU, M_HIDE_SEARCH, M_LONG_PRESS_MENU, ON_GENERATE_SWIPABLE_BACKGROUND - } - - public enum eBookmarkAdapterCommands { - M_ON_LOADING, M_LOADING_CLEAR, M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE - } - - public enum eBookmarkViewAdapterCommands { - M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT - } - +package com.darkweb.genesissearchengine.appManager.bookmarkManager; + +public class bookmarkEnums +{ + /*History Manager*/ + public enum eBookmarkViewCommands { + M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU, M_CLOSE_MENU, M_HIDE_SEARCH, M_LONG_PRESS_MENU, ON_GENERATE_SWIPABLE_BACKGROUND + } + + public enum eBookmarkAdapterCommands { + M_ON_LOADING, M_LOADING_CLEAR, M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE + } + + public enum eBookmarkViewAdapterCommands { + M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeEnums.java index b31b0738..48a101dc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeEnums.java @@ -1,14 +1,14 @@ -package com.darkweb.genesissearchengine.appManager.bridgeManager; - -public class bridgeEnums -{ - /*Settings Manager*/ - public enum eBridgeViewCommands { - M_INIT_VIEWS, M_ENABLE_CUSTOM_BRIDGE - } - - public enum eBridgeModelCommands { - M_REQUEST_BRIDGE, M_CUSTOM_BRIDGE, M_MEEK_BRIDGE, M_OBFS_CHECK - } - +package com.darkweb.genesissearchengine.appManager.bridgeManager; + +public class bridgeEnums +{ + /*Settings Manager*/ + public enum eBridgeViewCommands { + M_INIT_VIEWS, M_ENABLE_CUSTOM_BRIDGE + } + + public enum eBridgeModelCommands { + M_REQUEST_BRIDGE, M_CUSTOM_BRIDGE, M_MEEK_BRIDGE, M_OBFS_CHECK + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java index df63b337..d0c9b42d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java @@ -1,85 +1,85 @@ -package com.darkweb.genesissearchengine.appManager.bridgeManager; - -import androidx.appcompat.app.AppCompatActivity; - -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginController; - -import java.util.Arrays; -import java.util.List; - -import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_MEEK; -import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_OBFS4; -import static com.darkweb.genesissearchengine.constants.strings.GENERIC_EMPTY_STR; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_BRIDGE_MAIL; - -class bridgeModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - private AppCompatActivity mContext; - - /*Initializations*/ - - bridgeModel(eventObserver.eventListener mEvent, AppCompatActivity pContext){ - this.mEvent = mEvent; - mContext = pContext; - } - - /*Helper Methods*/ - - public void requestBridges(){ - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(constants.CONST_BACKEND_GOOGLE_URL, mContext), M_BRIDGE_MAIL); - } - - public void onCustomChecked(String pBridge, String pType){ - status.sBridgeCustomBridge = pBridge; - status.sBridgeCustomType = pType; - status.sBridgeGatewayManual = true; - - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual)); - } - public void onMeekChecked(){ - status.sBridgeCustomBridge = BRIDGE_CUSTOM_BRIDGE_MEEK; - status.sBridgeCustomType = GENERIC_EMPTY_STR; - status.sBridgeGatewayManual = false; - - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual)); - } - public void onObfsChecked(){ - status.sBridgeCustomBridge = BRIDGE_CUSTOM_BRIDGE_OBFS4; - status.sBridgeCustomType = GENERIC_EMPTY_STR; - status.sBridgeGatewayManual = false; - - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual)); - } - - public void onTrigger(bridgeEnums.eBridgeModelCommands pCommands, List pData){ - if(pCommands == bridgeEnums.eBridgeModelCommands.M_REQUEST_BRIDGE){ - requestBridges(); - } - else if(pCommands == bridgeEnums.eBridgeModelCommands.M_CUSTOM_BRIDGE){ - onCustomChecked((String) pData.get(0), (String) pData.get(1)); - } - else if(pCommands == bridgeEnums.eBridgeModelCommands.M_MEEK_BRIDGE){ - onMeekChecked(); - } - else if(pCommands == bridgeEnums.eBridgeModelCommands.M_OBFS_CHECK){ - onObfsChecked(); - } - } - - -} +package com.darkweb.genesissearchengine.appManager.bridgeManager; + +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginController; + +import java.util.Arrays; +import java.util.List; + +import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_MEEK; +import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_OBFS4; +import static com.darkweb.genesissearchengine.constants.strings.GENERIC_EMPTY_STR; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_BRIDGE_MAIL; + +class bridgeModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + + /*Initializations*/ + + bridgeModel(eventObserver.eventListener mEvent, AppCompatActivity pContext){ + this.mEvent = mEvent; + mContext = pContext; + } + + /*Helper Methods*/ + + public void requestBridges(){ + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(constants.CONST_BACKEND_GOOGLE_URL, mContext), M_BRIDGE_MAIL); + } + + public void onCustomChecked(String pBridge, String pType){ + status.sBridgeCustomBridge = pBridge; + status.sBridgeCustomType = pType; + status.sBridgeGatewayManual = true; + + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual)); + } + public void onMeekChecked(){ + status.sBridgeCustomBridge = BRIDGE_CUSTOM_BRIDGE_MEEK; + status.sBridgeCustomType = GENERIC_EMPTY_STR; + status.sBridgeGatewayManual = false; + + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual)); + } + public void onObfsChecked(){ + status.sBridgeCustomBridge = BRIDGE_CUSTOM_BRIDGE_OBFS4; + status.sBridgeCustomType = GENERIC_EMPTY_STR; + status.sBridgeGatewayManual = false; + + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,status.sBridgeCustomType)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,status.sBridgeGatewayManual)); + } + + public void onTrigger(bridgeEnums.eBridgeModelCommands pCommands, List pData){ + if(pCommands == bridgeEnums.eBridgeModelCommands.M_REQUEST_BRIDGE){ + requestBridges(); + } + else if(pCommands == bridgeEnums.eBridgeModelCommands.M_CUSTOM_BRIDGE){ + onCustomChecked((String) pData.get(0), (String) pData.get(1)); + } + else if(pCommands == bridgeEnums.eBridgeModelCommands.M_MEEK_BRIDGE){ + onMeekChecked(); + } + else if(pCommands == bridgeEnums.eBridgeModelCommands.M_OBFS_CHECK){ + onObfsChecked(); + } + } + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java index 7e96748c..6ef7c734 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java @@ -1,66 +1,66 @@ -package com.darkweb.genesissearchengine.appManager.externalCommandManager; - -import android.content.Intent; -import android.os.Bundle; -import android.os.Handler; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; - -import org.torproject.android.proxy.wrapper.orbotLocalConstants; - -public class externalShortcutController extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - status.sSettingIsAppStarted = false; - orbotLocalConstants.mIsTorInitialized = false; - boolean mConnect = false; - - if (getIntent() != null && getIntent().getStringExtra("shortcut") != null) { - String bundleString = getIntent().getStringExtra("shortcut"); - switch (bundleString) { - case "erase": - setContentView(R.layout.popup_data_cleared_shortcut); - panicExitInvoked(); - new Handler().postDelayed(this::finish, 3000); - return; - case "erase_and_open": - panicExitInvoked(); - mConnect = true; - break; - case "Restart": - break; - } - } - - setContentView(R.layout.empty_view); - - if(mConnect){ - new Handler().postDelayed(() -> activityContextManager.getInstance().getHomeController().onStartApplication(null), 3000); - } - - helperMethod.onDelayHandler(activityContextManager.getInstance().getHomeController(), 800, () -> { - - /* Start Required Activity */ - - Intent intent = new Intent(this.getIntent()); - intent.setClassName(this.getApplicationContext(), homeController.class.getName()); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); - - this.startActivity(intent); - overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); - - return null; - }); - } - - public void panicExitInvoked() { - dataController.getInstance().clearData(this); - } +package com.darkweb.genesissearchengine.appManager.externalCommandManager; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; + +import org.torproject.android.proxy.wrapper.orbotLocalConstants; + +public class externalShortcutController extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + status.sSettingIsAppStarted = false; + orbotLocalConstants.mIsTorInitialized = false; + boolean mConnect = false; + + if (getIntent() != null && getIntent().getStringExtra("shortcut") != null) { + String bundleString = getIntent().getStringExtra("shortcut"); + switch (bundleString) { + case "erase": + setContentView(R.layout.popup_data_cleared_shortcut); + panicExitInvoked(); + new Handler().postDelayed(this::finish, 3000); + return; + case "erase_and_open": + panicExitInvoked(); + mConnect = true; + break; + case "Restart": + break; + } + } + + setContentView(R.layout.empty_view); + + if(mConnect){ + new Handler().postDelayed(() -> activityContextManager.getInstance().getHomeController().onStartApplication(null), 3000); + } + + helperMethod.onDelayHandler(activityContextManager.getInstance().getHomeController(), 800, () -> { + + /* Start Required Activity */ + + Intent intent = new Intent(this.getIntent()); + intent.setClassName(this.getApplicationContext(), homeController.class.getName()); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); + + this.startActivity(intent); + overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); + + return null; + }); + } + + public void panicExitInvoked() { + dataController.getInstance().clearData(this); + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalURLNavigationContoller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalURLNavigationContoller.java index fb50d5c0..f6d2c2b2 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalURLNavigationContoller.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalURLNavigationContoller.java @@ -1,78 +1,78 @@ -package com.darkweb.genesissearchengine.appManager.externalCommandManager; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; - -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; - -public class externalURLNavigationContoller extends AppCompatActivity { - @Override - - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - Uri data = externalURLNavigationContoller.this.getIntent().getData(); - if(data == null || status.sSettingIsAppStarted){ - - /* Close Activity */ - - finish(); - activityContextManager.getInstance().onClearStack(); - - /* Create Request Handler */ - - if(status.sSettingIsAppStarted && data!=null){ - helperMethod.onDelayHandler(this, 250, () -> { - activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString())); - activityContextManager.getInstance().getHomeController().onClearSelectionTab(); - return null; - }); - } - - Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class); - bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(bringToForegroundIntent); - overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); - } - else if(status.sSettingIsAppRunning){ - - /* Refresh Intent Data */ - - finish(); - status.sExternalWebsite = data.toString(); - - }else { - - /* Start Required Activity */ - - Intent intent = new Intent(this.getIntent()); - intent.setClassName(this.getApplicationContext(), homeController.class.getName()); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); - - if(activityContextManager.getInstance().getHomeController()!=null){ - activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString()); - }else { - status.sExternalWebsite = data.toString(); - } - - /* Bring Application To Front */ - - Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); - startActivity(launchIntent); - overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); - - /* Close Activity */ - - helperMethod.onDelayHandler(this, 1000, () -> { - finish(); - return null; - }); - } - } -} +package com.darkweb.genesissearchengine.appManager.externalCommandManager; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; + +import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; + +public class externalURLNavigationContoller extends AppCompatActivity { + @Override + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Uri data = externalURLNavigationContoller.this.getIntent().getData(); + if(data == null || status.sSettingIsAppStarted){ + + /* Close Activity */ + + finish(); + activityContextManager.getInstance().onClearStack(); + + /* Create Request Handler */ + + if(status.sSettingIsAppStarted && data!=null){ + helperMethod.onDelayHandler(this, 250, () -> { + activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString())); + activityContextManager.getInstance().getHomeController().onClearSelectionTab(); + return null; + }); + } + + Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class); + bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(bringToForegroundIntent); + overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); + } + else if(status.sSettingIsAppRunning){ + + /* Refresh Intent Data */ + + finish(); + status.sExternalWebsite = data.toString(); + + }else { + + /* Start Required Activity */ + + Intent intent = new Intent(this.getIntent()); + intent.setClassName(this.getApplicationContext(), homeController.class.getName()); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); + + if(activityContextManager.getInstance().getHomeController()!=null){ + activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString()); + }else { + status.sExternalWebsite = data.toString(); + } + + /* Bring Application To Front */ + + Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); + startActivity(launchIntent); + overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); + + /* Close Activity */ + + helperMethod.onDelayHandler(this, 1000, () -> { + finish(); + return null; + }); + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java index fe00e02e..a7368729 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java @@ -1,44 +1,44 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.KeyEvent; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.eventObserver; - -public class editViewController extends androidx.appcompat.widget.AppCompatAutoCompleteTextView { - - Context mContext; - private eventObserver.eventListener mEvent = null; - - public editViewController(@NonNull Context context) { - super(context); - mContext = context; - } - - public editViewController(@NonNull Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - mContext = context; - } - - public editViewController(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - mContext = context; - } - - public void setEventHandler(eventObserver.eventListener pEvent){ - mEvent = pEvent; - } - - @Override - public boolean onKeyPreIme(int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_BACK) { - if(mEvent!=null){ - mEvent.invokeObserver(null, enums.etype.ON_KEYBOARD_CLOSE); - } - } - return false; - } -} +package com.darkweb.genesissearchengine.appManager.helpManager; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.KeyEvent; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.eventObserver; + +public class editViewController extends androidx.appcompat.widget.AppCompatAutoCompleteTextView { + + Context mContext; + private eventObserver.eventListener mEvent = null; + + public editViewController(@NonNull Context context) { + super(context); + mContext = context; + } + + public editViewController(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + mContext = context; + } + + public editViewController(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + mContext = context; + } + + public void setEventHandler(eventObserver.eventListener pEvent){ + mEvent = pEvent; + } + + @Override + public boolean onKeyPreIme(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_BACK) { + if(mEvent!=null){ + mEvent.invokeObserver(null, enums.etype.ON_KEYBOARD_CLOSE); + } + } + return false; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpAdapter.java index 388afea9..d145fc67 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpAdapter.java @@ -1,157 +1,157 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; - -import android.content.Context; -import android.content.res.Resources; -import android.graphics.drawable.Drawable; -import android.text.Html; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; -import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import com.darkweb.genesissearchengine.appManager.historyManager.historyEnums; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; - -import java.util.ArrayList; -import java.util.List; - -public class helpAdapter extends RecyclerView.Adapter{ - private List mModelList = new ArrayList<>(); - private List mCompleteModelList = new ArrayList<>(); - private LinearLayout mPrevRow; - private Context mContext; - - private int mCurrentPosition = -1; - private boolean mIsAnimating = false; - - public helpAdapter(List pModelList, Context context) { - if(pModelList!=null){ - this.mCompleteModelList.addAll(pModelList); - this.mModelList.addAll(pModelList); - } - this.mContext = context; - } - - private void onSearchFilterInvoked(String pQuery){ - pQuery = pQuery.toLowerCase(); - this.mModelList.clear(); - mCurrentPosition = -1; - for(int mCounter=0;mCounter pData){ - if(pCommands == helpEnums.eHelpAdapter.M_INIT_FILTER){ - onSearchFilterInvoked((String) pData.get(0)); - } - - return null; - } -} +package com.darkweb.genesissearchengine.appManager.helpManager; + +import android.content.Context; +import android.content.res.Resources; +import android.graphics.drawable.Drawable; +import android.text.Html; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.darkweb.genesissearchengine.appManager.historyManager.historyEnums; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; + +import java.util.ArrayList; +import java.util.List; + +public class helpAdapter extends RecyclerView.Adapter{ + private List mModelList = new ArrayList<>(); + private List mCompleteModelList = new ArrayList<>(); + private LinearLayout mPrevRow; + private Context mContext; + + private int mCurrentPosition = -1; + private boolean mIsAnimating = false; + + public helpAdapter(List pModelList, Context context) { + if(pModelList!=null){ + this.mCompleteModelList.addAll(pModelList); + this.mModelList.addAll(pModelList); + } + this.mContext = context; + } + + private void onSearchFilterInvoked(String pQuery){ + pQuery = pQuery.toLowerCase(); + this.mModelList.clear(); + mCurrentPosition = -1; + for(int mCounter=0;mCounter pData){ + if(pCommands == helpEnums.eHelpAdapter.M_INIT_FILTER){ + onSearchFilterInvoked((String) pData.get(0)); + } + + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpDataModel.java index 32422eaa..1628caf4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpDataModel.java @@ -1,26 +1,26 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; - -public class helpDataModel { - - private String mHeader; - private String mDescription; - private String mIcon; - - public helpDataModel(String pHeader, String pDescription, String pIcon) { - this.mHeader = pHeader; - this.mDescription = pDescription; - this.mIcon = pIcon; - } - - public String getHeader() { - return mHeader; - } - public String getDescription() { - return mDescription; - } - public String getIconID() { - return mIcon; - } - -} - +package com.darkweb.genesissearchengine.appManager.helpManager; + +public class helpDataModel { + + private String mHeader; + private String mDescription; + private String mIcon; + + public helpDataModel(String pHeader, String pDescription, String pIcon) { + this.mHeader = pHeader; + this.mDescription = pDescription; + this.mIcon = pIcon; + } + + public String getHeader() { + return mHeader; + } + public String getDescription() { + return mDescription; + } + public String getIconID() { + return mIcon; + } + +} + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpEnums.java index b520d2e8..8c1b4d19 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpEnums.java @@ -1,24 +1,24 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; - -class helpEnums -{ - /*History Manager*/ - public enum eHelpModel { - M_LOAD_HELP_DATA, M_IS_LOADED - } - - public enum eHelpModelCallback { - M_LOAD_JSON_RESPONSE_SUCCESS, M_LOAD_JSON_RESPONSE_FAILURE - } - - public enum eHelpViewController { - M_INIT_VIEWS, M_DATA_LOADED, M_LOAD_ERROR, M_RELOAD_DATA - } - - public enum eHelpAdapter { - M_INIT_FILTER - } - - public enum eHelpViewCallback { - } +package com.darkweb.genesissearchengine.appManager.helpManager; + +class helpEnums +{ + /*History Manager*/ + public enum eHelpModel { + M_LOAD_HELP_DATA, M_IS_LOADED + } + + public enum eHelpModelCallback { + M_LOAD_JSON_RESPONSE_SUCCESS, M_LOAD_JSON_RESPONSE_FAILURE + } + + public enum eHelpViewController { + M_INIT_VIEWS, M_DATA_LOADED, M_LOAD_ERROR, M_RELOAD_DATA + } + + public enum eHelpAdapter { + M_INIT_FILTER + } + + public enum eHelpViewCallback { + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java index d795064f..015893b8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java @@ -1,93 +1,93 @@ -package com.darkweb.genesissearchengine.appManager.helpManager; - -import androidx.appcompat.app.AppCompatActivity; -import com.android.volley.Request; -import com.android.volley.RequestQueue; -import com.android.volley.toolbox.StringRequest; -import com.android.volley.toolbox.Volley; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.*; - -class helpModel -{ - private eventObserver.eventListener mEvent; - private String mJsonPath; - private AppCompatActivity mContext; - private ArrayList mHelpListModel; - private boolean mIsLoaded = false; - - public helpModel(AppCompatActivity pContext, eventObserver.eventListener pEvent){ - this.mContext = pContext; - this.mEvent = pEvent; - this.mHelpListModel = new ArrayList<>(); - - if(status.sDeveloperBuild){ - this.mJsonPath = CONST_SERVER_DEV; - }else { - this.mJsonPath = CONST_SERVER; - } - } - - private void getHelpJSON(){ - - ArrayList mTempModel = (ArrayList)dataController.getInstance().invokeHelp(dataEnums.eHelpCommands.M_GET_HELP, null); - - mHelpListModel.clear(); - if(mTempModel.size()>0){ - mIsLoaded = true; - mHelpListModel.addAll(mTempModel); - mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_SUCCESS); - }else { - StringRequest stringRequest = new StringRequest(Request.Method.GET, mJsonPath, - response -> { - try { - JSONArray jsonArray = new JSONArray(response); - - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject obj = jsonArray.getJSONObject(i); - - helpDataModel hero = new helpDataModel( - obj.getString(CONST_HELP_MODEL_HEADER), - obj.getString(CONST_HELP_MODEL_DESCRIPTION), - obj.getString(CONST_HELP_MODEL_ICON)); - mHelpListModel.add(hero); - dataController.getInstance().invokeHelp(dataEnums.eHelpCommands.M_SET_HELP, Collections.singletonList(mHelpListModel)); - } - mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_SUCCESS); - } catch (JSONException e) { - mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_FAILURE); - e.printStackTrace(); - } - }, - error -> { - mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_FAILURE); - }); - - RequestQueue requestQueue = Volley.newRequestQueue(mContext/*, new ProxiedHurlStack()*/); - requestQueue.add(stringRequest); - } - } - - private boolean IsLoaded(){ - return mIsLoaded; - } - - public Object onTrigger(helpEnums.eHelpModel pCommands, List pData){ - if(pCommands.equals(helpEnums.eHelpModel.M_LOAD_HELP_DATA)){ - getHelpJSON(); - } - else if(pCommands.equals(helpEnums.eHelpModel.M_IS_LOADED)){ - return IsLoaded(); - } - return null; - } -} +package com.darkweb.genesissearchengine.appManager.helpManager; + +import androidx.appcompat.app.AppCompatActivity; +import com.android.volley.Request; +import com.android.volley.RequestQueue; +import com.android.volley.toolbox.StringRequest; +import com.android.volley.toolbox.Volley; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import static com.darkweb.genesissearchengine.constants.constants.*; + +class helpModel +{ + private eventObserver.eventListener mEvent; + private String mJsonPath; + private AppCompatActivity mContext; + private ArrayList mHelpListModel; + private boolean mIsLoaded = false; + + public helpModel(AppCompatActivity pContext, eventObserver.eventListener pEvent){ + this.mContext = pContext; + this.mEvent = pEvent; + this.mHelpListModel = new ArrayList<>(); + + if(status.sDeveloperBuild){ + this.mJsonPath = CONST_SERVER_DEV; + }else { + this.mJsonPath = CONST_SERVER; + } + } + + private void getHelpJSON(){ + + ArrayList mTempModel = (ArrayList)dataController.getInstance().invokeHelp(dataEnums.eHelpCommands.M_GET_HELP, null); + + mHelpListModel.clear(); + if(mTempModel.size()>0){ + mIsLoaded = true; + mHelpListModel.addAll(mTempModel); + mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_SUCCESS); + }else { + StringRequest stringRequest = new StringRequest(Request.Method.GET, mJsonPath, + response -> { + try { + JSONArray jsonArray = new JSONArray(response); + + for (int i = 0; i < jsonArray.length(); i++) { + JSONObject obj = jsonArray.getJSONObject(i); + + helpDataModel hero = new helpDataModel( + obj.getString(CONST_HELP_MODEL_HEADER), + obj.getString(CONST_HELP_MODEL_DESCRIPTION), + obj.getString(CONST_HELP_MODEL_ICON)); + mHelpListModel.add(hero); + dataController.getInstance().invokeHelp(dataEnums.eHelpCommands.M_SET_HELP, Collections.singletonList(mHelpListModel)); + } + mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_SUCCESS); + } catch (JSONException e) { + mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_FAILURE); + e.printStackTrace(); + } + }, + error -> { + mEvent.invokeObserver(Collections.singletonList(mHelpListModel),helpEnums.eHelpModelCallback.M_LOAD_JSON_RESPONSE_FAILURE); + }); + + RequestQueue requestQueue = Volley.newRequestQueue(mContext/*, new ProxiedHurlStack()*/); + requestQueue.add(stringRequest); + } + } + + private boolean IsLoaded(){ + return mIsLoaded; + } + + public Object onTrigger(helpEnums.eHelpModel pCommands, List pData){ + if(pCommands.equals(helpEnums.eHelpModel.M_LOAD_HELP_DATA)){ + getHelpJSON(); + } + else if(pCommands.equals(helpEnums.eHelpModel.M_IS_LOADED)){ + return IsLoaded(); + } + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapterView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapterView.java index 382732da..b4a7f4fc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapterView.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapterView.java @@ -1,128 +1,128 @@ -package com.darkweb.genesissearchengine.appManager.historyManager; - -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.view.View; -import android.widget.ActionMenuView; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.PopupWindow; -import androidx.appcompat.app.AppCompatActivity; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; -import java.util.List; - -public class historyAdapterView -{ - /*Private Variables*/ - private AppCompatActivity mContext; - - historyAdapterView(AppCompatActivity pContext) - { - this.mContext = pContext; - } - - public Object openMenu(PopupWindow pPopupWindow, View pView, View popupView){ - - if(pPopupWindow !=null){ - pPopupWindow.dismiss(); - } - - pPopupWindow = new PopupWindow( - popupView, - ActionMenuView.LayoutParams.WRAP_CONTENT, - ActionMenuView.LayoutParams.WRAP_CONTENT, true); - - pView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); - int xOffset = -(pView.getMeasuredWidth() - pView.getWidth()); - - int[] location = new int[2]; - pView.getLocationOnScreen(location); - int y = location[1]; - int height = helperMethod.getScreenHeight(mContext); - int m_offset_height; - if(y + helperMethod.pxFromDp(300) >height){ - m_offset_height = helperMethod.pxFromDp(203); - } - else{ - m_offset_height = 0; - } - - pPopupWindow.setOutsideTouchable(true); - pPopupWindow.setFocusable(true); - pPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); - pPopupWindow.setAnimationStyle(R.style.popup_window_animation); - pPopupWindow.setElevation(7); - if(status.sSettingLanguageRegion.equals("Ur")){ - pPopupWindow.showAsDropDown(pView,0, helperMethod.pxFromDp(-45)); - }else { - pPopupWindow.showAsDropDown(pView,xOffset - 90, -m_offset_height-helperMethod.pxFromDp(50)); - } - - return pPopupWindow; - } - - private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){ - mItemView.setPressed(false); - pPopupMenu.setVisibility(View.GONE); - pPopupMenu.animate().setDuration(150).alpha(0); - pPopupMenu.setClickable(true); - pLogoImage.setAlpha(0f); - pLogoImage.animate().cancel(); - pLogoImage.setVisibility(View.GONE); - pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE)); - } - - public void onSelectView(View pItemView, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){ - pItemView.setPressed(false); - int speed = 150; - if(pIsForced){ - speed=150; - } - if(pVibrate){ - helperMethod.vibrate(mContext); - } - - pLogoImage.setAlpha(0f); - pLogoImage.setVisibility(View.VISIBLE); - pLogoImage.animate().cancel(); - pLogoImage.animate().setDuration(speed).alpha(0.95f); - } - - public void onClearHighlight(View pItemView, ImageView pLogoImage, boolean pIsForced) - { - try { - if(pLogoImage.getAlpha()>0){ - pItemView.setPressed(false); - int speed = 150; - if(pIsForced){ - speed = 0; - } - pLogoImage.setAlpha(0f); - pLogoImage.animate().cancel(); - pLogoImage.animate().setDuration(speed).alpha(0f).withEndAction(() -> pLogoImage.setVisibility(View.GONE)); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public Object onTrigger(historyEnums.eHistoryViewAdapterCommands pCommands, List pData){ - if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_OPEN_MENU){ - return openMenu((PopupWindow) pData.get(0), (View) pData.get(1), (View) pData.get(2)); - } - if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW){ - clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2)); - } - if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW){ - onSelectView((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4)); - } - if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT){ - onClearHighlight((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.historyManager; + +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.view.View; +import android.widget.ActionMenuView; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.PopupWindow; +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; +import java.util.List; + +public class historyAdapterView +{ + /*Private Variables*/ + private AppCompatActivity mContext; + + historyAdapterView(AppCompatActivity pContext) + { + this.mContext = pContext; + } + + public Object openMenu(PopupWindow pPopupWindow, View pView, View popupView){ + + if(pPopupWindow !=null){ + pPopupWindow.dismiss(); + } + + pPopupWindow = new PopupWindow( + popupView, + ActionMenuView.LayoutParams.WRAP_CONTENT, + ActionMenuView.LayoutParams.WRAP_CONTENT, true); + + pView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); + int xOffset = -(pView.getMeasuredWidth() - pView.getWidth()); + + int[] location = new int[2]; + pView.getLocationOnScreen(location); + int y = location[1]; + int height = helperMethod.getScreenHeight(mContext); + int m_offset_height; + if(y + helperMethod.pxFromDp(300) >height){ + m_offset_height = helperMethod.pxFromDp(203); + } + else{ + m_offset_height = 0; + } + + pPopupWindow.setOutsideTouchable(true); + pPopupWindow.setFocusable(true); + pPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + pPopupWindow.setAnimationStyle(R.style.popup_window_animation); + pPopupWindow.setElevation(7); + if(status.sSettingLanguageRegion.equals("Ur")){ + pPopupWindow.showAsDropDown(pView,0, helperMethod.pxFromDp(-45)); + }else { + pPopupWindow.showAsDropDown(pView,xOffset - 90, -m_offset_height-helperMethod.pxFromDp(50)); + } + + return pPopupWindow; + } + + private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){ + mItemView.setPressed(false); + pPopupMenu.setVisibility(View.GONE); + pPopupMenu.animate().setDuration(150).alpha(0); + pPopupMenu.setClickable(true); + pLogoImage.setAlpha(0f); + pLogoImage.animate().cancel(); + pLogoImage.setVisibility(View.GONE); + pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE)); + } + + public void onSelectView(View pItemView, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){ + pItemView.setPressed(false); + int speed = 150; + if(pIsForced){ + speed=150; + } + if(pVibrate){ + helperMethod.vibrate(mContext); + } + + pLogoImage.setAlpha(0f); + pLogoImage.setVisibility(View.VISIBLE); + pLogoImage.animate().cancel(); + pLogoImage.animate().setDuration(speed).alpha(0.95f); + } + + public void onClearHighlight(View pItemView, ImageView pLogoImage, boolean pIsForced) + { + try { + if(pLogoImage.getAlpha()>0){ + pItemView.setPressed(false); + int speed = 150; + if(pIsForced){ + speed = 0; + } + pLogoImage.setAlpha(0f); + pLogoImage.animate().cancel(); + pLogoImage.animate().setDuration(speed).alpha(0f).withEndAction(() -> pLogoImage.setVisibility(View.GONE)); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public Object onTrigger(historyEnums.eHistoryViewAdapterCommands pCommands, List pData){ + if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_OPEN_MENU){ + return openMenu((PopupWindow) pData.get(0), (View) pData.get(1), (View) pData.get(2)); + } + if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW){ + clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2)); + } + if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW){ + onSelectView((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4)); + } + if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT){ + onClearHighlight((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyEnums.java index a88f5e86..4bd8e482 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyEnums.java @@ -1,18 +1,18 @@ -package com.darkweb.genesissearchengine.appManager.historyManager; - -public class historyEnums -{ - /*History Manager*/ - public enum eHistoryViewCommands { - M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU, M_CLOSE_MENU, M_HIDE_SEARCH, M_LONG_PRESS_MENU, ON_GENERATE_SWIPABLE_BACKGROUND - } - - public enum eHistoryAdapterCommands { - M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE - } - - public enum eHistoryViewAdapterCommands { - M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT - } - +package com.darkweb.genesissearchengine.appManager.historyManager; + +public class historyEnums +{ + /*History Manager*/ + public enum eHistoryViewCommands { + M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU, M_CLOSE_MENU, M_HIDE_SEARCH, M_LONG_PRESS_MENU, ON_GENERATE_SWIPABLE_BACKGROUND + } + + public enum eHistoryAdapterCommands { + M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE + } + + public enum eHistoryViewAdapterCommands { + M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/FakeLauncherActivity.kt b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/FakeLauncherActivity.kt index 40120541..a93a363c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/FakeLauncherActivity.kt +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/FakeLauncherActivity.kt @@ -1,10 +1,10 @@ -package com.darkweb.genesissearchengine.appManager.homeManager - -import androidx.appcompat.app.AppCompatActivity -import android.os.Bundle - -class FakeLauncherActivity : AppCompatActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - } +package com.darkweb.genesissearchengine.appManager.homeManager + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle + +class FakeLauncherActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java index 217e4e54..bb81a8af 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java @@ -1,156 +1,166 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; - -import android.content.Context; -import androidx.core.view.NestedScrollingChildHelper; -import androidx.core.view.ViewCompat; -import android.util.AttributeSet; -import android.util.Log; -import android.view.MotionEvent; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import org.mozilla.geckoview.GeckoView; -import java.util.Collections; - -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_ALWAYS; - -public class NestedGeckoView extends GeckoView { - private int mLastY; - private final int[] mScrollOffset = new int[2]; - private final int[] mScrollConsumed = new int[2]; - private int mNestedOffsetY; - private NestedScrollingChildHelper mChildHelper; - private eventObserver.eventListener mEvent; - - - public void onSetHomeEvent(eventObserver.eventListener pEvent){ - mEvent = pEvent; - } - - public void onDestroy() { - mEvent = null; - mChildHelper = null; - } - - public NestedGeckoView(Context context, AttributeSet attrs) { - super(context.getApplicationContext(), attrs); - - mChildHelper = new NestedScrollingChildHelper(this); - setNestedScrollingEnabled(true); - } - - @Override - public boolean onTouchEvent(MotionEvent ev) { - final MotionEvent event = MotionEvent.obtain(ev); - final int action = ev.getActionMasked(); - - if (action == MotionEvent.ACTION_DOWN) { - mNestedOffsetY = 0; - } - - final int eventY = (int) event.getY(); - event.offsetLocation(0, mNestedOffsetY); - - if(event.getPointerCount() > 1 && !status.sSettingEnableZoom) { - return true; - } - - switch (action) { - case MotionEvent.ACTION_MOVE: - // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); - final boolean allowScroll = status.sFullScreenBrowsing; - int deltaY = mLastY - eventY; - - - if (allowScroll && dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) { - deltaY -= mScrollConsumed[1]; - event.offsetLocation(0, -mScrollOffset[1]); - mNestedOffsetY += mScrollOffset[1]; - } - - - mLastY = eventY - mScrollOffset[1]; - - if (allowScroll && dispatchNestedScroll(0, mScrollOffset[1], 0, deltaY, mScrollOffset)) { - mLastY -= mScrollOffset[1]; - event.offsetLocation(0, mScrollOffset[1]); - mNestedOffsetY += mScrollOffset[1]; - } - - if(status.sFullScreenBrowsing){ - Log.i("wow1", eventY + ""); - } - - break; - - case MotionEvent.ACTION_DOWN: - mLastY = eventY; - startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); - mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_DOWN); - break; - - case MotionEvent.ACTION_UP: - mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_UP_ALWAYS); - case MotionEvent.ACTION_CANCEL: - // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); - stopNestedScroll(); - break; - - default: - // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); - } - - // Execute event handler from parent class in all cases - boolean eventHandled = super.onTouchEvent(event); - - // Recycle previously obtained event - event.recycle(); - - return eventHandled; - } - - @Override - public void setNestedScrollingEnabled(boolean enabled) { - mChildHelper.setNestedScrollingEnabled(enabled); - } - - @Override - public boolean isNestedScrollingEnabled() { - return mChildHelper.isNestedScrollingEnabled(); - } - - @Override - public boolean startNestedScroll(int axes) { - return mChildHelper.startNestedScroll(axes); - } - - @Override - public void stopNestedScroll() { - mChildHelper.stopNestedScroll(); - } - - @Override - public boolean hasNestedScrollingParent() { - return mChildHelper.hasNestedScrollingParent(); - } - - @Override - public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) { - return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow); - } - - @Override - public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) { - return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); - } - - @Override - public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) { - return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed); - } - - public int getMaxY(){ - return 1; - } - +package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; + +import android.content.Context; +import androidx.core.view.NestedScrollingChildHelper; +import androidx.core.view.ViewCompat; +import android.util.AttributeSet; +import android.util.Log; +import android.view.MotionEvent; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import org.mozilla.geckoview.GeckoView; +import java.util.Collections; + +import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN; +import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_ALWAYS; + +public class NestedGeckoView extends GeckoView { + private int mLastY; + private final int[] mScrollOffset = new int[2]; + private final int[] mScrollConsumed = new int[2]; + private int mNestedOffsetY; + private NestedScrollingChildHelper mChildHelper; + private eventObserver.eventListener mEvent; + private boolean mScrollable = true; + private int mSwipeDistance = 0; + + public void onSetHomeEvent(eventObserver.eventListener pEvent){ + mEvent = pEvent; + } + + public void onDestroy() { + mEvent = null; + mChildHelper = null; + } + + public NestedGeckoView(Context context, AttributeSet attrs) { + super(context.getApplicationContext(), attrs); + + mChildHelper = new NestedScrollingChildHelper(this); + setNestedScrollingEnabled(true); + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + final MotionEvent event = MotionEvent.obtain(ev); + final int action = ev.getActionMasked(); + + if (action == MotionEvent.ACTION_DOWN) { + mNestedOffsetY = 0; + } + + final int eventY = (int) event.getY(); + event.offsetLocation(0, mNestedOffsetY); + + if(event.getPointerCount() > 1 && !status.sSettingEnableZoom) { + return true; + } + + switch (action) { + case MotionEvent.ACTION_MOVE: + // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); + + int deltaY = mLastY - eventY; + mSwipeDistance += deltaY; + + if(mSwipeDistance>=100 || mSwipeDistance<=-150){ + mScrollable = true; + } + + final boolean allowScroll = status.sFullScreenBrowsing && !status.sDisableExpandTemp && mScrollable; + + + if (allowScroll && dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) { + deltaY -= mScrollConsumed[1]; + event.offsetLocation(0, -mScrollOffset[1]); + mNestedOffsetY += mScrollOffset[1]; + } + + + mLastY = eventY - mScrollOffset[1]; + + if (allowScroll && dispatchNestedScroll(0, mScrollOffset[1], 0, deltaY, mScrollOffset)) { + mLastY -= mScrollOffset[1]; + event.offsetLocation(0, mScrollOffset[1]); + mNestedOffsetY += mScrollOffset[1]; + } + + if(status.sFullScreenBrowsing){ + Log.i("wow1", eventY + ""); + } + + break; + + case MotionEvent.ACTION_DOWN: + mSwipeDistance = 0; + mScrollable = false; + mLastY = eventY; + startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); + mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_DOWN); + break; + + case MotionEvent.ACTION_UP: + mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_UP_ALWAYS); + case MotionEvent.ACTION_CANCEL: + // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); + stopNestedScroll(); + break; + + default: + // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); + } + + // Execute event handler from parent class in all cases + boolean eventHandled = super.onTouchEvent(event); + + // Recycle previously obtained event + event.recycle(); + + return eventHandled; + } + + @Override + public void setNestedScrollingEnabled(boolean enabled) { + mChildHelper.setNestedScrollingEnabled(enabled); + } + + @Override + public boolean isNestedScrollingEnabled() { + return mChildHelper.isNestedScrollingEnabled(); + } + + @Override + public boolean startNestedScroll(int axes) { + return mChildHelper.startNestedScroll(axes); + } + + @Override + public void stopNestedScroll() { + mChildHelper.stopNestedScroll(); + } + + @Override + public boolean hasNestedScrollingParent() { + return mChildHelper.hasNestedScrollingParent(); + } + + @Override + public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) { + return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow); + } + + @Override + public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) { + return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); + } + + @Override + public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) { + return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed); + } + + public int getMaxY(){ + return 1; + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/errorHandler.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/errorHandler.java index 405ef5f7..7025abe2 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/errorHandler.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/errorHandler.java @@ -1,167 +1,167 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; - -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; -import org.mozilla.geckoview.WebRequestError; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - -public class errorHandler -{ - private AppCompatActivity mContext; - private String mErrorTemplate; - - public String createErrorPage(final int category, final int error,AppCompatActivity mContext,String url, InputStream mResourceURL) { - this.mContext = mContext; - if (mErrorTemplate == null) { - StringBuilder builder = new StringBuilder(); - try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { - - String line; - while ((line = reader.readLine()) != null) { - builder.append(line); - builder.append("\n"); - } - - mErrorTemplate = builder.toString(); - } catch (IOException e) { - return null; - } - } - String title = helperMethod.getHost(url); - - if(url==null){ - url = "Hidden Error"; - } - if(title==null){ - title = "Hidden Error"; - } - - String replaceUrl = errorToString(error).replace("$URL",url); - String errorPage = createErrorPage("CODE : " + categoryToString(category) + "
    TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL); - errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category)); - return errorPage; - } - - private String translateMessage(String message,String error){ - message = message.replace("$ERROR_M1",mContext.getString(R.string.ERROR_M1)); - message = message.replace("$ERROR_M2",mContext.getString(R.string.ERROR_M2)); - message = message.replace("$ERROR_M3",mContext.getString(R.string.ERROR_M3)); - message = message.replace("$ERROR_M4",mContext.getString(R.string.ERROR_M4)); - message = message.replace("$ERROR_M5",mContext.getString(R.string.ERROR_M5)); - message = message.replace("$ERROR_M6",mContext.getString(R.string.ERROR_M6)); - message = message.replace("$ERROR", error); - - return message; - } - - private String errorToString(final int error) { - switch (error) { - case WebRequestError.ERROR_UNKNOWN: - return "ERROR_UNKNOWN" ; - case WebRequestError.ERROR_SECURITY_SSL: - return "ERROR_SECURITY_SSL"; - case WebRequestError.ERROR_SECURITY_BAD_CERT: - return "ERROR_SECURITY_BAD_CERT"; - case WebRequestError.ERROR_NET_RESET: - return "ERROR_NET_RESET"; - case WebRequestError.ERROR_NET_INTERRUPT: - return "ERROR_NET_INTERRUPT"; - case WebRequestError.ERROR_NET_TIMEOUT: - return "ERROR_NET_TIMEOUT"; - case WebRequestError.ERROR_CONNECTION_REFUSED: - return "ERROR_CONNECTION_REFUSED"; - case WebRequestError.ERROR_UNKNOWN_PROTOCOL: - return "ERROR_UNKNOWN_PROTOCOL"; - case WebRequestError.ERROR_UNKNOWN_HOST: - return "ERROR_UNKNOWN_HOST"; - case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE: - return "ERROR_UNKNOWN_SOCKET_TYPE"; - case WebRequestError.ERROR_UNKNOWN_PROXY_HOST: - return "ERROR_UNKNOWN_PROXY_HOST"; - case WebRequestError.ERROR_MALFORMED_URI: - return "ERROR_MALFORMED_URI"; - case WebRequestError.ERROR_REDIRECT_LOOP: - return "ERROR_REDIRECT_LOOP"; - case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI: - return "ERROR_SAFEBROWSING_PHISHING_URI"; - case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI: - return "ERROR_SAFEBROWSING_MALWARE_URI"; - case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI: - return "ERROR_SAFEBROWSING_UNWANTED_URI"; - case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI: - return "ERROR_SAFEBROWSING_HARMFUL_URI"; - case WebRequestError.ERROR_CONTENT_CRASHED: - return "ERROR_CONTENT_CRASHED"; - case WebRequestError.ERROR_OFFLINE: - return "ERROR_OFFLINE"; - case WebRequestError.ERROR_PORT_BLOCKED: - return "ERROR_PORT_BLOCKED"; - case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED: - return "ERROR_PROXY_CONNECTION_REFUSED"; - case WebRequestError.ERROR_FILE_NOT_FOUND: - return "ERROR_FILE_NOT_FOUND"; - case WebRequestError.ERROR_FILE_ACCESS_DENIED: - return "ERROR_FILE_ACCESS_DENIED"; - case WebRequestError.ERROR_INVALID_CONTENT_ENCODING: - return "ERROR_INVALID_CONTENT_ENCODING"; - case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE: - return "ERROR_UNSAFE_CONTENT_TYPE"; - case WebRequestError.ERROR_CORRUPTED_CONTENT: - return "ERROR_CORRUPTED_CONTENT"; - default: - return "UNKNOWN"; - } - } - private String categoryToString(final int category) - { - switch (category) - { - case WebRequestError.ERROR_CATEGORY_UNKNOWN: - return "ERROR_CATEGORY_UNKNOWN"; - case WebRequestError.ERROR_CATEGORY_SECURITY: - return "ERROR_CATEGORY_SECURITY"; - case WebRequestError.ERROR_CATEGORY_NETWORK: - return "ERROR_CATEGORY_NETWORK"; - case WebRequestError.ERROR_CATEGORY_CONTENT: - return "ERROR_CATEGORY_CONTENT"; - case WebRequestError.ERROR_CATEGORY_URI: - return "ERROR_CATEGORY_URI"; - case WebRequestError.ERROR_CATEGORY_PROXY: - return "ERROR_CATEGORY_PROXY"; - case WebRequestError.ERROR_CATEGORY_SAFEBROWSING: - return "ERROR_CATEGORY_SAFEBROWSING"; - default: - return "UNKNOWN"; - } - } - private String createErrorPage(final String error,String url, InputStream mResourceURL) { - if(error==null){ - return strings.GENERIC_EMPTY_STR; - } - - if (mErrorTemplate == null) { - StringBuilder builder = new StringBuilder(); - try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { - - String line; - while ((line = reader.readLine()) != null) { - builder.append(line); - builder.append("\n"); - } - - mErrorTemplate = builder.toString(); - } catch (IOException e) { - return null; - } - } - String replaceUrl = mErrorTemplate.replace("$URL",url); - - return replaceUrl; - } - -} +package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; + +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; +import org.mozilla.geckoview.WebRequestError; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +public class errorHandler +{ + private AppCompatActivity mContext; + private String mErrorTemplate; + + public String createErrorPage(final int category, final int error,AppCompatActivity mContext,String url, InputStream mResourceURL) { + this.mContext = mContext; + if (mErrorTemplate == null) { + StringBuilder builder = new StringBuilder(); + try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { + + String line; + while ((line = reader.readLine()) != null) { + builder.append(line); + builder.append("\n"); + } + + mErrorTemplate = builder.toString(); + } catch (IOException e) { + return null; + } + } + String title = helperMethod.getHost(url); + + if(url==null){ + url = "Hidden Error"; + } + if(title==null){ + title = "Hidden Error"; + } + + String replaceUrl = errorToString(error).replace("$URL",url); + String errorPage = createErrorPage("CODE : " + categoryToString(category) + "
    TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL); + errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category)); + return errorPage; + } + + private String translateMessage(String message,String error){ + message = message.replace("$ERROR_M1",mContext.getString(R.string.ERROR_M1)); + message = message.replace("$ERROR_M2",mContext.getString(R.string.ERROR_M2)); + message = message.replace("$ERROR_M3",mContext.getString(R.string.ERROR_M3)); + message = message.replace("$ERROR_M4",mContext.getString(R.string.ERROR_M4)); + message = message.replace("$ERROR_M5",mContext.getString(R.string.ERROR_M5)); + message = message.replace("$ERROR_M6",mContext.getString(R.string.ERROR_M6)); + message = message.replace("$ERROR", error); + + return message; + } + + private String errorToString(final int error) { + switch (error) { + case WebRequestError.ERROR_UNKNOWN: + return "ERROR_UNKNOWN" ; + case WebRequestError.ERROR_SECURITY_SSL: + return "ERROR_SECURITY_SSL"; + case WebRequestError.ERROR_SECURITY_BAD_CERT: + return "ERROR_SECURITY_BAD_CERT"; + case WebRequestError.ERROR_NET_RESET: + return "ERROR_NET_RESET"; + case WebRequestError.ERROR_NET_INTERRUPT: + return "ERROR_NET_INTERRUPT"; + case WebRequestError.ERROR_NET_TIMEOUT: + return "ERROR_NET_TIMEOUT"; + case WebRequestError.ERROR_CONNECTION_REFUSED: + return "ERROR_CONNECTION_REFUSED"; + case WebRequestError.ERROR_UNKNOWN_PROTOCOL: + return "ERROR_UNKNOWN_PROTOCOL"; + case WebRequestError.ERROR_UNKNOWN_HOST: + return "ERROR_UNKNOWN_HOST"; + case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE: + return "ERROR_UNKNOWN_SOCKET_TYPE"; + case WebRequestError.ERROR_UNKNOWN_PROXY_HOST: + return "ERROR_UNKNOWN_PROXY_HOST"; + case WebRequestError.ERROR_MALFORMED_URI: + return "ERROR_MALFORMED_URI"; + case WebRequestError.ERROR_REDIRECT_LOOP: + return "ERROR_REDIRECT_LOOP"; + case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI: + return "ERROR_SAFEBROWSING_PHISHING_URI"; + case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI: + return "ERROR_SAFEBROWSING_MALWARE_URI"; + case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI: + return "ERROR_SAFEBROWSING_UNWANTED_URI"; + case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI: + return "ERROR_SAFEBROWSING_HARMFUL_URI"; + case WebRequestError.ERROR_CONTENT_CRASHED: + return "ERROR_CONTENT_CRASHED"; + case WebRequestError.ERROR_OFFLINE: + return "ERROR_OFFLINE"; + case WebRequestError.ERROR_PORT_BLOCKED: + return "ERROR_PORT_BLOCKED"; + case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED: + return "ERROR_PROXY_CONNECTION_REFUSED"; + case WebRequestError.ERROR_FILE_NOT_FOUND: + return "ERROR_FILE_NOT_FOUND"; + case WebRequestError.ERROR_FILE_ACCESS_DENIED: + return "ERROR_FILE_ACCESS_DENIED"; + case WebRequestError.ERROR_INVALID_CONTENT_ENCODING: + return "ERROR_INVALID_CONTENT_ENCODING"; + case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE: + return "ERROR_UNSAFE_CONTENT_TYPE"; + case WebRequestError.ERROR_CORRUPTED_CONTENT: + return "ERROR_CORRUPTED_CONTENT"; + default: + return "UNKNOWN"; + } + } + private String categoryToString(final int category) + { + switch (category) + { + case WebRequestError.ERROR_CATEGORY_UNKNOWN: + return "ERROR_CATEGORY_UNKNOWN"; + case WebRequestError.ERROR_CATEGORY_SECURITY: + return "ERROR_CATEGORY_SECURITY"; + case WebRequestError.ERROR_CATEGORY_NETWORK: + return "ERROR_CATEGORY_NETWORK"; + case WebRequestError.ERROR_CATEGORY_CONTENT: + return "ERROR_CATEGORY_CONTENT"; + case WebRequestError.ERROR_CATEGORY_URI: + return "ERROR_CATEGORY_URI"; + case WebRequestError.ERROR_CATEGORY_PROXY: + return "ERROR_CATEGORY_PROXY"; + case WebRequestError.ERROR_CATEGORY_SAFEBROWSING: + return "ERROR_CATEGORY_SAFEBROWSING"; + default: + return "UNKNOWN"; + } + } + private String createErrorPage(final String error,String url, InputStream mResourceURL) { + if(error==null){ + return strings.GENERIC_EMPTY_STR; + } + + if (mErrorTemplate == null) { + StringBuilder builder = new StringBuilder(); + try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { + + String line; + while ((line = reader.readLine()) != null) { + builder.append(line); + builder.append("\n"); + } + + mErrorTemplate = builder.toString(); + } catch (IOException e) { + return null; + } + } + String replaceUrl = mErrorTemplate.replace("$URL",url); + + return replaceUrl; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/extendedGeckoView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/extendedGeckoView.java index e1c864d9..2260dce9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/extendedGeckoView.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/extendedGeckoView.java @@ -1,850 +1,850 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; - -import org.mozilla.gecko.AndroidGamepadManager; -import org.mozilla.gecko.EventDispatcher; -import org.mozilla.gecko.InputMethods; -import org.mozilla.gecko.SurfaceViewWrapper; -import org.mozilla.gecko.util.ActivityUtils; -import org.mozilla.gecko.util.ThreadUtils; -import org.mozilla.geckoview.Autofill; -import org.mozilla.geckoview.BasicSelectionActionDelegate; -import org.mozilla.geckoview.GeckoDisplay; -import org.mozilla.geckoview.GeckoResult; -import org.mozilla.geckoview.GeckoRuntime; -import org.mozilla.geckoview.GeckoSession; -import org.mozilla.geckoview.PanZoomController; - -import android.annotation.SuppressLint; -import android.annotation.TargetApi; -import android.app.Activity; -import android.content.Context; -import android.content.res.Configuration; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Matrix; -import android.graphics.Rect; -import android.graphics.RectF; -import android.graphics.Region; -import android.os.Build; -import android.os.Handler; -import androidx.annotation.AnyThread; -import androidx.annotation.IntDef; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.UiThread; -import androidx.core.view.ViewCompat; -import android.util.AttributeSet; -import android.util.DisplayMetrics; -import android.util.SparseArray; -import android.util.TypedValue; -import android.view.DisplayCutout; -import android.view.KeyEvent; -import android.view.MotionEvent; -import android.view.Surface; -import android.view.SurfaceView; -import android.view.TextureView; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewStructure; -import android.view.autofill.AutofillManager; -import android.view.autofill.AutofillValue; -import android.view.inputmethod.EditorInfo; -import android.view.inputmethod.InputConnection; -import android.view.inputmethod.InputMethodManager; -import android.widget.FrameLayout; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@UiThread -public class extendedGeckoView extends FrameLayout { - private static final String LOGTAG = "extendedGeckoView"; - private static final boolean DEBUG = false; - - protected final @NonNull Display mDisplay = new Display(); - - private Integer mLastCoverColor; - protected @Nullable - GeckoSession mSession; - private boolean mStateSaved; - - private @Nullable SurfaceViewWrapper mSurfaceWrapper; - - private boolean mIsResettingFocus; - - private boolean mAutofillEnabled = true; - - private GeckoSession.SelectionActionDelegate mSelectionActionDelegate; - private Autofill.Delegate mAutofillDelegate; - - private class Display implements SurfaceViewWrapper.Listener { - private final int[] mOrigin = new int[2]; - - private GeckoDisplay mDisplay; - private boolean mValid; - - private int mClippingHeight; - private int mDynamicToolbarMaxHeight; - - public void acquire(final GeckoDisplay display) { - mDisplay = display; - - if (!mValid) { - return; - } - - setVerticalClipping(mClippingHeight); - - // Tell display there is already a surface. - onGlobalLayout(); - if (extendedGeckoView.this.mSurfaceWrapper != null) { - final SurfaceViewWrapper wrapper = extendedGeckoView.this.mSurfaceWrapper; - mDisplay.surfaceChanged(wrapper.getSurface(), - wrapper.getWidth(), wrapper.getHeight()); - mDisplay.setDynamicToolbarMaxHeight(mDynamicToolbarMaxHeight); - extendedGeckoView.this.setActive(true); - } - } - - public GeckoDisplay release() { - if (mValid) { - if (mDisplay != null) { - mDisplay.surfaceDestroyed(); - } - extendedGeckoView.this.setActive(false); - } - - final GeckoDisplay display = mDisplay; - mDisplay = null; - return display; - } - - @Override // SurfaceListener - public void onSurfaceChanged(final Surface surface, - final int width, final int height) { - if (mDisplay != null) { - mDisplay.surfaceChanged(surface, width, height); - mDisplay.setDynamicToolbarMaxHeight(mDynamicToolbarMaxHeight); - if (!mValid) { - extendedGeckoView.this.setActive(true); - } - } - mValid = true; - } - - @Override // SurfaceListener - public void onSurfaceDestroyed() { - if (mDisplay != null) { - mDisplay.surfaceDestroyed(); - extendedGeckoView.this.setActive(false); - } - mValid = false; - } - - public void onGlobalLayout() { - if (mDisplay == null) { - return; - } - if (extendedGeckoView.this.mSurfaceWrapper != null) { - extendedGeckoView.this.mSurfaceWrapper.getView().getLocationOnScreen(mOrigin); - mDisplay.screenOriginChanged(mOrigin[0], mOrigin[1]); - // cutout support - if (Build.VERSION.SDK_INT >= 28) { - final DisplayCutout cutout = extendedGeckoView.this.mSurfaceWrapper.getView().getRootWindowInsets().getDisplayCutout(); - if (cutout != null) { - mDisplay.safeAreaInsetsChanged(cutout.getSafeInsetTop(), cutout.getSafeInsetRight(), cutout.getSafeInsetBottom(), cutout.getSafeInsetLeft()); - } - } - } - } - - public boolean shouldPinOnScreen() { - return mDisplay != null ? mDisplay.shouldPinOnScreen() : false; - } - - public void setVerticalClipping(final int clippingHeight) { - mClippingHeight = clippingHeight; - - if (mDisplay != null) { - mDisplay.setVerticalClipping(clippingHeight); - } - } - - public void setDynamicToolbarMaxHeight(final int height) { - mDynamicToolbarMaxHeight = height; - - // Reset the vertical clipping value to zero whenever we change - // the dynamic toolbar __max__ height so that it can be properly - // propagated to both the main thread and the compositor thread, - // thus we will be able to reset the __current__ toolbar height - // on the both threads whatever the __current__ toolbar height is. - setVerticalClipping(0); - - if (mDisplay != null) { - mDisplay.setDynamicToolbarMaxHeight(height); - } - } - - /** - * Request a {@link Bitmap} of the visible portion of the web page currently being - * rendered. - * - * @return A {@link GeckoResult} that completes with a {@link Bitmap} containing - * the pixels and size information of the currently visible rendered web page. - */ - @UiThread - @NonNull - GeckoResult capturePixels() { - if (mDisplay == null) { - return GeckoResult.fromException(new IllegalStateException("Display must be created before pixels can be captured")); - } - - return mDisplay.capturePixels(); - } - } - - @SuppressWarnings("checkstyle:javadocmethod") - public extendedGeckoView(final Context context) { - super(context); - init(); - } - - @SuppressWarnings("checkstyle:javadocmethod") - public extendedGeckoView(final Context context, final AttributeSet attrs) { - super(context, attrs); - init(); - } - - private void init() { - setFocusable(true); - setFocusableInTouchMode(true); - setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); - - // We are adding descendants to this LayerView, but we don't want the - // descendants to affect the way LayerView retains its focus. - setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS); - - // This will stop PropertyAnimator from creating a drawing cache (i.e. a - // bitmap) from a SurfaceView, which is just not possible (the bitmap will be - // transparent). - setWillNotCacheDrawing(false); - - mSurfaceWrapper = new SurfaceViewWrapper(getContext()); - mSurfaceWrapper.setBackgroundColor(Color.WHITE); - addView(mSurfaceWrapper.getView(), - new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT)); - - mSurfaceWrapper.setListener(mDisplay); - - final Activity activity = ActivityUtils.getActivityFromContext(getContext()); - if (activity != null) { - mSelectionActionDelegate = new BasicSelectionActionDelegate(activity); - } - - mAutofillDelegate = new AndroidAutofillDelegate(); - } - - /** - * Set a color to cover the display surface while a document is being shown. The color - * is automatically cleared once the new document starts painting. - * - * @param color Cover color. - */ - public void coverUntilFirstPaint(final int color) { - mLastCoverColor = color; - if (mSession != null) { - mSession.getCompositorController().setClearColor(color); - } - coverUntilFirstPaintInternal(color); - } - - private void uncover() { - coverUntilFirstPaintInternal(Color.TRANSPARENT); - } - - private void coverUntilFirstPaintInternal(final int color) { - ThreadUtils.assertOnUiThread(); - - if (mSurfaceWrapper != null) { - mSurfaceWrapper.setBackgroundColor(color); - } - } - - /** - * This extendedGeckoView instance will be backed by a {@link SurfaceView}. - * - * This option offers the best performance at the price of not being - * able to animate extendedGeckoView. - */ - public static final int BACKEND_SURFACE_VIEW = 1; - /** - * This extendedGeckoView instance will be backed by a {@link TextureView}. - * - * This option offers worse performance compared to {@link #BACKEND_SURFACE_VIEW} - * but allows you to animate extendedGeckoView or to paint a extendedGeckoView on top of another extendedGeckoView. - */ - public static final int BACKEND_TEXTURE_VIEW = 2; - - @Retention(RetentionPolicy.SOURCE) - @IntDef({BACKEND_SURFACE_VIEW, BACKEND_TEXTURE_VIEW}) - /* protected */ @interface ViewBackend {} - - /** - * Set which view should be used by this extendedGeckoView instance to display content. - * - * By default, extendedGeckoView will use a {@link SurfaceView}. - * - * @param backend Any of {@link #BACKEND_SURFACE_VIEW BACKEND_*}. - */ - public void setViewBackend(final @ViewBackend int backend) { - removeView(mSurfaceWrapper.getView()); - - if (backend == BACKEND_SURFACE_VIEW) { - mSurfaceWrapper.useSurfaceView(getContext()); - } else if (backend == BACKEND_TEXTURE_VIEW) { - mSurfaceWrapper.useTextureView(getContext()); - } - - addView(mSurfaceWrapper.getView()); - } - - /** - * Return whether the view should be pinned on the screen. When pinned, the view - * should not be moved on the screen due to animation, scrolling, etc. A common reason - * for the view being pinned is when the user is dragging a selection caret inside - * the view; normal user interaction would be disrupted in that case if the view - * was moved on screen. - * - * @return True if view should be pinned on the screen. - */ - public boolean shouldPinOnScreen() { - ThreadUtils.assertOnUiThread(); - - return mDisplay.shouldPinOnScreen(); - } - - /** - * Update the amount of vertical space that is clipped or visibly obscured in the bottom portion - * of the view. Tells gecko where to put bottom fixed elements so they are fully visible. - * - * Optional call. The display's visible vertical space has changed. Must be - * called on the application main thread. - * - * @param clippingHeight The height of the bottom clipped space in screen pixels. - */ - public void setVerticalClipping(final int clippingHeight) { - ThreadUtils.assertOnUiThread(); - - mDisplay.setVerticalClipping(clippingHeight); - } - - /** - * Set the maximum height of the dynamic toolbar(s). - * - * If there are two or more dynamic toolbars, the height value should be the total amount of - * the height of each dynamic toolbar. - * - * @param height The the maximum height of the dynamic toolbar(s). - */ - public void setDynamicToolbarMaxHeight(final int height) { - mDisplay.setDynamicToolbarMaxHeight(height); - } - - /* package */ void setActive(final boolean active) { - if (mSession != null) { - mSession.setActive(active); - } - } - - // TODO: Bug 1670805 this should really be configurable - // Default dark color for about:blank, keep it in sync with PresShell.cpp - final static int DEFAULT_DARK_COLOR = 0xFF2A2A2E; - - - /** - * Unsets the current session from this instance and returns it, if any. You must call - * this before {@link #setSession(GeckoSession)} if there is already an open session - * set for this instance. - * - * Note: this method does not close the session and the session remains active. The - * caller is responsible for calling {@link GeckoSession#close()} when appropriate. - * - * @return The {@link GeckoSession} that was set for this instance. May be null. - */ - @UiThread - public @Nullable GeckoSession releaseSession() { - ThreadUtils.assertOnUiThread(); - - if (mSession == null) { - return null; - } - - GeckoSession session = mSession; - mSession.releaseDisplay(mDisplay.release()); - mSession.getOverscrollEdgeEffect().setInvalidationCallback(null); - mSession.getCompositorController().setFirstPaintCallback(null); - - if (mSession.getAccessibility().getView() == this) { - mSession.getAccessibility().setView(null); - } - - if (mSession.getTextInput().getView() == this) { - mSession.getTextInput().setView(null); - } - - if (mSession.getSelectionActionDelegate() == mSelectionActionDelegate) { - mSession.setSelectionActionDelegate(null); - } - - if (mSession.getAutofillDelegate() == mAutofillDelegate) { - mSession.setAutofillDelegate(null); - } - - if (isFocused()) { - mSession.setFocused(false); - } - mSession = null; - return session; - } - - /** - * Attach a session to this view. If this instance already has an open session, you must use - * {@link #releaseSession()} first, otherwise {@link IllegalStateException} - * will be thrown. This is to avoid potentially leaking the currently opened session. - * - * @param session The session to be attached. - * @throws IllegalArgumentException if an existing open session is already set. - */ - @UiThread - public void setSession(@NonNull final GeckoSession session) { - ThreadUtils.assertOnUiThread(); - - if (mSession != null && mSession.isOpen()) { - throw new IllegalStateException("Current session is open"); - } - - releaseSession(); - - mSession = session; - - // Make sure the clear color is set to the default - - if (ViewCompat.isAttachedToWindow(this)) { - mDisplay.acquire(session.acquireDisplay()); - } - - final Context context = getContext(); - session.getOverscrollEdgeEffect().setTheme(context); - session.getOverscrollEdgeEffect().setInvalidationCallback(new Runnable() { - @Override - public void run() { - if (Build.VERSION.SDK_INT >= 16) { - extendedGeckoView.this.postInvalidateOnAnimation(); - } else { - extendedGeckoView.this.postInvalidateDelayed(10); - } - } - }); - - final DisplayMetrics metrics = context.getResources().getDisplayMetrics(); - final TypedValue outValue = new TypedValue(); - if (context.getTheme().resolveAttribute(android.R.attr.listPreferredItemHeight, - outValue, true)) { - session.getPanZoomController().setScrollFactor(outValue.getDimension(metrics)); - } else { - session.getPanZoomController().setScrollFactor(0.075f * metrics.densityDpi); - } - - session.getCompositorController().setFirstPaintCallback(this::uncover); - - if (session.getTextInput().getView() == null) { - session.getTextInput().setView(this); - } - - if (session.getAccessibility().getView() == null) { - session.getAccessibility().setView(this); - } - - if (session.getSelectionActionDelegate() == null && mSelectionActionDelegate != null) { - session.setSelectionActionDelegate(mSelectionActionDelegate); - } - - if (mAutofillEnabled) { - session.setAutofillDelegate(mAutofillDelegate); - } - - if (isFocused()) { - session.setFocused(true); - } - } - - @AnyThread - @SuppressWarnings("checkstyle:javadocmethod") - public @Nullable GeckoSession getSession() { - return mSession; - } - - - @Override - public void onDetachedFromWindow() { - super.onDetachedFromWindow(); - - if (mSession == null) { - return; - } - - // Release the display before we detach from the window. - mSession.releaseDisplay(mDisplay.release()); - } - - - - @Override - public boolean gatherTransparentRegion(final Region region) { - // For detecting changes in SurfaceView layout, we take a shortcut here and - // override gatherTransparentRegion, instead of registering a layout listener, - // which is more expensive. - if (mSurfaceWrapper != null) { - mDisplay.onGlobalLayout(); - } - return super.gatherTransparentRegion(region); - } - - @Override - public void onWindowFocusChanged(final boolean hasWindowFocus) { - super.onWindowFocusChanged(hasWindowFocus); - - // Only call setFocus(true) when the window gains focus. Any focus loss could be temporary - // (e.g. due to auto-fill popups) and we don't want to call setFocus(false) in those cases. - // Instead, we call setFocus(false) in onWindowVisibilityChanged. - if (mSession != null && hasWindowFocus && isFocused()) { - mSession.setFocused(true); - } - } - - @Override - protected void onWindowVisibilityChanged(final int visibility) { - super.onWindowVisibilityChanged(visibility); - - // We can be reasonably sure that the focus loss is not temporary, so call setFocus(false). - if (mSession != null && visibility != View.VISIBLE && !hasWindowFocus()) { - mSession.setFocused(false); - } - } - - @Override - protected void onFocusChanged(final boolean gainFocus, final int direction, - final Rect previouslyFocusedRect) { - super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); - - if (mIsResettingFocus) { - return; - } - - if (mSession != null) { - mSession.setFocused(gainFocus); - } - - if (!gainFocus) { - return; - } - - post(new Runnable() { - @Override - public void run() { - if (!isFocused()) { - return; - } - - final InputMethodManager imm = InputMethods.getInputMethodManager(getContext()); - // Bug 1404111: Through View#onFocusChanged, the InputMethodManager queues - // up a checkFocus call for the next spin of the message loop, so by - // posting this Runnable after super#onFocusChanged, the IMM should have - // completed its focus change handling at this point and we should be the - // active view for input handling. - - // If however onViewDetachedFromWindow for the previously active view gets - // called *after* onFocusChanged, but *before* the focus change has been - // fully processed by the IMM with the help of checkFocus, the IMM will - // lose track of the currently active view, which means that we can't - // interact with the IME. - if (!imm.isActive(extendedGeckoView.this)) { - // If that happens, we bring the IMM's internal state back into sync - // by clearing and resetting our focus. - mIsResettingFocus = true; - clearFocus(); - // After calling clearFocus we might regain focus automatically, but - // we explicitly request it again in case this doesn't happen. If - // we've already got the focus back, this will then be a no-op anyway. - requestFocus(); - mIsResettingFocus = false; - } - } - }); - } - - @Override - public Handler getHandler() { - if (Build.VERSION.SDK_INT >= 24 || mSession == null) { - return super.getHandler(); - } - return mSession.getTextInput().getHandler(super.getHandler()); - } - - @Override - public InputConnection onCreateInputConnection(final EditorInfo outAttrs) { - if (mSession == null) { - return null; - } - return mSession.getTextInput().onCreateInputConnection(outAttrs); - } - - @Override - public boolean onKeyPreIme(final int keyCode, final KeyEvent event) { - if (super.onKeyPreIme(keyCode, event)) { - return true; - } - return mSession != null && - mSession.getTextInput().onKeyPreIme(keyCode, event); - } - - @Override - public boolean onKeyUp(final int keyCode, final KeyEvent event) { - if (super.onKeyUp(keyCode, event)) { - return true; - } - return mSession != null && - mSession.getTextInput().onKeyUp(keyCode, event); - } - - @Override - public boolean onKeyDown(final int keyCode, final KeyEvent event) { - if (super.onKeyDown(keyCode, event)) { - return true; - } - return mSession != null && - mSession.getTextInput().onKeyDown(keyCode, event); - } - - @Override - public boolean onKeyLongPress(final int keyCode, final KeyEvent event) { - if (super.onKeyLongPress(keyCode, event)) { - return true; - } - return mSession != null && - mSession.getTextInput().onKeyLongPress(keyCode, event); - } - - @Override - public boolean onKeyMultiple(final int keyCode, final int repeatCount, final KeyEvent event) { - if (super.onKeyMultiple(keyCode, repeatCount, event)) { - return true; - } - return mSession != null && - mSession.getTextInput().onKeyMultiple(keyCode, repeatCount, event); - } - - @Override - public void dispatchDraw(final Canvas canvas) { - super.dispatchDraw(canvas); - - if (mSession != null) { - mSession.getOverscrollEdgeEffect().draw(canvas); - } - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public boolean onTouchEvent(final MotionEvent event) { - if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { - requestFocus(); - } - - if (mSession == null) { - return false; - } - - mSession.getPanZoomController().onTouchEvent(event); - return true; - } - - /** - * Dispatches a {@link MotionEvent} to the {@link PanZoomController}. This is the same as - * indicating how the event was handled. - * - * NOTE: It is highly recommended to only call this with ACTION_DOWN or in otherwise - * limited capacity. Returning a GeckoResult for every touch event will generate - * a lot of allocations and unnecessary GC pressure. - * - * @param event A {@link MotionEvent} - * @return One of the {@link PanZoomController#INPUT_RESULT_UNHANDLED INPUT_RESULT_*}) indicating how the event was handled. - */ - public @NonNull GeckoResult onTouchEventForResult(final @NonNull MotionEvent event) { - if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { - requestFocus(); - } - - if (mSession == null) { - return GeckoResult.fromValue(PanZoomController.INPUT_RESULT_UNHANDLED); - } - - // NOTE: Treat mouse events as "touch" rather than as "mouse", so mouse can be - // used to pan/zoom. Call onMouseEvent() instead for behavior similar to desktop. - return mSession.getPanZoomController().onTouchEventForResult(event); - } - - @Override - public boolean onGenericMotionEvent(final MotionEvent event) { - if (AndroidGamepadManager.handleMotionEvent(event)) { - return true; - } - - if (mSession == null) { - return true; - } - - if (mSession.getAccessibility().onMotionEvent(event)) { - return true; - } - - mSession.getPanZoomController().onMotionEvent(event); - return true; - } - - @Override - public void onProvideAutofillVirtualStructure(final ViewStructure structure, - final int flags) { - super.onProvideAutofillVirtualStructure(structure, flags); - - if (mSession == null) { - return; - } - - final Autofill.Session autofillSession = mSession.getAutofillSession(); - autofillSession.fillViewStructure(this, structure, flags); - } - - @Override - @TargetApi(26) - public void autofill(@NonNull final SparseArray values) { - super.autofill(values); - - if (mSession == null) { - return; - } - final SparseArray strValues = new SparseArray<>(values.size()); - for (int i = 0; i < values.size(); i++) { - final AutofillValue value = values.valueAt(i); - if (value.isText()) { - // Only text is currently supported. - strValues.put(values.keyAt(i), value.getTextValue()); - } - } - mSession.autofill(strValues); - } - - /** - * Request a {@link Bitmap} of the visible portion of the web page currently being - * rendered. - * - * See {@link GeckoDisplay#capturePixels} for more details. - * - * @return A {@link GeckoResult} that completes with a {@link Bitmap} containing - * the pixels and size information of the currently visible rendered web page. - */ - @UiThread - public @NonNull GeckoResult capturePixels() { - return mDisplay.capturePixels(); - } - - /** - * Sets whether or not this View participates in Android autofill. - * - * When enabled, this will set an {@link Autofill.Delegate} on the - * {@link GeckoSession} for this instance. - * - * @param enabled Whether or not Android autofill is enabled for this view. - */ - @TargetApi(26) - public void setAutofillEnabled(final boolean enabled) { - mAutofillEnabled = enabled; - - if (mSession != null) { - if (!enabled && mSession.getAutofillDelegate() == mAutofillDelegate) { - mSession.setAutofillDelegate(null); - } else if (enabled) { - mSession.setAutofillDelegate(mAutofillDelegate); - } - } - } - - /** - * @return Whether or not Android autofill is enabled for this view. - */ - @TargetApi(26) - public boolean getAutofillEnabled() { - return mAutofillEnabled; - } - - private class AndroidAutofillDelegate implements Autofill.Delegate { - - private Rect displayRectForId(@NonNull final GeckoSession session, - @NonNull final Autofill.Node node) { - if (node == null) { - return new Rect(0, 0, 0, 0); - } - - final Matrix matrix = new Matrix(); - final RectF rectF = new RectF(node.getDimensions()); - session.getPageToScreenMatrix(matrix); - matrix.mapRect(rectF); - - final Rect screenRect = new Rect(); - rectF.roundOut(screenRect); - return screenRect; - } - - @Override - public void onAutofill(@NonNull final GeckoSession session, - final int notification, - final Autofill.Node node) { - ThreadUtils.assertOnUiThread(); - if (Build.VERSION.SDK_INT < 26) { - return; - } - - final AutofillManager manager = - extendedGeckoView.this.getContext().getSystemService(AutofillManager.class); - if (manager == null) { - return; - } - - switch (notification) { - case Autofill.Notify.SESSION_STARTED: - // This line seems necessary for auto-fill to work on the initial page. - case Autofill.Notify.SESSION_CANCELED: - manager.cancel(); - break; - case Autofill.Notify.SESSION_COMMITTED: - manager.commit(); - break; - case Autofill.Notify.NODE_FOCUSED: - manager.notifyViewEntered( - extendedGeckoView.this, node.getId(), - displayRectForId(session, node)); - break; - case Autofill.Notify.NODE_BLURRED: - manager.notifyViewExited(extendedGeckoView.this, node.getId()); - break; - case Autofill.Notify.NODE_UPDATED: - manager.notifyValueChanged( - extendedGeckoView.this, - node.getId(), - AutofillValue.forText(node.getValue())); - break; - } - } - } +package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; + +import org.mozilla.gecko.AndroidGamepadManager; +import org.mozilla.gecko.EventDispatcher; +import org.mozilla.gecko.InputMethods; +import org.mozilla.gecko.SurfaceViewWrapper; +//import org.mozilla.gecko.util.ActivityUtils; +import org.mozilla.gecko.util.ThreadUtils; +import org.mozilla.geckoview.Autofill; +import org.mozilla.geckoview.BasicSelectionActionDelegate; +import org.mozilla.geckoview.GeckoDisplay; +import org.mozilla.geckoview.GeckoResult; +import org.mozilla.geckoview.GeckoRuntime; +import org.mozilla.geckoview.GeckoSession; +import org.mozilla.geckoview.PanZoomController; + +import android.annotation.SuppressLint; +import android.annotation.TargetApi; +import android.app.Activity; +import android.content.Context; +import android.content.res.Configuration; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Matrix; +import android.graphics.Rect; +import android.graphics.RectF; +import android.graphics.Region; +import android.os.Build; +import android.os.Handler; +import androidx.annotation.AnyThread; +import androidx.annotation.IntDef; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.UiThread; +import androidx.core.view.ViewCompat; +import android.util.AttributeSet; +import android.util.DisplayMetrics; +import android.util.SparseArray; +import android.util.TypedValue; +import android.view.DisplayCutout; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.Surface; +import android.view.SurfaceView; +import android.view.TextureView; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewStructure; +import android.view.autofill.AutofillManager; +import android.view.autofill.AutofillValue; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputConnection; +import android.view.inputmethod.InputMethodManager; +import android.widget.FrameLayout; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@UiThread +public class extendedGeckoView extends FrameLayout { + private static final String LOGTAG = "extendedGeckoView"; + private static final boolean DEBUG = false; + + protected final @NonNull Display mDisplay = new Display(); + + private Integer mLastCoverColor; + protected @Nullable + GeckoSession mSession; + private boolean mStateSaved; + + private @Nullable SurfaceViewWrapper mSurfaceWrapper; + + private boolean mIsResettingFocus; + + private boolean mAutofillEnabled = true; + + private GeckoSession.SelectionActionDelegate mSelectionActionDelegate; + private Autofill.Delegate mAutofillDelegate; + + private class Display implements SurfaceViewWrapper.Listener { + private final int[] mOrigin = new int[2]; + + private GeckoDisplay mDisplay; + private boolean mValid; + + private int mClippingHeight; + private int mDynamicToolbarMaxHeight; + + public void acquire(final GeckoDisplay display) { + mDisplay = display; + + if (!mValid) { + return; + } + + setVerticalClipping(mClippingHeight); + + // Tell display there is already a surface. + onGlobalLayout(); + if (extendedGeckoView.this.mSurfaceWrapper != null) { + final SurfaceViewWrapper wrapper = extendedGeckoView.this.mSurfaceWrapper; + mDisplay.surfaceChanged(wrapper.getSurface(), + wrapper.getWidth(), wrapper.getHeight()); + mDisplay.setDynamicToolbarMaxHeight(mDynamicToolbarMaxHeight); + extendedGeckoView.this.setActive(true); + } + } + + public GeckoDisplay release() { + if (mValid) { + if (mDisplay != null) { + mDisplay.surfaceDestroyed(); + } + extendedGeckoView.this.setActive(false); + } + + final GeckoDisplay display = mDisplay; + mDisplay = null; + return display; + } + + @Override // SurfaceListener + public void onSurfaceChanged(final Surface surface, + final int width, final int height) { + if (mDisplay != null) { + mDisplay.surfaceChanged(surface, width, height); + mDisplay.setDynamicToolbarMaxHeight(mDynamicToolbarMaxHeight); + if (!mValid) { + extendedGeckoView.this.setActive(true); + } + } + mValid = true; + } + + @Override // SurfaceListener + public void onSurfaceDestroyed() { + if (mDisplay != null) { + mDisplay.surfaceDestroyed(); + extendedGeckoView.this.setActive(false); + } + mValid = false; + } + + public void onGlobalLayout() { + if (mDisplay == null) { + return; + } + if (extendedGeckoView.this.mSurfaceWrapper != null) { + extendedGeckoView.this.mSurfaceWrapper.getView().getLocationOnScreen(mOrigin); + mDisplay.screenOriginChanged(mOrigin[0], mOrigin[1]); + // cutout support + if (Build.VERSION.SDK_INT >= 28) { + final DisplayCutout cutout = extendedGeckoView.this.mSurfaceWrapper.getView().getRootWindowInsets().getDisplayCutout(); + if (cutout != null) { + mDisplay.safeAreaInsetsChanged(cutout.getSafeInsetTop(), cutout.getSafeInsetRight(), cutout.getSafeInsetBottom(), cutout.getSafeInsetLeft()); + } + } + } + } + + public boolean shouldPinOnScreen() { + return mDisplay != null ? mDisplay.shouldPinOnScreen() : false; + } + + public void setVerticalClipping(final int clippingHeight) { + mClippingHeight = clippingHeight; + + if (mDisplay != null) { + mDisplay.setVerticalClipping(clippingHeight); + } + } + + public void setDynamicToolbarMaxHeight(final int height) { + mDynamicToolbarMaxHeight = height; + + // Reset the vertical clipping value to zero whenever we change + // the dynamic toolbar __max__ height so that it can be properly + // propagated to both the main thread and the compositor thread, + // thus we will be able to reset the __current__ toolbar height + // on the both threads whatever the __current__ toolbar height is. + setVerticalClipping(0); + + if (mDisplay != null) { + mDisplay.setDynamicToolbarMaxHeight(height); + } + } + + /** + * Request a {@link Bitmap} of the visible portion of the web page currently being + * rendered. + * + * @return A {@link GeckoResult} that completes with a {@link Bitmap} containing + * the pixels and size information of the currently visible rendered web page. + */ + @UiThread + @NonNull + GeckoResult capturePixels() { + if (mDisplay == null) { + return GeckoResult.fromException(new IllegalStateException("Display must be created before pixels can be captured")); + } + + return mDisplay.capturePixels(); + } + } + + @SuppressWarnings("checkstyle:javadocmethod") + public extendedGeckoView(final Context context) { + super(context); + init(); + } + + @SuppressWarnings("checkstyle:javadocmethod") + public extendedGeckoView(final Context context, final AttributeSet attrs) { + super(context, attrs); + init(); + } + + private void init() { + setFocusable(true); + setFocusableInTouchMode(true); + setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); + + // We are adding descendants to this LayerView, but we don't want the + // descendants to affect the way LayerView retains its focus. + setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS); + + // This will stop PropertyAnimator from creating a drawing cache (i.e. a + // bitmap) from a SurfaceView, which is just not possible (the bitmap will be + // transparent). + setWillNotCacheDrawing(false); + + mSurfaceWrapper = new SurfaceViewWrapper(getContext()); + mSurfaceWrapper.setBackgroundColor(Color.WHITE); + addView(mSurfaceWrapper.getView(), + new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT)); + + mSurfaceWrapper.setListener(mDisplay); + + //final Activity activity = ActivityUtils.getActivityFromContext(getContext()); + //if (activity != null) { + //mSelectionActionDelegate = new BasicSelectionActionDelegate(); + //} + + mAutofillDelegate = new AndroidAutofillDelegate(); + } + + /** + * Set a color to cover the display surface while a document is being shown. The color + * is automatically cleared once the new document starts painting. + * + * @param color Cover color. + */ + public void coverUntilFirstPaint(final int color) { + mLastCoverColor = color; + if (mSession != null) { + mSession.getCompositorController().setClearColor(color); + } + coverUntilFirstPaintInternal(color); + } + + private void uncover() { + coverUntilFirstPaintInternal(Color.TRANSPARENT); + } + + private void coverUntilFirstPaintInternal(final int color) { + ThreadUtils.assertOnUiThread(); + + if (mSurfaceWrapper != null) { + mSurfaceWrapper.setBackgroundColor(color); + } + } + + /** + * This extendedGeckoView instance will be backed by a {@link SurfaceView}. + * + * This option offers the best performance at the price of not being + * able to animate extendedGeckoView. + */ + public static final int BACKEND_SURFACE_VIEW = 1; + /** + * This extendedGeckoView instance will be backed by a {@link TextureView}. + * + * This option offers worse performance compared to {@link #BACKEND_SURFACE_VIEW} + * but allows you to animate extendedGeckoView or to paint a extendedGeckoView on top of another extendedGeckoView. + */ + public static final int BACKEND_TEXTURE_VIEW = 2; + + @Retention(RetentionPolicy.SOURCE) + @IntDef({BACKEND_SURFACE_VIEW, BACKEND_TEXTURE_VIEW}) + /* protected */ @interface ViewBackend {} + + /** + * Set which view should be used by this extendedGeckoView instance to display content. + * + * By default, extendedGeckoView will use a {@link SurfaceView}. + * + * @param backend Any of {@link #BACKEND_SURFACE_VIEW BACKEND_*}. + */ + public void setViewBackend(final @ViewBackend int backend) { + removeView(mSurfaceWrapper.getView()); + + if (backend == BACKEND_SURFACE_VIEW) { + mSurfaceWrapper.useSurfaceView(getContext()); + } else if (backend == BACKEND_TEXTURE_VIEW) { + mSurfaceWrapper.useTextureView(getContext()); + } + + addView(mSurfaceWrapper.getView()); + } + + /** + * Return whether the view should be pinned on the screen. When pinned, the view + * should not be moved on the screen due to animation, scrolling, etc. A common reason + * for the view being pinned is when the user is dragging a selection caret inside + * the view; normal user interaction would be disrupted in that case if the view + * was moved on screen. + * + * @return True if view should be pinned on the screen. + */ + public boolean shouldPinOnScreen() { + ThreadUtils.assertOnUiThread(); + + return mDisplay.shouldPinOnScreen(); + } + + /** + * Update the amount of vertical space that is clipped or visibly obscured in the bottom portion + * of the view. Tells gecko where to put bottom fixed elements so they are fully visible. + * + * Optional call. The display's visible vertical space has changed. Must be + * called on the application main thread. + * + * @param clippingHeight The height of the bottom clipped space in screen pixels. + */ + public void setVerticalClipping(final int clippingHeight) { + ThreadUtils.assertOnUiThread(); + + mDisplay.setVerticalClipping(clippingHeight); + } + + /** + * Set the maximum height of the dynamic toolbar(s). + * + * If there are two or more dynamic toolbars, the height value should be the total amount of + * the height of each dynamic toolbar. + * + * @param height The the maximum height of the dynamic toolbar(s). + */ + public void setDynamicToolbarMaxHeight(final int height) { + mDisplay.setDynamicToolbarMaxHeight(height); + } + + /* package */ void setActive(final boolean active) { + if (mSession != null) { + mSession.setActive(active); + } + } + + // TODO: Bug 1670805 this should really be configurable + // Default dark color for about:blank, keep it in sync with PresShell.cpp + final static int DEFAULT_DARK_COLOR = 0xFF2A2A2E; + + + /** + * Unsets the current session from this instance and returns it, if any. You must call + * this before {@link #setSession(GeckoSession)} if there is already an open session + * set for this instance. + * + * Note: this method does not close the session and the session remains active. The + * caller is responsible for calling {@link GeckoSession#close()} when appropriate. + * + * @return The {@link GeckoSession} that was set for this instance. May be null. + */ + @UiThread + public @Nullable GeckoSession releaseSession() { + ThreadUtils.assertOnUiThread(); + + if (mSession == null) { + return null; + } + + GeckoSession session = mSession; + mSession.releaseDisplay(mDisplay.release()); + mSession.getOverscrollEdgeEffect().setInvalidationCallback(null); + mSession.getCompositorController().setFirstPaintCallback(null); + + if (mSession.getAccessibility().getView() == this) { + mSession.getAccessibility().setView(null); + } + + if (mSession.getTextInput().getView() == this) { + mSession.getTextInput().setView(null); + } + + if (mSession.getSelectionActionDelegate() == mSelectionActionDelegate) { + mSession.setSelectionActionDelegate(null); + } + + if (mSession.getAutofillDelegate() == mAutofillDelegate) { + mSession.setAutofillDelegate(null); + } + + if (isFocused()) { + mSession.setFocused(false); + } + mSession = null; + return session; + } + + /** + * Attach a session to this view. If this instance already has an open session, you must use + * {@link #releaseSession()} first, otherwise {@link IllegalStateException} + * will be thrown. This is to avoid potentially leaking the currently opened session. + * + * @param session The session to be attached. + * @throws IllegalArgumentException if an existing open session is already set. + */ + @UiThread + public void setSession(@NonNull final GeckoSession session) { + ThreadUtils.assertOnUiThread(); + + if (mSession != null && mSession.isOpen()) { + throw new IllegalStateException("Current session is open"); + } + + releaseSession(); + + mSession = session; + + // Make sure the clear color is set to the default + + if (ViewCompat.isAttachedToWindow(this)) { + mDisplay.acquire(session.acquireDisplay()); + } + + final Context context = getContext(); + session.getOverscrollEdgeEffect().setTheme(context); + session.getOverscrollEdgeEffect().setInvalidationCallback(new Runnable() { + @Override + public void run() { + if (Build.VERSION.SDK_INT >= 16) { + extendedGeckoView.this.postInvalidateOnAnimation(); + } else { + extendedGeckoView.this.postInvalidateDelayed(10); + } + } + }); + + final DisplayMetrics metrics = context.getResources().getDisplayMetrics(); + final TypedValue outValue = new TypedValue(); + if (context.getTheme().resolveAttribute(android.R.attr.listPreferredItemHeight, + outValue, true)) { + session.getPanZoomController().setScrollFactor(outValue.getDimension(metrics)); + } else { + session.getPanZoomController().setScrollFactor(0.075f * metrics.densityDpi); + } + + session.getCompositorController().setFirstPaintCallback(this::uncover); + + if (session.getTextInput().getView() == null) { + session.getTextInput().setView(this); + } + + if (session.getAccessibility().getView() == null) { + session.getAccessibility().setView(this); + } + + if (session.getSelectionActionDelegate() == null && mSelectionActionDelegate != null) { + session.setSelectionActionDelegate(mSelectionActionDelegate); + } + + if (mAutofillEnabled) { + session.setAutofillDelegate(mAutofillDelegate); + } + + if (isFocused()) { + session.setFocused(true); + } + } + + @AnyThread + @SuppressWarnings("checkstyle:javadocmethod") + public @Nullable GeckoSession getSession() { + return mSession; + } + + + @Override + public void onDetachedFromWindow() { + super.onDetachedFromWindow(); + + if (mSession == null) { + return; + } + + // Release the display before we detach from the window. + mSession.releaseDisplay(mDisplay.release()); + } + + + + @Override + public boolean gatherTransparentRegion(final Region region) { + // For detecting changes in SurfaceView layout, we take a shortcut here and + // override gatherTransparentRegion, instead of registering a layout listener, + // which is more expensive. + if (mSurfaceWrapper != null) { + mDisplay.onGlobalLayout(); + } + return super.gatherTransparentRegion(region); + } + + @Override + public void onWindowFocusChanged(final boolean hasWindowFocus) { + super.onWindowFocusChanged(hasWindowFocus); + + // Only call setFocus(true) when the window gains focus. Any focus loss could be temporary + // (e.g. due to auto-fill popups) and we don't want to call setFocus(false) in those cases. + // Instead, we call setFocus(false) in onWindowVisibilityChanged. + if (mSession != null && hasWindowFocus && isFocused()) { + mSession.setFocused(true); + } + } + + @Override + protected void onWindowVisibilityChanged(final int visibility) { + super.onWindowVisibilityChanged(visibility); + + // We can be reasonably sure that the focus loss is not temporary, so call setFocus(false). + if (mSession != null && visibility != View.VISIBLE && !hasWindowFocus()) { + mSession.setFocused(false); + } + } + + @Override + protected void onFocusChanged(final boolean gainFocus, final int direction, + final Rect previouslyFocusedRect) { + super.onFocusChanged(gainFocus, direction, previouslyFocusedRect); + + if (mIsResettingFocus) { + return; + } + + if (mSession != null) { + mSession.setFocused(gainFocus); + } + + if (!gainFocus) { + return; + } + + post(new Runnable() { + @Override + public void run() { + if (!isFocused()) { + return; + } + + final InputMethodManager imm = InputMethods.getInputMethodManager(getContext()); + // Bug 1404111: Through View#onFocusChanged, the InputMethodManager queues + // up a checkFocus call for the next spin of the message loop, so by + // posting this Runnable after super#onFocusChanged, the IMM should have + // completed its focus change handling at this point and we should be the + // active view for input handling. + + // If however onViewDetachedFromWindow for the previously active view gets + // called *after* onFocusChanged, but *before* the focus change has been + // fully processed by the IMM with the help of checkFocus, the IMM will + // lose track of the currently active view, which means that we can't + // interact with the IME. + if (!imm.isActive(extendedGeckoView.this)) { + // If that happens, we bring the IMM's internal state back into sync + // by clearing and resetting our focus. + mIsResettingFocus = true; + clearFocus(); + // After calling clearFocus we might regain focus automatically, but + // we explicitly request it again in case this doesn't happen. If + // we've already got the focus back, this will then be a no-op anyway. + requestFocus(); + mIsResettingFocus = false; + } + } + }); + } + + @Override + public Handler getHandler() { + if (Build.VERSION.SDK_INT >= 24 || mSession == null) { + return super.getHandler(); + } + return mSession.getTextInput().getHandler(super.getHandler()); + } + + @Override + public InputConnection onCreateInputConnection(final EditorInfo outAttrs) { + if (mSession == null) { + return null; + } + return mSession.getTextInput().onCreateInputConnection(outAttrs); + } + + @Override + public boolean onKeyPreIme(final int keyCode, final KeyEvent event) { + if (super.onKeyPreIme(keyCode, event)) { + return true; + } + return mSession != null && + mSession.getTextInput().onKeyPreIme(keyCode, event); + } + + @Override + public boolean onKeyUp(final int keyCode, final KeyEvent event) { + if (super.onKeyUp(keyCode, event)) { + return true; + } + return mSession != null && + mSession.getTextInput().onKeyUp(keyCode, event); + } + + @Override + public boolean onKeyDown(final int keyCode, final KeyEvent event) { + if (super.onKeyDown(keyCode, event)) { + return true; + } + return mSession != null && + mSession.getTextInput().onKeyDown(keyCode, event); + } + + @Override + public boolean onKeyLongPress(final int keyCode, final KeyEvent event) { + if (super.onKeyLongPress(keyCode, event)) { + return true; + } + return mSession != null && + mSession.getTextInput().onKeyLongPress(keyCode, event); + } + + @Override + public boolean onKeyMultiple(final int keyCode, final int repeatCount, final KeyEvent event) { + if (super.onKeyMultiple(keyCode, repeatCount, event)) { + return true; + } + return mSession != null && + mSession.getTextInput().onKeyMultiple(keyCode, repeatCount, event); + } + + @Override + public void dispatchDraw(final Canvas canvas) { + super.dispatchDraw(canvas); + + if (mSession != null) { + mSession.getOverscrollEdgeEffect().draw(canvas); + } + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public boolean onTouchEvent(final MotionEvent event) { + if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { + requestFocus(); + } + + if (mSession == null) { + return false; + } + + mSession.getPanZoomController().onTouchEvent(event); + return true; + } + + /** + * Dispatches a {@link MotionEvent} to the {@link PanZoomController}. This is the same as + * indicating how the event was handled. + * + * NOTE: It is highly recommended to only call this with ACTION_DOWN or in otherwise + * limited capacity. Returning a GeckoResult for every touch event will generate + * a lot of allocations and unnecessary GC pressure. + * + * @param event A {@link MotionEvent} + * @return One of the {@link PanZoomController#INPUT_RESULT_UNHANDLED INPUT_RESULT_*}) indicating how the event was handled. + */ + public @NonNull GeckoResult onTouchEventForResult(final @NonNull MotionEvent event) { + if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { + requestFocus(); + } + + if (mSession == null) { + return GeckoResult.fromValue(PanZoomController.INPUT_RESULT_UNHANDLED); + } + + // NOTE: Treat mouse events as "touch" rather than as "mouse", so mouse can be + // used to pan/zoom. Call onMouseEvent() instead for behavior similar to desktop. + return mSession.getPanZoomController().onTouchEventForResult(event); + } + + @Override + public boolean onGenericMotionEvent(final MotionEvent event) { + if (AndroidGamepadManager.handleMotionEvent(event)) { + return true; + } + + if (mSession == null) { + return true; + } + + if (mSession.getAccessibility().onMotionEvent(event)) { + return true; + } + + mSession.getPanZoomController().onMotionEvent(event); + return true; + } + + @Override + public void onProvideAutofillVirtualStructure(final ViewStructure structure, + final int flags) { + super.onProvideAutofillVirtualStructure(structure, flags); + + if (mSession == null) { + return; + } + + final Autofill.Session autofillSession = mSession.getAutofillSession(); + autofillSession.fillViewStructure(this, structure, flags); + } + + @Override + @TargetApi(26) + public void autofill(@NonNull final SparseArray values) { + super.autofill(values); + + if (mSession == null) { + return; + } + final SparseArray strValues = new SparseArray<>(values.size()); + for (int i = 0; i < values.size(); i++) { + final AutofillValue value = values.valueAt(i); + if (value.isText()) { + // Only text is currently supported. + strValues.put(values.keyAt(i), value.getTextValue()); + } + } + mSession.autofill(strValues); + } + + /** + * Request a {@link Bitmap} of the visible portion of the web page currently being + * rendered. + * + * See {@link GeckoDisplay#capturePixels} for more details. + * + * @return A {@link GeckoResult} that completes with a {@link Bitmap} containing + * the pixels and size information of the currently visible rendered web page. + */ + @UiThread + public @NonNull GeckoResult capturePixels() { + return mDisplay.capturePixels(); + } + + /** + * Sets whether or not this View participates in Android autofill. + * + * When enabled, this will set an {@link Autofill.Delegate} on the + * {@link GeckoSession} for this instance. + * + * @param enabled Whether or not Android autofill is enabled for this view. + */ + @TargetApi(26) + public void setAutofillEnabled(final boolean enabled) { + mAutofillEnabled = enabled; + + if (mSession != null) { + if (!enabled && mSession.getAutofillDelegate() == mAutofillDelegate) { + mSession.setAutofillDelegate(null); + } else if (enabled) { + mSession.setAutofillDelegate(mAutofillDelegate); + } + } + } + + /** + * @return Whether or not Android autofill is enabled for this view. + */ + @TargetApi(26) + public boolean getAutofillEnabled() { + return mAutofillEnabled; + } + + private class AndroidAutofillDelegate implements Autofill.Delegate { + + private Rect displayRectForId(@NonNull final GeckoSession session, + @NonNull final Autofill.Node node) { + if (node == null) { + return new Rect(0, 0, 0, 0); + } + + final Matrix matrix = new Matrix(); + final RectF rectF = new RectF(node.getDimensions()); + session.getPageToScreenMatrix(matrix); + matrix.mapRect(rectF); + + final Rect screenRect = new Rect(); + rectF.roundOut(screenRect); + return screenRect; + } + + @Override + public void onAutofill(@NonNull final GeckoSession session, + final int notification, + final Autofill.Node node) { + ThreadUtils.assertOnUiThread(); + if (Build.VERSION.SDK_INT < 26) { + return; + } + + final AutofillManager manager = + extendedGeckoView.this.getContext().getSystemService(AutofillManager.class); + if (manager == null) { + return; + } + + switch (notification) { + case Autofill.Notify.SESSION_STARTED: + // This line seems necessary for auto-fill to work on the initial page. + case Autofill.Notify.SESSION_CANCELED: + manager.cancel(); + break; + case Autofill.Notify.SESSION_COMMITTED: + manager.commit(); + break; + case Autofill.Notify.NODE_FOCUSED: + manager.notifyViewEntered( + extendedGeckoView.this, node.getId(), + displayRectForId(session, node)); + break; + case Autofill.Notify.NODE_BLURRED: + manager.notifyViewExited(extendedGeckoView.this, node.getId()); + break; + case Autofill.Notify.NODE_UPDATED: + manager.notifyValueChanged( + extendedGeckoView.this, + node.getId(), + AutofillValue.forText(node.getValue())); + break; + } + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java index e0c60410..0f4f4389 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java @@ -1,490 +1,490 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; - -import android.annotation.SuppressLint; -import android.content.Intent; -import android.net.Uri; -import android.os.Handler; -import android.util.Log; -import android.widget.ImageView; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.BrowserIconManager; -import com.darkweb.genesissearchengine.constants.*; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; - -import java.io.File; -import java.util.List; - -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; -import static com.darkweb.genesissearchengine.constants.constants.CONST_REPORT_URL; -import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent; -import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; -import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS; -import static org.mozilla.geckoview.StorageController.ClearFlags.COOKIES; -import static org.mozilla.geckoview.StorageController.ClearFlags.DOM_STORAGES; -import static org.mozilla.geckoview.StorageController.ClearFlags.IMAGE_CACHE; -import static org.mozilla.geckoview.StorageController.ClearFlags.NETWORK_CACHE; -import static org.mozilla.geckoview.StorageController.ClearFlags.PERMISSIONS; -import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_DATA; -import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_SETTINGS; -import org.mozilla.geckoview.ContentBlocking; -import org.mozilla.geckoview.GeckoRuntime; -import org.mozilla.geckoview.GeckoView; -import org.mozilla.geckoview.WebResponse; - -public class geckoClients -{ - /*Gecko Variables*/ - - private geckoSession mSession = null; - private GeckoRuntime mRuntime = null; - private BrowserIconManager mIconManager; - private eventObserver.eventListener event; - - /*Local Variable*/ - - private String mSessionID; - - public void initialize(GeckoView geckoView, eventObserver.eventListener event, AppCompatActivity context, boolean isForced) - { - this.event = event; - mSessionID = helperMethod.createRandomID(); - initRuntimeSettings(context); - - if(!isForced && geckoView.getSession()!=null && geckoView.getSession().isOpen()){ - mSession = (geckoSession) geckoView.getSession(); - } - else { - geckoView.releaseSession(); - mSession = new geckoSession(new geckoViewClientCallback(),mSessionID,context, geckoView); - mSession.open(mRuntime); - mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); - mSession.getSettings().setFullAccessibilityTree(true); - mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); - mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); - geckoView.releaseSession(); - geckoView.setSession(mSession); - } - mSession.onSetInitializeFromStartup(); - onUpdateFont(); - } - - public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ - boolean mStatus = mSession.onValidateInitializeFromStartup(); - if(mStatus){ - boolean mState = mSession.onRestoreState(); - if(!mState){ - new Handler().postDelayed(() -> - { - mSession.stop(); - mSession.loadUri(mSession.getCurrentURL()); - }, 500); - }else { - String mURL = mSession.getCurrentURL(); - if(mURL.equals("https://genesishiddentechnologies.com") || mURL.startsWith(CONST_GENESIS_URL_CACHED) || mURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ - if(!mSession.canGoBack()){ - mNestedGeckoView.releaseSession(); - mSession.close(); - mSession.open(mRuntime); - mNestedGeckoView.setSession(mSession); - }else { - mSession.goBack(); - } - loadURL("genesishiddentechnologies.com", mNestedGeckoView, pcontext); - } - } - } - } - - public geckoSession initFreeSession(GeckoView pGeckoView, AppCompatActivity pcontext, eventObserver.eventListener event){ - this.event = event; - initRuntimeSettings(pcontext); - geckoSession mTempSession = new geckoSession(new geckoViewClientCallback(),mSessionID,pcontext, pGeckoView); - mTempSession.open(mRuntime); - mTempSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); - mTempSession.getSettings().setFullAccessibilityTree(true); - mTempSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); - mTempSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); - return mTempSession; - } - - public void onDestroy(){ - mSession.onDestroy(); - mSession = null; - mRuntime = null; - mIconManager = null; - event = null; - } - - public GeckoRuntime getmRuntime(){ - return mRuntime; - } - - public void onSessionReinit(){ - mSession.onSessionReinit(); - } - - public void toogleUserAgent(){ - mSession.toogleUserAgent(); - } - - public int getUserAgent(){ - return mSession.getUserAgentMode(); - } - - @SuppressLint("WrongConstant") - public void initRuntimeSettings(AppCompatActivity context){ - if(mRuntime==null){ - mRuntime = GeckoRuntime.getDefault(context.getApplicationContext()); - mRuntime.getSettings().setAboutConfigEnabled(true); - mRuntime.getSettings().setAutomaticFontSizeAdjustment(false); - mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts); - mRuntime.getSettings().setForceUserScalableEnabled(status.sSettingEnableZoom); - mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour()); - mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT); - mIconManager = new BrowserIconManager(); - - if(status.sSettingTrackingProtection == 1){ - mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.DEFAULT); - }else if(status.sSettingTrackingProtection == 2){ - mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT); - } - } - } - - public void onGetFavIcon(ImageView pImageView, String pURL, AppCompatActivity pcontext){ - pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL)); - mIconManager.onLoadIconIntoView(pcontext,mRuntime, pImageView, pURL); - } - - public void onLoadFavIcon(AppCompatActivity pcontext){ - BrowserIconManager mIconManager = new BrowserIconManager(); - mIconManager.onLoadIcon(pcontext.getApplicationContext(), mRuntime); - } - - private int getCookiesBehaviour(){ - return status.sSettingCookieStatus; - } - - @SuppressLint("WrongConstant") - public void updateSetting(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ - mRuntime.getSettings().setRemoteDebuggingEnabled(false); - mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts); - mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour()); - mRuntime.getSettings().setAutomaticFontSizeAdjustment(false); - mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT); - mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts); - mRuntime.getSettings().setForceUserScalableEnabled(status.sSettingEnableZoom); - mIconManager = new BrowserIconManager(); - - if(status.sSettingTrackingProtection == 1){ - mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.DEFAULT); - }else if(status.sSettingTrackingProtection == 2){ - mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT); - } - - mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); - mSession.getSettings().setFullAccessibilityTree(true); - mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE ); - mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); - onUpdateFont(); - onReload(mNestedGeckoView, pcontext); - } - - public void resetSession(){ - mSessionID = strings.GENERIC_EMPTY_STR; - } - - public String getTheme(){ - if(mSessionID.equals(strings.GENERIC_EMPTY_STR)){ - return null; - }else { - return mSession.getTheme(); - } - } - - public void initSession(geckoSession mSession){ - mSessionID = mSession.getSessionID(); - this.mSession = mSession; - } - - public geckoSession getSession(){ - return mSession; - } - - public void onUploadRequest(int resultCode,Intent data){ - mSession.onFileUploadRequest(resultCode,data); - } - public void setLoading(boolean status){ - mSession.setLoading(status); - } - - - public void initURL(String url) { - mSession.initURL(url); - } - - public void loadURL(String url, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext) { - mSession = (geckoSession)mNestedGeckoView.getSession(); - if(mSession==null){ - return; - } - if(mSession.onGetInitializeFromStartup()){ - mSession.initURL(url); - if(!url.startsWith(CONST_REPORT_URL) && (url.startsWith("https://genesishiddentechnologies.com/?pG") || url.startsWith("https://genesishiddentechnologies.com?pG") || url.endsWith("genesishiddentechnologies.com") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED))){ - try{ - mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL); - if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){ - String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); - mSession.getSettings().setAllowJavascript(true); - mSession.initURL(mURL); - mSession.loadUri(mURL); - }else { - String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); - mSession.getSettings().setAllowJavascript(true); - mSession.loadUri(mURL); - } - }catch (Exception ex){ - ex.printStackTrace(); - } - }else if(url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)){ - try{ - mSession.initURL(constants.CONST_GENESIS_HELP_URL); - - if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){ - mSession.getSettings().setAllowJavascript(true); - mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE); - }else { - mSession.getSettings().setAllowJavascript(true); - mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); - } - }catch (Exception ex){ - ex.printStackTrace(); - } - }else { - mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); - mSession.loadUri(url); - } - } - } - - public void onRedrawPixel(AppCompatActivity pcontext){ - mSession.onRedrawPixel(); - onLoadFavIcon(pcontext); - } - - public boolean isLoaded(){ - return mSession.isLoaded(); - } - - public void onClearSiteData(){ - mRuntime.getStorageController().clearData(SITE_SETTINGS); - mRuntime.getStorageController().clearData(SITE_DATA); - } - - public void onClearSession(){ - mRuntime.getStorageController().clearData(AUTH_SESSIONS); - mRuntime.getStorageController().clearData(PERMISSIONS); - } - - public void onClearCache(){ - mRuntime.getStorageController().clearData(NETWORK_CACHE); - mRuntime.getStorageController().clearData(IMAGE_CACHE); - mRuntime.getStorageController().clearData(DOM_STORAGES); - } - - public void onClearCookies(){ - mRuntime.getStorageController().clearData(COOKIES); - } - - public void onBackPressed(boolean isFinishAllowed, int mTabSize, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ - if(mSession.canGoBack()){ - mSession.goBackSession(); - mSession.onUpdateBannerAdvert(); - } - else if(isFinishAllowed){ - if(mSession.getRemovableFromBackPressed() && mTabSize>1){ - event.invokeObserver(null, enums.etype.M_CLOSE_TAB); - }else { - event.invokeObserver(null, enums.etype.back_list_empty); - } - } - } - - public boolean wasPreviousErrorPage(){ - return mSession.wasPreviousErrorPage(); - } - - public boolean canGoForward(){ - return mSession.canGoForward(); - } - - public boolean isLoading(){ - return mSession.isLoading(); - } - - public Uri getUriPermission(){ - return mSession.getUriPermission(); - } - - public boolean getFullScreenStatus(){ - return mSession.getFullScreenStatus(); - } - - public void onExitFullScreen(){ - mSession.exitScreen(); - } - - public void onForwardPressed(){ - if(mSession.canGoForward()){ - mSession.goForwardSession(); - } - } - - public void onClose(){ - mSession.onClose(); - } - - public void setRemovableFromBackPressed(boolean pStatus){ - mSession.setRemovableFromBackPressed(pStatus); - } - - - public void onStop(){ - mSession.stop(); - } - - public void onReload(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ - mSession.stop(); - String url = mSession.getCurrentURL(); - if(url.startsWith("https://genesishiddentechnologies.com/?pG") || url.startsWith("https://genesishiddentechnologies.com?pG") || url.endsWith("genesishiddentechnologies.com") || url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)){ - loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); - }else{ - mSession.reload(); - } - } - - public void onReloadStatic(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ - ///mSession.stop(); - loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); - } - - public void manual_download(String url, AppCompatActivity context){ - Uri downloadURL = Uri.parse(url); - File f = new File(url); - f.getName(); - String downloadFile = f.getName(); - - /*EXTERNAL STORAGE REQUEST*/ - if(helperMethod.checkPermissions(context)){ - mSession.downloadRequestedFile(downloadURL,downloadFile); - } - } - - public void manualDownloadWithName(String url, String file, AppCompatActivity context){ - Uri downloadURL = Uri.parse(url); - /*EXTERNAL STORAGE REQUEST*/ - if(helperMethod.checkPermissions(context)){ - mSession.downloadRequestedFile(downloadURL,file); - } - } - - public void downloadFile(AppCompatActivity pcontext) - { - if(helperMethod.checkPermissions(pcontext)){ - mSession.downloadRequestedFile(); - } - } - - public void downloadFile(String mURL, AppCompatActivity pcontext) - { - if(helperMethod.checkPermissions(pcontext)){ - mSession.downloadRequestedFile(); - } - } - - /*Session Updates*/ - - public void onUpdateFont(){ - float font = (status.sSettingFontSize -100)/3+100; - mRuntime.getSettings().setFontSizeFactor(font/100); - } - - public void reinitHomeTheme(){ - String mURLFinal; - mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL); - if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(activityContextManager.getInstance().getHomeController())){ - String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); - mSession.getSettings().setAllowJavascript(true); - mSession.initURL(mURL); - mURLFinal = mURL; - }else { - String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); - mSession.getSettings().setAllowJavascript(true); - mSession.initURL(mURL); - mURLFinal = mURL; - } - - if(!mSession.canGoBack()){ - activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession(); - mSession.close(); - mSession.open(mRuntime); - activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession); - }else { - mSession.goBack(); - } - - new Handler().postDelayed(() -> - { - if(!mSession.canGoBack()){ - mSession.close(); - activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession(); - mSession.open(mRuntime); - activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession); - } - - mSession.loadUri(mURLFinal); - - }, 10); - - } - - public class geckoViewClientCallback implements eventObserver.eventListener{ - @Override - public Object invokeObserver(List data, Object e_type) - { - if(e_type.equals(enums.etype.M_CHANGE_HOME_THEME)){ - reinitHomeTheme(); - } - else if(mSession!=null && mSession.isClosed()){ - return null; - }else if(mSession!=null) { - if(e_type.equals(enums.etype.SESSION_ID)){ - return mSession.getSessionID(); - } - else if (mSessionID!=null && mSessionID.equals(data.get(1)) || e_type.equals(enums.etype.M_RATE_COUNT) || e_type.equals(enums.etype.FINDER_RESULT_CALLBACK) || e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE) || e_type.equals(enums.etype.on_update_favicon) ||e_type.equals(enums.etype.on_update_history) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url)) - { - if (e_type.equals(on_handle_external_intent)) - { - try { - WebResponse responseInfo = (WebResponse)data.get(0); - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.headers.get("Content-Type")); - activityContextManager.getInstance().getHomeController().startActivity(intent); - }catch (Exception ex){ - Log.i("ex","ex"); - } - } else - { - return event.invokeObserver(data, e_type); - } - } - } - return null; - } - } -} +package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; + +import android.annotation.SuppressLint; +import android.content.Intent; +import android.net.Uri; +import android.os.Handler; +import android.util.Log; +import android.widget.ImageView; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.BrowserIconManager; +import com.darkweb.genesissearchengine.constants.*; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + +import java.io.File; +import java.util.List; + +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; +import static com.darkweb.genesissearchengine.constants.constants.CONST_REPORT_URL; +import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent; +import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; +import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS; +import static org.mozilla.geckoview.StorageController.ClearFlags.COOKIES; +import static org.mozilla.geckoview.StorageController.ClearFlags.DOM_STORAGES; +import static org.mozilla.geckoview.StorageController.ClearFlags.IMAGE_CACHE; +import static org.mozilla.geckoview.StorageController.ClearFlags.NETWORK_CACHE; +import static org.mozilla.geckoview.StorageController.ClearFlags.PERMISSIONS; +import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_DATA; +import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_SETTINGS; +import org.mozilla.geckoview.ContentBlocking; +import org.mozilla.geckoview.GeckoRuntime; +import org.mozilla.geckoview.GeckoView; +import org.mozilla.geckoview.WebResponse; + +public class geckoClients +{ + /*Gecko Variables*/ + + private geckoSession mSession = null; + private GeckoRuntime mRuntime = null; + private BrowserIconManager mIconManager; + private eventObserver.eventListener event; + + /*Local Variable*/ + + private String mSessionID; + + public void initialize(GeckoView geckoView, eventObserver.eventListener event, AppCompatActivity context, boolean isForced) + { + this.event = event; + mSessionID = helperMethod.createRandomID(); + initRuntimeSettings(context); + + if(!isForced && geckoView.getSession()!=null && geckoView.getSession().isOpen()){ + mSession = (geckoSession) geckoView.getSession(); + } + else { + geckoView.releaseSession(); + mSession = new geckoSession(new geckoViewClientCallback(),mSessionID,context, geckoView); + mSession.open(mRuntime); + mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); + mSession.getSettings().setFullAccessibilityTree(true); + mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); + mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); + geckoView.setSession(mSession); + } + mSession.onSetInitializeFromStartup(); + onUpdateFont(); + } + + public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ + boolean mStatus = mSession.onValidateInitializeFromStartup(); + if(mStatus){ + boolean mState = mSession.onRestoreState(); + if(!mState){ + new Handler().postDelayed(() -> + { + mSession.stop(); + mSession.loadUri(mSession.getCurrentURL()); + }, 500); + }else { + String mURL = mSession.getCurrentURL(); + if(mURL.equals("https://genesishiddentechnologies.com") || mURL.startsWith(CONST_GENESIS_URL_CACHED) || mURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ + if(!mSession.canGoBack()){ + mNestedGeckoView.releaseSession(); + mSession.close(); + mSession.open(mRuntime); + mNestedGeckoView.setSession(mSession); + }else { + mSession.goBack(); + } + loadURL("genesishiddentechnologies.com", mNestedGeckoView, pcontext); + } + } + } + } + + public geckoSession initFreeSession(GeckoView pGeckoView, AppCompatActivity pcontext, eventObserver.eventListener event){ + this.event = event; + initRuntimeSettings(pcontext); + geckoSession mTempSession = new geckoSession(new geckoViewClientCallback(),mSessionID,pcontext, pGeckoView); + mTempSession.open(mRuntime); + mTempSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); + mTempSession.getSettings().setFullAccessibilityTree(true); + mTempSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); + mTempSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); + return mTempSession; + } + + public void onDestroy(){ + mSession.onDestroy(); + mSession = null; + mRuntime = null; + mIconManager = null; + event = null; + } + + public GeckoRuntime getmRuntime(){ + return mRuntime; + } + + public void onSessionReinit(){ + mSession.onSessionReinit(); + } + + public void toogleUserAgent(){ + mSession.toogleUserAgent(); + } + + public int getUserAgent(){ + return mSession.getUserAgentMode(); + } + + @SuppressLint("WrongConstant") + public void initRuntimeSettings(AppCompatActivity context){ + if(mRuntime==null){ + mRuntime = GeckoRuntime.getDefault(context.getApplicationContext()); + mRuntime.getSettings().setAboutConfigEnabled(true); + mRuntime.getSettings().setAboutConfigEnabled(true); + mRuntime.getSettings().setAutomaticFontSizeAdjustment(false); + mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts); + mRuntime.getSettings().setForceUserScalableEnabled(status.sSettingEnableZoom); + mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour()); + mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT); + mIconManager = new BrowserIconManager(); + + if(status.sSettingTrackingProtection == 1){ + mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.DEFAULT); + }else if(status.sSettingTrackingProtection == 2){ + mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT); + } + } + } + + public void onGetFavIcon(ImageView pImageView, String pURL, AppCompatActivity pcontext){ + pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL)); + mIconManager.onLoadIconIntoView(pcontext,mRuntime, pImageView, pURL); + } + + public void onLoadFavIcon(AppCompatActivity pcontext){ + BrowserIconManager mIconManager = new BrowserIconManager(); + mIconManager.onLoadIcon(pcontext.getApplicationContext(), mRuntime); + } + + private int getCookiesBehaviour(){ + return status.sSettingCookieStatus; + } + + @SuppressLint("WrongConstant") + public void updateSetting(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ + mRuntime.getSettings().setRemoteDebuggingEnabled(false); + mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts); + mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour()); + mRuntime.getSettings().setAutomaticFontSizeAdjustment(false); + mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT); + mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts); + mRuntime.getSettings().setForceUserScalableEnabled(status.sSettingEnableZoom); + mIconManager = new BrowserIconManager(); + + if(status.sSettingTrackingProtection == 1){ + mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.DEFAULT); + }else if(status.sSettingTrackingProtection == 2){ + mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT); + } + + mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); + mSession.getSettings().setFullAccessibilityTree(true); + mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE ); + mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); + onUpdateFont(); + onReload(mNestedGeckoView, pcontext); + } + + public void resetSession(){ + mSessionID = strings.GENERIC_EMPTY_STR; + } + + public String getTheme(){ + if(mSessionID.equals(strings.GENERIC_EMPTY_STR)){ + return null; + }else { + return mSession.getTheme(); + } + } + + public void initSession(geckoSession mSession){ + mSessionID = mSession.getSessionID(); + this.mSession = mSession; + } + + public geckoSession getSession(){ + return mSession; + } + + public void onUploadRequest(int resultCode,Intent data){ + mSession.onFileUploadRequest(resultCode,data); + } + public void setLoading(boolean status){ + mSession.setLoading(status); + } + + + public void initURL(String url) { + mSession.initURL(url); + } + + public void loadURL(String url, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext) { + mSession = (geckoSession)mNestedGeckoView.getSession(); + if(mSession==null){ + return; + } + if(mSession.onGetInitializeFromStartup()){ + mSession.initURL(url); + if(!url.startsWith(CONST_REPORT_URL) && (url.startsWith("https://genesishiddentechnologies.com/?pG") || url.startsWith("https://genesishiddentechnologies.com?pG") || url.endsWith("genesishiddentechnologies.com") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED))){ + try{ + mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL); + if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){ + String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); + mSession.getSettings().setAllowJavascript(true); + mSession.initURL(mURL); + mSession.loadUri(mURL); + }else { + String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); + mSession.getSettings().setAllowJavascript(true); + mSession.loadUri(mURL); + } + }catch (Exception ex){ + ex.printStackTrace(); + } + }else if(url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)){ + try{ + mSession.initURL(constants.CONST_GENESIS_HELP_URL); + + if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){ + mSession.getSettings().setAllowJavascript(true); + mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE); + }else { + mSession.getSettings().setAllowJavascript(true); + mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); + } + }catch (Exception ex){ + ex.printStackTrace(); + } + }else { + mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); + mSession.loadUri(url); + } + } + } + + public void onRedrawPixel(AppCompatActivity pcontext){ + mSession.onRedrawPixel(); + onLoadFavIcon(pcontext); + } + + public boolean isLoaded(){ + return mSession.isLoaded(); + } + + public void onClearSiteData(){ + mRuntime.getStorageController().clearData(SITE_SETTINGS); + mRuntime.getStorageController().clearData(SITE_DATA); + } + + public void onClearSession(){ + mRuntime.getStorageController().clearData(AUTH_SESSIONS); + mRuntime.getStorageController().clearData(PERMISSIONS); + } + + public void onClearCache(){ + mRuntime.getStorageController().clearData(NETWORK_CACHE); + mRuntime.getStorageController().clearData(IMAGE_CACHE); + mRuntime.getStorageController().clearData(DOM_STORAGES); + } + + public void onClearCookies(){ + mRuntime.getStorageController().clearData(COOKIES); + } + + public void onBackPressed(boolean isFinishAllowed, int mTabSize, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ + if(mSession.canGoBack()){ + mSession.goBackSession(); + mSession.onUpdateBannerAdvert(); + } + else if(isFinishAllowed){ + if(mSession.getRemovableFromBackPressed() && mTabSize>1){ + event.invokeObserver(null, enums.etype.M_CLOSE_TAB); + }else { + event.invokeObserver(null, enums.etype.back_list_empty); + } + } + } + + public boolean wasPreviousErrorPage(){ + return mSession.wasPreviousErrorPage(); + } + + public boolean canGoForward(){ + return mSession.canGoForward(); + } + + public boolean isLoading(){ + return mSession.isLoading(); + } + + public Uri getUriPermission(){ + return mSession.getUriPermission(); + } + + public boolean getFullScreenStatus(){ + return mSession.getFullScreenStatus(); + } + + public void onExitFullScreen(){ + mSession.exitScreen(); + } + + public void onForwardPressed(){ + if(mSession.canGoForward()){ + mSession.goForwardSession(); + } + } + + public void onClose(){ + mSession.onClose(); + } + + public void setRemovableFromBackPressed(boolean pStatus){ + mSession.setRemovableFromBackPressed(pStatus); + } + + + public void onStop(){ + mSession.stop(); + } + + public void onReload(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ + mSession.stop(); + String url = mSession.getCurrentURL(); + if(url.startsWith("https://genesishiddentechnologies.com/?pG") || url.startsWith("https://genesishiddentechnologies.com?pG") || url.endsWith("genesishiddentechnologies.com") || url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)){ + loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); + }else{ + mSession.reload(); + } + } + + public void onReloadStatic(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ + ///mSession.stop(); + loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); + } + + public void manual_download(String url, AppCompatActivity context){ + Uri downloadURL = Uri.parse(url); + File f = new File(url); + f.getName(); + String downloadFile = f.getName(); + + /*EXTERNAL STORAGE REQUEST*/ + if(helperMethod.checkPermissions(context)){ + mSession.downloadRequestedFile(downloadURL,downloadFile); + } + } + + public void manualDownloadWithName(String url, String file, AppCompatActivity context){ + Uri downloadURL = Uri.parse(url); + /*EXTERNAL STORAGE REQUEST*/ + if(helperMethod.checkPermissions(context)){ + mSession.downloadRequestedFile(downloadURL,file); + } + } + + public void downloadFile(AppCompatActivity pcontext) + { + if(helperMethod.checkPermissions(pcontext)){ + mSession.downloadRequestedFile(); + } + } + + public void downloadFile(String mURL, AppCompatActivity pcontext) + { + if(helperMethod.checkPermissions(pcontext)){ + mSession.downloadRequestedFile(); + } + } + + /*Session Updates*/ + + public void onUpdateFont(){ + float font = (status.sSettingFontSize -100)/3+100; + mRuntime.getSettings().setFontSizeFactor(font/100); + } + + public void reinitHomeTheme(){ + String mURLFinal; + mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL); + if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(activityContextManager.getInstance().getHomeController())){ + String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); + mSession.getSettings().setAllowJavascript(true); + mSession.initURL(mURL); + mURLFinal = mURL; + }else { + String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); + mSession.getSettings().setAllowJavascript(true); + mSession.initURL(mURL); + mURLFinal = mURL; + } + + if(!mSession.canGoBack()){ + activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession(); + mSession.close(); + mSession.open(mRuntime); + activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession); + }else { + mSession.goBack(); + } + + new Handler().postDelayed(() -> + { + if(!mSession.canGoBack()){ + mSession.close(); + activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession(); + mSession.open(mRuntime); + activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession); + } + + mSession.loadUri(mURLFinal); + + }, 10); + + } + + public class geckoViewClientCallback implements eventObserver.eventListener{ + @Override + public Object invokeObserver(List data, Object e_type) + { + if(e_type.equals(enums.etype.M_CHANGE_HOME_THEME)){ + reinitHomeTheme(); + } + else if(mSession!=null && mSession.isClosed()){ + return null; + }else if(mSession!=null) { + if(e_type.equals(enums.etype.SESSION_ID)){ + return mSession.getSessionID(); + } + else if (mSessionID!=null && mSessionID.equals(data.get(1)) || e_type.equals(enums.etype.M_RATE_COUNT) || e_type.equals(enums.etype.FINDER_RESULT_CALLBACK) || e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE) || e_type.equals(enums.etype.on_update_favicon) ||e_type.equals(enums.etype.on_update_history) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url)) + { + if (e_type.equals(on_handle_external_intent)) + { + try { + WebResponse responseInfo = (WebResponse)data.get(0); + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.headers.get("Content-Type")); + activityContextManager.getInstance().getHomeController().startActivity(intent); + }catch (Exception ex){ + Log.i("ex","ex"); + } + } else + { + return event.invokeObserver(data, e_type); + } + } + } + return null; + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java index bfb4cdbb..e1dceb35 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java @@ -1,69 +1,69 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; - -import android.Manifest; -import android.content.pm.PackageManager; -import android.net.Uri; -import android.util.Log; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.ActivityCompat; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; - -import org.mozilla.geckoview.WebResponse; - -import java.util.Arrays; - -import mozilla.components.support.utils.DownloadUtils; - -class geckoDownloadManager -{ - private Uri downloadURL; - private String downloadFile = strings.GENERIC_EMPTY_STR; - - geckoDownloadManager(){ - - } - - void downloadFile(WebResponse response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) { - session - .getUserAgent() - .accept(userAgent -> downloadFile(response, userAgent,context,session,event), - exception -> { - throw new IllegalStateException("Could not get UserAgent string."); - }); - } - - private void downloadFile(WebResponse response, String userAgent, AppCompatActivity context, geckoSession session, eventObserver.eventListener event) { - if (ContextCompat.checkSelfPermission(context, - Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { - ActivityCompat.requestPermissions(context, - new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, - 3); - return; - } - - try{ - String mFileName = DownloadUtils.guessFileName(response.headers.get("Content-Disposition"),"",response.uri,null); - downloadURL = Uri.parse(response.uri); - downloadFile = mFileName; - }catch (Exception ex){ - ex.printStackTrace(); - Log.i("sadsad",ex.getMessage()); - } - - event.invokeObserver(Arrays.asList(0,session.getSessionID()), enums.etype.progress_update); - event.invokeObserver(Arrays.asList(downloadFile.toString(),session.getSessionID(),downloadURL.toString()), enums.etype.download_file_popup); - } - - Uri getDownloadURL(){ - return downloadURL; - } - - String getDownloadFile(){ - return downloadFile; - } - -} +package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; + +import android.Manifest; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.util.Log; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.eventObserver; + +import org.mozilla.geckoview.WebResponse; + +import java.util.Arrays; + +import mozilla.components.support.utils.DownloadUtils; + +class geckoDownloadManager +{ + private Uri downloadURL; + private String downloadFile = strings.GENERIC_EMPTY_STR; + + geckoDownloadManager(){ + + } + + void downloadFile(WebResponse response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) { + session + .getUserAgent() + .accept(userAgent -> downloadFile(response, userAgent,context,session,event), + exception -> { + throw new IllegalStateException("Could not get UserAgent string."); + }); + } + + private void downloadFile(WebResponse response, String userAgent, AppCompatActivity context, geckoSession session, eventObserver.eventListener event) { + if (ContextCompat.checkSelfPermission(context, + Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(context, + new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, + 3); + return; + } + + try{ + String mFileName = DownloadUtils.guessFileName(response.headers.get("Content-Disposition"),"",response.uri,null); + downloadURL = Uri.parse(response.uri); + downloadFile = mFileName; + }catch (Exception ex){ + ex.printStackTrace(); + Log.i("sadsad",ex.getMessage()); + } + + event.invokeObserver(Arrays.asList(0,session.getSessionID()), enums.etype.progress_update); + event.invokeObserver(Arrays.asList(downloadFile.toString(),session.getSessionID(),downloadURL.toString()), enums.etype.download_file_popup); + } + + Uri getDownloadURL(){ + return downloadURL; + } + + String getDownloadFile(){ + return downloadFile; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java index 1b315175..69c44ff9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java @@ -1,1008 +1,1008 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; - -import android.annotation.TargetApi; -import android.app.Activity; -import android.app.AlertDialog; -import android.content.ActivityNotFoundException; -import android.content.ClipData; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.res.TypedArray; -import android.graphics.Color; -import android.graphics.PorterDuff; -import android.net.Uri; -import android.os.Build; -import android.text.InputType; -import android.text.format.DateFormat; -import android.util.Log; -import android.view.InflateException; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.CheckedTextView; -import android.widget.DatePicker; -import android.widget.EditText; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.ListView; -import android.widget.ScrollView; -import android.widget.Spinner; -import android.widget.TextView; -import android.widget.TimePicker; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.Locale; -import org.mozilla.geckoview.AllowOrDeny; -import org.mozilla.geckoview.GeckoResult; -import org.mozilla.geckoview.GeckoSession; -import org.mozilla.geckoview.SlowScriptResponse; - -final class geckoPromptView implements GeckoSession.PromptDelegate { - protected static final String LOGTAG = "BasicGeckoViewPrompt"; - - private final AppCompatActivity mActivity; - public int filePickerRequestCode = 1; - private int mFileType; - private GeckoResult mFileResponse; - private FilePrompt mFilePrompt; - - public geckoPromptView(final AppCompatActivity activity) { - mActivity = activity; - } - - @Override - public GeckoResult onAlertPrompt(final GeckoSession session, - final AlertPrompt prompt) { - final Activity activity = mActivity; - if (activity == null) { - return GeckoResult.fromValue(prompt.dismiss()); - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity) - .setTitle(prompt.title) - .setMessage(prompt.message) - .setPositiveButton(android.R.string.ok, /* onClickListener */ null); - GeckoResult res = new GeckoResult(); - createStandardDialog(builder, prompt, res).show(); - return res; - } - - @Override - public GeckoResult onButtonPrompt(final GeckoSession session, - final ButtonPrompt prompt) { - final Activity activity = mActivity; - if (activity == null) { - return GeckoResult.fromValue(prompt.dismiss()); - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity) - .setTitle(prompt.title) - .setMessage(prompt.message); - - GeckoResult res = new GeckoResult(); - - final DialogInterface.OnClickListener listener = - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) { - if (which == DialogInterface.BUTTON_POSITIVE) { - res.complete(prompt.confirm(ButtonPrompt.Type.POSITIVE)); - } else if (which == DialogInterface.BUTTON_NEGATIVE) { - res.complete(prompt.confirm(ButtonPrompt.Type.NEGATIVE)); - } else { - res.complete(prompt.dismiss()); - } - } - }; - - builder.setPositiveButton(android.R.string.ok, listener); - builder.setNegativeButton(android.R.string.cancel, listener); - - createStandardDialog(builder, prompt, res).show(); - return res; - } - - @Override - public GeckoResult onSharePrompt(final GeckoSession session, - final SharePrompt prompt) { - return GeckoResult.fromValue(prompt.dismiss()); - } - - @Nullable - @Override - public GeckoResult onRepostConfirmPrompt(final GeckoSession session, - final RepostConfirmPrompt prompt) { - final Activity activity = mActivity; - if (activity == null) { - return GeckoResult.fromValue(prompt.dismiss()); - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity) - .setTitle("Are you sure?") - .setMessage("To display this page, GeckoViewExample must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."); - - GeckoResult res = new GeckoResult<>(); - - final DialogInterface.OnClickListener listener = (dialog, which) -> { - if (which == DialogInterface.BUTTON_POSITIVE) { - res.complete(prompt.confirm(AllowOrDeny.ALLOW)); - } else if (which == DialogInterface.BUTTON_NEGATIVE) { - res.complete(prompt.confirm(AllowOrDeny.DENY)); - } else { - res.complete(prompt.dismiss()); - } - }; - - builder.setPositiveButton("Resend", listener); - builder.setNegativeButton("Cancel", listener); - - createStandardDialog(builder, prompt, res).show(); - return res; - } - - @Nullable - @Override - public GeckoResult onBeforeUnloadPrompt(final GeckoSession session, - final BeforeUnloadPrompt prompt) { - final Activity activity = mActivity; - if (activity == null) { - return GeckoResult.fromValue(prompt.dismiss()); - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity) - .setTitle("Are you sure?") - .setMessage("This page is asking you to confirm that you want to leave - data you have entered may not be saved"); - - GeckoResult res = new GeckoResult<>(); - - final DialogInterface.OnClickListener listener = (dialog, which) -> { - if (which == DialogInterface.BUTTON_POSITIVE) { - res.complete(prompt.confirm(AllowOrDeny.ALLOW)); - } else if (which == DialogInterface.BUTTON_NEGATIVE) { - res.complete(prompt.confirm(AllowOrDeny.DENY)); - } else { - res.complete(prompt.dismiss()); - } - }; - - builder.setPositiveButton("Leave Page", listener); - builder.setNegativeButton("Stay on Page", listener); - - createStandardDialog(builder, prompt, res).show(); - return res; - } - - private int getViewPadding(final AlertDialog.Builder builder) { - final TypedArray attr = builder.getContext().obtainStyledAttributes( - new int[] { android.R.attr.listPreferredItemPaddingLeft }); - final int padding = attr.getDimensionPixelSize(0, 1); - attr.recycle(); - return padding; - } - - private LinearLayout addStandardLayout(final AlertDialog.Builder builder, - final String title, final String msg) { - final ScrollView scrollView = new ScrollView(builder.getContext()); - final LinearLayout container = new LinearLayout(builder.getContext()); - final int horizontalPadding = getViewPadding(builder); - final int verticalPadding = (msg == null || msg.isEmpty()) ? horizontalPadding : 0; - container.setOrientation(LinearLayout.VERTICAL); - container.setPadding(/* left */ horizontalPadding, /* top */ verticalPadding, - /* right */ horizontalPadding, /* bottom */ verticalPadding); - scrollView.addView(container); - builder.setTitle(title) - .setMessage(msg) - .setView(scrollView); - return container; - } - - private AlertDialog createStandardDialog(final AlertDialog.Builder builder, - final BasePrompt prompt, - final GeckoResult response) { - final AlertDialog dialog = builder.create(); - dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(final DialogInterface dialog) { - if (!prompt.isComplete()) { - response.complete(prompt.dismiss()); - } - } - }); - return dialog; - } - - @Override - public GeckoResult onTextPrompt(final GeckoSession session, - final TextPrompt prompt) { - final Activity activity = mActivity; - if (activity == null) { - return GeckoResult.fromValue(prompt.dismiss()); - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity); - final LinearLayout container = addStandardLayout(builder, prompt.title, prompt.message); - final EditText editText = new EditText(builder.getContext()); - editText.setText(prompt.defaultValue); - container.addView(editText); - - GeckoResult res = new GeckoResult(); - - builder.setNegativeButton(android.R.string.cancel, /* listener */ null) - .setPositiveButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) { - res.complete(prompt.confirm(editText.getText().toString())); - } - }); - - createStandardDialog(builder, prompt, res).show(); - return res; - } - - @Override - public GeckoResult onAuthPrompt(final GeckoSession session, - final AuthPrompt prompt) { - final Activity activity = mActivity; - if (activity == null) { - return GeckoResult.fromValue(prompt.dismiss()); - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity); - final LinearLayout container = addStandardLayout(builder, prompt.title, prompt.message); - - final int flags = prompt.authOptions.flags; - final int level = prompt.authOptions.level; - final EditText username; - if ((flags & AuthPrompt.AuthOptions.Flags.ONLY_PASSWORD) == 0) { - username = new EditText(builder.getContext()); - username.setHint("Username"); - username.setText(prompt.authOptions.username); - container.addView(username); - } else { - username = null; - } - - final EditText password = new EditText(builder.getContext()); - password.setHint("Password"); - password.setText(prompt.authOptions.password); - password.setInputType(InputType.TYPE_CLASS_TEXT | - InputType.TYPE_TEXT_VARIATION_PASSWORD); - container.addView(password); - - if (level != AuthPrompt.AuthOptions.Level.NONE) { - final ImageView secure = new ImageView(builder.getContext()); - secure.setImageResource(android.R.drawable.ic_lock_lock); - container.addView(secure); - } - - GeckoResult res = new GeckoResult(); - - builder.setNegativeButton(android.R.string.cancel, /* listener */ null) - .setPositiveButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) { - if ((flags & AuthPrompt.AuthOptions.Flags.ONLY_PASSWORD) == 0) { - res.complete(prompt.confirm(username.getText().toString(), - password.getText().toString())); - - } else { - res.complete(prompt.confirm(password.getText().toString())); - } - } - }); - createStandardDialog(builder, prompt, res).show(); - - return res; - } - - private static class ModifiableChoice { - public boolean modifiableSelected; - public String modifiableLabel; - public final ChoicePrompt.Choice choice; - - public ModifiableChoice(ChoicePrompt.Choice c) { - choice = c; - modifiableSelected = choice.selected; - modifiableLabel = choice.label; - } - } - - private void addChoiceItems(final int type, final ArrayAdapter list, - final ChoicePrompt.Choice[] items, final String indent) { - if (type == ChoicePrompt.Type.MENU) { - for (final ChoicePrompt.Choice item : items) { - list.add(new ModifiableChoice(item)); - } - return; - } - - for (final ChoicePrompt.Choice item : items) { - final ModifiableChoice modItem = new ModifiableChoice(item); - - final ChoicePrompt.Choice[] children = item.items; - - if (indent != null && children == null) { - modItem.modifiableLabel = indent + modItem.modifiableLabel; - } - list.add(modItem); - - if (children != null) { - final String newIndent; - if (type == ChoicePrompt.Type.SINGLE || type == ChoicePrompt.Type.MULTIPLE) { - newIndent = (indent != null) ? indent + '\t' : "\t"; - } else { - newIndent = null; - } - addChoiceItems(type, list, children, newIndent); - } - } - } - - private void onChoicePromptImpl(final GeckoSession session, final String title, - final String message, final int type, - final ChoicePrompt.Choice[] choices, final ChoicePrompt prompt, - final GeckoResult res) { - final Activity activity = mActivity; - if (activity == null) { - res.complete(prompt.dismiss()); - return; - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity); - addStandardLayout(builder, title, message); - - final ListView list = new ListView(builder.getContext()); - if (type == ChoicePrompt.Type.MULTIPLE) { - list.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); - } - - final ArrayAdapter adapter = new ArrayAdapter( - builder.getContext(), android.R.layout.simple_list_item_1) { - private static final int TYPE_MENU_ITEM = 0; - private static final int TYPE_MENU_CHECK = 1; - private static final int TYPE_SEPARATOR = 2; - private static final int TYPE_GROUP = 3; - private static final int TYPE_SINGLE = 4; - private static final int TYPE_MULTIPLE = 5; - private static final int TYPE_COUNT = 6; - - private LayoutInflater mInflater; - private View mSeparator; - - @Override - public int getViewTypeCount() { - return TYPE_COUNT; - } - - @Override - public int getItemViewType(final int position) { - final ModifiableChoice item = getItem(position); - if (item.choice.separator) { - return TYPE_SEPARATOR; - } else if (type == ChoicePrompt.Type.MENU) { - return item.modifiableSelected ? TYPE_MENU_CHECK : TYPE_MENU_ITEM; - } else if (item.choice.items != null) { - return TYPE_GROUP; - } else if (type == ChoicePrompt.Type.SINGLE) { - return TYPE_SINGLE; - } else if (type == ChoicePrompt.Type.MULTIPLE) { - return TYPE_MULTIPLE; - } else { - throw new UnsupportedOperationException(); - } - } - - @Override - public boolean isEnabled(final int position) { - final ModifiableChoice item = getItem(position); - return !item.choice.separator && !item.choice.disabled && - ((type != ChoicePrompt.Type.SINGLE && - type != ChoicePrompt.Type.MULTIPLE) || - item.choice.items == null); - } - - @Override - public View getView(final int position, View view, - final ViewGroup parent) { - final int itemType = getItemViewType(position); - final int layoutId; - if (itemType == TYPE_SEPARATOR) { - if (mSeparator == null) { - mSeparator = new View(getContext()); - mSeparator.setLayoutParams(new ListView.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, 2, itemType)); - final TypedArray attr = getContext().obtainStyledAttributes( - new int[] { android.R.attr.listDivider }); - mSeparator.setBackgroundResource(attr.getResourceId(0, 0)); - attr.recycle(); - } - return mSeparator; - } else if (itemType == TYPE_MENU_ITEM) { - layoutId = android.R.layout.simple_list_item_1; - } else if (itemType == TYPE_MENU_CHECK) { - layoutId = android.R.layout.simple_list_item_checked; - } else if (itemType == TYPE_GROUP) { - layoutId = android.R.layout.preference_category; - } else if (itemType == TYPE_SINGLE) { - layoutId = android.R.layout.simple_list_item_single_choice; - } else if (itemType == TYPE_MULTIPLE) { - layoutId = android.R.layout.simple_list_item_multiple_choice; - } else { - throw new UnsupportedOperationException(); - } - - if (view == null) { - if (mInflater == null) { - mInflater = LayoutInflater.from(builder.getContext()); - } - view = mInflater.inflate(layoutId, parent, false); - } - - final ModifiableChoice item = getItem(position); - final TextView text = (TextView) view; - text.setEnabled(!item.choice.disabled); - text.setText(item.modifiableLabel); - if (view instanceof CheckedTextView) { - final boolean selected = item.modifiableSelected; - if (itemType == TYPE_MULTIPLE) { - list.setItemChecked(position, selected); - } else { - ((CheckedTextView) view).setChecked(selected); - } - } - return view; - } - }; - addChoiceItems(type, adapter, choices, /* indent */ null); - - list.setAdapter(adapter); - builder.setView(list); - - final AlertDialog dialog; - if (type == ChoicePrompt.Type.SINGLE || type == ChoicePrompt.Type.MENU) { - dialog = createStandardDialog(builder, prompt, res); - list.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(final AdapterView parent, final View v, - final int position, final long id) { - final ModifiableChoice item = adapter.getItem(position); - if (type == ChoicePrompt.Type.MENU) { - final ChoicePrompt.Choice[] children = item.choice.items; - if (children != null) { - // Show sub-menu. - dialog.setOnDismissListener(null); - dialog.dismiss(); - onChoicePromptImpl(session, item.modifiableLabel, /* msg */ null, - type, children, prompt, res); - return; - } - } - res.complete(prompt.confirm(item.choice)); - dialog.dismiss(); - } - }); - } else if (type == ChoicePrompt.Type.MULTIPLE) { - list.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(final AdapterView parent, final View v, - final int position, final long id) { - final ModifiableChoice item = adapter.getItem(position); - item.modifiableSelected = ((CheckedTextView) v).isChecked(); - } - }); - builder.setNegativeButton(android.R.string.cancel, /* listener */ null) - .setPositiveButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, - final int which) { - final int len = adapter.getCount(); - ArrayList items = new ArrayList<>(len); - for (int i = 0; i < len; i++) { - final ModifiableChoice item = adapter.getItem(i); - if (item.modifiableSelected) { - items.add(item.choice.id); - } - } - res.complete(prompt.confirm(items.toArray(new String[items.size()]))); - } - }); - dialog = createStandardDialog(builder, prompt, res); - } else { - throw new UnsupportedOperationException(); - } - dialog.show(); - } - - @Override - public GeckoResult onChoicePrompt(final GeckoSession session, - final ChoicePrompt prompt) { - final GeckoResult res = new GeckoResult(); - onChoicePromptImpl(session, prompt.title, prompt.message, prompt.type, prompt.choices, - prompt, res); - return res; - } - - private static int parseColor(final String value, final int def) { - try { - return Color.parseColor(value); - } catch (final IllegalArgumentException e) { - return def; - } - } - - @Override - public GeckoResult onColorPrompt(final GeckoSession session, - final ColorPrompt prompt) { - final Activity activity = mActivity; - if (activity == null) { - return GeckoResult.fromValue(prompt.dismiss()); - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity); - addStandardLayout(builder, prompt.title, /* msg */ null); - - final int initial = parseColor(prompt.defaultValue, /* def */ 0); - final ArrayAdapter adapter = new ArrayAdapter( - builder.getContext(), android.R.layout.simple_list_item_1) { - private LayoutInflater mInflater; - - @Override - public int getViewTypeCount() { - return 2; - } - - @Override - public int getItemViewType(final int position) { - return (getItem(position) == initial) ? 1 : 0; - } - - @Override - public View getView(final int position, View view, - final ViewGroup parent) { - if (mInflater == null) { - mInflater = LayoutInflater.from(builder.getContext()); - } - final int color = getItem(position); - if (view == null) { - view = mInflater.inflate((color == initial) ? - android.R.layout.simple_list_item_checked : - android.R.layout.simple_list_item_1, parent, false); - } - view.setBackgroundResource(android.R.drawable.editbox_background); - view.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY); - return view; - } - }; - - adapter.addAll(0xffff4444 /* holo_red_light */, - 0xffcc0000 /* holo_red_dark */, - 0xffffbb33 /* holo_orange_light */, - 0xffff8800 /* holo_orange_dark */, - 0xff99cc00 /* holo_green_light */, - 0xff669900 /* holo_green_dark */, - 0xff33b5e5 /* holo_blue_light */, - 0xff0099cc /* holo_blue_dark */, - 0xffaa66cc /* holo_purple */, - 0xffffffff /* white */, - 0xffaaaaaa /* lighter_gray */, - 0xff555555 /* darker_gray */, - 0xff000000 /* black */); - - final ListView list = new ListView(builder.getContext()); - list.setAdapter(adapter); - builder.setView(list); - - GeckoResult res = new GeckoResult(); - - final AlertDialog dialog = createStandardDialog(builder, prompt, res); - list.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(final AdapterView parent, final View v, - final int position, final long id) { - res.complete(prompt.confirm(String.format("#%06x", 0xffffff & adapter.getItem(position)))); - dialog.dismiss(); - } - }); - dialog.show(); - - return res; - } - - private static Date parseDate(final SimpleDateFormat formatter, - final String value, - final boolean defaultToNow) { - try { - if (value != null && !value.isEmpty()) { - return formatter.parse(value); - } - } catch (final ParseException e) { - } - return defaultToNow ? new Date() : null; - } - - @SuppressWarnings("deprecation") - private static void setTimePickerTime(final TimePicker picker, final Calendar cal) { - if (Build.VERSION.SDK_INT >= 23) { - picker.setHour(cal.get(Calendar.HOUR_OF_DAY)); - picker.setMinute(cal.get(Calendar.MINUTE)); - } else { - picker.setCurrentHour(cal.get(Calendar.HOUR_OF_DAY)); - picker.setCurrentMinute(cal.get(Calendar.MINUTE)); - } - } - - @SuppressWarnings("deprecation") - private static void setCalendarTime(final Calendar cal, final TimePicker picker) { - if (Build.VERSION.SDK_INT >= 23) { - cal.set(Calendar.HOUR_OF_DAY, picker.getHour()); - cal.set(Calendar.MINUTE, picker.getMinute()); - } else { - cal.set(Calendar.HOUR_OF_DAY, picker.getCurrentHour()); - cal.set(Calendar.MINUTE, picker.getCurrentMinute()); - } - } - - @Override - public GeckoResult onDateTimePrompt(final GeckoSession session, - final DateTimePrompt prompt) { - final Activity activity = mActivity; - if (activity == null) { - return GeckoResult.fromValue(prompt.dismiss()); - } - final String format; - if (prompt.type == DateTimePrompt.Type.DATE) { - format = "yyyy-MM-dd"; - } else if (prompt.type == DateTimePrompt.Type.MONTH) { - format = "yyyy-MM"; - } else if (prompt.type == DateTimePrompt.Type.WEEK) { - format = "yyyy-'W'ww"; - } else if (prompt.type == DateTimePrompt.Type.TIME) { - format = "HH:mm"; - } else if (prompt.type == DateTimePrompt.Type.DATETIME_LOCAL) { - format = "yyyy-MM-dd'T'HH:mm"; - } else { - throw new UnsupportedOperationException(); - } - - final SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ROOT); - final Date minDate = parseDate(formatter, prompt.minValue, /* defaultToNow */ false); - final Date maxDate = parseDate(formatter, prompt.maxValue, /* defaultToNow */ false); - final Date date = parseDate(formatter, prompt.defaultValue, /* defaultToNow */ true); - final Calendar cal = formatter.getCalendar(); - cal.setTime(date); - - final AlertDialog.Builder builder = new AlertDialog.Builder(activity); - final LayoutInflater inflater = LayoutInflater.from(builder.getContext()); - final DatePicker datePicker; - if (prompt.type == DateTimePrompt.Type.DATE || prompt.type == DateTimePrompt.Type.MONTH || - prompt.type == DateTimePrompt.Type.WEEK || prompt.type == DateTimePrompt.Type.DATETIME_LOCAL) { - final int resId = builder.getContext().getResources().getIdentifier( - "date_picker_dialog", "layout", "android"); - DatePicker picker = null; - if (resId != 0) { - try { - picker = (DatePicker) inflater.inflate(resId, /* root */ null); - } catch (final ClassCastException|InflateException e) { - } - } - if (picker == null) { - picker = new DatePicker(builder.getContext()); - } - picker.init(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), - cal.get(Calendar.DAY_OF_MONTH), /* listener */ null); - if (minDate != null) { - picker.setMinDate(minDate.getTime()); - } - if (maxDate != null) { - picker.setMaxDate(maxDate.getTime()); - } - datePicker = picker; - } else { - datePicker = null; - } - - final TimePicker timePicker; - if (prompt.type == DateTimePrompt.Type.TIME || prompt.type == DateTimePrompt.Type.DATETIME_LOCAL) { - final int resId = builder.getContext().getResources().getIdentifier( - "time_picker_dialog", "layout", "android"); - TimePicker picker = null; - if (resId != 0) { - try { - picker = (TimePicker) inflater.inflate(resId, /* root */ null); - } catch (final ClassCastException|InflateException e) { - } - } - if (picker == null) { - picker = new TimePicker(builder.getContext()); - } - setTimePickerTime(picker, cal); - picker.setIs24HourView(DateFormat.is24HourFormat(builder.getContext())); - timePicker = picker; - } else { - timePicker = null; - } - - final LinearLayout container = addStandardLayout(builder, prompt.title, /* msg */ null); - container.setPadding(/* left */ 0, /* top */ 0, /* right */ 0, /* bottom */ 0); - if (datePicker != null) { - container.addView(datePicker); - } - if (timePicker != null) { - container.addView(timePicker); - } - - GeckoResult res = new GeckoResult(); - - final DialogInterface.OnClickListener listener = - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) { - if (which == DialogInterface.BUTTON_NEUTRAL) { - // Clear - res.complete(prompt.confirm("")); - return; - } - if (datePicker != null) { - cal.set(datePicker.getYear(), datePicker.getMonth(), - datePicker.getDayOfMonth()); - } - if (timePicker != null) { - setCalendarTime(cal, timePicker); - } - res.complete(prompt.confirm(formatter.format(cal.getTime()))); - } - }; - builder.setNegativeButton(android.R.string.cancel, /* listener */ null) - .setNeutralButton("Clear", listener) - .setPositiveButton(android.R.string.ok, listener); - createStandardDialog(builder, prompt, res).show(); - - return res; - } - - @Override - @TargetApi(19) - public GeckoResult onFilePrompt(GeckoSession session, FilePrompt prompt) - { - final Activity activity = mActivity; - if (activity == null) { - return GeckoResult.fromValue(prompt.dismiss()); - } - - // Merge all given MIME types into one, using wildcard if needed. - String mimeType = null; - String mimeSubtype = null; - if (prompt.mimeTypes != null) { - for (final String rawType : prompt.mimeTypes) { - final String normalizedType = rawType.trim().toLowerCase(Locale.ROOT); - final int len = normalizedType.length(); - int slash = normalizedType.indexOf('/'); - if (slash < 0) { - slash = len; - } - final String newType = normalizedType.substring(0, slash); - final String newSubtype = normalizedType.substring(Math.min(slash + 1, len)); - if (mimeType == null) { - mimeType = newType; - } else if (!mimeType.equals(newType)) { - mimeType = "*"; - } - if (mimeSubtype == null) { - mimeSubtype = newSubtype; - } else if (!mimeSubtype.equals(newSubtype)) { - mimeSubtype = "*"; - } - } - } - - final Intent intent = new Intent(Intent.ACTION_GET_CONTENT); - intent.setType((mimeType != null ? mimeType : "*") + '/' + - (mimeSubtype != null ? mimeSubtype : "*")); - intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); - if (Build.VERSION.SDK_INT >= 18 && prompt.type == FilePrompt.Type.MULTIPLE) { - intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); - } - if (Build.VERSION.SDK_INT >= 19 && prompt.mimeTypes.length > 0) { - intent.putExtra(Intent.EXTRA_MIME_TYPES, prompt.mimeTypes); - } - - GeckoResult res = new GeckoResult(); - - try { - mFileResponse = res; - mFilePrompt = prompt; - activity.startActivityForResult(intent, filePickerRequestCode); - } catch (final ActivityNotFoundException e) { - Log.e(LOGTAG, "Cannot launch activity", e); - return GeckoResult.fromValue(prompt.dismiss()); - } - - return res; - } - - public void onFileCallbackResult(final int resultCode, final Intent data) { - if (mFileResponse == null) { - return; - } - - final GeckoResult res = mFileResponse; - mFileResponse = null; - - final FilePrompt prompt = mFilePrompt; - mFilePrompt = null; - - if (resultCode != Activity.RESULT_OK || data == null) { - res.complete(prompt.dismiss()); - return; - } - - final Uri uri = data.getData(); - final ClipData clip = data.getClipData(); - - if (prompt.type == FilePrompt.Type.SINGLE || - (prompt.type == FilePrompt.Type.MULTIPLE && clip == null)) { - res.complete(prompt.confirm(mActivity, uri)); - } else if (prompt.type == FilePrompt.Type.MULTIPLE) { - if (clip == null) { - Log.w(LOGTAG, "No selected file"); - res.complete(prompt.dismiss()); - return; - } - final int count = clip.getItemCount(); - final ArrayList uris = new ArrayList<>(count); - for (int i = 0; i < count; i++) { - uris.add(clip.getItemAt(i).getUri()); - } - res.complete(prompt.confirm(mActivity, uris.toArray(new Uri[uris.size()]))); - } - } - - public void onPermissionPrompt(final GeckoSession session, final String title, - final GeckoSession.PermissionDelegate.Callback callback) { - final Activity activity = mActivity; - if (activity == null) { - callback.reject(); - return; - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity); - builder.setTitle(title) - .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) { - callback.reject(); - } - }) - .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) { - callback.grant(); - } - }); - - final AlertDialog dialog = builder.create(); - dialog.show(); - } - - public void onSlowScriptPrompt(GeckoSession geckoSession, String title, GeckoResult reportAction) { - final Activity activity = mActivity; - if (activity == null) { - return; - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity); - builder.setTitle(title) - .setNegativeButton("Wait", new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) { - reportAction.complete(SlowScriptResponse.CONTINUE); - } - }) - .setPositiveButton("Stop", new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) { - reportAction.complete(SlowScriptResponse.STOP); - } - }); - - final AlertDialog dialog = builder.create(); - dialog.show(); - } - - private Spinner addMediaSpinner(final Context context, final ViewGroup container, - final GeckoSession.PermissionDelegate.MediaSource[] sources, final String[] sourceNames) { - final ArrayAdapter adapter = new ArrayAdapter( - context, android.R.layout.simple_spinner_item) { - private View convertView(final int position, final View view) { - if (view != null) { - final GeckoSession.PermissionDelegate.MediaSource item = getItem(position); - ((TextView) view).setText(sourceNames != null ? sourceNames[position] : "media"); - } - return view; - } - - @Override - public View getView(final int position, View view, - final ViewGroup parent) { - return convertView(position, super.getView(position, view, parent)); - } - - @Override - public View getDropDownView(final int position, final View view, - final ViewGroup parent) { - return convertView(position, super.getDropDownView(position, view, parent)); - } - }; - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - adapter.addAll(sources); - - final Spinner spinner = new Spinner(context); - spinner.setAdapter(adapter); - spinner.setSelection(0); - container.addView(spinner); - return spinner; - } - - public void onMediaPrompt(final GeckoSession session, final String title, - final GeckoSession.PermissionDelegate.MediaSource[] video, final GeckoSession.PermissionDelegate.MediaSource[] audio, - final String[] videoNames, final String[] audioNames, - final GeckoSession.PermissionDelegate.MediaCallback callback) { - final Activity activity = mActivity; - if (activity == null || (video == null && audio == null)) { - callback.reject(); - return; - } - final AlertDialog.Builder builder = new AlertDialog.Builder(activity); - final LinearLayout container = addStandardLayout(builder, title, /* msg */ null); - - final Spinner videoSpinner; - if (video != null) { - videoSpinner = addMediaSpinner(builder.getContext(), container, video, videoNames); - } else { - videoSpinner = null; - } - - final Spinner audioSpinner; - if (audio != null) { - audioSpinner = addMediaSpinner(builder.getContext(), container, audio, audioNames); - } else { - audioSpinner = null; - } - - builder.setNegativeButton(android.R.string.cancel, /* listener */ null) - .setPositiveButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) { - final GeckoSession.PermissionDelegate.MediaSource video = (videoSpinner != null) - ? (GeckoSession.PermissionDelegate.MediaSource) videoSpinner.getSelectedItem() : null; - final GeckoSession.PermissionDelegate.MediaSource audio = (audioSpinner != null) - ? (GeckoSession.PermissionDelegate.MediaSource) audioSpinner.getSelectedItem() : null; - callback.grant(video, audio); - } - }); - - final AlertDialog dialog = builder.create(); - dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(final DialogInterface dialog) { - callback.reject(); - } - }); - dialog.show(); - } - - public void onMediaPrompt(final GeckoSession session, final String title, - final GeckoSession.PermissionDelegate.MediaSource[] video, final GeckoSession.PermissionDelegate.MediaSource[] audio, - final GeckoSession.PermissionDelegate.MediaCallback callback) { - onMediaPrompt(session, title, video, audio, null, null, callback); - } - - @Override - public GeckoResult onPopupPrompt(final GeckoSession session, - final PopupPrompt prompt) { - return GeckoResult.fromValue(prompt.confirm(AllowOrDeny.ALLOW)); - } +package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.app.AlertDialog; +import android.content.ActivityNotFoundException; +import android.content.ClipData; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.res.TypedArray; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.net.Uri; +import android.os.Build; +import android.text.InputType; +import android.text.format.DateFormat; +import android.util.Log; +import android.view.InflateException; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.CheckedTextView; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.ScrollView; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.TimePicker; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; +import org.mozilla.geckoview.AllowOrDeny; +import org.mozilla.geckoview.GeckoResult; +import org.mozilla.geckoview.GeckoSession; +import org.mozilla.geckoview.SlowScriptResponse; + +final class geckoPromptView implements GeckoSession.PromptDelegate { + protected static final String LOGTAG = "BasicGeckoViewPrompt"; + + private final AppCompatActivity mActivity; + public int filePickerRequestCode = 1; + private int mFileType; + private GeckoResult mFileResponse; + private FilePrompt mFilePrompt; + + public geckoPromptView(final AppCompatActivity activity) { + mActivity = activity; + } + + @Override + public GeckoResult onAlertPrompt(final GeckoSession session, + final AlertPrompt prompt) { + final Activity activity = mActivity; + if (activity == null) { + return GeckoResult.fromValue(prompt.dismiss()); + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity) + .setTitle(prompt.title) + .setMessage(prompt.message) + .setPositiveButton(android.R.string.ok, /* onClickListener */ null); + GeckoResult res = new GeckoResult(); + createStandardDialog(builder, prompt, res).show(); + return res; + } + + @Override + public GeckoResult onButtonPrompt(final GeckoSession session, + final ButtonPrompt prompt) { + final Activity activity = mActivity; + if (activity == null) { + return GeckoResult.fromValue(prompt.dismiss()); + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity) + .setTitle(prompt.title) + .setMessage(prompt.message); + + GeckoResult res = new GeckoResult(); + + final DialogInterface.OnClickListener listener = + new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + if (which == DialogInterface.BUTTON_POSITIVE) { + res.complete(prompt.confirm(ButtonPrompt.Type.POSITIVE)); + } else if (which == DialogInterface.BUTTON_NEGATIVE) { + res.complete(prompt.confirm(ButtonPrompt.Type.NEGATIVE)); + } else { + res.complete(prompt.dismiss()); + } + } + }; + + builder.setPositiveButton(android.R.string.ok, listener); + builder.setNegativeButton(android.R.string.cancel, listener); + + createStandardDialog(builder, prompt, res).show(); + return res; + } + + @Override + public GeckoResult onSharePrompt(final GeckoSession session, + final SharePrompt prompt) { + return GeckoResult.fromValue(prompt.dismiss()); + } + + @Nullable + @Override + public GeckoResult onRepostConfirmPrompt(final GeckoSession session, + final RepostConfirmPrompt prompt) { + final Activity activity = mActivity; + if (activity == null) { + return GeckoResult.fromValue(prompt.dismiss()); + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity) + .setTitle("Are you sure?") + .setMessage("To display this page, GeckoViewExample must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."); + + GeckoResult res = new GeckoResult<>(); + + final DialogInterface.OnClickListener listener = (dialog, which) -> { + if (which == DialogInterface.BUTTON_POSITIVE) { + res.complete(prompt.confirm(AllowOrDeny.ALLOW)); + } else if (which == DialogInterface.BUTTON_NEGATIVE) { + res.complete(prompt.confirm(AllowOrDeny.DENY)); + } else { + res.complete(prompt.dismiss()); + } + }; + + builder.setPositiveButton("Resend", listener); + builder.setNegativeButton("Cancel", listener); + + createStandardDialog(builder, prompt, res).show(); + return res; + } + + @Nullable + @Override + public GeckoResult onBeforeUnloadPrompt(final GeckoSession session, + final BeforeUnloadPrompt prompt) { + final Activity activity = mActivity; + if (activity == null) { + return GeckoResult.fromValue(prompt.dismiss()); + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity) + .setTitle("Are you sure?") + .setMessage("This page is asking you to confirm that you want to leave - data you have entered may not be saved"); + + GeckoResult res = new GeckoResult<>(); + + final DialogInterface.OnClickListener listener = (dialog, which) -> { + if (which == DialogInterface.BUTTON_POSITIVE) { + res.complete(prompt.confirm(AllowOrDeny.ALLOW)); + } else if (which == DialogInterface.BUTTON_NEGATIVE) { + res.complete(prompt.confirm(AllowOrDeny.DENY)); + } else { + res.complete(prompt.dismiss()); + } + }; + + builder.setPositiveButton("Leave Page", listener); + builder.setNegativeButton("Stay on Page", listener); + + createStandardDialog(builder, prompt, res).show(); + return res; + } + + private int getViewPadding(final AlertDialog.Builder builder) { + final TypedArray attr = builder.getContext().obtainStyledAttributes( + new int[] { android.R.attr.listPreferredItemPaddingLeft }); + final int padding = attr.getDimensionPixelSize(0, 1); + attr.recycle(); + return padding; + } + + private LinearLayout addStandardLayout(final AlertDialog.Builder builder, + final String title, final String msg) { + final ScrollView scrollView = new ScrollView(builder.getContext()); + final LinearLayout container = new LinearLayout(builder.getContext()); + final int horizontalPadding = getViewPadding(builder); + final int verticalPadding = (msg == null || msg.isEmpty()) ? horizontalPadding : 0; + container.setOrientation(LinearLayout.VERTICAL); + container.setPadding(/* left */ horizontalPadding, /* top */ verticalPadding, + /* right */ horizontalPadding, /* bottom */ verticalPadding); + scrollView.addView(container); + builder.setTitle(title) + .setMessage(msg) + .setView(scrollView); + return container; + } + + private AlertDialog createStandardDialog(final AlertDialog.Builder builder, + final BasePrompt prompt, + final GeckoResult response) { + final AlertDialog dialog = builder.create(); + dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(final DialogInterface dialog) { + if (!prompt.isComplete()) { + response.complete(prompt.dismiss()); + } + } + }); + return dialog; + } + + @Override + public GeckoResult onTextPrompt(final GeckoSession session, + final TextPrompt prompt) { + final Activity activity = mActivity; + if (activity == null) { + return GeckoResult.fromValue(prompt.dismiss()); + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); + final LinearLayout container = addStandardLayout(builder, prompt.title, prompt.message); + final EditText editText = new EditText(builder.getContext()); + editText.setText(prompt.defaultValue); + container.addView(editText); + + GeckoResult res = new GeckoResult(); + + builder.setNegativeButton(android.R.string.cancel, /* listener */ null) + .setPositiveButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + res.complete(prompt.confirm(editText.getText().toString())); + } + }); + + createStandardDialog(builder, prompt, res).show(); + return res; + } + + @Override + public GeckoResult onAuthPrompt(final GeckoSession session, + final AuthPrompt prompt) { + final Activity activity = mActivity; + if (activity == null) { + return GeckoResult.fromValue(prompt.dismiss()); + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); + final LinearLayout container = addStandardLayout(builder, prompt.title, prompt.message); + + final int flags = prompt.authOptions.flags; + final int level = prompt.authOptions.level; + final EditText username; + if ((flags & AuthPrompt.AuthOptions.Flags.ONLY_PASSWORD) == 0) { + username = new EditText(builder.getContext()); + username.setHint("Username"); + username.setText(prompt.authOptions.username); + container.addView(username); + } else { + username = null; + } + + final EditText password = new EditText(builder.getContext()); + password.setHint("Password"); + password.setText(prompt.authOptions.password); + password.setInputType(InputType.TYPE_CLASS_TEXT | + InputType.TYPE_TEXT_VARIATION_PASSWORD); + container.addView(password); + + if (level != AuthPrompt.AuthOptions.Level.NONE) { + final ImageView secure = new ImageView(builder.getContext()); + secure.setImageResource(android.R.drawable.ic_lock_lock); + container.addView(secure); + } + + GeckoResult res = new GeckoResult(); + + builder.setNegativeButton(android.R.string.cancel, /* listener */ null) + .setPositiveButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + if ((flags & AuthPrompt.AuthOptions.Flags.ONLY_PASSWORD) == 0) { + res.complete(prompt.confirm(username.getText().toString(), + password.getText().toString())); + + } else { + res.complete(prompt.confirm(password.getText().toString())); + } + } + }); + createStandardDialog(builder, prompt, res).show(); + + return res; + } + + private static class ModifiableChoice { + public boolean modifiableSelected; + public String modifiableLabel; + public final ChoicePrompt.Choice choice; + + public ModifiableChoice(ChoicePrompt.Choice c) { + choice = c; + modifiableSelected = choice.selected; + modifiableLabel = choice.label; + } + } + + private void addChoiceItems(final int type, final ArrayAdapter list, + final ChoicePrompt.Choice[] items, final String indent) { + if (type == ChoicePrompt.Type.MENU) { + for (final ChoicePrompt.Choice item : items) { + list.add(new ModifiableChoice(item)); + } + return; + } + + for (final ChoicePrompt.Choice item : items) { + final ModifiableChoice modItem = new ModifiableChoice(item); + + final ChoicePrompt.Choice[] children = item.items; + + if (indent != null && children == null) { + modItem.modifiableLabel = indent + modItem.modifiableLabel; + } + list.add(modItem); + + if (children != null) { + final String newIndent; + if (type == ChoicePrompt.Type.SINGLE || type == ChoicePrompt.Type.MULTIPLE) { + newIndent = (indent != null) ? indent + '\t' : "\t"; + } else { + newIndent = null; + } + addChoiceItems(type, list, children, newIndent); + } + } + } + + private void onChoicePromptImpl(final GeckoSession session, final String title, + final String message, final int type, + final ChoicePrompt.Choice[] choices, final ChoicePrompt prompt, + final GeckoResult res) { + final Activity activity = mActivity; + if (activity == null) { + res.complete(prompt.dismiss()); + return; + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); + addStandardLayout(builder, title, message); + + final ListView list = new ListView(builder.getContext()); + if (type == ChoicePrompt.Type.MULTIPLE) { + list.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); + } + + final ArrayAdapter adapter = new ArrayAdapter( + builder.getContext(), android.R.layout.simple_list_item_1) { + private static final int TYPE_MENU_ITEM = 0; + private static final int TYPE_MENU_CHECK = 1; + private static final int TYPE_SEPARATOR = 2; + private static final int TYPE_GROUP = 3; + private static final int TYPE_SINGLE = 4; + private static final int TYPE_MULTIPLE = 5; + private static final int TYPE_COUNT = 6; + + private LayoutInflater mInflater; + private View mSeparator; + + @Override + public int getViewTypeCount() { + return TYPE_COUNT; + } + + @Override + public int getItemViewType(final int position) { + final ModifiableChoice item = getItem(position); + if (item.choice.separator) { + return TYPE_SEPARATOR; + } else if (type == ChoicePrompt.Type.MENU) { + return item.modifiableSelected ? TYPE_MENU_CHECK : TYPE_MENU_ITEM; + } else if (item.choice.items != null) { + return TYPE_GROUP; + } else if (type == ChoicePrompt.Type.SINGLE) { + return TYPE_SINGLE; + } else if (type == ChoicePrompt.Type.MULTIPLE) { + return TYPE_MULTIPLE; + } else { + throw new UnsupportedOperationException(); + } + } + + @Override + public boolean isEnabled(final int position) { + final ModifiableChoice item = getItem(position); + return !item.choice.separator && !item.choice.disabled && + ((type != ChoicePrompt.Type.SINGLE && + type != ChoicePrompt.Type.MULTIPLE) || + item.choice.items == null); + } + + @Override + public View getView(final int position, View view, + final ViewGroup parent) { + final int itemType = getItemViewType(position); + final int layoutId; + if (itemType == TYPE_SEPARATOR) { + if (mSeparator == null) { + mSeparator = new View(getContext()); + mSeparator.setLayoutParams(new ListView.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, 2, itemType)); + final TypedArray attr = getContext().obtainStyledAttributes( + new int[] { android.R.attr.listDivider }); + mSeparator.setBackgroundResource(attr.getResourceId(0, 0)); + attr.recycle(); + } + return mSeparator; + } else if (itemType == TYPE_MENU_ITEM) { + layoutId = android.R.layout.simple_list_item_1; + } else if (itemType == TYPE_MENU_CHECK) { + layoutId = android.R.layout.simple_list_item_checked; + } else if (itemType == TYPE_GROUP) { + layoutId = android.R.layout.preference_category; + } else if (itemType == TYPE_SINGLE) { + layoutId = android.R.layout.simple_list_item_single_choice; + } else if (itemType == TYPE_MULTIPLE) { + layoutId = android.R.layout.simple_list_item_multiple_choice; + } else { + throw new UnsupportedOperationException(); + } + + if (view == null) { + if (mInflater == null) { + mInflater = LayoutInflater.from(builder.getContext()); + } + view = mInflater.inflate(layoutId, parent, false); + } + + final ModifiableChoice item = getItem(position); + final TextView text = (TextView) view; + text.setEnabled(!item.choice.disabled); + text.setText(item.modifiableLabel); + if (view instanceof CheckedTextView) { + final boolean selected = item.modifiableSelected; + if (itemType == TYPE_MULTIPLE) { + list.setItemChecked(position, selected); + } else { + ((CheckedTextView) view).setChecked(selected); + } + } + return view; + } + }; + addChoiceItems(type, adapter, choices, /* indent */ null); + + list.setAdapter(adapter); + builder.setView(list); + + final AlertDialog dialog; + if (type == ChoicePrompt.Type.SINGLE || type == ChoicePrompt.Type.MENU) { + dialog = createStandardDialog(builder, prompt, res); + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(final AdapterView parent, final View v, + final int position, final long id) { + final ModifiableChoice item = adapter.getItem(position); + if (type == ChoicePrompt.Type.MENU) { + final ChoicePrompt.Choice[] children = item.choice.items; + if (children != null) { + // Show sub-menu. + dialog.setOnDismissListener(null); + dialog.dismiss(); + onChoicePromptImpl(session, item.modifiableLabel, /* msg */ null, + type, children, prompt, res); + return; + } + } + res.complete(prompt.confirm(item.choice)); + dialog.dismiss(); + } + }); + } else if (type == ChoicePrompt.Type.MULTIPLE) { + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(final AdapterView parent, final View v, + final int position, final long id) { + final ModifiableChoice item = adapter.getItem(position); + item.modifiableSelected = ((CheckedTextView) v).isChecked(); + } + }); + builder.setNegativeButton(android.R.string.cancel, /* listener */ null) + .setPositiveButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, + final int which) { + final int len = adapter.getCount(); + ArrayList items = new ArrayList<>(len); + for (int i = 0; i < len; i++) { + final ModifiableChoice item = adapter.getItem(i); + if (item.modifiableSelected) { + items.add(item.choice.id); + } + } + res.complete(prompt.confirm(items.toArray(new String[items.size()]))); + } + }); + dialog = createStandardDialog(builder, prompt, res); + } else { + throw new UnsupportedOperationException(); + } + dialog.show(); + } + + @Override + public GeckoResult onChoicePrompt(final GeckoSession session, + final ChoicePrompt prompt) { + final GeckoResult res = new GeckoResult(); + onChoicePromptImpl(session, prompt.title, prompt.message, prompt.type, prompt.choices, + prompt, res); + return res; + } + + private static int parseColor(final String value, final int def) { + try { + return Color.parseColor(value); + } catch (final IllegalArgumentException e) { + return def; + } + } + + @Override + public GeckoResult onColorPrompt(final GeckoSession session, + final ColorPrompt prompt) { + final Activity activity = mActivity; + if (activity == null) { + return GeckoResult.fromValue(prompt.dismiss()); + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); + addStandardLayout(builder, prompt.title, /* msg */ null); + + final int initial = parseColor(prompt.defaultValue, /* def */ 0); + final ArrayAdapter adapter = new ArrayAdapter( + builder.getContext(), android.R.layout.simple_list_item_1) { + private LayoutInflater mInflater; + + @Override + public int getViewTypeCount() { + return 2; + } + + @Override + public int getItemViewType(final int position) { + return (getItem(position) == initial) ? 1 : 0; + } + + @Override + public View getView(final int position, View view, + final ViewGroup parent) { + if (mInflater == null) { + mInflater = LayoutInflater.from(builder.getContext()); + } + final int color = getItem(position); + if (view == null) { + view = mInflater.inflate((color == initial) ? + android.R.layout.simple_list_item_checked : + android.R.layout.simple_list_item_1, parent, false); + } + view.setBackgroundResource(android.R.drawable.editbox_background); + view.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY); + return view; + } + }; + + adapter.addAll(0xffff4444 /* holo_red_light */, + 0xffcc0000 /* holo_red_dark */, + 0xffffbb33 /* holo_orange_light */, + 0xffff8800 /* holo_orange_dark */, + 0xff99cc00 /* holo_green_light */, + 0xff669900 /* holo_green_dark */, + 0xff33b5e5 /* holo_blue_light */, + 0xff0099cc /* holo_blue_dark */, + 0xffaa66cc /* holo_purple */, + 0xffffffff /* white */, + 0xffaaaaaa /* lighter_gray */, + 0xff555555 /* darker_gray */, + 0xff000000 /* black */); + + final ListView list = new ListView(builder.getContext()); + list.setAdapter(adapter); + builder.setView(list); + + GeckoResult res = new GeckoResult(); + + final AlertDialog dialog = createStandardDialog(builder, prompt, res); + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(final AdapterView parent, final View v, + final int position, final long id) { + res.complete(prompt.confirm(String.format("#%06x", 0xffffff & adapter.getItem(position)))); + dialog.dismiss(); + } + }); + dialog.show(); + + return res; + } + + private static Date parseDate(final SimpleDateFormat formatter, + final String value, + final boolean defaultToNow) { + try { + if (value != null && !value.isEmpty()) { + return formatter.parse(value); + } + } catch (final ParseException e) { + } + return defaultToNow ? new Date() : null; + } + + @SuppressWarnings("deprecation") + private static void setTimePickerTime(final TimePicker picker, final Calendar cal) { + if (Build.VERSION.SDK_INT >= 23) { + picker.setHour(cal.get(Calendar.HOUR_OF_DAY)); + picker.setMinute(cal.get(Calendar.MINUTE)); + } else { + picker.setCurrentHour(cal.get(Calendar.HOUR_OF_DAY)); + picker.setCurrentMinute(cal.get(Calendar.MINUTE)); + } + } + + @SuppressWarnings("deprecation") + private static void setCalendarTime(final Calendar cal, final TimePicker picker) { + if (Build.VERSION.SDK_INT >= 23) { + cal.set(Calendar.HOUR_OF_DAY, picker.getHour()); + cal.set(Calendar.MINUTE, picker.getMinute()); + } else { + cal.set(Calendar.HOUR_OF_DAY, picker.getCurrentHour()); + cal.set(Calendar.MINUTE, picker.getCurrentMinute()); + } + } + + @Override + public GeckoResult onDateTimePrompt(final GeckoSession session, + final DateTimePrompt prompt) { + final Activity activity = mActivity; + if (activity == null) { + return GeckoResult.fromValue(prompt.dismiss()); + } + final String format; + if (prompt.type == DateTimePrompt.Type.DATE) { + format = "yyyy-MM-dd"; + } else if (prompt.type == DateTimePrompt.Type.MONTH) { + format = "yyyy-MM"; + } else if (prompt.type == DateTimePrompt.Type.WEEK) { + format = "yyyy-'W'ww"; + } else if (prompt.type == DateTimePrompt.Type.TIME) { + format = "HH:mm"; + } else if (prompt.type == DateTimePrompt.Type.DATETIME_LOCAL) { + format = "yyyy-MM-dd'T'HH:mm"; + } else { + throw new UnsupportedOperationException(); + } + + final SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ROOT); + final Date minDate = parseDate(formatter, prompt.minValue, /* defaultToNow */ false); + final Date maxDate = parseDate(formatter, prompt.maxValue, /* defaultToNow */ false); + final Date date = parseDate(formatter, prompt.defaultValue, /* defaultToNow */ true); + final Calendar cal = formatter.getCalendar(); + cal.setTime(date); + + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); + final LayoutInflater inflater = LayoutInflater.from(builder.getContext()); + final DatePicker datePicker; + if (prompt.type == DateTimePrompt.Type.DATE || prompt.type == DateTimePrompt.Type.MONTH || + prompt.type == DateTimePrompt.Type.WEEK || prompt.type == DateTimePrompt.Type.DATETIME_LOCAL) { + final int resId = builder.getContext().getResources().getIdentifier( + "date_picker_dialog", "layout", "android"); + DatePicker picker = null; + if (resId != 0) { + try { + picker = (DatePicker) inflater.inflate(resId, /* root */ null); + } catch (final ClassCastException|InflateException e) { + } + } + if (picker == null) { + picker = new DatePicker(builder.getContext()); + } + picker.init(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), + cal.get(Calendar.DAY_OF_MONTH), /* listener */ null); + if (minDate != null) { + picker.setMinDate(minDate.getTime()); + } + if (maxDate != null) { + picker.setMaxDate(maxDate.getTime()); + } + datePicker = picker; + } else { + datePicker = null; + } + + final TimePicker timePicker; + if (prompt.type == DateTimePrompt.Type.TIME || prompt.type == DateTimePrompt.Type.DATETIME_LOCAL) { + final int resId = builder.getContext().getResources().getIdentifier( + "time_picker_dialog", "layout", "android"); + TimePicker picker = null; + if (resId != 0) { + try { + picker = (TimePicker) inflater.inflate(resId, /* root */ null); + } catch (final ClassCastException|InflateException e) { + } + } + if (picker == null) { + picker = new TimePicker(builder.getContext()); + } + setTimePickerTime(picker, cal); + picker.setIs24HourView(DateFormat.is24HourFormat(builder.getContext())); + timePicker = picker; + } else { + timePicker = null; + } + + final LinearLayout container = addStandardLayout(builder, prompt.title, /* msg */ null); + container.setPadding(/* left */ 0, /* top */ 0, /* right */ 0, /* bottom */ 0); + if (datePicker != null) { + container.addView(datePicker); + } + if (timePicker != null) { + container.addView(timePicker); + } + + GeckoResult res = new GeckoResult(); + + final DialogInterface.OnClickListener listener = + new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + if (which == DialogInterface.BUTTON_NEUTRAL) { + // Clear + res.complete(prompt.confirm("")); + return; + } + if (datePicker != null) { + cal.set(datePicker.getYear(), datePicker.getMonth(), + datePicker.getDayOfMonth()); + } + if (timePicker != null) { + setCalendarTime(cal, timePicker); + } + res.complete(prompt.confirm(formatter.format(cal.getTime()))); + } + }; + builder.setNegativeButton(android.R.string.cancel, /* listener */ null) + .setNeutralButton("Clear", listener) + .setPositiveButton(android.R.string.ok, listener); + createStandardDialog(builder, prompt, res).show(); + + return res; + } + + @Override + @TargetApi(19) + public GeckoResult onFilePrompt(GeckoSession session, FilePrompt prompt) + { + final Activity activity = mActivity; + if (activity == null) { + return GeckoResult.fromValue(prompt.dismiss()); + } + + // Merge all given MIME types into one, using wildcard if needed. + String mimeType = null; + String mimeSubtype = null; + if (prompt.mimeTypes != null) { + for (final String rawType : prompt.mimeTypes) { + final String normalizedType = rawType.trim().toLowerCase(Locale.ROOT); + final int len = normalizedType.length(); + int slash = normalizedType.indexOf('/'); + if (slash < 0) { + slash = len; + } + final String newType = normalizedType.substring(0, slash); + final String newSubtype = normalizedType.substring(Math.min(slash + 1, len)); + if (mimeType == null) { + mimeType = newType; + } else if (!mimeType.equals(newType)) { + mimeType = "*"; + } + if (mimeSubtype == null) { + mimeSubtype = newSubtype; + } else if (!mimeSubtype.equals(newSubtype)) { + mimeSubtype = "*"; + } + } + } + + final Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType((mimeType != null ? mimeType : "*") + '/' + + (mimeSubtype != null ? mimeSubtype : "*")); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); + if (Build.VERSION.SDK_INT >= 18 && prompt.type == FilePrompt.Type.MULTIPLE) { + intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); + } + if (Build.VERSION.SDK_INT >= 19 && prompt.mimeTypes.length > 0) { + intent.putExtra(Intent.EXTRA_MIME_TYPES, prompt.mimeTypes); + } + + GeckoResult res = new GeckoResult(); + + try { + mFileResponse = res; + mFilePrompt = prompt; + activity.startActivityForResult(intent, filePickerRequestCode); + } catch (final ActivityNotFoundException e) { + Log.e(LOGTAG, "Cannot launch activity", e); + return GeckoResult.fromValue(prompt.dismiss()); + } + + return res; + } + + public void onFileCallbackResult(final int resultCode, final Intent data) { + if (mFileResponse == null) { + return; + } + + final GeckoResult res = mFileResponse; + mFileResponse = null; + + final FilePrompt prompt = mFilePrompt; + mFilePrompt = null; + + if (resultCode != Activity.RESULT_OK || data == null) { + res.complete(prompt.dismiss()); + return; + } + + final Uri uri = data.getData(); + final ClipData clip = data.getClipData(); + + if (prompt.type == FilePrompt.Type.SINGLE || + (prompt.type == FilePrompt.Type.MULTIPLE && clip == null)) { + res.complete(prompt.confirm(mActivity, uri)); + } else if (prompt.type == FilePrompt.Type.MULTIPLE) { + if (clip == null) { + Log.w(LOGTAG, "No selected file"); + res.complete(prompt.dismiss()); + return; + } + final int count = clip.getItemCount(); + final ArrayList uris = new ArrayList<>(count); + for (int i = 0; i < count; i++) { + uris.add(clip.getItemAt(i).getUri()); + } + res.complete(prompt.confirm(mActivity, uris.toArray(new Uri[uris.size()]))); + } + } + + public void onPermissionPrompt(final GeckoSession session, final String title, + final GeckoSession.PermissionDelegate.Callback callback) { + final Activity activity = mActivity; + if (activity == null) { + callback.reject(); + return; + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); + builder.setTitle(title) + .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + callback.reject(); + } + }) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + callback.grant(); + } + }); + + final AlertDialog dialog = builder.create(); + dialog.show(); + } + + public void onSlowScriptPrompt(GeckoSession geckoSession, String title, GeckoResult reportAction) { + final Activity activity = mActivity; + if (activity == null) { + return; + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); + builder.setTitle(title) + .setNegativeButton("Wait", new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + reportAction.complete(SlowScriptResponse.CONTINUE); + } + }) + .setPositiveButton("Stop", new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + reportAction.complete(SlowScriptResponse.STOP); + } + }); + + final AlertDialog dialog = builder.create(); + dialog.show(); + } + + private Spinner addMediaSpinner(final Context context, final ViewGroup container, + final GeckoSession.PermissionDelegate.MediaSource[] sources, final String[] sourceNames) { + final ArrayAdapter adapter = new ArrayAdapter( + context, android.R.layout.simple_spinner_item) { + private View convertView(final int position, final View view) { + if (view != null) { + final GeckoSession.PermissionDelegate.MediaSource item = getItem(position); + ((TextView) view).setText(sourceNames != null ? sourceNames[position] : "media"); + } + return view; + } + + @Override + public View getView(final int position, View view, + final ViewGroup parent) { + return convertView(position, super.getView(position, view, parent)); + } + + @Override + public View getDropDownView(final int position, final View view, + final ViewGroup parent) { + return convertView(position, super.getDropDownView(position, view, parent)); + } + }; + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + adapter.addAll(sources); + + final Spinner spinner = new Spinner(context); + spinner.setAdapter(adapter); + spinner.setSelection(0); + container.addView(spinner); + return spinner; + } + + public void onMediaPrompt(final GeckoSession session, final String title, + final GeckoSession.PermissionDelegate.MediaSource[] video, final GeckoSession.PermissionDelegate.MediaSource[] audio, + final String[] videoNames, final String[] audioNames, + final GeckoSession.PermissionDelegate.MediaCallback callback) { + final Activity activity = mActivity; + if (activity == null || (video == null && audio == null)) { + callback.reject(); + return; + } + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); + final LinearLayout container = addStandardLayout(builder, title, /* msg */ null); + + final Spinner videoSpinner; + if (video != null) { + videoSpinner = addMediaSpinner(builder.getContext(), container, video, videoNames); + } else { + videoSpinner = null; + } + + final Spinner audioSpinner; + if (audio != null) { + audioSpinner = addMediaSpinner(builder.getContext(), container, audio, audioNames); + } else { + audioSpinner = null; + } + + builder.setNegativeButton(android.R.string.cancel, /* listener */ null) + .setPositiveButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + @Override + public void onClick(final DialogInterface dialog, final int which) { + final GeckoSession.PermissionDelegate.MediaSource video = (videoSpinner != null) + ? (GeckoSession.PermissionDelegate.MediaSource) videoSpinner.getSelectedItem() : null; + final GeckoSession.PermissionDelegate.MediaSource audio = (audioSpinner != null) + ? (GeckoSession.PermissionDelegate.MediaSource) audioSpinner.getSelectedItem() : null; + callback.grant(video, audio); + } + }); + + final AlertDialog dialog = builder.create(); + dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(final DialogInterface dialog) { + callback.reject(); + } + }); + dialog.show(); + } + + public void onMediaPrompt(final GeckoSession session, final String title, + final GeckoSession.PermissionDelegate.MediaSource[] video, final GeckoSession.PermissionDelegate.MediaSource[] audio, + final GeckoSession.PermissionDelegate.MediaCallback callback) { + onMediaPrompt(session, title, video, audio, null, null, callback); + } + + @Override + public GeckoResult onPopupPrompt(final GeckoSession session, + final PopupPrompt prompt) { + return GeckoResult.fromValue(prompt.confirm(AllowOrDeny.ALLOW)); + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java index 00328867..0fbca355 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java @@ -1,1060 +1,1063 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; - -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.ActivityNotFoundException; -import android.content.Context; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.graphics.Bitmap; -import android.graphics.Matrix; -import android.graphics.Rect; -import android.graphics.RectF; -import android.media.MediaScannerConnection; -import android.net.Uri; -import android.os.Build; -import android.os.Environment; -import android.os.Handler; -import android.util.Base64; -import android.util.Log; -import android.view.autofill.AutofillManager; -import android.view.autofill.AutofillValue; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.UiThread; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.NotificationCompat; -import androidx.core.content.FileProvider; - -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.libs.trueTime.trueTime; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import org.json.JSONObject; -import org.mozilla.gecko.util.ThreadUtils; -import org.mozilla.geckoview.AllowOrDeny; -import org.mozilla.geckoview.Autofill; -import org.mozilla.geckoview.GeckoResult; -import org.mozilla.geckoview.GeckoSession; -import org.mozilla.geckoview.GeckoView; -import org.mozilla.geckoview.SlowScriptResponse; -import org.mozilla.geckoview.WebRequestError; -import org.mozilla.geckoview.WebResponse; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.ref.WeakReference; -import java.net.URLEncoder; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Objects; -import javax.crypto.spec.SecretKeySpec; - -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED_DARK; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; -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.enums.etype.M_RATE_COUNT; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; -import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; -import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; - -public class -geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSession.ScrollDelegate,GeckoSession.PermissionDelegate,GeckoSession.ProgressDelegate, GeckoSession.HistoryDelegate,GeckoSession.NavigationDelegate,GeckoSession.ContentDelegate -{ - private eventObserver.eventListener event; - - private boolean wasBackPressed = false; - private String mSessionID; - private boolean mCanGoBack = false; - private boolean mCanGoForward = false; - private boolean mFullScreen = false; - private boolean isPageLoading = false; - private int mProgress = 0; - private String mPrevURL = "about:blank"; - private String mCurrentTitle = "loading"; - private String mCurrentURL = "about:blank"; - private Uri mUriPermission = null; - private WeakReference mContext; - private geckoDownloadManager mDownloadManager; - private String mTheme = null; - private boolean mPreviousErrorPage = false; - private boolean mRemovableFromBackPressed = false; - private boolean mThemeChanged = false; - - /*Temp Variables*/ - private GeckoSession.HistoryDelegate.HistoryList mHistoryList = null; - private int rateCount=0; - private int m_current_url_id = -1; - private GeckoView mGeckoView; - private boolean mIsLoaded = false; - private boolean isFirstPaintExecuted = false; - private boolean mIsProgressBarChanging = false; - private Handler mFindHandler; - private boolean mClosed = false; - public SessionState mSessionState; - - geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){ - - this.mGeckoView = pGeckoView; - this.mContext = new WeakReference(mContext); - this.mSessionID = mSessionID; - this.event = event; - - onSessionReinit(); - setProgressDelegate(this); - setHistoryDelegate(this); - setNavigationDelegate(this); - setContentDelegate(this); - setAutoFillDelegate(); - setPermissionDelegate(this); - setScrollDelegate(this); - mDownloadManager = new geckoDownloadManager(); - setPromptDelegate(new geckoPromptView(mContext)); - setSelectionActionDelegate(new selectionActionDelegate(mContext, true)); - } - - public void onDestroy(){ - close(); - setProgressDelegate(null); - setHistoryDelegate(null); - setNavigationDelegate(null); - setContentDelegate(null); - setAutoFillDelegate(); - setPermissionDelegate(null); - setScrollDelegate(null); - mDownloadManager = null; - setPromptDelegate(null); - event = null; - mContext = null; - mDownloadManager = null; - mHistoryList = null; - mFindHandler = null; - mGeckoView = null; - } - - public void onSetInitializeFromStartup(){ - mIsLoaded = true; - } - - public boolean onGetInitializeFromStartup(){ - return mIsLoaded; - } - - public boolean onValidateInitializeFromStartup(){ - if(!mIsLoaded){ - mIsLoaded = true; - initURL(mCurrentURL); - return true; - } - return false; - } - - void onFileUploadRequest(int resultCode, Intent data){ - - geckoPromptView mPromptDelegate = (geckoPromptView)getPromptDelegate(); - Objects.requireNonNull(mPromptDelegate).onFileCallbackResult(resultCode,data); - } - - public void onSessionReinit(){ - mCrashCount = 0; - if(!isFirstPaintExecuted){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.ON_SESSION_REINIT); - }else { - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.ON_FIRST_PAINT); - } - - mFindHandler = new Handler(); - mFindHandler.postDelayed(() -> - { - if(mContext!=null){ - mContext.get().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); - - } - }, 1500); - - } - - void initURL(String url){ - if(mIsLoaded){ - mCrashCount = 0; - isPageLoading = true; - setURL(url); - mCurrentTitle = mCurrentURL; - - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion); - if(!url.equals("about:blank") && !url.equals("about:config")) - { - mProgress = 5; - onProgressStart(); - } - m_current_url_id = -1; - } - } - - /*Scroll Delegate*/ - @UiThread - public void onScrollChanged(@NonNull GeckoSession session, int scrollX, int scrollY) { - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); - } - - /*Autofill Delegate*/ - - public void setAutoFillDelegate(){ - this.setAutofillDelegate(new AndroidAutofillDelegate()); - } - - private class AndroidAutofillDelegate implements Autofill.Delegate { - - private Rect displayRectForId(@NonNull final GeckoSession session, - @NonNull final Autofill.Node node) { - final Matrix matrix = new Matrix(); - final RectF rectF = new RectF(node.getDimensions()); - session.getPageToScreenMatrix(matrix); - matrix.mapRect(rectF); - - final Rect screenRect = new Rect(); - rectF.roundOut(screenRect); - return screenRect; - } - - @Override - public void onAutofill(@NonNull final GeckoSession session, - final int notification, - final Autofill.Node node) { - ThreadUtils.assertOnUiThread(); - if (Build.VERSION.SDK_INT < 26) { - return; - } - - final AutofillManager manager = - mContext.get().getApplicationContext().getSystemService(AutofillManager.class); - if (manager == null) { - return; - } - - switch (notification) { - case Autofill.Notify.SESSION_STARTED: - case Autofill.Notify.SESSION_CANCELED: - manager.cancel(); - break; - case Autofill.Notify.SESSION_COMMITTED: - manager.commit(); - break; - case Autofill.Notify.NODE_FOCUSED: - manager.notifyViewEntered( - mGeckoView, node.getId(), - displayRectForId(session, node)); - break; - case Autofill.Notify.NODE_BLURRED: - manager.notifyViewExited(mGeckoView, node.getId()); - break; - case Autofill.Notify.NODE_UPDATED: - manager.notifyValueChanged( - mGeckoView, - node.getId(), - AutofillValue.forText(node.getValue())); - break; - case Autofill.Notify.NODE_ADDED: - case Autofill.Notify.NODE_REMOVED: - break; - } - } - } - /*Progress Delegate*/ - - @Override - public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) { - if(mIsLoaded){ - if(!isPageLoading){ - mCurrentTitle = "loading"; - m_current_url_id = -1; - //mTheme = null; - mThemeChanged = false; - } - isPageLoading = true; - if(!var2.equals("about:blank") && !mCurrentTitle.equals("loading")){ - mProgress = 5; - mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update)); - mThemeChanged = false; - } - } - } - - @UiThread - public void onPageStop(@NonNull GeckoSession var1, boolean var2) { - if(var2){ - if(mProgress>=100){ - //event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.on_update_favicon); - event.invokeObserver(Arrays.asList(null,mSessionID), enums.etype.on_page_loaded); - - if(!mThemeChanged){ - new Handler().postDelayed(() -> - { - if(!mThemeChanged){ - mTheme = null; - if(event!=null) { - event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); - } - } - }, 500); - } - } - } - } - - - @Override - public void onProgressChange(@NonNull GeckoSession session, int progress) - { - if(!mFullScreen){ - mProgress = progress; - - if(progress<=20) { - mIsProgressBarChanging = false; - mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update)); - }else { - if(progress==100){ - if(!mIsProgressBarChanging){ - mIsProgressBarChanging = true; - mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); - } - }else { - mIsProgressBarChanging = false; - mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); - } - } - } - - if(progress>=100){ - isPageLoading = false; - } - } - - public void onProgressStart(){ - if(!getCurrentURL().equals("about:blank") && !getCurrentURL().contains("genesishiddentechnologies.com") && !wasPreviousErrorPage() && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ - mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update)); - } - } - - public void onRedrawPixel(){ - event.invokeObserver(Arrays.asList("",mSessionID,mCurrentTitle, m_current_url_id, mTheme, false), dataEnums.eTabCommands.M_UPDATE_PIXEL); - } - - public boolean isLoaded(){ - return mProgress>=100; - } - - /*History Delegate*/ - @Override - public GeckoResult onVisited(@NonNull GeckoSession var1, @NonNull String var2, @Nullable String var3, int var4) { - if(var4==3 || var4==5 || var4==1){ - event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_url_load); - m_current_url_id = (int)event.invokeObserver(Arrays.asList(var2,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); - isPageLoading = false; - } - return null; - } - - @UiThread - public void onHistoryStateChange(@NonNull GeckoSession var1, @NonNull GeckoSession.HistoryDelegate.HistoryList var2) { - mHistoryList = var2; - } - - @UiThread - public void onSessionStateChange(@NonNull GeckoSession session, @NonNull SessionState sessionState) { - mSessionState = sessionState; - // if(!status.sRestoreTabs){ - // mSessionState = null; - // } - // if(mSessionState!=null) - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, mSessionState.toString()), enums.etype.M_UPDATE_SESSION_STATE); - } - - public boolean onRestoreState(){ - if(mSessionState!=null){ - restoreState(mSessionState); - return true; - }else { - return false; - } - } - - /*Navigation Delegate*/ - public void onLocationChange(@NonNull GeckoSession var1, @Nullable String var2) { - - if(!mIsLoaded){ - return; - } - if(wasBackPressed && mHistoryList.get(mHistoryList.getCurrentIndex()-1).getUri().equals(var2)){ - if(var2.equals("https://genesishiddentechnologies.com") || var2.startsWith(CONST_GENESIS_URL_CACHED) || var2.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ - if(var2.startsWith(CONST_GENESIS_URL_CACHED_DARK) && (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get()))){ - isPageLoading = false; - event.invokeObserver(null, enums.etype.M_CHANGE_HOME_THEME); - } - else if(var2.startsWith(CONST_GENESIS_URL_CACHED) && (status.sTheme != enums.Theme.THEME_LIGHT && !helperMethod.isDayMode(mContext.get()))){ - isPageLoading = false; - event.invokeObserver(null, enums.etype.M_CHANGE_HOME_THEME); - } - } - } - wasBackPressed = false; - - String newUrl = Objects.requireNonNull(var2).split("#")[0]; - if(!mCurrentTitle.equals("loading")){ - m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); - } - if(newUrl.startsWith(CONST_GENESIS_URL_CACHED) || newUrl.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ - setURL(constants.CONST_GENESIS_DOMAIN_URL); - } - else if(newUrl.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){ - if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())){ - setURL(constants.CONST_GENESIS_HELP_URL); - }else { - setURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); - } - }else if(!newUrl.equals("about:blank")){ - setURL(newUrl); - } - if(!mCurrentURL.equals("about:blank")){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); - } - } - - private String setGenesisVerificationToken(String pString){ - try{ - Uri built = Uri.parse(pString).buildUpon() - .appendQueryParameter(constants.CONST_GENESIS_GMT_TIME_GET_KEY, URLEncoder.encode(helperMethod.caesarCipherEncrypt(trueTime.getInstance().getGMT(),new SecretKeySpec(constants.CONST_ENCRYPTION_KEY.getBytes(), "AES")), "utf-8")) - .appendQueryParameter(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY, URLEncoder.encode(helperMethod.caesarCipherEncrypt(trueTime.getInstance().getLTZ(),new SecretKeySpec(constants.CONST_ENCRYPTION_KEY.getBytes(), "AES")), "utf-8")) - .build(); - return built.toString(); - }catch (Exception ex){ - return pString; - } - } - - public GeckoResult onLoadRequest(@NonNull GeckoSession var2, @NonNull GeckoSession.NavigationDelegate.LoadRequest var1) { - mPreviousErrorPage = false; - if(!var1.uri.startsWith(CONST_GENESIS_URL_CACHED) && !var1.uri.startsWith(CONST_GENESIS_URL_CACHED_DARK) && var1.uri.startsWith("https://genesishiddentechnologies.com") && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY) && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY)){ - String mVerificationURL = setGenesisVerificationToken(var1.uri); - initURL(mVerificationURL); - loadUri(mVerificationURL); - return GeckoResult.fromValue(AllowOrDeny.DENY); - } - else if(var1.uri.startsWith("mailto")){ - event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.M_ON_MAIL); - return GeckoResult.fromValue(AllowOrDeny.ALLOW); - } - else if(var1.uri.contains("genesishiddentechnologies.com/advert__")){ - event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.on_playstore_load); - return GeckoResult.fromValue(AllowOrDeny.DENY); - } - else if(var1.uri.equals(constants.CONST_GENESIS_DOMAIN_URL_SLASHED) || var1.uri.startsWith("https://genesishiddentechnologies.com/?")){ - initURL(constants.CONST_GENESIS_DOMAIN_URL); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_LOAD_HOMEPAGE_GENESIS); - return GeckoResult.fromValue(AllowOrDeny.DENY); - } - else if(var1.uri.equals("about:blank") && mIsLoaded){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_EXPAND_TOP_BAR); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE); - return GeckoResult.fromValue(AllowOrDeny.ALLOW); - } - else if(var1.target==2){ - event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.open_new_tab); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_EXPAND_TOP_BAR); - return GeckoResult.fromValue(AllowOrDeny.DENY); - } - else if(!var1.uri.equals("about:blank")){ - if(mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ - setURL(constants.CONST_GENESIS_DOMAIN_URL); - }else if(mCurrentURL.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){ - if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())){ - setURL(constants.CONST_GENESIS_HELP_URL); - }else { - setURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); - } - }else if(!var1.uri.startsWith("resource://android/assets/homepage/")){ - setURL(var1.uri); - } - - event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.start_proxy); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.search_update); - checkApplicationRate(); - - /* Its Absence causes delay on first launch*/ - - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); - - if(!mCurrentURL.contains("genesishiddentechnologies.com")){ - mProgress = 5; - onProgressStart(); - } - - return GeckoResult.fromValue(AllowOrDeny.ALLOW); - }else { - return GeckoResult.fromValue(AllowOrDeny.DENY); - } - } - - public void onUpdateBannerAdvert(){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE); - } - - public void onClose(){ - stop(); - mCurrentURL = mPrevURL; - //mIsLoaded = false; - //isPageLoading = false; - } - - @Override - public void onCanGoBack(@NonNull GeckoSession session, boolean var2) - { - mCanGoBack = var2; - } - - @Override - public void onCanGoForward(@NonNull GeckoSession session, boolean var2) - { - mCanGoForward = var2; - } - - - public GeckoResult onLoadError(@NonNull GeckoSession var1, @Nullable String var2, WebRequestError var3) { - if(status.sSettingIsAppStarted){ - errorHandler handler = new errorHandler(); - mProgress = 0; - mPreviousErrorPage = true; - event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); - - InputStream mResourceURL = null; - try { - if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())){ - mResourceURL = mContext.get().getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED); - }else { - mResourceURL = mContext.get().getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED_DARK); - } - }catch (Exception ignored){ - - } - - return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code,mContext.get(),var2, mResourceURL)); - } - return null; - } - - /*Content Delegate*/ - @UiThread - @Override - public void onExternalResponse(@NonNull GeckoSession session, @NonNull WebResponse response) { - try { - if(response.headers.containsKey("Content-Disposition")){ - mDownloadManager.downloadFile(response,this,mContext.get(),event); - }else if(response.headers.containsKey("Content-Type")){ - mDownloadManager.downloadFile(response,this,mContext.get(),event); - } - } catch (ActivityNotFoundException e) { - event.invokeObserver(Arrays.asList(response,mSessionID), enums.etype.on_handle_external_intent); - stop(); - } - } - - @UiThread - public void onExternalResponse(@NonNull GeckoSession session, @NonNull GeckoSession.WebResponseInfo response){ - - } - - @UiThread - public void onFirstContentfulPaint(@NonNull GeckoSession var1) { - - isFirstPaintExecuted = true; - if(mPreviousErrorPage || mCurrentURL.contains("genesishiddentechnologies.com") || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK) || mCurrentURL.startsWith(CONST_GENESIS_HELP_URL_CACHE) || mCurrentURL.toString().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE); - }else { - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, true), enums.etype.M_ON_BANNER_UPDATE); - } - - if(!mCurrentURL.equals("about:blank")){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id,mTheme), enums.etype.ON_FIRST_PAINT); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id,mTheme), enums.etype.ON_LOAD_REQUEST); - }else { - onSessionReinit(); - } - - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_EXPAND_TOP_BAR); - mPrevURL = mCurrentURL; - } - - @UiThread - public GeckoResult onSlowScript(@NonNull GeckoSession var1, @NonNull String var2) { - return null; - } - - @UiThread - public void onWebAppManifest(@NonNull GeckoSession var1, @NonNull JSONObject var2) { - try { - mThemeChanged = true; - mTheme = var2.getString("theme_color"); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); - } catch (Exception ex) { - mTheme = null; - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); - ex.printStackTrace(); - } - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.ON_UPDATE_TAB_TITLE); - } - - @UiThread - public void onTitleChange(@NonNull GeckoSession var1, @Nullable String var2) { - if(var2!=null && !var2.equals(strings.GENERIC_EMPTY_STR) && var2.length()>2 && !var2.equals("about:blank") && mIsLoaded){ - mCurrentTitle = var2; - m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_TAB_TITLE); - } - } - - @UiThread - public void onCloseRequest(@NonNull GeckoSession var1) { - if(!canGoBack() && !mClosed){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.back_list_empty); - } - } - - int mCrashCount = 0; - @UiThread - public void onCrash(@NonNull GeckoSession session) { - if(!mClosed){ - String mSessionID = (String) event.invokeObserver(null, enums.etype.SESSION_ID); - if(mSessionID.equals(getSessionID())){ - if(mCrashCount<=5){ - final Handler handler = new Handler(); - handler.postDelayed(() -> { - if(!session.isOpen()){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.M_OPEN_SESSION); - } - }, mCrashCount*500); - } - mCrashCount+=1; - } - } - } - - @UiThread - public void onKill(@NonNull GeckoSession session) { - if(!mClosed){ - String mSessionID = (String) event.invokeObserver(null, enums.etype.SESSION_ID); - if(mSessionID.equals(getSessionID())){ - if(mCrashCount<=5){ - final Handler handler = new Handler(); - handler.postDelayed(() -> { - if(!session.isOpen()){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.M_OPEN_SESSION); - } - }, mCrashCount*500); - } - mCrashCount+=1; - } - } - } - - @Override - public void onFullScreen(@NonNull GeckoSession var1, boolean var2) { - mFullScreen = var2; - event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_full_screen); - } - - @UiThread - @Override - public void onContextMenu(@NonNull GeckoSession var1, int var2, int var3, @NonNull GeckoSession.ContentDelegate.ContextElement var4) { - - String title = strings.GENERIC_EMPTY_STR; - if(var4.title!=null){ - title = var4.title; - } - if(var4.type!=0){ - if(var4.linkUri!=null){ - event.invokeObserver(Arrays.asList(var4.linkUri,mSessionID,var4.srcUri,title, mTheme, mContext.get()), M_LONG_PRESS_WITH_LINK); - } - else { - try{ - event.invokeObserver(Arrays.asList(var4.srcUri,mSessionID,title, mTheme, mContext.get()), enums.etype.on_long_press); - }catch (Exception ex){ - ex.printStackTrace(); - Log.i("",""); - } - } - } - else{ - event.invokeObserver(Arrays.asList(var4.linkUri,mSessionID,title, mTheme, mContext.get()), M_LONG_PRESS_URL); - } - } - - /*Permission Delegate*/ - - @Override - public void onContentPermissionRequest(final GeckoSession session, final String uri, - final int type, final Callback callback) { - if (PERMISSION_AUTOPLAY_AUDIBLE == type || PERMISSION_AUTOPLAY_INAUDIBLE == type) { - if (!status.sToolbarTheme) { - callback.reject(); - } else { - callback.grant(); - } - }else { - callback.reject(); - } - } - /*Download Manager*/ - - void downloadRequestedFile() - { - if(mDownloadManager.getDownloadURL()!=null && mDownloadManager.getDownloadFile()!=null){ - if(!createAndSaveFileFromBase64Url(mDownloadManager.getDownloadURL().toString())){ - pluginController.getInstance().onDownloadInvoke(Arrays.asList(mDownloadManager.getDownloadURL()+"__"+mDownloadManager.getDownloadFile(), Environment.DIRECTORY_DOWNLOADS), pluginEnums.eDownloadManager.M_START_SERVICE); - } - } - } - - void downloadRequestedFile(Uri downloadURL,String downloadFile) - { - if(downloadURL!=null && downloadFile!=null){ - if(!createAndSaveFileFromBase64Url(downloadURL.toString())){ - pluginController.getInstance().onDownloadInvoke(Arrays.asList(downloadURL + "__" + downloadFile, Environment.DIRECTORY_DOWNLOADS), pluginEnums.eDownloadManager.M_START_SERVICE); - } - } - } - - private void saveImage(Bitmap finalBitmap) { - - String root = Environment.getExternalStorageDirectory().toString(); - File myDir = new File(root + "/saved_images"); - myDir.mkdirs(); - - String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); - String fname = "Shutta_"+ timeStamp +".jpg"; - - File file = new File(myDir, fname); - if (file.exists()) file.delete (); - try { - FileOutputStream out = new FileOutputStream(file); - finalBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); - out.flush(); - out.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /* Checks if external storage is available for read and write */ - public boolean isExternalStorageWritable() { - String state = Environment.getExternalStorageState(); - if (Environment.MEDIA_MOUNTED.equals(state)) { - return true; - } - return false; - } - - private boolean createAndSaveFileFromBase64Url(String url) { - - try{ - if(!url.startsWith("data") && !url.startsWith("blob")){ - return false; - } - - File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); - - String filetype; - String filename; - - if(url.startsWith("blob")){ - loadUri((String) pluginController.getInstance().onDownloadInvoke(Collections.singletonList(url), pluginEnums.eDownloadManager.M_DOWNLOAD_BLOB)); - return true; - } - - filetype = url.substring(url.indexOf("/") + 1, url.indexOf(";")); - filename = System.currentTimeMillis() + "." + filetype; - - File file = new File(path, filename); - try { - if(!path.exists()) - path.mkdirs(); - if(!file.exists()) - file.createNewFile(); - - String base64EncodedString = url.substring(url.indexOf(",") + 1); - byte[] decodedBytes = Base64.decode(base64EncodedString, Base64.DEFAULT); - OutputStream os = new FileOutputStream(file); - os.write(decodedBytes); - os.close(); - - //Tell the media scanner about the new file so that it is immediately available to the user. - MediaScannerConnection.scanFile(mContext.get().getApplicationContext(), - new String[]{file.toString()}, null, - (path1, uri) -> - { - Log.i("ExternalStorage", "Scanned " + path1 + ":"); - Log.i("ExternalStorage", "-> uri=" + uri); - }); - - //Set notification after download complete and add "click to view" action to that - String mimetype = url.substring(url.indexOf(":") + 1, url.indexOf("/")); - Intent intent = new Intent(); - intent.setAction(android.content.Intent.ACTION_VIEW); - Uri uri_temp = FileProvider.getUriForFile(mContext.get().getApplicationContext(),mContext.get().getString(R.string.GENERAL_FILE_PROVIDER_AUTHORITY), file); - intent.setDataAndType(uri_temp, (mimetype + "/*")); - - List resInfoList = mContext.get().getApplicationContext().getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); - for (ResolveInfo resolveInfo : resInfoList) { - String packageName = resolveInfo.activityInfo.packageName; - mUriPermission = uri_temp; - mContext.get().getApplicationContext().grantUriPermission(packageName, uri_temp, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); - } - PendingIntent pIntent = PendingIntent.getActivity(mContext.get().getApplicationContext(), 0, intent, 0); - - String channel_id = createNotificationChannel(mContext.get().getApplicationContext()); - - NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext.get().getApplicationContext(), channel_id) - .setSmallIcon(R.drawable.ic_download) - .setContentTitle(filename) - .setContentIntent(pIntent); - - notificationBuilder.setAutoCancel(true); - - int notificationId = 85851; - NotificationManager notificationManager = (NotificationManager) mContext.get().getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); - notificationManager.notify(notificationId, notificationBuilder.build()); - - } catch (Exception e) { - e.printStackTrace(); - } - - return true; - } - catch (Exception ex){ - ex.printStackTrace(); - } - - return true; - } - - private static String createNotificationChannel(Context context) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - - String channelId = "Channel_id"; - CharSequence channelName = "Application_name"; - String channelDescription = "Application_name Alert"; - int channelImportance = NotificationManager.IMPORTANCE_DEFAULT; - NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, channelImportance); - notificationChannel.setDescription(channelDescription); - notificationChannel.enableVibration(true); - NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - assert notificationManager != null; - notificationManager.createNotificationChannel(notificationChannel); - return channelId; - } else { - return null; - } - } - - /*Helper Methods*/ - - void toogleUserAgent(){ - if(getSettings().getUserAgentMode()==USER_AGENT_MODE_DESKTOP){ - getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); - }else { - getSettings().setUserAgentMode(USER_AGENT_MODE_DESKTOP); - } - - } - - int getUserAgentMode(){ - return getSettings().getUserAgentMode(); - } - - public String getCurrentURL(){ - if(mCurrentURL.equals("resource://android/assets/Homepage/homepage.html") || mCurrentURL.equals("resource://android/assets/Homepage/homepage-dark.html")){ - //setURL("https://genesishiddentechnologies.com"); - } - return mCurrentURL; - } - - public String getTitle(){ - return mCurrentTitle; - } - - public int getProgress(){ - return mProgress; - } - - public void setTitle(String title){ - mCurrentTitle = title; - } - - public void setURL(String pURL){ - mCurrentURL = pURL; - } - - public void setRemovableFromBackPressed(boolean pStatus){ - mRemovableFromBackPressed = pStatus; - } - - public boolean getRemovableFromBackPressed(){ - return mRemovableFromBackPressed; - } - - public void setTheme(String pTheme){ - mTheme = pTheme; - } - - public String getTheme(){ - return mTheme; - } - boolean canGoBack(){ - if(mHistoryList==null || mHistoryList.size()==0){ - return false; - } - return mCanGoBack; - } - - public boolean wasPreviousErrorPage(){ - return mPreviousErrorPage; - } - - boolean canGoForward(){ - return mCanGoForward; - } - - public String getSessionID(){ - return mSessionID; - } - - public void setSessionID(String pSession){ - mSessionID = pSession; - } - - void exitScreen(){ - this.exitFullScreen(); - } - - boolean getFullScreenStatus(){ - return !mFullScreen; - } - - public void closeSession(){ - event.invokeObserver(Arrays.asList(null,mSessionID), enums.etype.on_close_sesson); - } - - public void closeSessionInstant(){ - mSessionID = "-1"; - mClosed = true; - close(); - } - - public boolean isClosed(){ - return mClosed; - } - - GeckoResult mFinder = null; - public void findInPage(String pQuery, int pDirection){ - mFinder = null; - mFinder = getFinder().find(pQuery, pDirection); - new Thread(){ - public void run(){ - - int mCounter=0; - while (mFinder==null){ - try { - mCounter+=1; - sleep(100); - if(mCounter>100){ - return; - } - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - try { - FinderResult mResult = mFinder.poll(1000); - event.invokeObserver(Arrays.asList(mResult.total, mResult.current), enums.etype.FINDER_RESULT_CALLBACK); - } catch (Throwable throwable) { - throwable.printStackTrace(); - } - } - }.start(); - - } - - void goBackSession(){ - wasBackPressed = true; - goBack(); - } - - void goForwardSession(){ - - if(mHistoryList!=null) - { - stop(); - int index = mHistoryList.getCurrentIndex() + 1; - initURL(mHistoryList.get(index).getUri()); - if(mHistoryList.size()>index){ - event.invokeObserver(Arrays.asList(mHistoryList.get(index).getUri(), mSessionID), enums.etype.start_proxy); - } - final Handler handler = new Handler(); - handler.postDelayed(this::goForward, 100); - mProgress = 5; - event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced); - event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK); - }else { - final Handler handler = new Handler(); - handler.postDelayed(this::goForward, 100); - mProgress = 5; - event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced); - event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK); - } - } - - boolean isLoading(){ - return isPageLoading; - } - - void setLoading(boolean status){ - isPageLoading = status; - } - - Uri getUriPermission(){ - return mUriPermission; - } - - private void checkApplicationRate(){ - if(status.sSettingIsAppStarted){ - if(status.sRateCount==40){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), M_RATE_APPLICATION); - } - status.sRateCount+=1; - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), M_RATE_COUNT); - } - } -} +package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; + +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.ActivityNotFoundException; +import android.content.Context; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.graphics.Bitmap; +import android.graphics.Matrix; +import android.graphics.Rect; +import android.graphics.RectF; +import android.media.MediaScannerConnection; +import android.net.Uri; +import android.os.Build; +import android.os.Environment; +import android.os.Handler; +import android.util.Base64; +import android.util.Log; +import android.view.autofill.AutofillManager; +import android.view.autofill.AutofillValue; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.UiThread; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.NotificationCompat; +import androidx.core.content.FileProvider; + +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.libs.trueTime.trueTime; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import org.json.JSONObject; +import org.mozilla.gecko.util.ThreadUtils; +import org.mozilla.geckoview.AllowOrDeny; +import org.mozilla.geckoview.Autofill; +import org.mozilla.geckoview.GeckoResult; +import org.mozilla.geckoview.GeckoSession; +import org.mozilla.geckoview.GeckoView; +import org.mozilla.geckoview.SlowScriptResponse; +import org.mozilla.geckoview.WebRequestError; +import org.mozilla.geckoview.WebResponse; +import org.torproject.android.proxy.wrapper.orbotLocalConstants; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.ref.WeakReference; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Objects; +import javax.crypto.spec.SecretKeySpec; + +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED; +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED_DARK; +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; +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.enums.etype.M_RATE_COUNT; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; +import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; +import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; + +public class +geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSession.ScrollDelegate,GeckoSession.PermissionDelegate,GeckoSession.ProgressDelegate, GeckoSession.HistoryDelegate,GeckoSession.NavigationDelegate,GeckoSession.ContentDelegate +{ + private eventObserver.eventListener event; + + private boolean wasBackPressed = false; + private String mSessionID; + private boolean mCanGoBack = false; + private boolean mCanGoForward = false; + private boolean mFullScreen = false; + private boolean isPageLoading = false; + private int mProgress = 0; + private String mPrevURL = "about:blank"; + private String mCurrentTitle = "loading"; + private String mCurrentURL = "about:blank"; + private Uri mUriPermission = null; + private WeakReference mContext; + private geckoDownloadManager mDownloadManager; + private String mTheme = null; + private boolean mPreviousErrorPage = false; + private boolean mRemovableFromBackPressed = false; + private boolean mThemeChanged = false; + + /*Temp Variables*/ + private GeckoSession.HistoryDelegate.HistoryList mHistoryList = null; + private int rateCount=0; + private int m_current_url_id = -1; + private GeckoView mGeckoView; + private boolean mIsLoaded = false; + private boolean isFirstPaintExecuted = false; + private boolean mIsProgressBarChanging = false; + private Handler mFindHandler; + private boolean mClosed = false; + public SessionState mSessionState; + + geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){ + + this.mGeckoView = pGeckoView; + this.mContext = new WeakReference(mContext); + this.mSessionID = mSessionID; + this.event = event; + + onSessionReinit(); + setProgressDelegate(this); + setHistoryDelegate(this); + setNavigationDelegate(this); + setContentDelegate(this); + setAutoFillDelegate(); + setPermissionDelegate(this); + setScrollDelegate(this); + mDownloadManager = new geckoDownloadManager(); + setPromptDelegate(new geckoPromptView(mContext)); + setSelectionActionDelegate(new selectionActionDelegate(mContext, true)); + } + + public void onDestroy(){ + close(); + setProgressDelegate(null); + setHistoryDelegate(null); + setNavigationDelegate(null); + setContentDelegate(null); + setAutoFillDelegate(); + setPermissionDelegate(null); + setScrollDelegate(null); + mDownloadManager = null; + setPromptDelegate(null); + event = null; + mContext = null; + mDownloadManager = null; + mHistoryList = null; + mFindHandler = null; + mGeckoView = null; + } + + public void onSetInitializeFromStartup(){ + mIsLoaded = true; + } + + public boolean onGetInitializeFromStartup(){ + return mIsLoaded; + } + + public boolean onValidateInitializeFromStartup(){ + if(!mIsLoaded){ + mIsLoaded = true; + initURL(mCurrentURL); + return true; + } + return false; + } + + void onFileUploadRequest(int resultCode, Intent data){ + + geckoPromptView mPromptDelegate = (geckoPromptView)getPromptDelegate(); + Objects.requireNonNull(mPromptDelegate).onFileCallbackResult(resultCode,data); + } + + public void onSessionReinit(){ + mCrashCount = 0; + if(!isFirstPaintExecuted){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.ON_SESSION_REINIT); + }else { + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.ON_FIRST_PAINT); + } + + mFindHandler = new Handler(); + mFindHandler.postDelayed(() -> + { + if(mContext!=null){ + mContext.get().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); + + } + }, 1500); + + } + + void initURL(String url){ + if(mIsLoaded){ + mCrashCount = 0; + isPageLoading = true; + setURL(url); + mCurrentTitle = mCurrentURL; + + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion); + if(!url.equals("about:blank") && !url.equals("about:config")) + { + mProgress = 5; + onProgressStart(); + } + m_current_url_id = -1; + } + } + + /*Scroll Delegate*/ + @UiThread + public void onScrollChanged(@NonNull GeckoSession session, int scrollX, int scrollY) { + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); + } + + /*Autofill Delegate*/ + + public void setAutoFillDelegate(){ + this.setAutofillDelegate(new AndroidAutofillDelegate()); + } + + private class AndroidAutofillDelegate implements Autofill.Delegate { + + private Rect displayRectForId(@NonNull final GeckoSession session, + @NonNull final Autofill.Node node) { + final Matrix matrix = new Matrix(); + final RectF rectF = new RectF(node.getDimensions()); + session.getPageToScreenMatrix(matrix); + matrix.mapRect(rectF); + + final Rect screenRect = new Rect(); + rectF.roundOut(screenRect); + return screenRect; + } + + @Override + public void onAutofill(@NonNull final GeckoSession session, + final int notification, + final Autofill.Node node) { + ThreadUtils.assertOnUiThread(); + if (Build.VERSION.SDK_INT < 26) { + return; + } + + final AutofillManager manager = + mContext.get().getApplicationContext().getSystemService(AutofillManager.class); + if (manager == null) { + return; + } + + switch (notification) { + case Autofill.Notify.SESSION_STARTED: + case Autofill.Notify.SESSION_CANCELED: + manager.cancel(); + break; + case Autofill.Notify.SESSION_COMMITTED: + manager.commit(); + break; + case Autofill.Notify.NODE_FOCUSED: + manager.notifyViewEntered( + mGeckoView, node.getId(), + displayRectForId(session, node)); + break; + case Autofill.Notify.NODE_BLURRED: + manager.notifyViewExited(mGeckoView, node.getId()); + break; + case Autofill.Notify.NODE_UPDATED: + manager.notifyValueChanged( + mGeckoView, + node.getId(), + AutofillValue.forText(node.getValue())); + break; + case Autofill.Notify.NODE_ADDED: + case Autofill.Notify.NODE_REMOVED: + break; + } + } + } + /*Progress Delegate*/ + + @Override + public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) { + if(mIsLoaded){ + event.invokeObserver(Arrays.asList(var2,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + if(!isPageLoading){ + mCurrentTitle = "loading"; + m_current_url_id = -1; + mThemeChanged = false; + } + isPageLoading = true; + if(!var2.equals("about:blank") && !mCurrentTitle.equals("loading")){ + mProgress = 5; + mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update)); + mThemeChanged = false; + } + } + } + + @UiThread + public @Nullable GeckoResult onSlowScript(@NonNull final GeckoSession geckoSession, @NonNull final String scriptFileName) { + return null; + } + + @UiThread + public void onPageStop(@NonNull GeckoSession var1, boolean var2) { + if(var2){ + if(mProgress>=100){ + //event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.on_update_favicon); + event.invokeObserver(Arrays.asList(null,mSessionID), enums.etype.on_page_loaded); + + if(!mThemeChanged){ + new Handler().postDelayed(() -> + { + if(!mThemeChanged){ + mTheme = null; + if(event!=null) { + event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); + } + } + }, 500); + } + } + } + } + + + @Override + public void onProgressChange(@NonNull GeckoSession session, int progress) + { + if(!mFullScreen){ + mProgress = progress; + + if(progress<=20) { + mIsProgressBarChanging = false; + mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update)); + }else { + if(progress==100){ + if(!mIsProgressBarChanging){ + mIsProgressBarChanging = true; + mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); + } + }else { + mIsProgressBarChanging = false; + mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); + } + } + } + + if(progress>=100){ + isPageLoading = false; + } + } + + public void onProgressStart(){ + if(!getCurrentURL().equals("about:blank") && !getCurrentURL().contains("genesishiddentechnologies.com") && !wasPreviousErrorPage() && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update)); + } + } + + public void onRedrawPixel(){ + event.invokeObserver(Arrays.asList("",mSessionID,mCurrentTitle, m_current_url_id, mTheme, false), dataEnums.eTabCommands.M_UPDATE_PIXEL); + } + + public boolean isLoaded(){ + return mProgress>=100; + } + + /*History Delegate*/ + @Override + public GeckoResult onVisited(@NonNull GeckoSession var1, @NonNull String var2, @Nullable String var3, int var4) { + if(var4==3 || var4==5 || var4==1){ + event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_url_load); + m_current_url_id = (int)event.invokeObserver(Arrays.asList(var2,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); + isPageLoading = false; + } + return null; + } + + @UiThread + public void onHistoryStateChange(@NonNull GeckoSession var1, @NonNull GeckoSession.HistoryDelegate.HistoryList var2) { + mHistoryList = var2; + } + + @UiThread + public void onSessionStateChange(@NonNull GeckoSession session, @NonNull SessionState sessionState) { + mSessionState = sessionState; + // if(!status.sRestoreTabs){ + // mSessionState = null; + // } + // if(mSessionState!=null) + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, mSessionState.toString()), enums.etype.M_UPDATE_SESSION_STATE); + } + + public boolean onRestoreState(){ + if(mSessionState!=null){ + restoreState(mSessionState); + return true; + }else { + return false; + } + } + + /*Navigation Delegate*/ + public void onLocationChange(@NonNull GeckoSession var1, @Nullable String var2) { + + if(!mIsLoaded){ + return; + } + if(wasBackPressed && mHistoryList.get(mHistoryList.getCurrentIndex()-1).getUri().equals(var2)){ + if(var2.equals("https://genesishiddentechnologies.com") || var2.startsWith(CONST_GENESIS_URL_CACHED) || var2.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ + if(var2.startsWith(CONST_GENESIS_URL_CACHED_DARK) && (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get()))){ + isPageLoading = false; + event.invokeObserver(null, enums.etype.M_CHANGE_HOME_THEME); + } + else if(var2.startsWith(CONST_GENESIS_URL_CACHED) && (status.sTheme != enums.Theme.THEME_LIGHT && !helperMethod.isDayMode(mContext.get()))){ + isPageLoading = false; + event.invokeObserver(null, enums.etype.M_CHANGE_HOME_THEME); + } + } + } + wasBackPressed = false; + + String newUrl = Objects.requireNonNull(var2).split("#")[0]; + if(!mCurrentTitle.equals("loading")){ + m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); + } + if(newUrl.startsWith(CONST_GENESIS_URL_CACHED) || newUrl.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ + setURL(constants.CONST_GENESIS_DOMAIN_URL); + } + else if(newUrl.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){ + if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())){ + setURL(constants.CONST_GENESIS_HELP_URL); + }else { + setURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); + } + }else if(!newUrl.equals("about:blank")){ + setURL(newUrl); + } + if(!mCurrentURL.equals("about:blank")){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + } + } + + private String setGenesisVerificationToken(String pString){ + try{ + Uri built = Uri.parse(pString).buildUpon() + .appendQueryParameter(constants.CONST_GENESIS_GMT_TIME_GET_KEY, URLEncoder.encode(helperMethod.caesarCipherEncrypt(trueTime.getInstance().getGMT(),new SecretKeySpec(constants.CONST_ENCRYPTION_KEY.getBytes(), "AES")), "utf-8")) + .appendQueryParameter(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY, URLEncoder.encode(helperMethod.caesarCipherEncrypt(trueTime.getInstance().getLTZ(),new SecretKeySpec(constants.CONST_ENCRYPTION_KEY.getBytes(), "AES")), "utf-8")) + .build(); + return built.toString(); + }catch (Exception ex){ + return pString; + } + } + + public GeckoResult onLoadRequest(@NonNull GeckoSession var2, @NonNull GeckoSession.NavigationDelegate.LoadRequest var1) { + mPreviousErrorPage = false; + if(!var1.uri.startsWith(CONST_GENESIS_URL_CACHED) && !var1.uri.startsWith(CONST_GENESIS_URL_CACHED_DARK) && var1.uri.startsWith("https://genesishiddentechnologies.com") && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY) && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY)){ + String mVerificationURL = setGenesisVerificationToken(var1.uri); + initURL(mVerificationURL); + loadUri(mVerificationURL); + return GeckoResult.fromValue(AllowOrDeny.DENY); + } + else if(var1.uri.startsWith("mailto")){ + event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.M_ON_MAIL); + return GeckoResult.fromValue(AllowOrDeny.ALLOW); + } + else if(var1.uri.contains("genesishiddentechnologies.com/advert__")){ + event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.on_playstore_load); + return GeckoResult.fromValue(AllowOrDeny.DENY); + } + else if(var1.uri.equals(constants.CONST_GENESIS_DOMAIN_URL_SLASHED) || var1.uri.startsWith("https://genesishiddentechnologies.com/?")){ + initURL(constants.CONST_GENESIS_DOMAIN_URL); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_LOAD_HOMEPAGE_GENESIS); + return GeckoResult.fromValue(AllowOrDeny.DENY); + } + else if(var1.uri.equals("about:blank") && mIsLoaded){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_EXPAND_TOP_BAR); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE); + return GeckoResult.fromValue(AllowOrDeny.ALLOW); + } + else if(var1.target==2){ + event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.open_new_tab); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_EXPAND_TOP_BAR); + return GeckoResult.fromValue(AllowOrDeny.DENY); + } + else if(!var1.uri.equals("about:blank")){ + if(mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ + setURL(constants.CONST_GENESIS_DOMAIN_URL); + }else if(mCurrentURL.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){ + if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())){ + setURL(constants.CONST_GENESIS_HELP_URL); + }else { + setURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); + } + }else if(!var1.uri.startsWith("resource://android/assets/homepage/")){ + setURL(var1.uri); + } + + event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.start_proxy); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.search_update); + checkApplicationRate(); + + /* Its Absence causes delay on first launch*/ + + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + + if(!mCurrentURL.contains("genesishiddentechnologies.com")){ + mProgress = 5; + onProgressStart(); + } + + return GeckoResult.fromValue(AllowOrDeny.ALLOW); + }else { + return GeckoResult.fromValue(AllowOrDeny.DENY); + } + } + + public void onUpdateBannerAdvert(){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE); + } + + public void onClose(){ + stop(); + mCurrentURL = mPrevURL; + //mIsLoaded = false; + //isPageLoading = false; + } + + @Override + public void onCanGoBack(@NonNull GeckoSession session, boolean var2) + { + mCanGoBack = var2; + } + + @Override + public void onCanGoForward(@NonNull GeckoSession session, boolean var2) + { + mCanGoForward = var2; + } + + + public GeckoResult onLoadError(@NonNull GeckoSession var1, @Nullable String var2, WebRequestError var3) { + if(status.sSettingIsAppStarted && orbotLocalConstants.mIsTorInitialized){ + errorHandler handler = new errorHandler(); + mProgress = 0; + mPreviousErrorPage = true; + event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); + + InputStream mResourceURL = null; + try { + if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())){ + mResourceURL = mContext.get().getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED); + }else { + mResourceURL = mContext.get().getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED_DARK); + } + }catch (Exception ignored){ + + } + + return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code,mContext.get(),var2, mResourceURL)); + }else { + event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.M_ORBOT_LOADING); + mCurrentURL = mPrevURL; + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + } + return null; + } + + /*Content Delegate*/ + @UiThread + @Override + public void onExternalResponse(@NonNull GeckoSession session, @NonNull WebResponse response) { + try { + if(response.headers.containsKey("Content-Disposition")){ + mDownloadManager.downloadFile(response,this,mContext.get(),event); + }else if(response.headers.containsKey("Content-Type")){ + mDownloadManager.downloadFile(response,this,mContext.get(),event); + } + } catch (ActivityNotFoundException e) { + event.invokeObserver(Arrays.asList(response,mSessionID), enums.etype.on_handle_external_intent); + stop(); + } + } + + @UiThread + public void onExternalResponse(@NonNull GeckoSession session, @NonNull GeckoSession.WebResponseInfo response){ + + } + + @UiThread + public void onFirstContentfulPaint(@NonNull GeckoSession var1) { + + isFirstPaintExecuted = true; + if(mPreviousErrorPage || mCurrentURL.contains("genesishiddentechnologies.com") || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK) || mCurrentURL.startsWith(CONST_GENESIS_HELP_URL_CACHE) || mCurrentURL.toString().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE); + }else { + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, true), enums.etype.M_ON_BANNER_UPDATE); + } + + if(!mCurrentURL.equals("about:blank")){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id,mTheme), enums.etype.ON_FIRST_PAINT); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id,mTheme), enums.etype.ON_LOAD_REQUEST); + }else { + onSessionReinit(); + } + + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_EXPAND_TOP_BAR); + mPrevURL = mCurrentURL; + } + + @UiThread + public void onWebAppManifest(@NonNull GeckoSession var1, @NonNull JSONObject var2) { + try { + mThemeChanged = true; + mTheme = var2.getString("theme_color"); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); + } catch (Exception ex) { + mTheme = null; + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); + ex.printStackTrace(); + } + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.ON_UPDATE_TAB_TITLE); + } + + @UiThread + public void onTitleChange(@NonNull GeckoSession var1, @Nullable String var2) { + if(var2!=null && !var2.equals(strings.GENERIC_EMPTY_STR) && var2.length()>2 && !var2.equals("about:blank") && mIsLoaded){ + mCurrentTitle = var2; + m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_TAB_TITLE); + } + } + + @UiThread + public void onCloseRequest(@NonNull GeckoSession var1) { + if(!canGoBack() && !mClosed){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.back_list_empty); + } + } + + int mCrashCount = 0; + @UiThread + public void onCrash(@NonNull GeckoSession session) { + if(!mClosed){ + String mSessionID = (String) event.invokeObserver(null, enums.etype.SESSION_ID); + if(mSessionID.equals(getSessionID())){ + if(mCrashCount<=5){ + final Handler handler = new Handler(); + handler.postDelayed(() -> { + if(!session.isOpen()){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.M_OPEN_SESSION); + } + }, mCrashCount*500); + } + mCrashCount+=1; + } + } + } + + @UiThread + public void onKill(@NonNull GeckoSession session) { + if(!mClosed){ + String mSessionID = (String) event.invokeObserver(null, enums.etype.SESSION_ID); + if(mSessionID.equals(getSessionID())){ + if(mCrashCount<=5){ + final Handler handler = new Handler(); + handler.postDelayed(() -> { + if(!session.isOpen()){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.M_OPEN_SESSION); + } + }, mCrashCount*500); + } + mCrashCount+=1; + } + } + } + + @Override + public void onFullScreen(@NonNull GeckoSession var1, boolean var2) { + mFullScreen = var2; + event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_full_screen); + } + + @UiThread + @Override + public void onContextMenu(@NonNull GeckoSession var1, int var2, int var3, @NonNull GeckoSession.ContentDelegate.ContextElement var4) { + + String title = strings.GENERIC_EMPTY_STR; + if(var4.title!=null){ + title = var4.title; + } + if(var4.type!=0){ + if(var4.linkUri!=null){ + event.invokeObserver(Arrays.asList(var4.linkUri,mSessionID,var4.srcUri,title, mTheme, mContext.get()), M_LONG_PRESS_WITH_LINK); + } + else { + try{ + event.invokeObserver(Arrays.asList(var4.srcUri,mSessionID,title, mTheme, mContext.get()), enums.etype.on_long_press); + }catch (Exception ex){ + ex.printStackTrace(); + Log.i("",""); + } + } + } + else{ + event.invokeObserver(Arrays.asList(var4.linkUri,mSessionID,title, mTheme, mContext.get()), M_LONG_PRESS_URL); + } + } + + /*Permission Delegate*/ + + @Override + public void onContentPermissionRequest(final GeckoSession session, final String uri, + final int type, final Callback callback) { + if (PERMISSION_AUTOPLAY_AUDIBLE == type || PERMISSION_AUTOPLAY_INAUDIBLE == type) { + if (!status.sToolbarTheme) { + callback.reject(); + } else { + callback.grant(); + } + }else { + callback.reject(); + } + } + /*Download Manager*/ + + void downloadRequestedFile() + { + if(mDownloadManager.getDownloadURL()!=null && mDownloadManager.getDownloadFile()!=null){ + if(!createAndSaveFileFromBase64Url(mDownloadManager.getDownloadURL().toString())){ + pluginController.getInstance().onDownloadInvoke(Arrays.asList(mDownloadManager.getDownloadURL()+"__"+mDownloadManager.getDownloadFile(), Environment.DIRECTORY_DOWNLOADS), pluginEnums.eDownloadManager.M_START_SERVICE); + } + } + } + + void downloadRequestedFile(Uri downloadURL,String downloadFile) + { + if(downloadURL!=null && downloadFile!=null){ + if(!createAndSaveFileFromBase64Url(downloadURL.toString())){ + pluginController.getInstance().onDownloadInvoke(Arrays.asList(downloadURL + "__" + downloadFile, Environment.DIRECTORY_DOWNLOADS), pluginEnums.eDownloadManager.M_START_SERVICE); + } + } + } + + private void saveImage(Bitmap finalBitmap) { + + String root = Environment.getExternalStorageDirectory().toString(); + File myDir = new File(root + "/saved_images"); + myDir.mkdirs(); + + String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); + String fname = "Shutta_"+ timeStamp +".jpg"; + + File file = new File(myDir, fname); + if (file.exists()) file.delete (); + try { + FileOutputStream out = new FileOutputStream(file); + finalBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); + out.flush(); + out.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /* Checks if external storage is available for read and write */ + public boolean isExternalStorageWritable() { + String state = Environment.getExternalStorageState(); + if (Environment.MEDIA_MOUNTED.equals(state)) { + return true; + } + return false; + } + + private boolean createAndSaveFileFromBase64Url(String url) { + + try{ + if(!url.startsWith("data") && !url.startsWith("blob")){ + return false; + } + + File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); + + String filetype; + String filename; + + if(url.startsWith("blob")){ + loadUri((String) pluginController.getInstance().onDownloadInvoke(Collections.singletonList(url), pluginEnums.eDownloadManager.M_DOWNLOAD_BLOB)); + return true; + } + + filetype = url.substring(url.indexOf("/") + 1, url.indexOf(";")); + filename = System.currentTimeMillis() + "." + filetype; + + File file = new File(path, filename); + try { + if(!path.exists()) + path.mkdirs(); + if(!file.exists()) + file.createNewFile(); + + String base64EncodedString = url.substring(url.indexOf(",") + 1); + byte[] decodedBytes = Base64.decode(base64EncodedString, Base64.DEFAULT); + OutputStream os = new FileOutputStream(file); + os.write(decodedBytes); + os.close(); + + //Tell the media scanner about the new file so that it is immediately available to the user. + MediaScannerConnection.scanFile(mContext.get().getApplicationContext(), + new String[]{file.toString()}, null, + (path1, uri) -> + { + Log.i("ExternalStorage", "Scanned " + path1 + ":"); + Log.i("ExternalStorage", "-> uri=" + uri); + }); + + //Set notification after download complete and add "click to view" action to that + String mimetype = url.substring(url.indexOf(":") + 1, url.indexOf("/")); + Intent intent = new Intent(); + intent.setAction(android.content.Intent.ACTION_VIEW); + Uri uri_temp = FileProvider.getUriForFile(mContext.get().getApplicationContext(),mContext.get().getString(R.string.GENERAL_FILE_PROVIDER_AUTHORITY), file); + intent.setDataAndType(uri_temp, (mimetype + "/*")); + + List resInfoList = mContext.get().getApplicationContext().getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); + for (ResolveInfo resolveInfo : resInfoList) { + String packageName = resolveInfo.activityInfo.packageName; + mUriPermission = uri_temp; + mContext.get().getApplicationContext().grantUriPermission(packageName, uri_temp, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); + } + PendingIntent pIntent = PendingIntent.getActivity(mContext.get().getApplicationContext(), 0, intent, 0); + + String channel_id = createNotificationChannel(mContext.get().getApplicationContext()); + + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext.get().getApplicationContext(), channel_id) + .setSmallIcon(R.drawable.ic_download) + .setContentTitle(filename) + .setContentIntent(pIntent); + + notificationBuilder.setAutoCancel(true); + + int notificationId = 85851; + NotificationManager notificationManager = (NotificationManager) mContext.get().getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); + notificationManager.notify(notificationId, notificationBuilder.build()); + + } catch (Exception e) { + e.printStackTrace(); + } + + return true; + } + catch (Exception ex){ + ex.printStackTrace(); + } + + return true; + } + + private static String createNotificationChannel(Context context) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + + String channelId = "Channel_id"; + CharSequence channelName = "Application_name"; + String channelDescription = "Application_name Alert"; + int channelImportance = NotificationManager.IMPORTANCE_DEFAULT; + NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, channelImportance); + notificationChannel.setDescription(channelDescription); + notificationChannel.enableVibration(true); + NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + assert notificationManager != null; + notificationManager.createNotificationChannel(notificationChannel); + return channelId; + } else { + return null; + } + } + + /*Helper Methods*/ + + void toogleUserAgent(){ + if(getSettings().getUserAgentMode()==USER_AGENT_MODE_DESKTOP){ + getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); + }else { + getSettings().setUserAgentMode(USER_AGENT_MODE_DESKTOP); + } + + } + + int getUserAgentMode(){ + return getSettings().getUserAgentMode(); + } + + public String getCurrentURL(){ + return mCurrentURL; + } + + public String getTitle(){ + return mCurrentTitle; + } + + public int getProgress(){ + return mProgress; + } + + public void setTitle(String title){ + mCurrentTitle = title; + } + + public void setURL(String pURL){ + mCurrentURL = pURL; + } + + public void setRemovableFromBackPressed(boolean pStatus){ + mRemovableFromBackPressed = pStatus; + } + + public boolean getRemovableFromBackPressed(){ + return mRemovableFromBackPressed; + } + + public void setTheme(String pTheme){ + mTheme = pTheme; + } + + public String getTheme(){ + return mTheme; + } + boolean canGoBack(){ + if(mHistoryList==null || mHistoryList.size()==0){ + return false; + } + return mCanGoBack; + } + + public boolean wasPreviousErrorPage(){ + return mPreviousErrorPage; + } + + boolean canGoForward(){ + return mCanGoForward; + } + + public String getSessionID(){ + return mSessionID; + } + + public void setSessionID(String pSession){ + mSessionID = pSession; + } + + void exitScreen(){ + this.exitFullScreen(); + } + + boolean getFullScreenStatus(){ + return !mFullScreen; + } + + public void closeSession(){ + event.invokeObserver(Arrays.asList(null,mSessionID), enums.etype.on_close_sesson); + } + + public void closeSessionInstant(){ + mSessionID = "-1"; + mClosed = true; + close(); + } + + public boolean isClosed(){ + return mClosed; + } + + GeckoResult mFinder = null; + public void findInPage(String pQuery, int pDirection){ + mFinder = null; + mFinder = getFinder().find(pQuery, pDirection); + new Thread(){ + public void run(){ + + int mCounter=0; + while (mFinder==null){ + try { + mCounter+=1; + sleep(100); + if(mCounter>100){ + return; + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + try { + FinderResult mResult = mFinder.poll(1000); + event.invokeObserver(Arrays.asList(mResult.total, mResult.current), enums.etype.FINDER_RESULT_CALLBACK); + } catch (Throwable throwable) { + throwable.printStackTrace(); + } + } + }.start(); + + } + + void goBackSession(){ + wasBackPressed = true; + goBack(); + } + + void goForwardSession(){ + + if(mHistoryList!=null) + { + stop(); + int index = mHistoryList.getCurrentIndex() + 1; + initURL(mHistoryList.get(index).getUri()); + if(mHistoryList.size()>index){ + event.invokeObserver(Arrays.asList(mHistoryList.get(index).getUri(), mSessionID), enums.etype.start_proxy); + } + final Handler handler = new Handler(); + handler.postDelayed(this::goForward, 100); + mProgress = 5; + event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced); + event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK); + }else { + final Handler handler = new Handler(); + handler.postDelayed(this::goForward, 100); + mProgress = 5; + event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced); + event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK); + } + } + + boolean isLoading(){ + return isPageLoading; + } + + void setLoading(boolean status){ + isPageLoading = status; + } + + Uri getUriPermission(){ + return mUriPermission; + } + + private void checkApplicationRate(){ + if(status.sSettingIsAppStarted){ + if(status.sRateCount==40){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), M_RATE_APPLICATION); + } + status.sRateCount+=1; + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), M_RATE_COUNT); + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java index 6f0b85cb..2026d936 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java @@ -1,447 +1,448 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; - -import android.annotation.TargetApi; -import android.app.Activity; -import android.content.ActivityNotFoundException; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.graphics.Matrix; -import android.graphics.Rect; -import android.graphics.RectF; -import android.os.Build; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.UiThread; -import android.util.Log; -import android.view.ActionMode; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; - -import com.darkweb.genesissearchengine.appManager.activityContextManager; - -import org.mozilla.gecko.util.ThreadUtils; -import org.mozilla.geckoview.GeckoSession; - -/** - * Class that implements a basic SelectionActionDelegate. This class is used by GeckoView by - * default if the consumer does not explicitly set a SelectionActionDelegate. - * - * To provide custom actions, extend this class and override the following methods, - * - * 1) Override {@link #getAllActions} to include custom action IDs in the returned array. This - * array must include all actions, available or not, and must not change over the class lifetime. - * - * 2) Override {@link #isActionAvailable} to return whether a custom action is currently available. - * - * 3) Override {@link #prepareAction} to set custom title and/or icon for a custom action. - * - * 4) Override {@link #performAction} to perform a custom action when used. - */ -@UiThread -public class selectionActionDelegate implements ActionMode.Callback, - GeckoSession.SelectionActionDelegate { - private static final String LOGTAG = "BasicSelectionAction"; - - protected static final String ACTION_PROCESS_TEXT = Intent.ACTION_PROCESS_TEXT; - - private static final String[] FLOATING_TOOLBAR_ACTIONS = new String[] { - ACTION_CUT, ACTION_COPY, ACTION_PASTE, ACTION_SELECT_ALL, ACTION_PROCESS_TEXT, "SEARCH" - }; - private static final String[] FIXED_TOOLBAR_ACTIONS = new String[] { - ACTION_SELECT_ALL, ACTION_CUT, ACTION_COPY, ACTION_PASTE,"SEARCH" - }; - - protected final @NonNull Activity mActivity; - protected final boolean mUseFloatingToolbar; - protected final @NonNull Matrix mTempMatrix = new Matrix(); - protected final @NonNull RectF mTempRect = new RectF(); - - private boolean mExternalActionsEnabled; - - protected @Nullable ActionMode mActionMode; - protected @Nullable GeckoSession mSession; - protected @Nullable Selection mSelection; - protected boolean mRepopulatedMenu; - - @TargetApi(Build.VERSION_CODES.M) - private class Callback2Wrapper extends ActionMode.Callback2 { - @Override - public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) { - return selectionActionDelegate.this.onCreateActionMode(actionMode, menu); - } - - @Override - public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) { - return selectionActionDelegate.this.onPrepareActionMode(actionMode, menu); - } - - @Override - public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) { - return selectionActionDelegate.this.onActionItemClicked(actionMode, menuItem); - } - - @Override - public void onDestroyActionMode(final ActionMode actionMode) { - selectionActionDelegate.this.onDestroyActionMode(actionMode); - } - - @Override - public void onGetContentRect(final ActionMode mode, final View view, final Rect outRect) { - super.onGetContentRect(mode, view, outRect); - selectionActionDelegate.this.onGetContentRect(mode, view, outRect); - } - } - - @SuppressWarnings("checkstyle:javadocmethod") - public selectionActionDelegate(final @NonNull Activity activity) { - this(activity, Build.VERSION.SDK_INT >= 23); - } - - @SuppressWarnings("checkstyle:javadocmethod") - public selectionActionDelegate(final @NonNull Activity activity, - final boolean useFloatingToolbar) { - mActivity = activity; - mUseFloatingToolbar = useFloatingToolbar; - mExternalActionsEnabled = true; - } - - /** - * Set whether to include text actions from other apps in the floating toolbar. - * - * @param enable True if external actions should be enabled. - */ - public void enableExternalActions(final boolean enable) { - ThreadUtils.assertOnUiThread(); - mExternalActionsEnabled = enable; - - if (mActionMode != null) { - mActionMode.invalidate(); - } - } - - /** - * Get whether text actions from other apps are enabled. - * - * @return True if external actions are enabled. - */ - public boolean areExternalActionsEnabled() { - return mExternalActionsEnabled; - } - - /** - * Return list of all actions in proper order, regardless of their availability at present. - * Override to add to or remove from the default set. - * - * @return Array of action IDs in proper order. - */ - protected @NonNull String[] getAllActions() { - return mUseFloatingToolbar ? FLOATING_TOOLBAR_ACTIONS - : FIXED_TOOLBAR_ACTIONS; - } - - /** - * Return whether an action is presently available. Override to indicate - * availability for custom actions. - * - * @param id Action ID. - * @return True if the action is presently available. - */ - protected boolean isActionAvailable(final @NonNull String id) { - if (mSelection == null) { - return false; - } - - if (mExternalActionsEnabled && !mSelection.text.isEmpty() && - ACTION_PROCESS_TEXT.equals(id)) { - final PackageManager pm = mActivity.getPackageManager(); - return pm.resolveActivity(getProcessTextIntent(), - PackageManager.MATCH_DEFAULT_ONLY) != null; - } - if(id.equals("SEARCH")){ - return true; - } - - return mSelection.isActionAvailable(id); - } - - /** - * Provides access to whether there are text selection actions available. Override to indicate - * availability for custom actions. - * - * @return True if there are text selection actions available. - */ - public boolean isActionAvailable() { - if (mSelection == null) { - return false; - } - - return isActionAvailable(ACTION_PROCESS_TEXT) || - !mSelection.availableActions.isEmpty(); - } - - /** - * Prepare a menu item corresponding to a certain action. Override to prepare - * menu item for custom action. - * - * @param id Action ID. - * @param item New menu item to prepare. - */ - protected void prepareAction(final @NonNull String id, final @NonNull MenuItem item) { - - switch (id) { - case ACTION_CUT: - item.setTitle(android.R.string.cut); - break; - case ACTION_COPY: - item.setTitle(android.R.string.copy); - break; - case "SEARCH": - item.setTitle("Search"); - break; - case ACTION_PASTE: - item.setTitle(android.R.string.paste); - break; - case ACTION_SELECT_ALL: - item.setTitle(android.R.string.selectAll); - break; - case ACTION_PROCESS_TEXT: - throw new IllegalStateException("Unexpected action"); - } - } - - /** - * Perform the specified action. Override to perform custom actions. - * - * @param id Action ID. - * @param item Nenu item for the action. - * @return True if the action was performed. - */ - protected boolean performAction(final @NonNull String id, final @NonNull MenuItem item) { - if (ACTION_PROCESS_TEXT.equals(id)) { - try { - mActivity.startActivity(item.getIntent()); - } catch (final ActivityNotFoundException e) { - Log.e(LOGTAG, "Cannot perform action", e); - return false; - } - return true; - } - - if (mSelection == null) { - return false; - } - if (id.equals("SEARCH")) { - activityContextManager.getInstance().getHomeController().onSearchString(mSelection.text); - mActionMode.finish(); - return false; - } - mSelection.execute(id); - - // Android behavior is to clear selection on copy. - if (ACTION_COPY.equals(id)) { - if (mUseFloatingToolbar) { - clearSelection(); - } else { - mActionMode.finish(); - } - } - return true; - } - - /** - * Get the current selection object. This object should not be stored as it does not update - * when the selection becomes invalid. Stale actions are ignored. - * - * @return The {@link GeckoSession.SelectionActionDelegate.Selection} attached to the current - * action menu. null if no action menu is active. - */ - public @Nullable Selection getSelection() { - return mSelection; - } - - /** - * Clear the current selection, if possible. - */ - public void clearSelection() { - if (mSelection == null) { - return; - } - - if (isActionAvailable(ACTION_COLLAPSE_TO_END)) { - mSelection.collapseToEnd(); - } else if (isActionAvailable(ACTION_UNSELECT)) { - mSelection.unselect(); - } else { - mSelection.hide(); - } - } - - private Intent getProcessTextIntent() { - final Intent intent = new Intent(Intent.ACTION_PROCESS_TEXT); - intent.addCategory(Intent.CATEGORY_DEFAULT); - intent.setType("text/plain"); - intent.putExtra(Intent.EXTRA_PROCESS_TEXT, mSelection.text); - // TODO: implement ability to replace text in Gecko for editable selection (bug 1453137). - intent.putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true); - return intent; - } - - @Override - public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) { - ThreadUtils.assertOnUiThread(); - final String[] allActions = getAllActions(); - for (final String actionId : allActions) { - if (isActionAvailable(actionId)) { - if (!mUseFloatingToolbar && ( - Build.VERSION.SDK_INT == 22 || Build.VERSION.SDK_INT == 23)) { - // Android bug where onPrepareActionMode is not called initially. - onPrepareActionMode(actionMode, menu); - } - return true; - } - } - return false; - } - - @Override - public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) { - ThreadUtils.assertOnUiThread(); - final String[] allActions = getAllActions(); - boolean changed = false; - - // Whether we are repopulating an existing menu. - mRepopulatedMenu = menu.size() != 0; - - // For each action, see if it's available at present, and if necessary, - // add to or remove from menu. - for (int i = 0; i < allActions.length; i++) { - final String actionId = allActions[i]; - final int menuId = i + Menu.FIRST; - - if (ACTION_PROCESS_TEXT.equals(actionId)) { - if (mExternalActionsEnabled && !mSelection.text.isEmpty()) { - menu.addIntentOptions(menuId, menuId, menuId, - mActivity.getComponentName(), - /* specifiec */ null, getProcessTextIntent(), - /* flags */ 0, /* items */ null); - changed = true; - } else if (menu.findItem(menuId) != null) { - menu.removeGroup(menuId); - changed = true; - } - continue; - } - - if (isActionAvailable(actionId)) { - if (menu.findItem(menuId) == null) { - prepareAction(actionId, menu.add(/* group */ Menu.NONE, menuId, - menuId, /* title */ "")); - changed = true; - } - } else if (menu.findItem(menuId) != null) { - menu.removeItem(menuId); - changed = true; - } - } - return changed; - } - - @Override - public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) { - ThreadUtils.assertOnUiThread(); - MenuItem realMenuItem = null; - if (mRepopulatedMenu) { - // When we repopulate an existing menu, Android can sometimes give us an old, - // deleted MenuItem. Find the current MenuItem that corresponds to the old one. - final Menu menu = actionMode.getMenu(); - final int size = menu.size(); - for (int i = 0; i < size; i++) { - final MenuItem item = menu.getItem(i); - if (item == menuItem || (item.getItemId() == menuItem.getItemId() && - item.getTitle().equals(menuItem.getTitle()))) { - realMenuItem = item; - break; - } - } - } else { - realMenuItem = menuItem; - } - - if (realMenuItem == null) { - return false; - } - final String[] allActions = getAllActions(); - return performAction(allActions[realMenuItem.getItemId() - Menu.FIRST], realMenuItem); - } - - @Override - public void onDestroyActionMode(final ActionMode actionMode) { - ThreadUtils.assertOnUiThread(); - if (!mUseFloatingToolbar) { - clearSelection(); - } - mSession = null; - mSelection = null; - mActionMode = null; - } - - @SuppressWarnings("checkstyle:javadocmethod") - public void onGetContentRect(final @Nullable ActionMode mode, final @Nullable View view, - final @NonNull Rect outRect) { - ThreadUtils.assertOnUiThread(); - if (mSelection == null || mSelection.clientRect == null) { - return; - } - mSession.getClientToScreenMatrix(mTempMatrix); - mTempMatrix.mapRect(mTempRect, mSelection.clientRect); - mTempRect.roundOut(outRect); - } - - @TargetApi(Build.VERSION_CODES.M) - @Override - public void onShowActionRequest(final GeckoSession session, final Selection selection) { - ThreadUtils.assertOnUiThread(); - mSession = session; - mSelection = selection; - - if (mActionMode != null) { - if (isActionAvailable()) { - mActionMode.invalidate(); - } else { - mActionMode.finish(); - } - return; - } - - if (mUseFloatingToolbar) { - mActionMode = mActivity.startActionMode(new Callback2Wrapper(), - ActionMode.TYPE_FLOATING); - } else { - mActionMode = mActivity.startActionMode(this); - } - } - - @Override - public void onHideAction(final GeckoSession session, final int reason) { - ThreadUtils.assertOnUiThread(); - if (mActionMode == null) { - return; - } - - switch (reason) { - case HIDE_REASON_ACTIVE_SCROLL: - case HIDE_REASON_ACTIVE_SELECTION: - case HIDE_REASON_INVISIBLE_SELECTION: - if (mUseFloatingToolbar) { - // Hide the floating toolbar when scrolling/selecting. - mActionMode.finish(); - } - break; - - case HIDE_REASON_NO_SELECTION: - mActionMode.finish(); - break; - } - } +package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.content.ActivityNotFoundException; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.graphics.Matrix; +import android.graphics.Rect; +import android.graphics.RectF; +import android.os.Build; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.UiThread; +import android.util.Log; +import android.view.ActionMode; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; + +import com.darkweb.genesissearchengine.appManager.activityContextManager; + +import org.mozilla.gecko.util.ThreadUtils; +import org.mozilla.geckoview.GeckoSession; + +/** + * Class that implements a basic SelectionActionDelegate. This class is used by GeckoView by + * default if the consumer does not explicitly set a SelectionActionDelegate. + * + * To provide custom actions, extend this class and override the following methods, + * + * 1) Override {@link #getAllActions} to include custom action IDs in the returned array. This + * array must include all actions, available or not, and must not change over the class lifetime. + * + * 2) Override {@link #isActionAvailable} to return whether a custom action is currently available. + * + * 3) Override {@link #prepareAction} to set custom title and/or icon for a custom action. + * + * 4) Override {@link #performAction} to perform a custom action when used. + */ +@UiThread +public class selectionActionDelegate implements ActionMode.Callback, + GeckoSession.SelectionActionDelegate { + private static final String LOGTAG = "BasicSelectionAction"; + + protected static final String ACTION_PROCESS_TEXT = Intent.ACTION_PROCESS_TEXT; + + private static final String[] FLOATING_TOOLBAR_ACTIONS = new String[] { + ACTION_CUT, ACTION_COPY, ACTION_PASTE, ACTION_SELECT_ALL, "SEARCH" + }; + private static final String[] FIXED_TOOLBAR_ACTIONS = new String[] { + ACTION_SELECT_ALL, ACTION_CUT, ACTION_COPY, ACTION_PASTE,"SEARCH" + }; + + protected final @NonNull Activity mActivity; + protected final boolean mUseFloatingToolbar; + protected final @NonNull Matrix mTempMatrix = new Matrix(); + protected final @NonNull RectF mTempRect = new RectF(); + + private boolean mExternalActionsEnabled; + + protected @Nullable ActionMode mActionMode; + protected @Nullable GeckoSession mSession; + protected @Nullable Selection mSelection; + protected boolean mRepopulatedMenu; + + @TargetApi(Build.VERSION_CODES.M) + private class Callback2Wrapper extends ActionMode.Callback2 { + @Override + public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) { + return selectionActionDelegate.this.onCreateActionMode(actionMode, menu); + } + + @Override + public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) { + return selectionActionDelegate.this.onPrepareActionMode(actionMode, menu); + } + + @Override + public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) { + return selectionActionDelegate.this.onActionItemClicked(actionMode, menuItem); + } + + @Override + public void onDestroyActionMode(final ActionMode actionMode) { + selectionActionDelegate.this.onDestroyActionMode(actionMode); + } + + @Override + public void onGetContentRect(final ActionMode mode, final View view, final Rect outRect) { + super.onGetContentRect(mode, view, outRect); + selectionActionDelegate.this.onGetContentRect(mode, view, outRect); + } + } + + @SuppressWarnings("checkstyle:javadocmethod") + public selectionActionDelegate(final @NonNull Activity activity) { + this(activity, Build.VERSION.SDK_INT >= 23); + } + + @SuppressWarnings("checkstyle:javadocmethod") + public selectionActionDelegate(final @NonNull Activity activity, + final boolean useFloatingToolbar) { + mActivity = activity; + mUseFloatingToolbar = useFloatingToolbar; + mExternalActionsEnabled = true; + } + + /** + * Set whether to include text actions from other apps in the floating toolbar. + * + * @param enable True if external actions should be enabled. + */ + public void enableExternalActions(final boolean enable) { + ThreadUtils.assertOnUiThread(); + mExternalActionsEnabled = enable; + + if (mActionMode != null) { + mActionMode.invalidate(); + } + } + + /** + * Get whether text actions from other apps are enabled. + * + * @return True if external actions are enabled. + */ + public boolean areExternalActionsEnabled() { + return mExternalActionsEnabled; + } + + /** + * Return list of all actions in proper order, regardless of their availability at present. + * Override to add to or remove from the default set. + * + * @return Array of action IDs in proper order. + */ + protected @NonNull String[] getAllActions() { + return mUseFloatingToolbar ? FLOATING_TOOLBAR_ACTIONS + : FIXED_TOOLBAR_ACTIONS; + } + + /** + * Return whether an action is presently available. Override to indicate + * availability for custom actions. + * + * @param id Action ID. + * @return True if the action is presently available. + */ + protected boolean isActionAvailable(final @NonNull String id) { + if (mSelection == null) { + return false; + } + + if (mExternalActionsEnabled && !mSelection.text.isEmpty() && + ACTION_PROCESS_TEXT.equals(id)) { + final PackageManager pm = mActivity.getPackageManager(); + return pm.resolveActivity(getProcessTextIntent(), + PackageManager.MATCH_DEFAULT_ONLY) != null; + } + if(id.equals("SEARCH") && !mSelection.text.isEmpty() && mExternalActionsEnabled){ + return true; + } + + return mSelection.isActionAvailable(id); + } + + /** + * Provides access to whether there are text selection actions available. Override to indicate + * availability for custom actions. + * + * @return True if there are text selection actions available. + */ + public boolean isActionAvailable() { + if (mSelection == null) { + return false; + } + + return isActionAvailable(ACTION_PROCESS_TEXT) || + !mSelection.availableActions.isEmpty(); + } + + /** + * Prepare a menu item corresponding to a certain action. Override to prepare + * menu item for custom action. + * + * @param id Action ID. + * @param item New menu item to prepare. + */ + protected void prepareAction(final @NonNull String id, final @NonNull MenuItem item) { + + switch (id) { + case ACTION_CUT: + item.setTitle(android.R.string.cut); + break; + case ACTION_COPY: + item.setTitle(android.R.string.copy); + break; + case "SEARCH": + item.setTitle("Search"); + break; + case ACTION_PASTE: + item.setTitle(android.R.string.paste); + break; + case ACTION_SELECT_ALL: + item.setTitle(android.R.string.selectAll); + break; + case ACTION_PROCESS_TEXT: + throw new IllegalStateException("Unexpected action"); + } + } + + /** + * Perform the specified action. Override to perform custom actions. + * + * @param id Action ID. + * @param item Nenu item for the action. + * @return True if the action was performed. + */ + protected boolean performAction(final @NonNull String id, final @NonNull MenuItem item) { + if (ACTION_PROCESS_TEXT.equals(id)) { + try { + mActivity.startActivity(item.getIntent()); + } catch (final ActivityNotFoundException e) { + Log.e(LOGTAG, "Cannot perform action", e); + return false; + } + return true; + } + + if (mSelection == null) { + return false; + } + if (id.equals("SEARCH")) { + activityContextManager.getInstance().getHomeController().onSearchString(mSelection.text); + clearSelection(); + mActionMode.finish(); + return false; + } + mSelection.execute(id); + + // Android behavior is to clear selection on copy. + if (ACTION_COPY.equals(id)) { + if (mUseFloatingToolbar) { + clearSelection(); + } else { + mActionMode.finish(); + } + } + return true; + } + + /** + * Get the current selection object. This object should not be stored as it does not update + * when the selection becomes invalid. Stale actions are ignored. + * + * @return The {@link GeckoSession.SelectionActionDelegate.Selection} attached to the current + * action menu. null if no action menu is active. + */ + public @Nullable Selection getSelection() { + return mSelection; + } + + /** + * Clear the current selection, if possible. + */ + public void clearSelection() { + if (mSelection == null) { + return; + } + + if (isActionAvailable(ACTION_COLLAPSE_TO_END)) { + mSelection.collapseToEnd(); + } else if (isActionAvailable(ACTION_UNSELECT)) { + mSelection.unselect(); + } else { + mSelection.hide(); + } + } + + private Intent getProcessTextIntent() { + final Intent intent = new Intent(Intent.ACTION_PROCESS_TEXT); + intent.addCategory(Intent.CATEGORY_DEFAULT); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_PROCESS_TEXT, mSelection.text); + // TODO: implement ability to replace text in Gecko for editable selection (bug 1453137). + intent.putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true); + return intent; + } + + @Override + public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) { + ThreadUtils.assertOnUiThread(); + final String[] allActions = getAllActions(); + for (final String actionId : allActions) { + if (isActionAvailable(actionId)) { + if (!mUseFloatingToolbar && ( + Build.VERSION.SDK_INT == 22 || Build.VERSION.SDK_INT == 23)) { + // Android bug where onPrepareActionMode is not called initially. + onPrepareActionMode(actionMode, menu); + } + return true; + } + } + return false; + } + + @Override + public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) { + ThreadUtils.assertOnUiThread(); + final String[] allActions = getAllActions(); + boolean changed = false; + + // Whether we are repopulating an existing menu. + mRepopulatedMenu = menu.size() != 0; + + // For each action, see if it's available at present, and if necessary, + // add to or remove from menu. + for (int i = 0; i < allActions.length; i++) { + final String actionId = allActions[i]; + final int menuId = i + Menu.FIRST; + + if (ACTION_PROCESS_TEXT.equals(actionId)) { + if (mExternalActionsEnabled && !mSelection.text.isEmpty()) { + menu.addIntentOptions(menuId, menuId, menuId, + mActivity.getComponentName(), + /* specifiec */ null, getProcessTextIntent(), + /* flags */ 0, /* items */ null); + changed = true; + } else if (menu.findItem(menuId) != null) { + menu.removeGroup(menuId); + changed = true; + } + continue; + } + + if (isActionAvailable(actionId)) { + if (menu.findItem(menuId) == null) { + prepareAction(actionId, menu.add(/* group */ Menu.NONE, menuId, + menuId, /* title */ "")); + changed = true; + } + } else if (menu.findItem(menuId) != null) { + menu.removeItem(menuId); + changed = true; + } + } + return changed; + } + + @Override + public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) { + ThreadUtils.assertOnUiThread(); + MenuItem realMenuItem = null; + if (mRepopulatedMenu) { + // When we repopulate an existing menu, Android can sometimes give us an old, + // deleted MenuItem. Find the current MenuItem that corresponds to the old one. + final Menu menu = actionMode.getMenu(); + final int size = menu.size(); + for (int i = 0; i < size; i++) { + final MenuItem item = menu.getItem(i); + if (item == menuItem || (item.getItemId() == menuItem.getItemId() && + item.getTitle().equals(menuItem.getTitle()))) { + realMenuItem = item; + break; + } + } + } else { + realMenuItem = menuItem; + } + + if (realMenuItem == null) { + return false; + } + final String[] allActions = getAllActions(); + return performAction(allActions[realMenuItem.getItemId() - Menu.FIRST], realMenuItem); + } + + @Override + public void onDestroyActionMode(final ActionMode actionMode) { + ThreadUtils.assertOnUiThread(); + if (!mUseFloatingToolbar) { + clearSelection(); + } + mSession = null; + mSelection = null; + mActionMode = null; + } + + @SuppressWarnings("checkstyle:javadocmethod") + public void onGetContentRect(final @Nullable ActionMode mode, final @Nullable View view, + final @NonNull Rect outRect) { + ThreadUtils.assertOnUiThread(); + if (mSelection == null || mSelection.clientRect == null) { + return; + } + mSession.getClientToScreenMatrix(mTempMatrix); + mTempMatrix.mapRect(mTempRect, mSelection.clientRect); + mTempRect.roundOut(outRect); + } + + @TargetApi(Build.VERSION_CODES.M) + @Override + public void onShowActionRequest(final GeckoSession session, final Selection selection) { + ThreadUtils.assertOnUiThread(); + mSession = session; + mSelection = selection; + + if (mActionMode != null) { + if (isActionAvailable()) { + mActionMode.invalidate(); + } else { + mActionMode.finish(); + } + return; + } + + if (mUseFloatingToolbar) { + mActionMode = mActivity.startActionMode(new Callback2Wrapper(), + ActionMode.TYPE_FLOATING); + } else { + mActionMode = mActivity.startActionMode(this); + } + } + + @Override + public void onHideAction(final GeckoSession session, final int reason) { + ThreadUtils.assertOnUiThread(); + if (mActionMode == null) { + return; + } + + switch (reason) { + case HIDE_REASON_ACTIVE_SCROLL: + case HIDE_REASON_ACTIVE_SELECTION: + case HIDE_REASON_INVISIBLE_SELECTION: + if (mUseFloatingToolbar) { + // Hide the floating toolbar when scrolling/selecting. + mActionMode.finish(); + } + break; + + case HIDE_REASON_NO_SELECTION: + mActionMode.finish(); + break; + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java index bcebc3b0..7b3851cf 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java @@ -1,245 +1,245 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.hintManager; - -import android.annotation.SuppressLint; -import android.content.res.ColorStateList; -import android.content.res.Resources; -import android.graphics.drawable.Drawable; -import android.os.Handler; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.recyclerview.widget.RecyclerView; - -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class hintAdapter extends RecyclerView.Adapter -{ - /*Private Variables*/ - - private ArrayList mHintList; - private AppCompatActivity mContext; - private eventObserver.eventListener mEvent; - private Map mPastWebIcon = new HashMap<>(); - private Map mPastIconFlicker = new HashMap<>(); - - public hintAdapter(ArrayList pHintList, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pSearch) { - this.mHintList = new ArrayList(); - int maxCounter=5; - if(pHintList.size() pHintList, String pSearch){ - mHintList = pHintList; - if(mHintList.size()==1 && mHintList.get(0).getHeader().equals("about:blank")) { - mHintList.clear(); - mHintList.add( new historyRowModel("Genesis Search", "genesis.onion",-1)); - } - - notifyDataSetChanged(); - } - - public void onClearAdapter(){ - //mPastWebIcon.clear(); - mPastWebIcon.remove(0); - mPastWebIcon.remove(1); - mPastWebIcon.remove(2); - } - - /*Initializations*/ - - @NonNull @Override - public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.hint_view, parent, false); - return new listViewHolder(view); - } - - @Override - public void onBindViewHolder(@NonNull hintAdapter.listViewHolder holder, int position) - { - holder.bindListView(mHintList.get(position)); - } - - @Override - public int getItemCount() { - return mHintList.size(); - } - - /*Listeners*/ - - /*View Holder Extensions*/ - class listViewHolder extends RecyclerView.ViewHolder implements View.OnTouchListener - { - TextView mHeader; - TextView mHeaderSingle; - TextView mURL; - ImageButton mMoveURL; - ImageView mHindTypeIcon; - ImageView mHintWebIcon = null; - LinearLayout mpHintListener; - ImageView mHindTypeIconTemp; - - listViewHolder(View itemView) { - super(itemView); - } - - @SuppressLint({"ClickableViewAccessibility", "UseCompatLoadingForDrawables"}) - void bindListView(historyRowModel model) { - mHeader = itemView.findViewById(R.id.pHeader); - mHeaderSingle = itemView.findViewById(R.id.pHeaderSingle); - mURL = itemView.findViewById(R.id.pURL); - mHindTypeIcon = itemView.findViewById(R.id.pHindTypeIcon); - mpHintListener = itemView.findViewById(R.id.pHintListener); - mMoveURL = itemView.findViewById(R.id.pMoveURL); - mHintWebIcon = itemView.findViewById(R.id.pHintWebIcon); - mHindTypeIconTemp = new ImageView(mContext); - - mHintWebIcon.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v6))); - - if(mPastWebIcon.containsKey(getLayoutPosition())){ - mHintWebIcon.setImageDrawable(mPastWebIcon.get(getLayoutPosition())); - mHintWebIcon.setImageTintList(null); - }else { - mHintWebIcon.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v8))); - - Drawable mDrawable; - Resources res = itemView.getContext().getResources(); - try { - mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_browser)); - mMoveURL.setVisibility(View.VISIBLE); - mMoveURL.setOnTouchListener(listViewHolder.this); - mHintWebIcon.setImageDrawable(mDrawable); - } catch (Exception ignored) { - } - - } - - String mURLLink; - if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){ - mURLLink = model.getHeader(); - mHeaderSingle.setText(model.getHeader().replace("+"," ").replace("%", "+")); - mHeaderSingle.setVisibility(View.VISIBLE); - mHeader.setVisibility(View.GONE); - mURL.setVisibility(View.GONE); - mHintWebIcon.setVisibility(View.GONE); - mHindTypeIcon.setVisibility(View.VISIBLE); - }else { - mURLLink = model.getDescription(); - mHeaderSingle.setVisibility(View.GONE); - mHeader.setVisibility(View.VISIBLE); - mURL.setVisibility(View.VISIBLE); - mHintWebIcon.setVisibility(View.VISIBLE); - mHindTypeIcon.setVisibility(View.GONE); - } - - mHeader.setText(model.getHeader()); - if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){ - mMoveURL.setTag(model.getHeader()); - }else { - mMoveURL.setTag(model.getDescription()); - } - - mURL.setText(model.getDescription()); - Drawable mDrawable = null; - Resources res = itemView.getContext().getResources(); - try { - if(model.getDescription().equals(strings.GENERIC_EMPTY_STR) && !model.getHeader().contains(".")){ - mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_search)); - mMoveURL.setVisibility(View.GONE); - }else { - mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_browser)); - mMoveURL.setVisibility(View.VISIBLE); - mMoveURL.setOnTouchListener(listViewHolder.this); - } - } catch (Exception ignored) { - } - - if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){ - mHindTypeIcon.setImageDrawable(mDrawable); - } - - mpHintListener.setOnTouchListener(listViewHolder.this); - - if(mURLLink.contains("genesishiddentechnologies.com") || mURLLink.contains("genesis.onion")){ - mHintWebIcon.setImageTintList(null); - mHintWebIcon.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis)); - mPastWebIcon.put(getLayoutPosition(),mHintWebIcon.getDrawable()); - }else - { - new Thread(){ - - public void run(){ - try { - String mURLPast = mURLLink; - mPastIconFlicker.put(getLayoutPosition(),mURLPast); - - mHindTypeIconTemp.setImageDrawable(null); - mEvent.invokeObserver(Arrays.asList(mHindTypeIconTemp, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon); - sleep(200); - - mContext.runOnUiThread(() -> new Handler().postDelayed(() -> - { - if(mHindTypeIconTemp.getDrawable() != null){ - if(mURLPast.equals(mPastIconFlicker.get(getLayoutPosition()))){ - mHintWebIcon.setImageTintList(null); - mHintWebIcon.setImageDrawable(mHindTypeIconTemp.getDrawable()); - mPastWebIcon.put(getLayoutPosition(),mHintWebIcon.getDrawable()); - } - if(getLayoutPosition() == 1){ - Log.i("FUSSSS1111","FUSSSS4444"); - } - } - }, 200)); - - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }.start(); - } - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public boolean onTouch(View v, MotionEvent event) { - if(v.getId() == mpHintListener.getId() || v.getId() == mMoveURL.getId()){ - if(event.getAction() == MotionEvent.ACTION_MOVE){ - helperMethod.hideKeyboard(mContext); - } - } - return false; - } - } - - public Object onTrigger(tabEnums.eTabAdapterCommands pCommands, List pData){ - return null; - } - -} - - +package com.darkweb.genesissearchengine.appManager.homeManager.hintManager; + +import android.annotation.SuppressLint; +import android.content.res.ColorStateList; +import android.content.res.Resources; +import android.graphics.drawable.Drawable; +import android.os.Handler; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.RecyclerView; + +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; +import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class hintAdapter extends RecyclerView.Adapter +{ + /*Private Variables*/ + + private ArrayList mHintList; + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + private Map mPastWebIcon = new HashMap<>(); + private Map mPastIconFlicker = new HashMap<>(); + + public hintAdapter(ArrayList pHintList, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pSearch) { + this.mHintList = new ArrayList(); + int maxCounter=5; + if(pHintList.size() pHintList, String pSearch){ + mHintList = pHintList; + if(mHintList.size()==1 && mHintList.get(0).getHeader().equals("about:blank")) { + mHintList.clear(); + mHintList.add( new historyRowModel("Genesis Search", "genesis.onion",-1)); + } + + notifyDataSetChanged(); + } + + public void onClearAdapter(){ + //mPastWebIcon.clear(); + mPastWebIcon.remove(0); + mPastWebIcon.remove(1); + mPastWebIcon.remove(2); + } + + /*Initializations*/ + + @NonNull @Override + public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.hint_view, parent, false); + return new listViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull hintAdapter.listViewHolder holder, int position) + { + holder.bindListView(mHintList.get(position)); + } + + @Override + public int getItemCount() { + return mHintList.size(); + } + + /*Listeners*/ + + /*View Holder Extensions*/ + class listViewHolder extends RecyclerView.ViewHolder implements View.OnTouchListener + { + TextView mHeader; + TextView mHeaderSingle; + TextView mURL; + ImageButton mMoveURL; + ImageView mHindTypeIcon; + ImageView mHintWebIcon = null; + LinearLayout mpHintListener; + ImageView mHindTypeIconTemp; + + listViewHolder(View itemView) { + super(itemView); + } + + @SuppressLint({"ClickableViewAccessibility", "UseCompatLoadingForDrawables"}) + void bindListView(historyRowModel model) { + mHeader = itemView.findViewById(R.id.pHeader); + mHeaderSingle = itemView.findViewById(R.id.pHeaderSingle); + mURL = itemView.findViewById(R.id.pURL); + mHindTypeIcon = itemView.findViewById(R.id.pHindTypeIcon); + mpHintListener = itemView.findViewById(R.id.pHintListener); + mMoveURL = itemView.findViewById(R.id.pMoveURL); + mHintWebIcon = itemView.findViewById(R.id.pHintWebIcon); + mHindTypeIconTemp = new ImageView(mContext); + + mHintWebIcon.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v6))); + + if(mPastWebIcon.containsKey(getLayoutPosition())){ + mHintWebIcon.setImageDrawable(mPastWebIcon.get(getLayoutPosition())); + mHintWebIcon.setImageTintList(null); + }else { + mHintWebIcon.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v8))); + + Drawable mDrawable; + Resources res = itemView.getContext().getResources(); + try { + mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_browser)); + mMoveURL.setVisibility(View.VISIBLE); + mMoveURL.setOnTouchListener(listViewHolder.this); + mHintWebIcon.setImageDrawable(mDrawable); + } catch (Exception ignored) { + } + + } + + String mURLLink; + if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){ + mURLLink = model.getHeader(); + mHeaderSingle.setText(model.getHeader().replace("+"," ").replace("%", "+")); + mHeaderSingle.setVisibility(View.VISIBLE); + mHeader.setVisibility(View.GONE); + mURL.setVisibility(View.GONE); + mHintWebIcon.setVisibility(View.GONE); + mHindTypeIcon.setVisibility(View.VISIBLE); + }else { + mURLLink = model.getDescription(); + mHeaderSingle.setVisibility(View.GONE); + mHeader.setVisibility(View.VISIBLE); + mURL.setVisibility(View.VISIBLE); + mHintWebIcon.setVisibility(View.VISIBLE); + mHindTypeIcon.setVisibility(View.GONE); + } + + mHeader.setText(model.getHeader()); + if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){ + mMoveURL.setTag(model.getHeader()); + }else { + mMoveURL.setTag(model.getDescription()); + } + + mURL.setText(model.getDescription()); + Drawable mDrawable = null; + Resources res = itemView.getContext().getResources(); + try { + if(model.getDescription().equals(strings.GENERIC_EMPTY_STR) && !model.getHeader().contains(".")){ + mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_search)); + mMoveURL.setVisibility(View.GONE); + }else { + mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_browser)); + mMoveURL.setVisibility(View.VISIBLE); + mMoveURL.setOnTouchListener(listViewHolder.this); + } + } catch (Exception ignored) { + } + + if(model.getDescription().equals(strings.GENERIC_EMPTY_STR)){ + mHindTypeIcon.setImageDrawable(mDrawable); + } + + mpHintListener.setOnTouchListener(listViewHolder.this); + + if(mURLLink.contains("genesishiddentechnologies.com") || mURLLink.contains("genesis.onion")){ + mHintWebIcon.setImageTintList(null); + mHintWebIcon.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis)); + mPastWebIcon.put(getLayoutPosition(),mHintWebIcon.getDrawable()); + }else + { + new Thread(){ + + public void run(){ + try { + String mURLPast = mURLLink; + mPastIconFlicker.put(getLayoutPosition(),mURLPast); + + mHindTypeIconTemp.setImageDrawable(null); + mEvent.invokeObserver(Arrays.asList(mHindTypeIconTemp, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon); + sleep(200); + + mContext.runOnUiThread(() -> new Handler().postDelayed(() -> + { + if(mHindTypeIconTemp.getDrawable() != null){ + if(mURLPast.equals(mPastIconFlicker.get(getLayoutPosition()))){ + mHintWebIcon.setImageTintList(null); + mHintWebIcon.setImageDrawable(mHindTypeIconTemp.getDrawable()); + mPastWebIcon.put(getLayoutPosition(),mHintWebIcon.getDrawable()); + } + if(getLayoutPosition() == 1){ + Log.i("FUSSSS1111","FUSSSS4444"); + } + } + }, 200)); + + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }.start(); + } + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public boolean onTouch(View v, MotionEvent event) { + if(v.getId() == mpHintListener.getId() || v.getId() == mMoveURL.getId()){ + if(event.getAction() == MotionEvent.ACTION_MOVE){ + helperMethod.hideKeyboard(mContext); + } + } + return false; + } + } + + public Object onTrigger(tabEnums.eTabAdapterCommands pCommands, List pData){ + return null; + } + +} + + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java index f689cd7e..4272030c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java @@ -1,23 +1,23 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.hintManager; - -public class hintModel -{ - /*Private Variables*/ - - private String mHeader; - private String mURL; - - public hintModel(String pHeader, String pURL){ - mHeader = pHeader; - mURL = pURL; - } - - public String getHeader(){ - return mHeader; - } - - public String getURL(){ - return mURL; - } - +package com.darkweb.genesissearchengine.appManager.homeManager.hintManager; + +public class hintModel +{ + /*Private Variables*/ + + private String mHeader; + private String mURL; + + public hintModel(String pHeader, String pURL){ + mHeader = pHeader; + mURL = pURL; + } + + public String getHeader(){ + return mHeader; + } + + public String getURL(){ + return mURL; + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java index e9c1d25e..2bd357ae 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java @@ -1,46 +1,46 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.homeController; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.KeyEvent; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.eventObserver; - -public class editTextManager extends androidx.appcompat.widget.AppCompatAutoCompleteTextView { - - Context mContext; - private eventObserver.eventListener mEvent = null; - - public editTextManager(@NonNull Context context) { - super(context); - mContext = context; - } - - public editTextManager(@NonNull Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - mContext = context; - } - - public editTextManager(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - mContext = context; - } - - public void setEventHandler(eventObserver.eventListener pEvent){ - mEvent = pEvent; - } - - @Override - public boolean onKeyPreIme(int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_BACK) { - if(mEvent!=null){ - mEvent.invokeObserver(null, enums.etype.ON_KEYBOARD_CLOSE); - } - } - return false; - } -} +package com.darkweb.genesissearchengine.appManager.homeManager.homeController; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.KeyEvent; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.eventObserver; + +public class editTextManager extends androidx.appcompat.widget.AppCompatAutoCompleteTextView { + + Context mContext; + private eventObserver.eventListener mEvent = null; + + public editTextManager(@NonNull Context context) { + super(context); + mContext = context; + } + + public editTextManager(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + mContext = context; + } + + public editTextManager(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + mContext = context; + } + + public void setEventHandler(eventObserver.eventListener pEvent){ + mEvent = pEvent; + } + + @Override + public boolean onKeyPreIme(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_BACK) { + if(mEvent!=null){ + mEvent.invokeObserver(null, enums.etype.ON_KEYBOARD_CLOSE); + } + } + return false; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java index fd143e07..e6685cbc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java @@ -1,2330 +1,2339 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.homeController; - -import android.annotation.SuppressLint; -import android.app.ActivityOptions; -import android.app.DownloadManager; -import android.content.ActivityNotFoundException; -import android.content.BroadcastReceiver; -import android.content.ComponentCallbacks2; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.SharedPreferences; -import android.content.res.Configuration; -import android.database.Cursor; -import android.graphics.Bitmap; -import android.graphics.Color; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.os.Handler; -import android.preference.PreferenceManager; -import android.speech.RecognizerIntent; -import android.text.Editable; -import android.text.TextWatcher; -import android.util.Log; -import android.view.MotionEvent; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.view.inputmethod.EditorInfo; -import android.webkit.URLUtil; -import android.widget.*; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.core.app.NotificationManagerCompat; -import androidx.core.content.ContextCompat; -import androidx.core.widget.NestedScrollView; -import androidx.fragment.app.FragmentContainerView; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; -import com.darkweb.genesissearchengine.appManager.historyManager.historyController; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.*; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.appManager.homeManager.hintManager.hintAdapter; -import com.darkweb.genesissearchengine.appManager.landingManager.landingController; -import com.darkweb.genesissearchengine.appManager.languageManager.languageController; -import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; -import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController; -import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; -import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeController; -import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.libs.views.KeyboardUtils; -import com.darkweb.genesissearchengine.appManager.activityStateManager; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.libs.trueTime.trueTime; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.gms.ads.AdView; -import org.mozilla.geckoview.ContentBlocking; -import org.mozilla.geckoview.GeckoResult; -import org.mozilla.geckoview.GeckoSession; -import org.torproject.android.proxy.OrbotService; -import org.torproject.android.proxy.util.Prefs; -import org.torproject.android.proxy.wrapper.LocaleHelper; -import org.torproject.android.proxy.wrapper.orbotLocalConstants; - -import java.io.StringWriter; -import java.lang.ref.WeakReference; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Objects; -import java.util.concurrent.Callable; -import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; -import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; -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.enums.etype.GECKO_SCROLL_DOWN; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_LINK; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE; -import static com.darkweb.genesissearchengine.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB; -import static com.darkweb.genesissearchengine.constants.enums.etype.open_new_tab; -import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; -import static java.lang.Character.isLetter; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; - -public class homeController extends AppCompatActivity implements ComponentCallbacks2 -{ - /*Model Declaration*/ - private homeViewController mHomeViewController; - private homeModel mHomeModel; - private geckoClients mGeckoClient = null; - - /*View Webviews*/ - private NestedGeckoView mGeckoView = null; - private androidx.constraintlayout.widget.ConstraintLayout mTopLayout; - private ConstraintLayout mWebViewContainer; - - /*View Objects*/ - private ProgressBar mProgressBar; - private ConstraintLayout mSplashScreen; - private editTextManager mSearchbar; - private ImageView mLoadingIcon; - private ImageView mBlocker; - private TextView mLoadingText; - private AdView mBannerAds = null; - private ImageButton mGatewaySplash; - private ImageButton mPanicButton; - private ImageButton mPanicButtonLandscape; - private LinearLayout mTopBar; - private ImageView mBackSplash; - private Button mConnectButton; - private Button mNewTab; - private View mFindBar; - private View mSearchEngineBar; - private ImageView mGenesisLogo; - private EditText mFindText; - private TextView mFindCount; - private ImageButton mVoiceInput; - private ImageButton mMenu; - private NestedScrollView mNestedScroll; - private ImageView mBlockerFullSceen; - private ImageView mNewTabBlocker; - private TextView mCopyright; - private RecyclerView mHintListView = null; - private ImageView mSearchLock; - private ImageButton mOrbotLogManager; - private ConstraintLayout mInfoPortrait; - private ConstraintLayout mInfoLandscape; - private com.google.android.material.appbar.AppBarLayout mAppBar; - private ProgressBar mProgressBarIndeterminate; - private FragmentContainerView mTabFragment; - private LinearLayout mTopBarContainer; - private View mPopupLoadNewTab; - private ImageView mTopBarHider; - private CoordinatorLayout mCoordinatorLayout; - private ImageView mImageDivider; - - /*Redirection Objects*/ - private GeckoResult mRenderedBitmap = null; - private boolean mPageClosed = false; - private boolean isKeyboardOpened = false; - private boolean isSuggestionChanged = false; - private boolean isSuggestionSearchOpened = false; - private boolean isFocusChanging = false; - private boolean mAppRestarted = false; - private boolean mSearchBarLoading = false; - private boolean mSearchBarLoadingOpening = false; - private boolean mSearchBarWasBackButtonPressed = false; - private String mSearchBarPreviousText = strings.GENERIC_EMPTY_STR; - private Handler mScrollHandler = null; - private Runnable mScrollRunnable = null; - - /*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/ - - @Override - protected void onCreate(Bundle savedInstanceState) - { - onInitTheme(); - onInitBooleans(); - orbotLocalConstants.mHomeIntent = getIntent(); - - getWindow().getDecorView().setBackgroundColor(Color.WHITE); - pluginController.getInstance().preInitialize(this); - dataController.getInstance().initialize(this); - status.initStatus(this); - dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_INIT, Collections.singletonList(this)); - trueTime.getInstance().initTime(); - - super.onCreate(savedInstanceState); - setContentView(R.layout.home_view); - - Thread.setDefaultUncaughtExceptionHandler((t, e) -> { - status.sSettingIsAppStarted = false; - finishAndRemoveTask(); - - Intent intent = new Intent(this, homeController.class); - intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION); - intent.putExtra("crash",true); - this.startActivity(intent); - this.finish(); - - Runtime.getRuntime().exit(0); - }); - - initPreFixes(); - activityContextManager.getInstance().setHomeController(this); - pluginController.getInstance().initializeAllServices(this); - initializeAppModel(); - initializeConnections(); - pluginController.getInstance().initialize(); - initializeLocalEventHandlers(); - initLandingPage(); - initLocalLanguage(); - onInitResume(false); - initSuggestions(); - initAdmob(); - initWidget(); - initSuggestionView(new ArrayList<>(), strings.GENERIC_EMPTY_STR); - status.sSettingIsAppRunning = true; - org.torproject.android.service.util.Prefs.setContext(activityContextManager.getInstance().getHomeController()); - } - - - public void initWidget(){ - if(status.sWidgetResponse == enums.WidgetResponse.SEARCHBAR){ - if(!status.sSettingIsAppStarted){ - if(mSplashScreen.getAlpha()==1 && mConnectButton.isEnabled()){ - onStartApplication(null); - } - }else { - mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); - final Handler handler = new Handler(); - handler.postDelayed(() -> - { - if(mSearchEngineBar.getVisibility() != View.VISIBLE){ - mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); - status.sWidgetResponse = enums.WidgetResponse.NONE; - } - }, 500); - } - } - else if(status.sWidgetResponse == enums.WidgetResponse.VOICE){ - if(!status.sSettingIsAppStarted){ - if(mSplashScreen.getAlpha()==1 && mConnectButton.isEnabled()){ - onStartApplication(null); - } - }else { - if(mSearchEngineBar.getVisibility() != View.VISIBLE){ - onVoiceClick(null); - status.sWidgetResponse = enums.WidgetResponse.NONE; - } - } - } - } - - public void initAdmob(){ - pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS); - } - - public void onInitBooleans(){ - mPageClosed = false; - isKeyboardOpened = false; - isSuggestionChanged = false; - isSuggestionSearchOpened = false; - isFocusChanging = false; - mAppRestarted = false; - mSearchBarLoading = false; - } - - public void initSuggestions(){ - mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mSearchbar.getText().toString())); - } - - public void onInitResume(boolean pStatus){ - if(status.mThemeApplying){ - mSplashScreen.setAlpha(0); - mSplashScreen.setVisibility(View.GONE); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - mHomeViewController.initStatusBarColor(false); - }else { - Window window = getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - window.setStatusBarColor(ContextCompat.getColor(this, R.color.c_text_v3)); - } - mHomeViewController.splashScreenDisableInstant(); - onLoadTabOnResume(); - mSearchLock.setColorFilter(ContextCompat.getColor(this, R.color.c_lock_tint)); - } - initSuggestionView(new ArrayList<>(), strings.GENERIC_EMPTY_STR); - } - - - public void onLoadTabFromTabController(){ - - Object mTempModel = dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); - if(mTempModel!=null){ - tabRowModel model = (tabRowModel)mTempModel; - if(model.getSession().onGetInitializeFromStartup()){ - mGeckoClient.getmRuntime(); - mGeckoClient.initSession(model.getSession()); - mGeckoView.releaseSession(); - mGeckoView.setSession(model.getSession()); - - if(!model.getSession().isOpen()){ - model.getSession().open(mGeckoClient.getmRuntime()); - onLoadURL(model.getSession().getCurrentURL()); - } - - mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this); - mGeckoClient.onSessionReinit(); - } - - if(mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ - mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - if(model.getSession().onGetInitializeFromStartup()) { - mHomeViewController.progressBarReset(); - } - }else { - mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,false,false); - }else { - if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GENESIS_URL)){ - mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } - } - } - - public void onLoadTabOnResume(){ - Object mTempModel = dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); - if(mTempModel!=null){ - tabRowModel model = (tabRowModel)mTempModel; - if(!status.mThemeApplying){ - mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(), false, false, false); - } - onLoadTab(model.getSession(),false,true); - }else { - onNewIntent(getIntent()); - onOpenLinkNewTab(helperMethod.getDomainName(mHomeModel.getSearchEngine())); - } - initTabCountForced(); - if(!status.mThemeApplying){ - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false); - } - } - - @SuppressLint("ClickableViewAccessibility") - private void initSuggestionView(ArrayList pList, String pSearch){ - if(mHintListView.getAdapter() == null){ - hintAdapter mAdapter = new hintAdapter(pList,new hintViewCallback(), this, pSearch); - mHintListView.setAdapter(mAdapter); - mHintListView.setLayoutManager(new LinearLayoutManager(this)); - mHintListView.setHasFixedSize(true); - mHintListView.setItemViewCacheSize(10); - mHintListView.setItemViewCacheSize(10); - mHintListView.setDrawingCacheEnabled(true); - mHintListView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); - - Objects.requireNonNull(mHintListView.getItemAnimator()).setChangeDuration(0); - Objects.requireNonNull(mHintListView.getItemAnimator()).setAddDuration(0); - - findViewById(R.id.pSuggestionScroll).setOnTouchListener((v, event) -> { - if (MotionEvent.ACTION_DOWN == event.getAction()) { - helperMethod.hideKeyboard(this); - } - return false; - }); - }else { - onUpdateSuggestionList(mSuggestions); - } - } - - public void onUpdateSuggestionList(ArrayList pList){ - ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onUpdateAdapter(pList, mSearchbar.getText().toString()); - } - - private void initLocalLanguage() { - pluginController.getInstance().onLanguageInvoke(Arrays.asList(this, status.sSettingLanguage, status.sSettingLanguageRegion, status.mThemeApplying),pluginEnums.eLangManager.M_SET_LANGUAGE); - } - - @Override - protected void onNewIntent(Intent intent) - { - super.onNewIntent(intent); - Uri data = intent.getData(); - if(data!=null){ - status.sSettingIsAppRedirected = true; - status.sSettingRedirectStatus = data.toString(); - if(status.sSettingIsAppStarted){ - mSplashScreen.setAlpha(0); - mSplashScreen.setVisibility(View.GONE); - } - onStartApplication(null); - } - } - - public void initLandingPage(){ - if(status.sSettingFirstStart){ - helperMethod.openActivity(landingController.class, constants.CONST_LIST_HISTORY, homeController.this,false); - } - } - - public void initializeAppModel() - { - mHomeViewController = new homeViewController(); - mHomeModel = new homeModel(); - } - - public void initializeConnections() - { - mGeckoView = findViewById(R.id.pWebView); - mTopBarContainer = findViewById(R.id.pTopBarContainer); - mProgressBar = findViewById(R.id.pProgressBar); - mSplashScreen = findViewById(R.id.pSplashScreen); - mSearchbar = findViewById(R.id.pSearchInput); - mLoadingText = findViewById(R.id.pOrbotLogs); - mWebViewContainer = findViewById(R.id.pWebLayoutView); - mTopLayout = findViewById(R.id.pTopLayout); - mLoadingIcon = findViewById(R.id.pLoadingIcon); - mBannerAds = findViewById(R.id.pAdView); - mGatewaySplash = findViewById(R.id.pSettings); - mTopBar = findViewById(R.id.pTopbar); - mBackSplash = findViewById(R.id.pTopImage); - mConnectButton = findViewById(R.id.Connect); - mNewTab = findViewById(R.id.pNewTab); - mSearchEngineBar = findViewById(R.id.pSearchEngineBar); - mFindText = findViewById(R.id.pFindText); - mFindCount = findViewById(R.id.pFindCount); - mVoiceInput = findViewById(R.id.pVoiceInput); - mMenu = findViewById(R.id.pMenu); - mBlocker = findViewById(R.id.pBlocker); - mNestedScroll = findViewById(R.id.pNestedScroll); - mBlockerFullSceen = findViewById(R.id.pBlockerFullSceen); - mCopyright = findViewById(R.id.pCopyright); - mHintListView = mSearchEngineBar.findViewById(R.id.pHistListView); - mAppBar = findViewById(R.id.pAppbar); - mSearchLock = findViewById(R.id.pSearchLogo); - mOrbotLogManager = findViewById(R.id.pOrbotLogManager); - mFindBar = findViewById(R.id.pFindBar); - mInfoPortrait = findViewById(R.id.pInfoPortrait); - mInfoLandscape = findViewById(R.id.pInfoLandscape); - mProgressBarIndeterminate = findViewById(R.id.pProgressBarIndeterminate); - mTabFragment = findViewById(R.id.mTabFragment); - mPopupLoadNewTab = findViewById(R.id.pPopupLoadNewTab); - mTopBarHider = findViewById(R.id.pTopBarHider); - mNewTabBlocker = findViewById(R.id.pNewTabBlocker); - mCoordinatorLayout = findViewById(R.id.pCoordinatorLayout); - mImageDivider = findViewById(R.id.pImageDivider); - mPanicButton = findViewById(R.id.pPanicButton); - mPanicButtonLandscape = findViewById(R.id.pPanicButtonLandscape); - mGenesisLogo = findViewById(R.id.pGenesisLogo); - - mGeckoView.setSaveEnabled(false); - mGeckoView.setSaveFromParentEnabled(false); - mGeckoView.setAutofillEnabled(true); - - mGeckoClient = new geckoClients(); - mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mPopupLoadNewTab, mTopBarHider, mNewTabBlocker, mCoordinatorLayout, mImageDivider, mPanicButton, mGenesisLogo, mPanicButtonLandscape); - mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback()); - mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false); - mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this); - dataController.getInstance().initializeListData(); - } - - public void onUpdateStatusBarTheme(){ - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); - } - - public boolean inSignatureArea(MotionEvent ev) { - float mEventY = ev.getY(); - return mEventY>mTopBar.getY()+mTopBar.getHeight() && mEventY - { - pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_APPLICATION_CRASH); - }, 2000); - } - - if(!status.mThemeApplying){ - orbotLocalConstants.mTorLogsStatus = strings.GENERIC_EMPTY_STR; - } - - Class clazz = Class.forName("java.lang.Daemons$FinalizerWatchdogDaemon"); - - Method method = Objects.requireNonNull(clazz.getSuperclass()).getDeclaredMethod("stop"); - method.setAccessible(true); - - Field field = clazz.getDeclaredField("INSTANCE"); - field.setAccessible(true); - - method.invoke(field.get(null)); - } - catch (Throwable e) { - e.printStackTrace(); - } - } - - public void initializeGeckoView(boolean isForced, boolean pDatabaseSavable){ - mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,isForced); - onSaveCurrentTab(mGeckoClient.getSession(),pDatabaseSavable); - initTabCountForced(); - } - - public void initTab(boolean isKeyboardOpened){ - postNewTabAnimation(isKeyboardOpened, false); - initTabCountForced(); - } - - @Override - protected void attachBaseContext(Context base) { - SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(base); - status.sTheme = mPrefs.getInt(keys.SETTING_THEME,enums.Theme.THEME_DEFAULT); - Prefs.setContext(base); - orbotLocalConstants.mHomeContext = new WeakReference<>(base); - - Context mContext = activityThemeManager.getInstance().initTheme(base); - activityContextManager.getInstance().setApplicationContext(mContext.getApplicationContext()); - super.attachBaseContext(LocaleHelper.onAttach(mContext, Prefs.getDefaultLocale())); - } - - /*-------------------------------------------------------Helper Methods-------------------------------------------------------*/ - - public void onGetFavIcon(ImageView pImageView, String pURL){ - mGeckoClient.onGetFavIcon(pImageView, pURL, homeController.this); - } - - public void onGetThumbnail(ImageView pImageView,boolean pLoadTabView){ - try{ - mRenderedBitmap = mGeckoView.capturePixels(); - }catch (Exception ignored){} - if(mScrollHandler!=null){ - mScrollHandler.removeCallbacksAndMessages(null); - } - new Handler().postDelayed(() -> - { - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, pImageView, mGeckoView, pLoadTabView)); - }, 100); - } - - - public void onLoadFont(){ - mGeckoClient.onUpdateFont(); - mHomeViewController.onReDraw(); - } - - public void onLoadProxy(View view){ - if(pluginController.getInstance().isInitialized() && !mPageClosed){ - helperMethod.openActivity(orbotController.class, constants.CONST_LIST_HISTORY, homeController.this,true); - } - } - - public void initRuntimeSettings() - { - mGeckoClient.updateSetting(mGeckoView, homeController.this); - } - - public void onReDrawGeckoview(){ - mGeckoClient.getSession().close(); - mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false); - } - - - public void onLoadURL(String url){ - if(mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ - mGeckoView.getSession().open(mGeckoClient.getmRuntime()); - } - - mAppBar.animate().cancel(); - Objects.requireNonNull(mGeckoView.getSession()).stop(); - mGeckoClient.loadURL(url.replace("genesis.onion","genesishiddentechnologies.com"),mGeckoView, homeController.this); - } - - public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed, boolean pExpandAppBar){ - - if(!isSessionClosed){ - dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession)); - } - - if(mTempSession.isOpen()){ - if(mTempSession.getSessionID().equals(mGeckoClient.getSession().getSessionID())){ - return; - } - } - - mGeckoClient.getmRuntime(); - mGeckoClient.initSession(mTempSession); - mGeckoView.releaseSession(); - mGeckoView.setSession(mTempSession); - - if(!mTempSession.isOpen()){ - mTempSession.open(mGeckoClient.getmRuntime()); - onLoadURL(mTempSession.getCurrentURL()); - } - - mHomeViewController.onClearSelections(false); - mHomeViewController.onUpdateSearchBar(mTempSession.getCurrentURL(),false,true, false); - if(mTempSession.getProgress()>0 && mTempSession.getProgress()<100){ - mHomeViewController.onProgressBarUpdate(mTempSession.getProgress(), false); - }else { - mHomeViewController.progressBarReset(); - } - - mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this); - mGeckoClient.onSessionReinit(); - mHomeViewController.onUpdateStatusBarTheme(mTempSession.getTheme(), false); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(),false); - - try{ - mRenderedBitmap = mGeckoView.capturePixels(); - }catch (Exception ignored){} - - if(pExpandAppBar){ - mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); - } - - if(mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ - mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - }else { - mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } - - mHomeViewController.onProgressBarUpdate(mGeckoClient.getSession().getProgress(),true); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false)); - - - TouchView(mGeckoView); - TouchView(mNestedScroll); - - } - - public void TouchView(View view) - { - long downTime = 3000; - long eventTime = 3000; - float x = 0f; - float y = 100f; - - int metaState = 0; - MotionEvent motionEvent = MotionEvent.obtain( - downTime, - eventTime, - MotionEvent.ACTION_SCROLL, - x, - y, - metaState - ); - - view.dispatchTouchEvent(motionEvent); - - view.dispatchTouchEvent(MotionEvent.obtain(0,0,MotionEvent.ACTION_DOWN, -1,-1,0.5f,5,0,1,1,0,0)); - } - /*-------------------------------------------------------USER EVENTS-------------------------------------------------------*/ - - private BroadcastReceiver downloadStatus = new BroadcastReceiver() - { - @Override - public void onReceive(Context context, Intent intent) - { - long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); - - DownloadManager dMgr = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); - Cursor c= Objects.requireNonNull(dMgr).query(new DownloadManager.Query().setFilterById(id)); - - if(c.moveToFirst()){ - String url = c.getString(c.getColumnIndex(DownloadManager.COLUMN_URI)); - onNotificationInvoked(URLUtil.guessFileName(url, null, null), enums.etype.download_folder); - } - } - }; - - @SuppressLint("NewApi") - @Override - public void onTrimMemory(int level) { - super.onTrimMemory(level); - - switch (level) { - case TRIM_MEMORY_BACKGROUND: - Log.i("wow : ", "trim memory requested: app in the background"); - break; - - case TRIM_MEMORY_COMPLETE: - Log.i("wow : ", "trim memory requested: cleanup all memory"); - break; - - case TRIM_MEMORY_MODERATE: - Log.i("wow : ", "trim memory requested: clean up some memory"); - break; - case TRIM_MEMORY_RUNNING_CRITICAL: - Log.i("wow : ", "trim memory requested: memory on device is very low and critical"); - break; - - case TRIM_MEMORY_RUNNING_LOW: - Log.i("wow : ", "trim memory requested: memory on device is running low"); - break; - - case TRIM_MEMORY_RUNNING_MODERATE: - Log.i("wow : ", "trim memory requested: memory on device is moderate"); - break; - - case TRIM_MEMORY_UI_HIDDEN: - Log.i("wow : ", "trim memory requested: app is not showing UI anymore"); - break; - } - } - - @SuppressLint("ClickableViewAccessibility") - @Override - protected void onDestroy() { - if(!status.sSettingIsAppStarted){ - super.onDestroy(); - return; - } - pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.mThemeApplying), pluginEnums.eOrbotManager.M_DESTROY); - mBackSplash.setImageDrawable(null); - mBackSplash.setBackground(null); - - if(!status.mThemeApplying){ - if(!status.sSettingIsAppStarted){ - Intent intent = new Intent(getApplicationContext(), OrbotService.class); - stopService(intent); - }else { - NotificationManagerCompat.from(this).cancelAll(); - } - } - - KeyboardUtils.removeAllKeyboardToggleListeners(); - mGatewaySplash.setOnTouchListener(null); - - ((ConstraintLayout)mGatewaySplash.getParent()).removeView(mGatewaySplash); - ((ConstraintLayout)mGeckoView.getParent()).removeView(mGeckoView); - ((ConstraintLayout)mTabFragment.getParent()).removeView(mTabFragment); - ((LinearLayout)mSearchbar.getParent()).removeView(mSearchbar); - - mTabFragment = null; - mNestedScroll = null; - mGeckoView.setOnFocusChangeListener(null); - mGeckoView.setOnTouchListener(null); - mGeckoView.destroyDrawingCache(); - mGeckoView.releaseSession(); - mGeckoClient.onDestroy(); - - mGeckoView.onDestroy(); - mGeckoClient=null; - mHomeViewController = null; - activityContextManager.getInstance().setHomeController(null); - mGeckoView.releaseSession(); - mGeckoView = null; - - activityContextManager.getInstance().setHomeController(null); - activityContextManager.getInstance().setCurrentActivity(null); - pluginController.getInstance().onRemoveInstances(); - - unregisterReceiver(downloadStatus); - - super.onDestroy(); - } - - @SuppressLint("ClickableViewAccessibility") - private void initializeLocalEventHandlers() { - - startService(new Intent(getBaseContext(), activityStateManager.class)); - - registerReceiver(downloadStatus,new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); - - mNewTab.setOnTouchListener((v, event) -> { - if(event.getAction() == MotionEvent.ACTION_DOWN){ - mTopBarContainer.getLayoutTransition().setDuration(200); - onOpenTabViewBoundary(null); - mNewTab.setPressed(true); - } - return true; - }); - - mFindText.addTextChangedListener(new TextWatcher() { - - @Override - public void afterTextChanged(Editable s) { - } - - @Override - public void beforeTextChanged(CharSequence s, int start,int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start,int before, int count) { - if(!mSearchbar.isFocused()){ - if(mFindText.getText().length()==0 && mGeckoClient!=null){ - mGeckoClient.getSession().getFinder().clear(); - mHomeViewController.onUpdateFindBarCount(0,0); - }else if(mGeckoClient!=null){ - mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_MATCH_CASE & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); - - } - } - } - }); - - mSearchbar.setOnEditorActionListener((v, actionId, event) -> - { - if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE) - { - onSearchBarInvoked(v); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true,true, false); - mHomeViewController.onClearSelections(true); - mGeckoClient.setLoading(true); - final Handler handler = new Handler(); - handler.postDelayed(() -> mHomeViewController.onClearSelections(false), 500); - } - return true; - }); - - mGatewaySplash.setOnTouchListener((v, event) -> - { - if (event.getAction() == MotionEvent.ACTION_DOWN) - mGatewaySplash.setElevation(9); - else if (event.getAction() == MotionEvent.ACTION_UP) - mGatewaySplash.setElevation(2); - return false; - }); - - mGeckoView.setOnTouchListener((v, event) -> { - mHomeViewController.onClearSelections(true); - if (event.getAction() == MotionEvent.ACTION_DOWN){ - mGatewaySplash.setElevation(9); - status.sUIInteracted = true; - mHomeViewController.onUpdateFindBar(false); - } - - return false; - }); - - mGeckoView.setOnFocusChangeListener((v, hasFocus) -> { - if(hasFocus) - { - pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); - if (!mGeckoClient.getSession().getCurrentURL().equals("about:blank")){ - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, true, false); - } - - final Handler handler = new Handler(); - handler.postDelayed(() -> getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE), 300); - - }else { - getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); - } - }); - - - mSearchbar.addTextChangedListener(new TextWatcher() { - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - new Handler().postDelayed(() -> - { - String mText = mSearchbar.getText().toString(); - if(status.sSearchSuggestionStatus && isSuggestionChanged){ - String mURL = mSearchbar.getText().toString(); - - if(!mURL.equals(strings.GENERIC_EMPTY_STR) && isLetter(mSearchbar.getText().toString().charAt(0)) && mSearchbar.getText().toString().contains(".")){ - mHomeViewController.onUpdateSearchIcon(2); - }else{ - mHomeViewController.onUpdateSearchIcon(0); - } - if(mSearchEngineBar.getVisibility() == View.GONE){ - mSearchBarLoadingOpening = true; - } - if(mSearchBarLoadingOpening){ - mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION, Collections.singletonList(mText)); - mHomeViewController.onUpdateSearchEngineBar(true, 0); - onUpdateSuggestionList(mSuggestions); - mEdittextChanged.postDelayed(postToServerRunnable, 0); - mSearchBarLoadingOpening = true; - mSearchBarLoading = false; - - mEdittextChanged.removeCallbacks(postToServerRunnable); - mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mText)); - mEdittextChanged.postDelayed(postToServerRunnable, 150); - return; - } - if(mSuggestions.size()>0){ - mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mText)); - if(mHintListView.getAdapter()==null){ - initSuggestionView(mSuggestions, mText.toString()); - }else if(!mSearchBarLoadingOpening){ - mEdittextChanged.removeCallbacks(postToServerRunnable); - if(!mSearchBarLoading){ - mSearchBarLoading = true; - mEdittextChanged.postDelayed(postToServerRunnable, 0); - }else{ - mEdittextChanged.postDelayed(postToServerRunnable, 150); - } - } - } - } - - }, 0); - } - - @Override - public void afterTextChanged(Editable s) { - - } - - @Override - public void beforeTextChanged(CharSequence s, int start,int count, int after) { - } - - }); - - mSearchbar.setEventHandler(new edittextManagerCallback()); - - mSearchbar.setOnFocusChangeListener((v, hasFocus) -> { - status.sUIInteracted = true; - if(!hasFocus) - { - mSearchBarWasBackButtonPressed = true; - new Handler().postDelayed(() -> - { - mSearchBarWasBackButtonPressed = false; - }, 100); - - if(!isSuggestionSearchOpened){ - if(isSuggestionChanged){ - isSuggestionChanged = false; - if(mHintListView!=null && mHintListView.getAdapter()!=null && mHintListView.getAdapter().getItemCount()>0){ - mHomeViewController.onUpdateSearchEngineBar(false, 150); - ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); - } - mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); - if(!mGeckoClient.isLoading()){ - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false); - } - helperMethod.hideKeyboard(homeController.this); - } - } - mSearchbar.setSelection(0); - }else { - mSearchBarWasBackButtonPressed = false; - if(!isFocusChanging){ - if(!status.mThemeApplying){ - mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); - } - isSuggestionChanged = true; - isSuggestionSearchOpened = false; - } - } - }); - - KeyboardUtils.addKeyboardToggleListener(this, isVisible -> isKeyboardOpened = isVisible); - - mNestedScroll.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { - if(v.getChildAt(v.getChildCount() - 1) != null) { - if ((scrollY >= (v.getChildAt(v.getChildCount() - 1).getMeasuredHeight() - v.getMeasuredHeight())) && scrollY > oldScrollY) { - } - } - onInvokePixelGenerator(); - }); - } - - private ArrayList mSuggestions; - private Handler mEdittextChanged = new Handler(); - private Runnable postToServerRunnable = () -> { - mSearchBarLoadingOpening = false; - onUpdateSuggestionList(mSuggestions); - final Handler handler = new Handler(); - handler.postDelayed(() -> { - mSearchBarLoading = false; - }, 150); - }; - - public void onSearchBarInvoked(View view){ - String url = ((EditText)view).getText().toString(); - String validated_url = mHomeModel.urlComplete(url, mHomeModel.getSearchEngine()); - url = validated_url; - - mHomeViewController.onUpdateSearchBar(url,false,true, false); - onLoadURL(url); - } - - public void onSearchString(String pString){ - String validated_url = mHomeModel.urlComplete(pString, mHomeModel.getSearchEngine()); - pString = validated_url; - - mHomeViewController.onUpdateSearchBar(pString,false,true, false); - onLoadURL(pString); - } - - public void onSuggestionInvoked(View view){ - String mVal = ((TextView)view.findViewById(R.id.pURL)).getText().toString(); - if(mVal.equals(strings.GENERIC_EMPTY_STR)){ - mVal = ((TextView)view.findViewById(R.id.pHeaderSingle)).getText().toString(); - } - String pURL = mHomeModel.urlComplete(mVal, status.sSettingSearchStatus); - - mHomeViewController.onClearSelections(true); - mHomeViewController.onUpdateSearchBar(pURL,false,true, true); - - String finalPURL = pURL; - new Handler().postDelayed(() -> - { - onLoadURL(finalPURL); - }, 250); - } - - public void onSuggestionMove(View view){ - String val = view.getTag().toString(); - mHomeViewController.onUpdateSearchBar(val,false,false, true); - } - - public void onHomeButton(View view){ - - mGeckoClient.getSession().setTheme(null); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); - onLoadURL(helperMethod.getDomainName(mHomeModel.getSearchEngine())); - mHomeViewController.onUpdateLogo(); - } - - /*TAB CONTROLLER EVENTS*/ - public void onMenuTrigger(View pView){ - activityContextManager.getInstance().getTabController().onMenuTrigger(pView); - } - - public void openTabMenu(View view) { - activityContextManager.getInstance().getTabController().openTabMenu(view); - } - - public void onRemoveSelection(View view) { - activityContextManager.getInstance().getTabController().onRemoveSelection(view); - } - - public void onLoadRecentTab(View view){ - mHomeViewController.onHideLoadTabDialog(); - tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_RECENT_TAB, null); - if(model!=null && !mGeckoClient.getSession().getSessionID().equals(model.getSession().getSessionID())){ - Log.i("FUCK::1",model.getSession().getCurrentURL()); - mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(),false,false,true); - Log.i("FUCK::2",model.getSession().getCurrentURL()); - onLoadTab(model.getSession(), false,true); - Log.i("FUCK::3",model.getSession().getCurrentURL()); - } - } - - public void onRestoreTab(View view){ - activityContextManager.getInstance().getTabController().onRestoreTab(view); - } - - public void onClearSelection(View view){ - activityContextManager.getInstance().getTabController().onClearSelection(view); - } - - public geckoSession onNewTabInit(){ - return mGeckoClient.initFreeSession(mGeckoView, this, new geckoViewCallback()); - } - - public void postNewTabAnimation(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){ - initializeGeckoView(true, true); - if(status.sOpenURLInNewTab){ - if(mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ - mGeckoView.getSession().open(mGeckoClient.getmRuntime()); - } - - mHomeViewController. onUpdateSearchBar(helperMethod.getDomainName(status.sSettingSearchStatus),false,true, false); - onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus)); - mGeckoView.getSession().setActive(true); - - }else { - onLoadURL("about:blank"); - mHomeViewController. onUpdateSearchBar(strings.HOME_BLANK_PAGE,false,true, false); - mHomeViewController.onNewTab(); - } - mHomeViewController.progressBarReset(); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); - } - - public void postNewLinkTabAnimation(String url,boolean isRemovable){ - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false)); - initializeGeckoView(true, true); - mHomeViewController.progressBarReset(); - mHomeViewController.onUpdateSearchBar(url,false,true, false); - mGeckoClient.loadURL(url, mGeckoView, homeController.this); - - if(isRemovable){ - mGeckoClient.setRemovableFromBackPressed(true); - } - } - - public void postNewLinkTabAnimationInBackgroundTrigger(String url){ - String mExtention = helperMethod.getMimeType(url, this); - if(mExtention == null || mExtention.equals("text/html") || mExtention.equals("application/vnd.ms-htmlhelp") || mExtention.equals("application/vnd.sun.xml.writer") || mExtention.equals("application/vnd.sun.xml.writer.global") || mExtention.equals("application/vnd.sun.xml.writer.template") || mExtention.equals("application/xhtml+xml")){ - initTabCount(M_NEW_LINK_IN_NEW_TAB, Collections.singletonList(url)); - }else { - postNewLinkTabAnimation(url, true); - } - } - - public void postNewLinkTabAnimationInBackground(String url){ - mAppBar.setTag(R.id.expandableBar,false); - geckoSession mSession = mGeckoClient.getSession(); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false)); - mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,true); - mHomeViewController.progressBarReset(); - mGeckoClient.initURL(url); - mGeckoClient.loadURL(url, mGeckoView, homeController.this); - mGeckoClient.getSession().setURL(url); - onSaveCurrentTab(mGeckoClient.getSession(),false); - onLoadTab(mSession,false,false); - - - mAppBar.setTag(R.id.expandableBar,true); - initTabCountForced(); - mHomeViewController.onUpdateSearchBar(mSession.getCurrentURL(),false,true, false); - } - - public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){ - - try{ - mRenderedBitmap = mGeckoView.capturePixels(); - }catch (Exception ignored){} - - new Handler().postDelayed(() -> - { - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false)); - if(status.sSettingSearchStatus.startsWith("https://genesishiddentechnologies.com") || !status.sOpenURLInNewTab || mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ - mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } - - if(status.sOpenURLInNewTab){ - mGeckoClient.resetSession(); - mHomeViewController.onUpdateSearchBar(helperMethod.getDomainName(mHomeModel.getSearchEngine()), false, false,false); - - if(status.sSettingSearchStatus.startsWith("https://genesishiddentechnologies.com")){ - mHomeViewController.progressBarReset(); - }else { - mHomeViewController.onProgressBarUpdate(5, true); - } - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); - } - mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), M_INITIALIZE_TAB_SINGLE); - }, 100); - } - - public void onUpdateScreenPixel(){ - - } - - public void onNewTabBackground(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){ - if(status.sSettingSearchStatus.startsWith("https://genesishiddentechnologies.com") || !status.sOpenURLInNewTab || mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ - mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } - - if(status.sOpenURLInNewTab){ - mGeckoClient.resetSession(); - mHomeViewController.onUpdateSearchBar(helperMethod.getDomainName(mHomeModel.getSearchEngine()), false, false,false); - - if(status.sSettingSearchStatus.startsWith("https://genesishiddentechnologies.com")){ - mHomeViewController.progressBarReset(); - }else { - mHomeViewController.onProgressBarUpdate(5, true); - } - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); - } - - mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), M_INITIALIZE_TAB_SINGLE); - } - - public String completeURL(String pURL){ - return mHomeModel.urlComplete(pURL, mHomeModel.getSearchEngine()); - } - - public void onOpenLinkNewTab(String url){ - mNewTab.setPressed(true); - final Handler handler = new Handler(); - handler.postDelayed(() -> { - onGetThumbnail(null, false); - mHomeViewController.expandTopBar(false,mGeckoView.getMaxY()); - if(status.sSettingSearchStatus.startsWith("https://genesishiddentechnologies.com") || !status.sOpenURLInNewTab || mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ - mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } - mHomeViewController.onNewTabAnimation(Collections.singletonList(url), M_INITIALIZE_TAB_LINK); - }, 100); - } - - public void onClearSelectionTab(){ - mNewTab.setPressed(false); - } - - public void onOpenTabViewBoundary(View view){ - onInvokePixelGenerator(); - if(mScrollHandler!=null){ - mScrollHandler.removeCallbacksAndMessages(null); - } - onInvokePixelGenerator(); - mNewTab.setPressed(true); - onOpenTabReady(); - } - - public void onOpenTabReady(){ - if(!status.mThemeApplying){ - runOnUiThread(() -> { - mHomeViewController.onShowTabContainer(); - pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); - activityContextManager.getInstance().getTabController().onInitInvoked(); - }); - } - } - - public void onLoadFirstElement(){ - activityContextManager.getInstance().getTabController().onInitFirstElement(); - } - - public void onLockSecure(View view){ - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(mGeckoClient.getSession().getCurrentURL(), status.sSettingJavaStatus, status.sStatusDoNotTrack, status.sSettingTrackingProtection, status.sSettingCookieStatus, this), M_SECURE_CONNECTION); - } - - public void onNotificationInvoked(String message,enums.etype e_type){ - mHomeViewController.downloadNotification(message,e_type); - } - - public void onOpenMenuItem(View view){ - status.sUIInteracted = true; - pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); - initLocalLanguage(); - - helperMethod.hideKeyboard(this); - mHomeViewController.onOpenMenu(view,mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() == View.INVISIBLE || mGeckoClient.isLoaded()),mGeckoClient.getUserAgent(), mGeckoClient.getSession().getCurrentURL()); - - view.setClickable(false); - new Handler().postDelayed(() -> - { - view.setClickable(true); - }, 500); - - } - - public void onFullScreenSettingChanged(){ - mHomeViewController.initTopBarPadding(); - } - - public void onDisableTabViewController(){ - onResumeDump(); - mHomeViewController.onHideTabContainer(); - activityContextManager.getInstance().getTabController().onExitAndClearBackup(); - activityContextManager.getInstance().getTabController().onPostExit(); - } - - @Override - public void onBackPressed(){ - if(mTabFragment.getVisibility()==View.VISIBLE){ - if(activityContextManager.getInstance().getTabController().isSelectionOpened()){ - activityContextManager.getInstance().getTabController().onClearSelection(null); - }else { - boolean mStatus = activityContextManager.getInstance().getTabController().onBackPressed(); - onResumeDump(); - activityContextManager.getInstance().getTabController().onPostExit(); - if(!mStatus){ - mHomeViewController.onHideTabContainer(); - } - } - return; - } - - if(mFindBar!=null && mFindBar.getVisibility() == View.VISIBLE){ - mHomeViewController.onUpdateFindBar(false); - } - else if(mSearchEngineBar.getVisibility() == View.VISIBLE){ - mHomeViewController.onUpdateSearchEngineBar(false, 150); - ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); - } - else if(!mGeckoClient.getFullScreenStatus()){ - mGeckoClient.onExitFullScreen(); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); - } - else if(mSearchbar.isFocused() || isKeyboardOpened){ - mHomeViewController.onClearSelections(true); - } - else if(!mSearchBarWasBackButtonPressed){ - int mTabSize = (int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null); - mGeckoClient.onBackPressed(true, mTabSize, mGeckoView, this); - } - } - - /*Activity States*/ - - public NestedGeckoView getGeckoView(){ - return mGeckoView; - } - - public void onReload(View view){ - onLoadURL(mSearchbar.getText().toString()); - } - - public void onClearSession(){ - onHomeButton(null); - mGeckoClient.onClearSession(); - } - - public void onClearSiteData(){ - mGeckoClient.onClearSiteData(); - } - - public void onClearCache(){ - mGeckoClient.onClearCache(); - } - - public void onClearCookies(){ - mGeckoClient.onClearCookies(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - super.onConfigurationChanged(newConfig); - - pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); - mHomeViewController.closeMenu(); - - final Handler handler = new Handler(); - handler.postDelayed(() -> mGeckoClient.onRedrawPixel(homeController.this), 300); - if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { - mHomeViewController.setOrientation(true); - if(mGeckoClient.getFullScreenStatus()) - { - mHomeViewController.onSetBannerAdMargin(false, true); - } - - - } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){ - mHomeViewController.setOrientation(false); - if(mGeckoClient.getFullScreenStatus()) - { - mHomeViewController.onSetBannerAdMargin(true,(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } - - if(mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ - mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - }else { - mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } - } - if(mSplashScreen.getAlpha()>0){ - mHomeViewController.initSplashOrientation(); - } - if(mSearchEngineBar.getVisibility() == View.VISIBLE){ - mHomeViewController.onClearSelections(true); - } - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - mHomeViewController.onClearSelections(true); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); - - mHomeViewController.initTopBarPadding(); - mHomeViewController.onSetBannerAdMargin(!mGeckoClient.isLoading(),(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)&&!!mGeckoClient.isLoading()); - - mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); - status.sUIInteracted = true; - } - - @Override - public void onPause(){ - super.onPause(); - if(mHomeViewController!=null){ - mHomeViewController.closeMenu(); - helperMethod.hideKeyboard(this); - } - if(mTabFragment.getVisibility()==View.VISIBLE){ - onResumeDump(); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); - mHomeViewController.onHideTabContainer(); - activityContextManager.getInstance().getTabController().onPostExit(); - activityContextManager.getInstance().getTabController().onBackPressed(); - return; - } - - mHomeViewController.onUpdateSearchEngineBar(false, 0); - mGeckoClient.onExitFullScreen(); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); - pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); - pluginController.getInstance().onNotificationInvoke(Collections.singletonList(172800000) , pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION); - mSearchBarWasBackButtonPressed = false; - if(status.sSettingIsAppStarted){ - status.sUIInteracted = true; - } - mHomeViewController.onUpdateFindBar(false); - mHomeViewController.onClearSelections(isKeyboardOpened); - mTopBarContainer.getLayoutTransition().setDuration(0); - } - - @Override - public void onResume() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - - if (mGeckoClient.getSession()!=null && mGeckoClient!=null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mGeckoClient.getUriPermission()!=null) { - this.revokeUriPermission(mGeckoClient.getUriPermission(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); - - TouchView(mGeckoView); - TouchView(mNestedScroll); - } - - - if(isSuggestionSearchOpened){ - isSuggestionChanged = true; - isFocusChanging = false; - isSuggestionSearchOpened = false; - mSearchbar.requestFocus(); - mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor(), status.sTheme)); - mSearchbar.selectAll(); - mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); - } - - if(mGeckoView!=null){ - tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); - if(model!=null){ - if(mGeckoView!=null && mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ - onReDrawGeckoview(); - onLoadURL(model.getSession().getCurrentURL()); - } - } - } - - if(status.sSettingIsAppStarted){ - mHomeViewController.onClearSelections(isKeyboardOpened); - } - - if(mAppBar!=null){ - mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); - - mAppBar.refreshDrawableState(); - mAppBar.invalidate(); - } - mAppRestarted = true; - pluginController.getInstance().onNotificationInvoke(null, pluginEnums.eNotificationManager.M_CLEAR_NOTIFICATION ); - - if(!status.mThemeApplying){ - //activityContextManager.getInstance().onClearStack(); - } - initWidget(); - initTabCountForced(); - - if(status.sSettingIsAppStarted && !status.mThemeApplying){ - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_INIT_LOCALE); - mHomeViewController.onUpdateSearchEngineBar(false, 0); - mNewTab.setPressed(false); - pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); - } - - if(status.sSettingIsAppStarted && !status.mThemeApplying){ - if(mGeckoClient.getSession().wasPreviousErrorPage()){ - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_NEW_CIRCUIT); - mGeckoClient.onReload(mGeckoView, this); - } - } - - status.mThemeApplying = false; - - super.onResume(); - } - - public void onResumeDump() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - if (mGeckoClient.getSession()!=null && mGeckoClient!=null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mGeckoClient.getUriPermission()!=null) { - this.revokeUriPermission(mGeckoClient.getUriPermission(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); - } - if(isSuggestionSearchOpened){ - tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); - if(model==null){ - onOpenLinkNewTab(status.sSettingSearchStatus); - } - isSuggestionChanged = true; - isFocusChanging = false; - isSuggestionSearchOpened = false; - mSearchbar.requestFocus(); - mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor(), status.sTheme)); - mSearchbar.selectAll(); - mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); - } - - if(status.sSettingIsAppStarted && mAppRestarted) { - activityContextManager.getInstance().onClearStack(); - - tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); - if(model==null){ - mHomeViewController.onProgressBarUpdate(5, false); - initializeGeckoView(false,false); - onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus)); - }else { - if(model.getSession().getSessionID() != mGeckoClient.getSession().getSessionID()){ - onLoadTab(model.getSession(),false,true); - } - } - } - - if(mAppBar!=null){ - mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); - - mAppBar.refreshDrawableState(); - mAppBar.invalidate(); - } - mAppRestarted = true; - pluginController.getInstance().onNotificationInvoke(null, pluginEnums.eNotificationManager.M_CLEAR_NOTIFICATION ); - initTabCountForced(); - initWidget(); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data){ - if(requestCode==100){ - if(resultCode == RESULT_OK && null != data){ - mSearchbar.clearFocus(); - ArrayList result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); - mSearchbar.setText(result.get(0).toLowerCase()); - helperMethod.hideKeyboard(homeController.this); - mGeckoClient.setLoading(true); - onSearchBarInvoked(mSearchbar); - final Handler handler = new Handler(); - handler.postDelayed(() -> mGeckoView.clearFocus(), 500); - } - } - - else if(requestCode==1){ - mGeckoClient.onUploadRequest(resultCode,data); - } - else { - super.onActivityResult(requestCode, resultCode, data); - } - } - - public void onSetBannerAdMargin(){ - mHomeViewController.onSetBannerAdMargin(true,(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } - - public void onVoiceClick(View view) { - if(status.sSettingEnableVoiceInput || status.sWidgetResponse == enums.WidgetResponse.VOICE){ - Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); - intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); - intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); - intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Voice2Text \n Say Something!!"); - try { - startActivityForResult(intent, 100); - } catch (ActivityNotFoundException ignored) { - - } - }else { - mSearchbar.clearFocus(); - new Handler().postDelayed(() -> - { - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false); - }, 170); - } - } - /*-------------------------------------------------------External Callback Methods-------------------------------------------------------*/ - - public String onGetCurrentURL(){ - return mGeckoClient.getSession().getCurrentURL(); - } - - public void onStartApplication(View view){ - pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sBridgeCustomBridge, status.sBridgeGatewayManual, status.sBridgeCustomType, status.sBridgeStatus, status.sShowImages, status.sClearOnExit, (String)dataController.getInstance().invokeBridges(dataEnums.eBridgeWebsiteCommands.M_FETCH, null)), pluginEnums.eOrbotManager.M_START_ORBOT); - onInvokeProxyLoading(); - mHomeViewController.initHomePage(); - } - - public void onDownloadFile(){ - mGeckoClient.downloadFile(homeController.this); - } - - public void onManualDownload(String url){ - - /*EXTERNAL STORAGE REQUEST*/ - mGeckoClient.manual_download(url,this); - } - - public void onManualDownloadFileName(String pURL, String pPath){ - - /*EXTERNAL STORAGE REQUEST*/ - mGeckoClient.manualDownloadWithName(pURL,pPath,this); - } - - public AdView getBannerAd() - { - return mBannerAds; - } - - public void onInvokeProxyLoading(){ - - Callable callable = () -> { - String mLog = (String) pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_LOGS); - mHomeViewController.onUpdateLogs(mLog); - return strings.GENERIC_EMPTY_STR; - }; - - mHomeViewController.initProxyLoading(callable); - } - - public void onSaveCurrentTab(geckoSession session,boolean isHardCopy){ - int mStatus = (Integer) dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_ADD_TAB, Arrays.asList(session,isHardCopy)); - if(mStatus == enums.AddTabCallback.TAB_FULL){ - pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_MAX_TAB_REACHED); - } - } - - public boolean onCloseCurrentTab(geckoSession session){ - dataController.getInstance().invokeTab(dataEnums.eTabCommands.CLOSE_TAB, Arrays.asList(session, session)); - tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); - - session.stop(); - session.close(); - initTabCountForced(); - - if(model!=null){ - if(mTabFragment.getVisibility()!=View.VISIBLE){ - onLoadTab(model.getSession(),true, true); - } - return true; - } - else { - if(mTabFragment.getVisibility()!=View.VISIBLE){ - return false; - }else { - return true; - } - } - } - - public void initTabCount(enums.etype pEvent, List pData){ - mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null), false, pEvent, pData); - } - - public void initTabCountForced(){ - mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null), true, null, null); - } - - /*-------------------------------------------------------CALLBACKS-------------------------------------------------------*/ - - - public void onHideFindBar(View view){ - mHomeViewController.onUpdateFindBar(false); - mGeckoClient.getSession().getFinder().clear(); - } - - public void onClearSearchBar(View view){ - mHomeViewController.onUpdateSearchBar(strings.GENERIC_EMPTY_STR, false, true, false); - } - - public void onFindNext(View view){ - mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_MATCH_CASE & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); - } - - public void onOpenSearchEngine(View view){ - mSearchBarPreviousText = mSearchbar.getText().toString(); - isSuggestionSearchOpened = true; - helperMethod.openActivity(settingSearchController.class,constants.CONST_LIST_HISTORY, homeController.this,true); - } - - public void onFindPrev(View view){ - mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_BACKWARDS & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); - } - - public void onOpenDownloadFolder(View view){ - helperMethod.openDownloadFolder(homeController.this); - } - - public void onMenuItemInvoked(View view){ - int menuId = view.getId(); - if (menuId == R.id.menu11) { - onNewTab(isKeyboardOpened, true); - } - else if (menuId == R.id.menu10) { - if(!onCloseCurrentTab(mGeckoClient.getSession())){ - onNewTab(isKeyboardOpened, true); - } - } - else if (menuId == R.id.menuItem25) { - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(mGeckoClient.getSession().getCurrentURL(), this), M_DOWNLOAD_SINGLE); - } - else { - mSearchbar.clearFocus(); - if (menuId == R.id.menu12) { - mHomeViewController.closeMenu(); - helperMethod.hideKeyboard(this); - helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this,true); - } - else if (menuId == R.id.menu9) { - helperMethod.hideKeyboard(this); - mGeckoClient.onRedrawPixel(homeController.this); - mHomeViewController.onShowTabContainer(); - pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); - Log.i("I AM FUCKED,","I AM FUCKED : 1"); - activityContextManager.getInstance().getTabController().onInit(); - } - else if (menuId == R.id.menu8) { - helperMethod.hideKeyboard(this); - onOpenDownloadFolder(null); - } - else if (menuId == R.id.menu7) { - helperMethod.hideKeyboard(this); - helperMethod.openActivity(historyController.class, constants.CONST_LIST_HISTORY, homeController.this,true); - } - else if (menuId == R.id.menu6) - { - helperMethod.hideKeyboard(this); - helperMethod.openActivity(settingHomeController.class,constants.CONST_LIST_HISTORY, homeController.this,true); - } - else if (menuId == R.id.pMenuDelete) - { - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(this, mGeckoClient.getSession().getCurrentURL()), M_BOOKMARK); - } - else if (menuId == R.id.pMenuOpenRecentTab) - { - onOpenTabViewBoundary(null); - mNewTab.setPressed(true); - } - else if (menuId == R.id.pMenuOpenNewTab) - { - helperMethod.hideKeyboard(this); - helperMethod.openActivity(bookmarkController.class,constants.CONST_LIST_BOOKMARK, homeController.this,true); - } - else if (menuId == R.id.menu28) - { - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_NEW_CIRCUIT); - pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_NEW_IDENTITY); - mGeckoClient.onReload(mGeckoView, this); - } - else if (menuId == R.id.pMenuOpenCurrentTab) - { - helperMethod.hideKeyboard(this); - pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_REPORT_URL); - } - else if (menuId == R.id.pMenuQuit) - { - pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.mThemeApplying), pluginEnums.eOrbotManager.M_DESTROY); - - new Handler().postDelayed(() -> - { - status.sSettingIsAppStarted = false; - finishAndRemoveTask(); - - new Thread(){ - public void run(){ - try { - sleep(1000); - android.os.Process.killProcess(android.os.Process.myPid()); - System.exit(1); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }.start(); - }, 100); - } - else if (menuId == R.id.pMenuFind) - { - helperMethod.hideKeyboard(this); - mHomeViewController.onUpdateFindBar(true); - } - if (menuId == R.id.menu20) { - mGeckoClient.onClose(); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); - helperMethod.hideKeyboard(this); - } - if (menuId == R.id.menu21) { - helperMethod.hideKeyboard(this); - String mUrl = mGeckoClient.getSession().getCurrentURL(); - - if(mUrl.equals(constants.CONST_GENESIS_HELP_URL_CACHE_DARK) && status.sTheme != enums.Theme.THEME_DARK){ - onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE); - } - else if(mUrl.equals(constants.CONST_GENESIS_HELP_URL_CACHE) && status.sTheme != enums.Theme.THEME_LIGHT){ - onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); - } - else if(mUrl.equals(CONST_GENESIS_URL_CACHED_DARK) && status.sTheme != enums.Theme.THEME_DARK){ - onLoadURL(CONST_GENESIS_URL_CACHED); - } - else if(mUrl.equals(constants.CONST_GENESIS_URL_CACHED) && status.sTheme != enums.Theme.THEME_LIGHT){ - onLoadURL(CONST_GENESIS_URL_CACHED_DARK); - }else { - onLoadURL(mGeckoClient.getSession().getCurrentURL()); - } - - } - if (menuId == R.id.menu22) { - helperMethod.hideKeyboard(this); - mHomeViewController.onProgressBarUpdate(5,true); - mGeckoClient.onForwardPressed(); - } - if (menuId == R.id.menu23) { - helperMethod.hideKeyboard(this); - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(mGeckoClient.getSession().getCurrentURL(), this), M_BOOKMARK); - } - if (menuId == R.id.menu24) { - helperMethod.hideKeyboard(this); - onHomeButton(view); - } - if (menuId == R.id.menu26 || menuId == R.id.menu27) { - helperMethod.hideKeyboard(this); - mGeckoClient.toogleUserAgent(); - mGeckoClient.onReload(mGeckoView, homeController.this); - } - if(menuId == R.id.menu25){ - helperMethod.hideKeyboard(this); - helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, homeController.this,true); - } - } - mHomeViewController.closeMenu(); - } - - private void onInitTheme(){ - - if(status.mThemeApplying){ - if(status.sTheme == enums.Theme.THEME_DARK){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - }else if(status.sTheme == enums.Theme.THEME_LIGHT){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - }else { - if(!status.sDefaultNightMode){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - }else { - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - } - } - } - } - - public void onReInitTheme(){ - recreate(); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); - } - - public void onOrbotLog(View view) { - mHomeViewController.closeMenu(); - helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this,true); - } - - public void panicExit(View view) { - pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); - pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_PANIC_RESET); - } - - public void panicExitInvoked() { - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE, strings.SETTING_DEFAULT_LANGUAGE)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); - - - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); - dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null)); - dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); - activityContextManager.getInstance().getHomeController().onClearCache(); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); - activityContextManager.getInstance().getHomeController().onClearSiteData(); - activityContextManager.getInstance().getHomeController().onClearSession(); - activityContextManager.getInstance().getHomeController().onClearCookies(); - onClearSettings(); - status.initStatus(activityContextManager.getInstance().getHomeController()); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); - activityContextManager.getInstance().getHomeController().initRuntimeSettings(); - pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_DATA_CLEARED); - activityContextManager.getInstance().getHomeController().onClearSettings(); - - status.sSettingIsAppStarted = false; - finishAndRemoveTask(); - - Intent intent = new Intent(this, homeController.class); - intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION); - this.startActivity(intent); - overridePendingTransition(R.anim.popup_scale_in, R.anim.popup_scale_out); - this.finish(); - - Runtime.getRuntime().exit(0); - - } - - public class nestedGeckoViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - if(status.sFullScreenBrowsing){ - if(e_type.equals(GECKO_SCROLL_DOWN)){ - mTopBarContainer.getLayoutTransition().setDuration(0); - mHomeViewController.onClearSelections(isKeyboardOpened); - mSearchbar.clearFocus(); - } - else { - int[] locatiosn = new int[2]; - mSearchbar.getLocationOnScreen(locatiosn); - int ys = locatiosn[1]; - if(ys!=0){ - if(ys<=50){ - mHomeViewController.shrinkTopBar(true, mGeckoView.getMaxY()); - }else { - mHomeViewController.expandTopBar(true, mGeckoView.getMaxY()); - } - } - } - } - return null; - } - } - - public class homeViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - if(e_type.equals(enums.etype.M_INIT_TAB_COUNT_FORCED)) - { - initTabCountForced(); - } - else if(e_type.equals(enums.etype.M_NEW_LINK_IN_NEW_TAB)) - { - postNewLinkTabAnimationInBackground(dataToStr(data.get(0))); - mHomeViewController.onShowLoadTabDialog(); - } - else if(e_type.equals(enums.etype.M_RESET_SUGGESTION)) - { - } - else if(e_type.equals(open_new_tab)) - { - if(status.sSettingPopupStatus){ - pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_POPUP_BLOCKED); - }else { - postNewLinkTabAnimation(dataToStr(data.get(0)), true); - } - } - else if(e_type.equals(enums.etype.M_CACHE_UPDATE_TAB)){ - } - else if(e_type.equals(enums.etype.M_UPDATE_PIXEL_BACKGROUND)){ - onInvokePixelGenerator(); - } - else if(e_type.equals(enums.etype.ON_NEW_TAB_ANIMATION)){ - postNewTabAnimation((boolean)data.get(0),(boolean)data.get(1)); - } - else if(e_type.equals(enums.etype.ON_OPEN_TAB_VIEW)){ - onOpenTabViewBoundary(null); - } - else if(e_type.equals(enums.etype.download_folder)) - { - onOpenDownloadFolder(null); - } - else if(e_type.equals(enums.etype.M_UPDATE_THEME)) - { - if(mGeckoClient!=null) { - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); - } - } - else if(e_type.equals(enums.etype.ON_UPDATE_THEME)){ - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(),false); - } - else if(e_type.equals(M_INITIALIZE_TAB_SINGLE)){ - initTabCount(enums.etype.ON_NEW_TAB_ANIMATION,data); - } - else if(e_type.equals(M_INITIALIZE_TAB_LINK)){ - postNewLinkTabAnimation((String)data.get(0),false); - } - else if(e_type.equals(enums.etype.on_init_ads)) - { - mHomeViewController.onSetBannerAdMargin((boolean)data.get(0),(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } - else if(e_type.equals(enums.etype.M_SPLASH_DISABLE)) - { - initWidget(); - } - else if(e_type.equals(enums.etype.M_WELCOME_MESSAGE)){ - if(status.sSettingIsWelcomeEnabled){ - final Handler handler = new Handler(); - Runnable runnable = () -> { - if(!status.sUIInteracted){ - if(mHomeViewController!=null){ - mHomeViewController.closeMenu(); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); - mSearchbar.clearFocus(); - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_WELCOME); - status.sUIInteracted = true; - } - } - }; - handler.postDelayed(runnable, 2500); - } - } - else if(e_type.equals(enums.etype.on_url_load)){ - if(status.sSettingIsAppRedirected){ - mHomeViewController.onPageFinished(); - mGeckoClient.onRedrawPixel(homeController.this); - - status.sSettingIsAppRedirected = false; - onLoadURL(status.sSettingRedirectStatus); - status.sSettingRedirectStatus = strings.GENERIC_EMPTY_STR; - }else { - if(status.mThemeApplying){ - mHomeViewController.onUpdateSearchBar(data.get(0).toString(),false, false, false); - mHomeViewController.splashScreenDisableInstant(); - onLoadTabOnResume(); - } - onLoadURL(data.get(0).toString()); - mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true, false); - } - } - else if(e_type.equals(enums.etype.ON_LOAD_TAB_ON_RESUME)){ - if(status.sSettingIsAppRedirected){ - status.sSettingIsAppRedirected = false; - onLoadURL(status.sSettingRedirectStatus); - status.sSettingRedirectStatus = strings.GENERIC_EMPTY_STR; - }else { - if(status.mThemeApplying){ - mHomeViewController.splashScreenDisableInstant(); - onLoadTabOnResume(); - } - else if(status.sSettingIsAppStarted){ - mHomeViewController.onPageFinished(); - mGeckoClient.onRedrawPixel(homeController.this); - mHomeViewController.onProgressBarUpdate(5, false); - onLoadTabOnResume(); - } - } - } - else if(e_type.equals(enums.etype.open_new_tab_instant)){ - postNewLinkTabAnimation(dataToStr(data.get(0)), true); - } - else if(e_type.equals(enums.etype.M_HOME_PAGE)){ - geckoSession mSession = (geckoSession)dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_HOME_PAGE, null); - if(mSession!=null){ - onLoadTab(mSession, false,true); - } - return dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_HOME_PAGE, null); - } - return null; - } - } - - String dataToStr(Object data,String defaultVal){ - if(data==null){ - return defaultVal; - } - else { - return data.toString(); - } - } - - String dataToStr(Object data){ - if(data==null){ - return strings.GENERIC_EMPTY_STR; - } - else { - return data.toString(); - } - } - - public class edittextManagerCallback implements eventObserver.eventListener { - - @Override - public Object invokeObserver(List data, Object e_type) { - - if(e_type.equals(enums.etype.ON_KEYBOARD_CLOSE)){ - isSuggestionChanged = false; - isFocusChanging = true; - mSearchbar.setSelection(0); - mHomeViewController.onClearSelections(false); - if(!isSuggestionSearchOpened){ - if(mHintListView!=null && mHintListView.getAdapter()!=null && mHintListView.getAdapter().getItemCount()>0){ - mHomeViewController.onUpdateSearchEngineBar(false, 150); - ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); - } - mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); - helperMethod.hideKeyboard(homeController.this); - } - isFocusChanging = false; - } - return null; - } - } - - - public class hintViewCallback implements eventObserver.eventListener { - - @Override - public Object invokeObserver(List data, Object e_type) { - if(e_type.equals(enums.etype.fetch_favicon)){ - mGeckoClient.onGetFavIcon((ImageView) data.get(0), (String) data.get(1), homeController.this); - } - return null; - } - } - - public void onDisableAdvert(){ - mHomeViewController.updateBannerAdvertStatus(false, true); - } - - public void onClearSettings(){ - mHomeViewController.updateBannerAdvertStatus(false, true); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); - activityContextManager.getInstance().getTabController().onCloseAllTabs(); - onLoadTabFromTabController(); - initTabCountForced(); - } - - public void onClearAllTabs(){ - mHomeViewController.updateBannerAdvertStatus(false, true); - } - - public void onInvokePixelGenerator(){ - - if(mTabFragment==null || mTabFragment.getVisibility()==View.VISIBLE){ - return; - } - - if(mScrollHandler!=null){ - mScrollHandler.removeCallbacksAndMessages(null); - } - - mScrollHandler = new Handler(); - mScrollRunnable = () -> { - - try{ - mRenderedBitmap = mGeckoView.capturePixels(); - }catch (Exception ignored){} - new Handler().postDelayed(() -> - { - if(mTabFragment!=null){ - if(mTabFragment.getVisibility()!=View.VISIBLE){ - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, true)); - }else { - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, true)); - } - } - }, 100); - - }; - mScrollHandler.postDelayed(mScrollRunnable, 450); - } - - public class geckoViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - - if(e_type.equals(enums.etype.ON_EXPAND_TOP_BAR)){ - mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); - } - else if(e_type.equals(enums.etype.M_ON_BANNER_UPDATE)){ - Object mAdvertResponse = pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED); - if(mAdvertResponse != null){ - mHomeViewController.updateBannerAdvertStatus((boolean)data.get(3), (boolean)mAdvertResponse); - } - } - else if(e_type.equals(enums.etype.progress_update)){ - mHomeViewController.onProgressBarUpdate((int)data.get(0), false); - } - else if(e_type.equals(enums.etype.M_LOAD_HOMEPAGE_GENESIS)){ - onLoadURL(helperMethod.getDomainName(constants.CONST_BACKEND_GENESIS_URL)); - } - else if(e_type.equals(enums.etype.progress_update_forced)){ - Log.i("SUPPPP7:",(String)data.get(2)); - mHomeViewController.onUpdateSearchBar((String) data.get(2), false, true, false); - mHomeViewController.onProgressBarUpdate((int)data.get(0), true); - } - else if(e_type.equals(enums.etype.ON_UPDATE_SEARCH_BAR)){ - mHomeViewController.onUpdateSearchBar((String)data.get(0), false, false, false); - } - else if(e_type.equals(enums.etype.ON_FIRST_PAINT)){ - mHomeViewController.onFirstPaint(); - } - else if(e_type.equals(enums.etype.ON_SESSION_REINIT)){ - mHomeViewController.onSessionReinit(); - } - else if(e_type.equals(enums.etype.on_url_load)){ - //mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true); - } - else if(e_type.equals(enums.etype.back_list_empty)){ - helperMethod.onMinimizeApp(homeController.this); - } - else if(e_type.equals(enums.etype.M_CLOSE_TAB)){ - onCloseCurrentTab(mGeckoClient.getSession()); - } - else if(e_type.equals(enums.etype.M_ADMOB_BANNER_RECHECK)){ - if(data.get(2).toString().startsWith(CONST_GENESIS_URL_CACHED) || data.get(2).toString().startsWith(CONST_GENESIS_URL_CACHED_DARK) || helperMethod.getHost(data.get(2).toString()).contains("genesishiddentechnologies.com") || data.get(2).toString().startsWith(CONST_GENESIS_HELP_URL_CACHE) || data.get(2).toString().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ - mHomeViewController.updateBannerAdvertStatus(false,true); - } - } - else if(e_type.equals(enums.etype.ON_UPDATE_THEME)){ - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(),false); - } - else if(e_type.equals(enums.etype.start_proxy)){ - pluginController.getInstance().onOrbotInvoke(data, pluginEnums.eOrbotManager.M_SET_PROXY); - } - else if(e_type.equals(enums.etype.on_update_history)){ - return dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_ADD_HISTORY ,data); - } - else if(e_type.equals(enums.etype.on_page_loaded)){ - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_BOOTSTRAPPED,true)); - mHomeViewController.onPageFinished(); - mGeckoClient.onRedrawPixel(homeController.this); - } - else if(e_type.equals(M_RATE_APPLICATION)){ - if(!status.sSettingIsAppRated){ - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true)); - status.sSettingIsAppRated = true; - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_RATE_APP); - } - } - else if(e_type.equals(enums.etype.on_load_error)){ - pluginController.getInstance().onLanguageInvoke(Arrays.asList(homeController.this, status.sSettingLanguage, status.sSettingLanguageRegion, status.mThemeApplying), pluginEnums.eLangManager.M_SET_LANGUAGE); - initLocalLanguage(); - mHomeViewController.onPageFinished(); - mGeckoClient.onRedrawPixel(homeController.this); - mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true, false); - } - else if(e_type.equals(enums.etype.search_update)){ - mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false, true, false); - } - else if(e_type.equals(enums.etype.download_file_popup)){ - List mData = new ArrayList<>(); - mData.addAll(data); - mData.add(homeController.this); - pluginController.getInstance().onMessageManagerInvoke(mData, M_DOWNLOAD_SINGLE); - } - else if(e_type.equals(enums.etype.on_full_screen)){ - boolean status = (Boolean)data.get(0); - mHomeViewController.onFullScreenUpdate(status); - - mHomeViewController.onUpdateSearchEngineBar(false, 0); - } - else if(e_type.equals(enums.etype.on_update_favicon)){ - dataController.getInstance().invokeImage(dataEnums.eImageCommands.M_REQUEST_IMAGE_URL,Collections.singletonList(data.get(0))); - } - else if(e_type.equals(M_LONG_PRESS_WITH_LINK)){ - pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_WITH_LINK); - } - else if(e_type.equals(enums.etype.on_long_press)){ - pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_DOWNLOAD); - } - else if(e_type.equals(M_LONG_PRESS_URL)){ - pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_URL); - } - else if(e_type.equals(open_new_tab)){ - initTabCount(open_new_tab, data); - } - else if(e_type.equals(enums.etype.on_close_sesson)){ - if(!onCloseCurrentTab(mGeckoClient.getSession())){ - postNewTabAnimation(true,true); - } - } - else if(e_type.equals(enums.etype.on_playstore_load)){ - helperMethod.openPlayStore(dataToStr(data.get(0)).split("__")[1],homeController.this); - } - else if(e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE)){ - if(activityContextManager.getInstance().getTabController()!=null && mTabFragment.getVisibility()==View.VISIBLE) - activityContextManager.getInstance().getTabController().onTabRowChanged((String) data.get(1)); - } - else if(e_type.equals(enums.etype.M_RELOAD)){ - onReload(null); - } - else if(e_type.equals(enums.etype.M_UPDATE_SESSION_STATE)){ - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_SESSION_STATE, data); - } - else if(e_type.equals(enums.etype.FINDER_RESULT_CALLBACK)){ - mHomeViewController.onUpdateFindBarCount((int)data.get(0),(int)data.get(1)); - } - else if(e_type.equals(enums.etype.M_ON_MAIL)){ - helperMethod.sendCustomMail(homeController.this, (String)data.get(0)); - } - else if(e_type.equals(enums.etype.M_OPEN_SESSION)){ - tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); - if(model!=null){ - onLoadTab(model.getSession(),true,true); - onLoadURL(model.getSession().getCurrentURL()); - } - } - else if(e_type.equals(enums.etype.M_UPDATE_PIXEL_BACKGROUND)){ - onInvokePixelGenerator(); - } - else if(e_type.equals(enums.etype.M_INIT_PADDING)){ - mHomeViewController.initTopBarPadding(); - } - else if(e_type.equals(enums.etype.M_RATE_COUNT)){ - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_RATE_COUNT, status.sRateCount)); - } - - return null; - } - } -} - +package com.darkweb.genesissearchengine.appManager.homeManager.homeController; + +import android.annotation.SuppressLint; +import android.app.ActivityOptions; +import android.app.DownloadManager; +import android.content.ActivityNotFoundException; +import android.content.BroadcastReceiver; +import android.content.ComponentCallbacks2; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.SharedPreferences; +import android.content.res.Configuration; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.Color; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.preference.PreferenceManager; +import android.speech.RecognizerIntent; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.MotionEvent; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.view.inputmethod.EditorInfo; +import android.webkit.URLUtil; +import android.widget.*; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.app.NotificationManagerCompat; +import androidx.core.content.ContextCompat; +import androidx.core.widget.NestedScrollView; +import androidx.fragment.app.FragmentContainerView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; +import com.darkweb.genesissearchengine.appManager.historyManager.historyController; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; +import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView; +import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.*; +import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; +import com.darkweb.genesissearchengine.appManager.homeManager.hintManager.hintAdapter; +import com.darkweb.genesissearchengine.appManager.landingManager.landingController; +import com.darkweb.genesissearchengine.appManager.languageManager.languageController; +import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; +import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController; +import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; +import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeController; +import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.libs.views.KeyboardUtils; +import com.darkweb.genesissearchengine.appManager.activityStateManager; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.libs.trueTime.trueTime; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.gms.ads.AdView; +import org.mozilla.geckoview.ContentBlocking; +import org.mozilla.geckoview.GeckoResult; +import org.mozilla.geckoview.GeckoSession; +import org.torproject.android.proxy.OrbotService; +import org.torproject.android.proxy.util.Prefs; +import org.torproject.android.proxy.wrapper.LocaleHelper; +import org.torproject.android.proxy.wrapper.orbotLocalConstants; + +import java.io.StringWriter; +import java.lang.ref.WeakReference; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Objects; +import java.util.concurrent.Callable; +import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; +import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; +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.enums.etype.GECKO_SCROLL_DOWN; +import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_LINK; +import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE; +import static com.darkweb.genesissearchengine.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB; +import static com.darkweb.genesissearchengine.constants.enums.etype.open_new_tab; +import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; +import static java.lang.Character.isLetter; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; + +public class homeController extends AppCompatActivity implements ComponentCallbacks2 +{ + /*Model Declaration*/ + private homeViewController mHomeViewController; + private homeModel mHomeModel; + private geckoClients mGeckoClient = null; + + /*View Webviews*/ + private NestedGeckoView mGeckoView = null; + private androidx.constraintlayout.widget.ConstraintLayout mTopLayout; + private ConstraintLayout mWebViewContainer; + + /*View Objects*/ + private ProgressBar mProgressBar; + private ConstraintLayout mSplashScreen; + private editTextManager mSearchbar; + private ImageView mLoadingIcon; + private ImageView mBlocker; + private TextView mLoadingText; + private AdView mBannerAds = null; + private ImageButton mGatewaySplash; + private ImageButton mPanicButton; + private ImageButton mPanicButtonLandscape; + private LinearLayout mTopBar; + private ImageView mBackSplash; + private Button mConnectButton; + private Button mNewTab; + private View mFindBar; + private View mSearchEngineBar; + private ImageView mGenesisLogo; + private EditText mFindText; + private TextView mFindCount; + private ImageButton mVoiceInput; + private ImageButton mMenu; + private NestedScrollView mNestedScroll; + private ImageView mBlockerFullSceen; + private ImageView mNewTabBlocker; + private TextView mCopyright; + private RecyclerView mHintListView = null; + private ImageView mSearchLock; + private ImageButton mOrbotLogManager; + private ConstraintLayout mInfoPortrait; + private ConstraintLayout mInfoLandscape; + private com.google.android.material.appbar.AppBarLayout mAppBar; + private ProgressBar mProgressBarIndeterminate; + private FragmentContainerView mTabFragment; + private LinearLayout mTopBarContainer; + private View mPopupLoadNewTab; + private ImageView mTopBarHider; + private CoordinatorLayout mCoordinatorLayout; + private ImageView mImageDivider; + + /*Redirection Objects*/ + private GeckoResult mRenderedBitmap = null; + private boolean mPageClosed = false; + private boolean isKeyboardOpened = false; + private boolean isSuggestionChanged = false; + private boolean isSuggestionSearchOpened = false; + private boolean isFocusChanging = false; + private boolean mAppRestarted = false; + private boolean mSearchBarLoading = false; + private boolean mSearchBarLoadingOpening = false; + private boolean mSearchBarWasBackButtonPressed = false; + private String mSearchBarPreviousText = strings.GENERIC_EMPTY_STR; + private Handler mScrollHandler = null; + private Runnable mScrollRunnable = null; + + /*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/ + + @Override + protected void onCreate(Bundle savedInstanceState) + { + onInitTheme(); + onInitBooleans(); + orbotLocalConstants.mHomeIntent = getIntent(); + + getWindow().getDecorView().setBackgroundColor(Color.WHITE); + pluginController.getInstance().preInitialize(this); + dataController.getInstance().initialize(this); + status.initStatus(this); + dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_INIT, Collections.singletonList(this)); + trueTime.getInstance().initTime(); + + super.onCreate(savedInstanceState); + setContentView(R.layout.home_view); + + Thread.setDefaultUncaughtExceptionHandler((t, e) -> { + status.sSettingIsAppStarted = false; + finishAndRemoveTask(); + + Intent intent = new Intent(this, homeController.class); + intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION); + intent.putExtra("crash",true); + this.startActivity(intent); + this.finish(); + + Runtime.getRuntime().exit(0); + }); + + initPreFixes(); + activityContextManager.getInstance().setHomeController(this); + pluginController.getInstance().initializeAllServices(this); + initializeAppModel(); + initializeConnections(); + pluginController.getInstance().initialize(); + initializeLocalEventHandlers(); + initLandingPage(); + initLocalLanguage(); + onInitResume(false); + initSuggestions(); + initAdmob(); + initWidget(); + initSuggestionView(new ArrayList<>(), strings.GENERIC_EMPTY_STR); + status.sSettingIsAppRunning = true; + org.torproject.android.service.util.Prefs.setContext(activityContextManager.getInstance().getHomeController()); + } + + + public void initWidget(){ + if(status.sWidgetResponse == enums.WidgetResponse.SEARCHBAR){ + if(!status.sSettingIsAppStarted){ + if(mSplashScreen.getAlpha()==1 && mConnectButton.isEnabled()){ + onStartApplication(null); + } + }else { + mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + if(mSearchEngineBar.getVisibility() != View.VISIBLE){ + mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); + status.sWidgetResponse = enums.WidgetResponse.NONE; + } + }, 500); + } + } + else if(status.sWidgetResponse == enums.WidgetResponse.VOICE){ + if(!status.sSettingIsAppStarted){ + if(mSplashScreen.getAlpha()==1 && mConnectButton.isEnabled()){ + onStartApplication(null); + } + }else { + if(mSearchEngineBar.getVisibility() != View.VISIBLE){ + onVoiceClick(null); + status.sWidgetResponse = enums.WidgetResponse.NONE; + } + } + } + } + + public void initAdmob(){ + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS); + } + + public void onInitBooleans(){ + mPageClosed = false; + isKeyboardOpened = false; + isSuggestionChanged = false; + isSuggestionSearchOpened = false; + isFocusChanging = false; + mAppRestarted = false; + mSearchBarLoading = false; + } + + public void initSuggestions(){ + mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mSearchbar.getText().toString())); + } + + public void onInitResume(boolean pStatus){ + if(status.mThemeApplying){ + mSplashScreen.setAlpha(0); + mSplashScreen.setVisibility(View.GONE); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + mHomeViewController.initStatusBarColor(false); + }else { + Window window = getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(ContextCompat.getColor(this, R.color.c_text_v3)); + } + mHomeViewController.splashScreenDisableInstant(); + onLoadTabOnResume(); + mSearchLock.setColorFilter(ContextCompat.getColor(this, R.color.c_lock_tint)); + } + initSuggestionView(new ArrayList<>(), strings.GENERIC_EMPTY_STR); + } + + + public void onLoadTabFromTabController(){ + + Object mTempModel = dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + if(mTempModel!=null){ + tabRowModel model = (tabRowModel)mTempModel; + if(model.getSession().onGetInitializeFromStartup()){ + mGeckoClient.getmRuntime(); + mGeckoClient.initSession(model.getSession()); + mGeckoView.releaseSession(); + mGeckoView.setSession(model.getSession()); + + if(!model.getSession().isOpen()){ + model.getSession().open(mGeckoClient.getmRuntime()); + onLoadURL(model.getSession().getCurrentURL()); + } + + mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this); + mGeckoClient.onSessionReinit(); + } + + if(mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + if(model.getSession().onGetInitializeFromStartup()) { + mHomeViewController.progressBarReset(); + } + }else { + mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,false,false); + }else { + if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GENESIS_URL)){ + mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + } + } + + public void onLoadTabOnResume(){ + Object mTempModel = dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + if(mTempModel!=null){ + tabRowModel model = (tabRowModel)mTempModel; + if(!status.mThemeApplying){ + mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(), false, false, false); + } + onLoadTab(model.getSession(),false,true); + }else { + onNewIntent(getIntent()); + onOpenLinkNewTab(helperMethod.getDomainName(mHomeModel.getSearchEngine())); + } + initTabCountForced(); + if(!status.mThemeApplying){ + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false); + } + } + + @SuppressLint("ClickableViewAccessibility") + private void initSuggestionView(ArrayList pList, String pSearch){ + if(mHintListView.getAdapter() == null){ + hintAdapter mAdapter = new hintAdapter(pList,new hintViewCallback(), this, pSearch); + mHintListView.setAdapter(mAdapter); + mHintListView.setLayoutManager(new LinearLayoutManager(this)); + mHintListView.setHasFixedSize(true); + mHintListView.setItemViewCacheSize(10); + mHintListView.setItemViewCacheSize(10); + mHintListView.setDrawingCacheEnabled(true); + mHintListView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); + + Objects.requireNonNull(mHintListView.getItemAnimator()).setChangeDuration(0); + Objects.requireNonNull(mHintListView.getItemAnimator()).setAddDuration(0); + + findViewById(R.id.pSuggestionScroll).setOnTouchListener((v, event) -> { + if (MotionEvent.ACTION_DOWN == event.getAction()) { + helperMethod.hideKeyboard(this); + } + return false; + }); + }else { + onUpdateSuggestionList(mSuggestions); + } + } + + public void onUpdateSuggestionList(ArrayList pList){ + ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onUpdateAdapter(pList, mSearchbar.getText().toString()); + } + + private void initLocalLanguage() { + pluginController.getInstance().onLanguageInvoke(Arrays.asList(this, status.sSettingLanguage, status.sSettingLanguageRegion, status.mThemeApplying),pluginEnums.eLangManager.M_SET_LANGUAGE); + } + + @Override + protected void onNewIntent(Intent intent) + { + super.onNewIntent(intent); + Uri data = intent.getData(); + if(data!=null){ + status.sSettingIsAppRedirected = true; + status.sSettingRedirectStatus = data.toString(); + if(status.sSettingIsAppStarted){ + mSplashScreen.setAlpha(0); + mSplashScreen.setVisibility(View.GONE); + } + onStartApplication(null); + } + } + + public void initLandingPage(){ + if(status.sSettingFirstStart){ + helperMethod.openActivity(landingController.class, constants.CONST_LIST_HISTORY, homeController.this,false); + } + } + + public void initializeAppModel() + { + mHomeViewController = new homeViewController(); + mHomeModel = new homeModel(); + } + + public void initializeConnections() + { + mGeckoView = findViewById(R.id.pWebView); + mTopBarContainer = findViewById(R.id.pTopBarContainer); + mProgressBar = findViewById(R.id.pProgressBar); + mSplashScreen = findViewById(R.id.pSplashScreen); + mSearchbar = findViewById(R.id.pSearchInput); + mLoadingText = findViewById(R.id.pOrbotLogs); + mWebViewContainer = findViewById(R.id.pWebLayoutView); + mTopLayout = findViewById(R.id.pTopLayout); + mLoadingIcon = findViewById(R.id.pLoadingIcon); + mBannerAds = findViewById(R.id.pAdView); + mGatewaySplash = findViewById(R.id.pSettings); + mTopBar = findViewById(R.id.pTopbar); + mBackSplash = findViewById(R.id.pTopImage); + mConnectButton = findViewById(R.id.Connect); + mNewTab = findViewById(R.id.pNewTab); + mSearchEngineBar = findViewById(R.id.pSearchEngineBar); + mFindText = findViewById(R.id.pFindText); + mFindCount = findViewById(R.id.pFindCount); + mVoiceInput = findViewById(R.id.pVoiceInput); + mMenu = findViewById(R.id.pMenu); + mBlocker = findViewById(R.id.pBlocker); + mNestedScroll = findViewById(R.id.pNestedScroll); + mBlockerFullSceen = findViewById(R.id.pBlockerFullSceen); + mCopyright = findViewById(R.id.pCopyright); + mHintListView = mSearchEngineBar.findViewById(R.id.pHistListView); + mAppBar = findViewById(R.id.pAppbar); + mSearchLock = findViewById(R.id.pSearchLogo); + mOrbotLogManager = findViewById(R.id.pOrbotLogManager); + mFindBar = findViewById(R.id.pFindBar); + mInfoPortrait = findViewById(R.id.pInfoPortrait); + mInfoLandscape = findViewById(R.id.pInfoLandscape); + mProgressBarIndeterminate = findViewById(R.id.pProgressBarIndeterminate); + mTabFragment = findViewById(R.id.mTabFragment); + mPopupLoadNewTab = findViewById(R.id.pPopupLoadNewTab); + mTopBarHider = findViewById(R.id.pTopBarHider); + mNewTabBlocker = findViewById(R.id.pNewTabBlocker); + mCoordinatorLayout = findViewById(R.id.pCoordinatorLayout); + mImageDivider = findViewById(R.id.pImageDivider); + mPanicButton = findViewById(R.id.pPanicButton); + mPanicButtonLandscape = findViewById(R.id.pPanicButtonLandscape); + mGenesisLogo = findViewById(R.id.pGenesisLogo); + + mGeckoView.setSaveEnabled(false); + mGeckoView.setSaveFromParentEnabled(false); + mGeckoView.setAutofillEnabled(true); + + mGeckoClient = new geckoClients(); + mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mPopupLoadNewTab, mTopBarHider, mNewTabBlocker, mCoordinatorLayout, mImageDivider, mPanicButton, mGenesisLogo, mPanicButtonLandscape); + mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback()); + mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false); + mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this); + dataController.getInstance().initializeListData(); + } + + public void onUpdateStatusBarTheme(){ + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); + } + + public boolean inSignatureArea(MotionEvent ev) { + float mEventY = ev.getY(); + return mEventY>mTopBar.getY()+mTopBar.getHeight() && mEventY + { + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_APPLICATION_CRASH); + }, 2000); + } + + if(!status.mThemeApplying){ + orbotLocalConstants.mTorLogsStatus = strings.GENERIC_EMPTY_STR; + } + + Class clazz = Class.forName("java.lang.Daemons$FinalizerWatchdogDaemon"); + + Method method = Objects.requireNonNull(clazz.getSuperclass()).getDeclaredMethod("stop"); + method.setAccessible(true); + + Field field = clazz.getDeclaredField("INSTANCE"); + field.setAccessible(true); + + method.invoke(field.get(null)); + } + catch (Throwable e) { + e.printStackTrace(); + } + } + + public void initializeGeckoView(boolean isForced, boolean pDatabaseSavable){ + mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,isForced); + onSaveCurrentTab(mGeckoClient.getSession(),pDatabaseSavable); + initTabCountForced(); + } + + public void initTab(boolean isKeyboardOpened){ + postNewTabAnimation(isKeyboardOpened, false); + initTabCountForced(); + } + + @Override + protected void attachBaseContext(Context base) { + SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(base); + status.sTheme = mPrefs.getInt(keys.SETTING_THEME,enums.Theme.THEME_DEFAULT); + Prefs.setContext(base); + orbotLocalConstants.mHomeContext = new WeakReference<>(base); + + Context mContext = activityThemeManager.getInstance().initTheme(base); + activityContextManager.getInstance().setApplicationContext(mContext.getApplicationContext()); + super.attachBaseContext(LocaleHelper.onAttach(mContext, Prefs.getDefaultLocale())); + } + + /*-------------------------------------------------------Helper Methods-------------------------------------------------------*/ + + public void onGetFavIcon(ImageView pImageView, String pURL){ + mGeckoClient.onGetFavIcon(pImageView, pURL, homeController.this); + } + + public void onGetThumbnail(ImageView pImageView,boolean pLoadTabView){ + try{ + mRenderedBitmap = mGeckoView.capturePixels(); + }catch (Exception ignored){} + if(mScrollHandler!=null){ + mScrollHandler.removeCallbacksAndMessages(null); + } + new Handler().postDelayed(() -> + { + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, pImageView, mGeckoView, pLoadTabView)); + }, 100); + } + + + public void onLoadFont(){ + mGeckoClient.onUpdateFont(); + mHomeViewController.onReDraw(); + } + + public void onLoadProxy(View view){ + if(pluginController.getInstance().isInitialized() && !mPageClosed){ + helperMethod.openActivity(orbotController.class, constants.CONST_LIST_HISTORY, homeController.this,true); + } + } + + public void initRuntimeSettings() + { + mGeckoClient.updateSetting(mGeckoView, homeController.this); + } + + public void onReDrawGeckoview(){ + mGeckoClient.getSession().close(); + mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false); + } + + + public void onLoadURL(String url){ + if(mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ + mGeckoView.getSession().open(mGeckoClient.getmRuntime()); + } + + mAppBar.animate().cancel(); + Objects.requireNonNull(mGeckoView.getSession()).stop(); + mGeckoClient.loadURL(url.replace("genesis.onion","genesishiddentechnologies.com"),mGeckoView, homeController.this); + } + + public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed, boolean pExpandAppBar){ + + if(!isSessionClosed){ + dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession)); + } + + if(mTempSession.isOpen()){ + if(mTempSession.getSessionID().equals(mGeckoClient.getSession().getSessionID())){ + return; + } + } + + mGeckoClient.getmRuntime(); + mGeckoClient.initSession(mTempSession); + mGeckoView.releaseSession(); + mGeckoView.setSession(mTempSession); + + if(!mTempSession.isOpen()){ + mTempSession.open(mGeckoClient.getmRuntime()); + onLoadURL(mTempSession.getCurrentURL()); + } + + mHomeViewController.onClearSelections(false); + mHomeViewController.onUpdateSearchBar(mTempSession.getCurrentURL(),false,true, false); + if(mTempSession.getProgress()>0 && mTempSession.getProgress()<100){ + mHomeViewController.onProgressBarUpdate(mTempSession.getProgress(), false); + }else { + mHomeViewController.progressBarReset(); + } + + mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this); + mGeckoClient.onSessionReinit(); + mHomeViewController.onUpdateStatusBarTheme(mTempSession.getTheme(), false); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(),false); + + try{ + mRenderedBitmap = mGeckoView.capturePixels(); + }catch (Exception ignored){} + + if(pExpandAppBar){ + mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); + } + + if(mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + }else { + mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + + mHomeViewController.onProgressBarUpdate(mGeckoClient.getSession().getProgress(),true); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false)); + + + TouchView(mGeckoView); + TouchView(mNestedScroll); + + } + + public void TouchView(View view) + { + long downTime = 3000; + long eventTime = 3000; + float x = 0f; + float y = 100f; + + int metaState = 0; + MotionEvent motionEvent = MotionEvent.obtain( + downTime, + eventTime, + MotionEvent.ACTION_SCROLL, + x, + y, + metaState + ); + + view.dispatchTouchEvent(motionEvent); + + view.dispatchTouchEvent(MotionEvent.obtain(0,0,MotionEvent.ACTION_DOWN, -1,-1,0.5f,5,0,1,1,0,0)); + } + /*-------------------------------------------------------USER EVENTS-------------------------------------------------------*/ + + private BroadcastReceiver downloadStatus = new BroadcastReceiver() + { + @Override + public void onReceive(Context context, Intent intent) + { + long id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); + + DownloadManager dMgr = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); + Cursor c= Objects.requireNonNull(dMgr).query(new DownloadManager.Query().setFilterById(id)); + + if(c.moveToFirst()){ + String url = c.getString(c.getColumnIndex(DownloadManager.COLUMN_URI)); + onNotificationInvoked(URLUtil.guessFileName(url, null, null), enums.etype.download_folder); + } + } + }; + + @SuppressLint("NewApi") + @Override + public void onTrimMemory(int level) { + super.onTrimMemory(level); + + switch (level) { + case TRIM_MEMORY_BACKGROUND: + Log.i("wow : ", "trim memory requested: app in the background"); + break; + + case TRIM_MEMORY_COMPLETE: + Log.i("wow : ", "trim memory requested: cleanup all memory"); + break; + + case TRIM_MEMORY_MODERATE: + Log.i("wow : ", "trim memory requested: clean up some memory"); + break; + case TRIM_MEMORY_RUNNING_CRITICAL: + Log.i("wow : ", "trim memory requested: memory on device is very low and critical"); + break; + + case TRIM_MEMORY_RUNNING_LOW: + Log.i("wow : ", "trim memory requested: memory on device is running low"); + break; + + case TRIM_MEMORY_RUNNING_MODERATE: + Log.i("wow : ", "trim memory requested: memory on device is moderate"); + break; + + case TRIM_MEMORY_UI_HIDDEN: + Log.i("wow : ", "trim memory requested: app is not showing UI anymore"); + break; + } + } + + public void onDestroyExernal(){ + pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.mThemeApplying), pluginEnums.eOrbotManager.M_DESTROY); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + protected void onDestroy() { + if(!status.sSettingIsAppStarted){ + super.onDestroy(); + return; + } + mBackSplash.setImageDrawable(null); + mBackSplash.setBackground(null); + + if(!status.mThemeApplying){ + if(!status.sSettingIsAppStarted){ + Intent intent = new Intent(getApplicationContext(), OrbotService.class); + stopService(intent); + }else { + NotificationManagerCompat.from(this).cancelAll(); + } + } + + KeyboardUtils.removeAllKeyboardToggleListeners(); + mGatewaySplash.setOnTouchListener(null); + + ((ConstraintLayout)mGatewaySplash.getParent()).removeView(mGatewaySplash); + ((ConstraintLayout)mGeckoView.getParent()).removeView(mGeckoView); + ((ConstraintLayout)mTabFragment.getParent()).removeView(mTabFragment); + ((LinearLayout)mSearchbar.getParent()).removeView(mSearchbar); + + mTabFragment = null; + mNestedScroll = null; + mGeckoView.setOnFocusChangeListener(null); + mGeckoView.setOnTouchListener(null); + mGeckoView.destroyDrawingCache(); + mGeckoView.releaseSession(); + mGeckoClient.onDestroy(); + + mGeckoView.onDestroy(); + mGeckoClient=null; + mHomeViewController = null; + activityContextManager.getInstance().setHomeController(null); + mGeckoView.releaseSession(); + mGeckoView = null; + + activityContextManager.getInstance().setHomeController(null); + activityContextManager.getInstance().setCurrentActivity(null); + pluginController.getInstance().onRemoveInstances(); + + unregisterReceiver(downloadStatus); + + super.onDestroy(); + } + + @SuppressLint("ClickableViewAccessibility") + private void initializeLocalEventHandlers() { + + startService(new Intent(getBaseContext(), activityStateManager.class)); + + registerReceiver(downloadStatus,new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); + + mNewTab.setOnTouchListener((v, event) -> { + if(event.getAction() == MotionEvent.ACTION_DOWN){ + mTopBarContainer.getLayoutTransition().setDuration(200); + onOpenTabViewBoundary(null); + mNewTab.setPressed(true); + } + return true; + }); + + mFindText.addTextChangedListener(new TextWatcher() { + + @Override + public void afterTextChanged(Editable s) { + } + + @Override + public void beforeTextChanged(CharSequence s, int start,int count, int after) { + } + + @Override + public void onTextChanged(CharSequence s, int start,int before, int count) { + if(!mSearchbar.isFocused()){ + if(mFindText.getText().length()==0 && mGeckoClient!=null){ + mGeckoClient.getSession().getFinder().clear(); + mHomeViewController.onUpdateFindBarCount(0,0); + }else if(mGeckoClient!=null){ + mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_MATCH_CASE & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); + + } + } + } + }); + + mSearchbar.setOnEditorActionListener((v, actionId, event) -> + { + if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE) + { + onSearchBarInvoked(v); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true,true, false); + mHomeViewController.onClearSelections(true); + mGeckoClient.setLoading(true); + final Handler handler = new Handler(); + handler.postDelayed(() -> mHomeViewController.onClearSelections(false), 500); + } + return true; + }); + + mGatewaySplash.setOnTouchListener((v, event) -> + { + if (event.getAction() == MotionEvent.ACTION_DOWN) + mGatewaySplash.setElevation(9); + else if (event.getAction() == MotionEvent.ACTION_UP) + mGatewaySplash.setElevation(2); + return false; + }); + + mGeckoView.setOnTouchListener((v, event) -> { + mHomeViewController.onClearSelections(true); + if (event.getAction() == MotionEvent.ACTION_DOWN){ + mGatewaySplash.setElevation(9); + status.sUIInteracted = true; + mHomeViewController.onUpdateFindBar(false); + } + + return false; + }); + + mGeckoView.setOnFocusChangeListener((v, hasFocus) -> { + if(hasFocus) + { + pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); + if (!mGeckoClient.getSession().getCurrentURL().equals("about:blank")){ + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, true, false); + } + + final Handler handler = new Handler(); + handler.postDelayed(() -> getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE), 300); + + }else { + getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); + } + }); + + + mSearchbar.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + new Handler().postDelayed(() -> + { + String mText = mSearchbar.getText().toString(); + if(status.sSearchSuggestionStatus && isSuggestionChanged){ + String mURL = mSearchbar.getText().toString(); + + if(!mURL.equals(strings.GENERIC_EMPTY_STR) && isLetter(mSearchbar.getText().toString().charAt(0)) && mSearchbar.getText().toString().contains(".")){ + mHomeViewController.onUpdateSearchIcon(2); + }else{ + mHomeViewController.onUpdateSearchIcon(0); + } + if(mSearchEngineBar.getVisibility() == View.GONE){ + mSearchBarLoadingOpening = true; + } + if(mSearchBarLoadingOpening){ + mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION, Collections.singletonList(mText)); + mHomeViewController.onUpdateSearchEngineBar(true, 0); + onUpdateSuggestionList(mSuggestions); + mEdittextChanged.postDelayed(postToServerRunnable, 0); + mSearchBarLoadingOpening = true; + mSearchBarLoading = false; + + mEdittextChanged.removeCallbacks(postToServerRunnable); + mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mText)); + mEdittextChanged.postDelayed(postToServerRunnable, 150); + return; + } + if(mSuggestions.size()>0){ + mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mText)); + if(mHintListView.getAdapter()==null){ + initSuggestionView(mSuggestions, mText.toString()); + }else if(!mSearchBarLoadingOpening){ + mEdittextChanged.removeCallbacks(postToServerRunnable); + if(!mSearchBarLoading){ + mSearchBarLoading = true; + mEdittextChanged.postDelayed(postToServerRunnable, 0); + }else{ + mEdittextChanged.postDelayed(postToServerRunnable, 150); + } + } + } + } + + }, 0); + } + + @Override + public void afterTextChanged(Editable s) { + + } + + @Override + public void beforeTextChanged(CharSequence s, int start,int count, int after) { + } + + }); + + mSearchbar.setEventHandler(new edittextManagerCallback()); + + mSearchbar.setOnFocusChangeListener((v, hasFocus) -> { + status.sUIInteracted = true; + if(!hasFocus) + { + mSearchBarWasBackButtonPressed = true; + new Handler().postDelayed(() -> + { + mSearchBarWasBackButtonPressed = false; + }, 100); + + if(!isSuggestionSearchOpened){ + if(isSuggestionChanged){ + isSuggestionChanged = false; + if(mHintListView!=null && mHintListView.getAdapter()!=null && mHintListView.getAdapter().getItemCount()>0){ + mHomeViewController.onUpdateSearchEngineBar(false, 150); + ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); + } + mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); + if(!mGeckoClient.isLoading()){ + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false); + } + helperMethod.hideKeyboard(homeController.this); + } + } + mSearchbar.setSelection(0); + }else { + mSearchBarWasBackButtonPressed = false; + if(!isFocusChanging){ + if(!status.mThemeApplying){ + mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); + } + isSuggestionChanged = true; + isSuggestionSearchOpened = false; + } + } + }); + + KeyboardUtils.addKeyboardToggleListener(this, isVisible -> isKeyboardOpened = isVisible); + + mNestedScroll.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { + if(v.getChildAt(v.getChildCount() - 1) != null) { + if ((scrollY >= (v.getChildAt(v.getChildCount() - 1).getMeasuredHeight() - v.getMeasuredHeight())) && scrollY > oldScrollY) { + } + } + onInvokePixelGenerator(); + }); + } + + private ArrayList mSuggestions; + private Handler mEdittextChanged = new Handler(); + private Runnable postToServerRunnable = () -> { + mSearchBarLoadingOpening = false; + onUpdateSuggestionList(mSuggestions); + final Handler handler = new Handler(); + handler.postDelayed(() -> { + mSearchBarLoading = false; + }, 150); + }; + + public void onSearchBarInvoked(View view){ + String url = ((EditText)view).getText().toString(); + String validated_url = mHomeModel.urlComplete(url, mHomeModel.getSearchEngine()); + url = validated_url; + + mHomeViewController.onUpdateSearchBar(url,false,true, false); + onLoadURL(url); + } + + public void onSearchString(String pString){ + String validated_url = mHomeModel.urlComplete(pString, mHomeModel.getSearchEngine()); + pString = validated_url; + + mHomeViewController.onUpdateSearchBar(pString,false,true, false); + onLoadURL(pString); + } + + public void onSuggestionInvoked(View view){ + String mVal = ((TextView)view.findViewById(R.id.pURL)).getText().toString(); + if(mVal.equals(strings.GENERIC_EMPTY_STR)){ + mVal = ((TextView)view.findViewById(R.id.pHeaderSingle)).getText().toString(); + } + String pURL = mHomeModel.urlComplete(mVal, status.sSettingSearchStatus); + + mHomeViewController.onClearSelections(true); + mHomeViewController.onUpdateSearchBar(pURL,false,true, true); + + String finalPURL = pURL; + new Handler().postDelayed(() -> + { + onLoadURL(finalPURL); + }, 250); + } + + public void onSuggestionMove(View view){ + String val = view.getTag().toString(); + mHomeViewController.onUpdateSearchBar(val,false,false, true); + } + + public void onHomeButton(View view){ + + mGeckoClient.getSession().setTheme(null); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); + onLoadURL(helperMethod.getDomainName(mHomeModel.getSearchEngine())); + mHomeViewController.onUpdateLogo(); + } + + /*TAB CONTROLLER EVENTS*/ + public void onMenuTrigger(View pView){ + activityContextManager.getInstance().getTabController().onMenuTrigger(pView); + } + + public void openTabMenu(View view) { + activityContextManager.getInstance().getTabController().openTabMenu(view); + } + + public void onRemoveSelection(View view) { + activityContextManager.getInstance().getTabController().onRemoveSelection(view); + } + + public void onLoadRecentTab(View view){ + mHomeViewController.onHideLoadTabDialog(); + tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_RECENT_TAB, null); + if(model!=null && !mGeckoClient.getSession().getSessionID().equals(model.getSession().getSessionID())){ + Log.i("FUCK::1",model.getSession().getCurrentURL()); + mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(),false,false,true); + Log.i("FUCK::2",model.getSession().getCurrentURL()); + onLoadTab(model.getSession(), false,true); + Log.i("FUCK::3",model.getSession().getCurrentURL()); + } + } + + public void onRestoreTab(View view){ + activityContextManager.getInstance().getTabController().onRestoreTab(view); + } + + public void onClearSelection(View view){ + activityContextManager.getInstance().getTabController().onClearSelection(view); + } + + public geckoSession onNewTabInit(){ + return mGeckoClient.initFreeSession(mGeckoView, this, new geckoViewCallback()); + } + + public void postNewTabAnimation(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){ + initializeGeckoView(true, true); + if(status.sOpenURLInNewTab){ + if(mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ + mGeckoView.getSession().open(mGeckoClient.getmRuntime()); + } + + mHomeViewController. onUpdateSearchBar(helperMethod.getDomainName(status.sSettingSearchStatus),false,true, false); + onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus)); + mGeckoView.getSession().setActive(true); + + }else { + onLoadURL("about:blank"); + mHomeViewController. onUpdateSearchBar(strings.HOME_BLANK_PAGE,false,true, false); + mHomeViewController.onNewTab(); + } + mHomeViewController.progressBarReset(); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); + } + + public void postNewLinkTabAnimation(String url,boolean isRemovable){ + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false)); + initializeGeckoView(true, true); + mHomeViewController.progressBarReset(); + mHomeViewController.onUpdateSearchBar(url,false,true, false); + mGeckoClient.loadURL(url, mGeckoView, homeController.this); + + if(isRemovable){ + mGeckoClient.setRemovableFromBackPressed(true); + } + } + + public void postNewLinkTabAnimationInBackgroundTrigger(String url){ + String mExtention = helperMethod.getMimeType(url, this); + if(mExtention == null || mExtention.equals("text/html") || mExtention.equals("application/vnd.ms-htmlhelp") || mExtention.equals("application/vnd.sun.xml.writer") || mExtention.equals("application/vnd.sun.xml.writer.global") || mExtention.equals("application/vnd.sun.xml.writer.template") || mExtention.equals("application/xhtml+xml")){ + initTabCount(M_NEW_LINK_IN_NEW_TAB, Collections.singletonList(url)); + }else { + postNewLinkTabAnimation(url, true); + } + } + + public void postNewLinkTabAnimationInBackground(String url){ + mAppBar.setTag(R.id.expandableBar,false); + geckoSession mSession = mGeckoClient.getSession(); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false)); + mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,true); + mHomeViewController.progressBarReset(); + mGeckoClient.initURL(url); + mGeckoClient.loadURL(url, mGeckoView, homeController.this); + mGeckoClient.getSession().setURL(url); + onSaveCurrentTab(mGeckoClient.getSession(),false); + onLoadTab(mSession,false,false); + + + mAppBar.setTag(R.id.expandableBar,true); + initTabCountForced(); + mHomeViewController.onUpdateSearchBar(mSession.getCurrentURL(),false,true, false); + } + + public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){ + + try{ + mRenderedBitmap = mGeckoView.capturePixels(); + }catch (Exception ignored){} + + new Handler().postDelayed(() -> + { + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false)); + if(status.sSettingSearchStatus.startsWith("https://genesishiddentechnologies.com") || !status.sOpenURLInNewTab || mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + + if(status.sOpenURLInNewTab){ + mGeckoClient.resetSession(); + mHomeViewController.onUpdateSearchBar(helperMethod.getDomainName(mHomeModel.getSearchEngine()), false, false,false); + + if(status.sSettingSearchStatus.startsWith("https://genesishiddentechnologies.com")){ + mHomeViewController.progressBarReset(); + }else { + mHomeViewController.onProgressBarUpdate(5, true); + } + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); + } + mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), M_INITIALIZE_TAB_SINGLE); + }, 100); + } + + public void onUpdateScreenPixel(){ + + } + + public void onNewTabBackground(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){ + if(status.sSettingSearchStatus.startsWith("https://genesishiddentechnologies.com") || !status.sOpenURLInNewTab || mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + + if(status.sOpenURLInNewTab){ + mGeckoClient.resetSession(); + mHomeViewController.onUpdateSearchBar(helperMethod.getDomainName(mHomeModel.getSearchEngine()), false, false,false); + + if(status.sSettingSearchStatus.startsWith("https://genesishiddentechnologies.com")){ + mHomeViewController.progressBarReset(); + }else { + mHomeViewController.onProgressBarUpdate(5, true); + } + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); + } + + mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), M_INITIALIZE_TAB_SINGLE); + } + + public String completeURL(String pURL){ + return mHomeModel.urlComplete(pURL, mHomeModel.getSearchEngine()); + } + + public void onOpenLinkNewTab(String url){ + mNewTab.setPressed(true); + final Handler handler = new Handler(); + handler.postDelayed(() -> { + onGetThumbnail(null, false); + mHomeViewController.expandTopBar(false,mGeckoView.getMaxY()); + if(status.sSettingSearchStatus.startsWith("https://genesishiddentechnologies.com") || !status.sOpenURLInNewTab || mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + mHomeViewController.onNewTabAnimation(Collections.singletonList(url), M_INITIALIZE_TAB_LINK); + }, 100); + } + + public void onClearSelectionTab(){ + mNewTab.setPressed(false); + } + + public void onOpenTabViewBoundary(View view){ + onInvokePixelGenerator(); + if(mScrollHandler!=null){ + mScrollHandler.removeCallbacksAndMessages(null); + } + onInvokePixelGenerator(); + mNewTab.setPressed(true); + onOpenTabReady(); + } + + public void onOpenTabReady(){ + if(!status.mThemeApplying){ + runOnUiThread(() -> { + mHomeViewController.onShowTabContainer(); + pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); + activityContextManager.getInstance().getTabController().onInitInvoked(); + }); + } + } + + public void onLoadFirstElement(){ + activityContextManager.getInstance().getTabController().onInitFirstElement(); + } + + public void onLockSecure(View view){ + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(mGeckoClient.getSession().getCurrentURL(), status.sSettingJavaStatus, status.sStatusDoNotTrack, status.sSettingTrackingProtection, status.sSettingCookieStatus, this), M_SECURE_CONNECTION); + } + + public void onNotificationInvoked(String message,enums.etype e_type){ + mHomeViewController.downloadNotification(message,e_type); + } + + public void onOpenMenuItem(View view){ + status.sUIInteracted = true; + pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); + initLocalLanguage(); + + helperMethod.hideKeyboard(this); + mHomeViewController.onOpenMenu(view,mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() == View.INVISIBLE || mGeckoClient.isLoaded()),mGeckoClient.getUserAgent(), mGeckoClient.getSession().getCurrentURL()); + + view.setClickable(false); + new Handler().postDelayed(() -> + { + view.setClickable(true); + }, 500); + + } + + public void onFullScreenSettingChanged(){ + mHomeViewController.initTopBarPadding(); + } + + public void onDisableTabViewController(){ + onResumeDump(); + mHomeViewController.onHideTabContainer(); + activityContextManager.getInstance().getTabController().onExitAndClearBackup(); + activityContextManager.getInstance().getTabController().onPostExit(); + } + + @Override + public void onBackPressed(){ + if(mTabFragment.getVisibility()==View.VISIBLE){ + if(activityContextManager.getInstance().getTabController().isSelectionOpened()){ + activityContextManager.getInstance().getTabController().onClearSelection(null); + }else { + boolean mStatus = activityContextManager.getInstance().getTabController().onBackPressed(); + onResumeDump(); + if(!mStatus){ + mHomeViewController.onHideTabContainer(); + } + } + return; + } + + if(mFindBar!=null && mFindBar.getVisibility() == View.VISIBLE){ + mHomeViewController.onUpdateFindBar(false); + } + else if(mSearchEngineBar.getVisibility() == View.VISIBLE){ + mHomeViewController.onUpdateSearchEngineBar(false, 150); + ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); + } + else if(!mGeckoClient.getFullScreenStatus()){ + mGeckoClient.onExitFullScreen(); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); + } + else if(mSearchbar.isFocused() || isKeyboardOpened){ + mHomeViewController.onClearSelections(true); + } + else if(!mSearchBarWasBackButtonPressed){ + int mTabSize = (int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null); + mGeckoClient.onBackPressed(true, mTabSize, mGeckoView, this); + } + } + + /*Activity States*/ + + public NestedGeckoView getGeckoView(){ + return mGeckoView; + } + + public void onReload(View view){ + onLoadURL(mSearchbar.getText().toString()); + } + + public void onClearSession(){ + onHomeButton(null); + mGeckoClient.onClearSession(); + } + + public void onClearSiteData(){ + mGeckoClient.onClearSiteData(); + } + + public void onClearCache(){ + mGeckoClient.onClearCache(); + } + + public void onClearCookies(){ + mGeckoClient.onClearCookies(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); + mHomeViewController.closeMenu(); + + final Handler handler = new Handler(); + handler.postDelayed(() -> mGeckoClient.onRedrawPixel(homeController.this), 300); + if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { + mHomeViewController.setOrientation(true); + if(mGeckoClient.getFullScreenStatus()) + { + mHomeViewController.onSetBannerAdMargin(false, true); + } + + + } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){ + mHomeViewController.setOrientation(false); + if(mGeckoClient.getFullScreenStatus()) + { + mHomeViewController.onSetBannerAdMargin(true,(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + + if(mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("genesishiddentechnologies.com") || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + }else { + mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + } + if(mSplashScreen.getAlpha()>0){ + mHomeViewController.initSplashOrientation(); + } + if(mSearchEngineBar.getVisibility() == View.VISIBLE){ + mHomeViewController.onClearSelections(true); + } + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + mHomeViewController.onClearSelections(true); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); + + mHomeViewController.initTopBarPadding(); + mHomeViewController.onSetBannerAdMargin(!mGeckoClient.isLoading(),(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)&&!!mGeckoClient.isLoading()); + + mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); + status.sUIInteracted = true; + } + + @Override + public void onPause(){ + super.onPause(); + if(mHomeViewController!=null){ + mHomeViewController.closeMenu(); + helperMethod.hideKeyboard(this); + } + if(mTabFragment.getVisibility()==View.VISIBLE){ + onResumeDump(); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); + mHomeViewController.onHideTabContainer(); + activityContextManager.getInstance().getTabController().onPostExit(); + activityContextManager.getInstance().getTabController().onBackPressed(); + return; + } + + mHomeViewController.onUpdateSearchEngineBar(false, 0); + mGeckoClient.onExitFullScreen(); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); + pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); + pluginController.getInstance().onNotificationInvoke(Collections.singletonList(172800000) , pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION); + mSearchBarWasBackButtonPressed = false; + if(status.sSettingIsAppStarted){ + status.sUIInteracted = true; + } + mHomeViewController.onUpdateFindBar(false); + mHomeViewController.onClearSelections(isKeyboardOpened); + mTopBarContainer.getLayoutTransition().setDuration(0); + } + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + + if (mGeckoClient.getSession()!=null && mGeckoClient!=null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mGeckoClient.getUriPermission()!=null) { + this.revokeUriPermission(mGeckoClient.getUriPermission(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); + + TouchView(mGeckoView); + TouchView(mNestedScroll); + } + + + if(isSuggestionSearchOpened){ + isSuggestionChanged = true; + isFocusChanging = false; + isSuggestionSearchOpened = false; + mSearchbar.requestFocus(); + mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor(), status.sTheme)); + mSearchbar.selectAll(); + mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); + } + + if(mGeckoView!=null){ + tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + if(model!=null){ + if(mGeckoView!=null && mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ + onReDrawGeckoview(); + onLoadURL(model.getSession().getCurrentURL()); + } + } + } + + if(status.sSettingIsAppStarted){ + mHomeViewController.onClearSelections(isKeyboardOpened); + } + + if(mAppBar!=null){ + mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); + + mAppBar.refreshDrawableState(); + mAppBar.invalidate(); + } + mAppRestarted = true; + pluginController.getInstance().onNotificationInvoke(null, pluginEnums.eNotificationManager.M_CLEAR_NOTIFICATION ); + + if(!status.mThemeApplying){ + //activityContextManager.getInstance().onClearStack(); + } + initWidget(); + initTabCountForced(); + + if(status.sSettingIsAppStarted && !status.mThemeApplying){ + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_INIT_LOCALE); + mHomeViewController.onUpdateSearchEngineBar(false, 0); + mNewTab.setPressed(false); + pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); + } + + if(status.sSettingIsAppStarted && !status.mThemeApplying){ + if(mGeckoClient.getSession().wasPreviousErrorPage()){ + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_NEW_CIRCUIT); + mGeckoClient.onReload(mGeckoView, this); + } + } + + status.mThemeApplying = false; + + super.onResume(); + } + + public void onResumeDump() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + if (mGeckoClient.getSession()!=null && mGeckoClient!=null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mGeckoClient.getUriPermission()!=null) { + this.revokeUriPermission(mGeckoClient.getUriPermission(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); + } + if(isSuggestionSearchOpened){ + tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + if(model==null){ + onOpenLinkNewTab(status.sSettingSearchStatus); + } + isSuggestionChanged = true; + isFocusChanging = false; + isSuggestionSearchOpened = false; + mSearchbar.requestFocus(); + mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor(), status.sTheme)); + mSearchbar.selectAll(); + mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); + } + + if(status.sSettingIsAppStarted && mAppRestarted) { + activityContextManager.getInstance().onClearStack(); + + tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + if(model==null){ + mHomeViewController.onProgressBarUpdate(5, false); + mGeckoView.releaseSession(); + initializeGeckoView(false,false); + onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus)); + }else { + if(model.getSession().getSessionID() != mGeckoClient.getSession().getSessionID()){ + onLoadTab(model.getSession(),false,true); + } + } + } + + if(mAppBar!=null){ + mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); + + mAppBar.refreshDrawableState(); + mAppBar.invalidate(); + } + mAppRestarted = true; + pluginController.getInstance().onNotificationInvoke(null, pluginEnums.eNotificationManager.M_CLEAR_NOTIFICATION ); + initTabCountForced(); + initWidget(); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data){ + if(requestCode==100){ + if(resultCode == RESULT_OK && null != data){ + mSearchbar.clearFocus(); + ArrayList result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); + mSearchbar.setText(result.get(0).toLowerCase()); + helperMethod.hideKeyboard(homeController.this); + mGeckoClient.setLoading(true); + onSearchBarInvoked(mSearchbar); + final Handler handler = new Handler(); + handler.postDelayed(() -> mGeckoView.clearFocus(), 500); + } + } + + else if(requestCode==1){ + mGeckoClient.onUploadRequest(resultCode,data); + } + else { + super.onActivityResult(requestCode, resultCode, data); + } + } + + public void onSetBannerAdMargin(){ + mHomeViewController.onSetBannerAdMargin(true,(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + + public void onVoiceClick(View view) { + if(status.sSettingEnableVoiceInput || status.sWidgetResponse == enums.WidgetResponse.VOICE){ + Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); + intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); + intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); + intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Voice2Text \n Say Something!!"); + try { + startActivityForResult(intent, 100); + } catch (ActivityNotFoundException ignored) { + + } + }else { + mSearchbar.clearFocus(); + new Handler().postDelayed(() -> + { + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false); + }, 170); + } + } + /*-------------------------------------------------------External Callback Methods-------------------------------------------------------*/ + + public String onGetCurrentURL(){ + return mGeckoClient.getSession().getCurrentURL(); + } + + public void onStartApplication(View view){ + pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sBridgeCustomBridge, status.sBridgeGatewayManual, status.sBridgeCustomType, status.sBridgeStatus, status.sShowImages, status.sClearOnExit, (String)dataController.getInstance().invokeBridges(dataEnums.eBridgeWebsiteCommands.M_FETCH, null)), pluginEnums.eOrbotManager.M_START_ORBOT); + onInvokeProxyLoading(); + mHomeViewController.initHomePage(); + } + + public void onDownloadFile(){ + mGeckoClient.downloadFile(homeController.this); + } + + public void onManualDownload(String url){ + + /*EXTERNAL STORAGE REQUEST*/ + mGeckoClient.manual_download(url,this); + } + + public void onManualDownloadFileName(String pURL, String pPath){ + + /*EXTERNAL STORAGE REQUEST*/ + mGeckoClient.manualDownloadWithName(pURL,pPath,this); + } + + public AdView getBannerAd() + { + return mBannerAds; + } + + public void onInvokeProxyLoading(){ + + Callable callable = () -> { + String mLog = (String) pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_LOGS); + mHomeViewController.onUpdateLogs(mLog); + return strings.GENERIC_EMPTY_STR; + }; + + mHomeViewController.initProxyLoading(callable); + } + + public void onSaveCurrentTab(geckoSession session,boolean isHardCopy){ + int mStatus = (Integer) dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_ADD_TAB, Arrays.asList(session,isHardCopy)); + if(mStatus == enums.AddTabCallback.TAB_FULL){ + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_MAX_TAB_REACHED); + } + } + + public boolean onCloseCurrentTab(geckoSession session){ + dataController.getInstance().invokeTab(dataEnums.eTabCommands.CLOSE_TAB, Arrays.asList(session, session)); + tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + + session.stop(); + session.close(); + initTabCountForced(); + + if(model!=null){ + if(mTabFragment.getVisibility()!=View.VISIBLE){ + onLoadTab(model.getSession(),true, true); + } + return true; + } + else { + if(mTabFragment.getVisibility()!=View.VISIBLE){ + return false; + }else { + return true; + } + } + } + + public void initTabCount(enums.etype pEvent, List pData){ + mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null), false, pEvent, pData); + } + + public void initTabCountForced(){ + mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null), true, null, null); + } + + /*-------------------------------------------------------CALLBACKS-------------------------------------------------------*/ + + + public void onHideFindBar(View view){ + mHomeViewController.onUpdateFindBar(false); + mGeckoClient.getSession().getFinder().clear(); + } + + public void onClearSearchBar(View view){ + mHomeViewController.onUpdateSearchBar(strings.GENERIC_EMPTY_STR, false, true, false); + } + + public void onFindNext(View view){ + mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_MATCH_CASE & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); + } + + public void onOpenSearchEngine(View view){ + mSearchBarPreviousText = mSearchbar.getText().toString(); + isSuggestionSearchOpened = true; + helperMethod.openActivity(settingSearchController.class,constants.CONST_LIST_HISTORY, homeController.this,true); + } + + public void onFindPrev(View view){ + mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_BACKWARDS & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); + } + + public void onOpenDownloadFolder(View view){ + helperMethod.openDownloadFolder(homeController.this); + } + + public void onMenuItemInvoked(View view){ + int menuId = view.getId(); + if (menuId == R.id.menu11) { + onNewTab(isKeyboardOpened, true); + } + else if (menuId == R.id.menu10) { + if(!onCloseCurrentTab(mGeckoClient.getSession())){ + onNewTab(isKeyboardOpened, true); + } + } + else if (menuId == R.id.menuItem25) { + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(mGeckoClient.getSession().getCurrentURL(), this), M_DOWNLOAD_SINGLE); + } + else { + mSearchbar.clearFocus(); + if (menuId == R.id.menu12) { + mHomeViewController.closeMenu(); + helperMethod.hideKeyboard(this); + helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this,true); + } + else if (menuId == R.id.menu9) { + helperMethod.hideKeyboard(this); + mGeckoClient.onRedrawPixel(homeController.this); + mHomeViewController.onShowTabContainer(); + pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); + Log.i("I AM FUCKED,","I AM FUCKED : 1"); + activityContextManager.getInstance().getTabController().onInit(); + } + else if (menuId == R.id.menu8) { + helperMethod.hideKeyboard(this); + onOpenDownloadFolder(null); + } + else if (menuId == R.id.menu7) { + helperMethod.hideKeyboard(this); + helperMethod.openActivity(historyController.class, constants.CONST_LIST_HISTORY, homeController.this,true); + } + else if (menuId == R.id.menu6) + { + helperMethod.hideKeyboard(this); + helperMethod.openActivity(settingHomeController.class,constants.CONST_LIST_HISTORY, homeController.this,true); + } + else if (menuId == R.id.pMenuDelete) + { + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(this, mGeckoClient.getSession().getCurrentURL()), M_BOOKMARK); + } + else if (menuId == R.id.pMenuOpenRecentTab) + { + onOpenTabViewBoundary(null); + mNewTab.setPressed(true); + } + else if (menuId == R.id.pMenuOpenNewTab) + { + helperMethod.hideKeyboard(this); + helperMethod.openActivity(bookmarkController.class,constants.CONST_LIST_BOOKMARK, homeController.this,true); + } + else if (menuId == R.id.menu28) + { + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_NEW_CIRCUIT); + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_NEW_IDENTITY); + mGeckoClient.onReload(mGeckoView, this); + } + else if (menuId == R.id.pMenuOpenCurrentTab) + { + helperMethod.hideKeyboard(this); + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_REPORT_URL); + } + else if (menuId == R.id.pMenuQuit) + { + pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.mThemeApplying), pluginEnums.eOrbotManager.M_DESTROY); + + new Handler().postDelayed(() -> + { + status.sSettingIsAppStarted = false; + finishAndRemoveTask(); + + new Thread(){ + public void run(){ + try { + sleep(1000); + android.os.Process.killProcess(android.os.Process.myPid()); + System.exit(1); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }.start(); + }, 100); + } + else if (menuId == R.id.pMenuFind) + { + helperMethod.hideKeyboard(this); + mHomeViewController.onUpdateFindBar(true); + } + if (menuId == R.id.menu20) { + mGeckoClient.onClose(); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); + helperMethod.hideKeyboard(this); + } + if (menuId == R.id.menu21) { + helperMethod.hideKeyboard(this); + String mUrl = mGeckoClient.getSession().getCurrentURL(); + + if(mUrl.equals(constants.CONST_GENESIS_HELP_URL_CACHE_DARK) && status.sTheme != enums.Theme.THEME_DARK){ + onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE); + } + else if(mUrl.equals(constants.CONST_GENESIS_HELP_URL_CACHE) && status.sTheme != enums.Theme.THEME_LIGHT){ + onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); + } + else if(mUrl.equals(CONST_GENESIS_URL_CACHED_DARK) && status.sTheme != enums.Theme.THEME_DARK){ + onLoadURL(CONST_GENESIS_URL_CACHED); + } + else if(mUrl.equals(constants.CONST_GENESIS_URL_CACHED) && status.sTheme != enums.Theme.THEME_LIGHT){ + onLoadURL(CONST_GENESIS_URL_CACHED_DARK); + }else { + onLoadURL(mGeckoClient.getSession().getCurrentURL()); + } + + } + if (menuId == R.id.menu22) { + helperMethod.hideKeyboard(this); + mHomeViewController.onProgressBarUpdate(5,true); + mGeckoClient.onForwardPressed(); + } + if (menuId == R.id.menu23) { + helperMethod.hideKeyboard(this); + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(mGeckoClient.getSession().getCurrentURL(), this), M_BOOKMARK); + } + if (menuId == R.id.menu24) { + helperMethod.hideKeyboard(this); + onHomeButton(view); + } + if (menuId == R.id.menu26 || menuId == R.id.menu27) { + helperMethod.hideKeyboard(this); + mGeckoClient.toogleUserAgent(); + mGeckoClient.onReload(mGeckoView, homeController.this); + } + if(menuId == R.id.menu25){ + helperMethod.hideKeyboard(this); + helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, homeController.this,true); + } + } + mHomeViewController.closeMenu(); + } + + private void onInitTheme(){ + + if(status.mThemeApplying){ + if(status.sTheme == enums.Theme.THEME_DARK){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + }else if(status.sTheme == enums.Theme.THEME_LIGHT){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + }else { + if(!status.sDefaultNightMode){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + }else { + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + } + } + } + } + + public void onReInitTheme(){ + recreate(); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); + } + + public void onOrbotLog(View view) { + mHomeViewController.closeMenu(); + helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this,true); + } + + public void panicExit(View view) { + pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_PANIC_RESET); + } + + public void panicExitInvoked() { + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE, strings.SETTING_DEFAULT_LANGUAGE)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,false)); + + + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null)); + dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); + activityContextManager.getInstance().getHomeController().onClearCache(); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + activityContextManager.getInstance().getHomeController().onClearSiteData(); + activityContextManager.getInstance().getHomeController().onClearSession(); + activityContextManager.getInstance().getHomeController().onClearCookies(); + onClearSettings(); + status.initStatus(activityContextManager.getInstance().getHomeController()); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + activityContextManager.getInstance().getHomeController().initRuntimeSettings(); + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_DATA_CLEARED); + activityContextManager.getInstance().getHomeController().onClearSettings(); + + status.sSettingIsAppStarted = false; + finishAndRemoveTask(); + + Intent intent = new Intent(this, homeController.class); + intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION); + this.startActivity(intent); + overridePendingTransition(R.anim.popup_scale_in, R.anim.popup_scale_out); + this.finish(); + + Runtime.getRuntime().exit(0); + + } + + public class nestedGeckoViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + if(status.sFullScreenBrowsing){ + if(e_type.equals(GECKO_SCROLL_DOWN)){ + mTopBarContainer.getLayoutTransition().setDuration(0); + mHomeViewController.onClearSelections(isKeyboardOpened); + mSearchbar.clearFocus(); + } + else { + int[] locatiosn = new int[2]; + mSearchbar.getLocationOnScreen(locatiosn); + int ys = locatiosn[1]; + if(ys!=0){ + if(ys<=8){ + mHomeViewController.shrinkTopBar(true, mGeckoView.getMaxY()); + }else { + mHomeViewController.expandTopBar(true, mGeckoView.getMaxY()); + } + } + } + } + return null; + } + } + + public class homeViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + if(e_type.equals(enums.etype.M_INIT_TAB_COUNT_FORCED)) + { + initTabCountForced(); + } + else if(e_type.equals(enums.etype.M_NEW_LINK_IN_NEW_TAB)) + { + postNewLinkTabAnimationInBackground(dataToStr(data.get(0))); + mHomeViewController.onShowLoadTabDialog(); + } + else if(e_type.equals(enums.etype.M_RESET_SUGGESTION)) + { + } + else if(e_type.equals(open_new_tab)) + { + if(status.sSettingPopupStatus){ + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_POPUP_BLOCKED); + }else { + postNewLinkTabAnimation(dataToStr(data.get(0)), true); + } + } + else if(e_type.equals(enums.etype.M_CACHE_UPDATE_TAB)){ + } + else if(e_type.equals(enums.etype.M_UPDATE_PIXEL_BACKGROUND)){ + onInvokePixelGenerator(); + } + else if(e_type.equals(enums.etype.ON_NEW_TAB_ANIMATION)){ + postNewTabAnimation((boolean)data.get(0),(boolean)data.get(1)); + } + else if(e_type.equals(enums.etype.ON_OPEN_TAB_VIEW)){ + onOpenTabViewBoundary(null); + } + else if(e_type.equals(enums.etype.download_folder)) + { + onOpenDownloadFolder(null); + } + else if(e_type.equals(enums.etype.M_UPDATE_THEME)) + { + if(mGeckoClient!=null) { + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); + } + } + else if(e_type.equals(enums.etype.ON_UPDATE_THEME)){ + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(),false); + } + else if(e_type.equals(M_INITIALIZE_TAB_SINGLE)){ + initTabCount(enums.etype.ON_NEW_TAB_ANIMATION,data); + } + else if(e_type.equals(M_INITIALIZE_TAB_LINK)){ + postNewLinkTabAnimation((String)data.get(0),false); + } + else if(e_type.equals(enums.etype.on_init_ads)) + { + mHomeViewController.onSetBannerAdMargin((boolean)data.get(0),(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + else if(e_type.equals(enums.etype.M_SPLASH_DISABLE)) + { + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,true)); + status.sAppInstalled = true; + initWidget(); + } + else if(e_type.equals(enums.etype.M_WELCOME_MESSAGE)){ + if(status.sSettingIsWelcomeEnabled){ + final Handler handler = new Handler(); + Runnable runnable = () -> { + if(!status.sUIInteracted){ + if(mHomeViewController!=null){ + mHomeViewController.closeMenu(); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); + mSearchbar.clearFocus(); + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_WELCOME); + status.sUIInteracted = true; + } + } + }; + handler.postDelayed(runnable, 2500); + } + } + else if(e_type.equals(enums.etype.on_url_load)){ + if(status.sSettingIsAppRedirected){ + mHomeViewController.onPageFinished(); + mGeckoClient.onRedrawPixel(homeController.this); + + status.sSettingIsAppRedirected = false; + onLoadURL(status.sSettingRedirectStatus); + status.sSettingRedirectStatus = strings.GENERIC_EMPTY_STR; + }else { + if(status.mThemeApplying){ + mHomeViewController.onUpdateSearchBar(data.get(0).toString(),false, false, false); + mHomeViewController.splashScreenDisableInstant(); + onLoadTabOnResume(); + } + onLoadURL(data.get(0).toString()); + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true, false); + } + } + else if(e_type.equals(enums.etype.ON_LOAD_TAB_ON_RESUME)){ + if(status.sSettingIsAppRedirected){ + status.sSettingIsAppRedirected = false; + onLoadURL(status.sSettingRedirectStatus); + status.sSettingRedirectStatus = strings.GENERIC_EMPTY_STR; + }else { + if(status.mThemeApplying){ + mHomeViewController.splashScreenDisableInstant(); + onLoadTabOnResume(); + } + else if(status.sSettingIsAppStarted){ + mHomeViewController.onPageFinished(); + mGeckoClient.onRedrawPixel(homeController.this); + mHomeViewController.onProgressBarUpdate(5, false); + onLoadTabOnResume(); + } + } + } + else if(e_type.equals(enums.etype.open_new_tab_instant)){ + postNewLinkTabAnimation(dataToStr(data.get(0)), true); + } + else if(e_type.equals(enums.etype.M_HOME_PAGE)){ + geckoSession mSession = (geckoSession)dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_HOME_PAGE, null); + if(mSession!=null){ + onLoadTab(mSession, false,true); + } + return dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_HOME_PAGE, null); + } + return null; + } + } + + String dataToStr(Object data,String defaultVal){ + if(data==null){ + return defaultVal; + } + else { + return data.toString(); + } + } + + String dataToStr(Object data){ + if(data==null){ + return strings.GENERIC_EMPTY_STR; + } + else { + return data.toString(); + } + } + + public class edittextManagerCallback implements eventObserver.eventListener { + + @Override + public Object invokeObserver(List data, Object e_type) { + + if(e_type.equals(enums.etype.ON_KEYBOARD_CLOSE)){ + isSuggestionChanged = false; + isFocusChanging = true; + mSearchbar.setSelection(0); + mHomeViewController.onClearSelections(false); + if(!isSuggestionSearchOpened){ + if(mHintListView!=null && mHintListView.getAdapter()!=null && mHintListView.getAdapter().getItemCount()>0){ + mHomeViewController.onUpdateSearchEngineBar(false, 150); + ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); + } + mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); + helperMethod.hideKeyboard(homeController.this); + } + isFocusChanging = false; + } + return null; + } + } + + + public class hintViewCallback implements eventObserver.eventListener { + + @Override + public Object invokeObserver(List data, Object e_type) { + if(e_type.equals(enums.etype.fetch_favicon)){ + mGeckoClient.onGetFavIcon((ImageView) data.get(0), (String) data.get(1), homeController.this); + } + return null; + } + } + + public void onDisableAdvert(){ + mHomeViewController.updateBannerAdvertStatus(false, true); + } + + public void onClearSettings(){ + mHomeViewController.updateBannerAdvertStatus(false, true); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + activityContextManager.getInstance().getTabController().onCloseAllTabs(); + onLoadTabFromTabController(); + initTabCountForced(); + } + + public void onClearAllTabs(){ + mHomeViewController.updateBannerAdvertStatus(false, true); + } + + public void onInvokePixelGenerator(){ + + if(mTabFragment==null || mTabFragment.getVisibility()==View.VISIBLE){ + return; + } + + if(mScrollHandler!=null){ + mScrollHandler.removeCallbacksAndMessages(null); + } + + mScrollHandler = new Handler(); + mScrollRunnable = () -> { + + try{ + mRenderedBitmap = mGeckoView.capturePixels(); + }catch (Exception ignored){} + new Handler().postDelayed(() -> + { + if(mTabFragment!=null){ + if(mTabFragment.getVisibility()!=View.VISIBLE){ + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, true)); + }else { + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, true)); + } + } + }, 100); + + }; + mScrollHandler.postDelayed(mScrollRunnable, 450); + } + + public class geckoViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + + if(e_type.equals(enums.etype.ON_EXPAND_TOP_BAR)){ + mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); + } + else if(e_type.equals(enums.etype.M_ON_BANNER_UPDATE)){ + Object mAdvertResponse = pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED); + if(mAdvertResponse != null){ + mHomeViewController.updateBannerAdvertStatus((boolean)data.get(3), (boolean)mAdvertResponse); + } + } + else if(e_type.equals(enums.etype.progress_update)){ + mHomeViewController.onProgressBarUpdate((int)data.get(0), false); + } + else if(e_type.equals(enums.etype.M_LOAD_HOMEPAGE_GENESIS)){ + onLoadURL(helperMethod.getDomainName(constants.CONST_BACKEND_GENESIS_URL)); + } + else if(e_type.equals(enums.etype.progress_update_forced)){ + Log.i("SUPPPP7:",(String)data.get(2)); + mHomeViewController.onUpdateSearchBar((String) data.get(2), false, true, false); + mHomeViewController.onProgressBarUpdate((int)data.get(0), true); + } + else if(e_type.equals(enums.etype.ON_UPDATE_SEARCH_BAR)){ + mHomeViewController.onUpdateSearchBar((String)data.get(0), false, false, false); + } + else if(e_type.equals(enums.etype.ON_FIRST_PAINT)){ + mHomeViewController.onFirstPaint(); + } + else if(e_type.equals(enums.etype.ON_SESSION_REINIT)){ + mHomeViewController.onSessionReinit(); + } + else if(e_type.equals(enums.etype.on_url_load)){ + //mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true); + } + else if(e_type.equals(enums.etype.back_list_empty)){ + helperMethod.onMinimizeApp(homeController.this); + } + else if(e_type.equals(enums.etype.M_CLOSE_TAB)){ + onCloseCurrentTab(mGeckoClient.getSession()); + } + else if(e_type.equals(enums.etype.M_ADMOB_BANNER_RECHECK)){ + if(data.get(2).toString().startsWith(CONST_GENESIS_URL_CACHED) || data.get(2).toString().startsWith(CONST_GENESIS_URL_CACHED_DARK) || helperMethod.getHost(data.get(2).toString()).contains("genesishiddentechnologies.com") || data.get(2).toString().startsWith(CONST_GENESIS_HELP_URL_CACHE) || data.get(2).toString().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mHomeViewController.updateBannerAdvertStatus(false,true); + } + } + else if(e_type.equals(enums.etype.ON_UPDATE_THEME)){ + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(),false); + } + else if(e_type.equals(enums.etype.start_proxy)){ + pluginController.getInstance().onOrbotInvoke(data, pluginEnums.eOrbotManager.M_SET_PROXY); + } + else if(e_type.equals(enums.etype.on_update_history)){ + return dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_ADD_HISTORY ,data); + } + else if(e_type.equals(enums.etype.on_page_loaded)){ + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_BOOTSTRAPPED,true)); + mHomeViewController.onPageFinished(); + mGeckoClient.onRedrawPixel(homeController.this); + } + else if(e_type.equals(M_RATE_APPLICATION)){ + if(!status.sSettingIsAppRated){ + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true)); + status.sSettingIsAppRated = true; + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_RATE_APP); + } + } + else if(e_type.equals(enums.etype.on_load_error)){ + pluginController.getInstance().onLanguageInvoke(Arrays.asList(homeController.this, status.sSettingLanguage, status.sSettingLanguageRegion, status.mThemeApplying), pluginEnums.eLangManager.M_SET_LANGUAGE); + initLocalLanguage(); + mHomeViewController.onPageFinished(); + mGeckoClient.onRedrawPixel(homeController.this); + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true, false); + } + else if(e_type.equals(enums.etype.search_update)){ + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false, true, false); + } + else if(e_type.equals(enums.etype.download_file_popup)){ + List mData = new ArrayList<>(); + mData.addAll(data); + mData.add(homeController.this); + pluginController.getInstance().onMessageManagerInvoke(mData, M_DOWNLOAD_SINGLE); + } + else if(e_type.equals(enums.etype.on_full_screen)){ + boolean status = (Boolean)data.get(0); + mHomeViewController.onFullScreenUpdate(status); + + mHomeViewController.onUpdateSearchEngineBar(false, 0); + } + else if(e_type.equals(enums.etype.on_update_favicon)){ + dataController.getInstance().invokeImage(dataEnums.eImageCommands.M_REQUEST_IMAGE_URL,Collections.singletonList(data.get(0))); + } + else if(e_type.equals(M_LONG_PRESS_WITH_LINK)){ + pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_WITH_LINK); + } + else if(e_type.equals(enums.etype.on_long_press)){ + pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_DOWNLOAD); + } + else if(e_type.equals(M_LONG_PRESS_URL)){ + pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_URL); + } + else if(e_type.equals(open_new_tab)){ + initTabCount(open_new_tab, data); + } + else if(e_type.equals(enums.etype.on_close_sesson)){ + if(!onCloseCurrentTab(mGeckoClient.getSession())){ + postNewTabAnimation(true,true); + } + } + else if(e_type.equals(enums.etype.on_playstore_load)){ + helperMethod.openPlayStore(dataToStr(data.get(0)).split("__")[1],homeController.this); + } + else if(e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE)){ + if(activityContextManager.getInstance().getTabController()!=null && mTabFragment.getVisibility()==View.VISIBLE) + activityContextManager.getInstance().getTabController().onTabRowChanged((String) data.get(1)); + } + else if(e_type.equals(enums.etype.M_RELOAD)){ + onReload(null); + } + else if(e_type.equals(enums.etype.M_UPDATE_SESSION_STATE)){ + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_SESSION_STATE, data); + } + else if(e_type.equals(enums.etype.FINDER_RESULT_CALLBACK)){ + mHomeViewController.onUpdateFindBarCount((int)data.get(0),(int)data.get(1)); + } + else if(e_type.equals(enums.etype.M_ON_MAIL)){ + helperMethod.sendCustomMail(homeController.this, (String)data.get(0)); + } + else if(e_type.equals(enums.etype.M_OPEN_SESSION)){ + tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + if(model!=null){ + onLoadTab(model.getSession(),true,true); + onLoadURL(model.getSession().getCurrentURL()); + } + } + else if(e_type.equals(enums.etype.M_UPDATE_PIXEL_BACKGROUND)){ + onInvokePixelGenerator(); + } + else if(e_type.equals(enums.etype.M_INIT_PADDING)){ + mHomeViewController.initTopBarPadding(); + } + else if(e_type.equals(enums.etype.M_RATE_COUNT)){ + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_RATE_COUNT, status.sRateCount)); + } + else if(e_type.equals(enums.etype.M_ORBOT_LOADING)){ + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_ORBOT_LOADING); + } + + return null; + } + } +} + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java index aa6308e3..d6224b70 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java @@ -1,43 +1,43 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.homeController; - -import android.util.Patterns; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; - -import java.net.URL; - -class homeModel -{ - - String getSearchEngine(){ - return status.sSettingSearchStatus; - } - - String urlComplete(String pURL, String pSearchEngine){ - if(pURL.equals("about:blank")){ - return helperMethod.completeURL("genesishiddentechnologies.com"); - } - else if(pURL.equals("about:config")){ - return pURL; - }else { - try - { - String updateUrl = helperMethod.completeURL(pURL); - URL host = new URL(updateUrl); - boolean isUrlValid = Patterns.WEB_URL.matcher(updateUrl).matches(); - if(isUrlValid && host.getHost().replace("www.","").contains(".")) - { - return pURL; - } - } - - catch (Exception ex){ - ex.printStackTrace(); - } - - String mURL = pSearchEngine.replace("$s",pURL.replaceAll(" ","+")); - return mURL; - } - } -} +package com.darkweb.genesissearchengine.appManager.homeManager.homeController; + +import android.util.Patterns; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + +import java.net.URL; + +class homeModel +{ + + String getSearchEngine(){ + return status.sSettingSearchStatus; + } + + String urlComplete(String pURL, String pSearchEngine){ + if(pURL.equals("about:blank")){ + return helperMethod.completeURL("genesishiddentechnologies.com"); + } + else if(pURL.equals("about:config")){ + return pURL; + }else { + try + { + String updateUrl = helperMethod.completeURL(pURL); + URL host = new URL(updateUrl); + boolean isUrlValid = Patterns.WEB_URL.matcher(updateUrl).matches(); + if(isUrlValid && host.getHost().replace("www.","").contains(".")) + { + return pURL; + } + } + + catch (Exception ex){ + ex.printStackTrace(); + } + + String mURL = pSearchEngine.replace("$s",pURL.replaceAll(" ","+")); + return mURL; + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java index 89b56c10..4baeeb46 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java @@ -1,1498 +1,1533 @@ -package com.darkweb.genesissearchengine.appManager.homeManager.homeController; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; -import android.animation.PropertyValuesHolder; -import android.animation.ValueAnimator; -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.pm.ActivityInfo; -import android.content.res.Configuration; -import android.content.res.Resources; -import android.graphics.Color; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.GradientDrawable; -import android.graphics.drawable.InsetDrawable; -import android.graphics.drawable.StateListDrawable; -import android.os.Build; -import android.os.Handler; -import android.os.Message; -import android.text.method.MovementMethod; -import android.util.Log; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.Window; -import android.view.WindowManager; -import android.view.inputmethod.InputMethodManager; -import android.widget.*; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.core.content.ContextCompat; -import androidx.core.graphics.ColorUtils; -import androidx.core.widget.NestedScrollView; -import androidx.fragment.app.FragmentContainerView; -import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.*; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.libs.views.ColorAnimator; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; -import com.google.android.gms.ads.AdView; -import com.google.android.material.appbar.AppBarLayout; -import org.mozilla.geckoview.GeckoView; -import org.torproject.android.proxy.wrapper.orbotLocalConstants; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.Callable; -import static android.content.Context.LAYOUT_INFLATER_SERVICE; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_DOMAIN_URL; -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 org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; - -class homeViewController -{ - /*ViewControllers*/ - private AppCompatActivity mContext; - private eventObserver.eventListener mEvent; - - /*ViewControllers*/ - private com.google.android.material.appbar.AppBarLayout mAppBar; - private ConstraintLayout mWebviewContainer; - private ProgressBar mProgressBar; - private editTextManager mSearchbar; - private ConstraintLayout mSplashScreen; - private TextView mLoadingText; - private AdView mBannerAds = null; - private Handler mUpdateUIHandler = null; - private ImageButton mGatewaySplash; - private LinearLayout mTopBar; - private GeckoView mGeckoView; - private Button mConnectButton; - private Button mNewTab; - private PopupWindow popupWindow = null; - private View mFindBar; - private View mSearchEngineBar; - private EditText mFindText; - private TextView mFindCount; - private ConstraintLayout mTopLayout; - private ImageButton mVoiceInput; - private ImageButton mMenu; - private ImageView mBlocker; - private ImageView mBlockerFullSceen; - private TextView mCopyright; - private ImageButton mOrbotLogManager; - private ConstraintLayout mInfoPortrait; - private ConstraintLayout mInfoLandscape; - private NestedScrollView mNestedScroll; - private ProgressBar mProgressBarIndeterminate; - private FragmentContainerView mTabFragment; - private LinearLayout mTopBarContainer; - private ImageView mSearchLock; - private View mPopupLoadNewTab; - private ImageView mTopBarHider; - private ImageView mNewTabBlocker; - private CoordinatorLayout mCoordinatorLayout; - private ImageView mImageDivider; - private ImageButton mPanicButton; - private ImageButton mPanicButtonLandscape; - private ImageView mGenesisLogo; - - /*Local Variables*/ - private Callable mLogs = null; - private boolean isLandscape = false; - private boolean isFullScreen = false; - private MovementMethod mSearchBarMovementMethod = null; - private Handler mTabDialogHandler = null; - private Runnable mTabDialogRunnable = null; - private boolean mIsTopBarExpanded = true; - - void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, View pPopupLoadNewTab, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo,ImageButton pPanicButtonLandscape){ - this.mContext = context; - this.mProgressBar = progressBar; - this.mSearchbar = searchbar; - this.mSplashScreen = splashScreen; - this.mLoadingText = loadingText; - this.mWebviewContainer = webviewContainer; - this.mBannerAds = banner_ads; - this.mEvent = event; - this.mGatewaySplash = gateway_splash; - this.mTopBar = top_bar; - this.mGeckoView = gecko_view; - this.mConnectButton = connect_button; - this.mNewTab = mNewTab; - this.popupWindow = null; - this.mFindBar = pFindBar; - this.mFindText = pFindText; - this.mFindCount = pFindCount; - this.mTopLayout = pTopLayout; - this.mVoiceInput = pVoiceInput; - this.mMenu = pMenu; - this.mBlocker = pBlocker; - this.mBlockerFullSceen = pBlockerFullSceen; - this.mSearchEngineBar = mSearchEngineBar; - this.mCopyright = pCopyright; - this.mAppBar = pAppBar; - this.mOrbotLogManager = pOrbotLogManager; - this.mInfoPortrait = pInfoPortrait; - this.mInfoLandscape = pInfoLandscape; - this.mNestedScroll = pNestedScroll; - this.mProgressBarIndeterminate = pProgressBarIndeterminate; - this.mTabFragment = pTabFragment; - this.mTopBarContainer = pTopBarContainer; - this.mSearchLock = pSearchLock; - this.mPopupLoadNewTab = pPopupLoadNewTab; - this.mTopBarHider = pTopBarHider; - this.mNewTabBlocker = pNewTabBlocker; - this.mCoordinatorLayout = mCoordinatorLayout; - this.mImageDivider = pImageDivider; - this.mPanicButton = pPanicButton; - this.mGenesisLogo = pGenesisLogo; - this.mPanicButtonLandscape = pPanicButtonLandscape; - - initSplashScreen(); - createUpdateUiHandler(); - recreateStatusBar(); - initTopBarPadding(); - initializeViews(); - } - - @SuppressLint("WrongConstant") - public void initializeViews(){ - mSearchbar.setTag(R.id.msearchbarProcessing,false); - mNestedScroll.setNestedScrollingEnabled(true); - this.mBlockerFullSceen.setVisibility(View.GONE); - mSearchBarMovementMethod = mSearchbar.getMovementMethod(); - mSearchbar.setMovementMethod(null); - mTopBarContainer.getLayoutTransition().setDuration(200); - - final Handler handler = new Handler(); - handler.postDelayed(() -> mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER), 1500); - - updateBannerAdvertStatus(false, false); - expandTopBar(false, 2000); - mBlockerFullSceen.setVisibility(View.GONE); - mNewTab.setPressed(true); - mNewTab.setPressed(false); - - - View child = mAppBar.getChildAt(0); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); - params.setScrollFlags(1); - mIsTopBarExpanded = false; - mAppBar.setExpanded(true,false); - mAppBar.refreshDrawableState(); - mAppBar.invalidate(); - - onClearSelections(false); - mGeckoView.requestFocus(); - - - mContext.runOnUiThread(() -> { - if(helperMethod.getScreenHeight(mContext)<1000){ - - ConstraintLayout.LayoutParams newLayoutParams1 = (ConstraintLayout.LayoutParams) mImageDivider.getLayoutParams(); - newLayoutParams1.bottomMargin = helperMethod.pxFromDp(200); - mImageDivider.setLayoutParams(newLayoutParams1); - - - ConstraintLayout.LayoutParams newLayoutParams = (ConstraintLayout.LayoutParams) mGenesisLogo.getLayoutParams(); - newLayoutParams.topMargin = helperMethod.pxFromDp(80); - mGenesisLogo.setLayoutParams(newLayoutParams); - } - }); - - } - - @SuppressLint("WrongConstant") - public void initTopBarPadding(){ - if(!status.sFullScreenBrowsing){ - int paddingDp = 110; - if(isFullScreen){ - paddingDp = 60; - }else { - if(mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){ - paddingDp = 0; - }else { - mGeckoView.setPadding(0,0,0,0); - View child = mAppBar.getChildAt(0); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); - params.setScrollFlags(0); - return; - } - } - float density = mContext.getResources().getDisplayMetrics().density; - int paddingPixel = (int)(paddingDp * density); - mGeckoView.setPadding(0,0,0,paddingPixel); - - View child = mAppBar.getChildAt(0); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); - params.setScrollFlags(0); - - }else { - int paddingDp = 0; - if(isFullScreen){ - paddingDp = 60; - } - float density = mContext.getResources().getDisplayMetrics().density; - int paddingPixel = (int)(paddingDp * density); - mGeckoView.setPadding(0,0,0,paddingPixel); - - View child = mAppBar.getChildAt(0); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); - params.setScrollFlags(1); - } - } - - public void initSplashOrientation(){ - if(isLandscape){ - this.mInfoPortrait.setVisibility(View.GONE); - this.mInfoLandscape.setVisibility(View.VISIBLE); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue_splash)); - }else { - this.mInfoPortrait.setVisibility(View.VISIBLE); - this.mInfoLandscape.setVisibility(View.GONE); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - } - - public void onShowLoadTabDialog() { - mPopupLoadNewTab.findViewById(R.id.pBlockerUndo).setVisibility(View.GONE); - mPopupLoadNewTab.animate().cancel(); - mPopupLoadNewTab.setAlpha(0); - mPopupLoadNewTab.setVisibility(View.VISIBLE); - mPopupLoadNewTab.animate().setStartDelay(400).setDuration(250).alpha(1); - - if(mTabDialogHandler!=null){ - mTabDialogHandler.removeCallbacksAndMessages(null); - } - - mTabDialogHandler = new Handler(); - mTabDialogRunnable = this::onHideLoadTabDialog; - mTabDialogHandler.postDelayed(mTabDialogRunnable, 3500); - } - - public void onHideLoadTabDialog() { - mPopupLoadNewTab.findViewById(R.id.pBlockerUndo).setVisibility(View.VISIBLE); - mPopupLoadNewTab.animate().cancel(); - - mPopupLoadNewTab.animate().setDuration(250).alpha(0).withEndAction(() -> { - mPopupLoadNewTab.setVisibility(View.GONE); - }); - } - - public void onShowTabContainer(){ - onHideLoadTabDialog(); - if(mTabFragment.getAlpha()==0 || mTabFragment.getAlpha()==1){ - - onUpdateStatusBarTheme(null, false); - mTabFragment.animate().cancel(); - mTabFragment.setAlpha(0); - mTabFragment.setVisibility(View.VISIBLE); - mTabFragment.animate().alpha(1).setStartDelay(100).setDuration(150).withEndAction(() -> mNewTab.setPressed(false)); - } - } - - public void onHideTabContainer(){ - onHideLoadTabDialog(); - if(mTabFragment.getAlpha()>0 || mTabFragment.getVisibility()!=View.GONE){ - Log.i("SUPERFUCK4","SUPERFUCK"); - mNewTab.setPressed(false); - new Handler().postDelayed(() -> - { - mTopBarHider.animate().alpha(0).setDuration(250).setStartDelay(0).withEndAction(() -> mTopBarHider.setVisibility(View.GONE)); - mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME); - }, 250); - - mTabFragment.animate().cancel(); - mTabFragment.animate().setDuration(100).alpha(0f).withEndAction(() -> { - mTabFragment.setVisibility(View.GONE); - mEvent.invokeObserver(null, enums.etype.M_UPDATE_PIXEL_BACKGROUND); - }); - } - } - - public int getSearchLogo(){ - switch (status.sSettingSearchStatus) { - case constants.CONST_BACKEND_GENESIS_URL: - return R.drawable.genesis; - case constants.CONST_BACKEND_GOOGLE_URL: - return R.drawable.google; - case constants.CONST_BACKEND_DUCK_DUCK_GO_URL: - return R.drawable.duckduckgo; - case constants.CONST_BACKEND_BING_URL: - return R.drawable.bing; - default: - return R.drawable.wikipedia; - } - } - - @SuppressLint("UseCompatLoadingForDrawables") - public void onUpdateSearchIcon(int mStatus){ - try { - if(mStatus==0){ - mSearchLock.setColorFilter(null); - mSearchLock.clearColorFilter(); - mSearchLock.setImageTintList(null); - - mSearchLock.setImageDrawable(mContext.getResources().getDrawable(getSearchLogo())); - } - else if(mStatus==1){ - if(!(boolean)mSearchLock.getTag(R.id.themed)){ - mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_lock_tint)); - mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_lock)); - }else { - mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_lock)); - } - } - else if(mStatus==2){ - mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_icon_tint)); - mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_browser)); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @SuppressLint("UseCompatLoadingForDrawables") - public void initSearchBarFocus(boolean pStatus, boolean mIsKeyboardOpened){ - if(!pStatus){ - this.mVoiceInput.animate().setDuration(0).alpha(0).withEndAction(() -> { - - mVoiceInput.setClickable(true); - mVoiceInput.setFocusable(true); - onUpdateSearchIcon(1); - mVoiceInput.setVisibility(View.GONE); - mNewTab.setVisibility(View.VISIBLE); - mMenu.setVisibility(View.VISIBLE); - mSearchbar.setFadingEdgeLength(helperMethod.pxFromDp(20)); - mSearchbar.setMovementMethod(null); - - if(status.sSettingLanguageRegion.equals("Ur")){ - mSearchbar.setPadding(helperMethod.pxFromDp(17),0,mSearchbar.getPaddingRight(),0); - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mSearchbar.getLayoutParams(); - params.leftMargin = helperMethod.pxFromDp(5); - }else { - mSearchbar.setPadding(mSearchbar.getPaddingLeft(),0,helperMethod.pxFromDp(5),0); - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mSearchbar.getLayoutParams(); - params.rightMargin = helperMethod.pxFromDp(10); - } - - }); - }else { - - onUpdateSearchIcon(0); - mSearchbar.setMovementMethod(mSearchBarMovementMethod); - mSearchbar.setFadingEdgeLength(helperMethod.pxFromDp(0)); - - final Handler handler = new Handler(); - handler.postDelayed(() -> - { - Drawable drawable; - Resources res = mContext.getResources(); - try { - if(status.sSettingEnableVoiceInput){ - drawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_keyboard_voice)); - }else { - drawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_cancel)); - } - mVoiceInput.setImageDrawable(drawable); - } catch (Exception ex) { - ex.printStackTrace(); - } - if(status.sSettingIsAppStarted){ - mVoiceInput.setVisibility(View.VISIBLE); - } - mVoiceInput.setClickable(true); - mVoiceInput.setFocusable(true); - }, 0); - - mNewTab.setVisibility(View.GONE); - this.mMenu.setVisibility(View.GONE); - - if(status.sSettingLanguageRegion.equals("Ur")){ - mSearchbar.setPadding(helperMethod.pxFromDp(45),0,mSearchbar.getPaddingRight(),0); - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mSearchbar.getLayoutParams(); - params.leftMargin = helperMethod.pxFromDp(17); - }else { - mSearchbar.setPadding(mSearchbar.getPaddingLeft(),0,helperMethod.pxFromDp(45),0); - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mSearchbar.getLayoutParams(); - params.rightMargin = helperMethod.pxFromDp(17); - } - - if(!mIsKeyboardOpened){ - mSearchbar.requestFocus(); - InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE); - imm.showSoftInput(mSearchbar, InputMethodManager.SHOW_IMPLICIT); - } - } - } - - void initTab(int count, boolean pForced, enums.etype pEvent, List pData){ - if(!pForced){ - ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mNewTab, - PropertyValuesHolder.ofFloat("scaleX", 1, 0.70f, 1), - PropertyValuesHolder.ofFloat("scaleY", 1, 0.70f, 1)); - scaleDown.setDuration(250); - scaleDown.start(); - - scaleDown.addListener(new Animator.AnimatorListener() { - - @Override - public void onAnimationStart(Animator arg0) { - } - - @Override - public void onAnimationRepeat(Animator arg0) { - } - - @Override - public void onAnimationEnd(Animator arg0) { - if(pEvent!=null){ - mEvent.invokeObserver(pData, pEvent); - } - } - - @Override - public void onAnimationCancel(Animator arg0) { - } - }); - } - - if(count==0){ - count=1; - } - mNewTab.setText((count+strings.GENERIC_EMPTY_STR)); - - } - - public void recreateStatusBar(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - } - } - - public void initStatusBarColor(boolean mInstant) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - ColorAnimator oneToTwo = new ColorAnimator(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2)); - - int mDelay = 500; - if(status.mThemeApplying || mInstant){ - mDelay = 0; - } - - ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f); - animator.setDuration(250).setStartDelay(mDelay); - animator.addUpdateListener(animation -> - { - float v = (float) animation.getAnimatedValue(); - mSplashScreen.setAlpha(1-v); - mContext.getWindow().setStatusBarColor(oneToTwo.with(v*1f)); - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - }); - animator.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - }); - animator.addListener(new AnimatorListenerAdapter() - { - @Override - public void onAnimationEnd(Animator animation) - { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - }else { - View decorView = mContext.getWindow().getDecorView(); - decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - } - }); - animator.start(); - }else { - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - - } - - public void initSplashLoading(){ - - mLoadingText.setAlpha(0); - mLoadingText.setVisibility(View.VISIBLE); - mLoadingText.animate().setStartDelay(0).alpha(1); - - mProgressBarIndeterminate.setVisibility(View.VISIBLE); - mProgressBarIndeterminate.animate().alpha(1); - mConnectButton.setEnabled(false); - mSplashScreen.setEnabled(false); - mBlocker.setClickable(true); - mBlocker.setFocusable(true); - } - - void initHomePage(){ - mConnectButton.setEnabled(false); - mSplashScreen.setEnabled(false); - mOrbotLogManager.setEnabled(false); - mPanicButton.setEnabled(false); - mPanicButtonLandscape.setEnabled(false); - - final Handler handler = new Handler(); - handler.postDelayed(() -> - { - mOrbotLogManager.setEnabled(true); - }, 700); - - mConnectButton.animate().setDuration(350).alpha(0.4f).withEndAction(() -> { - mCopyright.setVisibility(View.GONE); - initSplashLoading(); - }); - mGatewaySplash.animate().setDuration(350).alpha(0.4f); - mPanicButton.animate().setDuration(250).alpha(0f); - mPanicButtonLandscape.animate().setDuration(250).alpha(0f); - } - - private void initSplashScreen(){ - - mIsAnimating = false; - helperMethod.hideKeyboard(mContext); - mSearchLock.setTag(R.id.themed,false); - mAppBar.setTag(R.id.expandableBar,true); - - if(!status.mThemeApplying){ - mSearchbar.setEnabled(false); - }else { - mSearchbar.setEnabled(true); - } - - View root = mSearchbar.getRootView(); - root.setBackgroundColor(ContextCompat.getColor(mContext, R.color.c_background_keyboard)); - - - } - - void initProxyLoading(Callable logs){ - this.mLogs = logs; - - if(mSplashScreen.getVisibility()==View.VISIBLE){ - new Thread(){ - public void run(){ - AppCompatActivity temp_context = mContext; - while (!orbotLocalConstants.mIsTorInitialized || !orbotLocalConstants.mNetworkState){ - try - { - sleep(1000); - mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), enums.etype.recheck_orbot); - if(temp_context.isDestroyed()){ - return; - } - startPostTask(messages.MESSAGE_UPDATE_LOADING_TEXT); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - if(!status.sSettingIsAppStarted){ - startPostTask(messages.MESSAGE_ON_URL_LOAD); - mContext.runOnUiThread(() -> splashScreenDisable()); - }else { - mContext.runOnUiThread(() -> mEvent.invokeObserver(null, enums.etype.ON_LOAD_TAB_ON_RESUME)); - } - } - }.start(); - } - } - - /*-------------------------------------------------------PAGE UI Methods-------------------------------------------------------*/ - - void onPageFinished(){ - mSearchbar.setEnabled(true); - mProgressBar.bringToFront(); - mSplashScreen.bringToFront(); - splashScreenDisable(); - } - - public void splashScreenDisableInstant() { - mSplashScreen.setAlpha(0f); - mSplashScreen.setVisibility(View.GONE); - mSplashScreen.setVisibility(View.GONE); - mBlocker.setEnabled(false); - } -//C:\Users\MSi\AppData\Local\Android\ndk - private boolean mIsAnimating = false; - public void splashScreenDisable(){ - mTopBar.setAlpha(1); - - if(mSplashScreen.getAlpha()==1){ - if(!mIsAnimating){ - mIsAnimating = true; - triggerPostUI(2000); - mProgressBar.setVisibility(View.GONE); - mSplashScreen.animate().cancel(); - onClearSelections(false); - mGeckoView.requestFocus(); - mProgressBarIndeterminate.animate().cancel(); - mProgressBarIndeterminate.animate().setStartDelay(350).setDuration(250).alpha(0).withEndAction(() -> { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - initStatusBarColor(false); - } - - mSplashScreen.animate().setDuration(0).setStartDelay(1000).alpha(0).withEndAction(() -> { - mProgressBarIndeterminate.setVisibility(View.GONE); - mSplashScreen.setClickable(false); - mSplashScreen.setFocusable(false); - mSearchbar.setEnabled(true); - mBlocker.setEnabled(false); - - mBlocker.setVisibility(View.GONE); - mGatewaySplash.setVisibility(View.GONE); - mConnectButton.setVisibility(View.GONE); - mPanicButton.setVisibility(View.GONE); - mPanicButtonLandscape.setVisibility(View.GONE); - - mEvent.invokeObserver(null, enums.etype.M_CACHE_UPDATE_TAB); - mEvent.invokeObserver(null, enums.etype.M_SPLASH_DISABLE); - }); - }); - mEvent.invokeObserver(null, enums.etype.M_WELCOME_MESSAGE); - mOrbotLogManager.setClickable(false); - status.sSettingIsAppRestarting = true; - } - } - } - - public void onUpdateToolbarTheme(){ - mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); - } - - private void triggerPostUI(int pOffsetY){ - expandTopBar(false, pOffsetY); - if(mProgressBar.getProgress()>0 && mProgressBar.getProgress()<10000){ - mProgressBar.animate().setStartDelay(0).alpha(1); - } - } - - public void disableExpand(){ - - View child = mAppBar.getChildAt(0); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); - params.setScrollFlags(0); - - } - - @SuppressLint("WrongConstant") - private void enableCollapsing() { - View child = mAppBar.getChildAt(0); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); - params.setScrollFlags(1); - } - public void expandTopBar(boolean pForced, int pOffsetY){ - - if(pOffsetY == -1){ - mAppBar.setExpanded(true,true); - disableExpand(); - }else { - enableCollapsing(); - } - - new Handler().postDelayed(() -> - { - mTopBarContainer.getLayoutTransition().setDuration(200); - Object mTag = mAppBar.getTag(R.id.expandableBar); - if(mIsTopBarExpanded && !pForced){ - return; - } - - - if(mTag!=null && (boolean) mTag){ - mAppBar.setExpanded(true,true); - mIsTopBarExpanded = true; - Log.i("wwwwww1","wwwwww"); - } - }, 100); - - } - - public void shrinkTopBar(boolean pForced, int pOffsetY){ - - if(pOffsetY == -1){ - mAppBar.setExpanded(true,true); - disableExpand(); - }else { - enableCollapsing(); - } - - mTopBarContainer.getLayoutTransition().setDuration(0); - new Handler().postDelayed(() -> - { - mTopBarContainer.getLayoutTransition().setDuration(200); - Object mTag = mAppBar.getTag(R.id.expandableBar); - - if(!mIsTopBarExpanded && !pForced){ - return; - } - - if(mTag!=null && (boolean) mTag){ - mIsTopBarExpanded = false; - mAppBar.setExpanded(false,true); - Log.i("wwwwww2","wwwwww"); - } - }, 100); - } - - /*-------------------------------------------------------Helper Methods-------------------------------------------------------*/ - - void onOpenMenu(View view, boolean canGoForward, boolean isLoading, int userAgent, String mURL){ - - if(popupWindow!=null){ - popupWindow.dismiss(); - } - - LayoutInflater layoutInflater - = (LayoutInflater) mContext - .getSystemService(LAYOUT_INFLATER_SERVICE); - @SuppressLint("InflateParams") final View popupView = layoutInflater.inflate(R.layout.popup_side_menu, null); - - - int height = helperMethod.getScreenHeight(mContext)*90 /100; - - popupWindow = new PopupWindow( - popupView, - ActionMenuView.LayoutParams.WRAP_CONTENT, - ActionMenuView.LayoutParams.WRAP_CONTENT, true); - - popupWindow.setOutsideTouchable(true); - popupWindow.setFocusable(true); - popupWindow.setBackgroundDrawable(new BitmapDrawable()); - View parent = view.getRootView(); - popupWindow.setAnimationStyle(R.style.popup_window_animation); - if(isLandscape){ - helperMethod.hideKeyboard(mContext); - popupWindow.setHeight(height); - } - - if(status.sSettingLanguageRegion.equals("Ur") || status.sSettingLanguage.equals("default") && status.mSystemLocale.getLanguage().equals("ur")){ - popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.START,0,0); - }else { - popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.END,0,0); - } - - ImageButton back = popupView.findViewById(R.id.menu22); - ImageButton close = popupView.findViewById(R.id.menu20); - ImageButton mRefresh = popupView.findViewById(R.id.menu21); - ImageButton mDownload = popupView.findViewById(R.id.menuItem25); - CheckBox desktop = popupView.findViewById(R.id.menu27); - LinearLayout newTab = popupView.findViewById(R.id.menu11); - desktop.setChecked(userAgent==USER_AGENT_MODE_DESKTOP); - - String mExtention = helperMethod.getMimeType(mURL, mContext); - if(mExtention == null || mExtention.equals("text/html") || mExtention.equals("application/vnd.ms-htmlhelp") || mExtention.equals("application/vnd.sun.xml.writer") || mExtention.equals("application/vnd.sun.xml.writer.global") || mExtention.equals("application/vnd.sun.xml.writer.template") || mExtention.equals("application/xhtml+xml")){ - mDownload.setEnabled(false); - mDownload.setColorFilter(Color.argb(255, 191, 191, 191)); - } - - if(!canGoForward){ - back.setEnabled(false); - back.setColorFilter(Color.argb(255, 191, 191, 191)); - } - if(!isLoading){ - close.setVisibility(View.GONE); - mRefresh.setVisibility(View.VISIBLE); - }else { - close.setVisibility(View.VISIBLE); - mRefresh.setVisibility(View.GONE); - } - - newTab.setClickable(false); - close.setClickable(false); - new Handler().postDelayed(() -> - { - newTab.setClickable(true); - close.setClickable(true); - }, 300); - - } - - void downloadNotification(String message, enums.etype e_type){ - - if(popupWindow!=null){ - popupWindow.dismiss(); - } - - LayoutInflater layoutInflater - = (LayoutInflater) mContext - .getSystemService(LAYOUT_INFLATER_SERVICE); - assert layoutInflater != null; - @SuppressLint("InflateParams") final View popupView = layoutInflater.inflate(R.layout.notification_menu, null); - popupWindow = new PopupWindow( - popupView, - ActionMenuView.LayoutParams.MATCH_PARENT, - ActionMenuView.LayoutParams.WRAP_CONTENT, true); - - popupWindow.setOutsideTouchable(true); - popupWindow.setFocusable(true); - popupWindow.setBackgroundDrawable(new BitmapDrawable()); - View parent = mGeckoView.getRootView(); - popupWindow.setAnimationStyle(R.style.popup_window_animation); - - - if(message.length()>30){ - message = message.substring(message.length()-20); - } - - TextView notification_message = popupView.findViewById(R.id.notification_message); - notification_message.setText(message); - - Button btn = popupView.findViewById(R.id.notification_event); - btn.setOnClickListener(v -> - { - mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), enums.etype.progress_update); - popupWindow.dismiss(); - }); - - popupWindow.showAtLocation(parent, Gravity.BOTTOM|Gravity.START,0,-10); - } - - void closeMenu(){ - if(popupWindow!=null){ - popupWindow.dismiss(); - } - } - - public void onMoveTopBar(int pPosition){ - } - - public void setOrientation(boolean status){ - isLandscape = status; - } - - void onSetBannerAdMargin(boolean status,boolean isAdLoaded){ - if(isAdLoaded){ - if(status && !isLandscape && !isFullScreen){ - mBannerAds.setVisibility(View.VISIBLE); - - final Handler handler = new Handler(); - handler.postDelayed(() -> - { - mWebviewContainer.clearAnimation(); - mProgressBar.bringToFront(); - }, 250); - }else{ - mBannerAds.setVisibility(View.GONE); - } - } - } - - void updateBannerAdvertStatus(boolean status, boolean pIsAdvertLoaded){ - if(status && pIsAdvertLoaded){ - if(mBannerAds.getAlpha()==0){ - mBannerAds.animate().cancel(); - mBannerAds.setAlpha(0); - mBannerAds.animate().alpha(1); - mBannerAds.setVisibility(View.VISIBLE); - } - onSetBannerAdMargin(true,true); - }else{ - if(mBannerAds.getAlpha()==1){ - mBannerAds.animate().cancel(); - mBannerAds.animate().alpha(0).withEndAction(() -> mBannerAds.setVisibility(View.GONE)); - } - onSetBannerAdMargin(false,true); - } - } - - private Handler searchBarUpdateHandler = new Handler(); - private String handlerLocalUrl = ""; - void onUpdateSearchBar(String url,boolean showProtocol, boolean pClearText, boolean pBypassFocus){ - - if(url.startsWith(CONST_GENESIS_URL_CACHED) || url.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ - mSearchbar.setTag(R.id.msearchbarProcessing,true); - url = CONST_GENESIS_DOMAIN_URL; - } - - - Log.i("FUCK::5",url); - if(!mSearchbar.hasFocus() || pClearText || pBypassFocus){ - if(mSearchEngineBar.getVisibility() == View.GONE || pBypassFocus){ - int delay = 0; - handlerLocalUrl = url; - - if(searchBarUpdateHandler.hasMessages(100)){ - searchBarUpdateHandler.removeMessages(100); - } - - searchBarUpdateHandler.sendEmptyMessage(100); - searchBarUpdateHandler.removeMessages(100); - triggerUpdateSearchBar(handlerLocalUrl,showProtocol, pClearText); - mSearchbar.setTag(R.id.msearchbarProcessing,false); - } - } - } - - public void onUpdateFindBarCount(int index, int total) - { - if(total==0){ - mFindCount.setText("0/0"); - mFindCount.setTextColor(ContextCompat.getColor(mContext, R.color.dark_red_soft)); - }else { - mFindCount.setText((total + "/" + index)); - mFindCount.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v6)); - } - } - - public void onUpdateStatusBarTheme(String pTheme, boolean mForced) - { - if(mSplashScreen.getAlpha()<=0 && (status.sTheme != enums.Theme.THEME_DARK && mTabFragment.getAlpha()<=0 || mForced)){ - if(status.sDefaultNightMode && status.sTheme == enums.Theme.THEME_DEFAULT){ - return; - } - int mColor; - try{ - mColor = Color.parseColor(pTheme); - }catch (Exception ex){ - mColor = -1; - } - - if(!mSearchbar.isFocused() && pTheme!=null && status.sToolbarTheme && mColor!=-1 && helperMethod.getColorDensity(mColor)<0.80 && status.sTheme != enums.Theme.THEME_DARK){ - mTopBar.setBackgroundColor(mColor); - mSearchbar.setTextColor(helperMethod.invertedGrayColor(mColor)); - mSearchbar.setHintTextColor(helperMethod.invertedGrayColor(mColor)); - mNewTab.setTextColor(helperMethod.invertedGrayColor(mColor)); - - GradientDrawable mGradientDrawable = new GradientDrawable(); - mGradientDrawable.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.90f), Color.BLACK, 0.2f)); - mGradientDrawable.setCornerRadius(helperMethod.pxFromDp(7)); - - GradientDrawable gradientDrawable1 = new GradientDrawable(); - gradientDrawable1.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.50f), Color.BLACK, 0.2f)); - gradientDrawable1.setCornerRadius(helperMethod.pxFromDp(4)); - - GradientDrawable gradientDrawable3 = new GradientDrawable(); - gradientDrawable3.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.50f), Color.BLACK, 0.2f)); - gradientDrawable3.setCornerRadius(helperMethod.pxFromDp(4)); - gradientDrawable3.setStroke(helperMethod.pxFromDp(2), helperMethod.invertedGrayColor(mColor)); - - GradientDrawable gradientDrawable2 = new GradientDrawable(); - gradientDrawable2.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.90f), Color.BLACK, 0.2f)); - gradientDrawable2.setCornerRadius(helperMethod.pxFromDp(4)); - gradientDrawable2.setStroke(helperMethod.pxFromDp(2), helperMethod.invertedGrayColor(mColor)); - - StateListDrawable states = new StateListDrawable(); - InsetDrawable mInsetDrawable1 = new InsetDrawable(gradientDrawable3, helperMethod.pxFromDp(8), helperMethod.pxFromDp(8), helperMethod.pxFromDp(8), helperMethod.pxFromDp(8)); - InsetDrawable mInsetDrawable2 = new InsetDrawable(gradientDrawable2, helperMethod.pxFromDp(8), helperMethod.pxFromDp(8), helperMethod.pxFromDp(8), helperMethod.pxFromDp(8)); - - states.addState(new int[] {android.R.attr.state_pressed}, mInsetDrawable1); - states.addState(new int[] { }, mInsetDrawable2); - - mNewTab.setBackground(states); - - mMenu.setColorFilter(helperMethod.invertedGrayColor(mColor)); - mVoiceInput.setColorFilter(helperMethod.invertedGrayColor(mColor)); - mVoiceInput.setBackground(mGradientDrawable); - mSearchLock.setColorFilter(helperMethod.invertedGrayColor(mColor)); - mSearchLock.setTag(R.id.themed,true); - gradientDrawable1.setCornerRadius(helperMethod.pxFromDp(7)); - gradientDrawable1.setStroke(helperMethod.pxFromDp(2), mColor); - gradientDrawable1.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.90f), Color.BLACK, 0.2f)); - mSearchbar.setBackground(gradientDrawable1); - mSearchbar.setHintTextColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.10f), Color.BLACK, 0.2f)); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - mContext.getWindow().setStatusBarColor(Color.parseColor(pTheme)); - }else { - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - - if(helperMethod.isColorDark(mColor)){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - }else { - View decorView = mContext.getWindow().getDecorView(); //set status background black - decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mTopBarHider.setBackgroundColor(mColor); - } - else{ - mSearchLock.setTag(R.id.themed,false); - mTopBar.setBackground(ContextCompat.getDrawable(mContext, R.color.c_background)); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - }else { - mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - - GradientDrawable gradientDrawable1 = new GradientDrawable(); - gradientDrawable1.setColor(ContextCompat.getColor(mContext, R.color.c_edittext_background)); - gradientDrawable1.setCornerRadius(helperMethod.pxFromDp(7)); - gradientDrawable1.setStroke(helperMethod.pxFromDp(2), ContextCompat.getColor(mContext, R.color.c_edittext_background)); - mSearchbar.setBackground(gradientDrawable1); - - Drawable drawable; - Resources res = mContext.getResources(); - try { - drawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_generic_tab_button)); - mNewTab.setBackground(drawable); - - Drawable drawableTemp = Drawable.createFromXml(res, res.getXml(R.xml.gx_generic_input)); - mVoiceInput.setBackground(drawableTemp); - } catch (Exception ex) { - ex.printStackTrace(); - } - - mNewTab.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1)); - mMenu.setColorFilter(ContextCompat.getColor(mContext, R.color.c_navigation_tint)); - mVoiceInput.setColorFilter(ContextCompat.getColor(mContext, R.color.c_text_v8)); - mSearchbar.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1)); - mSearchbar.setHintTextColor(ContextCompat.getColor(mContext, R.color.c_text_v2)); - - if(!mSearchbar.isFocused()){ - onUpdateSearchIcon(1); - } - - if(status.sTheme != enums.Theme.THEME_DARK || (status.sDefaultNightMode && status.sTheme != enums.Theme.THEME_DEFAULT)){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - }else { - View decorView = mContext.getWindow().getDecorView(); - decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - - mTopBarHider.setBackground(ContextCompat.getDrawable(mContext, R.color.c_background)); - } - } - } - - public void onUpdateFindBar(boolean pStatus) - { - mFindBar.animate().cancel(); - if(pStatus){ - mFindBar.setVisibility(View.VISIBLE); - mFindBar.setAlpha(0); - mFindBar.animate().setDuration(200).alpha(1); - mFindText.requestFocus(); - mFindCount.setText("0/0"); - mFindCount.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v6)); - final Handler handler = new Handler(); - handler.postDelayed(() -> - { - InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); - imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT,0); - }, 300); - }else { - mFindText.clearFocus(); - helperMethod.hideKeyboard(mContext); - mFindBar.animate().setDuration(200).alpha(0).withEndAction(() -> { - mFindCount.setText(strings.GENERIC_EMPTY_STR); - mFindText.setText(strings.GENERIC_EMPTY_STR); - mFindBar.setVisibility(View.GONE); - }); - } - } - - @SuppressLint("WrongConstant") - public void onUpdateSearchEngineBar(boolean pStatus, int delay) - { - if(pStatus){ - if(mSearchEngineBar.getAlpha() == 0 || mSearchEngineBar.getVisibility() == View.GONE && mSplashScreen.getAlpha()<=0){ - mSearchEngineBar.animate().cancel(); - mSearchEngineBar.setAlpha(0f); - mSearchEngineBar.animate().setDuration(delay).alpha(1); - mSearchEngineBar.setVisibility(View.VISIBLE); - onUpdateStatusBarTheme(null, false); - - View child = mAppBar.getChildAt(0); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); - params.setScrollFlags(0); - } - }else { - View child = mAppBar.getChildAt(0); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); - params.setScrollFlags(1); - mAppBar.refreshDrawableState(); - mAppBar.invalidate(); - - mSearchEngineBar.animate().setDuration(delay).alpha(0).withEndAction(() -> { - mSearchEngineBar.animate().cancel(); - mSearchEngineBar.setAlpha(0f); - mSearchEngineBar.setVisibility(View.GONE); - mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME); - mEvent.invokeObserver(null, enums.etype.M_RESET_SUGGESTION); - }); - } - - } - - private void triggerUpdateSearchBar(String url, boolean showProtocol, boolean pClearText){ - if (mSearchbar == null || url==null) - { - return; - } - - if(!showProtocol){ - url=url.replace("https://",""); - url=url.replace("http://",""); - } - - url = url.replace("genesishiddentechnologies.com","genesis.onion"); - boolean isTextSelected = false; - - if(mSearchbar.isSelected()){ - isTextSelected = true; - } - - - if(url.length()<=300){ - url = removeEndingSlash(url); - mSearchbar.setText(helperMethod.urlDesigner(url, mContext, mSearchbar.getCurrentTextColor(), status.sTheme)); - mSearchbar.selectAll(); - - if(isTextSelected){ - mSearchbar.selectAll(); - } - - mSearchbar.setSelection(0); - }else { - url = removeEndingSlash(url); - mSearchbar.setText(url); - } - - if(mSearchbar.isFocused()){ - mSearchbar.setSelection(mSearchbar.getText().length()); - mSearchbar.selectAll(); - } - - if(mSearchbar.getText().toString().equals("loading")){ - mSearchbar.setText("about:blank"); - } - } - - private String removeEndingSlash(String url){ - return helperMethod.removeLastSlash(url); - } - - void onNewTab(){ - if(!mSearchbar.isFocused()){ - mSearchbar.requestFocus(); - mSearchbar.selectAll(); - } - } - - void onUpdateLogs(String log){ - mLoadingText.setText(log); - } - - void progressBarReset(){ - mProgressBar.setProgress(5); - mProgressBar.setVisibility(View.INVISIBLE); - } - - public void onFirstPaint(){ - mGeckoView.setForeground(ContextCompat.getDrawable(mContext, R.color.clear_alpha)); - } - - public void onSessionReinit(){ - mGeckoView.setForeground(ContextCompat.getDrawable(mContext, R.color.c_background)); - } - - void onProgressBarUpdate(int value, boolean mForced){ - - if(progressAnimator!=null){ - progressAnimator.cancel(); - } - if(mSearchbar.getText().toString().equals("genesis.onion") && !mForced || (boolean)mSearchbar.getTag(R.id.msearchbarProcessing)){ - mProgressBar.setProgress(0); - mProgressBar.setVisibility(View.GONE); - return; - } - - mProgressBar.setVisibility(View.VISIBLE); - mProgressBar.setAlpha(1); - mProgressBar.animate().cancel(); - - if(value != mProgressBar.getProgress()){ - if(value<=5 && value>0){ - setProgressAnimate(5,70); - }else { - setProgressAnimate(value,200); - } - if(value >= 100 || value<=0){ - mProgressBar.animate().alpha(0).setStartDelay(200).withEndAction(() -> mProgressBar.setProgress(0)); - } - } - } - - ObjectAnimator progressAnimator = null; - private void setProgressAnimate(int pValue, int pSpeed) - { - progressAnimator = ObjectAnimator.ofInt(mProgressBar, "progress", pValue); - progressAnimator.setDuration(pSpeed); - progressAnimator.start(); - } - - public void onNewTabAnimation(List data, Object e_type){ - mGeckoView.setPivotX(0); - mGeckoView.setPivotY(0); - - ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mGeckoView, - PropertyValuesHolder.ofFloat("scaleX", 1, 0.8f), - PropertyValuesHolder.ofFloat("scaleY", 1, 0.8f)); - - mNewTabBlocker.setVisibility(View.VISIBLE); - ObjectAnimator alpha = ObjectAnimator.ofPropertyValuesHolder(mNewTabBlocker, - PropertyValuesHolder.ofFloat("alpha", 0, 1f)); - - scaleDown.setDuration(150); - alpha.setDuration(150); - - scaleDown.start(); - alpha.start(); - - scaleDown.addListener(new Animator.AnimatorListener() { - @Override - public void onAnimationStart(Animator animation, boolean isReverse) { - } - - @Override - public void onAnimationEnd(Animator animation, boolean isReverse) { - mEvent.invokeObserver(data, e_type); - ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mGeckoView, - PropertyValuesHolder.ofFloat("scaleX", 0.8f, 1f), - PropertyValuesHolder.ofFloat("scaleY", 0.8f, 1f)); - - scaleDown.setDuration(150); - scaleDown.setStartDelay(0); - mNewTabBlocker.animate().setStartDelay(250).setDuration(150).alpha(0f).withEndAction(() -> { - mNewTabBlocker.setVisibility(View.GONE); - }); - scaleDown.start(); - } - - @Override - public void onAnimationStart(Animator animation) { - } - - @Override - public void onAnimationEnd(Animator animation) { - mEvent.invokeObserver(data, e_type); - ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mGeckoView, - PropertyValuesHolder.ofFloat("scaleX", 0.8f, 1f), - PropertyValuesHolder.ofFloat("scaleY", 0.8f, 1f)); - - scaleDown.setDuration(150); - scaleDown.setStartDelay(0); - mNewTabBlocker.animate().setStartDelay(250).setDuration(150).alpha(0f).withEndAction(() -> { - mNewTabBlocker.setVisibility(View.GONE); - }); - scaleDown.start(); - } - - @Override - public void onAnimationCancel(Animator animation) { - - } - - @Override - public void onAnimationRepeat(Animator animation) { - } - }); - } - - void onClearSelections(boolean hideKeyboard){ - mSearchbar.setFocusable(false); - mSearchbar.setFocusableInTouchMode(true); - mSearchbar.setFocusable(true); - if(hideKeyboard){ - helperMethod.hideKeyboard(mContext); - } - } - - private void disableEnableControls(boolean enable, ViewGroup vg){ - vg.setEnabled(enable); // the point that I was missing - for (int i = 0; i < vg.getChildCount(); i++){ - View child = vg.getChildAt(i); - child.setEnabled(enable); - child.setClickable(enable); - if (child instanceof ViewGroup){ - disableEnableControls(enable, (ViewGroup)child); - } - } - } - - private int defaultFlag = 0; - void onFullScreenUpdate(boolean pStatus){ - int value = !pStatus ? 1 : 0; - - if(pStatus) { - isFullScreen = true; - }else { - this.mBlockerFullSceen.setVisibility(View.VISIBLE); - this.mBlockerFullSceen.setAlpha(1f); - isFullScreen = false; - } - - if(pStatus){ - onProgressBarUpdate(100, false); - this.mBlockerFullSceen.setVisibility(View.VISIBLE); - this.mBlockerFullSceen.setAlpha(0f); - this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(1).withEndAction(() -> { - mTopBar.setClickable(!pStatus); - disableEnableControls(!pStatus, mTopBar); - mTopBar.setAlpha(value); - mBannerAds.setVisibility(View.GONE); - - defaultFlag = mContext.getWindow().getDecorView().getSystemUiVisibility(); - final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; - mContext.getWindow().getDecorView().setSystemUiVisibility(flags); - mContext.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); - - mProgressBar.setVisibility(View.GONE); - mTopBar.setVisibility(View.GONE); - mBannerAds.setVisibility(View.GONE); - - NestedScrollView.MarginLayoutParams params = (NestedScrollView.MarginLayoutParams) mNestedScroll.getLayoutParams(); - params.setMargins(0, 0, 0,helperMethod.pxFromDp(60)*-1); - mNestedScroll.setLayoutParams(params); - - com.darkweb.genesissearchengine.constants.status.sFullScreenBrowsing = false; - initTopBarPadding(); - - this.mBlockerFullSceen.animate().setStartDelay(100).setDuration(200).alpha(0).withEndAction(() -> { - mBlockerFullSceen.setVisibility(View.GONE); - }); - }); - } - else { - mTopBar.setClickable(!pStatus); - disableEnableControls(!pStatus, mTopBar); - mTopBar.setAlpha(value); - mBannerAds.setVisibility(View.GONE); - - mProgressBar.setVisibility(View.VISIBLE); - mTopBar.setVisibility(View.VISIBLE); - mBannerAds.setVisibility(View.GONE); - mEvent.invokeObserver(Collections.singletonList(!isLandscape), enums.etype.on_init_ads); - - NestedScrollView.MarginLayoutParams params = (NestedScrollView.MarginLayoutParams) mNestedScroll.getLayoutParams(); - params.setMargins(0, 0, 0,0); - mNestedScroll.setLayoutParams(params); - - com.darkweb.genesissearchengine.constants.status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true)); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - if(status.sTheme == enums.Theme.THEME_DARK || status.sDefaultNightMode){ - mContext.getWindow().getDecorView().setSystemUiVisibility(0); - }else { - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - }else { - mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - } - - this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(0).withEndAction(() -> mBlockerFullSceen.setVisibility(View.GONE)); - mContext.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); - initTopBarPadding(); - - mIsTopBarExpanded = false; - mAppBar.setExpanded(true,false); - mAppBar.refreshDrawableState(); - mAppBar.invalidate(); - } - - } - - void onReDraw(){ - if(mWebviewContainer.getPaddingBottom()==0){ - mWebviewContainer.setPadding(0,0,0,1); - } - else { - mWebviewContainer.setPadding(0,0,0,0); - } - } - - void onSessionChanged(){ - } - - void onUpdateLogo(){ - - switch (status.sSettingSearchStatus) - { - } - } - - /*-------------------------------------------------------POST UI TASK HANDLER-------------------------------------------------------*/ - - private void startPostTask(int m_id) { - Message message = new Message(); - message.what = m_id; - mUpdateUIHandler.sendMessage(message); - } - - @SuppressLint("HandlerLeak") - private void createUpdateUiHandler(){ - mUpdateUIHandler = new Handler() - { - @Override - public void handleMessage(Message msg) - { - if(msg.what == messages.MESSAGE_ON_URL_LOAD) - { - if(mEvent.invokeObserver(null, enums.etype.M_HOME_PAGE)==null){ - mEvent.invokeObserver(null, enums.etype.M_PRELOAD_URL); - if(status.sSettingRedirectStatus.equals(strings.GENERIC_EMPTY_STR)){ - mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingSearchStatus)), enums.etype.on_url_load); - }else { - mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingRedirectStatus)), enums.etype.on_url_load); - } - } - if(!status.sExternalWebsite.equals(strings.GENERIC_EMPTY_STR) ){ - mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sExternalWebsite)), enums.etype.open_new_tab_instant); - } - - status.sSettingIsAppStarted = true; - } - if(msg.what == messages.MESSAGE_UPDATE_LOADING_TEXT) - { - if(mLogs !=null) - { - try - { - mLogs.call(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - } - if(msg.what == messages.MESSAGE_PROGRESSBAR_VALIDATE) - { - } - } - }; - } - - +package com.darkweb.genesissearchengine.appManager.homeManager.homeController; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; +import android.animation.PropertyValuesHolder; +import android.animation.ValueAnimator; +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.pm.ActivityInfo; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.graphics.Color; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable; +import android.graphics.drawable.InsetDrawable; +import android.graphics.drawable.StateListDrawable; +import android.os.Build; +import android.os.Handler; +import android.os.Message; +import android.text.method.MovementMethod; +import android.util.Log; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.view.inputmethod.InputMethodManager; +import android.widget.*; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.ColorUtils; +import androidx.core.widget.NestedScrollView; +import androidx.fragment.app.FragmentContainerView; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.constants.*; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.libs.views.ColorAnimator; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; +import com.google.android.gms.ads.AdView; +import com.google.android.material.appbar.AppBarLayout; +import org.mozilla.geckoview.GeckoView; +import org.torproject.android.proxy.wrapper.orbotLocalConstants; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.Callable; +import static android.content.Context.LAYOUT_INFLATER_SERVICE; +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_DOMAIN_URL; +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 org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; + +class homeViewController +{ + /*ViewControllers*/ + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + + /*ViewControllers*/ + private com.google.android.material.appbar.AppBarLayout mAppBar; + private ConstraintLayout mWebviewContainer; + private ProgressBar mProgressBar; + private editTextManager mSearchbar; + private ConstraintLayout mSplashScreen; + private TextView mLoadingText; + private AdView mBannerAds = null; + private Handler mUpdateUIHandler = null; + private ImageButton mGatewaySplash; + private LinearLayout mTopBar; + private GeckoView mGeckoView; + private Button mConnectButton; + private Button mNewTab; + private PopupWindow popupWindow = null; + private View mFindBar; + private View mSearchEngineBar; + private EditText mFindText; + private TextView mFindCount; + private ConstraintLayout mTopLayout; + private ImageButton mVoiceInput; + private ImageButton mMenu; + private ImageView mBlocker; + private ImageView mBlockerFullSceen; + private TextView mCopyright; + private ImageButton mOrbotLogManager; + private ConstraintLayout mInfoPortrait; + private ConstraintLayout mInfoLandscape; + private NestedScrollView mNestedScroll; + private ProgressBar mProgressBarIndeterminate; + private FragmentContainerView mTabFragment; + private LinearLayout mTopBarContainer; + private ImageView mSearchLock; + private View mPopupLoadNewTab; + private ImageView mTopBarHider; + private ImageView mNewTabBlocker; + private CoordinatorLayout mCoordinatorLayout; + private ImageView mImageDivider; + private ImageButton mPanicButton; + private ImageButton mPanicButtonLandscape; + private ImageView mGenesisLogo; + + /*Local Variables*/ + private Callable mLogs = null; + private boolean isLandscape = false; + private boolean isFullScreen = false; + private MovementMethod mSearchBarMovementMethod = null; + private Handler mTabDialogHandler = null; + private Runnable mTabDialogRunnable = null; + private boolean mIsTopBarExpanded = true; + + void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, View pPopupLoadNewTab, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo,ImageButton pPanicButtonLandscape){ + this.mContext = context; + this.mProgressBar = progressBar; + this.mSearchbar = searchbar; + this.mSplashScreen = splashScreen; + this.mLoadingText = loadingText; + this.mWebviewContainer = webviewContainer; + this.mBannerAds = banner_ads; + this.mEvent = event; + this.mGatewaySplash = gateway_splash; + this.mTopBar = top_bar; + this.mGeckoView = gecko_view; + this.mConnectButton = connect_button; + this.mNewTab = mNewTab; + this.popupWindow = null; + this.mFindBar = pFindBar; + this.mFindText = pFindText; + this.mFindCount = pFindCount; + this.mTopLayout = pTopLayout; + this.mVoiceInput = pVoiceInput; + this.mMenu = pMenu; + this.mBlocker = pBlocker; + this.mBlockerFullSceen = pBlockerFullSceen; + this.mSearchEngineBar = mSearchEngineBar; + this.mCopyright = pCopyright; + this.mAppBar = pAppBar; + this.mOrbotLogManager = pOrbotLogManager; + this.mInfoPortrait = pInfoPortrait; + this.mInfoLandscape = pInfoLandscape; + this.mNestedScroll = pNestedScroll; + this.mProgressBarIndeterminate = pProgressBarIndeterminate; + this.mTabFragment = pTabFragment; + this.mTopBarContainer = pTopBarContainer; + this.mSearchLock = pSearchLock; + this.mPopupLoadNewTab = pPopupLoadNewTab; + this.mTopBarHider = pTopBarHider; + this.mNewTabBlocker = pNewTabBlocker; + this.mCoordinatorLayout = mCoordinatorLayout; + this.mImageDivider = pImageDivider; + this.mPanicButton = pPanicButton; + this.mGenesisLogo = pGenesisLogo; + this.mPanicButtonLandscape = pPanicButtonLandscape; + + initSplashScreen(); + createUpdateUiHandler(); + recreateStatusBar(); + initTopBarPadding(); + initializeViews(); + } + + @SuppressLint("WrongConstant") + public void initializeViews(){ + mSearchbar.setTag(R.id.msearchbarProcessing,false); + mNestedScroll.setNestedScrollingEnabled(true); + this.mBlockerFullSceen.setVisibility(View.GONE); + mSearchBarMovementMethod = mSearchbar.getMovementMethod(); + mSearchbar.setMovementMethod(null); + mTopBarContainer.getLayoutTransition().setDuration(200); + + final Handler handler = new Handler(); + handler.postDelayed(() -> mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER), 1500); + + updateBannerAdvertStatus(false, false); + expandTopBar(false, 2000); + mBlockerFullSceen.setVisibility(View.GONE); + mNewTab.setPressed(true); + mNewTab.setPressed(false); + + + View child = mAppBar.getChildAt(0); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); + params.setScrollFlags(1); + mIsTopBarExpanded = false; + mAppBar.setExpanded(true,false); + mAppBar.refreshDrawableState(); + mAppBar.invalidate(); + + onClearSelections(false); + mGeckoView.requestFocus(); + + + mContext.runOnUiThread(() -> { + if(helperMethod.getScreenHeight(mContext)<1000){ + + ConstraintLayout.LayoutParams newLayoutParams1 = (ConstraintLayout.LayoutParams) mImageDivider.getLayoutParams(); + newLayoutParams1.bottomMargin = helperMethod.pxFromDp(200); + mImageDivider.setLayoutParams(newLayoutParams1); + + + ConstraintLayout.LayoutParams newLayoutParams = (ConstraintLayout.LayoutParams) mGenesisLogo.getLayoutParams(); + newLayoutParams.topMargin = helperMethod.pxFromDp(80); + mGenesisLogo.setLayoutParams(newLayoutParams); + } + }); + + } + + @SuppressLint("WrongConstant") + public void initTopBarPadding(){ + if(!status.sFullScreenBrowsing){ + int paddingDp = 110; + if(isFullScreen){ + paddingDp = 60; + }else { + if(mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){ + paddingDp = 0; + }else { + mGeckoView.setPadding(0,0,0,0); + View child = mAppBar.getChildAt(0); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); + params.setScrollFlags(0); + return; + } + } + float density = mContext.getResources().getDisplayMetrics().density; + int paddingPixel = (int)(paddingDp * density); + mGeckoView.setPadding(0,0,0,paddingPixel); + + View child = mAppBar.getChildAt(0); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); + params.setScrollFlags(0); + + }else { + int paddingDp = 0; + if(isFullScreen){ + paddingDp = 60; + } + float density = mContext.getResources().getDisplayMetrics().density; + int paddingPixel = (int)(paddingDp * density); + mGeckoView.setPadding(0,0,0,paddingPixel); + + View child = mAppBar.getChildAt(0); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); + params.setScrollFlags(1); + } + } + + public void initSplashOrientation(){ + if(isLandscape){ + this.mInfoPortrait.setVisibility(View.GONE); + this.mInfoLandscape.setVisibility(View.VISIBLE); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue_splash)); + }else { + this.mInfoPortrait.setVisibility(View.VISIBLE); + this.mInfoLandscape.setVisibility(View.GONE); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + } + + public void onShowLoadTabDialog() { + mPopupLoadNewTab.findViewById(R.id.pBlockerUndo).setVisibility(View.GONE); + mPopupLoadNewTab.animate().cancel(); + mPopupLoadNewTab.setAlpha(0); + mPopupLoadNewTab.setVisibility(View.VISIBLE); + mPopupLoadNewTab.animate().setStartDelay(400).setDuration(250).alpha(1); + + if(mTabDialogHandler!=null){ + mTabDialogHandler.removeCallbacksAndMessages(null); + } + + mTabDialogHandler = new Handler(); + mTabDialogRunnable = this::onHideLoadTabDialog; + mTabDialogHandler.postDelayed(mTabDialogRunnable, 3500); + } + + public void onHideLoadTabDialog() { + mPopupLoadNewTab.findViewById(R.id.pBlockerUndo).setVisibility(View.VISIBLE); + mPopupLoadNewTab.animate().cancel(); + + mPopupLoadNewTab.animate().setDuration(250).alpha(0).withEndAction(() -> { + mPopupLoadNewTab.setVisibility(View.GONE); + }); + } + + public void onShowTabContainer(){ + onHideLoadTabDialog(); + if(mTabFragment.getAlpha()==0 || mTabFragment.getAlpha()==1){ + + onUpdateStatusBarTheme(null, false); + mTabFragment.animate().cancel(); + mTabFragment.setAlpha(0); + mTabFragment.setVisibility(View.VISIBLE); + mTabFragment.animate().alpha(1).setStartDelay(100).setDuration(150).withEndAction(() -> mNewTab.setPressed(false)); + } + } + + public void onHideTabContainer(){ + onHideLoadTabDialog(); + if(mTabFragment.getAlpha()>0 || mTabFragment.getVisibility()!=View.GONE){ + Log.i("SUPERFUCK4","SUPERFUCK"); + mNewTab.setPressed(false); + new Handler().postDelayed(() -> + { + mTopBarHider.animate().alpha(0).setDuration(250).setStartDelay(0).withEndAction(() -> mTopBarHider.setVisibility(View.GONE)); + mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME); + }, 250); + + mTabFragment.animate().cancel(); + mTabFragment.animate().setDuration(100).alpha(0f).withEndAction(() -> { + mTabFragment.setVisibility(View.GONE); + mEvent.invokeObserver(null, enums.etype.M_UPDATE_PIXEL_BACKGROUND); + }); + } + } + + public int getSearchLogo(){ + switch (status.sSettingSearchStatus) { + case constants.CONST_BACKEND_GENESIS_URL: + return R.drawable.genesis; + case constants.CONST_BACKEND_GOOGLE_URL: + return R.drawable.google; + case constants.CONST_BACKEND_DUCK_DUCK_GO_URL: + return R.drawable.duckduckgo; + case constants.CONST_BACKEND_BING_URL: + return R.drawable.bing; + default: + return R.drawable.wikipedia; + } + } + + @SuppressLint("UseCompatLoadingForDrawables") + public void onUpdateSearchIcon(int mStatus){ + try { + if(mStatus==0){ + mSearchLock.setColorFilter(null); + mSearchLock.clearColorFilter(); + mSearchLock.setImageTintList(null); + + mSearchLock.setImageDrawable(mContext.getResources().getDrawable(getSearchLogo())); + } + else if(mStatus==1){ + if(!(boolean)mSearchLock.getTag(R.id.themed)){ + mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_lock_tint)); + mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_lock)); + }else { + mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_lock)); + } + } + else if(mStatus==2){ + mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_icon_tint)); + mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_browser)); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @SuppressLint("UseCompatLoadingForDrawables") + public void initSearchBarFocus(boolean pStatus, boolean mIsKeyboardOpened){ + if(!pStatus){ + this.mVoiceInput.animate().setDuration(0).alpha(0).withEndAction(() -> { + + mVoiceInput.setClickable(true); + mVoiceInput.setFocusable(true); + onUpdateSearchIcon(1); + mVoiceInput.setVisibility(View.GONE); + mNewTab.setVisibility(View.VISIBLE); + mMenu.setVisibility(View.VISIBLE); + mSearchbar.setFadingEdgeLength(helperMethod.pxFromDp(20)); + mSearchbar.setMovementMethod(null); + + if(status.sSettingLanguageRegion.equals("Ur")){ + mSearchbar.setPadding(helperMethod.pxFromDp(17),0,mSearchbar.getPaddingRight(),0); + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mSearchbar.getLayoutParams(); + params.leftMargin = helperMethod.pxFromDp(5); + }else { + mSearchbar.setPadding(mSearchbar.getPaddingLeft(),0,helperMethod.pxFromDp(5),0); + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mSearchbar.getLayoutParams(); + params.rightMargin = helperMethod.pxFromDp(10); + } + + }); + }else { + + onUpdateSearchIcon(0); + mSearchbar.setMovementMethod(mSearchBarMovementMethod); + mSearchbar.setFadingEdgeLength(helperMethod.pxFromDp(0)); + + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + Drawable drawable; + Resources res = mContext.getResources(); + try { + if(status.sSettingEnableVoiceInput){ + drawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_keyboard_voice)); + }else { + drawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_cancel)); + } + mVoiceInput.setImageDrawable(drawable); + } catch (Exception ex) { + ex.printStackTrace(); + } + if(status.sSettingIsAppStarted){ + mVoiceInput.setVisibility(View.VISIBLE); + } + mVoiceInput.setClickable(true); + mVoiceInput.setFocusable(true); + }, 0); + + mNewTab.setVisibility(View.GONE); + this.mMenu.setVisibility(View.GONE); + + if(status.sSettingLanguageRegion.equals("Ur")){ + mSearchbar.setPadding(helperMethod.pxFromDp(45),0,mSearchbar.getPaddingRight(),0); + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mSearchbar.getLayoutParams(); + params.leftMargin = helperMethod.pxFromDp(17); + }else { + mSearchbar.setPadding(mSearchbar.getPaddingLeft(),0,helperMethod.pxFromDp(45),0); + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mSearchbar.getLayoutParams(); + params.rightMargin = helperMethod.pxFromDp(17); + } + + if(!mIsKeyboardOpened){ + mSearchbar.requestFocus(); + InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.showSoftInput(mSearchbar, InputMethodManager.SHOW_IMPLICIT); + } + } + } + + void initTab(int count, boolean pForced, enums.etype pEvent, List pData){ + if(!pForced){ + ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mNewTab, + PropertyValuesHolder.ofFloat("scaleX", 1, 0.70f, 1), + PropertyValuesHolder.ofFloat("scaleY", 1, 0.70f, 1)); + scaleDown.setDuration(250); + scaleDown.start(); + + scaleDown.addListener(new Animator.AnimatorListener() { + + @Override + public void onAnimationStart(Animator arg0) { + } + + @Override + public void onAnimationRepeat(Animator arg0) { + } + + @Override + public void onAnimationEnd(Animator arg0) { + if(pEvent!=null){ + mEvent.invokeObserver(pData, pEvent); + } + } + + @Override + public void onAnimationCancel(Animator arg0) { + } + }); + } + + if(count==0){ + count=1; + } + mNewTab.setText((count+strings.GENERIC_EMPTY_STR)); + + } + + public void recreateStatusBar(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + } + } + + public void initStatusBarColor(boolean mInstant) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + ColorAnimator oneToTwo = new ColorAnimator(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2)); + + int mDelay = 500; + if(status.mThemeApplying || mInstant){ + mDelay = 0; + } + + ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f); + animator.setDuration(250).setStartDelay(mDelay); + animator.addUpdateListener(animation -> + { + float v = (float) animation.getAnimatedValue(); + mSplashScreen.setAlpha(1-v); + mContext.getWindow().setStatusBarColor(oneToTwo.with(v*1f)); + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + }); + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + }); + animator.addListener(new AnimatorListenerAdapter() + { + @Override + public void onAnimationEnd(Animator animation) + { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + }else { + View decorView = mContext.getWindow().getDecorView(); + decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + } + }); + animator.start(); + }else { + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + + } + + public void initSplashLoading(){ + + mLoadingText.setAlpha(0); + mLoadingText.setVisibility(View.VISIBLE); + mLoadingText.animate().setStartDelay(0).alpha(1); + + mProgressBarIndeterminate.setVisibility(View.VISIBLE); + mProgressBarIndeterminate.animate().alpha(1); + mConnectButton.setEnabled(false); + mSplashScreen.setEnabled(false); + mBlocker.setClickable(true); + mBlocker.setFocusable(true); + } + + void initHomePage(){ + mConnectButton.setEnabled(false); + mSplashScreen.setEnabled(false); + mOrbotLogManager.setEnabled(false); + mPanicButton.setEnabled(false); + mPanicButtonLandscape.setEnabled(false); + + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + mOrbotLogManager.setEnabled(true); + }, 700); + + mConnectButton.animate().setDuration(350).alpha(0.4f).withEndAction(() -> { + mCopyright.setVisibility(View.GONE); + initSplashLoading(); + }); + mGatewaySplash.animate().setDuration(350).alpha(0.4f); + mPanicButton.animate().setDuration(250).alpha(0f); + mPanicButtonLandscape.animate().setDuration(250).alpha(0f); + } + + private void initSplashScreen(){ + + mIsAnimating = false; + helperMethod.hideKeyboard(mContext); + mSearchLock.setTag(R.id.themed,false); + mAppBar.setTag(R.id.expandableBar,true); + + if(!status.mThemeApplying){ + mSearchbar.setEnabled(false); + }else { + mSearchbar.setEnabled(true); + } + + View root = mSearchbar.getRootView(); + root.setBackgroundColor(ContextCompat.getColor(mContext, R.color.c_background_keyboard)); + + + } + + void initProxyLoading(Callable logs){ + this.mLogs = logs; + + if(mSplashScreen.getVisibility()==View.VISIBLE){ + new Thread(){ + public void run(){ + AppCompatActivity temp_context = mContext; + while (!orbotLocalConstants.mIsTorInitialized || !orbotLocalConstants.mNetworkState){ + try + { + boolean mFastConnect = !status.sRestoreTabs && status.sAppInstalled && status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GENESIS_URL) && !status.sBridgeStatus; + if(mFastConnect){ + if(orbotLocalConstants.mNetworkState){ + sleep(1000); + orbotLocalConstants.mTorLogsStatus = "Starting Genesis | Please Wait ..."; + mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), enums.etype.recheck_orbot); + startPostTask(messages.MESSAGE_UPDATE_LOADING_TEXT); + break; + } + } + + sleep(1500); + if(mFastConnect){ + continue; + } + + mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), enums.etype.recheck_orbot); + if(temp_context.isDestroyed()){ + return; + } + startPostTask(messages.MESSAGE_UPDATE_LOADING_TEXT); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + if(!status.sSettingIsAppStarted){ + startPostTask(messages.MESSAGE_ON_URL_LOAD); + mContext.runOnUiThread(() -> { + splashScreenDisable(); + }); + }else { + mContext.runOnUiThread(() -> { + mEvent.invokeObserver(null, enums.etype.ON_LOAD_TAB_ON_RESUME); + }); + } + } + }.start(); + } + } + + /*-------------------------------------------------------PAGE UI Methods-------------------------------------------------------*/ + + void onPageFinished(){ + mSearchbar.setEnabled(true); + mProgressBar.bringToFront(); + mSplashScreen.bringToFront(); + splashScreenDisable(); + } + + public void splashScreenDisableInstant() { + mSplashScreen.setAlpha(0f); + mSplashScreen.setVisibility(View.GONE); + mSplashScreen.setVisibility(View.GONE); + mBlocker.setEnabled(false); + } +//C:\Users\MSi\AppData\Local\Android\ndk + private boolean mIsAnimating = false; + public void splashScreenDisable(){ + mTopBar.setAlpha(1); + + if(mSplashScreen.getAlpha()==1){ + if(!mIsAnimating){ + mIsAnimating = true; + triggerPostUI(2000); + mProgressBar.setVisibility(View.GONE); + mSplashScreen.animate().cancel(); + onClearSelections(false); + mGeckoView.requestFocus(); + mProgressBarIndeterminate.animate().cancel(); + mProgressBarIndeterminate.animate().setStartDelay(350).setDuration(250).alpha(0).withEndAction(() -> { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + initStatusBarColor(false); + } + + mSplashScreen.animate().setDuration(0).setStartDelay(1000).alpha(0).withEndAction(() -> { + mProgressBarIndeterminate.setVisibility(View.GONE); + mSplashScreen.setClickable(false); + mSplashScreen.setFocusable(false); + mSearchbar.setEnabled(true); + mBlocker.setEnabled(false); + + mBlocker.setVisibility(View.GONE); + mGatewaySplash.setVisibility(View.GONE); + mConnectButton.setVisibility(View.GONE); + mPanicButton.setVisibility(View.GONE); + mPanicButtonLandscape.setVisibility(View.GONE); + + mEvent.invokeObserver(null, enums.etype.M_CACHE_UPDATE_TAB); + mEvent.invokeObserver(null, enums.etype.M_SPLASH_DISABLE); + }); + }); + mEvent.invokeObserver(null, enums.etype.M_WELCOME_MESSAGE); + mOrbotLogManager.setClickable(false); + status.sSettingIsAppRestarting = true; + } + } + } + + public void onUpdateToolbarTheme(){ + mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); + } + + private void triggerPostUI(int pOffsetY){ + expandTopBar(false, pOffsetY); + if(mProgressBar.getProgress()>0 && mProgressBar.getProgress()<10000){ + mProgressBar.animate().setStartDelay(0).alpha(1); + } + } + + public void disableExpand(){ + View child = mAppBar.getChildAt(0); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); + params.setScrollFlags(0); + } + + @SuppressLint("WrongConstant") + private void enableCollapsing() { + if(mProgressBar.getProgress()==0 || mProgressBar.getProgress()==100){ + View child = mAppBar.getChildAt(0); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); + params.setScrollFlags(1); + } + } + public void expandTopBar(boolean pForced, int pOffsetY){ + + if(pOffsetY == -1){ + mAppBar.setExpanded(true,true); + disableExpand(); + }else { + enableCollapsing(); + } + + new Handler().postDelayed(() -> + { + mTopBarContainer.getLayoutTransition().setDuration(200); + Object mTag = mAppBar.getTag(R.id.expandableBar); + if(mIsTopBarExpanded && !pForced){ + return; + } + + + if(mTag!=null && (boolean) mTag){ + mAppBar.setExpanded(true,true); + mIsTopBarExpanded = true; + Log.i("wwwwww1","wwwwww"); + } + }, 0); + + } + + public void shrinkTopBar(boolean pForced, int pOffsetY){ + + if(pOffsetY == -1){ + mAppBar.setExpanded(true,true); + disableExpand(); + }else { + enableCollapsing(); + } + + mTopBarContainer.getLayoutTransition().setDuration(0); + new Handler().postDelayed(() -> + { + mTopBarContainer.getLayoutTransition().setDuration(200); + Object mTag = mAppBar.getTag(R.id.expandableBar); + + if(!mIsTopBarExpanded && !pForced){ + return; + } + + if(mTag!=null && (boolean) mTag){ + mIsTopBarExpanded = false; + mAppBar.setExpanded(false,true); + Log.i("wwwwww2","wwwwww"); + } + }, 0); + } + + /*-------------------------------------------------------Helper Methods-------------------------------------------------------*/ + + void onOpenMenu(View view, boolean canGoForward, boolean isLoading, int userAgent, String mURL){ + + if(popupWindow!=null){ + popupWindow.dismiss(); + } + + LayoutInflater layoutInflater + = (LayoutInflater) mContext + .getSystemService(LAYOUT_INFLATER_SERVICE); + @SuppressLint("InflateParams") final View popupView = layoutInflater.inflate(R.layout.popup_side_menu, null); + + + int height = helperMethod.getScreenHeight(mContext)*90 /100; + + popupWindow = new PopupWindow( + popupView, + ActionMenuView.LayoutParams.WRAP_CONTENT, + ActionMenuView.LayoutParams.WRAP_CONTENT, true); + + popupWindow.setOutsideTouchable(true); + popupWindow.setFocusable(true); + popupWindow.setBackgroundDrawable(new BitmapDrawable()); + View parent = view.getRootView(); + popupWindow.setAnimationStyle(R.style.popup_window_animation); + if(isLandscape){ + helperMethod.hideKeyboard(mContext); + popupWindow.setHeight(height); + } + + if(status.sSettingLanguageRegion.equals("Ur") || status.sSettingLanguage.equals("default") && status.mSystemLocale.getLanguage().equals("ur")){ + popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.START,0,0); + }else { + popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.END,0,0); + } + + ImageButton back = popupView.findViewById(R.id.menu22); + ImageButton close = popupView.findViewById(R.id.menu20); + ImageButton mRefresh = popupView.findViewById(R.id.menu21); + ImageButton mDownload = popupView.findViewById(R.id.menuItem25); + CheckBox desktop = popupView.findViewById(R.id.menu27); + LinearLayout newTab = popupView.findViewById(R.id.menu11); + desktop.setChecked(userAgent==USER_AGENT_MODE_DESKTOP); + + String mExtention = helperMethod.getMimeType(mURL, mContext); + if(mExtention == null || mExtention.equals("text/html") || mExtention.equals("application/vnd.ms-htmlhelp") || mExtention.equals("application/vnd.sun.xml.writer") || mExtention.equals("application/vnd.sun.xml.writer.global") || mExtention.equals("application/vnd.sun.xml.writer.template") || mExtention.equals("application/xhtml+xml")){ + mDownload.setEnabled(false); + mDownload.setColorFilter(Color.argb(255, 191, 191, 191)); + } + + if(!canGoForward){ + back.setEnabled(false); + back.setColorFilter(Color.argb(255, 191, 191, 191)); + } + if(!isLoading){ + close.setVisibility(View.GONE); + mRefresh.setVisibility(View.VISIBLE); + }else { + close.setVisibility(View.VISIBLE); + mRefresh.setVisibility(View.GONE); + } + + newTab.setClickable(false); + close.setClickable(false); + new Handler().postDelayed(() -> + { + newTab.setClickable(true); + close.setClickable(true); + }, 300); + + } + + void downloadNotification(String message, enums.etype e_type){ + + if(popupWindow!=null){ + popupWindow.dismiss(); + } + + LayoutInflater layoutInflater + = (LayoutInflater) mContext + .getSystemService(LAYOUT_INFLATER_SERVICE); + assert layoutInflater != null; + @SuppressLint("InflateParams") final View popupView = layoutInflater.inflate(R.layout.notification_menu, null); + popupWindow = new PopupWindow( + popupView, + ActionMenuView.LayoutParams.MATCH_PARENT, + ActionMenuView.LayoutParams.WRAP_CONTENT, true); + + popupWindow.setOutsideTouchable(true); + popupWindow.setFocusable(true); + popupWindow.setBackgroundDrawable(new BitmapDrawable()); + View parent = mGeckoView.getRootView(); + popupWindow.setAnimationStyle(R.style.popup_window_animation); + + + if(message.length()>30){ + message = message.substring(message.length()-20); + } + + TextView notification_message = popupView.findViewById(R.id.notification_message); + notification_message.setText(message); + + Button btn = popupView.findViewById(R.id.notification_event); + btn.setOnClickListener(v -> + { + mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), enums.etype.progress_update); + popupWindow.dismiss(); + }); + + popupWindow.showAtLocation(parent, Gravity.BOTTOM|Gravity.START,0,-10); + } + + void closeMenu(){ + if(popupWindow!=null){ + popupWindow.dismiss(); + } + } + + public void onMoveTopBar(int pPosition){ + } + + public void setOrientation(boolean status){ + isLandscape = status; + } + + void onSetBannerAdMargin(boolean status,boolean isAdLoaded){ + if(isAdLoaded){ + if(status && !isLandscape && !isFullScreen){ + mBannerAds.setVisibility(View.VISIBLE); + + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + mWebviewContainer.clearAnimation(); + mProgressBar.bringToFront(); + }, 250); + }else{ + mBannerAds.setVisibility(View.GONE); + } + } + } + + void updateBannerAdvertStatus(boolean status, boolean pIsAdvertLoaded){ + if(status && pIsAdvertLoaded){ + if(mBannerAds.getAlpha()==0){ + mBannerAds.animate().cancel(); + mBannerAds.setAlpha(0); + mBannerAds.animate().alpha(1); + mBannerAds.setVisibility(View.VISIBLE); + } + onSetBannerAdMargin(true,true); + }else{ + if(mBannerAds.getAlpha()==1){ + mBannerAds.animate().cancel(); + mBannerAds.animate().alpha(0).withEndAction(() -> mBannerAds.setVisibility(View.GONE)); + } + onSetBannerAdMargin(false,true); + } + } + + private Handler searchBarUpdateHandler = new Handler(); + private String handlerLocalUrl = ""; + void onUpdateSearchBar(String url,boolean showProtocol, boolean pClearText, boolean pBypassFocus){ + if(url.startsWith(CONST_GENESIS_URL_CACHED) || url.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ + mSearchbar.setTag(R.id.msearchbarProcessing,true); + url = CONST_GENESIS_DOMAIN_URL; + } + + + Log.i("FUCK::5",url); + if(!mSearchbar.hasFocus() || pClearText || pBypassFocus){ + if(mSearchEngineBar.getVisibility() == View.GONE || pBypassFocus){ + int delay = 0; + handlerLocalUrl = url; + + if(searchBarUpdateHandler.hasMessages(100)){ + searchBarUpdateHandler.removeMessages(100); + } + + searchBarUpdateHandler.sendEmptyMessage(100); + searchBarUpdateHandler.removeMessages(100); + triggerUpdateSearchBar(handlerLocalUrl,showProtocol, pClearText); + mSearchbar.setTag(R.id.msearchbarProcessing,false); + } + } + } + + public void onUpdateFindBarCount(int index, int total) + { + if(total==0){ + mFindCount.setText("0/0"); + mFindCount.setTextColor(ContextCompat.getColor(mContext, R.color.dark_red_soft)); + }else { + mFindCount.setText((total + "/" + index)); + mFindCount.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v6)); + } + } + + public void onUpdateStatusBarTheme(String pTheme, boolean mForced) + { + if(mSplashScreen.getAlpha()<=0 && (status.sTheme != enums.Theme.THEME_DARK && mTabFragment.getAlpha()<=0 || mForced)){ + if(status.sDefaultNightMode && status.sTheme == enums.Theme.THEME_DEFAULT){ + return; + } + int mColor; + try{ + mColor = Color.parseColor(pTheme); + }catch (Exception ex){ + mColor = -1; + } + + if(!mSearchbar.isFocused() && pTheme!=null && status.sToolbarTheme && mColor!=-1 && helperMethod.getColorDensity(mColor)<0.80 && status.sTheme != enums.Theme.THEME_DARK){ + mTopBar.setBackgroundColor(mColor); + mSearchbar.setTextColor(helperMethod.invertedGrayColor(mColor)); + mSearchbar.setHintTextColor(helperMethod.invertedGrayColor(mColor)); + mNewTab.setTextColor(helperMethod.invertedGrayColor(mColor)); + + GradientDrawable mGradientDrawable = new GradientDrawable(); + mGradientDrawable.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.90f), Color.BLACK, 0.2f)); + mGradientDrawable.setCornerRadius(helperMethod.pxFromDp(7)); + + GradientDrawable gradientDrawable1 = new GradientDrawable(); + gradientDrawable1.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.50f), Color.BLACK, 0.2f)); + gradientDrawable1.setCornerRadius(helperMethod.pxFromDp(4)); + + GradientDrawable gradientDrawable3 = new GradientDrawable(); + gradientDrawable3.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.50f), Color.BLACK, 0.2f)); + gradientDrawable3.setCornerRadius(helperMethod.pxFromDp(4)); + gradientDrawable3.setStroke(helperMethod.pxFromDp(2), helperMethod.invertedGrayColor(mColor)); + + GradientDrawable gradientDrawable2 = new GradientDrawable(); + gradientDrawable2.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.90f), Color.BLACK, 0.2f)); + gradientDrawable2.setCornerRadius(helperMethod.pxFromDp(4)); + gradientDrawable2.setStroke(helperMethod.pxFromDp(2), helperMethod.invertedGrayColor(mColor)); + + StateListDrawable states = new StateListDrawable(); + InsetDrawable mInsetDrawable1 = new InsetDrawable(gradientDrawable3, helperMethod.pxFromDp(8), helperMethod.pxFromDp(8), helperMethod.pxFromDp(8), helperMethod.pxFromDp(8)); + InsetDrawable mInsetDrawable2 = new InsetDrawable(gradientDrawable2, helperMethod.pxFromDp(8), helperMethod.pxFromDp(8), helperMethod.pxFromDp(8), helperMethod.pxFromDp(8)); + + states.addState(new int[] {android.R.attr.state_pressed}, mInsetDrawable1); + states.addState(new int[] { }, mInsetDrawable2); + + mNewTab.setBackground(states); + + mMenu.setColorFilter(helperMethod.invertedGrayColor(mColor)); + mVoiceInput.setColorFilter(helperMethod.invertedGrayColor(mColor)); + mVoiceInput.setBackground(mGradientDrawable); + mSearchLock.setColorFilter(helperMethod.invertedGrayColor(mColor)); + mSearchLock.setTag(R.id.themed,true); + gradientDrawable1.setCornerRadius(helperMethod.pxFromDp(7)); + gradientDrawable1.setStroke(helperMethod.pxFromDp(2), mColor); + gradientDrawable1.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.90f), Color.BLACK, 0.2f)); + mSearchbar.setBackground(gradientDrawable1); + mSearchbar.setHintTextColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.10f), Color.BLACK, 0.2f)); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + mContext.getWindow().setStatusBarColor(Color.parseColor(pTheme)); + }else { + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + + if(helperMethod.isColorDark(mColor)){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + }else { + View decorView = mContext.getWindow().getDecorView(); //set status background black + decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mTopBarHider.setBackgroundColor(mColor); + } + else{ + mSearchLock.setTag(R.id.themed,false); + mTopBar.setBackground(ContextCompat.getDrawable(mContext, R.color.c_background)); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + }else { + mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + + GradientDrawable gradientDrawable1 = new GradientDrawable(); + gradientDrawable1.setColor(ContextCompat.getColor(mContext, R.color.c_edittext_background)); + gradientDrawable1.setCornerRadius(helperMethod.pxFromDp(7)); + gradientDrawable1.setStroke(helperMethod.pxFromDp(2), ContextCompat.getColor(mContext, R.color.c_edittext_background)); + mSearchbar.setBackground(gradientDrawable1); + + Drawable drawable; + Resources res = mContext.getResources(); + try { + drawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_generic_tab_button)); + mNewTab.setBackground(drawable); + + Drawable drawableTemp = Drawable.createFromXml(res, res.getXml(R.xml.gx_generic_input)); + mVoiceInput.setBackground(drawableTemp); + } catch (Exception ex) { + ex.printStackTrace(); + } + + mNewTab.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1)); + mMenu.setColorFilter(ContextCompat.getColor(mContext, R.color.c_navigation_tint)); + mVoiceInput.setColorFilter(ContextCompat.getColor(mContext, R.color.c_text_v8)); + mSearchbar.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1)); + mSearchbar.setHintTextColor(ContextCompat.getColor(mContext, R.color.c_text_v2)); + + if(!mSearchbar.isFocused()){ + onUpdateSearchIcon(1); + } + + if(status.sTheme != enums.Theme.THEME_DARK || (status.sDefaultNightMode && status.sTheme != enums.Theme.THEME_DEFAULT)){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + }else { + View decorView = mContext.getWindow().getDecorView(); + decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + + mTopBarHider.setBackground(ContextCompat.getDrawable(mContext, R.color.c_background)); + } + } + } + + public void onUpdateFindBar(boolean pStatus) + { + mFindBar.animate().cancel(); + if(pStatus){ + mFindBar.setVisibility(View.VISIBLE); + mFindBar.setAlpha(0); + mFindBar.animate().setDuration(200).alpha(1); + mFindText.requestFocus(); + mFindCount.setText("0/0"); + mFindCount.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v6)); + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT,0); + }, 300); + }else { + mFindText.clearFocus(); + helperMethod.hideKeyboard(mContext); + mFindBar.animate().setDuration(200).alpha(0).withEndAction(() -> { + mFindCount.setText(strings.GENERIC_EMPTY_STR); + mFindText.setText(strings.GENERIC_EMPTY_STR); + mFindBar.setVisibility(View.GONE); + }); + } + } + + @SuppressLint("WrongConstant") + public void onUpdateSearchEngineBar(boolean pStatus, int delay) + { + if(pStatus){ + if(mSearchEngineBar.getAlpha() == 0 || mSearchEngineBar.getVisibility() == View.GONE && mSplashScreen.getAlpha()<=0){ + mSearchEngineBar.animate().cancel(); + mSearchEngineBar.setAlpha(0f); + mSearchEngineBar.animate().setDuration(delay).alpha(1); + mSearchEngineBar.setVisibility(View.VISIBLE); + onUpdateStatusBarTheme(null, false); + + View child = mAppBar.getChildAt(0); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); + params.setScrollFlags(0); + } + }else { + View child = mAppBar.getChildAt(0); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); + params.setScrollFlags(1); + mAppBar.refreshDrawableState(); + mAppBar.invalidate(); + + mSearchEngineBar.animate().setDuration(delay).alpha(0).withEndAction(() -> { + mSearchEngineBar.animate().cancel(); + mSearchEngineBar.setAlpha(0f); + mSearchEngineBar.setVisibility(View.GONE); + mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME); + mEvent.invokeObserver(null, enums.etype.M_RESET_SUGGESTION); + }); + } + + } + + private void triggerUpdateSearchBar(String url, boolean showProtocol, boolean pClearText){ + if (mSearchbar == null || url==null) + { + return; + } + + if(!showProtocol){ + url=url.replace("https://",""); + url=url.replace("http://",""); + } + + url = url.replace("genesishiddentechnologies.com","genesis.onion"); + boolean isTextSelected = false; + + if(mSearchbar.isSelected()){ + isTextSelected = true; + } + + + if(url.length()<=300){ + url = removeEndingSlash(url); + mSearchbar.setText(helperMethod.urlDesigner(url, mContext, mSearchbar.getCurrentTextColor(), status.sTheme)); + mSearchbar.selectAll(); + + if(isTextSelected){ + mSearchbar.selectAll(); + } + + mSearchbar.setSelection(0); + }else { + url = removeEndingSlash(url); + mSearchbar.setText(url); + } + + if(mSearchbar.isFocused()){ + mSearchbar.setSelection(mSearchbar.getText().length()); + mSearchbar.selectAll(); + } + + if(mSearchbar.getText().toString().equals("loading")){ + mSearchbar.setText("about:blank"); + } + } + + private String removeEndingSlash(String url){ + return helperMethod.removeLastSlash(url); + } + + void onNewTab(){ + if(!mSearchbar.isFocused()){ + mSearchbar.requestFocus(); + mSearchbar.selectAll(); + } + } + + void onUpdateLogs(String log){ + mLoadingText.setText(log); + } + + void progressBarReset(){ + mProgressBar.setProgress(5); + mProgressBar.setVisibility(View.INVISIBLE); + } + + public void onFirstPaint(){ + mGeckoView.setForeground(ContextCompat.getDrawable(mContext, R.color.clear_alpha)); + } + + public void onSessionReinit(){ + mGeckoView.setForeground(ContextCompat.getDrawable(mContext, R.color.c_background)); + } + + void onProgressBarUpdate(int value, boolean mForced){ + + if(value != 0 && value != 100){ + mAppBar.setExpanded(true,true); + status.sDisableExpandTemp = true; + }else { + status.sDisableExpandTemp = false; + } + + if(mProgressBar.getProgress() == value || mProgressBar.getProgress() == 0 && value == 100){ + return; + } + + if(progressAnimator!=null){ + progressAnimator.cancel(); + } + + if(mSearchbar.getText().toString().equals("genesis.onion") && !mForced || (boolean)mSearchbar.getTag(R.id.msearchbarProcessing)){ + mProgressBar.setProgress(0); + mProgressBar.setVisibility(View.GONE); + return; + } + + mProgressBar.setVisibility(View.VISIBLE); + mProgressBar.setAlpha(1); + mProgressBar.animate().cancel(); + + if(value != mProgressBar.getProgress()){ + if(value<=5 && value>0){ + setProgressAnimate(5,70); + }else { + setProgressAnimate(value,200); + } + if(value >= 100 || value<=0){ + mProgressBar.animate().alpha(0).setStartDelay(200).withEndAction(() -> { + status.sDisableExpandTemp = false; + mProgressBar.setProgress(0); + enableCollapsing(); + }); + } + } + + } + + ObjectAnimator progressAnimator = null; + private void setProgressAnimate(int pValue, int pSpeed) + { + progressAnimator = ObjectAnimator.ofInt(mProgressBar, "progress", pValue); + progressAnimator.setDuration(pSpeed); + progressAnimator.start(); + } + + public void onNewTabAnimation(List data, Object e_type){ + mGeckoView.setPivotX(0); + mGeckoView.setPivotY(0); + + ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mGeckoView, + PropertyValuesHolder.ofFloat("scaleX", 1, 0.8f), + PropertyValuesHolder.ofFloat("scaleY", 1, 0.8f)); + + mNewTabBlocker.setVisibility(View.VISIBLE); + ObjectAnimator alpha = ObjectAnimator.ofPropertyValuesHolder(mNewTabBlocker, + PropertyValuesHolder.ofFloat("alpha", 0, 1f)); + + scaleDown.setDuration(150); + alpha.setDuration(150); + + scaleDown.start(); + alpha.start(); + + scaleDown.addListener(new Animator.AnimatorListener() { + @Override + public void onAnimationStart(Animator animation, boolean isReverse) { + } + + @Override + public void onAnimationEnd(Animator animation, boolean isReverse) { + mEvent.invokeObserver(data, e_type); + ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mGeckoView, + PropertyValuesHolder.ofFloat("scaleX", 0.8f, 1f), + PropertyValuesHolder.ofFloat("scaleY", 0.8f, 1f)); + + scaleDown.setDuration(150); + scaleDown.setStartDelay(0); + mNewTabBlocker.animate().setStartDelay(250).setDuration(150).alpha(0f).withEndAction(() -> { + mNewTabBlocker.setVisibility(View.GONE); + }); + scaleDown.start(); + } + + @Override + public void onAnimationStart(Animator animation) { + } + + @Override + public void onAnimationEnd(Animator animation) { + mEvent.invokeObserver(data, e_type); + ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mGeckoView, + PropertyValuesHolder.ofFloat("scaleX", 0.8f, 1f), + PropertyValuesHolder.ofFloat("scaleY", 0.8f, 1f)); + + scaleDown.setDuration(150); + scaleDown.setStartDelay(0); + mNewTabBlocker.animate().setStartDelay(250).setDuration(150).alpha(0f).withEndAction(() -> { + mNewTabBlocker.setVisibility(View.GONE); + }); + scaleDown.start(); + } + + @Override + public void onAnimationCancel(Animator animation) { + + } + + @Override + public void onAnimationRepeat(Animator animation) { + } + }); + } + + void onClearSelections(boolean hideKeyboard){ + mSearchbar.setFocusable(false); + mSearchbar.setFocusableInTouchMode(true); + mSearchbar.setFocusable(true); + if(hideKeyboard){ + helperMethod.hideKeyboard(mContext); + } + } + + private void disableEnableControls(boolean enable, ViewGroup vg){ + vg.setEnabled(enable); // the point that I was missing + for (int i = 0; i < vg.getChildCount(); i++){ + View child = vg.getChildAt(i); + child.setEnabled(enable); + child.setClickable(enable); + if (child instanceof ViewGroup){ + disableEnableControls(enable, (ViewGroup)child); + } + } + } + + private int defaultFlag = 0; + void onFullScreenUpdate(boolean pStatus){ + int value = !pStatus ? 1 : 0; + + if(pStatus) { + isFullScreen = true; + }else { + this.mBlockerFullSceen.setVisibility(View.VISIBLE); + this.mBlockerFullSceen.setAlpha(1f); + isFullScreen = false; + } + + if(pStatus){ + onProgressBarUpdate(100, false); + this.mBlockerFullSceen.setVisibility(View.VISIBLE); + this.mBlockerFullSceen.setAlpha(0f); + this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(1).withEndAction(() -> { + mTopBar.setClickable(!pStatus); + disableEnableControls(!pStatus, mTopBar); + mTopBar.setAlpha(value); + mBannerAds.setVisibility(View.GONE); + + defaultFlag = mContext.getWindow().getDecorView().getSystemUiVisibility(); + final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; + mContext.getWindow().getDecorView().setSystemUiVisibility(flags); + mContext.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); + + mProgressBar.setVisibility(View.GONE); + mTopBar.setVisibility(View.GONE); + mBannerAds.setVisibility(View.GONE); + + NestedScrollView.MarginLayoutParams params = (NestedScrollView.MarginLayoutParams) mNestedScroll.getLayoutParams(); + params.setMargins(0, 0, 0,helperMethod.pxFromDp(60)*-1); + mNestedScroll.setLayoutParams(params); + + com.darkweb.genesissearchengine.constants.status.sFullScreenBrowsing = false; + initTopBarPadding(); + + this.mBlockerFullSceen.animate().setStartDelay(100).setDuration(200).alpha(0).withEndAction(() -> { + mBlockerFullSceen.setVisibility(View.GONE); + }); + }); + } + else { + mTopBar.setClickable(!pStatus); + disableEnableControls(!pStatus, mTopBar); + mTopBar.setAlpha(value); + mBannerAds.setVisibility(View.GONE); + + mProgressBar.setVisibility(View.VISIBLE); + mTopBar.setVisibility(View.VISIBLE); + mBannerAds.setVisibility(View.GONE); + mEvent.invokeObserver(Collections.singletonList(!isLandscape), enums.etype.on_init_ads); + + NestedScrollView.MarginLayoutParams params = (NestedScrollView.MarginLayoutParams) mNestedScroll.getLayoutParams(); + params.setMargins(0, 0, 0,0); + mNestedScroll.setLayoutParams(params); + + com.darkweb.genesissearchengine.constants.status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true)); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if(status.sTheme == enums.Theme.THEME_DARK || status.sDefaultNightMode){ + mContext.getWindow().getDecorView().setSystemUiVisibility(0); + }else { + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + }else { + mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + } + + this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(0).withEndAction(() -> mBlockerFullSceen.setVisibility(View.GONE)); + mContext.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + initTopBarPadding(); + + mIsTopBarExpanded = false; + mAppBar.setExpanded(true,false); + mAppBar.refreshDrawableState(); + mAppBar.invalidate(); + } + + } + + void onReDraw(){ + if(mWebviewContainer.getPaddingBottom()==0){ + mWebviewContainer.setPadding(0,0,0,1); + } + else { + mWebviewContainer.setPadding(0,0,0,0); + } + } + + void onSessionChanged(){ + } + + void onUpdateLogo(){ + + switch (status.sSettingSearchStatus) + { + } + } + + /*-------------------------------------------------------POST UI TASK HANDLER-------------------------------------------------------*/ + + private void startPostTask(int m_id) { + Message message = new Message(); + message.what = m_id; + mUpdateUIHandler.sendMessage(message); + } + + @SuppressLint("HandlerLeak") + private void createUpdateUiHandler(){ + mUpdateUIHandler = new Handler() + { + @Override + public void handleMessage(Message msg) + { + if(msg.what == messages.MESSAGE_ON_URL_LOAD) + { + if(mEvent.invokeObserver(null, enums.etype.M_HOME_PAGE)==null){ + mEvent.invokeObserver(null, enums.etype.M_PRELOAD_URL); + if(status.sSettingRedirectStatus.equals(strings.GENERIC_EMPTY_STR)){ + mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingSearchStatus)), enums.etype.on_url_load); + }else { + mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingRedirectStatus)), enums.etype.on_url_load); + } + } + if(!status.sExternalWebsite.equals(strings.GENERIC_EMPTY_STR) ){ + mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sExternalWebsite)), enums.etype.open_new_tab_instant); + } + + status.sSettingIsAppStarted = true; + } + if(msg.what == messages.MESSAGE_UPDATE_LOADING_TEXT) + { + if(mLogs !=null) + { + try + { + mLogs.call(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + if(msg.what == messages.MESSAGE_PROGRESSBAR_VALIDATE) + { + } + } + }; + } + + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/kotlinHelperLibraries/BrowserIconManager.kt b/app/src/main/java/com/darkweb/genesissearchengine/appManager/kotlinHelperLibraries/BrowserIconManager.kt index 8bbf27c1..8d79e845 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/kotlinHelperLibraries/BrowserIconManager.kt +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/kotlinHelperLibraries/BrowserIconManager.kt @@ -1,25 +1,25 @@ -package com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries - -import android.content.Context -import android.widget.ImageView -import mozilla.components.browser.engine.gecko.fetch.GeckoViewFetchClient -import mozilla.components.browser.icons.BrowserIcons -import mozilla.components.browser.icons.IconRequest -import mozilla.components.browser.icons.generator.DefaultIconGenerator -import org.mozilla.geckoview.GeckoRuntime -import java.util.concurrent.TimeUnit - -class BrowserIconManager { - - fun onLoadIconIntoView(mContext: Context, mRuntime: GeckoRuntime, mView:ImageView, pURL:String) : BrowserIcons { - val fetchClient = GeckoViewFetchClient(mContext,mRuntime, Pair(10L, TimeUnit.MINUTES)) - val mIcons = BrowserIcons(mContext, httpClient = fetchClient, generator = DefaultIconGenerator()) - mIcons.loadIntoView(mView,IconRequest(pURL)) - return mIcons - } - - fun onLoadIcon(mContext: Context, mRuntime: GeckoRuntime) { - val fetchClient = GeckoViewFetchClient(mContext,mRuntime, Pair(10L, TimeUnit.MINUTES)) - BrowserIcons(mContext, httpClient = fetchClient, generator = DefaultIconGenerator()) - } +package com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries + +import android.content.Context +import android.widget.ImageView +import mozilla.components.browser.engine.gecko.fetch.GeckoViewFetchClient +import mozilla.components.browser.icons.BrowserIcons +import mozilla.components.browser.icons.IconRequest +import mozilla.components.browser.icons.generator.DefaultIconGenerator +import org.mozilla.geckoview.GeckoRuntime +import java.util.concurrent.TimeUnit + +class BrowserIconManager { + + fun onLoadIconIntoView(mContext: Context, mRuntime: GeckoRuntime, mView:ImageView, pURL:String) : BrowserIcons { + val fetchClient = GeckoViewFetchClient(mContext,mRuntime, Pair(10L, TimeUnit.MINUTES)) + val mIcons = BrowserIcons(mContext, httpClient = fetchClient, generator = DefaultIconGenerator()) + mIcons.loadIntoView(mView,IconRequest(pURL)) + return mIcons + } + + fun onLoadIcon(mContext: Context, mRuntime: GeckoRuntime) { + val fetchClient = GeckoViewFetchClient(mContext,mRuntime, Pair(10L, TimeUnit.MINUTES)) + BrowserIcons(mContext, httpClient = fetchClient, generator = DefaultIconGenerator()) + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java index d41980fa..fd9c1f7e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java @@ -1,151 +1,151 @@ -package com.darkweb.genesissearchengine.appManager.languageManager; - -import android.content.Context; -import android.content.res.Resources; -import android.graphics.drawable.Drawable; -import android.os.Handler; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; -import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; -import java.util.ArrayList; -import java.util.Arrays; -import static com.darkweb.genesissearchengine.appManager.languageManager.languageEnums.eLanguageAdapterCallback.*; -import static com.darkweb.genesissearchengine.constants.constants.CONST_LANGUAGE_DEFAULT_LANG; -import static com.darkweb.genesissearchengine.constants.strings.LANGUAGE_NOT_SUPPORTED; - -public class languageAdapter extends RecyclerView.Adapter{ - - /*Private Variables*/ - - private ArrayList mModelList; - private Context mContext; - - /*Private Local Variables*/ - - private String mCurrentLanguage; - private eventObserver.eventListener mEvent; - private int mCurrentIndex = 0; - private boolean mClickable = false; - - public languageAdapter(ArrayList pModelList, Context pContext, String pCurrentLanguage, eventObserver.eventListener pEvent) { - this.mModelList = pModelList; - this.mContext = pContext; - this.mEvent = pEvent; - this.mCurrentLanguage = pCurrentLanguage; - } - - @NonNull - @Override - public helpViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.lang_row_view, parent, false); - return new helpViewHolder(v); - } - - @Override - public void onBindViewHolder(@NonNull helpViewHolder holder, int position) { - holder.bindListView(mModelList.get(position)); - } - - @Override - public int getItemCount() { - return mModelList.size(); - } - - class helpViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { - TextView mHeader; - TextView mDescription; - LinearLayout mContainer; - ImageView mMarker; - - helpViewHolder(View itemView) { - super(itemView); - } - - void bindListView(languageDataModel model) { - boolean mIsDefaultSupported = true; - mHeader = itemView.findViewById(R.id.pHeader); - mDescription = itemView.findViewById(R.id.pDescription); - mContainer = itemView.findViewById(R.id.pContainer); - mMarker = itemView.findViewById(R.id.pMarker); - - mHeader.setText(model.getHeader()); - mContainer.setTag(R.id.LaguageID,model.getTag()); - mContainer.setTag(R.id.LaguageRegion,model.getCountry()); - - if(model.getTag().equals(CONST_LANGUAGE_DEFAULT_LANG) && status.sSettingLanguage.equals(CONST_LANGUAGE_DEFAULT_LANG)){ - mDescription.setText((String)mEvent.invokeObserver(null, M_SYSTEM_LANGUAGE_SUPPORT_INFO)); - if(mDescription.getText().toString().endsWith(LANGUAGE_NOT_SUPPORTED)){ - mIsDefaultSupported = false; - } - }else { - mDescription.setText(model.getDescription()); - } - - if(mContainer.getTag(R.id.LaguageID).toString().equals(mCurrentLanguage)){ - Drawable mDrawable; - Resources res = mContext.getResources(); - try { - mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_border_left)); - mContainer.setBackground(mDrawable); - mHeader.setTextColor(ContextCompat.getColor(mContext, R.color.white)); - mDescription.setTextColor(ContextCompat.getColor(mContext, R.color.white_darker)); - mMarker.setVisibility(View.VISIBLE); - mCurrentIndex = getLayoutPosition(); - if(!mIsDefaultSupported){ - mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_cross)); - mMarker.setImageDrawable(mDrawable); - }else { - mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_done)); - mMarker.setImageDrawable(mDrawable); - } - } catch (Exception ignored) { - } - }else { - Drawable mDrawable; - Resources res = mContext.getResources(); - try { - mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_ripple_gray)); - mContainer.setBackground(mDrawable); - mHeader.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1)); - mDescription.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v6)); - mMarker.setVisibility(View.GONE); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - mContainer.setOnClickListener(this); - } - - @Override - public void onClick(View v) { - if(v.getId() == R.id.pContainer){ - boolean mSupportedStatus = (boolean)mEvent.invokeObserver(Arrays.asList(v.getTag(R.id.LaguageID).toString(), v.getTag(R.id.LaguageRegion).toString()),M_UPDATE_LANGUAGE); - if(mCurrentIndex!=getLayoutPosition() && mSupportedStatus){ - if(!mClickable){ - mClickable = true; - mEvent.invokeObserver(null,M_ENABLE_VIEW_CLICK); - // notifyItemChanged(mCurrentIndex); - mCurrentLanguage = v.getTag(R.id.LaguageID).toString(); - mCurrentIndex = getLayoutPosition(); - // notifyItemChanged(mCurrentIndex); - - final Handler handler = new Handler(); - handler.postDelayed(() -> { - mClickable = false; - mEvent.invokeObserver(null,M_DISABLE_VIEW_CLICK); - }, 100); - } - } - } - } - } -} +package com.darkweb.genesissearchengine.appManager.languageManager; + +import android.content.Context; +import android.content.res.Resources; +import android.graphics.drawable.Drawable; +import android.os.Handler; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; +import java.util.ArrayList; +import java.util.Arrays; +import static com.darkweb.genesissearchengine.appManager.languageManager.languageEnums.eLanguageAdapterCallback.*; +import static com.darkweb.genesissearchengine.constants.constants.CONST_LANGUAGE_DEFAULT_LANG; +import static com.darkweb.genesissearchengine.constants.strings.LANGUAGE_NOT_SUPPORTED; + +public class languageAdapter extends RecyclerView.Adapter{ + + /*Private Variables*/ + + private ArrayList mModelList; + private Context mContext; + + /*Private Local Variables*/ + + private String mCurrentLanguage; + private eventObserver.eventListener mEvent; + private int mCurrentIndex = 0; + private boolean mClickable = false; + + public languageAdapter(ArrayList pModelList, Context pContext, String pCurrentLanguage, eventObserver.eventListener pEvent) { + this.mModelList = pModelList; + this.mContext = pContext; + this.mEvent = pEvent; + this.mCurrentLanguage = pCurrentLanguage; + } + + @NonNull + @Override + public helpViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.lang_row_view, parent, false); + return new helpViewHolder(v); + } + + @Override + public void onBindViewHolder(@NonNull helpViewHolder holder, int position) { + holder.bindListView(mModelList.get(position)); + } + + @Override + public int getItemCount() { + return mModelList.size(); + } + + class helpViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { + TextView mHeader; + TextView mDescription; + LinearLayout mContainer; + ImageView mMarker; + + helpViewHolder(View itemView) { + super(itemView); + } + + void bindListView(languageDataModel model) { + boolean mIsDefaultSupported = true; + mHeader = itemView.findViewById(R.id.pHeader); + mDescription = itemView.findViewById(R.id.pDescription); + mContainer = itemView.findViewById(R.id.pContainer); + mMarker = itemView.findViewById(R.id.pMarker); + + mHeader.setText(model.getHeader()); + mContainer.setTag(R.id.LaguageID,model.getTag()); + mContainer.setTag(R.id.LaguageRegion,model.getCountry()); + + if(model.getTag().equals(CONST_LANGUAGE_DEFAULT_LANG) && status.sSettingLanguage.equals(CONST_LANGUAGE_DEFAULT_LANG)){ + mDescription.setText((String)mEvent.invokeObserver(null, M_SYSTEM_LANGUAGE_SUPPORT_INFO)); + if(mDescription.getText().toString().endsWith(LANGUAGE_NOT_SUPPORTED)){ + mIsDefaultSupported = false; + } + }else { + mDescription.setText(model.getDescription()); + } + + if(mContainer.getTag(R.id.LaguageID).toString().equals(mCurrentLanguage)){ + Drawable mDrawable; + Resources res = mContext.getResources(); + try { + mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_border_left)); + mContainer.setBackground(mDrawable); + mHeader.setTextColor(ContextCompat.getColor(mContext, R.color.white)); + mDescription.setTextColor(ContextCompat.getColor(mContext, R.color.white_darker)); + mMarker.setVisibility(View.VISIBLE); + mCurrentIndex = getLayoutPosition(); + if(!mIsDefaultSupported){ + mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_cross)); + mMarker.setImageDrawable(mDrawable); + }else { + mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_done)); + mMarker.setImageDrawable(mDrawable); + } + } catch (Exception ignored) { + } + }else { + Drawable mDrawable; + Resources res = mContext.getResources(); + try { + mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_ripple_gray)); + mContainer.setBackground(mDrawable); + mHeader.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1)); + mDescription.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v6)); + mMarker.setVisibility(View.GONE); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + mContainer.setOnClickListener(this); + } + + @Override + public void onClick(View v) { + if(v.getId() == R.id.pContainer){ + boolean mSupportedStatus = (boolean)mEvent.invokeObserver(Arrays.asList(v.getTag(R.id.LaguageID).toString(), v.getTag(R.id.LaguageRegion).toString()),M_UPDATE_LANGUAGE); + if(mCurrentIndex!=getLayoutPosition() && mSupportedStatus){ + if(!mClickable){ + mClickable = true; + mEvent.invokeObserver(null,M_ENABLE_VIEW_CLICK); + // notifyItemChanged(mCurrentIndex); + mCurrentLanguage = v.getTag(R.id.LaguageID).toString(); + mCurrentIndex = getLayoutPosition(); + // notifyItemChanged(mCurrentIndex); + + final Handler handler = new Handler(); + handler.postDelayed(() -> { + mClickable = false; + mEvent.invokeObserver(null,M_DISABLE_VIEW_CLICK); + }, 100); + } + } + } + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java index b3cd666f..8f5b16bc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java @@ -154,7 +154,7 @@ public class languageController extends AppCompatActivity { getIntent().putExtra("activity_restarted",((LinearLayoutManager) Objects.requireNonNull(mRecycleView.getLayoutManager())).findFirstCompletelyVisibleItemPosition()); helperMethod.restartActivity(getIntent(), this); overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); - pluginController.getInstance().onLanguageInvoke(Arrays.asList(this, status.sSettingLanguage, status.sSettingLanguageRegion, status.sTheme), pluginEnums.eLangManager.M_SET_LANGUAGE); + pluginController.getInstance().onLanguageInvoke(Arrays.asList(this, status.sSettingLanguage, status.sSettingLanguageRegion, status.mThemeApplying), pluginEnums.eLangManager.M_SET_LANGUAGE); if(activityContextManager.getInstance().getSettingController()!=null && !activityContextManager.getInstance().getSettingController().isDestroyed()){ activityContextManager.getInstance().getSettingController().onRedrawXML(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageDataModel.java index a36d98fd..c9ee4eb2 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageDataModel.java @@ -1,31 +1,31 @@ -package com.darkweb.genesissearchengine.appManager.languageManager; - -public class languageDataModel { - - private String mHeader; - private String mDescription; - private String mTag; - private String mCountry; - - protected languageDataModel(String pHeader, String pDescription, String pTag, String pCountry) { - this.mHeader = pHeader; - this.mDescription = pDescription; - this.mTag = pTag; - this.mCountry = pCountry; - } - - public String getHeader() { - return mHeader; - } - public String getDescription() { - return mDescription; - } - public String getTag() { - return mTag; - } - public String getCountry() { - return mCountry; - } - -} - +package com.darkweb.genesissearchengine.appManager.languageManager; + +public class languageDataModel { + + private String mHeader; + private String mDescription; + private String mTag; + private String mCountry; + + protected languageDataModel(String pHeader, String pDescription, String pTag, String pCountry) { + this.mHeader = pHeader; + this.mDescription = pDescription; + this.mTag = pTag; + this.mCountry = pCountry; + } + + public String getHeader() { + return mHeader; + } + public String getDescription() { + return mDescription; + } + public String getTag() { + return mTag; + } + public String getCountry() { + return mCountry; + } + +} + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageEnums.java index fa2d0b02..5291cea4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageEnums.java @@ -1,17 +1,17 @@ -package com.darkweb.genesissearchengine.appManager.languageManager; - -class languageEnums -{ - /*History Manager*/ - public enum eLanguageModel { - M_SUPPORTED_LANGUAGE, M_ACTIVE_LANGUAGE - } - - public enum eLanguagevViewController { - M_UPDATE_BLOCKER - } - - public enum eLanguageAdapterCallback { - M_UPDATE_LANGUAGE, M_DISABLE_VIEW_CLICK, M_ENABLE_VIEW_CLICK, M_SYSTEM_LANGUAGE_SUPPORT_INFO - } +package com.darkweb.genesissearchengine.appManager.languageManager; + +class languageEnums +{ + /*History Manager*/ + public enum eLanguageModel { + M_SUPPORTED_LANGUAGE, M_ACTIVE_LANGUAGE + } + + public enum eLanguagevViewController { + M_UPDATE_BLOCKER + } + + public enum eLanguageAdapterCallback { + M_UPDATE_LANGUAGE, M_DISABLE_VIEW_CLICK, M_ENABLE_VIEW_CLICK, M_SYSTEM_LANGUAGE_SUPPORT_INFO + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageModel.java index 52e9a7e3..d953c56d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageModel.java @@ -1,60 +1,60 @@ -package com.darkweb.genesissearchengine.appManager.languageManager; - -import com.darkweb.genesissearchengine.constants.status; - -import java.util.ArrayList; -import java.util.List; - -class languageModel -{ - private ArrayList mSupportedLanaguage; - - public languageModel(){ - mSupportedLanaguage = new ArrayList<>(); - onInitLanguage(); - } - - private void onInitLanguage(){ - mSupportedLanaguage.add(new languageDataModel("Follow Device Language","Default Language", "default","default")); - mSupportedLanaguage.add(new languageDataModel("English (United States)","United States", "en","Us")); - mSupportedLanaguage.add(new languageDataModel("Deutsche","German", "de","De")); - mSupportedLanaguage.add(new languageDataModel("Català","Catalan", "ca","Es")); - mSupportedLanaguage.add(new languageDataModel("中文(中国)","Chinese (China)", "zh","Cn")); - mSupportedLanaguage.add(new languageDataModel("čeština","Czech", "ch","Cz")); - mSupportedLanaguage.add(new languageDataModel("Dutch (Netherland)","Dutch (Netherland)", "nl","Nl")); - mSupportedLanaguage.add(new languageDataModel("France (francaise)","French (France)", "fr","Fr")); - mSupportedLanaguage.add(new languageDataModel("Ελληνικά","Greek", "el","Gr")); - mSupportedLanaguage.add(new languageDataModel("Magyar","Hungarian", "hu","Hu")); - mSupportedLanaguage.add(new languageDataModel("bahasa Indonesia","Indonesian", "in","Id")); - mSupportedLanaguage.add(new languageDataModel("Italiana","Italian", "it","It")); - mSupportedLanaguage.add(new languageDataModel("日本人","Japanese", "ja","Jp")); - mSupportedLanaguage.add(new languageDataModel("韓国語","Korean", "ko","Kr")); - mSupportedLanaguage.add(new languageDataModel("Português","Portuguese (Portugal)", "pt","Pt")); - mSupportedLanaguage.add(new languageDataModel("Română","Romanian", "ro","Ro")); - mSupportedLanaguage.add(new languageDataModel("Urdu (اردو)","Urdu", "ur","Ur")); - mSupportedLanaguage.add(new languageDataModel("русский","Russian", "ru","Ru")); - mSupportedLanaguage.add(new languageDataModel("ไทย","Thai", "th","Th")); - mSupportedLanaguage.add(new languageDataModel("Türk","Turkish", "tr","Tr")); - mSupportedLanaguage.add(new languageDataModel("Український","Ukrainian", "uk","Ua")); - mSupportedLanaguage.add(new languageDataModel("Tiếng Việt","Vietnamese", "vi","Vn")); - } - - private int getActiveLanguageIndex(){ - for(int mCounter=0;mCounter pData){ - if(pCommands.equals(languageEnums.eLanguageModel.M_SUPPORTED_LANGUAGE)){ - return mSupportedLanaguage; - } - else if(pCommands.equals(languageEnums.eLanguageModel.M_ACTIVE_LANGUAGE)){ - return getActiveLanguageIndex(); - } - return null; - } -} +package com.darkweb.genesissearchengine.appManager.languageManager; + +import com.darkweb.genesissearchengine.constants.status; + +import java.util.ArrayList; +import java.util.List; + +class languageModel +{ + private ArrayList mSupportedLanaguage; + + public languageModel(){ + mSupportedLanaguage = new ArrayList<>(); + onInitLanguage(); + } + + private void onInitLanguage(){ + mSupportedLanaguage.add(new languageDataModel("Follow Device Language","Default Language", "default","default")); + mSupportedLanaguage.add(new languageDataModel("English (United States)","United States", "en","Us")); + mSupportedLanaguage.add(new languageDataModel("Deutsche","German", "de","De")); + mSupportedLanaguage.add(new languageDataModel("Català","Catalan", "ca","Es")); + mSupportedLanaguage.add(new languageDataModel("中文(中国)","Chinese (China)", "zh","Cn")); + mSupportedLanaguage.add(new languageDataModel("čeština","Czech", "ch","Cz")); + mSupportedLanaguage.add(new languageDataModel("Dutch (Netherland)","Dutch (Netherland)", "nl","Nl")); + mSupportedLanaguage.add(new languageDataModel("France (francaise)","French (France)", "fr","Fr")); + mSupportedLanaguage.add(new languageDataModel("Ελληνικά","Greek", "el","Gr")); + mSupportedLanaguage.add(new languageDataModel("Magyar","Hungarian", "hu","Hu")); + mSupportedLanaguage.add(new languageDataModel("bahasa Indonesia","Indonesian", "in","Id")); + mSupportedLanaguage.add(new languageDataModel("Italiana","Italian", "it","It")); + mSupportedLanaguage.add(new languageDataModel("日本人","Japanese", "ja","Jp")); + mSupportedLanaguage.add(new languageDataModel("韓国語","Korean", "ko","Kr")); + mSupportedLanaguage.add(new languageDataModel("Português","Portuguese (Portugal)", "pt","Pt")); + mSupportedLanaguage.add(new languageDataModel("Română","Romanian", "ro","Ro")); + mSupportedLanaguage.add(new languageDataModel("Urdu (اردو)","Urdu", "ur","Ur")); + mSupportedLanaguage.add(new languageDataModel("русский","Russian", "ru","Ru")); + mSupportedLanaguage.add(new languageDataModel("ไทย","Thai", "th","Th")); + mSupportedLanaguage.add(new languageDataModel("Türk","Turkish", "tr","Tr")); + mSupportedLanaguage.add(new languageDataModel("Український","Ukrainian", "uk","Ua")); + mSupportedLanaguage.add(new languageDataModel("Tiếng Việt","Vietnamese", "vi","Vn")); + } + + private int getActiveLanguageIndex(){ + for(int mCounter=0;mCounter pData){ + if(pCommands.equals(languageEnums.eLanguageModel.M_SUPPORTED_LANGUAGE)){ + return mSupportedLanaguage; + } + else if(pCommands.equals(languageEnums.eLanguageModel.M_ACTIVE_LANGUAGE)){ + return getActiveLanguageIndex(); + } + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java index c5540c6e..818b31aa 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java @@ -1,84 +1,84 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; - -import android.app.SearchManager; -import android.content.Intent; -import android.net.Uri; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; -import org.torproject.android.proxy.wrapper.logRowModel; -import java.util.ArrayList; -import java.util.List; - -public class orbotLogAdapter extends RecyclerView.Adapter -{ - /*Private Variables*/ - - private ArrayList mModelList; - private eventObserver.eventListener mEvent; - - orbotLogAdapter(ArrayList pModelList, eventObserver.eventListener pEvent) { - this.mModelList = pModelList; - this.mEvent = pEvent; - } - - @NonNull @Override - public orbotLogAdapter.listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.orbot_row_view, parent, false); - return new orbotLogAdapter.listViewHolder(view); - } - - @Override - public void onBindViewHolder(@NonNull orbotLogAdapter.listViewHolder holder, int position) - { - holder.bindListView(mModelList.get(position)); - } - - @Override - public int getItemCount() { - return mModelList.size(); - } - - - /*View Holder Extensions*/ - class listViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { - TextView mHeader; - TextView mDescription; - ConstraintLayout mRowContainerInner; - - listViewHolder(View itemView) { - super(itemView); - } - - void bindListView(logRowModel model) { - mHeader = itemView.findViewById(R.id.pHeader); - mDescription = itemView.findViewById(R.id.pDescription); - mRowContainerInner = itemView.findViewById(R.id.pRowContainerInner); - - mHeader.setText((this.getLayoutPosition() + ". " + model.getLog())); - mDescription.setText(model.getDate()); - mRowContainerInner.setOnClickListener(this); - } - - @Override - public void onClick(View v) { - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_LOG_DUCKDUCK + Uri.encode(" " + mModelList.get(this.getLayoutPosition()).getLog()))); - intent.putExtra(SearchManager.QUERY, mDescription.getText()); - intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - activityContextManager.getInstance().getHomeController().startActivity(intent); - } - } - - public Object onTrigger(tabEnums.eTabAdapterCommands pCommands, List pData){ - return null; - } -} +package com.darkweb.genesissearchengine.appManager.orbotLogManager; + +import android.app.SearchManager; +import android.content.Intent; +import android.net.Uri; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; +import org.torproject.android.proxy.wrapper.logRowModel; +import java.util.ArrayList; +import java.util.List; + +public class orbotLogAdapter extends RecyclerView.Adapter +{ + /*Private Variables*/ + + private ArrayList mModelList; + private eventObserver.eventListener mEvent; + + orbotLogAdapter(ArrayList pModelList, eventObserver.eventListener pEvent) { + this.mModelList = pModelList; + this.mEvent = pEvent; + } + + @NonNull @Override + public orbotLogAdapter.listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.orbot_row_view, parent, false); + return new orbotLogAdapter.listViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull orbotLogAdapter.listViewHolder holder, int position) + { + holder.bindListView(mModelList.get(position)); + } + + @Override + public int getItemCount() { + return mModelList.size(); + } + + + /*View Holder Extensions*/ + class listViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { + TextView mHeader; + TextView mDescription; + ConstraintLayout mRowContainerInner; + + listViewHolder(View itemView) { + super(itemView); + } + + void bindListView(logRowModel model) { + mHeader = itemView.findViewById(R.id.pHeader); + mDescription = itemView.findViewById(R.id.pDescription); + mRowContainerInner = itemView.findViewById(R.id.pRowContainerInner); + + mHeader.setText((this.getLayoutPosition() + ". " + model.getLog())); + mDescription.setText(model.getDate()); + mRowContainerInner.setOnClickListener(this); + } + + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_LOG_DUCKDUCK + Uri.encode(" " + mModelList.get(this.getLayoutPosition()).getLog()))); + intent.putExtra(SearchManager.QUERY, mDescription.getText()); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + activityContextManager.getInstance().getHomeController().startActivity(intent); + } + } + + public Object onTrigger(tabEnums.eTabAdapterCommands pCommands, List pData){ + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java index 71bc473f..8344aa80 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java @@ -1,385 +1,385 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; - -import android.annotation.SuppressLint; -import android.content.res.Configuration; -import android.os.Build; -import android.os.Bundle; -import android.util.Log; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewTreeObserver; -import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.annotation.RequiresApi; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.widget.NestedScrollView; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.material.floatingactionbutton.FloatingActionButton; - -import org.torproject.android.proxy.wrapper.logRowModel; -import org.torproject.android.proxy.wrapper.orbotLocalConstants; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE; -import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE; - - -public class orbotLogController extends AppCompatActivity { - - /* PRIVATE VARIABLES */ - - private orbotLogModel mOrbotModel; - private orbotLogViewController mOrbotLogViewController; - private orbotLogAdapter mOrbotAdapter; - private boolean mActivityClosed = false; - private int mLogCounter = 1; - private boolean mIsRecycleviewInteracting = false; - - /* UI VARIABLES */ - - private TextView mLogs; - private RecyclerView mLogRecycleView; - private NestedScrollView mNestedScrollView; - private FloatingActionButton mFloatingScroller; - - /* INITIALIZATIONS */ - - @RequiresApi(api = Build.VERSION_CODES.M) - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse); - activityContextManager.getInstance().setOrbotLogController(this); - activityContextManager.getInstance().onStack(this); - - super.onCreate(savedInstanceState); - setContentView(R.layout.orbot_log_view); - - initializeViews(); - initializeLogs(); - initListener(); - updateLogs(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - - mNestedScrollView.stopNestedScroll(); - - helperMethod.onDelayHandler(orbotLogController.this, 150, () -> { - if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { - if(!orbotLogStatus.sUIInteracted && ((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1)){ - if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ - mNestedScrollView.stopNestedScroll(); - onScrollBottom(); - mNestedScrollView.stopNestedScroll(); - orbotLogStatus.sScrollPosition = -1; - } - }else { - mNestedScrollView.stopNestedScroll(); - mNestedScrollView.scrollTo(0,0); - mNestedScrollView.smoothScrollTo(0,0); - mNestedScrollView.stopNestedScroll(); - orbotLogStatus.sScrollPosition = 0; - } - } - - return null; - }); - - super.onConfigurationChanged(newConfig); - } - - private void initializeViews() { - mLogRecycleView = findViewById(R.id.pLogRecycleView); - mLogs = findViewById(R.id.pLogs); - mNestedScrollView = findViewById(R.id.pNestedScrollView); - mFloatingScroller = findViewById(R.id.pFloatingScroller); - - mOrbotLogViewController = new orbotLogViewController(this, new orbotLogViewCallback() , mLogs, mLogRecycleView, mNestedScrollView, mFloatingScroller); - mOrbotModel = new orbotLogModel(); - } - - private void initializeLogs(){ - mLogCounter = 0; - mOrbotModel.setList(orbotLocalConstants.mTorLogsHistory); - if(status.sLogThemeStyleAdvanced){ - mLogCounter = (int)mOrbotModel.onTrigger(M_GET_LIST_SIZE); - LinearLayoutManager layoutManager = new LinearLayoutManager(orbotLogController.this); - orbotLogAdapter adapter = new orbotLogAdapter(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)),new orbotLogController.orbotModelCallback()); - mOrbotAdapter = adapter; - layoutManager.setReverseLayout(true); - - mLogRecycleView.setAdapter(adapter); - Objects.requireNonNull(mLogRecycleView.getItemAnimator()).setAddDuration(350); - - mLogRecycleView.setNestedScrollingEnabled(false); - mLogRecycleView.setLayoutManager(new LinearLayoutManager(orbotLogController.this)); - - mOrbotAdapter.notifyDataSetChanged(); - - }else { - logToString(); - } - mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS, Collections.singletonList(status.sLogThemeStyleAdvanced)); - mLogRecycleView.smoothScrollToPosition((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)); - } - - - /* LISTENERS */ - - @RequiresApi(api = Build.VERSION_CODES.M) - @SuppressLint("ClickableViewAccessibility") - private void initListener(){ - - mLogRecycleView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @SuppressLint("NewApi") @SuppressWarnings("deprecation") - @Override - public void onGlobalLayout() { - - if(orbotLogStatus.sOrientation==-1){ - orbotLogStatus.sOrientation = getResources().getConfiguration().orientation; - } - - if(orbotLogStatus.sOrientation != getResources().getConfiguration().orientation && orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sScrollPosition!=0){ - mNestedScrollView.stopNestedScroll(); - orbotLogStatus.sScrollPosition = 0; - mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition); - orbotLogStatus.sOrientation = getResources().getConfiguration().orientation; - }else { - if(orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sUIInteracted){ - mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition); - }else if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ - onScrollBottom(); - } - } - - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { - mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { - orbotLogStatus.sScrollPosition = scrollY; - }); - } - - mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); - mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this); - orbotLogStatus.sOrientation = getResources().getConfiguration().orientation; - } - }); - - mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); - if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) { - mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); - } - } - }); - - mLogRecycleView.setOnTouchListener((v, event) -> onTouch(event)); - - mNestedScrollView.setOnTouchListener((v, event) -> onTouch(event)); - - mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { - super.onScrollStateChanged(recyclerView, newState); - if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) { - mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); - } - } - }); - - mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> { - - if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) { - mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); - if(!mIsRecycleviewInteracting){ - orbotLogStatus.sUIInteracted = false; - } - } - if(mNestedScrollView.getScrollY() == 0){ - mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); - } - }); - } - - public boolean onTouch(MotionEvent event){ - if(event.getAction() == MotionEvent.ACTION_UP){ - mIsRecycleviewInteracting = false; - - if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ - orbotLogStatus.sUIInteracted = true; - } - }else if(event.getAction() == MotionEvent.ACTION_DOWN){ - mIsRecycleviewInteracting = true; - } - - mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); - - return false; - } - - private void logToString(){ - if((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1){ - for(int mCounter=0;mCounter<(int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);mCounter++){ - mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)).get(mCounter).getLog())); - mLogCounter+=1; - } - } - } - - private void updateLogs(){ - new Thread(){ - public void run(){ - try { - sleep(1000); - while (!mActivityClosed){ - if(status.sLogThemeStyleAdvanced){ - sleep(800); - }else { - sleep(100); - } - - if(mLogCounter>0){ - runOnUiThread(() -> { - if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){ - ((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)).add(orbotLocalConstants.mTorLogsHistory.get(mLogCounter)); - if(!status.sLogThemeStyleAdvanced){ - mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)).get(mLogCounter).getLog())); - }else { - if(mOrbotAdapter!=null){ - mOrbotAdapter.notifyItemInserted((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)-1); - } - } - - if(!orbotLogStatus.sUIInteracted){ - helperMethod.onDelayHandler(orbotLogController.this, 150, () -> { - Log.i("SUPFUCK4", orbotLogStatus.sUIInteracted + ""); - if(!orbotLogStatus.sUIInteracted){ - onScrollBottomAnimated(null); - } - return null; - }); - } - mLogCounter+=1; - } - }); - } - } - } - catch (InterruptedException e) { - e.printStackTrace(); - } - } - }.start(); - } - - private void onScrollBottom() { - mNestedScrollView.scrollTo(0,helperMethod.pxFromDp((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)*100)); - } - - /* View Callback */ - - public void onScrollBottomAnimated(View view) { - mNestedScrollView.fullScroll(View.FOCUS_DOWN); - orbotLogStatus.sUIInteracted = false; - Log.i("SUPFUCK5", orbotLogStatus.sUIInteracted + ""); - - if(view!=null){ - mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); - } - } - - public void onOpenInfo(View view) { - helperMethod.openActivity(settingLogController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onClose(View view){ - finish(); - activityContextManager.getInstance().onRemoveStack(this); - overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out); - mActivityClosed = true; - } - - /* View Callback */ - - private class orbotLogViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /* Model Callback */ - - public class orbotModelCallback implements eventObserver.eventListener{ - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /* LOCAL OVERRIDES */ - - @Override - public void onResume() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - - super.onResume(); - } - - @Override - public void onBackPressed() { - onClose(null); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - activityContextManager.getInstance().onRemoveStack(this); - activityContextManager.getInstance().setOrbotLogController(null); - mActivityClosed = true; - } - - /* External Calls */ - - public void onRefreshLayoutTheme(){ - if(!orbotLogStatus.sUIInteracted){ - orbotLogStatus.sScrollPosition = -1; - }else { - orbotLogStatus.sScrollPosition = 0; - } - - mIsRecycleviewInteracting = false; - recreate(); - } - +package com.darkweb.genesissearchengine.appManager.orbotLogManager; + +import android.annotation.SuppressLint; +import android.content.res.Configuration; +import android.os.Build; +import android.os.Bundle; +import android.util.Log; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewTreeObserver; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.annotation.RequiresApi; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.widget.NestedScrollView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.floatingactionbutton.FloatingActionButton; + +import org.torproject.android.proxy.wrapper.logRowModel; +import org.torproject.android.proxy.wrapper.orbotLocalConstants; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST; +import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE; +import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE; + + +public class orbotLogController extends AppCompatActivity { + + /* PRIVATE VARIABLES */ + + private orbotLogModel mOrbotModel; + private orbotLogViewController mOrbotLogViewController; + private orbotLogAdapter mOrbotAdapter; + private boolean mActivityClosed = false; + private int mLogCounter = 1; + private boolean mIsRecycleviewInteracting = false; + + /* UI VARIABLES */ + + private TextView mLogs; + private RecyclerView mLogRecycleView; + private NestedScrollView mNestedScrollView; + private FloatingActionButton mFloatingScroller; + + /* INITIALIZATIONS */ + + @RequiresApi(api = Build.VERSION_CODES.M) + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse); + activityContextManager.getInstance().setOrbotLogController(this); + activityContextManager.getInstance().onStack(this); + + super.onCreate(savedInstanceState); + setContentView(R.layout.orbot_log_view); + + initializeViews(); + initializeLogs(); + initListener(); + updateLogs(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + + mNestedScrollView.stopNestedScroll(); + + helperMethod.onDelayHandler(orbotLogController.this, 150, () -> { + if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { + if(!orbotLogStatus.sUIInteracted && ((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1)){ + if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ + mNestedScrollView.stopNestedScroll(); + onScrollBottom(); + mNestedScrollView.stopNestedScroll(); + orbotLogStatus.sScrollPosition = -1; + } + }else { + mNestedScrollView.stopNestedScroll(); + mNestedScrollView.scrollTo(0,0); + mNestedScrollView.smoothScrollTo(0,0); + mNestedScrollView.stopNestedScroll(); + orbotLogStatus.sScrollPosition = 0; + } + } + + return null; + }); + + super.onConfigurationChanged(newConfig); + } + + private void initializeViews() { + mLogRecycleView = findViewById(R.id.pLogRecycleView); + mLogs = findViewById(R.id.pLogs); + mNestedScrollView = findViewById(R.id.pNestedScrollView); + mFloatingScroller = findViewById(R.id.pFloatingScroller); + + mOrbotLogViewController = new orbotLogViewController(this, new orbotLogViewCallback() , mLogs, mLogRecycleView, mNestedScrollView, mFloatingScroller); + mOrbotModel = new orbotLogModel(); + } + + private void initializeLogs(){ + mLogCounter = 0; + mOrbotModel.setList(orbotLocalConstants.mTorLogsHistory); + if(status.sLogThemeStyleAdvanced){ + mLogCounter = (int)mOrbotModel.onTrigger(M_GET_LIST_SIZE); + LinearLayoutManager layoutManager = new LinearLayoutManager(orbotLogController.this); + orbotLogAdapter adapter = new orbotLogAdapter(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)),new orbotLogController.orbotModelCallback()); + mOrbotAdapter = adapter; + layoutManager.setReverseLayout(true); + + mLogRecycleView.setAdapter(adapter); + Objects.requireNonNull(mLogRecycleView.getItemAnimator()).setAddDuration(350); + + mLogRecycleView.setNestedScrollingEnabled(false); + mLogRecycleView.setLayoutManager(new LinearLayoutManager(orbotLogController.this)); + + mOrbotAdapter.notifyDataSetChanged(); + + }else { + logToString(); + } + mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS, Collections.singletonList(status.sLogThemeStyleAdvanced)); + mLogRecycleView.smoothScrollToPosition((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)); + } + + + /* LISTENERS */ + + @RequiresApi(api = Build.VERSION_CODES.M) + @SuppressLint("ClickableViewAccessibility") + private void initListener(){ + + mLogRecycleView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @SuppressLint("NewApi") @SuppressWarnings("deprecation") + @Override + public void onGlobalLayout() { + + if(orbotLogStatus.sOrientation==-1){ + orbotLogStatus.sOrientation = getResources().getConfiguration().orientation; + } + + if(orbotLogStatus.sOrientation != getResources().getConfiguration().orientation && orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sScrollPosition!=0){ + mNestedScrollView.stopNestedScroll(); + orbotLogStatus.sScrollPosition = 0; + mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition); + orbotLogStatus.sOrientation = getResources().getConfiguration().orientation; + }else { + if(orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sUIInteracted){ + mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition); + }else if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ + onScrollBottom(); + } + } + + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { + mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { + orbotLogStatus.sScrollPosition = scrollY; + }); + } + + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + orbotLogStatus.sOrientation = getResources().getConfiguration().orientation; + } + }); + + mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) { + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + } + } + }); + + mLogRecycleView.setOnTouchListener((v, event) -> onTouch(event)); + + mNestedScrollView.setOnTouchListener((v, event) -> onTouch(event)); + + mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) { + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + } + } + }); + + mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> { + + if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) { + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + if(!mIsRecycleviewInteracting){ + orbotLogStatus.sUIInteracted = false; + } + } + if(mNestedScrollView.getScrollY() == 0){ + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + } + }); + } + + public boolean onTouch(MotionEvent event){ + if(event.getAction() == MotionEvent.ACTION_UP){ + mIsRecycleviewInteracting = false; + + if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ + orbotLogStatus.sUIInteracted = true; + } + }else if(event.getAction() == MotionEvent.ACTION_DOWN){ + mIsRecycleviewInteracting = true; + } + + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + + return false; + } + + private void logToString(){ + if((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1){ + for(int mCounter=0;mCounter<(int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);mCounter++){ + mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)).get(mCounter).getLog())); + mLogCounter+=1; + } + } + } + + private void updateLogs(){ + new Thread(){ + public void run(){ + try { + sleep(1000); + while (!mActivityClosed){ + if(status.sLogThemeStyleAdvanced){ + sleep(800); + }else { + sleep(100); + } + + if(mLogCounter>0){ + runOnUiThread(() -> { + if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){ + ((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)).add(orbotLocalConstants.mTorLogsHistory.get(mLogCounter)); + if(!status.sLogThemeStyleAdvanced){ + mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)).get(mLogCounter).getLog())); + }else { + if(mOrbotAdapter!=null){ + mOrbotAdapter.notifyItemInserted((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)-1); + } + } + + if(!orbotLogStatus.sUIInteracted){ + helperMethod.onDelayHandler(orbotLogController.this, 150, () -> { + Log.i("SUPFUCK4", orbotLogStatus.sUIInteracted + ""); + if(!orbotLogStatus.sUIInteracted){ + onScrollBottomAnimated(null); + } + return null; + }); + } + mLogCounter+=1; + } + }); + } + } + } + catch (InterruptedException e) { + e.printStackTrace(); + } + } + }.start(); + } + + private void onScrollBottom() { + mNestedScrollView.scrollTo(0,helperMethod.pxFromDp((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)*100)); + } + + /* View Callback */ + + public void onScrollBottomAnimated(View view) { + mNestedScrollView.fullScroll(View.FOCUS_DOWN); + orbotLogStatus.sUIInteracted = false; + Log.i("SUPFUCK5", orbotLogStatus.sUIInteracted + ""); + + if(view!=null){ + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + } + } + + public void onOpenInfo(View view) { + helperMethod.openActivity(settingLogController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onClose(View view){ + finish(); + activityContextManager.getInstance().onRemoveStack(this); + overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out); + mActivityClosed = true; + } + + /* View Callback */ + + private class orbotLogViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /* Model Callback */ + + public class orbotModelCallback implements eventObserver.eventListener{ + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + + super.onResume(); + } + + @Override + public void onBackPressed() { + onClose(null); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + activityContextManager.getInstance().onRemoveStack(this); + activityContextManager.getInstance().setOrbotLogController(null); + mActivityClosed = true; + } + + /* External Calls */ + + public void onRefreshLayoutTheme(){ + if(!orbotLogStatus.sUIInteracted){ + orbotLogStatus.sScrollPosition = -1; + }else { + orbotLogStatus.sScrollPosition = 0; + } + + mIsRecycleviewInteracting = false; + recreate(); + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java index 7a45a5e4..0b564893 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java @@ -1,16 +1,16 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; - -public class orbotLogEnums -{ - /*Orbot Log View Manager*/ - - public enum eOrbotLogViewCommands { - M_UPDATE_LOGS, M_INIT_VIEWS, M_FLOAT_BUTTON_UPDATE - } - - /*Orbot Log Model Manager*/ - - public enum eOrbotLogModelCommands { - M_GET_LIST, M_GET_LIST_SIZE - } +package com.darkweb.genesissearchengine.appManager.orbotLogManager; + +public class orbotLogEnums +{ + /*Orbot Log View Manager*/ + + public enum eOrbotLogViewCommands { + M_UPDATE_LOGS, M_INIT_VIEWS, M_FLOAT_BUTTON_UPDATE + } + + /*Orbot Log Model Manager*/ + + public enum eOrbotLogModelCommands { + M_GET_LIST, M_GET_LIST_SIZE + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java index 26533e2b..277795c6 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java @@ -1,53 +1,53 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; - -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import org.torproject.android.proxy.wrapper.logRowModel; -import java.util.ArrayList; -import java.util.List; - -class orbotLogModel -{ - /*Private Variables*/ - - private ArrayList mModelList = new ArrayList<>(); - - /*Helper Methods*/ - - void setList(ArrayList pModel) - { - if(pModel.size()>0){ - mModelList.clear(); - mModelList.addAll(pModel); - } - else { - mModelList.add(new logRowModel(constants.CONST_LOGS_DEFAULT_MESSAGE, helperMethod.getCurrentTime())); - } - } - - private ArrayList getList() - { - return mModelList; - } - - private int getListSize() - { - return mModelList.size(); - } - - /*Triggers*/ - - public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List pData){ - } - - public Object onTrigger(orbotLogEnums.eOrbotLogModelCommands pCommands){ - if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST)){ - return getList(); - } - else if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE)){ - return getListSize(); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.orbotLogManager; + +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import org.torproject.android.proxy.wrapper.logRowModel; +import java.util.ArrayList; +import java.util.List; + +class orbotLogModel +{ + /*Private Variables*/ + + private ArrayList mModelList = new ArrayList<>(); + + /*Helper Methods*/ + + void setList(ArrayList pModel) + { + if(pModel.size()>0){ + mModelList.clear(); + mModelList.addAll(pModel); + } + else { + mModelList.add(new logRowModel(constants.CONST_LOGS_DEFAULT_MESSAGE, helperMethod.getCurrentTime())); + } + } + + private ArrayList getList() + { + return mModelList; + } + + private int getListSize() + { + return mModelList.size(); + } + + /*Triggers*/ + + public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List pData){ + } + + public Object onTrigger(orbotLogEnums.eOrbotLogModelCommands pCommands){ + if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST)){ + return getList(); + } + else if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE)){ + return getListSize(); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java index 0071cef8..ebb02142 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java @@ -1,8 +1,8 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; - -public class orbotLogStatus { - - public static boolean sUIInteracted = false; - public static int sScrollPosition = -1; - public static int sOrientation = -1; -} +package com.darkweb.genesissearchengine.appManager.orbotLogManager; + +public class orbotLogStatus { + + public static boolean sUIInteracted = false; + public static int sScrollPosition = -1; + public static int sOrientation = -1; +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java index f13f6691..cd3aa04a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java @@ -1,92 +1,92 @@ -package com.darkweb.genesissearchengine.appManager.orbotLogManager; - -import android.view.View; -import android.widget.TextView; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.widget.NestedScrollView; -import androidx.recyclerview.widget.RecyclerView; - -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; -import com.google.android.material.floatingactionbutton.FloatingActionButton; - -import java.util.List; - -class orbotLogViewController -{ - /*Private Variables*/ - - private AppCompatActivity mContext; - private eventObserver.eventListener mEvent; - - private TextView mLogs; - private RecyclerView mLogRecycleView; - private NestedScrollView mNestedScrollView; - private FloatingActionButton mFloatingScroller; - - /*Initializations*/ - - orbotLogViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent, TextView pLogs, RecyclerView pLogRecycleView, NestedScrollView pNestedScrollView, FloatingActionButton pFloatingScroller) - { - this.mContext = pContext; - this.mLogs = pLogs; - this.mLogRecycleView = pLogRecycleView; - this.mNestedScrollView = pNestedScrollView; - this.mFloatingScroller = pFloatingScroller; - this.mEvent = pEvent; - - initPostUI(); - } - - private void initViews(boolean pLogThemeStyleAdvanced){ - if(pLogThemeStyleAdvanced){ - mLogRecycleView.setVisibility(View.VISIBLE); - mLogs.setVisibility(View.GONE); - }else { - mLogRecycleView.setVisibility(View.GONE); - mLogs.setVisibility(View.VISIBLE); - } - } - - /*Helper Methods*/ - - private void initPostUI(){ - sharedUIMethod.updateStatusBar(mContext); - } - - private void onUpdateLogs(String pLogs){ - pLogs = "~ " + pLogs; - mLogs.setText(String.format("%s%s",mLogs.getText() , "\n\n" + pLogs )); - } - - private void onFloatButtonUpdate(){ - if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ - mFloatingScroller.setVisibility(View.VISIBLE); - mFloatingScroller.animate().cancel(); - mFloatingScroller.animate().setDuration(250).alpha(1); - }else { - mFloatingScroller.animate().cancel(); - mFloatingScroller.animate().setDuration(250).alpha(0).withEndAction(() -> mFloatingScroller.setVisibility(View.GONE)); - } - } - - - /*Triggers*/ - - public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List pData){ - if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS)){ - onUpdateLogs((String) pData.get(0)); - } - else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS)){ - initViews((boolean)pData.get(0)); - } - else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE)){ - onFloatButtonUpdate(); - } - } - - public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands){ - onTrigger(pCommands, null); - } -} +package com.darkweb.genesissearchengine.appManager.orbotLogManager; + +import android.view.View; +import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.widget.NestedScrollView; +import androidx.recyclerview.widget.RecyclerView; + +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; +import com.google.android.material.floatingactionbutton.FloatingActionButton; + +import java.util.List; + +class orbotLogViewController +{ + /*Private Variables*/ + + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + + private TextView mLogs; + private RecyclerView mLogRecycleView; + private NestedScrollView mNestedScrollView; + private FloatingActionButton mFloatingScroller; + + /*Initializations*/ + + orbotLogViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent, TextView pLogs, RecyclerView pLogRecycleView, NestedScrollView pNestedScrollView, FloatingActionButton pFloatingScroller) + { + this.mContext = pContext; + this.mLogs = pLogs; + this.mLogRecycleView = pLogRecycleView; + this.mNestedScrollView = pNestedScrollView; + this.mFloatingScroller = pFloatingScroller; + this.mEvent = pEvent; + + initPostUI(); + } + + private void initViews(boolean pLogThemeStyleAdvanced){ + if(pLogThemeStyleAdvanced){ + mLogRecycleView.setVisibility(View.VISIBLE); + mLogs.setVisibility(View.GONE); + }else { + mLogRecycleView.setVisibility(View.GONE); + mLogs.setVisibility(View.VISIBLE); + } + } + + /*Helper Methods*/ + + private void initPostUI(){ + sharedUIMethod.updateStatusBar(mContext); + } + + private void onUpdateLogs(String pLogs){ + pLogs = "~ " + pLogs; + mLogs.setText(String.format("%s%s",mLogs.getText() , "\n\n" + pLogs )); + } + + private void onFloatButtonUpdate(){ + if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ + mFloatingScroller.setVisibility(View.VISIBLE); + mFloatingScroller.animate().cancel(); + mFloatingScroller.animate().setDuration(250).alpha(1); + }else { + mFloatingScroller.animate().cancel(); + mFloatingScroller.animate().setDuration(250).alpha(0).withEndAction(() -> mFloatingScroller.setVisibility(View.GONE)); + } + } + + + /*Triggers*/ + + public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List pData){ + if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS)){ + onUpdateLogs((String) pData.get(0)); + } + else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS)){ + initViews((boolean)pData.get(0)); + } + else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE)){ + onFloatButtonUpdate(); + } + } + + public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands){ + onTrigger(pCommands, null); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotEnums.java index fecf8a8b..ec298675 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotEnums.java @@ -1,13 +1,13 @@ -package com.darkweb.genesissearchengine.appManager.orbotManager; - -public class orbotEnums -{ - /*Settings Manager*/ - public enum eOrbotViewCommands { - M_UPDATE_BRIDGE_SETTINGS_VIEWS, M_INIT_POST_UI, M_INIT_UI, M_UPDATE_VPN, M_UPDATE_BRIDGES - } - - public enum eOrbotModelCommands { - M_BRIDGE_SWITCH, M_VPN_SWITCH - } +package com.darkweb.genesissearchengine.appManager.orbotManager; + +public class orbotEnums +{ + /*Settings Manager*/ + public enum eOrbotViewCommands { + M_UPDATE_BRIDGE_SETTINGS_VIEWS, M_INIT_POST_UI, M_INIT_UI, M_UPDATE_VPN, M_UPDATE_BRIDGES + } + + public enum eOrbotModelCommands { + M_BRIDGE_SWITCH, M_VPN_SWITCH + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotModel.java index 5ec76cfa..36ee29e8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotModel.java @@ -1,46 +1,46 @@ -package com.darkweb.genesissearchengine.appManager.orbotManager; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; - -import java.util.Collections; -import java.util.List; - -class orbotModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - orbotModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - - /*Helper Methods*/ - - public void onBridgeSwitch(boolean pStatus){ - status.sBridgeStatus = pStatus; - pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.sBridgeStatus), pluginEnums.eOrbotManager.M_UPDATE_BRIDGES); - } - - public void onVPNSwitch(boolean pStatus){ - status.sVPNStatus = pStatus; - pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.sBridgeStatus), pluginEnums.eOrbotManager.M_UPDATE_VPN); - } - - - public void onTrigger(com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands pCommands, List pData){ - if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_BRIDGE_SWITCH){ - onBridgeSwitch((boolean) pData.get(0)); - } - else if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_VPN_SWITCH){ - onVPNSwitch((boolean) pData.get(0)); - } - } - - -} +package com.darkweb.genesissearchengine.appManager.orbotManager; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; + +import java.util.Collections; +import java.util.List; + +class orbotModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + orbotModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + /*Helper Methods*/ + + public void onBridgeSwitch(boolean pStatus){ + status.sBridgeStatus = pStatus; + pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.sBridgeStatus), pluginEnums.eOrbotManager.M_UPDATE_BRIDGES); + } + + public void onVPNSwitch(boolean pStatus){ + status.sVPNStatus = pStatus; + pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.sBridgeStatus), pluginEnums.eOrbotManager.M_UPDATE_VPN); + } + + + public void onTrigger(com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands pCommands, List pData){ + if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_BRIDGE_SWITCH){ + onBridgeSwitch((boolean) pData.get(0)); + } + else if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_VPN_SWITCH){ + onVPNSwitch((boolean) pData.get(0)); + } + } + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java index 6264b1ff..3ce87c39 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java @@ -1,124 +1,124 @@ -package com.darkweb.genesissearchengine.appManager.proxyStatusManager; - -import android.content.res.Configuration; -import android.os.Bundle; -import android.view.View; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; - -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class proxyStatusController extends AppCompatActivity { - - /* PRIVATE VARIABLES */ - private proxyStatusModel mProxyStatusModel; - private proxyStatusViewController mProxyStatusViewController; - - /* INITIALIZATIONS */ - private TextView mOrbotStatus; - private SwitchMaterial mVpnStatus; - private SwitchMaterial mBridgeStatus; - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out); - - super.onCreate(savedInstanceState); - setContentView(R.layout.proxy_status_view); - - viewsInitializations(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - } - - public void viewsInitializations() { - mOrbotStatus = findViewById(R.id.pOrbotStatus); - mVpnStatus = findViewById(R.id.pVpnStatus); - mBridgeStatus = findViewById(R.id.pBridgeStatus); - - activityContextManager.getInstance().onStack(this); - mProxyStatusViewController = new proxyStatusViewController(this, mOrbotStatus, mVpnStatus, mBridgeStatus); - mProxyStatusViewController.onTrigger(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS, Arrays.asList(pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS), status.sVPNStatus,status.sBridgeStatus)); - mProxyStatusModel = new proxyStatusModel(new proxyStatusModelCallback()); - } - - public void orbotLog(View view) { - helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void refreshOrbotStatus(View view) { - mProxyStatusViewController.onTrigger(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS, Arrays.asList(pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS), status.sVPNStatus,status.sBridgeStatus)); - } - - /* LISTENERS */ - - public class proxyStatusModelCallback implements eventObserver.eventListener{ - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - public void onClose(View view){ - finish(); - activityContextManager.getInstance().onRemoveStack(this); - overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse); - } - - /* LOCAL OVERRIDES */ - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - @Override - public void onResume() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - super.onResume(); - } - - @Override - public void onPause() - { - super.onPause(); - } - - @Override - public void onBackPressed() { - onClose(null); - } - - @Override - protected void onStop() { - super.onStop(); - } +package com.darkweb.genesissearchengine.appManager.proxyStatusManager; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class proxyStatusController extends AppCompatActivity { + + /* PRIVATE VARIABLES */ + private proxyStatusModel mProxyStatusModel; + private proxyStatusViewController mProxyStatusViewController; + + /* INITIALIZATIONS */ + private TextView mOrbotStatus; + private SwitchMaterial mVpnStatus; + private SwitchMaterial mBridgeStatus; + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out); + + super.onCreate(savedInstanceState); + setContentView(R.layout.proxy_status_view); + + viewsInitializations(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + } + + public void viewsInitializations() { + mOrbotStatus = findViewById(R.id.pOrbotStatus); + mVpnStatus = findViewById(R.id.pVpnStatus); + mBridgeStatus = findViewById(R.id.pBridgeStatus); + + activityContextManager.getInstance().onStack(this); + mProxyStatusViewController = new proxyStatusViewController(this, mOrbotStatus, mVpnStatus, mBridgeStatus); + mProxyStatusViewController.onTrigger(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS, Arrays.asList(pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS), status.sVPNStatus,status.sBridgeStatus)); + mProxyStatusModel = new proxyStatusModel(new proxyStatusModelCallback()); + } + + public void orbotLog(View view) { + helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void refreshOrbotStatus(View view) { + mProxyStatusViewController.onTrigger(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS, Arrays.asList(pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS), status.sVPNStatus,status.sBridgeStatus)); + } + + /* LISTENERS */ + + public class proxyStatusModelCallback implements eventObserver.eventListener{ + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + public void onClose(View view){ + finish(); + activityContextManager.getInstance().onRemoveStack(this); + overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse); + } + + /* LOCAL OVERRIDES */ + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + super.onResume(); + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + onClose(null); + } + + @Override + protected void onStop() { + super.onStop(); + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusEnums.java index 9a67b3db..cefdd775 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusEnums.java @@ -1,12 +1,12 @@ -package com.darkweb.genesissearchengine.appManager.proxyStatusManager; - -public class proxyStatusEnums -{ - /*Settings Manager*/ - public enum eProxyStatusViewCommands { - M_INIT_VIEWS - } - - public enum eProxyStatusModelCommands { - } +package com.darkweb.genesissearchengine.appManager.proxyStatusManager; + +public class proxyStatusEnums +{ + /*Settings Manager*/ + public enum eProxyStatusViewCommands { + M_INIT_VIEWS + } + + public enum eProxyStatusModelCommands { + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusModel.java index 92854b27..2b83ef7b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusModel.java @@ -1,17 +1,17 @@ -package com.darkweb.genesissearchengine.appManager.proxyStatusManager; - -import com.darkweb.genesissearchengine.eventObserver; - -class proxyStatusModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - proxyStatusModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - -} +package com.darkweb.genesissearchengine.appManager.proxyStatusManager; + +import com.darkweb.genesissearchengine.eventObserver; + +class proxyStatusModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + proxyStatusModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusViewController.java index 920ff99b..c0e307c5 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusViewController.java @@ -1,70 +1,70 @@ -package com.darkweb.genesissearchengine.appManager.proxyStatusManager; - -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.LinearLayout; -import android.widget.TextView; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.List; - -class proxyStatusViewController -{ - /*Private Variables*/ - - private AppCompatActivity mContext; - private SwitchMaterial mBridgeSwitch; - private SwitchMaterial mVpnSwitch; - private LinearLayout mCustomizableBridgeMenu; - - /*Initializations*/ - private TextView mOrbotStatus; - private SwitchMaterial mVpnStatus; - private SwitchMaterial mBridgeStatus; - - proxyStatusViewController(AppCompatActivity pContext, TextView pOrbotStatus, SwitchMaterial pVpnStatus, SwitchMaterial pBridgeStatus) - { - this.mContext = pContext; - this.mOrbotStatus = pOrbotStatus; - this.mVpnStatus = pVpnStatus; - this.mBridgeStatus = pBridgeStatus; - - initPostUI(); - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - private void initViews(String pOrbotStatus, boolean pVPNStatus, boolean pGatewayStatus){ - mOrbotStatus.setText(pOrbotStatus); - mVpnStatus.setChecked(pVPNStatus); - mBridgeStatus.setChecked(pGatewayStatus); - } - - public void onTrigger(proxyStatusEnums.eProxyStatusViewCommands pCommands, List pData){ - if(pCommands.equals(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS)){ - initViews((String)pData.get(0),(boolean)pData.get(1),(boolean)pData.get(2)); - } - } -} +package com.darkweb.genesissearchengine.appManager.proxyStatusManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.List; + +class proxyStatusViewController +{ + /*Private Variables*/ + + private AppCompatActivity mContext; + private SwitchMaterial mBridgeSwitch; + private SwitchMaterial mVpnSwitch; + private LinearLayout mCustomizableBridgeMenu; + + /*Initializations*/ + private TextView mOrbotStatus; + private SwitchMaterial mVpnStatus; + private SwitchMaterial mBridgeStatus; + + proxyStatusViewController(AppCompatActivity pContext, TextView pOrbotStatus, SwitchMaterial pVpnStatus, SwitchMaterial pBridgeStatus) + { + this.mContext = pContext; + this.mOrbotStatus = pOrbotStatus; + this.mVpnStatus = pVpnStatus; + this.mBridgeStatus = pBridgeStatus; + + initPostUI(); + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + private void initViews(String pOrbotStatus, boolean pVPNStatus, boolean pGatewayStatus){ + mOrbotStatus.setText(pOrbotStatus); + mVpnStatus.setChecked(pVPNStatus); + mBridgeStatus.setChecked(pGatewayStatus); + } + + public void onTrigger(proxyStatusEnums.eProxyStatusViewCommands pCommands, List pData){ + if(pCommands.equals(proxyStatusEnums.eProxyStatusViewCommands.M_INIT_VIEWS)){ + initViews((String)pData.get(0),(boolean)pData.get(1),(boolean)pData.get(2)); + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java index e41ff6f1..1713a390 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java @@ -1,189 +1,189 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; - -import android.content.res.Configuration; -import android.os.Bundle; -import android.os.Handler; -import android.view.View; -import android.widget.SeekBar; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class settingAccessibilityController extends AppCompatActivity { - - /* PRIVATE VARIABLES */ - - private settingAccessibilityModel mSettingAccessibilityModel; - private settingAccessibilityViewController mSettingAccessibilityViewController; - private SwitchMaterial mZoom; - private SwitchMaterial mVoiceInput; - private SeekBar mSeekBar; - private TextView mSeekBarSample; - private TextView mScalePercentage; - - /* PRIVATE LOCAL VARIABLES */ - - private boolean mIsSettingChanged = false; - private float mDefaultFontSize = status.sSettingFontSize; - - /* Initializations */ - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - - setContentView(R.layout.setting_accessibility_view); - - viewsInitializations(); - initializeListeners(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - } - - private void viewsInitializations() { - mZoom = findViewById(R.id.pZoom); - mVoiceInput = findViewById(R.id.pVoiceInput); - mSeekBar = findViewById(R.id.pSeekBar); - mSeekBarSample = findViewById(R.id.pSeekBarSample); - mScalePercentage = findViewById(R.id.pScalePercentage); - - activityContextManager.getInstance().onStack(this); - mSettingAccessibilityViewController = new settingAccessibilityViewController(this, new settingAccessibilityController.settingAccessibilityViewCallback(), mZoom, mVoiceInput, mSeekBar, mSeekBarSample, mScalePercentage); - mSettingAccessibilityModel = new settingAccessibilityModel(new settingAccessibilityController.settingAccessibilityModelCallback()); - } - - private void initializeListeners(){ - mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { - - @Override - public void onStopTrackingTouch(SeekBar seekBar) { - } - - @Override - public void onStartTrackingTouch(SeekBar seekBar) { - } - - @Override - public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) { - mIsSettingChanged = true; - int percentage = ((progress+5)*10); - mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT, Collections.singletonList((int)((12.0*percentage)/100))); - mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE, Collections.singletonList((percentage+ constants.CONST_PERCENTAGE_SIGN))); - - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,percentage)); - status.sSettingFontSize = percentage; - activityContextManager.getInstance().getHomeController().onLoadFont(); - } - }); - } - - /*View Callbacks*/ - - private class settingAccessibilityViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Model Callbacks*/ - - private class settingAccessibilityModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /* LOCAL OVERRIDES */ - - @Override - public void onResume() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - super.onResume(); - } - - @Override - public void onPause() - { - super.onPause(); - } - - @Override - public void onBackPressed() { - onClose(null); - } - - /*UI Redirection*/ - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onClose(View view){ - activityContextManager.getInstance().onRemoveStack(this); - finish(); - - if(mIsSettingChanged && mDefaultFontSize!=status.sSettingFontSize){ - activityContextManager.getInstance().getHomeController().initRuntimeSettings(); - } - } - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - public void onZoomSettingUpdate(View view){ - mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING, Collections.singletonList(!mZoom.isChecked())); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,status.sSettingEnableZoom)); - mZoom.toggle(); - - new Handler().postDelayed(() -> - { - activityContextManager.getInstance().getHomeController().onReload(null); - }, 300); - - } - - public void onVoiceInputSettingUpdate(View view){ - mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING, Collections.singletonList(!mVoiceInput.isChecked())); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,status.sSettingEnableVoiceInput)); - mVoiceInput.toggle(); - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.os.Handler; +import android.view.View; +import android.widget.SeekBar; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class settingAccessibilityController extends AppCompatActivity { + + /* PRIVATE VARIABLES */ + + private settingAccessibilityModel mSettingAccessibilityModel; + private settingAccessibilityViewController mSettingAccessibilityViewController; + private SwitchMaterial mZoom; + private SwitchMaterial mVoiceInput; + private SeekBar mSeekBar; + private TextView mSeekBarSample; + private TextView mScalePercentage; + + /* PRIVATE LOCAL VARIABLES */ + + private boolean mIsSettingChanged = false; + private float mDefaultFontSize = status.sSettingFontSize; + + /* Initializations */ + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + + setContentView(R.layout.setting_accessibility_view); + + viewsInitializations(); + initializeListeners(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + } + + private void viewsInitializations() { + mZoom = findViewById(R.id.pZoom); + mVoiceInput = findViewById(R.id.pVoiceInput); + mSeekBar = findViewById(R.id.pSeekBar); + mSeekBarSample = findViewById(R.id.pSeekBarSample); + mScalePercentage = findViewById(R.id.pScalePercentage); + + activityContextManager.getInstance().onStack(this); + mSettingAccessibilityViewController = new settingAccessibilityViewController(this, new settingAccessibilityController.settingAccessibilityViewCallback(), mZoom, mVoiceInput, mSeekBar, mSeekBarSample, mScalePercentage); + mSettingAccessibilityModel = new settingAccessibilityModel(new settingAccessibilityController.settingAccessibilityModelCallback()); + } + + private void initializeListeners(){ + mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + } + + @Override + public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) { + mIsSettingChanged = true; + int percentage = ((progress+5)*10); + mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT, Collections.singletonList((int)((12.0*percentage)/100))); + mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE, Collections.singletonList((percentage+ constants.CONST_PERCENTAGE_SIGN))); + + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,percentage)); + status.sSettingFontSize = percentage; + activityContextManager.getInstance().getHomeController().onLoadFont(); + } + }); + } + + /*View Callbacks*/ + + private class settingAccessibilityViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Model Callbacks*/ + + private class settingAccessibilityModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + onClose(null); + } + + /*UI Redirection*/ + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onClose(View view){ + activityContextManager.getInstance().onRemoveStack(this); + finish(); + + if(mIsSettingChanged && mDefaultFontSize!=status.sSettingFontSize){ + activityContextManager.getInstance().getHomeController().initRuntimeSettings(); + } + } + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + public void onZoomSettingUpdate(View view){ + mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING, Collections.singletonList(!mZoom.isChecked())); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,status.sSettingEnableZoom)); + mZoom.toggle(); + + new Handler().postDelayed(() -> + { + activityContextManager.getInstance().getHomeController().onReload(null); + }, 300); + + } + + public void onVoiceInputSettingUpdate(View view){ + mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING, Collections.singletonList(!mVoiceInput.isChecked())); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,status.sSettingEnableVoiceInput)); + mVoiceInput.toggle(); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java index cba7234c..c577b6a0 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityEnums.java @@ -1,14 +1,14 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; - -class settingAccessibilityEnums -{ - /*History Manager*/ - public enum eAccessibilityModel { - M_UPDATE_SAMPLE_TEXT, M_UPDATE_PERCENTAGE - } - - public enum eAccessibilityViewController { - M_ZOOM_SETTING, M_VOICE_INPUT_SETTING - } - +package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; + +class settingAccessibilityEnums +{ + /*History Manager*/ + public enum eAccessibilityModel { + M_UPDATE_SAMPLE_TEXT, M_UPDATE_PERCENTAGE + } + + public enum eAccessibilityViewController { + M_ZOOM_SETTING, M_VOICE_INPUT_SETTING + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java index 1f326524..b58063b4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityModel.java @@ -1,38 +1,38 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import java.util.List; - -class settingAccessibilityModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - settingAccessibilityModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - - /*Helper Methods*/ - - private void onZoomSettingUpdate(boolean pStatus){ - status.sSettingEnableZoom = pStatus; - } - - private void onVoiceInputSettingUpdate(boolean pStatus){ - status.sSettingEnableVoiceInput = pStatus; - } - - public Object onTrigger(settingAccessibilityEnums.eAccessibilityViewController pCommands, List pData){ - if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING)){ - onZoomSettingUpdate((boolean)pData.get(0)); - } - else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING)){ - onVoiceInputSettingUpdate((boolean)pData.get(0)); - } - return null; - } -} +package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import java.util.List; + +class settingAccessibilityModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingAccessibilityModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + /*Helper Methods*/ + + private void onZoomSettingUpdate(boolean pStatus){ + status.sSettingEnableZoom = pStatus; + } + + private void onVoiceInputSettingUpdate(boolean pStatus){ + status.sSettingEnableVoiceInput = pStatus; + } + + public Object onTrigger(settingAccessibilityEnums.eAccessibilityViewController pCommands, List pData){ + if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING)){ + onZoomSettingUpdate((boolean)pData.get(0)); + } + else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING)){ + onVoiceInputSettingUpdate((boolean)pData.get(0)); + } + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java index b1515a3d..87dbd56e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityViewController.java @@ -1,112 +1,112 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; - -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.SeekBar; -import android.widget.TextView; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.List; - -class settingAccessibilityViewController -{ - /*Private Variables*/ - - private eventObserver.eventListener mEvent; - private AppCompatActivity mContext; - - private SwitchMaterial mZoom; - private SwitchMaterial mVoiceInput; - private SeekBar mSeekBar; - private TextView mSeekBarSample; - private TextView mScalePercentage; - - /*Initializations*/ - - settingAccessibilityViewController(settingAccessibilityController pContext, eventObserver.eventListener pEvent, SwitchMaterial pZoom, SwitchMaterial pVoiceInput, SeekBar pSeekBar, TextView mSeekBarSample, TextView pScalePercentage) - { - this.mEvent = pEvent; - this.mContext = pContext; - this.mZoom = pZoom; - this.mVoiceInput = pVoiceInput; - this.mSeekBar = pSeekBar; - this.mSeekBarSample = mSeekBarSample; - this.mScalePercentage = pScalePercentage; - - initViews(); - initPostUI(); - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - private void initViews() - { - if(status.sSettingEnableZoom){ - mZoom.setChecked(true); - }else { - mZoom.setChecked(false); - } - if(status.sSettingEnableVoiceInput){ - mVoiceInput.setChecked(true); - }else { - mVoiceInput.setChecked(false); - } - - mSeekBar.setProgress((int)status.sSettingFontSize/10-5); - float percentage = status.sSettingFontSize; - if(status.sSettingFontSize<100){ - mSeekBarSample.setTextSize((int)((12*percentage)/100)); - }else if(status.sSettingFontSize>100){ - mSeekBarSample.setTextSize((int)((12*percentage)/100)); - } - - mScalePercentage.setText(((int)percentage + constants.CONST_PERCENTAGE_SIGN)); - mSeekBar.setAlpha(1f); - mScalePercentage.setAlpha(1f); - mSeekBarSample.setAlpha(1f); - mSeekBar.setEnabled(true); - } - - private void updateSampleTextSize(int pText){ - mSeekBarSample.setTextSize(pText); - } - - private void updatePercentage(String pText){ - mScalePercentage.setText(pText); - } - - public Object onTrigger(settingAccessibilityEnums.eAccessibilityModel pCommands, List pData){ - if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT)){ - updateSampleTextSize((int)pData.get(0)); - } - else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE)){ - updatePercentage((String)pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.SeekBar; +import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.List; + +class settingAccessibilityViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + + private SwitchMaterial mZoom; + private SwitchMaterial mVoiceInput; + private SeekBar mSeekBar; + private TextView mSeekBarSample; + private TextView mScalePercentage; + + /*Initializations*/ + + settingAccessibilityViewController(settingAccessibilityController pContext, eventObserver.eventListener pEvent, SwitchMaterial pZoom, SwitchMaterial pVoiceInput, SeekBar pSeekBar, TextView mSeekBarSample, TextView pScalePercentage) + { + this.mEvent = pEvent; + this.mContext = pContext; + this.mZoom = pZoom; + this.mVoiceInput = pVoiceInput; + this.mSeekBar = pSeekBar; + this.mSeekBarSample = mSeekBarSample; + this.mScalePercentage = pScalePercentage; + + initViews(); + initPostUI(); + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + private void initViews() + { + if(status.sSettingEnableZoom){ + mZoom.setChecked(true); + }else { + mZoom.setChecked(false); + } + if(status.sSettingEnableVoiceInput){ + mVoiceInput.setChecked(true); + }else { + mVoiceInput.setChecked(false); + } + + mSeekBar.setProgress((int)status.sSettingFontSize/10-5); + float percentage = status.sSettingFontSize; + if(status.sSettingFontSize<100){ + mSeekBarSample.setTextSize((int)((12*percentage)/100)); + }else if(status.sSettingFontSize>100){ + mSeekBarSample.setTextSize((int)((12*percentage)/100)); + } + + mScalePercentage.setText(((int)percentage + constants.CONST_PERCENTAGE_SIGN)); + mSeekBar.setAlpha(1f); + mScalePercentage.setAlpha(1f); + mSeekBarSample.setAlpha(1f); + mSeekBar.setEnabled(true); + } + + private void updateSampleTextSize(int pText){ + mSeekBarSample.setTextSize(pText); + } + + private void updatePercentage(String pText){ + mScalePercentage.setText(pText); + } + + public Object onTrigger(settingAccessibilityEnums.eAccessibilityModel pCommands, List pData){ + if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT)){ + updateSampleTextSize((int)pData.get(0)); + } + else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE)){ + updatePercentage((String)pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java index 5f1f43d9..06c1074e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java @@ -1,185 +1,185 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; - -import android.content.res.Configuration; -import android.os.Bundle; -import android.view.View; -import android.widget.RadioButton; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class settingAdvanceController extends AppCompatActivity { - - /* Private Variables */ - - private settingAdvanceModel mSettingAdvanceModel; - private settingAdvanceViewController mSettingAdvanceViewController; - private SwitchMaterial mRestoreTabs; - private SwitchMaterial mShowWebFonts; - private SwitchMaterial mToolbarTheme; - - private ArrayList mImageOption = new ArrayList<>(); - private ArrayList mTabLayoutOption = new ArrayList<>(); - private boolean mIsChanged = false; - - /* Initializations */ - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - - setContentView(R.layout.setting_advance_view); - - viewsInitializations(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - - } - - public void viewsInitializations() { - mRestoreTabs = findViewById(R.id.pRestoreTabs); - mShowWebFonts = findViewById(R.id.pShowWebFonts); - mToolbarTheme = findViewById(R.id.pToolbarTheme); - mImageOption.add(findViewById(R.id.pAdvanceImageOption1)); - mImageOption.add(findViewById(R.id.pAdvanceImageOption2)); - mTabLayoutOption.add(findViewById(R.id.pAdvanceGridOption1)); - mTabLayoutOption.add(findViewById(R.id.pAdvanceGridOption2)); - - activityContextManager.getInstance().onStack(this); - mSettingAdvanceViewController = new settingAdvanceViewController(this, new settingAdvanceViewCallback(), mRestoreTabs, mShowWebFonts, mToolbarTheme, mImageOption, mTabLayoutOption); - mSettingAdvanceModel = new settingAdvanceModel(new settingAdvanceModelCallback()); - } - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - - /*View Callbacks*/ - - public class settingAdvanceViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Model Callbacks*/ - - public class settingAdvanceModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /* LOCAL OVERRIDES */ - - @Override - public void onResume() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - super.onResume(); - - int notificationStatus = (int)pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_NOTIFICATION_STATUS); - if(notificationStatus==0){ - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION); - } else if(notificationStatus==1){ - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION); - } - } - - @Override - public void onPause() - { - super.onPause(); - } - - @Override - public void onBackPressed() { - onClose(null); - activityContextManager.getInstance().onRemoveStack(this); - } - - /*UI Redirection*/ - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - public void onClose(View view){ - if(mIsChanged){ - pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sShowImages, status.sClearOnExit), pluginEnums.eOrbotManager.M_UPDATE_PRIVACY); - activityContextManager.getInstance().getHomeController().initRuntimeSettings(); - } - finish(); - } - - public void onRestoreTabs(View view) { - mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB, Collections.singletonList(!mRestoreTabs.isChecked())); - mRestoreTabs.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB, status.sRestoreTabs)); - } - - public void onShowImages(View view) { - mIsChanged = true; - mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE, Collections.singletonList(null)); - mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE, Collections.singletonList(view)); - mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE, Collections.singletonList(view)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,status.sShowImages)); - } - - public void onGridView(View view) { - mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_GRID, Collections.singletonList(null)); - mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_TAB_GRID, Collections.singletonList(view)); - mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_SET_GRID, Collections.singletonList(view)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,status.sTabGridLayoutEnabled)); - } - - public void onShowWebFonts(View view) { - mIsChanged = true; - mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS, Collections.singletonList(!mShowWebFonts.isChecked())); - mShowWebFonts.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,status.sShowWebFonts)); - } - - public void onToolbarTheme(View view) { - mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_TOOLBAR_THEME, Collections.singletonList(!mToolbarTheme.isChecked())); - mToolbarTheme.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,status.sToolbarTheme)); - activityContextManager.getInstance().getHomeController().onUpdateStatusBarTheme(); - } +package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; +import android.widget.RadioButton; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class settingAdvanceController extends AppCompatActivity { + + /* Private Variables */ + + private settingAdvanceModel mSettingAdvanceModel; + private settingAdvanceViewController mSettingAdvanceViewController; + private SwitchMaterial mRestoreTabs; + private SwitchMaterial mShowWebFonts; + private SwitchMaterial mToolbarTheme; + + private ArrayList mImageOption = new ArrayList<>(); + private ArrayList mTabLayoutOption = new ArrayList<>(); + private boolean mIsChanged = false; + + /* Initializations */ + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + + setContentView(R.layout.setting_advance_view); + + viewsInitializations(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + + } + + public void viewsInitializations() { + mRestoreTabs = findViewById(R.id.pRestoreTabs); + mShowWebFonts = findViewById(R.id.pShowWebFonts); + mToolbarTheme = findViewById(R.id.pToolbarTheme); + mImageOption.add(findViewById(R.id.pAdvanceImageOption1)); + mImageOption.add(findViewById(R.id.pAdvanceImageOption2)); + mTabLayoutOption.add(findViewById(R.id.pAdvanceGridOption1)); + mTabLayoutOption.add(findViewById(R.id.pAdvanceGridOption2)); + + activityContextManager.getInstance().onStack(this); + mSettingAdvanceViewController = new settingAdvanceViewController(this, new settingAdvanceViewCallback(), mRestoreTabs, mShowWebFonts, mToolbarTheme, mImageOption, mTabLayoutOption); + mSettingAdvanceModel = new settingAdvanceModel(new settingAdvanceModelCallback()); + } + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + + /*View Callbacks*/ + + public class settingAdvanceViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Model Callbacks*/ + + public class settingAdvanceModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + + int notificationStatus = (int)pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_GET_NOTIFICATION_STATUS); + if(notificationStatus==0){ + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION); + } else if(notificationStatus==1){ + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION); + } + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + onClose(null); + activityContextManager.getInstance().onRemoveStack(this); + } + + /*UI Redirection*/ + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + public void onClose(View view){ + if(mIsChanged){ + pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sShowImages, status.sClearOnExit), pluginEnums.eOrbotManager.M_UPDATE_PRIVACY); + activityContextManager.getInstance().getHomeController().initRuntimeSettings(); + } + finish(); + } + + public void onRestoreTabs(View view) { + mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB, Collections.singletonList(!mRestoreTabs.isChecked())); + mRestoreTabs.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB, status.sRestoreTabs)); + } + + public void onShowImages(View view) { + mIsChanged = true; + mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE, Collections.singletonList(null)); + mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE, Collections.singletonList(view)); + mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE, Collections.singletonList(view)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,status.sShowImages)); + } + + public void onGridView(View view) { + mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_GRID, Collections.singletonList(null)); + mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_TAB_GRID, Collections.singletonList(view)); + mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_SET_GRID, Collections.singletonList(view)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,status.sTabGridLayoutEnabled)); + } + + public void onShowWebFonts(View view) { + mIsChanged = true; + mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS, Collections.singletonList(!mShowWebFonts.isChecked())); + mShowWebFonts.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,status.sShowWebFonts)); + } + + public void onToolbarTheme(View view) { + mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_TOOLBAR_THEME, Collections.singletonList(!mToolbarTheme.isChecked())); + mToolbarTheme.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,status.sToolbarTheme)); + activityContextManager.getInstance().getHomeController().onUpdateStatusBarTheme(); + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceEnums.java index c2bdcdb9..b95a25c9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceEnums.java @@ -1,14 +1,14 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; - -class settingAdvanceEnums -{ - /*History Manager*/ - public enum eAdvanceModel { - M_RESTORE_TAB, M_SHOW_IMAGE, M_SHOW_TAB_GRID, M_SHOW_WEB_FONTS, M_TOOLBAR_THEME - } - - public enum eAdvanceViewController { - M_CLEAR_IMAGE, M_SET_IMAGE, M_CLEAR_GRID, M_SET_GRID - } - +package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; + +class settingAdvanceEnums +{ + /*History Manager*/ + public enum eAdvanceModel { + M_RESTORE_TAB, M_SHOW_IMAGE, M_SHOW_TAB_GRID, M_SHOW_WEB_FONTS, M_TOOLBAR_THEME + } + + public enum eAdvanceViewController { + M_CLEAR_IMAGE, M_SET_IMAGE, M_CLEAR_GRID, M_SET_GRID + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceModel.java index 31c7e907..5b147c9d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceModel.java @@ -1,76 +1,76 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; - -import android.view.View; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; - -import java.util.List; - -class settingAdvanceModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - settingAdvanceModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - - /*Helper Methods*/ - - private void onRestoreTabs(boolean pStatus) { - status.sRestoreTabs = pStatus; - } - - private void onShowImages(View pView) { - - if(pView.getId() == R.id.pAdvanceOption1){ - status.sShowImages = 0; - } - else if(pView.getId() == R.id.pAdvanceOption2){ - status.sShowImages = 2; - } - } - - private void onShowTabGrid(View pView) { - - if(pView.getId() == R.id.pGridOption1){ - status.sTabGridLayoutEnabled = true; - } - else if(pView.getId() == R.id.pGridOption2){ - status.sTabGridLayoutEnabled = false; - } - } - - private void onShowWebFonts(boolean pStatus) { - status.sShowWebFonts = pStatus; - } - - private void onToolbarThemeChange(boolean pStatus) { - status.sToolbarTheme = pStatus; - } - - public Object onTrigger(settingAdvanceEnums.eAdvanceModel pCommands, List pData){ - if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB)){ - onRestoreTabs((boolean)pData.get(0)); - } - else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE)){ - onShowImages((View)pData.get(0)); - } - else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS)){ - onShowWebFonts((boolean)pData.get(0)); - } - else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_TOOLBAR_THEME)){ - onToolbarThemeChange((boolean)pData.get(0)); - } - else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_TAB_GRID)){ - onShowTabGrid((View)pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; + +import android.view.View; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; + +import java.util.List; + +class settingAdvanceModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingAdvanceModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + /*Helper Methods*/ + + private void onRestoreTabs(boolean pStatus) { + status.sRestoreTabs = pStatus; + } + + private void onShowImages(View pView) { + + if(pView.getId() == R.id.pAdvanceOption1){ + status.sShowImages = 0; + } + else if(pView.getId() == R.id.pAdvanceOption2){ + status.sShowImages = 2; + } + } + + private void onShowTabGrid(View pView) { + + if(pView.getId() == R.id.pGridOption1){ + status.sTabGridLayoutEnabled = true; + } + else if(pView.getId() == R.id.pGridOption2){ + status.sTabGridLayoutEnabled = false; + } + } + + private void onShowWebFonts(boolean pStatus) { + status.sShowWebFonts = pStatus; + } + + private void onToolbarThemeChange(boolean pStatus) { + status.sToolbarTheme = pStatus; + } + + public Object onTrigger(settingAdvanceEnums.eAdvanceModel pCommands, List pData){ + if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB)){ + onRestoreTabs((boolean)pData.get(0)); + } + else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE)){ + onShowImages((View)pData.get(0)); + } + else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS)){ + onShowWebFonts((boolean)pData.get(0)); + } + else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_TOOLBAR_THEME)){ + onToolbarThemeChange((boolean)pData.get(0)); + } + else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_TAB_GRID)){ + onShowTabGrid((View)pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceViewController.java index 1a8b36bd..09d62e86 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceViewController.java @@ -1,162 +1,162 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; - -import android.content.res.ColorStateList; -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.RadioButton; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.ArrayList; -import java.util.List; - -class settingAdvanceViewController -{ - /*Private Variables*/ - - private eventObserver.eventListener mEvent; - private AppCompatActivity mContext; - - private SwitchMaterial mRestoreTabs; - private SwitchMaterial mShowWebFonts; - private SwitchMaterial mToolbarTheme; - private ArrayList mImageOption; - private ArrayList mTabLayoutOption; - - /*Initializations*/ - - settingAdvanceViewController(settingAdvanceController pContext, eventObserver.eventListener pEvent, SwitchMaterial pRestoreTabs, SwitchMaterial pShowWebFonts, SwitchMaterial pToolbarTheme, ArrayList pImageOption, ArrayList pTabLayoutOption) - { - this.mEvent = pEvent; - this.mContext = pContext; - this.mRestoreTabs = pRestoreTabs; - this.mShowWebFonts = pShowWebFonts; - this.mToolbarTheme = pToolbarTheme; - this.mImageOption = pImageOption; - this.mTabLayoutOption = pTabLayoutOption; - - initViews(); - initPostUI(); - } - - private void initViews() - { - if(status.sRestoreTabs){ - mRestoreTabs.setChecked(true); - }else { - mRestoreTabs.setChecked(false); - } - - if(status.sShowWebFonts){ - mShowWebFonts.setChecked(true); - }else { - mShowWebFonts.setChecked(false); - } - - if(status.sToolbarTheme){ - mToolbarTheme.setChecked(true); - }else { - mToolbarTheme.setChecked(false); - } - - clearImageOptions(); - if(status.sShowImages == 0){ - mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mImageOption.get(0).setChecked(true); - } - else if(status.sShowImages == 2){ - mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mImageOption.get(1).setChecked(true); - } - - if(status.sTabGridLayoutEnabled){ - mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mTabLayoutOption.get(0).setChecked(true); - } - else{ - mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mTabLayoutOption.get(1).setChecked(true); - } - - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - private void clearImageOptions(){ - mImageOption.get(0).setChecked(false); - mImageOption.get(1).setChecked(false); - mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); - mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); - } - - private void clearGridOptions(){ - mTabLayoutOption.get(0).setChecked(false); - mTabLayoutOption.get(1).setChecked(false); - mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); - mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); - } - - private void setImageOptions(View pView){ - clearImageOptions(); - if(pView.getId() == R.id.pAdvanceOption1){ - mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mImageOption.get(0).setChecked(true); - } - else if(pView.getId() == R.id.pAdvanceOption2){ - mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mImageOption.get(1).setChecked(true); - } - } - - private void setGridOptions(View pView){ - clearGridOptions(); - if(pView.getId() == R.id.pGridOption1){ - mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mTabLayoutOption.get(0).setChecked(true); - } - else if(pView.getId() == R.id.pGridOption2){ - mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mTabLayoutOption.get(1).setChecked(true); - } - } - - public Object onTrigger(settingAdvanceEnums.eAdvanceViewController pCommands, List pData){ - if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE)){ - clearImageOptions(); - } - else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_GRID)){ - clearGridOptions(); - } - - else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE)){ - setImageOptions((View) pData.get(0)); - } - else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_SET_GRID)){ - setGridOptions((View) pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager; + +import android.content.res.ColorStateList; +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.RadioButton; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.ArrayList; +import java.util.List; + +class settingAdvanceViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + + private SwitchMaterial mRestoreTabs; + private SwitchMaterial mShowWebFonts; + private SwitchMaterial mToolbarTheme; + private ArrayList mImageOption; + private ArrayList mTabLayoutOption; + + /*Initializations*/ + + settingAdvanceViewController(settingAdvanceController pContext, eventObserver.eventListener pEvent, SwitchMaterial pRestoreTabs, SwitchMaterial pShowWebFonts, SwitchMaterial pToolbarTheme, ArrayList pImageOption, ArrayList pTabLayoutOption) + { + this.mEvent = pEvent; + this.mContext = pContext; + this.mRestoreTabs = pRestoreTabs; + this.mShowWebFonts = pShowWebFonts; + this.mToolbarTheme = pToolbarTheme; + this.mImageOption = pImageOption; + this.mTabLayoutOption = pTabLayoutOption; + + initViews(); + initPostUI(); + } + + private void initViews() + { + if(status.sRestoreTabs){ + mRestoreTabs.setChecked(true); + }else { + mRestoreTabs.setChecked(false); + } + + if(status.sShowWebFonts){ + mShowWebFonts.setChecked(true); + }else { + mShowWebFonts.setChecked(false); + } + + if(status.sToolbarTheme){ + mToolbarTheme.setChecked(true); + }else { + mToolbarTheme.setChecked(false); + } + + clearImageOptions(); + if(status.sShowImages == 0){ + mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mImageOption.get(0).setChecked(true); + } + else if(status.sShowImages == 2){ + mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mImageOption.get(1).setChecked(true); + } + + if(status.sTabGridLayoutEnabled){ + mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mTabLayoutOption.get(0).setChecked(true); + } + else{ + mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mTabLayoutOption.get(1).setChecked(true); + } + + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + private void clearImageOptions(){ + mImageOption.get(0).setChecked(false); + mImageOption.get(1).setChecked(false); + mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); + mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); + } + + private void clearGridOptions(){ + mTabLayoutOption.get(0).setChecked(false); + mTabLayoutOption.get(1).setChecked(false); + mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); + mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); + } + + private void setImageOptions(View pView){ + clearImageOptions(); + if(pView.getId() == R.id.pAdvanceOption1){ + mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mImageOption.get(0).setChecked(true); + } + else if(pView.getId() == R.id.pAdvanceOption2){ + mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mImageOption.get(1).setChecked(true); + } + } + + private void setGridOptions(View pView){ + clearGridOptions(); + if(pView.getId() == R.id.pGridOption1){ + mTabLayoutOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mTabLayoutOption.get(0).setChecked(true); + } + else if(pView.getId() == R.id.pGridOption2){ + mTabLayoutOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mTabLayoutOption.get(1).setChecked(true); + } + } + + public Object onTrigger(settingAdvanceEnums.eAdvanceViewController pCommands, List pData){ + if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE)){ + clearImageOptions(); + } + else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_GRID)){ + clearGridOptions(); + } + + else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE)){ + setImageOptions((View) pData.get(0)); + } + else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_SET_GRID)){ + setGridOptions((View) pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java index 869b147d..ed2627e6 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java @@ -1,277 +1,277 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; - -import android.content.res.ColorStateList; -import android.content.res.Configuration; -import android.os.Bundle; -import android.view.View; -import android.widget.CheckBox; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeEnums; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; - -import org.mozilla.geckoview.ContentBlocking; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_BOOKMARK; -import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_DATA_CLEARED; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; - -public class settingClearController extends AppCompatActivity { - - /* PRIVATE VARIABLES */ - - private settingClearModel mSettingClearModel; - private settingClearViewController mSettingClearViewController; - private ArrayList mCheckBoxList = new ArrayList<>(); - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - setContentView(R.layout.setting_clear_view); - - viewsInitializations(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - - } - - public void viewsInitializations() { - mCheckBoxList.add(findViewById(R.id.pClearChecked_1)); - mCheckBoxList.add(findViewById(R.id.pClearChecked_2)); - mCheckBoxList.add(findViewById(R.id.pClearChecked_3)); - mCheckBoxList.add(findViewById(R.id.pClearChecked_4)); - mCheckBoxList.add(findViewById(R.id.pClearChecked_5)); - mCheckBoxList.add(findViewById(R.id.pClearChecked_6)); - mCheckBoxList.add(findViewById(R.id.pClearChecked_7)); - mCheckBoxList.add(findViewById(R.id.pClearChecked_8)); - - activityContextManager.getInstance().onStack(this); - mSettingClearViewController = new settingClearViewController(this, new settingClearController.settingClearViewCallback(), mCheckBoxList); - mSettingClearModel = new settingClearModel(new settingClearController.settingClearModelCallback()); - } - - /*View Callbacks*/ - - private class settingClearViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Model Callbacks*/ - - private class settingClearModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - public void onClearData(View view){ - boolean mHomeInvoked = false; - if(mCheckBoxList.get(0).isChecked()){ - mCheckBoxList.get(0).setChecked(false); - mCheckBoxList.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); - mHomeInvoked = true; - } - if(mCheckBoxList.get(1).isChecked()){ - mCheckBoxList.get(1).setChecked(false); - mCheckBoxList.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); - dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null)); - dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); - } - if(mCheckBoxList.get(2).isChecked()){ - mCheckBoxList.get(2).setChecked(false); - mCheckBoxList.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); - dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_BOOKMARK,null)); - dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,null); - } - if(mCheckBoxList.get(3).isChecked()){ - mCheckBoxList.get(3).setChecked(false); - mCheckBoxList.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); - activityContextManager.getInstance().getHomeController().onClearCache(); - } - if(mCheckBoxList.get(4).isChecked()){ - mCheckBoxList.get(4).setChecked(false); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); - mCheckBoxList.get(4).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); - activityContextManager.getInstance().getHomeController().onClearSiteData(); - mHomeInvoked = true; - } - if(mCheckBoxList.get(5).isChecked()){ - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); - mCheckBoxList.get(5).setChecked(false); - mCheckBoxList.get(5).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); - activityContextManager.getInstance().getHomeController().onClearSession(); - mHomeInvoked = true; - } - if(mCheckBoxList.get(6).isChecked()){ - mCheckBoxList.get(6).setChecked(false); - mCheckBoxList.get(6).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); - activityContextManager.getInstance().getHomeController().onClearCookies(); - } - if(mCheckBoxList.get(7).isChecked()){ - mCheckBoxList.get(7).setChecked(false); - mCheckBoxList.get(7).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); - onClearSettings(); - status.initStatus(activityContextManager.getInstance().getHomeController()); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); - mHomeInvoked = true; - } - - activityContextManager.getInstance().getHomeController().initRuntimeSettings(); - pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_DATA_CLEARED); - - if(mHomeInvoked){ - activityContextManager.getInstance().getHomeController().onClearSettings(); - } - - - } - - private void onClearSettings(){ - - boolean mIsThemeChangable = false; - if(!status.sDefaultNightMode){ - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - mIsThemeChangable = true; - } - }else { - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - mIsThemeChangable = true; - } - } - - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE, strings.SETTING_DEFAULT_LANGUAGE)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); - - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); - - if(mIsThemeChangable) { - status.mThemeApplying = true; - onBackPressed(); - overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); - activityContextManager.getInstance().getHomeController().onReInitTheme(); - activityContextManager.getInstance().getSettingController().onReInitTheme(); - helperMethod.openActivity(settingClearController.class, constants.CONST_LIST_HISTORY, settingClearController.this, true); - } - } - - /* LOCAL OVERRIDES */ - - @Override - public void onResume() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - super.onResume(); - } - - @Override - public void onPause() - { - super.onPause(); - } - - @Override - public void onBackPressed() { - onClose(null); - } - - /*UI Redirection*/ - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onCheckBoxTriggered(View view){ - if(view!=null && view.getTag()!=null){ - mSettingClearViewController.onTrigger(settingClearEnums.eClearViewController.M_CHECK_INVOKE, Arrays.asList(view.getTag(),!mCheckBoxList.get(Integer.parseInt(view.getTag().toString())).isChecked())); - } - } - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - public void onClose(View view){ - activityContextManager.getInstance().onRemoveStack(this); - finish(); - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; + +import android.content.res.ColorStateList; +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; +import android.widget.CheckBox; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeEnums; +import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; + +import org.mozilla.geckoview.ContentBlocking; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_BOOKMARK; +import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_DATA_CLEARED; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; + +public class settingClearController extends AppCompatActivity { + + /* PRIVATE VARIABLES */ + + private settingClearModel mSettingClearModel; + private settingClearViewController mSettingClearViewController; + private ArrayList mCheckBoxList = new ArrayList<>(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + setContentView(R.layout.setting_clear_view); + + viewsInitializations(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + + } + + public void viewsInitializations() { + mCheckBoxList.add(findViewById(R.id.pClearChecked_1)); + mCheckBoxList.add(findViewById(R.id.pClearChecked_2)); + mCheckBoxList.add(findViewById(R.id.pClearChecked_3)); + mCheckBoxList.add(findViewById(R.id.pClearChecked_4)); + mCheckBoxList.add(findViewById(R.id.pClearChecked_5)); + mCheckBoxList.add(findViewById(R.id.pClearChecked_6)); + mCheckBoxList.add(findViewById(R.id.pClearChecked_7)); + mCheckBoxList.add(findViewById(R.id.pClearChecked_8)); + + activityContextManager.getInstance().onStack(this); + mSettingClearViewController = new settingClearViewController(this, new settingClearController.settingClearViewCallback(), mCheckBoxList); + mSettingClearModel = new settingClearModel(new settingClearController.settingClearModelCallback()); + } + + /*View Callbacks*/ + + private class settingClearViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Model Callbacks*/ + + private class settingClearModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + public void onClearData(View view){ + boolean mHomeInvoked = false; + if(mCheckBoxList.get(0).isChecked()){ + mCheckBoxList.get(0).setChecked(false); + mCheckBoxList.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + mHomeInvoked = true; + } + if(mCheckBoxList.get(1).isChecked()){ + mCheckBoxList.get(1).setChecked(false); + mCheckBoxList.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); + dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null)); + dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); + } + if(mCheckBoxList.get(2).isChecked()){ + mCheckBoxList.get(2).setChecked(false); + mCheckBoxList.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); + dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_BOOKMARK,null)); + dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,null); + } + if(mCheckBoxList.get(3).isChecked()){ + mCheckBoxList.get(3).setChecked(false); + mCheckBoxList.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); + activityContextManager.getInstance().getHomeController().onClearCache(); + } + if(mCheckBoxList.get(4).isChecked()){ + mCheckBoxList.get(4).setChecked(false); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + mCheckBoxList.get(4).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); + activityContextManager.getInstance().getHomeController().onClearSiteData(); + mHomeInvoked = true; + } + if(mCheckBoxList.get(5).isChecked()){ + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + mCheckBoxList.get(5).setChecked(false); + mCheckBoxList.get(5).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); + activityContextManager.getInstance().getHomeController().onClearSession(); + mHomeInvoked = true; + } + if(mCheckBoxList.get(6).isChecked()){ + mCheckBoxList.get(6).setChecked(false); + mCheckBoxList.get(6).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); + activityContextManager.getInstance().getHomeController().onClearCookies(); + } + if(mCheckBoxList.get(7).isChecked()){ + mCheckBoxList.get(7).setChecked(false); + mCheckBoxList.get(7).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); + onClearSettings(); + status.initStatus(activityContextManager.getInstance().getHomeController()); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + mHomeInvoked = true; + } + + activityContextManager.getInstance().getHomeController().initRuntimeSettings(); + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_DATA_CLEARED); + + if(mHomeInvoked){ + activityContextManager.getInstance().getHomeController().onClearSettings(); + } + + + } + + private void onClearSettings(){ + + boolean mIsThemeChangable = false; + if(!status.sDefaultNightMode){ + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + mIsThemeChangable = true; + } + }else { + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + mIsThemeChangable = true; + } + } + + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE, strings.SETTING_DEFAULT_LANGUAGE)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); + + if(mIsThemeChangable) { + status.mThemeApplying = true; + onBackPressed(); + overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); + activityContextManager.getInstance().getHomeController().onReInitTheme(); + activityContextManager.getInstance().getSettingController().onReInitTheme(); + helperMethod.openActivity(settingClearController.class, constants.CONST_LIST_HISTORY, settingClearController.this, true); + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + onClose(null); + } + + /*UI Redirection*/ + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onCheckBoxTriggered(View view){ + if(view!=null && view.getTag()!=null){ + mSettingClearViewController.onTrigger(settingClearEnums.eClearViewController.M_CHECK_INVOKE, Arrays.asList(view.getTag(),!mCheckBoxList.get(Integer.parseInt(view.getTag().toString())).isChecked())); + } + } + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + public void onClose(View view){ + activityContextManager.getInstance().onRemoveStack(this); + finish(); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearEnums.java index 56b97072..b37932d4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearEnums.java @@ -1,13 +1,13 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; - -class settingClearEnums -{ - /*History Manager*/ - public enum eClearModel { - } - - public enum eClearViewController { - M_CHECK_INVOKE - } - +package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; + +class settingClearEnums +{ + /*History Manager*/ + public enum eClearModel { + } + + public enum eClearViewController { + M_CHECK_INVOKE + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearModel.java index bdfece1b..1426a62a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearModel.java @@ -1,20 +1,20 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; - -import com.darkweb.genesissearchengine.eventObserver; - -class settingClearModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - settingClearModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - - /*Helper Methods*/ - - -} +package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; + +import com.darkweb.genesissearchengine.eventObserver; + +class settingClearModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingClearModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + /*Helper Methods*/ + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearViewController.java index 74009097..58326933 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearViewController.java @@ -1,69 +1,69 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; - -import android.content.res.ColorStateList; -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.CheckBox; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; -import java.util.ArrayList; -import java.util.List; - -class settingClearViewController -{ - /*Private Variables*/ - - private eventObserver.eventListener mEvent; - private AppCompatActivity mContext; - private ArrayList mCheckBoxList; - - /*Initializations*/ - - settingClearViewController(settingClearController pContext, eventObserver.eventListener pEvent, ArrayList pCheckBoxList) - { - this.mEvent = pEvent; - this.mContext = pContext; - this.mCheckBoxList = pCheckBoxList; - - initPostUI(); - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - private void onClearCheckbox(int pIndex, boolean pStatus){ - mCheckBoxList.get(pIndex).setChecked(pStatus); - if(pStatus){ - mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint))); - }else { - mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint_default))); - } - } - - public Object onTrigger(settingClearEnums.eClearViewController pCommands, List pData){ - if(pCommands.equals(settingClearEnums.eClearViewController.M_CHECK_INVOKE)){ - onClearCheckbox(Integer.parseInt(pData.get(0).toString()), (boolean)pData.get(1)); - } - return null; - } -} +package com.darkweb.genesissearchengine.appManager.settingManager.clearManager; + +import android.content.res.ColorStateList; +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.CheckBox; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; +import java.util.ArrayList; +import java.util.List; + +class settingClearViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + private ArrayList mCheckBoxList; + + /*Initializations*/ + + settingClearViewController(settingClearController pContext, eventObserver.eventListener pEvent, ArrayList pCheckBoxList) + { + this.mEvent = pEvent; + this.mContext = pContext; + this.mCheckBoxList = pCheckBoxList; + + initPostUI(); + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + private void onClearCheckbox(int pIndex, boolean pStatus){ + mCheckBoxList.get(pIndex).setChecked(pStatus); + if(pStatus){ + mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint))); + }else { + mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint_default))); + } + } + + public Object onTrigger(settingClearEnums.eClearViewController pCommands, List pData){ + if(pCommands.equals(settingClearEnums.eClearViewController.M_CHECK_INVOKE)){ + onClearCheckbox(Integer.parseInt(pData.get(0).toString()), (boolean)pData.get(1)); + } + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java index 8442a1ba..efb5a7ae 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java @@ -1,253 +1,253 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; - -import android.content.res.Configuration; -import android.os.Bundle; -import android.view.View; -import android.widget.RadioButton; -import android.widget.TextView; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.appManager.languageManager.languageController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class settingGeneralController extends AppCompatActivity { - - /* PRIVATE VARIABLES */ - - private settingGeneralModel mSettingGeneralModel; - private settingGeneralViewController mSettingGeneralViewController; - private SwitchMaterial mFullScreenMode; - private SwitchMaterial mOpenURLInNewTab; - private RadioButton mThemeLight; - private RadioButton mThemeDark; - private RadioButton mThemeDefault; - private TextView mHomePageText; - - /* PRIVATE LOCAL VARIABLES */ - - private Boolean mIsThemeChanging = false; - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - if(!status.mThemeApplying){ - activityContextManager.getInstance().onStack(this); - } - - setContentView(R.layout.setting_general_view); - activityContextManager.getInstance().setSettingGeneralController(this); - viewsInitializations(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - - if(!mIsThemeChanging){ - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - } - - } - - private void viewsInitializations() { - - mFullScreenMode = findViewById(R.id.pJSStatus); - mThemeLight = findViewById(R.id.pThemeLight); - mThemeDark = findViewById(R.id.pThemeDark); - mThemeDefault = findViewById(R.id.pThemeDefault); - mHomePageText = findViewById(R.id.pHomePageText); - mOpenURLInNewTab = findViewById(R.id.pOpenURLInNewTab); - - mSettingGeneralViewController = new settingGeneralViewController(this, new settingGeneralViewCallback(), mFullScreenMode, mThemeLight, mThemeDark, mThemeDefault, mHomePageText, mOpenURLInNewTab); - mSettingGeneralModel = new settingGeneralModel(new settingGeneralModelCallback()); - } - - /*View Callbacks*/ - - private class settingGeneralViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - if(settingGeneralEnums.eGeneralViewCallback.M_RESET_THEME_INVOKED_BACK.equals(e_type)) - { - boolean mIsThemeChangable = false; - if(status.sTheme == enums.Theme.THEME_DARK){ - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - mIsThemeChangable = true; - } - } - else if(status.sTheme == enums.Theme.THEME_LIGHT){ - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - mIsThemeChangable = true; - } - }else { - if(!status.sDefaultNightMode){ - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - mIsThemeChangable = true; - } - }else { - if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - mIsThemeChangable = true; - } - } - } - - if(mIsThemeChangable){ - status.mThemeApplying = true; - onBackPressed(); - overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); - activityContextManager.getInstance().getHomeController().onReInitTheme(); - activityContextManager.getInstance().getSettingController().onReInitTheme(); - helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, settingGeneralController.this,true); - } - } - return null; - } - } - - /*Model Callbacks*/ - - private class settingGeneralModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /* LOCAL OVERRIDES */ - - @Override - public void onResume() - { - if(status.mThemeApplying){ - // activityContextManager.getInstance().onStack(this); - } - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - super.onResume(); - } - - @Override - public void onPause() - { - super.onPause(); - } - - @Override - public void onBackPressed() { - finish(); - } - - /*External Redirection*/ - - public void onLanguageChanged(){ - setContentView(R.layout.setting_general_view); - } - - /*UI Redirection*/ - - public void onClose(View view){ - finish(); - } - - @Override - protected void onDestroy() { - if(!status.mThemeApplying){ - activityContextManager.getInstance().onRemoveStack(this); - } - activityContextManager.getInstance().setSettingGeneralController(null); - super.onDestroy(); - } - - public void onManageLanguage(View view) { - helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onFullScreenBrowsing(View view){ - mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING, Collections.singletonList(!mFullScreenMode.isChecked())); - mFullScreenMode.toggle(); - activityContextManager.getInstance().getHomeController().onFullScreenSettingChanged(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,status.sFullScreenBrowsing)); - } - - public void onSelectTheme(View view){ - if(!mIsThemeChanging){ - mIsThemeChanging = true; - if(view.getId() == R.id.pOption1){ - if(status.sTheme != enums.Theme.THEME_DARK) { - mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null); - mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DARK)); - mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DARK)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme)); - mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DARK)); - mIsThemeChanging = false; - }else { - mIsThemeChanging = false; - } - }else if(view.getId() == R.id.pOption2) { - if(status.sTheme != enums.Theme.THEME_LIGHT) { - mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null); - mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT)); - mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme)); - mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_LIGHT)); - mIsThemeChanging = false; - }else { - mIsThemeChanging = false; - } - }else { - if(status.sTheme != enums.Theme.THEME_DEFAULT) { - mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null); - mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT)); - mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme)); - mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DEFAULT)); - mIsThemeChanging = false; - }else { - mIsThemeChanging = false; - } - } - } - } - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onURLInNewTab(View view) { - mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB, Collections.singletonList(!mOpenURLInNewTab.isChecked())); - mOpenURLInNewTab.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,status.sOpenURLInNewTab)); - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; +import android.widget.RadioButton; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.appManager.languageManager.languageController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class settingGeneralController extends AppCompatActivity { + + /* PRIVATE VARIABLES */ + + private settingGeneralModel mSettingGeneralModel; + private settingGeneralViewController mSettingGeneralViewController; + private SwitchMaterial mFullScreenMode; + private SwitchMaterial mOpenURLInNewTab; + private RadioButton mThemeLight; + private RadioButton mThemeDark; + private RadioButton mThemeDefault; + private TextView mHomePageText; + + /* PRIVATE LOCAL VARIABLES */ + + private Boolean mIsThemeChanging = false; + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + if(!status.mThemeApplying){ + activityContextManager.getInstance().onStack(this); + } + + setContentView(R.layout.setting_general_view); + activityContextManager.getInstance().setSettingGeneralController(this); + viewsInitializations(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + + if(!mIsThemeChanging){ + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + } + + } + + private void viewsInitializations() { + + mFullScreenMode = findViewById(R.id.pJSStatus); + mThemeLight = findViewById(R.id.pThemeLight); + mThemeDark = findViewById(R.id.pThemeDark); + mThemeDefault = findViewById(R.id.pThemeDefault); + mHomePageText = findViewById(R.id.pHomePageText); + mOpenURLInNewTab = findViewById(R.id.pOpenURLInNewTab); + + mSettingGeneralViewController = new settingGeneralViewController(this, new settingGeneralViewCallback(), mFullScreenMode, mThemeLight, mThemeDark, mThemeDefault, mHomePageText, mOpenURLInNewTab); + mSettingGeneralModel = new settingGeneralModel(new settingGeneralModelCallback()); + } + + /*View Callbacks*/ + + private class settingGeneralViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + if(settingGeneralEnums.eGeneralViewCallback.M_RESET_THEME_INVOKED_BACK.equals(e_type)) + { + boolean mIsThemeChangable = false; + if(status.sTheme == enums.Theme.THEME_DARK){ + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + mIsThemeChangable = true; + } + } + else if(status.sTheme == enums.Theme.THEME_LIGHT){ + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + mIsThemeChangable = true; + } + }else { + if(!status.sDefaultNightMode){ + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + mIsThemeChangable = true; + } + }else { + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + mIsThemeChangable = true; + } + } + } + + if(mIsThemeChangable){ + status.mThemeApplying = true; + onBackPressed(); + overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); + activityContextManager.getInstance().getHomeController().onReInitTheme(); + activityContextManager.getInstance().getSettingController().onReInitTheme(); + helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, settingGeneralController.this,true); + } + } + return null; + } + } + + /*Model Callbacks*/ + + private class settingGeneralModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + if(status.mThemeApplying){ + // activityContextManager.getInstance().onStack(this); + } + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + finish(); + } + + /*External Redirection*/ + + public void onLanguageChanged(){ + setContentView(R.layout.setting_general_view); + } + + /*UI Redirection*/ + + public void onClose(View view){ + finish(); + } + + @Override + protected void onDestroy() { + if(!status.mThemeApplying){ + activityContextManager.getInstance().onRemoveStack(this); + } + activityContextManager.getInstance().setSettingGeneralController(null); + super.onDestroy(); + } + + public void onManageLanguage(View view) { + helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onFullScreenBrowsing(View view){ + mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING, Collections.singletonList(!mFullScreenMode.isChecked())); + mFullScreenMode.toggle(); + activityContextManager.getInstance().getHomeController().onFullScreenSettingChanged(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,status.sFullScreenBrowsing)); + } + + public void onSelectTheme(View view){ + if(!mIsThemeChanging){ + mIsThemeChanging = true; + if(view.getId() == R.id.pOption1){ + if(status.sTheme != enums.Theme.THEME_DARK) { + mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null); + mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DARK)); + mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DARK)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme)); + mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DARK)); + mIsThemeChanging = false; + }else { + mIsThemeChanging = false; + } + }else if(view.getId() == R.id.pOption2) { + if(status.sTheme != enums.Theme.THEME_LIGHT) { + mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null); + mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT)); + mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme)); + mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_LIGHT)); + mIsThemeChanging = false; + }else { + mIsThemeChanging = false; + } + }else { + if(status.sTheme != enums.Theme.THEME_DEFAULT) { + mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null); + mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT)); + mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,status.sTheme)); + mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DEFAULT)); + mIsThemeChanging = false; + }else { + mIsThemeChanging = false; + } + } + } + } + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onURLInNewTab(View view) { + mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB, Collections.singletonList(!mOpenURLInNewTab.isChecked())); + mOpenURLInNewTab.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,status.sOpenURLInNewTab)); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralEnums.java index 9d74e574..b840ee51 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralEnums.java @@ -1,17 +1,17 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; - -class settingGeneralEnums -{ - /*History Manager*/ - public enum eGeneralModel { - M_FULL_SCREEN_BROWSING, M_SELECT_THEME, M_URL_NEW_TAB - } - - public enum eGeneralViewController { - M_SET_THEME, M_RESET_THEME, M_UPDATE_THEME_BLOCKER - } - - public enum eGeneralViewCallback { - M_RESET_THEME_INVOKED_BACK - } +package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; + +class settingGeneralEnums +{ + /*History Manager*/ + public enum eGeneralModel { + M_FULL_SCREEN_BROWSING, M_SELECT_THEME, M_URL_NEW_TAB + } + + public enum eGeneralViewController { + M_SET_THEME, M_RESET_THEME, M_UPDATE_THEME_BLOCKER + } + + public enum eGeneralViewCallback { + M_RESET_THEME_INVOKED_BACK + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralModel.java index 8cb34df5..8fdaf3b0 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralModel.java @@ -1,45 +1,45 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import java.util.List; - -class settingGeneralModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - settingGeneralModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - - /*Helper Methods*/ - private void onFullScreenBrowsing(boolean pStatus){ - status.sFullScreenBrowsing = pStatus; - } - - private void onSelectThemeLight(int pStatus){ - status.sTheme = pStatus; - } - - private void onURLInNewTab(boolean pStatus) { - status.sOpenURLInNewTab = pStatus; - } - - public Object onTrigger(settingGeneralEnums.eGeneralModel pCommands, List pData){ - if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING)){ - onFullScreenBrowsing((boolean)pData.get(0)); - } - else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_SELECT_THEME)){ - onSelectThemeLight((int)pData.get(0)); - } - else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB)){ - onURLInNewTab((boolean)pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import java.util.List; + +class settingGeneralModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingGeneralModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + /*Helper Methods*/ + private void onFullScreenBrowsing(boolean pStatus){ + status.sFullScreenBrowsing = pStatus; + } + + private void onSelectThemeLight(int pStatus){ + status.sTheme = pStatus; + } + + private void onURLInNewTab(boolean pStatus) { + status.sOpenURLInNewTab = pStatus; + } + + public Object onTrigger(settingGeneralEnums.eGeneralModel pCommands, List pData){ + if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING)){ + onFullScreenBrowsing((boolean)pData.get(0)); + } + else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_SELECT_THEME)){ + onSelectThemeLight((int)pData.get(0)); + } + else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB)){ + onURLInNewTab((boolean)pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralViewController.java index 05a016f6..e24fe4d8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralViewController.java @@ -1,145 +1,145 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; - -import android.content.res.ColorStateList; -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.RadioButton; -import android.widget.TextView; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.Collections; -import java.util.List; - -import static com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralEnums.eGeneralViewCallback.M_RESET_THEME_INVOKED_BACK; - -class settingGeneralViewController -{ - /*Private Variables*/ - - private eventObserver.eventListener mEvent; - private AppCompatActivity mContext; - private SwitchMaterial mFullScreenMode; - private SwitchMaterial mOpenURLInNewTab; - private RadioButton mThemeLight; - private RadioButton mThemeDark; - private RadioButton mThemeDefault; - private TextView mHomePageText; - - /*Initializations*/ - - - settingGeneralViewController(settingGeneralController pContext, eventObserver.eventListener pEvent, SwitchMaterial pFullScreenMode, RadioButton pThemeLight, RadioButton pThemeDark, RadioButton pThemeDefault, TextView pHomePageText, SwitchMaterial pOpenURLInNewTab) - { - this.mEvent = pEvent; - this.mContext = pContext; - this.mFullScreenMode = pFullScreenMode; - this.mThemeLight = pThemeLight; - this.mThemeDark = pThemeDark; - this.mThemeDefault = pThemeDefault; - this.mHomePageText = pHomePageText; - this.mOpenURLInNewTab = pOpenURLInNewTab; - - initViews(); - initPostUI(); - } - - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - private void initViews() - { - resetThemeSelection(); - - if(status.sTheme == enums.Theme.THEME_LIGHT){ - mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mThemeLight.setChecked(true); - }else if(status.sTheme == enums.Theme.THEME_DARK){ - mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mThemeDark.setChecked(true); - }else{ - mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mThemeDefault.setChecked(true); - } - - if(status.sFullScreenBrowsing){ - mFullScreenMode.setChecked(true); - }else { - mFullScreenMode.setChecked(false); - } - - if(status.sOpenURLInNewTab){ - mOpenURLInNewTab.setChecked(true); - }else { - mOpenURLInNewTab.setChecked(false); - } - - mHomePageText.setText(helperMethod.getDomainName(status.sSettingSearchStatus.replace("genesishiddentechnologies.com","genesis.onion"))); - } - - private void updateThemeChanger(){ - mEvent.invokeObserver(Collections.singletonList(status.sTheme), M_RESET_THEME_INVOKED_BACK); - } - - private void resetThemeSelection(){ - mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); - mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); - mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); - - mThemeDark.setChecked(false); - mThemeLight.setChecked(false); - mThemeDefault.setChecked(false); - } - - private void setTheme(int pTheme){ - - if(pTheme == enums.Theme.THEME_LIGHT){ - mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mThemeLight.setChecked(true); - }else if(pTheme == enums.Theme.THEME_DARK){ - mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mThemeDark.setChecked(true); - }else{ - mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mThemeDefault.setChecked(true); - } - } - - public Object onTrigger(settingGeneralEnums.eGeneralViewController pCommands, List pData){ - if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_SET_THEME)){ - setTheme((int)pData.get(0)); - } - else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_RESET_THEME)){ - resetThemeSelection(); - } - else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER)){ - updateThemeChanger(); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.generalManager; + +import android.content.res.ColorStateList; +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.RadioButton; +import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.Collections; +import java.util.List; + +import static com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralEnums.eGeneralViewCallback.M_RESET_THEME_INVOKED_BACK; + +class settingGeneralViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + private SwitchMaterial mFullScreenMode; + private SwitchMaterial mOpenURLInNewTab; + private RadioButton mThemeLight; + private RadioButton mThemeDark; + private RadioButton mThemeDefault; + private TextView mHomePageText; + + /*Initializations*/ + + + settingGeneralViewController(settingGeneralController pContext, eventObserver.eventListener pEvent, SwitchMaterial pFullScreenMode, RadioButton pThemeLight, RadioButton pThemeDark, RadioButton pThemeDefault, TextView pHomePageText, SwitchMaterial pOpenURLInNewTab) + { + this.mEvent = pEvent; + this.mContext = pContext; + this.mFullScreenMode = pFullScreenMode; + this.mThemeLight = pThemeLight; + this.mThemeDark = pThemeDark; + this.mThemeDefault = pThemeDefault; + this.mHomePageText = pHomePageText; + this.mOpenURLInNewTab = pOpenURLInNewTab; + + initViews(); + initPostUI(); + } + + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + private void initViews() + { + resetThemeSelection(); + + if(status.sTheme == enums.Theme.THEME_LIGHT){ + mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mThemeLight.setChecked(true); + }else if(status.sTheme == enums.Theme.THEME_DARK){ + mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mThemeDark.setChecked(true); + }else{ + mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mThemeDefault.setChecked(true); + } + + if(status.sFullScreenBrowsing){ + mFullScreenMode.setChecked(true); + }else { + mFullScreenMode.setChecked(false); + } + + if(status.sOpenURLInNewTab){ + mOpenURLInNewTab.setChecked(true); + }else { + mOpenURLInNewTab.setChecked(false); + } + + mHomePageText.setText(helperMethod.getDomainName(status.sSettingSearchStatus.replace("genesishiddentechnologies.com","genesis.onion"))); + } + + private void updateThemeChanger(){ + mEvent.invokeObserver(Collections.singletonList(status.sTheme), M_RESET_THEME_INVOKED_BACK); + } + + private void resetThemeSelection(){ + mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); + mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); + mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default))); + + mThemeDark.setChecked(false); + mThemeLight.setChecked(false); + mThemeDefault.setChecked(false); + } + + private void setTheme(int pTheme){ + + if(pTheme == enums.Theme.THEME_LIGHT){ + mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mThemeLight.setChecked(true); + }else if(pTheme == enums.Theme.THEME_DARK){ + mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mThemeDark.setChecked(true); + }else{ + mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mThemeDefault.setChecked(true); + } + } + + public Object onTrigger(settingGeneralEnums.eGeneralViewController pCommands, List pData){ + if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_SET_THEME)){ + setTheme((int)pData.get(0)); + } + else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_RESET_THEME)){ + resetThemeSelection(); + } + else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER)){ + updateThemeChanger(); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java index bc240850..b18f0c34 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java @@ -1,134 +1,134 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.logManager; - -import android.content.res.Configuration; -import android.os.Bundle; -import android.view.View; -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import static com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogEnums.eLogViewController.M_TOOGLE_LOG_VIEW; - -public class settingLogController extends AppCompatActivity { - - /* UI Variables */ - - private SwitchMaterial mLogThemeToggle; - - /* Private Variables */ - - private settingLogModel mSettingLogModel; - private settingLogViewController mSettingLogViewController; - - /* Initializations */ - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - activityContextManager.getInstance().onStack(this); - - super.onCreate(savedInstanceState); - setContentView(R.layout.setting_log_view); - - initializeViews(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - } - - private void initializeViews() { - mLogThemeToggle = findViewById(R.id.pLogThemeToggle); - - mSettingLogViewController = new settingLogViewController(this, new settingLogViewCallback(), mLogThemeToggle); - mSettingLogViewController.onTrigger(settingLogEnums.eLogViewController.M_INIT_VIEW, Collections.singletonList(status.sLogThemeStyleAdvanced)); - mSettingLogModel = new settingLogModel(new settingLogModelCallback()); - } - - /*View Callbacks*/ - - private class settingLogViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Model Callbacks*/ - - private class settingLogModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /* LOCAL OVERRIDES */ - - @Override - public void onResume() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - super.onResume(); - } - - @Override - public void onBackPressed() { - onClose(null); - } - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - /*UI Redirection*/ - - public void onClose(View view){ - finish(); - } - - public void onSwitchLogUIMode(View view){ - mSettingLogModel.onTrigger(settingLogEnums.eLogModel.M_SWITCH_LOG_VIEW, Collections.singletonList(!mLogThemeToggle.isChecked())); - mSettingLogViewController.onTrigger(M_TOOGLE_LOG_VIEW); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW, status.sLogThemeStyleAdvanced)); - - helperMethod.onDelayHandler(this, 250, () -> { - activityContextManager.getInstance().getOrbotLogController().onRefreshLayoutTheme(); - return null; - }); - } - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.logManager; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import static com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogEnums.eLogViewController.M_TOOGLE_LOG_VIEW; + +public class settingLogController extends AppCompatActivity { + + /* UI Variables */ + + private SwitchMaterial mLogThemeToggle; + + /* Private Variables */ + + private settingLogModel mSettingLogModel; + private settingLogViewController mSettingLogViewController; + + /* Initializations */ + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + activityContextManager.getInstance().onStack(this); + + super.onCreate(savedInstanceState); + setContentView(R.layout.setting_log_view); + + initializeViews(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + } + + private void initializeViews() { + mLogThemeToggle = findViewById(R.id.pLogThemeToggle); + + mSettingLogViewController = new settingLogViewController(this, new settingLogViewCallback(), mLogThemeToggle); + mSettingLogViewController.onTrigger(settingLogEnums.eLogViewController.M_INIT_VIEW, Collections.singletonList(status.sLogThemeStyleAdvanced)); + mSettingLogModel = new settingLogModel(new settingLogModelCallback()); + } + + /*View Callbacks*/ + + private class settingLogViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Model Callbacks*/ + + private class settingLogModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + } + + @Override + public void onBackPressed() { + onClose(null); + } + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + /*UI Redirection*/ + + public void onClose(View view){ + finish(); + } + + public void onSwitchLogUIMode(View view){ + mSettingLogModel.onTrigger(settingLogEnums.eLogModel.M_SWITCH_LOG_VIEW, Collections.singletonList(!mLogThemeToggle.isChecked())); + mSettingLogViewController.onTrigger(M_TOOGLE_LOG_VIEW); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW, status.sLogThemeStyleAdvanced)); + + helperMethod.onDelayHandler(this, 250, () -> { + activityContextManager.getInstance().getOrbotLogController().onRefreshLayoutTheme(); + return null; + }); + } + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogEnums.java index a6ccdd1d..eb10e840 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogEnums.java @@ -1,16 +1,16 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.logManager; - -class settingLogEnums -{ - /* Log Model */ - - public enum eLogModel { - M_SWITCH_LOG_VIEW - } - - /* Log View Controller */ - - public enum eLogViewController { - M_INIT_VIEW, M_TOOGLE_LOG_VIEW - } +package com.darkweb.genesissearchengine.appManager.settingManager.logManager; + +class settingLogEnums +{ + /* Log Model */ + + public enum eLogModel { + M_SWITCH_LOG_VIEW + } + + /* Log View Controller */ + + public enum eLogViewController { + M_INIT_VIEW, M_TOOGLE_LOG_VIEW + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogModel.java index b7bcbd1f..b76d950e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogModel.java @@ -1,33 +1,33 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.logManager; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; - -import java.util.List; - -class settingLogModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - settingLogModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - - private void onUpdateLogView(boolean pLogThemeStyle){ - status.sLogThemeStyleAdvanced = pLogThemeStyle; - } - - /*Helper Methods*/ - - public Object onTrigger(settingLogEnums.eLogModel pCommands, List pData){ - if(settingLogEnums.eLogModel.M_SWITCH_LOG_VIEW.equals(pCommands)){ - onUpdateLogView((boolean)pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.logManager; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; + +import java.util.List; + +class settingLogModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingLogModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + private void onUpdateLogView(boolean pLogThemeStyle){ + status.sLogThemeStyleAdvanced = pLogThemeStyle; + } + + /*Helper Methods*/ + + public Object onTrigger(settingLogEnums.eLogModel pCommands, List pData){ + if(settingLogEnums.eLogModel.M_SWITCH_LOG_VIEW.equals(pCommands)){ + onUpdateLogView((boolean)pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogViewController.java index 42a5ecf9..0eead9ba 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogViewController.java @@ -1,64 +1,64 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.logManager; - -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.List; - -class settingLogViewController -{ - /*Private Variables*/ - - private eventObserver.eventListener mEvent; - private AppCompatActivity mContext; - - private SwitchMaterial mLogThemeToggle; - - /*Initializations*/ - - settingLogViewController(settingLogController pContext, eventObserver.eventListener pEvent, SwitchMaterial pLogThemeToggle) - { - this.mLogThemeToggle = pLogThemeToggle; - this.mEvent = pEvent; - this.mContext = pContext; - - initPostUI(); - } - - private void initViews(boolean pLogThemeStyle) - { - if(pLogThemeStyle){ - mLogThemeToggle.setChecked(true); - }else { - mLogThemeToggle.setChecked(false); - } - } - - /*Helper Methods*/ - - private void toggleLogThemeStyle() - { - mLogThemeToggle.toggle(); - } - - private void initPostUI(){ - sharedUIMethod.updateStatusBar(mContext); - } - - /*Triggers*/ - - public Object onTrigger(settingLogEnums.eLogViewController pCommands, List pData){ - if(settingLogEnums.eLogViewController.M_TOOGLE_LOG_VIEW.equals(pCommands)){ - toggleLogThemeStyle(); - } - else if(settingLogEnums.eLogViewController.M_INIT_VIEW.equals(pCommands)){ - initViews((boolean)pData.get(0)); - } - return null; - } - - public Object onTrigger(settingLogEnums.eLogViewController pCommands){ - return onTrigger(pCommands, null); - } -} +package com.darkweb.genesissearchengine.appManager.settingManager.logManager; + +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.List; + +class settingLogViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + + private SwitchMaterial mLogThemeToggle; + + /*Initializations*/ + + settingLogViewController(settingLogController pContext, eventObserver.eventListener pEvent, SwitchMaterial pLogThemeToggle) + { + this.mLogThemeToggle = pLogThemeToggle; + this.mEvent = pEvent; + this.mContext = pContext; + + initPostUI(); + } + + private void initViews(boolean pLogThemeStyle) + { + if(pLogThemeStyle){ + mLogThemeToggle.setChecked(true); + }else { + mLogThemeToggle.setChecked(false); + } + } + + /*Helper Methods*/ + + private void toggleLogThemeStyle() + { + mLogThemeToggle.toggle(); + } + + private void initPostUI(){ + sharedUIMethod.updateStatusBar(mContext); + } + + /*Triggers*/ + + public Object onTrigger(settingLogEnums.eLogViewController pCommands, List pData){ + if(settingLogEnums.eLogViewController.M_TOOGLE_LOG_VIEW.equals(pCommands)){ + toggleLogThemeStyle(); + } + else if(settingLogEnums.eLogViewController.M_INIT_VIEW.equals(pCommands)){ + initViews((boolean)pData.get(0)); + } + return null; + } + + public Object onTrigger(settingLogEnums.eLogViewController pCommands){ + return onTrigger(pCommands, null); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java index 14d7899d..78dc69b8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java @@ -1,139 +1,139 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; - -import android.content.res.Configuration; -import android.os.Bundle; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class settingNotificationController extends AppCompatActivity { - - /* PRIVATE VARIABLES */ - - private SwitchMaterial mNotificationManual; - private settingNotificationModel mSettingNotificationModel; - private settingNotificationViewController mSettingNotificationViewController; - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - setContentView(R.layout.setting_notification_view); - - viewsInitializations(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - - } - - private void viewsInitializations() { - activityContextManager.getInstance().onStack(this); - mNotificationManual = findViewById(R.id.pNotificationManual); - mSettingNotificationViewController = new settingNotificationViewController(this, new settingNotificationViewCallback(), mNotificationManual); - - mSettingNotificationModel = new settingNotificationModel(new settingNotificationModelCallback()); - } - - /*View Callbacks*/ - - private class settingNotificationViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Model Callbacks*/ - - private class settingNotificationModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /* LOCAL OVERRIDES */ - - @Override - public void onResume() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - super.onResume(); - - int notificationStatus = status.sBridgeNotificationManual; - if(notificationStatus==0){ - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION); - } else{ - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION); - } - } - - @Override - public void onPause() - { - super.onPause(); - } - - @Override - public void onBackPressed() { - finish(); - } - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - /*UI Redirection*/ - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onClose(View view){ - finish(); - } - - public void onOpenNotificationSettings(View view){ - helperMethod.openNotification(this); - } - - public void onSaveLocalNotificationSettings(View view){ - mSettingNotificationModel.onTrigger(settingNotificationEnums.eNotificationModel.M_UPDATE_LOCAL_NOTIFICATION, Collections.singletonList(!mNotificationManual.isChecked())); - mNotificationManual.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS, status.sBridgeNotificationManual)); - } +package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class settingNotificationController extends AppCompatActivity { + + /* PRIVATE VARIABLES */ + + private SwitchMaterial mNotificationManual; + private settingNotificationModel mSettingNotificationModel; + private settingNotificationViewController mSettingNotificationViewController; + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + setContentView(R.layout.setting_notification_view); + + viewsInitializations(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + + } + + private void viewsInitializations() { + activityContextManager.getInstance().onStack(this); + mNotificationManual = findViewById(R.id.pNotificationManual); + mSettingNotificationViewController = new settingNotificationViewController(this, new settingNotificationViewCallback(), mNotificationManual); + + mSettingNotificationModel = new settingNotificationModel(new settingNotificationModelCallback()); + } + + /*View Callbacks*/ + + private class settingNotificationViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Model Callbacks*/ + + private class settingNotificationModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + + int notificationStatus = status.sBridgeNotificationManual; + if(notificationStatus==0){ + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION); + } else{ + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION); + } + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + finish(); + } + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + /*UI Redirection*/ + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onClose(View view){ + finish(); + } + + public void onOpenNotificationSettings(View view){ + helperMethod.openNotification(this); + } + + public void onSaveLocalNotificationSettings(View view){ + mSettingNotificationModel.onTrigger(settingNotificationEnums.eNotificationModel.M_UPDATE_LOCAL_NOTIFICATION, Collections.singletonList(!mNotificationManual.isChecked())); + mNotificationManual.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS, status.sBridgeNotificationManual)); + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationEnums.java index 77599c2e..36c7c18b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationEnums.java @@ -1,14 +1,14 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; - -class settingNotificationEnums -{ - /*History Manager*/ - public enum eNotificationModel { - M_UPDATE_LOCAL_NOTIFICATION - } - - public enum eNotificationViewController { - - } - +package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; + +class settingNotificationEnums +{ + /*History Manager*/ + public enum eNotificationModel { + M_UPDATE_LOCAL_NOTIFICATION + } + + public enum eNotificationViewController { + + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationModel.java index b9a86dfe..233fe388 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationModel.java @@ -1,43 +1,43 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; - -import java.util.List; - -class settingNotificationModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - settingNotificationModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - - - /*Helper Methods*/ - - private void updateLocalNotification(boolean pStatus){ - - int mStatus = pStatus ? 1 : 0; - status.sBridgeNotificationManual = mStatus; - if(!pStatus){ - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION); - } else{ - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION); - } - } - - public Object onTrigger(settingNotificationEnums.eNotificationModel pCommands, List pData){ - if(pCommands.equals(settingNotificationEnums.eNotificationModel.M_UPDATE_LOCAL_NOTIFICATION)){ - updateLocalNotification((boolean)pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; + +import java.util.List; + +class settingNotificationModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingNotificationModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + + /*Helper Methods*/ + + private void updateLocalNotification(boolean pStatus){ + + int mStatus = pStatus ? 1 : 0; + status.sBridgeNotificationManual = mStatus; + if(!pStatus){ + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION); + } else{ + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION); + } + } + + public Object onTrigger(settingNotificationEnums.eNotificationModel pCommands, List pData){ + if(pCommands.equals(settingNotificationEnums.eNotificationModel.M_UPDATE_LOCAL_NOTIFICATION)){ + updateLocalNotification((boolean)pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationViewController.java index a67e0b3f..44872c7f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationViewController.java @@ -1,63 +1,63 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; - -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; - -class settingNotificationViewController -{ - /*Private Variables*/ - - private eventObserver.eventListener mEvent; - private AppCompatActivity mContext; - - private SwitchMaterial mNotificationManual; - - /*Initializations*/ - - settingNotificationViewController(settingNotificationController pContext, eventObserver.eventListener pEvent, SwitchMaterial pNotificationManual) - { - this.mNotificationManual = pNotificationManual; - this.mEvent = pEvent; - this.mContext = pContext; - - initViews(); - initPostUI(); - } - - private void initViews() - { - if(status.sBridgeNotificationManual == 1){ - mNotificationManual.setChecked(true); - }else { - mNotificationManual.setChecked(false); - } - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; + +class settingNotificationViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + + private SwitchMaterial mNotificationManual; + + /*Initializations*/ + + settingNotificationViewController(settingNotificationController pContext, eventObserver.eventListener pEvent, SwitchMaterial pNotificationManual) + { + this.mNotificationManual = pNotificationManual; + this.mEvent = pEvent; + this.mContext = pContext; + + initViews(); + initPostUI(); + } + + private void initViews() + { + if(status.sBridgeNotificationManual == 1){ + mNotificationManual.setChecked(true); + }else { + mNotificationManual.setChecked(false); + } + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java index a7a5d126..a0f1c06a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java @@ -1,181 +1,181 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; - -import android.content.res.Configuration; -import android.os.Bundle; -import android.view.View; -import android.widget.RadioButton; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.appManager.settingManager.trackingManager.settingTrackingController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class settingPrivacyController extends AppCompatActivity { - - /* PRIVATE VARIABLES */ - private settingPrivacyModel mSettingPrivacyModel; - private settingPrivacyViewController mSettingPrivacyViewController; - private SwitchMaterial mJavaScript; - private SwitchMaterial mPopup; - private SwitchMaterial mDoNotTrack; - private SwitchMaterial mClearDataOnExit; - private ArrayList mCookie = new ArrayList<>(); - private boolean mSettingChanged = false; - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - - setContentView(R.layout.setting_privacy_view); - - viewsInitializations(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - - } - - private void viewsInitializations() { - mJavaScript = findViewById(R.id.pJavascript); - mDoNotTrack = findViewById(R.id.pDoNotTrack); - mClearDataOnExit = findViewById(R.id.pClearDataOnExit); - mPopup = findViewById(R.id.pPopup); - mCookie.add(findViewById(R.id.pCookieRadioOption1)); - mCookie.add(findViewById(R.id.pCookieRadioOption2)); - mCookie.add(findViewById(R.id.pCookieRadioOption3)); - mCookie.add(findViewById(R.id.pCookieRadioOption4)); - - activityContextManager.getInstance().onStack(this); - mSettingPrivacyViewController = new settingPrivacyViewController(this, new settingPrivacyController.settingAccessibilityViewCallback(), mJavaScript, mDoNotTrack, mClearDataOnExit, mCookie, mPopup); - mSettingPrivacyModel = new settingPrivacyModel(new settingPrivacyController.settingAccessibilityModelCallback()); - } - - /*View Callbacks*/ - - private class settingAccessibilityViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Model Callbacks*/ - - private class settingAccessibilityModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /* LOCAL OVERRIDES */ - - @Override - public void onResume() - { - if(mSettingChanged){ - activityContextManager.getInstance().setCurrentActivity(this); - } - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - super.onResume(); - } - - @Override - public void onPause() - { - super.onPause(); - } - - @Override - public void onBackPressed() { - if(mSettingChanged){ - activityContextManager.getInstance().setCurrentActivity(this); - activityContextManager.getInstance().getHomeController().initRuntimeSettings(); - } - finish(); - } - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - /*UI Redirection*/ - - public void onClose(View view){ - onBackPressed(); - } - - public void onJavaScript(View view){ - mSettingChanged = true; - mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_JAVASCRIPT, Collections.singletonList(!status.sSettingJavaStatus)); - mJavaScript.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,status.sSettingJavaStatus)); - } - - public void onPopup(View view){ - mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_POPUP, Collections.singletonList(!status.sSettingPopupStatus)); - mPopup.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,status.sSettingPopupStatus)); - } - - public void onDoNotTrack(View view){ - mSettingChanged = true; - mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_DONOT_TRACK, Collections.singletonList(!status.sStatusDoNotTrack)); - mDoNotTrack.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,status.sStatusDoNotTrack)); - } - - public void onCookies(View view){ - mSettingChanged = true; - mSettingPrivacyViewController.onTrigger(settingPrivacyEnums.ePrivacyViewController.M_SET_COOKIE_STATUS, Collections.singletonList(view)); - mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_COOKIES, Collections.singletonList(view)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,status.sSettingCookieStatus)); - } - - public void onClearPrivateData(View view){ - mSettingChanged = true; - mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_CLEAR_PRIVATE_DATA, Collections.singletonList(!status.sClearOnExit)); - mClearDataOnExit.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,status.sClearOnExit)); - } - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onManageTracking(View view) { - helperMethod.openActivity(settingTrackingController.class, constants.CONST_LIST_HISTORY, this,true); - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; +import android.widget.RadioButton; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.appManager.settingManager.trackingManager.settingTrackingController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class settingPrivacyController extends AppCompatActivity { + + /* PRIVATE VARIABLES */ + private settingPrivacyModel mSettingPrivacyModel; + private settingPrivacyViewController mSettingPrivacyViewController; + private SwitchMaterial mJavaScript; + private SwitchMaterial mPopup; + private SwitchMaterial mDoNotTrack; + private SwitchMaterial mClearDataOnExit; + private ArrayList mCookie = new ArrayList<>(); + private boolean mSettingChanged = false; + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + + setContentView(R.layout.setting_privacy_view); + + viewsInitializations(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + + } + + private void viewsInitializations() { + mJavaScript = findViewById(R.id.pJavascript); + mDoNotTrack = findViewById(R.id.pDoNotTrack); + mClearDataOnExit = findViewById(R.id.pClearDataOnExit); + mPopup = findViewById(R.id.pPopup); + mCookie.add(findViewById(R.id.pCookieRadioOption1)); + mCookie.add(findViewById(R.id.pCookieRadioOption2)); + mCookie.add(findViewById(R.id.pCookieRadioOption3)); + mCookie.add(findViewById(R.id.pCookieRadioOption4)); + + activityContextManager.getInstance().onStack(this); + mSettingPrivacyViewController = new settingPrivacyViewController(this, new settingPrivacyController.settingAccessibilityViewCallback(), mJavaScript, mDoNotTrack, mClearDataOnExit, mCookie, mPopup); + mSettingPrivacyModel = new settingPrivacyModel(new settingPrivacyController.settingAccessibilityModelCallback()); + } + + /*View Callbacks*/ + + private class settingAccessibilityViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Model Callbacks*/ + + private class settingAccessibilityModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + if(mSettingChanged){ + activityContextManager.getInstance().setCurrentActivity(this); + } + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + super.onResume(); + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + if(mSettingChanged){ + activityContextManager.getInstance().setCurrentActivity(this); + activityContextManager.getInstance().getHomeController().initRuntimeSettings(); + } + finish(); + } + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + /*UI Redirection*/ + + public void onClose(View view){ + onBackPressed(); + } + + public void onJavaScript(View view){ + mSettingChanged = true; + mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_JAVASCRIPT, Collections.singletonList(!status.sSettingJavaStatus)); + mJavaScript.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,status.sSettingJavaStatus)); + } + + public void onPopup(View view){ + mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_POPUP, Collections.singletonList(!status.sSettingPopupStatus)); + mPopup.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,status.sSettingPopupStatus)); + } + + public void onDoNotTrack(View view){ + mSettingChanged = true; + mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_DONOT_TRACK, Collections.singletonList(!status.sStatusDoNotTrack)); + mDoNotTrack.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,status.sStatusDoNotTrack)); + } + + public void onCookies(View view){ + mSettingChanged = true; + mSettingPrivacyViewController.onTrigger(settingPrivacyEnums.ePrivacyViewController.M_SET_COOKIE_STATUS, Collections.singletonList(view)); + mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_COOKIES, Collections.singletonList(view)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,status.sSettingCookieStatus)); + } + + public void onClearPrivateData(View view){ + mSettingChanged = true; + mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_CLEAR_PRIVATE_DATA, Collections.singletonList(!status.sClearOnExit)); + mClearDataOnExit.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,status.sClearOnExit)); + } + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onManageTracking(View view) { + helperMethod.openActivity(settingTrackingController.class, constants.CONST_LIST_HISTORY, this,true); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java index 41975f12..d5152e54 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java @@ -1,14 +1,14 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; - -class settingPrivacyEnums -{ - /*Privacy Manager*/ - public enum ePrivacyModel { - M_SET_JAVASCRIPT, M_SET_POPUP, M_SET_DONOT_TRACK, M_SET_COOKIES, M_SET_CLEAR_PRIVATE_DATA - } - - public enum ePrivacyViewController { - M_SET_COOKIE_STATUS - } - +package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; + +class settingPrivacyEnums +{ + /*Privacy Manager*/ + public enum ePrivacyModel { + M_SET_JAVASCRIPT, M_SET_POPUP, M_SET_DONOT_TRACK, M_SET_COOKIES, M_SET_CLEAR_PRIVATE_DATA + } + + public enum ePrivacyViewController { + M_SET_COOKIE_STATUS + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java index fe002d59..57bc1949 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java @@ -1,79 +1,79 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; - -import android.view.View; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; - -import java.util.List; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_ALL; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NONE; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS; - -class settingPrivacyModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - settingPrivacyModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - - /*Helper Methods*/ - - private void onJavaScript(boolean pStatus){ - status.sSettingJavaStatus = pStatus; - } - - private void onDoNotTrack(boolean pStatus){ - status.sStatusDoNotTrack = pStatus; - } - - private void onPopup(boolean pStatus){ - status.sSettingPopupStatus = pStatus; - } - - private void onCookies(View pView){ - if(pView.getId() == R.id.pCookieOption1){ - status.sSettingCookieStatus = ACCEPT_ALL; - } - if(pView.getId() == R.id.pCookieOption2){ - status.sSettingCookieStatus = ACCEPT_NON_TRACKERS; - } - if(pView.getId() == R.id.pCookieOption3){ - status.sSettingCookieStatus = ACCEPT_FIRST_PARTY; - } - if(pView.getId() == R.id.pCookieOption4){ - status.sSettingCookieStatus = ACCEPT_NONE; - } - } - - private void onClearPrivateData(boolean pStatus){ - status.sClearOnExit = pStatus; - } - - public Object onTrigger(settingPrivacyEnums.ePrivacyModel pCommands, List pData){ - if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_JAVASCRIPT)){ - onJavaScript((boolean)pData.get(0)); - } - else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_DONOT_TRACK)){ - onDoNotTrack((boolean)pData.get(0)); - } - else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_POPUP)){ - onPopup((boolean)pData.get(0)); - } - else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_COOKIES)){ - onCookies((View) pData.get(0)); - } - else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_CLEAR_PRIVATE_DATA)){ - onClearPrivateData((Boolean) pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; + +import android.view.View; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; + +import java.util.List; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_ALL; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NONE; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS; + +class settingPrivacyModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingPrivacyModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + /*Helper Methods*/ + + private void onJavaScript(boolean pStatus){ + status.sSettingJavaStatus = pStatus; + } + + private void onDoNotTrack(boolean pStatus){ + status.sStatusDoNotTrack = pStatus; + } + + private void onPopup(boolean pStatus){ + status.sSettingPopupStatus = pStatus; + } + + private void onCookies(View pView){ + if(pView.getId() == R.id.pCookieOption1){ + status.sSettingCookieStatus = ACCEPT_ALL; + } + if(pView.getId() == R.id.pCookieOption2){ + status.sSettingCookieStatus = ACCEPT_NON_TRACKERS; + } + if(pView.getId() == R.id.pCookieOption3){ + status.sSettingCookieStatus = ACCEPT_FIRST_PARTY; + } + if(pView.getId() == R.id.pCookieOption4){ + status.sSettingCookieStatus = ACCEPT_NONE; + } + } + + private void onClearPrivateData(boolean pStatus){ + status.sClearOnExit = pStatus; + } + + public Object onTrigger(settingPrivacyEnums.ePrivacyModel pCommands, List pData){ + if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_JAVASCRIPT)){ + onJavaScript((boolean)pData.get(0)); + } + else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_DONOT_TRACK)){ + onDoNotTrack((boolean)pData.get(0)); + } + else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_POPUP)){ + onPopup((boolean)pData.get(0)); + } + else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_COOKIES)){ + onCookies((View) pData.get(0)); + } + else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_CLEAR_PRIVATE_DATA)){ + onClearPrivateData((Boolean) pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java index 80c7cfbe..3c78cc59 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java @@ -1,149 +1,149 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; - -import android.content.res.ColorStateList; -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.RadioButton; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.ArrayList; -import java.util.List; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_ALL; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NONE; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS; - -class settingPrivacyViewController -{ - /*Private Variables*/ - - private eventObserver.eventListener mEvent; - private AppCompatActivity mContext; - private SwitchMaterial mJavaScript; - private SwitchMaterial mDoNotTrack; - private SwitchMaterial mClearDataOnExit; - private ArrayList mCookie; - private SwitchMaterial mPopup; - - /*Initializations*/ - - settingPrivacyViewController(settingPrivacyController pContext, eventObserver.eventListener pEvent, SwitchMaterial pJavaScript, SwitchMaterial pDoNotTrack, SwitchMaterial pClearDataOnExit, ArrayList pCookie, SwitchMaterial pPopup) - { - this.mEvent = pEvent; - this.mContext = pContext; - this.mJavaScript = pJavaScript; - this.mClearDataOnExit = pClearDataOnExit; - this.mCookie = pCookie; - this.mDoNotTrack = pDoNotTrack; - this.mPopup = pPopup; - - initViews(); - initPostUI(); - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - private void initViews(){ - if(status.sSettingJavaStatus){ - this.mJavaScript.setChecked(true); - }else{ - this.mJavaScript.setChecked(false); - } - - if(status.sSettingPopupStatus){ - this.mPopup.setChecked(true); - }else{ - this.mPopup.setChecked(false); - } - - if(status.sClearOnExit){ - this.mClearDataOnExit.setChecked(true); - }else{ - this.mClearDataOnExit.setChecked(false); - } - - if(status.sStatusDoNotTrack){ - this.mDoNotTrack.setChecked(true); - }else{ - this.mDoNotTrack.setChecked(false); - } - - clearCookieSetting(); - if(status.sSettingCookieStatus == ACCEPT_ALL){ - mCookie.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mCookie.get(0).setChecked(true); - } - if(status.sSettingCookieStatus == ACCEPT_NON_TRACKERS){ - mCookie.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mCookie.get(1).setChecked(true); - } - if(status.sSettingCookieStatus == ACCEPT_FIRST_PARTY){ - mCookie.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mCookie.get(2).setChecked(true); - } - if(status.sSettingCookieStatus == ACCEPT_NONE){ - mCookie.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mCookie.get(3).setChecked(true); - } - - } - - private void clearCookieSetting(){ - for(int mCounter=0; mCounter pData){ - if(pCommands.equals(settingPrivacyEnums.ePrivacyViewController.M_SET_COOKIE_STATUS)){ - setCookieStatus((View)pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager; + +import android.content.res.ColorStateList; +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.RadioButton; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.ArrayList; +import java.util.List; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_ALL; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NONE; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS; + +class settingPrivacyViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + private SwitchMaterial mJavaScript; + private SwitchMaterial mDoNotTrack; + private SwitchMaterial mClearDataOnExit; + private ArrayList mCookie; + private SwitchMaterial mPopup; + + /*Initializations*/ + + settingPrivacyViewController(settingPrivacyController pContext, eventObserver.eventListener pEvent, SwitchMaterial pJavaScript, SwitchMaterial pDoNotTrack, SwitchMaterial pClearDataOnExit, ArrayList pCookie, SwitchMaterial pPopup) + { + this.mEvent = pEvent; + this.mContext = pContext; + this.mJavaScript = pJavaScript; + this.mClearDataOnExit = pClearDataOnExit; + this.mCookie = pCookie; + this.mDoNotTrack = pDoNotTrack; + this.mPopup = pPopup; + + initViews(); + initPostUI(); + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + private void initViews(){ + if(status.sSettingJavaStatus){ + this.mJavaScript.setChecked(true); + }else{ + this.mJavaScript.setChecked(false); + } + + if(status.sSettingPopupStatus){ + this.mPopup.setChecked(true); + }else{ + this.mPopup.setChecked(false); + } + + if(status.sClearOnExit){ + this.mClearDataOnExit.setChecked(true); + }else{ + this.mClearDataOnExit.setChecked(false); + } + + if(status.sStatusDoNotTrack){ + this.mDoNotTrack.setChecked(true); + }else{ + this.mDoNotTrack.setChecked(false); + } + + clearCookieSetting(); + if(status.sSettingCookieStatus == ACCEPT_ALL){ + mCookie.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mCookie.get(0).setChecked(true); + } + if(status.sSettingCookieStatus == ACCEPT_NON_TRACKERS){ + mCookie.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mCookie.get(1).setChecked(true); + } + if(status.sSettingCookieStatus == ACCEPT_FIRST_PARTY){ + mCookie.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mCookie.get(2).setChecked(true); + } + if(status.sSettingCookieStatus == ACCEPT_NONE){ + mCookie.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mCookie.get(3).setChecked(true); + } + + } + + private void clearCookieSetting(){ + for(int mCounter=0; mCounter pData){ + if(pCommands.equals(settingPrivacyEnums.ePrivacyViewController.M_SET_COOKIE_STATUS)){ + setCookieStatus((View)pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java index bf59f71c..dd9f1d01 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java @@ -1,171 +1,171 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; - -import android.content.res.Configuration; -import android.os.Bundle; -import android.view.View; -import android.widget.RadioButton; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class settingSearchController extends AppCompatActivity { - - /* PRIVATE VARIABLES */ - private ArrayList mSearchEngines = new ArrayList<>(); - private SwitchMaterial mSearchHistory; - private SwitchMaterial mSearchSuggestions; - private settingSearchModel mSettingSearchModel; - private settingSearchViewController mSettingSearchViewController; - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - setContentView(R.layout.setting_search_view); - - viewsInitializations(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - - } - - private void viewsInitializations() { - mSearchEngines.add(findViewById(R.id.mRadioSearch_1)); - mSearchEngines.add(findViewById(R.id.mRadioSearch_2)); - mSearchEngines.add(findViewById(R.id.mRadioSearch_3)); - mSearchEngines.add(findViewById(R.id.mRadioSearch_4)); - mSearchEngines.add(findViewById(R.id.mRadioSearch_5)); - mSearchHistory = findViewById(R.id.pSearchHistory); - mSearchSuggestions = findViewById(R.id.pSearchSuggestions); - - activityContextManager.getInstance().onStack(this); - mSettingSearchViewController = new settingSearchViewController(this, new settingSearchViewCallback(), mSearchEngines, mSearchHistory, mSearchSuggestions); - mSettingSearchModel = new settingSearchModel(new settingSearchModelCallback()); - } - - /*View Callbacks*/ - - private class settingSearchViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Model Callbacks*/ - - private class settingSearchModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /* LOCAL OVERRIDES */ - - @Override - public void onResume() - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - super.onResume(); - - } - - @Override - public void onPause() - { - super.onPause(); - } - - @Override - public void onBackPressed() { - activityContextManager.getInstance().onRemoveStack(this); - finish(); - } - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - /*UI Redirection*/ - - public void onClose(View view){ - finish(); - } - - public void onSelectSearchEngine(View view) { - if(view.getId() == R.id.pOption1){ - mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_GENESIS_URL)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingSearchStatus)); - } - else if(view.getId() == R.id.pOption2){ - mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_DUCK_DUCK_GO_URL)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingSearchStatus)); - } - else if(view.getId() == R.id.pOption3){ - mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingSearchStatus)); - } - else if(view.getId() == R.id.pOption4){ - mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_BING_URL)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingSearchStatus)); - } - else if(view.getId() == R.id.pOption5){ - mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_WIKI_URL)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingSearchStatus)); - } - - mSettingSearchViewController.onTrigger(settingSearchEnums.eSearchViewController.M_RESET_SEARCH_ENGINE, Collections.singletonList(null)); - mSettingSearchViewController.onTrigger(settingSearchEnums.eSearchViewController.M_INIT_SEARCH_ENGINE, Collections.singletonList(null)); - } - - public void setSearchHistory(View view){ - mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_HISTORY, Collections.singletonList(!mSearchHistory.isChecked())); - mSearchHistory.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY, status.sSettingSearchHistory)); - } - - public void setSuggestionStatus(View view){ - mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_SUGGESTION_STATUS, Collections.singletonList(!mSearchSuggestions.isChecked())); - mSearchSuggestions.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION, status.sSearchSuggestionStatus)); - } - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - +package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; +import android.widget.RadioButton; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class settingSearchController extends AppCompatActivity { + + /* PRIVATE VARIABLES */ + private ArrayList mSearchEngines = new ArrayList<>(); + private SwitchMaterial mSearchHistory; + private SwitchMaterial mSearchSuggestions; + private settingSearchModel mSettingSearchModel; + private settingSearchViewController mSettingSearchViewController; + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + setContentView(R.layout.setting_search_view); + + viewsInitializations(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + + } + + private void viewsInitializations() { + mSearchEngines.add(findViewById(R.id.mRadioSearch_1)); + mSearchEngines.add(findViewById(R.id.mRadioSearch_2)); + mSearchEngines.add(findViewById(R.id.mRadioSearch_3)); + mSearchEngines.add(findViewById(R.id.mRadioSearch_4)); + mSearchEngines.add(findViewById(R.id.mRadioSearch_5)); + mSearchHistory = findViewById(R.id.pSearchHistory); + mSearchSuggestions = findViewById(R.id.pSearchSuggestions); + + activityContextManager.getInstance().onStack(this); + mSettingSearchViewController = new settingSearchViewController(this, new settingSearchViewCallback(), mSearchEngines, mSearchHistory, mSearchSuggestions); + mSettingSearchModel = new settingSearchModel(new settingSearchModelCallback()); + } + + /*View Callbacks*/ + + private class settingSearchViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Model Callbacks*/ + + private class settingSearchModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + activityContextManager.getInstance().onRemoveStack(this); + finish(); + } + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + /*UI Redirection*/ + + public void onClose(View view){ + finish(); + } + + public void onSelectSearchEngine(View view) { + if(view.getId() == R.id.pOption1){ + mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_GENESIS_URL)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingSearchStatus)); + } + else if(view.getId() == R.id.pOption2){ + mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_DUCK_DUCK_GO_URL)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingSearchStatus)); + } + else if(view.getId() == R.id.pOption3){ + mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingSearchStatus)); + } + else if(view.getId() == R.id.pOption4){ + mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_BING_URL)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingSearchStatus)); + } + else if(view.getId() == R.id.pOption5){ + mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_WIKI_URL)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingSearchStatus)); + } + + mSettingSearchViewController.onTrigger(settingSearchEnums.eSearchViewController.M_RESET_SEARCH_ENGINE, Collections.singletonList(null)); + mSettingSearchViewController.onTrigger(settingSearchEnums.eSearchViewController.M_INIT_SEARCH_ENGINE, Collections.singletonList(null)); + } + + public void setSearchHistory(View view){ + mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_HISTORY, Collections.singletonList(!mSearchHistory.isChecked())); + mSearchHistory.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY, status.sSettingSearchHistory)); + } + + public void setSuggestionStatus(View view){ + mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_SUGGESTION_STATUS, Collections.singletonList(!mSearchSuggestions.isChecked())); + mSearchSuggestions.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION, status.sSearchSuggestionStatus)); + } + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchEnums.java index 7b48a63f..ff67cdfd 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchEnums.java @@ -1,14 +1,14 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; - -class settingSearchEnums -{ - /*History Manager*/ - public enum eSearchModel { - M_SET_SEARCH_ENGINE, M_SET_SEARCH_HISTORY, M_SET_SEARCH_SUGGESTION_STATUS - } - - public enum eSearchViewController { - M_INIT_SEARCH_ENGINE, M_RESET_SEARCH_ENGINE - } - +package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; + +class settingSearchEnums +{ + /*History Manager*/ + public enum eSearchModel { + M_SET_SEARCH_ENGINE, M_SET_SEARCH_HISTORY, M_SET_SEARCH_SUGGESTION_STATUS + } + + public enum eSearchViewController { + M_INIT_SEARCH_ENGINE, M_RESET_SEARCH_ENGINE + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchModel.java index 6daabc66..a1a1311e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchModel.java @@ -1,49 +1,49 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import java.util.List; - - -class settingSearchModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - settingSearchModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - - - /*Helper Methods*/ - - private void onSetSearchEngine(String pUrl){ - status.sSettingSearchStatus = pUrl; - } - - private void setSearchHistory(boolean pStatus){ - status.sSettingSearchHistory = pStatus; - } - private void setSearchSuggestionStatus(boolean pStatus){ - status.sSearchSuggestionStatus = pStatus; - } - - public Object onTrigger(settingSearchEnums.eSearchModel pCommands, List pData){ - if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE)){ - onSetSearchEngine((String) pData.get(0)); - } - else if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_HISTORY)){ - - setSearchHistory((boolean) pData.get(0)); - } - else if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_SUGGESTION_STATUS)){ - - setSearchSuggestionStatus((boolean) pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import java.util.List; + + +class settingSearchModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingSearchModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + + /*Helper Methods*/ + + private void onSetSearchEngine(String pUrl){ + status.sSettingSearchStatus = pUrl; + } + + private void setSearchHistory(boolean pStatus){ + status.sSettingSearchHistory = pStatus; + } + private void setSearchSuggestionStatus(boolean pStatus){ + status.sSearchSuggestionStatus = pStatus; + } + + public Object onTrigger(settingSearchEnums.eSearchModel pCommands, List pData){ + if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE)){ + onSetSearchEngine((String) pData.get(0)); + } + else if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_HISTORY)){ + + setSearchHistory((boolean) pData.get(0)); + } + else if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_SUGGESTION_STATUS)){ + + setSearchSuggestionStatus((boolean) pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchViewController.java index 5f5cea49..e8ae5050 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchViewController.java @@ -1,120 +1,120 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; - -import android.content.res.ColorStateList; -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.RadioButton; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import java.util.ArrayList; -import java.util.List; - -class settingSearchViewController -{ - /*Private Variables*/ - - private eventObserver.eventListener mEvent; - private AppCompatActivity mContext; - private ArrayList mSearchEngines; - private SwitchMaterial mSearchHistory; - private SwitchMaterial mSearchSuggestions; - - /*Initializations*/ - - settingSearchViewController(settingSearchController pContext, eventObserver.eventListener pEvent, ArrayList pSearchEngines, SwitchMaterial pSearchHistory, SwitchMaterial pSearchSuggestions) - { - this.mEvent = pEvent; - this.mContext = pContext; - this.mSearchEngines = pSearchEngines; - this.mSearchHistory = pSearchHistory; - this.mSearchSuggestions = pSearchSuggestions; - - initViews(); - initPostUI(); - } - - private void initViews() - { - initSearchEngine(); - initSearchViews(); - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - private void initSearchViews(){ - if(status.sSettingSearchHistory){ - mSearchHistory.setChecked(true); - } - if(status.sSearchSuggestionStatus){ - mSearchSuggestions.setChecked(true); - } - } - - private void initSearchEngine(){ - resetSearchEngine(); - switch (status.sSettingSearchStatus) { - case constants.CONST_BACKEND_GOOGLE_URL: - mSearchEngines.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mSearchEngines.get(2).setChecked(true); - break; - case constants.CONST_BACKEND_GENESIS_URL: - mSearchEngines.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mSearchEngines.get(0).setChecked(true); - break; - case constants.CONST_BACKEND_DUCK_DUCK_GO_URL: - mSearchEngines.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mSearchEngines.get(1).setChecked(true); - break; - case constants.CONST_BACKEND_BING_URL: - mSearchEngines.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mSearchEngines.get(3).setChecked(true); - break; - case constants.CONST_BACKEND_WIKI_URL: - mSearchEngines.get(4).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mSearchEngines.get(4).setChecked(true); - break; - } - } - - private void resetSearchEngine(){ - for(int mCounter=0;mCounter pData){ - if(pCommands.equals(settingSearchEnums.eSearchViewController.M_INIT_SEARCH_ENGINE)){ - initSearchEngine(); - } - else if(pCommands.equals(settingSearchEnums.eSearchViewController.M_RESET_SEARCH_ENGINE)){ - resetSearchEngine(); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager; + +import android.content.res.ColorStateList; +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.RadioButton; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import java.util.ArrayList; +import java.util.List; + +class settingSearchViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + private ArrayList mSearchEngines; + private SwitchMaterial mSearchHistory; + private SwitchMaterial mSearchSuggestions; + + /*Initializations*/ + + settingSearchViewController(settingSearchController pContext, eventObserver.eventListener pEvent, ArrayList pSearchEngines, SwitchMaterial pSearchHistory, SwitchMaterial pSearchSuggestions) + { + this.mEvent = pEvent; + this.mContext = pContext; + this.mSearchEngines = pSearchEngines; + this.mSearchHistory = pSearchHistory; + this.mSearchSuggestions = pSearchSuggestions; + + initViews(); + initPostUI(); + } + + private void initViews() + { + initSearchEngine(); + initSearchViews(); + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + private void initSearchViews(){ + if(status.sSettingSearchHistory){ + mSearchHistory.setChecked(true); + } + if(status.sSearchSuggestionStatus){ + mSearchSuggestions.setChecked(true); + } + } + + private void initSearchEngine(){ + resetSearchEngine(); + switch (status.sSettingSearchStatus) { + case constants.CONST_BACKEND_GOOGLE_URL: + mSearchEngines.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mSearchEngines.get(2).setChecked(true); + break; + case constants.CONST_BACKEND_GENESIS_URL: + mSearchEngines.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mSearchEngines.get(0).setChecked(true); + break; + case constants.CONST_BACKEND_DUCK_DUCK_GO_URL: + mSearchEngines.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mSearchEngines.get(1).setChecked(true); + break; + case constants.CONST_BACKEND_BING_URL: + mSearchEngines.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mSearchEngines.get(3).setChecked(true); + break; + case constants.CONST_BACKEND_WIKI_URL: + mSearchEngines.get(4).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mSearchEngines.get(4).setChecked(true); + break; + } + } + + private void resetSearchEngine(){ + for(int mCounter=0;mCounter pData){ + if(pCommands.equals(settingSearchEnums.eSearchViewController.M_INIT_SEARCH_ENGINE)){ + initSearchEngine(); + } + else if(pCommands.equals(settingSearchEnums.eSearchViewController.M_RESET_SEARCH_ENGINE)){ + resetSearchEngine(); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java index 52de6583..2600661f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java @@ -1,254 +1,254 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; - -import android.content.Intent; -import android.content.res.Configuration; -import android.os.Build; -import android.os.Bundle; -import android.view.View; -import android.widget.Toast; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.appManager.proxyStatusManager.proxyStatusController; -import com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController; -import com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController; -import com.darkweb.genesissearchengine.appManager.settingManager.clearManager.settingClearController; -import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController; -import com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController; -import com.darkweb.genesissearchengine.appManager.settingManager.privacyManager.settingPrivacyController; -import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; -import com.darkweb.genesissearchengine.appManager.settingManager.trackingManager.settingTrackingController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; - -public class settingHomeController extends AppCompatActivity -{ - /*Private Observer Classes*/ - - private settingHomeViewController mSettingViewController; - private settingHomeModel mSettingModel; - - /*Initializations*/ - - public settingHomeController(){ - mSettingModel = new settingHomeModel(new settingModelCallback()); - } - - @Override - protected void onCreate(Bundle savedInstanceState) - { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - if(!status.mThemeApplying){ - activityContextManager.getInstance().onStack(this); - } - - setContentView(R.layout.setting); - viewsInitializations(); - listenersInitializations(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - if(activityThemeManager.getInstance().onInitTheme(this) && !status.mThemeApplying){ - activityContextManager.getInstance().onResetTheme(); - } - - super.onConfigurationChanged(newConfig); - } - - private void viewsInitializations() - { - activityContextManager.getInstance().setSettingController(this); - mSettingViewController = new settingHomeViewController(this, new settingViewCallback()); - } - - private void listenersInitializations() - { - } - - public void cicadaClipboard(View view) { - Toast.makeText(getApplicationContext(),"Authorization Failed", Toast.LENGTH_SHORT).show(); - } - - /*View Callbacks*/ - - private class settingViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Model Callbacks*/ - - private class settingModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Local Overrides*/ - - @Override - public void onTrimMemory(int level) - { - if(status.sSettingIsAppPaused && (level==80 || level==15)) - { - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HOME_LOW_MEMORY,true)); - finish(); - } - } - - @Override - public void onResume() - { - if(status.mThemeApplying){ - // activityContextManager.getInstance().onStack(this); - } - - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - activityContextManager.getInstance().setCurrentActivity(this); - status.sSettingIsAppPaused = false; - super.onResume(); - } - - @Override - public void onPause() - { - super.onPause(); - } - - - @Override - public void onBackPressed(){ - finish(); - } - - @Override - protected void onDestroy() { - if(!status.mThemeApplying){ - activityContextManager.getInstance().onRemoveStack(this); - } - activityContextManager.getInstance().setSettingController(null); - super.onDestroy(); - } - - /*External Redirection*/ - - public void onRedrawXML(){ - setContentView(R.layout.setting); - } - - public void onReInitTheme(){ - recreate(); - } - - /*UI Redirection*/ - - public void onNavigationBackPressed(View view){ - finish(); - } - - public void onDefaultBrowser(View view){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - startActivity(new Intent(android.provider.Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS)); - }else{ - //pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_NOT_SUPPORTED); - } - } - - public void onManageNotification(View view){ - helperMethod.openActivity(settingNotificationController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onManageSearchEngine(View view){ - helperMethod.openActivity(settingSearchController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onManageSearchAccessibility(View view) { - helperMethod.openActivity(settingAccessibilityController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onManageGeneral(View view) { - helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onManageSearchClearData(View view) { - helperMethod.openActivity(settingClearController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onManageSearchPrivacy(View view) { - helperMethod.openActivity(settingPrivacyController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onManageSearchAdvanced(View view) { - helperMethod.openActivity(settingAdvanceController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onManageTracking(View view) { - helperMethod.openActivity(settingTrackingController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onReportWebsite(View view) { - try { - finish(); - activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_REPORT_URL + URLEncoder.encode(activityContextManager.getInstance().getHomeController().onGetCurrentURL(), "UTF-8")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - } - - public void onSitemap(View view) { - finish(); - activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_SITEMAP); - } - - public void onPrivacyPolicy(View view) { - finish(); - activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_PRIVACY_POLICY_URL); - } - - public void onRateApplication(View view) { - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(activityContextManager.getInstance().getHomeController().onGetCurrentURL(), this), M_RATE_APP); - status.sSettingIsAppRated = true; - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true)); - } - - public void onShareApplication(View view) { - helperMethod.shareApp(this); - } - - public void onOpenProxyStatus(View view) { - helperMethod.openActivity(proxyStatusController.class, constants.CONST_LIST_HISTORY, this,true); - } - +package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; + +import android.content.Intent; +import android.content.res.Configuration; +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.appManager.proxyStatusManager.proxyStatusController; +import com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController; +import com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController; +import com.darkweb.genesissearchengine.appManager.settingManager.clearManager.settingClearController; +import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController; +import com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController; +import com.darkweb.genesissearchengine.appManager.settingManager.privacyManager.settingPrivacyController; +import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; +import com.darkweb.genesissearchengine.appManager.settingManager.trackingManager.settingTrackingController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; + +public class settingHomeController extends AppCompatActivity +{ + /*Private Observer Classes*/ + + private settingHomeViewController mSettingViewController; + private settingHomeModel mSettingModel; + + /*Initializations*/ + + public settingHomeController(){ + mSettingModel = new settingHomeModel(new settingModelCallback()); + } + + @Override + protected void onCreate(Bundle savedInstanceState) + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + if(!status.mThemeApplying){ + activityContextManager.getInstance().onStack(this); + } + + setContentView(R.layout.setting); + viewsInitializations(); + listenersInitializations(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + if(activityThemeManager.getInstance().onInitTheme(this) && !status.mThemeApplying){ + activityContextManager.getInstance().onResetTheme(); + } + + super.onConfigurationChanged(newConfig); + } + + private void viewsInitializations() + { + activityContextManager.getInstance().setSettingController(this); + mSettingViewController = new settingHomeViewController(this, new settingViewCallback()); + } + + private void listenersInitializations() + { + } + + public void cicadaClipboard(View view) { + Toast.makeText(getApplicationContext(),"Authorization Failed", Toast.LENGTH_SHORT).show(); + } + + /*View Callbacks*/ + + private class settingViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Model Callbacks*/ + + private class settingModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Local Overrides*/ + + @Override + public void onTrimMemory(int level) + { + if(status.sSettingIsAppPaused && (level==80 || level==15)) + { + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HOME_LOW_MEMORY,true)); + finish(); + } + } + + @Override + public void onResume() + { + if(status.mThemeApplying){ + // activityContextManager.getInstance().onStack(this); + } + + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + status.sSettingIsAppPaused = false; + super.onResume(); + } + + @Override + public void onPause() + { + super.onPause(); + } + + + @Override + public void onBackPressed(){ + finish(); + } + + @Override + protected void onDestroy() { + if(!status.mThemeApplying){ + activityContextManager.getInstance().onRemoveStack(this); + } + activityContextManager.getInstance().setSettingController(null); + super.onDestroy(); + } + + /*External Redirection*/ + + public void onRedrawXML(){ + setContentView(R.layout.setting); + } + + public void onReInitTheme(){ + recreate(); + } + + /*UI Redirection*/ + + public void onNavigationBackPressed(View view){ + finish(); + } + + public void onDefaultBrowser(View view){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + startActivity(new Intent(android.provider.Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS)); + }else{ + //pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_NOT_SUPPORTED); + } + } + + public void onManageNotification(View view){ + helperMethod.openActivity(settingNotificationController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onManageSearchEngine(View view){ + helperMethod.openActivity(settingSearchController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onManageSearchAccessibility(View view) { + helperMethod.openActivity(settingAccessibilityController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onManageGeneral(View view) { + helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onManageSearchClearData(View view) { + helperMethod.openActivity(settingClearController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onManageSearchPrivacy(View view) { + helperMethod.openActivity(settingPrivacyController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onManageSearchAdvanced(View view) { + helperMethod.openActivity(settingAdvanceController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onManageTracking(View view) { + helperMethod.openActivity(settingTrackingController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + + public void onReportWebsite(View view) { + try { + finish(); + activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_REPORT_URL + URLEncoder.encode(activityContextManager.getInstance().getHomeController().onGetCurrentURL(), "UTF-8")); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + + public void onSitemap(View view) { + finish(); + activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_SITEMAP); + } + + public void onPrivacyPolicy(View view) { + finish(); + activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_PRIVACY_POLICY_URL); + } + + public void onRateApplication(View view) { + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(activityContextManager.getInstance().getHomeController().onGetCurrentURL(), this), M_RATE_APP); + status.sSettingIsAppRated = true; + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true)); + } + + public void onShareApplication(View view) { + helperMethod.shareApp(this); + } + + public void onOpenProxyStatus(View view) { + helperMethod.openActivity(proxyStatusController.class, constants.CONST_LIST_HISTORY, this,true); + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeEnums.java index faaf6c2e..c87345b2 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeEnums.java @@ -1,13 +1,13 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; - -public class settingHomeEnums -{ - /*History Manager*/ - public enum eHomeModel { - } - - public enum eHomeViewController { - M_INIT - } - +package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; + +public class settingHomeEnums +{ + /*History Manager*/ + public enum eHomeModel { + } + + public enum eHomeViewController { + M_INIT + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeModel.java index 0932178b..3c139249 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeModel.java @@ -1,17 +1,17 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; - -import com.darkweb.genesissearchengine.eventObserver; - -class settingHomeModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - settingHomeModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; + +import com.darkweb.genesissearchengine.eventObserver; + +class settingHomeModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingHomeModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeViewController.java index 19ab64b7..691d7d29 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeViewController.java @@ -1,56 +1,56 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; - -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; -import java.util.List; - -class settingHomeViewController -{ - /*Private Variables*/ - - private eventObserver.eventListener mEvent; - private AppCompatActivity mContext; - - /*Initializations*/ - - settingHomeViewController(settingHomeController mContext, eventObserver.eventListener mEvent) - { - this.mEvent = mEvent; - this.mContext = mContext; - - initPostUI(); - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - public Object onTrigger(settingHomeEnums.eHomeViewController pCommands, List pData){ - if(pCommands.equals(settingHomeEnums.eHomeViewController.M_INIT)){ - initPostUI(); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; +import java.util.List; + +class settingHomeViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + + /*Initializations*/ + + settingHomeViewController(settingHomeController mContext, eventObserver.eventListener mEvent) + { + this.mEvent = mEvent; + this.mContext = mContext; + + initPostUI(); + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + public Object onTrigger(settingHomeEnums.eHomeViewController pCommands, List pData){ + if(pCommands.equals(settingHomeEnums.eHomeViewController.M_INIT)){ + initPostUI(); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java index 69ca768d..d870b47b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java @@ -1,141 +1,141 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; - -import android.content.res.Configuration; -import android.os.Bundle; -import android.view.View; -import android.widget.RadioButton; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.appManager.activityThemeManager; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class settingTrackingController extends AppCompatActivity { - - /* PRIVATE VARIABLES */ - private settingTrackingModel mSettingPrivacyModel; - private settingTrackingViewController mSettingPrivacyViewController; - private ArrayList mTrackers = new ArrayList<>(); - private boolean mSettingChanged = false; - - @Override - protected void onCreate(Bundle savedInstanceState) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onCreate(savedInstanceState); - - setContentView(R.layout.setting_tracking_view); - - viewsInitializations(); - } - - @Override - public void onConfigurationChanged(@NonNull Configuration newConfig) { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - super.onConfigurationChanged(newConfig); - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ - activityContextManager.getInstance().onResetTheme(); - activityThemeManager.getInstance().onConfigurationChanged(this); - } - - } - - private void viewsInitializations() { - mTrackers.add(findViewById(R.id.pTrackingRadioOption1)); - mTrackers.add(findViewById(R.id.pTrackingRadioOption2)); - mTrackers.add(findViewById(R.id.pTrackingRadioOption3)); - - activityContextManager.getInstance().onStack(this); - mSettingPrivacyViewController = new settingTrackingViewController(this, new settingTrackingController.settingAccessibilityViewCallback(), mTrackers); - mSettingPrivacyModel = new settingTrackingModel(new settingTrackingController.settingAccessibilityModelCallback()); - } - - /*View Callbacks*/ - - private class settingAccessibilityViewCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /*Model Callbacks*/ - - private class settingAccessibilityModelCallback implements eventObserver.eventListener{ - - @Override - public Object invokeObserver(List data, Object e_type) - { - return null; - } - } - - /* LOCAL OVERRIDES */ - - @Override - public void onResume() - { - if(mSettingChanged){ - activityContextManager.getInstance().setCurrentActivity(this); - } - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); - super.onResume(); - } - - @Override - public void onPause() - { - super.onPause(); - } - - @Override - public void onBackPressed() { - if(mSettingChanged){ - activityContextManager.getInstance().setCurrentActivity(this); - activityContextManager.getInstance().getHomeController().initRuntimeSettings(); - } - activityContextManager.getInstance().onRemoveStack(this); - finish(); - } - - @Override - protected void onDestroy() { - activityContextManager.getInstance().onRemoveStack(this); - super.onDestroy(); - } - - /*UI Redirection*/ - - public void onClose(View view){ - onBackPressed(); - } - - public void onTracking(View view){ - mSettingChanged = true; - mSettingPrivacyViewController.onTrigger(settingTrackingEnums.eTrackingViewController.M_SET_TRACKING_STATUS, Collections.singletonList(view)); - mSettingPrivacyModel.onTrigger(settingTrackingEnums.eTrackingModel.M_SET_TRACKING_PROTECTION, Collections.singletonList(view)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, status.sSettingTrackingProtection)); - } - - public void onOpenInfo(View view) { - helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; +import android.widget.RadioButton; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.helpManager.helpController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class settingTrackingController extends AppCompatActivity { + + /* PRIVATE VARIABLES */ + private settingTrackingModel mSettingPrivacyModel; + private settingTrackingViewController mSettingPrivacyViewController; + private ArrayList mTrackers = new ArrayList<>(); + private boolean mSettingChanged = false; + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onCreate(savedInstanceState); + + setContentView(R.layout.setting_tracking_view); + + viewsInitializations(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + + } + + private void viewsInitializations() { + mTrackers.add(findViewById(R.id.pTrackingRadioOption1)); + mTrackers.add(findViewById(R.id.pTrackingRadioOption2)); + mTrackers.add(findViewById(R.id.pTrackingRadioOption3)); + + activityContextManager.getInstance().onStack(this); + mSettingPrivacyViewController = new settingTrackingViewController(this, new settingTrackingController.settingAccessibilityViewCallback(), mTrackers); + mSettingPrivacyModel = new settingTrackingModel(new settingTrackingController.settingAccessibilityModelCallback()); + } + + /*View Callbacks*/ + + private class settingAccessibilityViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /*Model Callbacks*/ + + private class settingAccessibilityModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + return null; + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + if(mSettingChanged){ + activityContextManager.getInstance().setCurrentActivity(this); + } + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + super.onResume(); + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + if(mSettingChanged){ + activityContextManager.getInstance().setCurrentActivity(this); + activityContextManager.getInstance().getHomeController().initRuntimeSettings(); + } + activityContextManager.getInstance().onRemoveStack(this); + finish(); + } + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + /*UI Redirection*/ + + public void onClose(View view){ + onBackPressed(); + } + + public void onTracking(View view){ + mSettingChanged = true; + mSettingPrivacyViewController.onTrigger(settingTrackingEnums.eTrackingViewController.M_SET_TRACKING_STATUS, Collections.singletonList(view)); + mSettingPrivacyModel.onTrigger(settingTrackingEnums.eTrackingModel.M_SET_TRACKING_PROTECTION, Collections.singletonList(view)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, status.sSettingTrackingProtection)); + } + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingEnums.java index 267590a3..889db3a0 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingEnums.java @@ -1,14 +1,14 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; - -class settingTrackingEnums -{ - /*History Manager*/ - public enum eTrackingModel { - M_SET_TRACKING_PROTECTION - } - - public enum eTrackingViewController { - M_SET_TRACKING_STATUS - } - +package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; + +class settingTrackingEnums +{ + /*History Manager*/ + public enum eTrackingModel { + M_SET_TRACKING_PROTECTION + } + + public enum eTrackingViewController { + M_SET_TRACKING_STATUS + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingModel.java index 20593886..1d2aa748 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingModel.java @@ -1,46 +1,46 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; - -import android.view.View; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; - -import org.mozilla.geckoview.ContentBlocking; - -import java.util.List; - -class settingTrackingModel -{ - /*Variable Declaration*/ - - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - settingTrackingModel(eventObserver.eventListener mEvent){ - this.mEvent = mEvent; - } - - /*Helper Methods*/ - - private void onTracking(View pView){ - if(pView.getId() == R.id.pTrackingOption1){ - status.sSettingTrackingProtection = ContentBlocking.AntiTracking.NONE; - } - if(pView.getId() == R.id.pTrackingOption2){ - status.sSettingTrackingProtection = ContentBlocking.AntiTracking.DEFAULT; - } - if(pView.getId() == R.id.pTrackingOption3){ - status.sSettingTrackingProtection = ContentBlocking.AntiTracking.STRICT; - } - } - - public Object onTrigger(settingTrackingEnums.eTrackingModel pCommands, List pData){ - if(pCommands.equals(settingTrackingEnums.eTrackingModel.M_SET_TRACKING_PROTECTION)){ - onTracking((View) pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; + +import android.view.View; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; + +import org.mozilla.geckoview.ContentBlocking; + +import java.util.List; + +class settingTrackingModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + settingTrackingModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + /*Helper Methods*/ + + private void onTracking(View pView){ + if(pView.getId() == R.id.pTrackingOption1){ + status.sSettingTrackingProtection = ContentBlocking.AntiTracking.NONE; + } + if(pView.getId() == R.id.pTrackingOption2){ + status.sSettingTrackingProtection = ContentBlocking.AntiTracking.DEFAULT; + } + if(pView.getId() == R.id.pTrackingOption3){ + status.sSettingTrackingProtection = ContentBlocking.AntiTracking.STRICT; + } + } + + public Object onTrigger(settingTrackingEnums.eTrackingModel pCommands, List pData){ + if(pCommands.equals(settingTrackingEnums.eTrackingModel.M_SET_TRACKING_PROTECTION)){ + onTracking((View) pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingViewController.java index 074a64ad..aa7a3e65 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingViewController.java @@ -1,104 +1,104 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; - -import android.content.res.ColorStateList; -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.RadioButton; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; -import org.mozilla.geckoview.ContentBlocking; -import java.util.ArrayList; -import java.util.List; - -class settingTrackingViewController -{ - /*Private Variables*/ - - private AppCompatActivity mContext; - private eventObserver.eventListener mEvent; - private ArrayList mTracking; - - /*Initializations*/ - - settingTrackingViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent, ArrayList pTracking) - { - this.mEvent = pEvent; - this.mTracking = pTracking; - this.mContext = pContext; - - initViews(); - initPostUI(); - } - - private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } - - private void initViews(){ - clearTrackersSetting(); - if(status.sSettingTrackingProtection == ContentBlocking.AntiTracking.NONE){ - mTracking.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mTracking.get(0).setChecked(true); - } - if(status.sSettingTrackingProtection == ContentBlocking.AntiTracking.DEFAULT){ - mTracking.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mTracking.get(1).setChecked(true); - } - if(status.sSettingTrackingProtection == ContentBlocking.AntiTracking.STRICT){ - mTracking.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); - mTracking.get(2).setChecked(true); - } - } - - private void clearTrackersSetting(){ - for(int mCounter=0; mCounter pData){ - if(pCommands.equals(settingTrackingEnums.eTrackingViewController.M_SET_TRACKING_STATUS)){ - setCookieStatus((View)pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.appManager.settingManager.trackingManager; + +import android.content.res.ColorStateList; +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.RadioButton; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.example.myapplication.R; +import org.mozilla.geckoview.ContentBlocking; +import java.util.ArrayList; +import java.util.List; + +class settingTrackingViewController +{ + /*Private Variables*/ + + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + private ArrayList mTracking; + + /*Initializations*/ + + settingTrackingViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent, ArrayList pTracking) + { + this.mEvent = pEvent; + this.mTracking = pTracking; + this.mContext = pContext; + + initViews(); + initPostUI(); + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } + + private void initViews(){ + clearTrackersSetting(); + if(status.sSettingTrackingProtection == ContentBlocking.AntiTracking.NONE){ + mTracking.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mTracking.get(0).setChecked(true); + } + if(status.sSettingTrackingProtection == ContentBlocking.AntiTracking.DEFAULT){ + mTracking.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mTracking.get(1).setChecked(true); + } + if(status.sSettingTrackingProtection == ContentBlocking.AntiTracking.STRICT){ + mTracking.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); + mTracking.get(2).setChecked(true); + } + } + + private void clearTrackersSetting(){ + for(int mCounter=0; mCounter pData){ + if(pCommands.equals(settingTrackingEnums.eTrackingViewController.M_SET_TRACKING_STATUS)){ + setCookieStatus((View)pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java index 35feb57c..2dec6ea3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java @@ -1,22 +1,22 @@ -package com.darkweb.genesissearchengine.appManager.tabManager; - -public class tabEnums -{ - /*Settings Manager*/ - public enum eTabViewCommands { - M_DISMISS_MENU, M_SHOW_MENU, INIT_TAB_COUNT, ON_HIDE_SELECTION, ON_SHOW_SELECTION, ON_SHOW_SELECTION_MENU, ON_SHOW_UNDO_DIALOG, ON_HIDE_UNDO_DIALOG, ON_GENERATE_SWIPABLE_BACKGROUND, ON_EXIT, ON_HIDE_UNDO_DIALOG_INIT, ON_HOLD_BLOCKER, ON_RELEASE_BLOCKER - } - - public enum eTabAdapterCommands { - M_SELECTION_MENU_SHOWING, M_REMOVE_ALL_SELECTION, M_CLEAR_ALL_SELECTION, ENABLE_LONG_CLICK_MENU, INIT_FIRST_ROW, REINIT_DATA, NOTIFY_SWIPE, GET_SELECTION_SIZE, REMOVE_ALL, REMOVE_ROW_CROSSED, M_INITIALIZE - } - - public enum eTabAdapterCallback { - ON_HIDE_SELECTION, ON_SHOW_SELECTION, ON_CLEAR_TAB_BACKUP, ON_REMOVE_TAB, ON_INIT_TAB_COUNT, ON_BACK_PRESSED, ON_LOAD_TAB, ON_REMOVE_TAB_VIEW,ON_REMOVE_TAB_VIEW_RETAIN_BACKUP, M_CLEAR_BACKUP, ON_SHOW_SELECTION_MENU - } - - public enum eModelCallback { - M_SET_LIST, M_GET_LIST, M_REMOVE_TAB, M_GET_BACKUP, M_CLEAR_BACKUP_WITHOUT_CLOSE, M_CLEAR_BACKUP_RETAIN_DATABASE, M_LOAD_BACKUP - } - +package com.darkweb.genesissearchengine.appManager.tabManager; + +public class tabEnums +{ + /*Settings Manager*/ + public enum eTabViewCommands { + M_DISMISS_MENU, M_SHOW_MENU, INIT_TAB_COUNT, ON_HIDE_SELECTION, ON_SHOW_SELECTION, ON_SHOW_SELECTION_MENU, ON_SHOW_UNDO_DIALOG, ON_HIDE_UNDO_DIALOG, ON_GENERATE_SWIPABLE_BACKGROUND, ON_EXIT, ON_HIDE_UNDO_DIALOG_INIT, ON_HOLD_BLOCKER, ON_RELEASE_BLOCKER + } + + public enum eTabAdapterCommands { + M_SELECTION_MENU_SHOWING, M_REMOVE_ALL_SELECTION, M_CLEAR_ALL_SELECTION, ENABLE_LONG_CLICK_MENU, INIT_FIRST_ROW, REINIT_DATA, NOTIFY_SWIPE, GET_SELECTION_SIZE, REMOVE_ALL, REMOVE_ROW_CROSSED, M_INITIALIZE + } + + public enum eTabAdapterCallback { + ON_HIDE_SELECTION, ON_SHOW_SELECTION, ON_CLEAR_TAB_BACKUP, ON_REMOVE_TAB, ON_INIT_TAB_COUNT, ON_BACK_PRESSED, ON_LOAD_TAB, ON_REMOVE_TAB_VIEW,ON_REMOVE_TAB_VIEW_RETAIN_BACKUP, M_CLEAR_BACKUP, ON_SHOW_SELECTION_MENU + } + + public enum eModelCallback { + M_SET_LIST, M_GET_LIST, M_REMOVE_TAB, M_GET_BACKUP, M_CLEAR_BACKUP_WITHOUT_CLOSE, M_CLEAR_BACKUP_RETAIN_DATABASE, M_LOAD_BACKUP + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java index 61dd78da..140fb342 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -8,7 +8,7 @@ public class enums on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,M_DOWNLOAD_FAILURE, welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT_FORCED,M_SPLASH_DISABLE,M_NEW_LINK_IN_NEW_TAB,M_RESET_SUGGESTION, url_triggered, url_triggered_new_tab,url_clear,fetch_favicon,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB, - on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_INITIALIZE_TAB_SINGLE, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_FIRST_PAINT, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error,download_file_popup,on_init_ads,search_update, open_new_tab,open_new_tab_instant + on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_INITIALIZE_TAB_SINGLE, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_FIRST_PAINT, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error, M_ORBOT_LOADING,download_file_popup,on_init_ads,search_update, open_new_tab,open_new_tab_instant } /*General Enums*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java index bd65cc42..46858815 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java @@ -57,6 +57,7 @@ public class keys public static final String SETTING_FULL_SCREEN_BROWSIING = "SETTING_FULL_SCREEN_BROWSIING_V1"; public static final String SETTING_OPEN_URL_IN_NEW_TAB = "SETTING_OPEN_URL_IN_NEW_TAB_V1"; public static final String SETTING_LIST_VIEW = "SETTING_LIST_VIEW_V1"; + public static final String SETTING_INSTALLED = "SETTING_INSTALLED_V1"; /*Bridge Settings*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/sql.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/sql.java index d2dceb17..6b3e5c64 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/sql.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/sql.java @@ -1,12 +1,12 @@ -package com.darkweb.genesissearchengine.constants; - -public class sql -{ - /*HISTORY*/ - - public static final String SQL_CLEAR_HISTORY = "delete from history where 1"; - public static final String SQL_CLEAR_BOOKMARK = "delete from bookmark where 1"; - public static final String SQL_CLEAR_TAB = "delete from tab where 1"; - - -} +package com.darkweb.genesissearchengine.constants; + +public class sql +{ + /*HISTORY*/ + + public static final String SQL_CLEAR_HISTORY = "delete from history where 1"; + public static final String SQL_CLEAR_BOOKMARK = "delete from bookmark where 1"; + public static final String SQL_CLEAR_TAB = "delete from tab where 1"; + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java index 9704d3df..101f8598 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -66,6 +66,7 @@ public class status public static boolean sVPNStatus = false; public static boolean sVPNPermission = false; public static boolean sBridgeStatus = false; + public static boolean sAppInstalled = false; public static int sTheme = enums.Theme.THEME_DEFAULT; public static int sSettingCookieStatus = ContentBlocking.AntiTracking.DEFAULT; @@ -77,6 +78,8 @@ public class status public static float sSettingFontSize = 1; + public static boolean sDisableExpandTemp = false; + private static void versionVerifier(Context pContext){ status.sVersion = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_VERSION,strings.GENERIC_EMPTY_STR)); if(!status.sVersion.equals("1.0.0.1")){ @@ -130,6 +133,7 @@ public class status status.sLogThemeStyleAdvanced = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true)); status.sTabGridLayoutEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true)); status.sRateCount = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_RATE_COUNT, 0)); + status.sAppInstalled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,false)); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java index 868d1163..c9c778b7 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java @@ -58,7 +58,7 @@ public class strings /*Home Manager*/ public static final String HOME_BLANK_PAGE = "about:blank"; - public static final String HOME_REFERENCE_WEBSITES_DEFAULT = ""; + public static final String HOME_REFERENCE_WEBSITES_DEFAULT = "[{\"mUrl\":\"https://wikileaks.org/-Leaks-.html\",\"mIcon\":\"https://wikileaks.org/static/img/wl-logo.png\",\"mHeader\":\"WikiLeaks (en)\",\"mBody\":\"WikiLeaks specializes in the publication of censored or otherwise restricted official materials involving war, and corruption\"},{\"mUrl\":\"https://p53lf57qovyuvwsc6xnrppyply3vtqm7l6pcobkmyqsiofyeznfu5uqd.onion/\",\"mIcon\":\"http://assets.p53lf57qovyuvwsc6xnrppyply3vtqm7l6pcobkmyqsiofyeznfu5uqd.onion/static/prod/v4/images/favicon-32x32.png\",\"mHeader\":\"Pro Publica\",\"mBody\":\"ProPublica is an independent, nonprofit newsroom that produces investigative journalism with moral force\"},{\"mUrl\":\"http://nzh3fv6jc6jskki3.onion/\",\"mIcon\":\"http://nzh3fv6jc6jskki3.onion/assets/images/favicon.png\",\"mHeader\":\"Rise UP | Communication Service\",\"mBody\":\"We are a project to create democratic alternatives and practiceself-determination by controlling our own secure means of communications\"},{\"mUrl\":\"http://answerszuvs3gg2l64e6hmnryudl5zgrmwm3vh65hzszdghblddvfiqd.onion/\",\"mIcon\":\"https://www.freeiconspng.com/uploads/questions-and-answers-icon-1.png\",\"mHeader\":\"Hidden Answer\",\"mBody\":\"Once you access the site, you’ll soon notice that the questions on Hidden Answers touch upon a variety of topics\"},{\"mUrl\":\"http://zerobinqmdqd236y.onion/\",\"mIcon\":\"https://icon-library.net//images/zero-icon/zero-icon-15.jpg\",\"mHeader\":\"Zero Bin\",\"mBody\":\"ZeroBin.net is a minimalist, open source online pastebin where the server has zero knowledge of pasted data\"},{\"mUrl\":\"http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion/\",\"mIcon\":\"http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion/img/favicon.ico\",\"mHeader\":\"Imperial Library\",\"mBody\":\"The Imperial Library of Trantor (also known as Galactic Library) is a repository of DRM-free ebooks on ePub format\"},{\"mUrl\":\"http://zqktlwiuavvvqqt4ybvgvi7tyo4hjl5xgfuvpdf6otjiycgwqbym2qad.onion/wiki/index.php/Main_Page\",\"mIcon\":\"http://zqktlwiuavvvqqt4ybvgvi7tyo4hjl5xgfuvpdf6otjiycgwqbym2qad.onion/wiki/resources/favicon.ico\",\"mHeader\":\"Hidden Wiki\",\"mBody\":\"One of the largest repository of categorized hidden web URL's\"},{\"mUrl\":\"https://www.facebookcorewwwi.onion/\",\"mIcon\":\"https://cdn1.iconfinder.com/data/icons/logotypes/32/square-facebook-512.png\",\"mHeader\":\"Facebook\",\"mBody\":\"Connect with friends and the world around you on Facebook\"},{\"mUrl\":\"https://www.bbcnewsv2vjtpsuy.onion/\",\"mIcon\":\"https://gn-web-assets.api.bbc.com/wwhp/20210105-1702-7302953dc6fd22d3eb4efd4d73bfd2a8d91bb7df/responsive/img/apple-touch/apple-touch-180.jpg\",\"mHeader\":\"BBC News\",\"mBody\":\"We’re impartial and independent, and every day we create distinctive, world class programmes and content which inform millions of people around the world\"},{\"mUrl\":\"http://archivecaslytosk.onion/\",\"mIcon\":\"https://archive.is/apple-touch-icon-144x144.png\",\"mHeader\":\"Archieve Today\",\"mBody\":\"It takes a 'snapshot' of a webpage that will always be online even if the original page disappears. It saves a text and a graphical copy of the legacy page\"},{\"mUrl\":\"http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion/\",\"mIcon\":\"http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion/images/favicon.ico\",\"mHeader\":\"Wasabi Wallet\",\"mBody\":\"Wasabi is an open-source, non-custodial, privacy-focused Bitcoin wallet for Desktop, that implements trustless CoinJoin\"},{\"mUrl\":\"http://ow24et3tetp6tvmk.onion/\",\"mIcon\":\"http://ow24et3tetp6tvmk.onion/favicon.ico\",\"mHeader\":\"Onion Wallet\",\"mBody\":\"When using Bitcoin together with Tor you are combining the best online money with the best encryption and privacy technology available\"},{\"mUrl\":\"http://piratebayztemzmv.onion/\",\"mIcon\":\"http://piratebayztemzmv.onion/images/tpb.jpg\",\"mHeader\":\"The Pirate Bay\",\"mBody\":\"The Pirate Bay allows users to search for Magnet links. These are used to reference resources available for download via peer-to-peer networks\"}]"; /*Message Manager*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java index 386f8855..711d5b7c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java @@ -1,100 +1,100 @@ -package com.darkweb.genesissearchengine.dataManager; - -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class bookmarkDataModel { - - /* Local Variables */ - - private eventObserver.eventListener mExternalEvents; - private ArrayList mBookmarks; - - /* Initializations */ - - public bookmarkDataModel(eventObserver.eventListener pExternalEvents){ - mBookmarks = new ArrayList<>(); - mExternalEvents = pExternalEvents; - } - - void initializebookmark(ArrayList pBookmark){ - mBookmarks = pBookmark; - } - - /* Helper Methods */ - - private ArrayList getBookmark() { - return mBookmarks; - } - - void addBookmark(String pURL, String pTitle){ - if(pURL.endsWith("about:blank")) - pURL = "about:blank"; - if(pURL.length()>1500){ - return; - } - int autoval = 0; - if(mBookmarks.size()> constants.CONST_MAX_BOOKMARK_SIZE) - { - mExternalEvents.invokeObserver(Arrays.asList("delete from bookmark where id="+ mBookmarks.get(mBookmarks.size()-1).getID(),null), dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL); - } - - if(mBookmarks.size()>0) - { - autoval = mBookmarks.get(0).getID()+1; - } - - if(pTitle.equals("")) - { - pTitle = strings.BOOKMARK_DEFAULT_TITLE+autoval; - } - - String[] params = new String[2]; - params[0] = pTitle; - params[1] = pURL; - - if(!pTitle.equals("loading")){ - mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params), dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL); - } - mBookmarks.add(0,new bookmarkRowModel(pTitle, pURL,autoval)); - } - - void clearBookmark(){ - mBookmarks.clear(); - } - - void deleteBookmark(int pID) { - for(int mCounter=0;mCounter1500){ + return; + } + int autoval = 0; + if(mBookmarks.size()> constants.CONST_MAX_BOOKMARK_SIZE) + { + mExternalEvents.invokeObserver(Arrays.asList("delete from bookmark where id="+ mBookmarks.get(mBookmarks.size()-1).getID(),null), dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL); + } + + if(mBookmarks.size()>0) + { + autoval = mBookmarks.get(0).getID()+1; + } + + if(pTitle.equals("")) + { + pTitle = strings.BOOKMARK_DEFAULT_TITLE+autoval; + } + + String[] params = new String[2]; + params[0] = pTitle; + params[1] = pURL; + + if(!pTitle.equals("loading")){ + mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params), dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL); + } + mBookmarks.add(0,new bookmarkRowModel(pTitle, pURL,autoval)); + } + + void clearBookmark(){ + mBookmarks.clear(); + } + + void deleteBookmark(int pID) { + for(int mCounter=0;mCounter mHelpListModel; - - /* Initializations */ - - helpDataModel(){ - mHelpListModel = new ArrayList<>(); - } - - /* Helper Methods */ - - ArrayList getHelpModel(){ - return mHelpListModel; - } - - private void setModel(ArrayList pHelpListModel){ - mHelpListModel.clear(); - mHelpListModel.addAll(pHelpListModel); - } - - /* External Triggers */ - - public Object onTrigger(dataEnums.eHelpCommands pCommands, List pData){ - if(pCommands.equals(dataEnums.eHelpCommands.M_GET_HELP)){ - return getHelpModel(); - } - else if(pCommands.equals(dataEnums.eHelpCommands.M_SET_HELP)){ - setModel((ArrayList)pData.get(0)); - } - - return null; - } - -} +package com.darkweb.genesissearchengine.dataManager; + +import android.annotation.SuppressLint; +import java.util.ArrayList; +import java.util.List; + +@SuppressLint("CommitPrefEdits") +class helpDataModel +{ + /* Local Variables */ + + private ArrayList mHelpListModel; + + /* Initializations */ + + helpDataModel(){ + mHelpListModel = new ArrayList<>(); + } + + /* Helper Methods */ + + ArrayList getHelpModel(){ + return mHelpListModel; + } + + private void setModel(ArrayList pHelpListModel){ + mHelpListModel.clear(); + mHelpListModel.addAll(pHelpListModel); + } + + /* External Triggers */ + + public Object onTrigger(dataEnums.eHelpCommands pCommands, List pData){ + if(pCommands.equals(dataEnums.eHelpCommands.M_GET_HELP)){ + return getHelpModel(); + } + else if(pCommands.equals(dataEnums.eHelpCommands.M_SET_HELP)){ + setModel((ArrayList)pData.get(0)); + } + + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java index 60fc2af4..cdc598a2 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java @@ -1,189 +1,189 @@ -package com.darkweb.genesissearchengine.dataManager; - -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -public class historyDataModel { - - /* Local Variables */ - - private eventObserver.eventListener mExternalEvents; - - private int mMaxHistoryId = 0; - private int mHistorySize = 0; - private ArrayList mHistory; - private Map mHistoryCache; - - public historyDataModel(eventObserver.eventListener pExternalEvents){ - mHistory = new ArrayList<>(); - mHistoryCache = new HashMap<>(); - - mExternalEvents = pExternalEvents; - } - - /* Initializations */ - - void initializeHistory(ArrayList history, int pMaxHistoryId, int pHistorySize){ - mMaxHistoryId = pMaxHistoryId; - mHistorySize = pHistorySize; - this.mHistory = history; - if(!status.sClearOnExit){ - initializeCache(history); - }else { - clearHistory(); - } - } - - private void initializeCache(ArrayList pHistory){ - for(int count=0;count<=pHistory.size()-1;count++){ - historyRowModel tempSuggestion = new historyRowModel(pHistory.get(count).getHeader(),pHistory.get(count).getHeader(),-1); - tempSuggestion.setURL(pHistory.get(count).getHeader()); - mHistoryCache.put(pHistory.get(count).getID(),tempSuggestion); - } - } - - /* Helper Methods */ - - private ArrayList getHistory() { - return mHistory; - } - - private void removeDuplicateURLFromHistory(int pID, String pUrl){ - - for (int m_count = 0; m_count < mHistory.size(); m_count++) { - historyRowModel m_temp_model = mHistory.get(m_count); - if(m_temp_model==null) - continue; - if (m_temp_model.getDescription().equals(pUrl)) { - if(m_temp_model.getID()==pID){ - if(m_count>0){ - mHistory.remove(m_count); - mHistory.add(0, m_temp_model); - } - }else { - Calendar calendar = Calendar.getInstance(); - int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); - - Calendar cal = Calendar.getInstance(); - cal.setTime(mHistory.get(m_count).getDate()); - - if (dayOfYear == cal.get(Calendar.DAY_OF_YEAR)) { - mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id = " + mHistory.get(m_count).getID(), null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); - mHistoryCache.remove(mHistory.get(m_count).getID()); - mHistory.remove(m_count); - m_count = m_count-1; - } - } - } - } - } - - private int addHistory(String pUrl,String pHeader, int pID) { - if(pUrl.length()>1500 || pUrl.equals("about:blank") || pHeader.equals("$TITLE")){ - return pID; - } - - pUrl = helperMethod.removeLastSlash(pUrl); - pUrl = helperMethod.urlWithoutPrefix(pUrl); - - Object url_exists = mHistoryCache.get(pID); - if(url_exists!=null){ - mHistoryCache.get(pID).setHeader(pHeader); - mHistoryCache.get(pID).setURL(pUrl); - - removeDuplicateURLFromHistory(pID, pUrl); - - String[] params = new String[2]; - params[0] = pUrl; - params[1] = pHeader; - String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); - mExternalEvents.invokeObserver(Arrays.asList("UPDATE history SET date = '" + m_date + "' , url = ? , title = ? WHERE id="+pID,params), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); - return pID; - }else { - if(mHistorySize > constants.CONST_MAX_LIST_DATA_SIZE) - { - mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.CONST_MAX_LIST_DATA_SIZE /2)+")",null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); - } - - if(pHeader.equals("loading")){ - pHeader = pUrl; - } - - String[] params = new String[2]; - params[0] = pUrl; - params[1] = pHeader; - - mMaxHistoryId = mMaxHistoryId +1; - mHistorySize += 1; - - String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); - - if(!pHeader.equals("loading")){ - mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO history(id,date,url,title) VALUES("+ mMaxHistoryId +",'" + m_date + "',?,?);",params), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); - } - - mHistory.add(0,new historyRowModel(pHeader,pUrl, mMaxHistoryId)); - mHistoryCache.put(mMaxHistoryId, mHistory.get(0)); - removeDuplicateURLFromHistory(mMaxHistoryId, pUrl); - return mMaxHistoryId; - } - } - private void removeHistory(int pID){ - mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id = "+pID,null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); - mHistoryCache.remove(pID); - mHistorySize -= 1; - } - private void clearHistory(){ - mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE 1 ",null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); - mHistory.clear(); - mHistoryCache.clear(); - } - private boolean loadMoreHistory(ArrayList pHistory){ - this.mHistory.addAll(pHistory); - for(int count=0;count<=pHistory.size()-1;count++){ - mHistoryCache.put(pHistory.get(count).getID(),pHistory.get(0)); - } - - return pHistory.size() > 0; - } - - /* External Triggers */ - - public Object onTrigger(dataEnums.eHistoryCommands pCommands, List pData){ - if(pCommands == dataEnums.eHistoryCommands.M_GET_HISTORY){ - return getHistory(); - } - else if(pCommands == dataEnums.eHistoryCommands.M_ADD_HISTORY){ - return addHistory((String) pData.get(0),(String) pData.get(2), (int)pData.get(3)); - } - else if(pCommands == dataEnums.eHistoryCommands.M_REMOVE_HISTORY){ - removeHistory((int) pData.get(0)); - } - else if(pCommands == dataEnums.eHistoryCommands.M_CLEAR_HISTORY){ - clearHistory(); - } - else if(pCommands == dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY){ - return loadMoreHistory((ArrayList) pData.get(0)); - } - else if(pCommands == dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY){ - initializeHistory((ArrayList) pData.get(0), (int)pData.get(1), (int)pData.get(2)); - } - else if(pCommands == dataEnums.eHistoryCommands.M_HISTORY_SIZE){ - return mHistory.size(); - } - - return null; - } - -} +package com.darkweb.genesissearchengine.dataManager; + +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +public class historyDataModel { + + /* Local Variables */ + + private eventObserver.eventListener mExternalEvents; + + private int mMaxHistoryId = 0; + private int mHistorySize = 0; + private ArrayList mHistory; + private Map mHistoryCache; + + public historyDataModel(eventObserver.eventListener pExternalEvents){ + mHistory = new ArrayList<>(); + mHistoryCache = new HashMap<>(); + + mExternalEvents = pExternalEvents; + } + + /* Initializations */ + + void initializeHistory(ArrayList history, int pMaxHistoryId, int pHistorySize){ + mMaxHistoryId = pMaxHistoryId; + mHistorySize = pHistorySize; + this.mHistory = history; + if(!status.sClearOnExit){ + initializeCache(history); + }else { + clearHistory(); + } + } + + private void initializeCache(ArrayList pHistory){ + for(int count=0;count<=pHistory.size()-1;count++){ + historyRowModel tempSuggestion = new historyRowModel(pHistory.get(count).getHeader(),pHistory.get(count).getHeader(),-1); + tempSuggestion.setURL(pHistory.get(count).getHeader()); + mHistoryCache.put(pHistory.get(count).getID(),tempSuggestion); + } + } + + /* Helper Methods */ + + private ArrayList getHistory() { + return mHistory; + } + + private void removeDuplicateURLFromHistory(int pID, String pUrl){ + + for (int m_count = 0; m_count < mHistory.size(); m_count++) { + historyRowModel m_temp_model = mHistory.get(m_count); + if(m_temp_model==null) + continue; + if (m_temp_model.getDescription().equals(pUrl)) { + if(m_temp_model.getID()==pID){ + if(m_count>0){ + mHistory.remove(m_count); + mHistory.add(0, m_temp_model); + } + }else { + Calendar calendar = Calendar.getInstance(); + int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); + + Calendar cal = Calendar.getInstance(); + cal.setTime(mHistory.get(m_count).getDate()); + + if (dayOfYear == cal.get(Calendar.DAY_OF_YEAR)) { + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id = " + mHistory.get(m_count).getID(), null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); + mHistoryCache.remove(mHistory.get(m_count).getID()); + mHistory.remove(m_count); + m_count = m_count-1; + } + } + } + } + } + + private int addHistory(String pUrl,String pHeader, int pID) { + if(pUrl.length()>1500 || pUrl.equals("about:blank") || pHeader.equals("$TITLE")){ + return pID; + } + + pUrl = helperMethod.removeLastSlash(pUrl); + pUrl = helperMethod.urlWithoutPrefix(pUrl); + + Object url_exists = mHistoryCache.get(pID); + if(url_exists!=null){ + mHistoryCache.get(pID).setHeader(pHeader); + mHistoryCache.get(pID).setURL(pUrl); + + removeDuplicateURLFromHistory(pID, pUrl); + + String[] params = new String[2]; + params[0] = pUrl; + params[1] = pHeader; + String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); + mExternalEvents.invokeObserver(Arrays.asList("UPDATE history SET date = '" + m_date + "' , url = ? , title = ? WHERE id="+pID,params), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); + return pID; + }else { + if(mHistorySize > constants.CONST_MAX_LIST_DATA_SIZE) + { + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.CONST_MAX_LIST_DATA_SIZE /2)+")",null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); + } + + if(pHeader.equals("loading")){ + pHeader = pUrl; + } + + String[] params = new String[2]; + params[0] = pUrl; + params[1] = pHeader; + + mMaxHistoryId = mMaxHistoryId +1; + mHistorySize += 1; + + String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); + + if(!pHeader.equals("loading")){ + mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO history(id,date,url,title) VALUES("+ mMaxHistoryId +",'" + m_date + "',?,?);",params), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); + } + + mHistory.add(0,new historyRowModel(pHeader,pUrl, mMaxHistoryId)); + mHistoryCache.put(mMaxHistoryId, mHistory.get(0)); + removeDuplicateURLFromHistory(mMaxHistoryId, pUrl); + return mMaxHistoryId; + } + } + private void removeHistory(int pID){ + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id = "+pID,null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); + mHistoryCache.remove(pID); + mHistorySize -= 1; + } + private void clearHistory(){ + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE 1 ",null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); + mHistory.clear(); + mHistoryCache.clear(); + } + private boolean loadMoreHistory(ArrayList pHistory){ + this.mHistory.addAll(pHistory); + for(int count=0;count<=pHistory.size()-1;count++){ + mHistoryCache.put(pHistory.get(count).getID(),pHistory.get(0)); + } + + return pHistory.size() > 0; + } + + /* External Triggers */ + + public Object onTrigger(dataEnums.eHistoryCommands pCommands, List pData){ + if(pCommands == dataEnums.eHistoryCommands.M_GET_HISTORY){ + return getHistory(); + } + else if(pCommands == dataEnums.eHistoryCommands.M_ADD_HISTORY){ + return addHistory((String) pData.get(0),(String) pData.get(2), (int)pData.get(3)); + } + else if(pCommands == dataEnums.eHistoryCommands.M_REMOVE_HISTORY){ + removeHistory((int) pData.get(0)); + } + else if(pCommands == dataEnums.eHistoryCommands.M_CLEAR_HISTORY){ + clearHistory(); + } + else if(pCommands == dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY){ + return loadMoreHistory((ArrayList) pData.get(0)); + } + else if(pCommands == dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY){ + initializeHistory((ArrayList) pData.get(0), (int)pData.get(1), (int)pData.get(2)); + } + else if(pCommands == dataEnums.eHistoryCommands.M_HISTORY_SIZE){ + return mHistory.size(); + } + + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java index 7f05493e..07496071 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java @@ -1,116 +1,116 @@ -package com.darkweb.genesissearchengine.dataManager; - -import android.annotation.SuppressLint; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.dataManager.models.imageRowModel; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.darkweb.genesissearchengine.constants.constants.*; -import static com.darkweb.genesissearchengine.constants.enums.ImageQueueStatus.*; - -@SuppressLint("CommitPrefEdits") -class imageDataModel -{ - - /* Local Variables */ - - private Map mImageCache; - private Map mParsedQueues; - private ArrayList mRequestQueue; - - /* Initializations */ - - public imageDataModel(){ - mImageCache = new HashMap<>(); - mParsedQueues = new HashMap<>(); - mRequestQueue = new ArrayList<>(); - - mBackgroundThread(); - } - - /* Helper Methods */ - - private void onRequestImage(String mURL){ - String mCraftedURL = helperMethod.completeURL(helperMethod.getDomainName(mURL))+"/favicon.ico"; - if(!mParsedQueues.containsKey(mCraftedURL)){ - mRequestQueue.add(mCraftedURL); - } - } - - private Bitmap getImage(String mURL){ - String mCraftedURL = helperMethod.completeURL(helperMethod.getDomainName(mURL))+"/favicon.ico"; - if(!mParsedQueues.containsKey(mCraftedURL) || mParsedQueues.get(mCraftedURL) == M_IMAGE_LOADING_FAILED){ - return null; - }else{ - return mImageCache.get(mCraftedURL).getImage(); - } - } - - public void mBackgroundThread(){ - new Thread(){ - public void run(){ - while (true) { - try { - sleep(50); - if(mRequestQueue.size()>0){ - mParsedQueues.put(mRequestQueue.get(0), enums.ImageQueueStatus.M_IMAGE_LOADING); - Bitmap mBitmap = getBitmapFromURL(mRequestQueue.get(0)); - if(mBitmap==null){ - mParsedQueues.put(mRequestQueue.get(0), M_IMAGE_LOADING_FAILED); - }else { - mParsedQueues.put(mRequestQueue.get(0), M_IMAGE_LOADED_SUCCESSFULLY); - mImageCache.put(mRequestQueue.get(0), new imageRowModel(helperMethod.createRandomID(), "",mRequestQueue.get(0),mBitmap)); - } - mRequestQueue.remove(0); - } - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - }.start(); - } - - private Bitmap getBitmapFromURL(String src) { - try { - java.net.URL url = new java.net.URL(src); - Proxy proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved(CONST_PROXY_SOCKS, 9050)); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxy); - connection.setConnectTimeout(10000); - connection.setDoInput(true); - connection.connect(); - InputStream input = connection.getInputStream(); - Bitmap myBitmap = BitmapFactory.decodeStream(input); - return myBitmap; - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - /* External Triggers */ - - public Object onTrigger(dataEnums.eImageCommands pCommands, List pData){ - - if(pCommands.equals(dataEnums.eImageCommands.M_REQUEST_IMAGE_URL)){ - onRequestImage((String) pData.get(0)); - } - else if(pCommands.equals(dataEnums.eImageCommands.M_GET_IMAGE)){ - return getImage((String) pData.get(0)); - } - - return null; - } - -} +package com.darkweb.genesissearchengine.dataManager; + +import android.annotation.SuppressLint; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.dataManager.models.imageRowModel; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.darkweb.genesissearchengine.constants.constants.*; +import static com.darkweb.genesissearchengine.constants.enums.ImageQueueStatus.*; + +@SuppressLint("CommitPrefEdits") +class imageDataModel +{ + + /* Local Variables */ + + private Map mImageCache; + private Map mParsedQueues; + private ArrayList mRequestQueue; + + /* Initializations */ + + public imageDataModel(){ + mImageCache = new HashMap<>(); + mParsedQueues = new HashMap<>(); + mRequestQueue = new ArrayList<>(); + + mBackgroundThread(); + } + + /* Helper Methods */ + + private void onRequestImage(String mURL){ + String mCraftedURL = helperMethod.completeURL(helperMethod.getDomainName(mURL))+"/favicon.ico"; + if(!mParsedQueues.containsKey(mCraftedURL)){ + mRequestQueue.add(mCraftedURL); + } + } + + private Bitmap getImage(String mURL){ + String mCraftedURL = helperMethod.completeURL(helperMethod.getDomainName(mURL))+"/favicon.ico"; + if(!mParsedQueues.containsKey(mCraftedURL) || mParsedQueues.get(mCraftedURL) == M_IMAGE_LOADING_FAILED){ + return null; + }else{ + return mImageCache.get(mCraftedURL).getImage(); + } + } + + public void mBackgroundThread(){ + new Thread(){ + public void run(){ + while (true) { + try { + sleep(50); + if(mRequestQueue.size()>0){ + mParsedQueues.put(mRequestQueue.get(0), enums.ImageQueueStatus.M_IMAGE_LOADING); + Bitmap mBitmap = getBitmapFromURL(mRequestQueue.get(0)); + if(mBitmap==null){ + mParsedQueues.put(mRequestQueue.get(0), M_IMAGE_LOADING_FAILED); + }else { + mParsedQueues.put(mRequestQueue.get(0), M_IMAGE_LOADED_SUCCESSFULLY); + mImageCache.put(mRequestQueue.get(0), new imageRowModel(helperMethod.createRandomID(), "",mRequestQueue.get(0),mBitmap)); + } + mRequestQueue.remove(0); + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + }.start(); + } + + private Bitmap getBitmapFromURL(String src) { + try { + java.net.URL url = new java.net.URL(src); + Proxy proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved(CONST_PROXY_SOCKS, 9055)); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxy); + connection.setConnectTimeout(10000); + connection.setDoInput(true); + connection.connect(); + InputStream input = connection.getInputStream(); + Bitmap myBitmap = BitmapFactory.decodeStream(input); + return myBitmap; + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + /* External Triggers */ + + public Object onTrigger(dataEnums.eImageCommands pCommands, List pData){ + + if(pCommands.equals(dataEnums.eImageCommands.M_REQUEST_IMAGE_URL)){ + onRequestImage((String) pData.get(0)); + } + else if(pCommands.equals(dataEnums.eImageCommands.M_GET_IMAGE)){ + return getImage((String) pData.get(0)); + } + + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/bookmarkRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/bookmarkRowModel.java index 0aacd020..125ba2b3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/bookmarkRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/bookmarkRowModel.java @@ -1,61 +1,61 @@ -package com.darkweb.genesissearchengine.dataManager.models; - -import android.widget.ImageView; -import java.util.Calendar; -import java.util.Date; - -public class bookmarkRowModel -{ - /*Private Variables*/ - - private int m_id; - private String m_header; - private String m_description; - private Date m_date; - private ImageView m_logo; - - /*Initializations*/ - - public bookmarkRowModel(String p_header, String p_description,int p_id) { - this.m_id = p_id; - this.m_header = p_header; - this.m_description = p_description; - m_date = Calendar.getInstance().getTime(); - } - - /*Variable Setters*/ - - public void setHeader(String p_header){ - this.m_header = p_header; - } - public void setURL(String p_url){ - this.m_description = p_url; - } - public void setLogo(ImageView p_logo){ - this.m_logo = p_logo; - } - public void setDate(Date p_date) { - m_date = p_date; - } - - /*Variable Getters*/ - - public String getHeader() { - return m_header; - } - public String getDescription() { - if(m_description!=null && m_description.equals("genesishiddentechnologies.com")){ - return "genesis.onion"; - } - return m_description; - } - public int getID() { - return m_id; - } - public ImageView getLogo() { - return m_logo; - } - public Date getDate() { - return m_date; - } -} +package com.darkweb.genesissearchengine.dataManager.models; + +import android.widget.ImageView; +import java.util.Calendar; +import java.util.Date; + +public class bookmarkRowModel +{ + /*Private Variables*/ + + private int m_id; + private String m_header; + private String m_description; + private Date m_date; + private ImageView m_logo; + + /*Initializations*/ + + public bookmarkRowModel(String p_header, String p_description,int p_id) { + this.m_id = p_id; + this.m_header = p_header; + this.m_description = p_description; + m_date = Calendar.getInstance().getTime(); + } + + /*Variable Setters*/ + + public void setHeader(String p_header){ + this.m_header = p_header; + } + public void setURL(String p_url){ + this.m_description = p_url; + } + public void setLogo(ImageView p_logo){ + this.m_logo = p_logo; + } + public void setDate(Date p_date) { + m_date = p_date; + } + + /*Variable Getters*/ + + public String getHeader() { + return m_header; + } + public String getDescription() { + if(m_description!=null && m_description.equals("genesishiddentechnologies.com")){ + return "genesis.onion"; + } + return m_description; + } + public int getID() { + return m_id; + } + public ImageView getLogo() { + return m_logo; + } + public Date getDate() { + return m_date; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/historyRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/historyRowModel.java index 21ff4213..bbbe5042 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/historyRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/historyRowModel.java @@ -1,64 +1,64 @@ -package com.darkweb.genesissearchengine.dataManager.models; - -import android.widget.ImageView; -import java.util.Calendar; -import java.util.Date; - -public class historyRowModel -{ - /*Private Variables*/ - - private int mID; - private String mHeader; - private String mDescription; - private Date mDate; - private ImageView mLogo; - - /*Initializations*/ - - public historyRowModel(String pHeader, String pDescription,int pID) { - this.mID = pID; - this.mHeader = pHeader; - this.mDescription = pDescription; - mDate = Calendar.getInstance().getTime(); - } - - /*Variable Setters*/ - - public void setHeader(String pHeader){ - this.mHeader = pHeader; - } - public void setURL(String pURL){ - this.mDescription = pURL; - } - public void setLogo(ImageView pLogo){ - this.mLogo = pLogo; - } - public void setDate(Date pDate) { - mDate = pDate; - } - - /*Variable Getters*/ - - public String getHeader() { - return mHeader; - } - public String getDescription() { - if(mDescription!=null && mDescription.equals("genesishiddentechnologies.com")){ - return "genesis.onion"; - } - return mDescription; - } - public String getDescriptionParsed() { - return mDescription.substring(8); - } - public int getID() { - return mID; - } - public ImageView getLogo() { - return mLogo; - } - public Date getDate() { - return mDate; - } -} +package com.darkweb.genesissearchengine.dataManager.models; + +import android.widget.ImageView; +import java.util.Calendar; +import java.util.Date; + +public class historyRowModel +{ + /*Private Variables*/ + + private int mID; + private String mHeader; + private String mDescription; + private Date mDate; + private ImageView mLogo; + + /*Initializations*/ + + public historyRowModel(String pHeader, String pDescription,int pID) { + this.mID = pID; + this.mHeader = pHeader; + this.mDescription = pDescription; + mDate = Calendar.getInstance().getTime(); + } + + /*Variable Setters*/ + + public void setHeader(String pHeader){ + this.mHeader = pHeader; + } + public void setURL(String pURL){ + this.mDescription = pURL; + } + public void setLogo(ImageView pLogo){ + this.mLogo = pLogo; + } + public void setDate(Date pDate) { + mDate = pDate; + } + + /*Variable Getters*/ + + public String getHeader() { + return mHeader; + } + public String getDescription() { + if(mDescription!=null && mDescription.equals("genesishiddentechnologies.com")){ + return "genesis.onion"; + } + return mDescription; + } + public String getDescriptionParsed() { + return mDescription.substring(8); + } + public int getID() { + return mID; + } + public ImageView getLogo() { + return mLogo; + } + public Date getDate() { + return mDate; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageRowModel.java index 6c0e8dab..0c5d7f8a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageRowModel.java @@ -1,26 +1,26 @@ -package com.darkweb.genesissearchengine.dataManager.models; - -import android.graphics.Bitmap; - -public class imageRowModel -{ - /*Private Variables*/ - - private String mID; - private String mCreationDate; - private String mURL; - private Bitmap mImage; - - /*Initializations*/ - public imageRowModel(String pID, String pCreationDate, String pURL, Bitmap pImage){ - mID = pID; - mCreationDate = pCreationDate; - mURL = pURL; - mImage = pImage; - } - - /*Getter Setters*/ - public Bitmap getImage(){ - return mImage; - } -} +package com.darkweb.genesissearchengine.dataManager.models; + +import android.graphics.Bitmap; + +public class imageRowModel +{ + /*Private Variables*/ + + private String mID; + private String mCreationDate; + private String mURL; + private Bitmap mImage; + + /*Initializations*/ + public imageRowModel(String pID, String pCreationDate, String pURL, Bitmap pImage){ + mID = pID; + mCreationDate = pCreationDate; + mURL = pURL; + mImage = pImage; + } + + /*Getter Setters*/ + public Bitmap getImage(){ + return mImage; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java index 3e8a3232..ce40745f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java @@ -1,79 +1,79 @@ -package com.darkweb.genesissearchengine.dataManager.models; - -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; - -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; - -import org.mozilla.geckoview.GeckoSession; - -public class tabRowModel -{ - /*Private Variables*/ - - private geckoSession mSession; - private String mId; - private Bitmap mBitmap = null; - private String mDate; - - /*Initializations*/ - - public tabRowModel(geckoSession mSession) { - this.mSession = mSession; - this.mId = mSession.getSessionID(); - this.mDate = helperMethod.getCurrentDate(); - } - - public tabRowModel(String pID, String pDate, byte[] pBlob) { - this.mId = pID; - this.mDate = pDate; - if(pBlob!=null){ - mBitmap = BitmapFactory.decodeByteArray(pBlob,0,pBlob.length); - } - } - - /*Helper Method*/ - - public geckoSession getSession() - { - return mSession; - } - - public void setSession(geckoSession pSession, String pURL, String pTitle, String pTheme, GeckoSession.SessionState pSessionState) - { - mSession = pSession; - mSession.setTitle(pTitle); - mSession.setURL(pURL); - mSession.setTheme(pTheme); - - if(pSessionState != null){ - mSession.mSessionState = pSessionState; - mSession.restoreState(pSessionState); - } - - if(!status.sSettingIsAppStarted){ - if(pTitle.equals("$TITLE") || pTitle.startsWith("http://loading") || pTitle.startsWith("loading") || pURL.equals("$TITLE") || pURL.startsWith("http://loading") || pURL.startsWith("loading")){ - mSession.setTitle("about:blank"); - mSession.setURL("about:blank"); - } - } - } - - public String getmId() { - return mId; - } - - public void setmBitmap(Bitmap pBitmap) { - mBitmap = null; - mBitmap = pBitmap; - } - public Bitmap getBitmap() { - return mBitmap; - } - - public String getDate(){ - return mDate; - } -} +package com.darkweb.genesissearchengine.dataManager.models; + +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; + +import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + +import org.mozilla.geckoview.GeckoSession; + +public class tabRowModel +{ + /*Private Variables*/ + + private geckoSession mSession; + private String mId; + private Bitmap mBitmap = null; + private String mDate; + + /*Initializations*/ + + public tabRowModel(geckoSession mSession) { + this.mSession = mSession; + this.mId = mSession.getSessionID(); + this.mDate = helperMethod.getCurrentDate(); + } + + public tabRowModel(String pID, String pDate, byte[] pBlob) { + this.mId = pID; + this.mDate = pDate; + if(pBlob!=null){ + mBitmap = BitmapFactory.decodeByteArray(pBlob,0,pBlob.length); + } + } + + /*Helper Method*/ + + public geckoSession getSession() + { + return mSession; + } + + public void setSession(geckoSession pSession, String pURL, String pTitle, String pTheme, GeckoSession.SessionState pSessionState) + { + mSession = pSession; + mSession.setTitle(pTitle); + mSession.setURL(pURL); + mSession.setTheme(pTheme); + + if(pSessionState != null){ + mSession.mSessionState = pSessionState; + mSession.restoreState(pSessionState); + } + + if(!status.sSettingIsAppStarted){ + if(pTitle.equals("$TITLE") || pTitle.startsWith("http://loading") || pTitle.startsWith("loading") || pURL.equals("$TITLE") || pURL.startsWith("http://loading") || pURL.startsWith("loading")){ + mSession.setTitle("about:blank"); + mSession.setURL("about:blank"); + } + } + } + + public String getmId() { + return mId; + } + + public void setmBitmap(Bitmap pBitmap) { + mBitmap = null; + mBitmap = pBitmap; + } + public Bitmap getBitmap() { + return mBitmap; + } + + public String getDate(){ + return mDate; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java index 97157554..7c628944 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java @@ -1,95 +1,95 @@ -package com.darkweb.genesissearchengine.dataManager; - -import android.annotation.SuppressLint; -import android.content.SharedPreferences; -import android.preference.PreferenceManager; -import androidx.appcompat.app.AppCompatActivity; - -import java.util.List; - -public class preferenceDataModel { - - /* Local Variables */ - - private SharedPreferences mPrefs; - private SharedPreferences.Editor mEdit; - - /* Initializations */ - - @SuppressLint("CommitPrefEdits") - public preferenceDataModel(AppCompatActivity pAppContext){ - mPrefs = PreferenceManager.getDefaultSharedPreferences(pAppContext); - mEdit = mPrefs.edit(); - } - - /* Helper Methods */ - - void clearPrefs(){ - mEdit.clear(); - mEdit.apply(); - } - - void setString(String pValueKey, String pValue){ - mEdit.putString(pValueKey, pValue); - mEdit.apply(); - } - String getString(String pValueKey, String pValueDefault){ - return mPrefs.getString(pValueKey, pValueDefault); - } - void setBool(String valueKey, boolean value){ - mEdit.putBoolean(valueKey, value); - mEdit.apply(); - } - boolean getBool(String pValueKey, boolean pValueDefault){ - return mPrefs.getBoolean(pValueKey, pValueDefault); - } - void setInt(String valueKey, int value){ - mEdit.putInt(valueKey, value); - mEdit.apply(); - } - int getInt(String pValueKey, int pValueDefault){ - return mPrefs.getInt(pValueKey, pValueDefault); - } - void setFloat(String pValueKey, int pValue){ - mEdit.putInt(pValueKey, pValue); - mEdit.apply(); - } - int getFloat(String pValueKey, int pValueDefault){ - return mPrefs.getInt(pValueKey, pValueDefault); - } - - /* External Triggers */ - - public Object onTrigger(dataEnums.ePreferencesCommands pCommands, List pData){ - if(pCommands == dataEnums.ePreferencesCommands.M_GET_BOOL){ - return getBool((String)pData.get(0), (boolean)pData.get(1)); - } - else if(pCommands == dataEnums.ePreferencesCommands.M_GET_INT){ - return getInt((String)pData.get(0), (int)pData.get(1)); - } - else if(pCommands == dataEnums.ePreferencesCommands.M_GET_STRING){ - return getString((String)pData.get(0), (String)pData.get(1)); - } - else if(pCommands == dataEnums.ePreferencesCommands.M_GET_FLOAT){ - return getFloat((String)pData.get(0), (int)pData.get(1)); - } - else if(pCommands == dataEnums.ePreferencesCommands.M_SET_BOOL){ - setBool((String)pData.get(0), (boolean)pData.get(1)); - } - else if(pCommands == dataEnums.ePreferencesCommands.M_SET_INT){ - setInt((String)pData.get(0), (int)pData.get(1)); - } - else if(pCommands == dataEnums.ePreferencesCommands.M_SET_STRING){ - setString((String)pData.get(0), (String)pData.get(1)); - } - else if(pCommands == dataEnums.ePreferencesCommands.M_SET_FLOAT){ - setFloat((String)pData.get(0), (int)pData.get(1)); - } - else if(pCommands == dataEnums.ePreferencesCommands.M_CLEAR_PREFS){ - clearPrefs(); - } - - return null; - } - -} +package com.darkweb.genesissearchengine.dataManager; + +import android.annotation.SuppressLint; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; +import androidx.appcompat.app.AppCompatActivity; + +import java.util.List; + +public class preferenceDataModel { + + /* Local Variables */ + + private SharedPreferences mPrefs; + private SharedPreferences.Editor mEdit; + + /* Initializations */ + + @SuppressLint("CommitPrefEdits") + public preferenceDataModel(AppCompatActivity pAppContext){ + mPrefs = PreferenceManager.getDefaultSharedPreferences(pAppContext); + mEdit = mPrefs.edit(); + } + + /* Helper Methods */ + + void clearPrefs(){ + mEdit.clear(); + mEdit.apply(); + } + + void setString(String pValueKey, String pValue){ + mEdit.putString(pValueKey, pValue); + mEdit.apply(); + } + String getString(String pValueKey, String pValueDefault){ + return mPrefs.getString(pValueKey, pValueDefault); + } + void setBool(String valueKey, boolean value){ + mEdit.putBoolean(valueKey, value); + mEdit.apply(); + } + boolean getBool(String pValueKey, boolean pValueDefault){ + return mPrefs.getBoolean(pValueKey, pValueDefault); + } + void setInt(String valueKey, int value){ + mEdit.putInt(valueKey, value); + mEdit.apply(); + } + int getInt(String pValueKey, int pValueDefault){ + return mPrefs.getInt(pValueKey, pValueDefault); + } + void setFloat(String pValueKey, int pValue){ + mEdit.putInt(pValueKey, pValue); + mEdit.apply(); + } + int getFloat(String pValueKey, int pValueDefault){ + return mPrefs.getInt(pValueKey, pValueDefault); + } + + /* External Triggers */ + + public Object onTrigger(dataEnums.ePreferencesCommands pCommands, List pData){ + if(pCommands == dataEnums.ePreferencesCommands.M_GET_BOOL){ + return getBool((String)pData.get(0), (boolean)pData.get(1)); + } + else if(pCommands == dataEnums.ePreferencesCommands.M_GET_INT){ + return getInt((String)pData.get(0), (int)pData.get(1)); + } + else if(pCommands == dataEnums.ePreferencesCommands.M_GET_STRING){ + return getString((String)pData.get(0), (String)pData.get(1)); + } + else if(pCommands == dataEnums.ePreferencesCommands.M_GET_FLOAT){ + return getFloat((String)pData.get(0), (int)pData.get(1)); + } + else if(pCommands == dataEnums.ePreferencesCommands.M_SET_BOOL){ + setBool((String)pData.get(0), (boolean)pData.get(1)); + } + else if(pCommands == dataEnums.ePreferencesCommands.M_SET_INT){ + setInt((String)pData.get(0), (int)pData.get(1)); + } + else if(pCommands == dataEnums.ePreferencesCommands.M_SET_STRING){ + setString((String)pData.get(0), (String)pData.get(1)); + } + else if(pCommands == dataEnums.ePreferencesCommands.M_SET_FLOAT){ + setFloat((String)pData.get(0), (int)pData.get(1)); + } + else if(pCommands == dataEnums.ePreferencesCommands.M_CLEAR_PREFS){ + clearPrefs(); + } + + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java index 06e69827..4f4c5f1d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java @@ -1,82 +1,72 @@ -package com.darkweb.genesissearchengine.dataManager; - -import android.content.Context; -import com.android.volley.Request; -import com.android.volley.RequestQueue; -import com.android.volley.toolbox.StringRequest; -import com.android.volley.toolbox.Volley; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import java.util.Arrays; -import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.*; - -public class referenceWebsiteDataModel { - - /* Local Variables */ - - private String mReferenceWebsiteData; - private boolean mLoading = false; - - /* Initializations */ - - public referenceWebsiteDataModel(){ - mReferenceWebsiteData = status.sReferenceWebsites; - } - - /* Helper Methods */ - - private void onLoad(Context pContext){ - if(!mLoading){ - mLoading = true; - - String mRefURL; - if(status.sDeveloperBuild){ - mRefURL = CONST_GENESIS_REFERENCE_WEBSITES_DEV; - }else { - mRefURL = CONST_GENESIS_REFERENCE_WEBSITES; - } - - StringRequest stringRequest = new StringRequest(Request.Method.GET, mRefURL, - response -> { - if(response.length()>10){ - mReferenceWebsiteData = response; - status.sReferenceWebsites = response; - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.HOME_REFERENCE_WEBSITES,status.sReferenceWebsites)); - mLoading = false; - }else { - mReferenceWebsiteData = status.sReferenceWebsites; - } - }, - error -> { - mReferenceWebsiteData = status.sReferenceWebsites; - mLoading = false; - }); - - RequestQueue requestQueue = Volley.newRequestQueue(pContext); - requestQueue.add(stringRequest); - } - } - - private String onFetch(){ - try { - return mReferenceWebsiteData; - }catch (Exception ignored){} - return strings.GENERIC_EMPTY_SPACE; - } - - /* External Triggers */ - - public Object onTrigger(dataEnums.eReferenceWebsiteCommands p_commands, List pData){ - if(p_commands == dataEnums.eReferenceWebsiteCommands.M_LOAD){ - onLoad((Context) pData.get(0)); - } - if(p_commands == dataEnums.eReferenceWebsiteCommands.M_FETCH){ - return onFetch(); - } - - return null; - } - -} +package com.darkweb.genesissearchengine.dataManager; + +import android.content.Context; +import com.android.volley.Request; +import com.android.volley.RequestQueue; +import com.android.volley.toolbox.StringRequest; +import com.android.volley.toolbox.Volley; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import java.util.Arrays; +import java.util.List; +import static com.darkweb.genesissearchengine.constants.constants.*; + +public class referenceWebsiteDataModel { + + /* Local Variables */ + + private boolean mLoading = false; + + /* Initializations */ + + public referenceWebsiteDataModel(){ + } + + /* Helper Methods */ + + private void onLoad(Context pContext){ + if(!mLoading){ + mLoading = true; + + String mRefURL; + if(status.sDeveloperBuild){ + mRefURL = CONST_GENESIS_REFERENCE_WEBSITES_DEV; + }else { + mRefURL = CONST_GENESIS_REFERENCE_WEBSITES; + } + + StringRequest stringRequest = new StringRequest(Request.Method.GET, mRefURL, + response -> { + if(response.length()>10){ + status.sReferenceWebsites = response; + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.HOME_REFERENCE_WEBSITES,status.sReferenceWebsites)); + mLoading = false; + } + }, + error -> { + mLoading = false; + }); + + RequestQueue requestQueue = Volley.newRequestQueue(pContext); + requestQueue.add(stringRequest); + } + } + + private String onFetch(){ + return status.sReferenceWebsites; + } + + /* External Triggers */ + + public Object onTrigger(dataEnums.eReferenceWebsiteCommands p_commands, List pData){ + if(p_commands == dataEnums.eReferenceWebsiteCommands.M_LOAD){ + onLoad((Context) pData.get(0)); + } + if(p_commands == dataEnums.eReferenceWebsiteCommands.M_FETCH){ + return onFetch(); + } + + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java index b863be0e..fa2d6f4f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java @@ -1,228 +1,228 @@ -package com.darkweb.genesissearchengine.dataManager; - -import android.database.Cursor; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; -import com.darkweb.genesissearchengine.constants.constants; -import net.sqlcipher.database.SQLiteDatabaseHook; -import net.sqlcipher.database.SQLiteDatabase; -import org.mozilla.geckoview.GeckoSession; -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Locale; -import java.util.Objects; - -import static com.darkweb.genesissearchengine.constants.constants.CONST_DATABASE_NAME; - - -public class sqlCipherDataModel -{ - - /*Private Variables*/ - - private static SQLiteDatabase sDatabaseInstance; - - /*Initializations*/ - - private void prepareDatabaseEnvironment(AppCompatActivity app_context) { - File databaseFile = app_context.getDatabasePath(CONST_DATABASE_NAME + "_SECURE"); - - if (!databaseFile.exists()) { - Objects.requireNonNull(databaseFile.getParentFile()).mkdirs(); - } - } - - private void initialize(AppCompatActivity app_context) - { - try - { - SQLiteDatabase.loadLibs(app_context); - prepareDatabaseEnvironment(app_context); - sDatabaseInstance = SQLiteDatabase.openOrCreateDatabase(app_context.getDatabasePath(CONST_DATABASE_NAME + "_SECURE"), constants.CONST_ENCRYPTION_KEY_DATABASE,null, wrapHook(null)); - - sDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "history" + " (id INT(4) PRIMARY KEY,date DATETIME,url VARCHAR,title VARCHAR);"); - sDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "bookmark" + " (id INT(4) PRIMARY KEY,title VARCHAR,url VARCHAR);"); - sDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "tab" + " (mid INT(4) PRIMARY KEY,date,title VARCHAR,url VARCHAR,mThumbnail BLOB, theme VARCHAR, session VARCHAR);"); - - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - } - - /*Helper Methods*/ - - private SQLiteDatabaseHook wrapHook(final SQLiteDatabaseHook hook) { - if (hook == null) - { - return keyHook; - } - return new SQLiteDatabaseHook() { - @Override - public void preKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) { - keyHook.preKey(sqLiteDatabase); - hook.preKey(sqLiteDatabase); - } - - @Override - public void postKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) { - keyHook.postKey(sqLiteDatabase); - hook.preKey(sqLiteDatabase); - } - }; - } - - SQLiteDatabaseHook keyHook = new SQLiteDatabaseHook() { - @Override - public void preKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) { - - } - - @Override - public void postKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) { - - } - }; - - private void execSQL(String query,String[] params) - { - if(params==null) - { - sDatabaseInstance.execSQL(query); - } - else - { - sDatabaseInstance.execSQL(query,params); - } - } - - private ArrayList selectHistory(int pStartIndex,int pEndIndex){ - ArrayList tempmodel = new ArrayList<>(); - - Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM history ORDER BY date DESC LIMIT " + pEndIndex + " OFFSET "+pStartIndex, null); - if (c.moveToFirst()){ - do { - historyRowModel model = new historyRowModel(c.getString(3), c.getString(2),Integer.parseInt(c.getString(0))); - try { - Date m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.US).parse(c.getString(1)); - model.setDate(m_date); - } catch (Exception e) { - e.printStackTrace(); - } - if(Calendar.getInstance().getTime().getTime() < model.getDate().getTime()){ - tempmodel.add(model); - }else { - tempmodel.add(model); - } - } while(c.moveToNext()); - } - c.close(); - - return tempmodel; - } - - private ArrayList selectTabs(){ - ArrayList mTempListModel = new ArrayList<>(); - - Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM tab ORDER BY date ASC", null); - if (c.moveToFirst()){ - do { - geckoSession mSession = activityContextManager.getInstance().getHomeController().onNewTabInit(); - tabRowModel model = new tabRowModel(c.getString(0), c.getString(1),c.getBlob(4)); - GeckoSession.SessionState session = null; - try { - // if(status.sRestoreTabs){ - session = GeckoSession.SessionState.fromString(c.getString(6)); - // } - } catch (Exception ex) { - ex.printStackTrace(); - } - model.setSession(mSession, c.getString(3),c.getString(2), c.getString(5), session); - model.getSession().setSessionID(model.getmId()); - if(session != null){ - mTempListModel.add(0, model); - }else { - mTempListModel.add(model); - } - } while(c.moveToNext()); - } - c.close(); - - return mTempListModel; - } - - private int getLargestHistoryID(){ - int id = 0; - Cursor c = sDatabaseInstance.rawQuery("SELECT max(id) FROM history", null); - - if (c.moveToFirst()){ - do { - if(c.getString(0)==null){ - break; - }else { - id = Integer.parseInt(c.getString(0)); - } - } while(c.moveToNext()); - } - c.close(); - - return id; - } - - private ArrayList selectBookmark(){ - ArrayList tempmodel = new ArrayList<>(); - Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM bookmark ORDER BY id DESC ", null); - - if (c.moveToFirst()){ - do { - tempmodel.add(new bookmarkRowModel(c.getString(1), c.getString(2),Integer.parseInt(c.getString(0)))); - } while(c.moveToNext()); - } - c.close(); - - return tempmodel; - } - - private void deleteFromList(int index,String table) { - execSQL("delete from "+table+" where id="+index,null); - } - - /* External Triggers */ - - public Object onTrigger(dataEnums.eSqlCipherCommands pCommands, List pData){ - if(pCommands == dataEnums.eSqlCipherCommands.M_INIT){ - initialize((AppCompatActivity)pData.get(0)); - } - else if(pCommands == dataEnums.eSqlCipherCommands.M_EXEC_SQL){ - execSQL((String)pData.get(0), (String[])pData.get(1)); - } - else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_BOOKMARK){ - return selectBookmark(); - } - else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_HISTORY){ - return selectHistory((int)pData.get(0), (int)pData.get(1)); - } - else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_TABS){ - return selectTabs(); - } - else if(pCommands == dataEnums.eSqlCipherCommands.M_HISTORY_ID){ - return getLargestHistoryID(); - } - else if(pCommands == dataEnums.eSqlCipherCommands.M_DELETE_FROM_HISTORY){ - deleteFromList((int)pData.get(0), (String)pData.get(1)); - } - - return null; - } - -} +package com.darkweb.genesissearchengine.dataManager; + +import android.database.Cursor; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; +import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; +import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; +import com.darkweb.genesissearchengine.constants.constants; +import net.sqlcipher.database.SQLiteDatabaseHook; +import net.sqlcipher.database.SQLiteDatabase; +import org.mozilla.geckoview.GeckoSession; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import static com.darkweb.genesissearchengine.constants.constants.CONST_DATABASE_NAME; + + +public class sqlCipherDataModel +{ + + /*Private Variables*/ + + private static SQLiteDatabase sDatabaseInstance; + + /*Initializations*/ + + private void prepareDatabaseEnvironment(AppCompatActivity app_context) { + File databaseFile = app_context.getDatabasePath(CONST_DATABASE_NAME + "_SECURE"); + + if (!databaseFile.exists()) { + Objects.requireNonNull(databaseFile.getParentFile()).mkdirs(); + } + } + + private void initialize(AppCompatActivity app_context) + { + try + { + SQLiteDatabase.loadLibs(app_context); + prepareDatabaseEnvironment(app_context); + sDatabaseInstance = SQLiteDatabase.openOrCreateDatabase(app_context.getDatabasePath(CONST_DATABASE_NAME + "_SECURE"), constants.CONST_ENCRYPTION_KEY_DATABASE,null, wrapHook(null)); + + sDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "history" + " (id INT(4) PRIMARY KEY,date DATETIME,url VARCHAR,title VARCHAR);"); + sDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "bookmark" + " (id INT(4) PRIMARY KEY,title VARCHAR,url VARCHAR);"); + sDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "tab" + " (mid INT(4) PRIMARY KEY,date,title VARCHAR,url VARCHAR,mThumbnail BLOB, theme VARCHAR, session VARCHAR);"); + + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + } + + /*Helper Methods*/ + + private SQLiteDatabaseHook wrapHook(final SQLiteDatabaseHook hook) { + if (hook == null) + { + return keyHook; + } + return new SQLiteDatabaseHook() { + @Override + public void preKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) { + keyHook.preKey(sqLiteDatabase); + hook.preKey(sqLiteDatabase); + } + + @Override + public void postKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) { + keyHook.postKey(sqLiteDatabase); + hook.preKey(sqLiteDatabase); + } + }; + } + + SQLiteDatabaseHook keyHook = new SQLiteDatabaseHook() { + @Override + public void preKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) { + + } + + @Override + public void postKey(net.sqlcipher.database.SQLiteDatabase sqLiteDatabase) { + + } + }; + + private void execSQL(String query,String[] params) + { + if(params==null) + { + sDatabaseInstance.execSQL(query); + } + else + { + sDatabaseInstance.execSQL(query,params); + } + } + + private ArrayList selectHistory(int pStartIndex,int pEndIndex){ + ArrayList tempmodel = new ArrayList<>(); + + Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM history ORDER BY date DESC LIMIT " + pEndIndex + " OFFSET "+pStartIndex, null); + if (c.moveToFirst()){ + do { + historyRowModel model = new historyRowModel(c.getString(3), c.getString(2),Integer.parseInt(c.getString(0))); + try { + Date m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.US).parse(c.getString(1)); + model.setDate(m_date); + } catch (Exception e) { + e.printStackTrace(); + } + if(Calendar.getInstance().getTime().getTime() < model.getDate().getTime()){ + tempmodel.add(model); + }else { + tempmodel.add(model); + } + } while(c.moveToNext()); + } + c.close(); + + return tempmodel; + } + + private ArrayList selectTabs(){ + ArrayList mTempListModel = new ArrayList<>(); + + Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM tab ORDER BY date ASC", null); + if (c.moveToFirst()){ + do { + geckoSession mSession = activityContextManager.getInstance().getHomeController().onNewTabInit(); + tabRowModel model = new tabRowModel(c.getString(0), c.getString(1),c.getBlob(4)); + GeckoSession.SessionState session = null; + try { + // if(status.sRestoreTabs){ + session = GeckoSession.SessionState.fromString(c.getString(6)); + // } + } catch (Exception ex) { + ex.printStackTrace(); + } + model.setSession(mSession, c.getString(3),c.getString(2), c.getString(5), session); + model.getSession().setSessionID(model.getmId()); + if(session != null){ + mTempListModel.add(0, model); + }else { + mTempListModel.add(model); + } + } while(c.moveToNext()); + } + c.close(); + + return mTempListModel; + } + + private int getLargestHistoryID(){ + int id = 0; + Cursor c = sDatabaseInstance.rawQuery("SELECT max(id) FROM history", null); + + if (c.moveToFirst()){ + do { + if(c.getString(0)==null){ + break; + }else { + id = Integer.parseInt(c.getString(0)); + } + } while(c.moveToNext()); + } + c.close(); + + return id; + } + + private ArrayList selectBookmark(){ + ArrayList tempmodel = new ArrayList<>(); + Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM bookmark ORDER BY id DESC ", null); + + if (c.moveToFirst()){ + do { + tempmodel.add(new bookmarkRowModel(c.getString(1), c.getString(2),Integer.parseInt(c.getString(0)))); + } while(c.moveToNext()); + } + c.close(); + + return tempmodel; + } + + private void deleteFromList(int index,String table) { + execSQL("delete from "+table+" where id="+index,null); + } + + /* External Triggers */ + + public Object onTrigger(dataEnums.eSqlCipherCommands pCommands, List pData){ + if(pCommands == dataEnums.eSqlCipherCommands.M_INIT){ + initialize((AppCompatActivity)pData.get(0)); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_EXEC_SQL){ + execSQL((String)pData.get(0), (String[])pData.get(1)); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_BOOKMARK){ + return selectBookmark(); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_HISTORY){ + return selectHistory((int)pData.get(0), (int)pData.get(1)); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_TABS){ + return selectTabs(); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_HISTORY_ID){ + return getLargestHistoryID(); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_DELETE_FROM_HISTORY){ + deleteFromList((int)pData.get(0), (String)pData.get(1)); + } + + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java index 57b92986..620737af 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java @@ -1,365 +1,365 @@ -package com.darkweb.genesissearchengine.dataManager; - -import android.content.Context; -import android.view.textservice.SentenceSuggestionsInfo; -import android.view.textservice.SpellCheckerSession; -import android.view.textservice.SuggestionsInfo; - -import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; -import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.helperManager.helperMethod; - -import java.util.ArrayList; -import java.util.List; - -public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSessionListener { - - /*Private Variables*/ - - private ArrayList mHintListLocalCache; - private ArrayList mCurrentList = new ArrayList<>(); - - - /*Initializations*/ - - public suggestionDataModel(Context mContext){ - mHintListLocalCache = initSuggestions(); - } - - /*Helper Methods*/ - - private ArrayList getDefaultSuggestionsOnStart(String pQuery){ - - if(pQuery.equals(strings.GENERIC_EMPTY_STR) || pQuery.trim().isEmpty()) { - pQuery = "hidden web"; - } - mCurrentList.clear(); - if(!pQuery.equals(strings.GENERIC_EMPTY_STR) && !pQuery.equals("about:blank") && !pQuery.contains("?") && !pQuery.contains("/") && !pQuery.contains(" ") && !pQuery.contains(" ") && !pQuery.contains("\n")){ - mCurrentList.size(); - int sepPos = pQuery.indexOf("."); - if (sepPos == -1) { - mCurrentList.add( 0, new historyRowModel(pQuery+".com", strings.GENERIC_EMPTY_STR,-1)); - mCurrentList.add( 0, new historyRowModel(pQuery+".onion", strings.GENERIC_EMPTY_STR,-1)); - }else - { - if(!pQuery.equals(pQuery.substring(0,sepPos)+".com")){ - mCurrentList.add( 0, new historyRowModel(pQuery.substring(0,sepPos)+".com", strings.GENERIC_EMPTY_STR,-1)); - } - if(!pQuery.equals(pQuery.substring(0,sepPos)+".onion")){ - mCurrentList.add( 0, new historyRowModel(pQuery.substring(0,sepPos)+".onion", strings.GENERIC_EMPTY_STR,-1)); - } - } - } - - mCurrentList.add( 0,new historyRowModel(pQuery, strings.GENERIC_EMPTY_STR,-1)); - return mCurrentList; - } - - private ArrayList getDefaultSuggestions(String pQuery, int mSize, ArrayList mDuplicationHandler, boolean pDefaultHostChaned){ - - if(pQuery.trim().isEmpty()) { - pQuery = ""; - } - - for(int count = 0; count<= mHintListLocalCache.size()-1 && mHintListLocalCache.size()<500; count++){ - if(mHintListLocalCache.get(count).getHeader().toLowerCase().contains(pQuery)){ - if(mHintListLocalCache.get(count).getHeader().toLowerCase().startsWith(pQuery)){ - if(mDuplicationHandler!=null && !mDuplicationHandler.contains(mHintListLocalCache.get(count).getDescriptionParsed())) { - if(pDefaultHostChaned){ - mCurrentList.add(1, new historyRowModel(mHintListLocalCache.get(count).getHeader(), mHintListLocalCache.get(count).getDescriptionParsed(), -1)); - }else { - mCurrentList.add(0, new historyRowModel(mHintListLocalCache.get(count).getHeader(), mHintListLocalCache.get(count).getDescriptionParsed(), -1)); - } - } - if(mCurrentList.size() + mSize > 6){ - break; - } - }else { - if(mCurrentList.size() + mSize <= 6){ - mCurrentList.add(new historyRowModel(mHintListLocalCache.get(count).getHeader(),mHintListLocalCache.get(count).getDescriptionParsed(),-1)); - } - } - }else if(mHintListLocalCache.get(count).getDescriptionParsed().toLowerCase().contains(pQuery)){ - if(mHintListLocalCache.get(count).getHeader().toLowerCase().startsWith(pQuery)){ - if(mDuplicationHandler!=null && !mDuplicationHandler.contains(mHintListLocalCache.get(count).getDescriptionParsed())) { - if(pDefaultHostChaned){ - mCurrentList.add(1, new historyRowModel(mHintListLocalCache.get(count).getHeader(), mHintListLocalCache.get(count).getDescriptionParsed(), -1)); - }else { - mCurrentList.add(0, new historyRowModel(mHintListLocalCache.get(count).getHeader(), mHintListLocalCache.get(count).getDescriptionParsed(), -1)); - } - } - if(mCurrentList.size() + mSize > 6){ - break; - } - }else { - if(mCurrentList.size() + mSize <= 6){ - mCurrentList.add(new historyRowModel(mHintListLocalCache.get(count).getHeader(),mHintListLocalCache.get(count).getDescriptionParsed(),-1)); - } - } - } - } - - if(mCurrentList.size()<=0) { - mCurrentList.add( mSize,new historyRowModel("Genesis Search", "genesis.onion",-1)); - } - - return mCurrentList; - } - - private ArrayList getSuggestions(String pQuery, ArrayList pHistory, ArrayList pBookmarks){ - - if(pQuery.trim().isEmpty()) { - pQuery = ""; - } - - mCurrentList = new ArrayList<>(); - String mQueryOriginal = pQuery; - pQuery = pQuery.replace("+","%").replace(" ","+"); - ArrayList mHistory = pHistory; - ArrayList mBookmarks = pBookmarks; - - pQuery = pQuery.toLowerCase(); - ArrayList mDuplicationHandler = new ArrayList<>(); - - if(status.sSettingSearchHistory){ - pQuery = pQuery.toLowerCase(); - for(int count = 0; count<= mHistory.size()-1 && mHistory.size()<500; count++){ - historyRowModel mTempModel; - if(!mDuplicationHandler.contains(mHistory.get(count).getDescription())){ - if(mHistory.get(count).getHeader().toLowerCase().contains(pQuery)){ - mTempModel = new historyRowModel(mHistory.get(count).getHeader(),mHistory.get(count).getDescription(),-1); - if(!mCurrentList.contains(mTempModel)){ - mDuplicationHandler.add(mTempModel.getDescription()); - mCurrentList.add(mTempModel); - } - }else if(mHistory.get(count).getDescription().toLowerCase().contains(pQuery)){ - mTempModel = new historyRowModel(mHistory.get(count).getHeader(),mHistory.get(count).getDescription(),-1); - if(!mCurrentList.contains(mTempModel)){ - mDuplicationHandler.add(mTempModel.getDescription()); - mCurrentList.add(mTempModel); - } - } - if(mCurrentList.size()>6){ - break; - } - } - } - } - - if(status.sSettingSearchHistory && mCurrentList.size()>4) { - for (int count = 0; count <= mBookmarks.size() - 1 && mBookmarks.size() < 500; count++) { - if(!mDuplicationHandler.contains(mBookmarks.get(count).getDescription())){ - if (mBookmarks.get(count).getHeader().toLowerCase().contains(pQuery)) { - mDuplicationHandler.add(mBookmarks.get(count).getDescription()); - mCurrentList.add(mCurrentList.size() - 1,new historyRowModel(mBookmarks.get(count).getHeader(), mBookmarks.get(count).getDescription(), -1)); - } else if (mCurrentList.size() > 0 && mBookmarks.get(count).getDescription().toLowerCase().contains(pQuery)) { - mDuplicationHandler.add(mBookmarks.get(count).getDescription()); - mCurrentList.add(mCurrentList.size() - 1, new historyRowModel(mBookmarks.get(count).getHeader(), mBookmarks.get(count).getDescription(), -1)); - } - if(mCurrentList.size()>6){ - break; - } - } - } - } - - boolean mDefaultHostChaned = false; - if(mCurrentList.size()>3){ - String mHost1 = helperMethod.getHost(helperMethod.completeURL(mCurrentList.get(0).getDescription())); - String mHost2 = helperMethod.getHost(helperMethod.completeURL(mCurrentList.get(1).getDescription())); - String mHost3 = helperMethod.getHost(helperMethod.completeURL(mCurrentList.get(2).getDescription())); - - String mHostReal = mHost1.replace("www.",""); - if(mHost1.equals(mHost2) && mHost1.equals(mHost3) && !mDuplicationHandler.contains(mHostReal)){ - mCurrentList.add( 0,new historyRowModel(mHostReal, strings.GENERIC_EMPTY_STR,-1)); - mDuplicationHandler.add(mHostReal); - } - mDefaultHostChaned = true; - } - - getDefaultSuggestions(pQuery, mCurrentList.size(), mDuplicationHandler, mDefaultHostChaned); - - boolean mHostAppend = false; - if(mCurrentList.size()>1 && helperMethod.getHost(helperMethod.completeURL(mCurrentList.get(0).getDescription())).equals(helperMethod.completeURL(mCurrentList.get(1).getDescription()))){ - mHostAppend = true; - } - - int mSize = mCurrentList.size(); - if(mCurrentList.size()<3){ - - if(!mQueryOriginal.equals(strings.GENERIC_EMPTY_STR) && !mQueryOriginal.equals("about:blank") && !mQueryOriginal.contains("?") && !mQueryOriginal.contains("/") && !mQueryOriginal.contains(" ") && !mQueryOriginal.contains(" ") && !mQueryOriginal.contains("\n")){ - mCurrentList.size(); - int sepPos = pQuery.indexOf("."); - if (sepPos == -1) { - mCurrentList.add( mSize, new historyRowModel(mQueryOriginal+".com", strings.GENERIC_EMPTY_STR,-1)); - mCurrentList.add( mSize, new historyRowModel(mQueryOriginal+".onion", strings.GENERIC_EMPTY_STR,-1)); - }else - { - if(!pQuery.equals(pQuery.substring(0,sepPos)+".com")){ - mCurrentList.add( mSize, new historyRowModel(pQuery.substring(0,sepPos)+".com", strings.GENERIC_EMPTY_STR,-1)); - } - if(!pQuery.equals(pQuery.substring(0,sepPos)+".onion")){ - mCurrentList.add( mSize, new historyRowModel(pQuery.substring(0,sepPos)+".onion", strings.GENERIC_EMPTY_STR,-1)); - } - } - } - } - - if(mHostAppend){ - if(mCurrentList.get(0).getDescription().startsWith(pQuery)){ - mCurrentList.add( mSize,new historyRowModel(mCurrentList.get(0).getHeader(), mCurrentList.get(0).getDescription(),-1)); - } - } - - if(pQuery.length()>0){ - if(!pQuery.equals("about:blank")){ - mCurrentList.add( 0,new historyRowModel(pQuery, strings.GENERIC_EMPTY_STR,-1)); - } - } - if(mCurrentList.size()<=0) { - mCurrentList.add( mSize,new historyRowModel("Genesis Search", "genesis.onion",-1)); - } - - return mCurrentList; - } - - private ArrayList initSuggestions(){ - mHintListLocalCache = new ArrayList<>(); - - mHintListLocalCache.add(new historyRowModel("Duckduckgo","https://duckduckgo.com",-1 )); - mHintListLocalCache.add(new historyRowModel("BBC","https://bbc.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Youtube","https://youtube.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Facebook","https://facebook.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Twitter","https://twitter.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Amazon","https://amazon.com",-1 )); - mHintListLocalCache.add(new historyRowModel("IMDB","https://imdb.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Reddit","https://reddit.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Pinterest","https://pinterest.com",-1 )); - mHintListLocalCache.add(new historyRowModel("EBay","https://ebay.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Trip Advisor","https://tripadvisor.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Craigslist","https://craigslist.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Walmart","https://walmart.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Instagram","https://instagram.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Google","https://google.com",-1 )); - mHintListLocalCache.add(new historyRowModel("NY Times","https://nytimes.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Apple","https://apple.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Linkedin","https://linkedin.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Play.Google","https://play.google.com",-1 )); - mHintListLocalCache.add(new historyRowModel("ESPN","https://espn.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Webmd","https://webmd.com",-1 )); - mHintListLocalCache.add(new historyRowModel("CNN","https://cnn.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Homedepot","https://homedepot.com",-1 )); - mHintListLocalCache.add(new historyRowModel("ETSY","https://etsy.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Netflix","https://netflix.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Quora","https://quora.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Microsoft","https://microsoft.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Target","https://target.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Merriam Webster","https://merriam-webster.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Forbes","https://forbes.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Mapquest","https://mapquest.com",-1 )); - mHintListLocalCache.add(new historyRowModel("NIH","https://nih.gov",-1 )); - mHintListLocalCache.add(new historyRowModel("Gamepedia","https://gamepedia.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Yahoo","https://yahoo.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Healthline","https://healthline.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Foxnews","https://foxnews.com",-1 )); - mHintListLocalCache.add(new historyRowModel("All Recipes","https://allrecipes.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Quizlet","https://quizlet.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Weather","https://weather.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Bestbuy","https://bestbuy.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Urbandictionary","https://urbandictionary.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Mayoclinic","https://mayoclinic.org",-1 )); - mHintListLocalCache.add(new historyRowModel("AOL","https://aol.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Genius","https://genius.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Zillow","https://zillow.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Usatoday","https://usatoday.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Glassdoor","https://glassdoor.com",-1 )); - mHintListLocalCache.add(new historyRowModel("MSN","https://msn.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Rotten Tomatoes","https://rottentomatoes.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Lowes","https://lowes.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Dictionary","https://dictionary.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Business Insider","https://businessinsider.com",-1 )); - mHintListLocalCache.add(new historyRowModel("US News","https://usnews.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Medical News Today","https://medicalnewstoday.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Britannica","https://britannica.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Washington Post","https://washingtonpost.com",-1 )); - mHintListLocalCache.add(new historyRowModel("USPS","https://usps.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Finance Yahoo","https://finance.yahoo.com",-1 )); - mHintListLocalCache.add(new historyRowModel("IRS","https://finance.irs.gov",-1 )); - mHintListLocalCache.add(new historyRowModel("Yellow Pages","https://yellowpages.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Chase","https://chase.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Retail Menot","https://retailmenot.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Accuweather","https://accuweather.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Way Fair","https://wayfair.com",-1 )); - mHintListLocalCache.add(new historyRowModel("GO","https://go.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Live","https://live.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Login Yahoo","https://login.yahoo.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Steam Community","https://steamcommunity.com",-1 )); - mHintListLocalCache.add(new historyRowModel("XFinity","https://xfinity.com",-1 )); - mHintListLocalCache.add(new historyRowModel("CNET","https://cnet.com",-1 )); - mHintListLocalCache.add(new historyRowModel("IGN","https://ign.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Steam Powered","https://steampowered.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Macys","https://macys.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Wikihow","https://wikihow.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Wikipedia","https://en.wikipedia.org/",-1 )); - mHintListLocalCache.add(new historyRowModel("Mail Yahoo","https://mail.yahoo.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Wiktionary","https://wiktionary.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Cbssports","https://cbssports.com",-1 )); - mHintListLocalCache.add(new historyRowModel("CNBC","https://cnbc.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Bank Of America","https://bankofamerica.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Expedia","https://expedia.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Wellsfargo","https://wellsfargo.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Groupon","https://groupon.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Twitch","https://twitch.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Khan Academy","https://khanacademy.com",-1 )); - mHintListLocalCache.add(new historyRowModel("The Guardian","https://theguardian.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Paypal","https://paypal.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Spotify","https://spotify.com",-1 )); - mHintListLocalCache.add(new historyRowModel("ATT","https://att.com",-1 )); - mHintListLocalCache.add(new historyRowModel("NFL","https://nfl.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Realtor","https://realtor.com",-1 )); - mHintListLocalCache.add(new historyRowModel("CA Gov","https://ca.gov",-1 )); - mHintListLocalCache.add(new historyRowModel("Good Reads","https://goodreads.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Office","https://office.com",-1 )); - mHintListLocalCache.add(new historyRowModel("UFL","https://ufl.com",-1 )); - mHintListLocalCache.add(new historyRowModel("MLB","https://mlb.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Food Network","https://foodnetwork.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Apartments","https://apartments.com",-1 )); - mHintListLocalCache.add(new historyRowModel("NPR","https://npr.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Wow Head","https://wowhead.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Bing","https://bing.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Google","https://google.com",-1 )); - mHintListLocalCache.add(new historyRowModel("Genesis Search","https://genesis.onion",-1 )); - - return mHintListLocalCache; - } - - /*External Redirections*/ - - public Object onTrigger(dataEnums.eSuggestionCommands pCommands, List pData){ - - if(pCommands == dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS) - { - return getSuggestions((String) pData.get(0), (ArrayList)pData.get(1), (ArrayList)pData.get(2)); - } - else if(pCommands == dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION) - { - return getDefaultSuggestionsOnStart((String) pData.get(0)); - } - - return null; - } - - /*Local Overrides*/ - - @Override - public void onGetSuggestions(SuggestionsInfo[] results) { - - } - - @Override - public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] results) { - - } -} +package com.darkweb.genesissearchengine.dataManager; + +import android.content.Context; +import android.view.textservice.SentenceSuggestionsInfo; +import android.view.textservice.SpellCheckerSession; +import android.view.textservice.SuggestionsInfo; + +import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + +import java.util.ArrayList; +import java.util.List; + +public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSessionListener { + + /*Private Variables*/ + + private ArrayList mHintListLocalCache; + private ArrayList mCurrentList = new ArrayList<>(); + + + /*Initializations*/ + + public suggestionDataModel(Context mContext){ + mHintListLocalCache = initSuggestions(); + } + + /*Helper Methods*/ + + private ArrayList getDefaultSuggestionsOnStart(String pQuery){ + + if(pQuery.equals(strings.GENERIC_EMPTY_STR) || pQuery.trim().isEmpty()) { + pQuery = "hidden web"; + } + mCurrentList.clear(); + if(!pQuery.equals(strings.GENERIC_EMPTY_STR) && !pQuery.equals("about:blank") && !pQuery.contains("?") && !pQuery.contains("/") && !pQuery.contains(" ") && !pQuery.contains(" ") && !pQuery.contains("\n")){ + mCurrentList.size(); + int sepPos = pQuery.indexOf("."); + if (sepPos == -1) { + mCurrentList.add( 0, new historyRowModel(pQuery+".com", strings.GENERIC_EMPTY_STR,-1)); + mCurrentList.add( 0, new historyRowModel(pQuery+".onion", strings.GENERIC_EMPTY_STR,-1)); + }else + { + if(!pQuery.equals(pQuery.substring(0,sepPos)+".com")){ + mCurrentList.add( 0, new historyRowModel(pQuery.substring(0,sepPos)+".com", strings.GENERIC_EMPTY_STR,-1)); + } + if(!pQuery.equals(pQuery.substring(0,sepPos)+".onion")){ + mCurrentList.add( 0, new historyRowModel(pQuery.substring(0,sepPos)+".onion", strings.GENERIC_EMPTY_STR,-1)); + } + } + } + + mCurrentList.add( 0,new historyRowModel(pQuery, strings.GENERIC_EMPTY_STR,-1)); + return mCurrentList; + } + + private ArrayList getDefaultSuggestions(String pQuery, int mSize, ArrayList mDuplicationHandler, boolean pDefaultHostChaned){ + + if(pQuery.trim().isEmpty()) { + pQuery = ""; + } + + for(int count = 0; count<= mHintListLocalCache.size()-1 && mHintListLocalCache.size()<500; count++){ + if(mHintListLocalCache.get(count).getHeader().toLowerCase().contains(pQuery)){ + if(mHintListLocalCache.get(count).getHeader().toLowerCase().startsWith(pQuery)){ + if(mDuplicationHandler!=null && !mDuplicationHandler.contains(mHintListLocalCache.get(count).getDescriptionParsed())) { + if(pDefaultHostChaned){ + mCurrentList.add(1, new historyRowModel(mHintListLocalCache.get(count).getHeader(), mHintListLocalCache.get(count).getDescriptionParsed(), -1)); + }else { + mCurrentList.add(0, new historyRowModel(mHintListLocalCache.get(count).getHeader(), mHintListLocalCache.get(count).getDescriptionParsed(), -1)); + } + } + if(mCurrentList.size() + mSize > 6){ + break; + } + }else { + if(mCurrentList.size() + mSize <= 6){ + mCurrentList.add(new historyRowModel(mHintListLocalCache.get(count).getHeader(),mHintListLocalCache.get(count).getDescriptionParsed(),-1)); + } + } + }else if(mHintListLocalCache.get(count).getDescriptionParsed().toLowerCase().contains(pQuery)){ + if(mHintListLocalCache.get(count).getHeader().toLowerCase().startsWith(pQuery)){ + if(mDuplicationHandler!=null && !mDuplicationHandler.contains(mHintListLocalCache.get(count).getDescriptionParsed())) { + if(pDefaultHostChaned){ + mCurrentList.add(1, new historyRowModel(mHintListLocalCache.get(count).getHeader(), mHintListLocalCache.get(count).getDescriptionParsed(), -1)); + }else { + mCurrentList.add(0, new historyRowModel(mHintListLocalCache.get(count).getHeader(), mHintListLocalCache.get(count).getDescriptionParsed(), -1)); + } + } + if(mCurrentList.size() + mSize > 6){ + break; + } + }else { + if(mCurrentList.size() + mSize <= 6){ + mCurrentList.add(new historyRowModel(mHintListLocalCache.get(count).getHeader(),mHintListLocalCache.get(count).getDescriptionParsed(),-1)); + } + } + } + } + + if(mCurrentList.size()<=0) { + mCurrentList.add( mSize,new historyRowModel("Genesis Search", "genesis.onion",-1)); + } + + return mCurrentList; + } + + private ArrayList getSuggestions(String pQuery, ArrayList pHistory, ArrayList pBookmarks){ + + if(pQuery.trim().isEmpty()) { + pQuery = ""; + } + + mCurrentList = new ArrayList<>(); + String mQueryOriginal = pQuery; + pQuery = pQuery.replace("+","%").replace(" ","+"); + ArrayList mHistory = pHistory; + ArrayList mBookmarks = pBookmarks; + + pQuery = pQuery.toLowerCase(); + ArrayList mDuplicationHandler = new ArrayList<>(); + + if(status.sSettingSearchHistory){ + pQuery = pQuery.toLowerCase(); + for(int count = 0; count<= mHistory.size()-1 && mHistory.size()<500; count++){ + historyRowModel mTempModel; + if(!mDuplicationHandler.contains(mHistory.get(count).getDescription())){ + if(mHistory.get(count).getHeader().toLowerCase().contains(pQuery)){ + mTempModel = new historyRowModel(mHistory.get(count).getHeader(),mHistory.get(count).getDescription(),-1); + if(!mCurrentList.contains(mTempModel)){ + mDuplicationHandler.add(mTempModel.getDescription()); + mCurrentList.add(mTempModel); + } + }else if(mHistory.get(count).getDescription().toLowerCase().contains(pQuery)){ + mTempModel = new historyRowModel(mHistory.get(count).getHeader(),mHistory.get(count).getDescription(),-1); + if(!mCurrentList.contains(mTempModel)){ + mDuplicationHandler.add(mTempModel.getDescription()); + mCurrentList.add(mTempModel); + } + } + if(mCurrentList.size()>6){ + break; + } + } + } + } + + if(status.sSettingSearchHistory && mCurrentList.size()>4) { + for (int count = 0; count <= mBookmarks.size() - 1 && mBookmarks.size() < 500; count++) { + if(!mDuplicationHandler.contains(mBookmarks.get(count).getDescription())){ + if (mBookmarks.get(count).getHeader().toLowerCase().contains(pQuery)) { + mDuplicationHandler.add(mBookmarks.get(count).getDescription()); + mCurrentList.add(mCurrentList.size() - 1,new historyRowModel(mBookmarks.get(count).getHeader(), mBookmarks.get(count).getDescription(), -1)); + } else if (mCurrentList.size() > 0 && mBookmarks.get(count).getDescription().toLowerCase().contains(pQuery)) { + mDuplicationHandler.add(mBookmarks.get(count).getDescription()); + mCurrentList.add(mCurrentList.size() - 1, new historyRowModel(mBookmarks.get(count).getHeader(), mBookmarks.get(count).getDescription(), -1)); + } + if(mCurrentList.size()>6){ + break; + } + } + } + } + + boolean mDefaultHostChaned = false; + if(mCurrentList.size()>3){ + String mHost1 = helperMethod.getHost(helperMethod.completeURL(mCurrentList.get(0).getDescription())); + String mHost2 = helperMethod.getHost(helperMethod.completeURL(mCurrentList.get(1).getDescription())); + String mHost3 = helperMethod.getHost(helperMethod.completeURL(mCurrentList.get(2).getDescription())); + + String mHostReal = mHost1.replace("www.",""); + if(mHost1.equals(mHost2) && mHost1.equals(mHost3) && !mDuplicationHandler.contains(mHostReal)){ + mCurrentList.add( 0,new historyRowModel(mHostReal, strings.GENERIC_EMPTY_STR,-1)); + mDuplicationHandler.add(mHostReal); + } + mDefaultHostChaned = true; + } + + getDefaultSuggestions(pQuery, mCurrentList.size(), mDuplicationHandler, mDefaultHostChaned); + + boolean mHostAppend = false; + if(mCurrentList.size()>1 && helperMethod.getHost(helperMethod.completeURL(mCurrentList.get(0).getDescription())).equals(helperMethod.completeURL(mCurrentList.get(1).getDescription()))){ + mHostAppend = true; + } + + int mSize = mCurrentList.size(); + if(mCurrentList.size()<3){ + + if(!mQueryOriginal.equals(strings.GENERIC_EMPTY_STR) && !mQueryOriginal.equals("about:blank") && !mQueryOriginal.contains("?") && !mQueryOriginal.contains("/") && !mQueryOriginal.contains(" ") && !mQueryOriginal.contains(" ") && !mQueryOriginal.contains("\n")){ + mCurrentList.size(); + int sepPos = pQuery.indexOf("."); + if (sepPos == -1) { + mCurrentList.add( mSize, new historyRowModel(mQueryOriginal+".com", strings.GENERIC_EMPTY_STR,-1)); + mCurrentList.add( mSize, new historyRowModel(mQueryOriginal+".onion", strings.GENERIC_EMPTY_STR,-1)); + }else + { + if(!pQuery.equals(pQuery.substring(0,sepPos)+".com")){ + mCurrentList.add( mSize, new historyRowModel(pQuery.substring(0,sepPos)+".com", strings.GENERIC_EMPTY_STR,-1)); + } + if(!pQuery.equals(pQuery.substring(0,sepPos)+".onion")){ + mCurrentList.add( mSize, new historyRowModel(pQuery.substring(0,sepPos)+".onion", strings.GENERIC_EMPTY_STR,-1)); + } + } + } + } + + if(mHostAppend){ + if(mCurrentList.get(0).getDescription().startsWith(pQuery)){ + mCurrentList.add( mSize,new historyRowModel(mCurrentList.get(0).getHeader(), mCurrentList.get(0).getDescription(),-1)); + } + } + + if(pQuery.length()>0){ + if(!pQuery.equals("about:blank")){ + mCurrentList.add( 0,new historyRowModel(pQuery, strings.GENERIC_EMPTY_STR,-1)); + } + } + if(mCurrentList.size()<=0) { + mCurrentList.add( mSize,new historyRowModel("Genesis Search", "genesis.onion",-1)); + } + + return mCurrentList; + } + + private ArrayList initSuggestions(){ + mHintListLocalCache = new ArrayList<>(); + + mHintListLocalCache.add(new historyRowModel("Duckduckgo","https://duckduckgo.com",-1 )); + mHintListLocalCache.add(new historyRowModel("BBC","https://bbc.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Youtube","https://youtube.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Facebook","https://facebook.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Twitter","https://twitter.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Amazon","https://amazon.com",-1 )); + mHintListLocalCache.add(new historyRowModel("IMDB","https://imdb.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Reddit","https://reddit.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Pinterest","https://pinterest.com",-1 )); + mHintListLocalCache.add(new historyRowModel("EBay","https://ebay.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Trip Advisor","https://tripadvisor.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Craigslist","https://craigslist.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Walmart","https://walmart.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Instagram","https://instagram.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Google","https://google.com",-1 )); + mHintListLocalCache.add(new historyRowModel("NY Times","https://nytimes.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Apple","https://apple.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Linkedin","https://linkedin.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Play.Google","https://play.google.com",-1 )); + mHintListLocalCache.add(new historyRowModel("ESPN","https://espn.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Webmd","https://webmd.com",-1 )); + mHintListLocalCache.add(new historyRowModel("CNN","https://cnn.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Homedepot","https://homedepot.com",-1 )); + mHintListLocalCache.add(new historyRowModel("ETSY","https://etsy.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Netflix","https://netflix.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Quora","https://quora.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Microsoft","https://microsoft.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Target","https://target.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Merriam Webster","https://merriam-webster.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Forbes","https://forbes.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Mapquest","https://mapquest.com",-1 )); + mHintListLocalCache.add(new historyRowModel("NIH","https://nih.gov",-1 )); + mHintListLocalCache.add(new historyRowModel("Gamepedia","https://gamepedia.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Yahoo","https://yahoo.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Healthline","https://healthline.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Foxnews","https://foxnews.com",-1 )); + mHintListLocalCache.add(new historyRowModel("All Recipes","https://allrecipes.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Quizlet","https://quizlet.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Weather","https://weather.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Bestbuy","https://bestbuy.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Urbandictionary","https://urbandictionary.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Mayoclinic","https://mayoclinic.org",-1 )); + mHintListLocalCache.add(new historyRowModel("AOL","https://aol.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Genius","https://genius.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Zillow","https://zillow.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Usatoday","https://usatoday.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Glassdoor","https://glassdoor.com",-1 )); + mHintListLocalCache.add(new historyRowModel("MSN","https://msn.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Rotten Tomatoes","https://rottentomatoes.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Lowes","https://lowes.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Dictionary","https://dictionary.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Business Insider","https://businessinsider.com",-1 )); + mHintListLocalCache.add(new historyRowModel("US News","https://usnews.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Medical News Today","https://medicalnewstoday.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Britannica","https://britannica.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Washington Post","https://washingtonpost.com",-1 )); + mHintListLocalCache.add(new historyRowModel("USPS","https://usps.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Finance Yahoo","https://finance.yahoo.com",-1 )); + mHintListLocalCache.add(new historyRowModel("IRS","https://finance.irs.gov",-1 )); + mHintListLocalCache.add(new historyRowModel("Yellow Pages","https://yellowpages.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Chase","https://chase.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Retail Menot","https://retailmenot.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Accuweather","https://accuweather.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Way Fair","https://wayfair.com",-1 )); + mHintListLocalCache.add(new historyRowModel("GO","https://go.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Live","https://live.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Login Yahoo","https://login.yahoo.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Steam Community","https://steamcommunity.com",-1 )); + mHintListLocalCache.add(new historyRowModel("XFinity","https://xfinity.com",-1 )); + mHintListLocalCache.add(new historyRowModel("CNET","https://cnet.com",-1 )); + mHintListLocalCache.add(new historyRowModel("IGN","https://ign.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Steam Powered","https://steampowered.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Macys","https://macys.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Wikihow","https://wikihow.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Wikipedia","https://en.wikipedia.org/",-1 )); + mHintListLocalCache.add(new historyRowModel("Mail Yahoo","https://mail.yahoo.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Wiktionary","https://wiktionary.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Cbssports","https://cbssports.com",-1 )); + mHintListLocalCache.add(new historyRowModel("CNBC","https://cnbc.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Bank Of America","https://bankofamerica.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Expedia","https://expedia.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Wellsfargo","https://wellsfargo.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Groupon","https://groupon.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Twitch","https://twitch.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Khan Academy","https://khanacademy.com",-1 )); + mHintListLocalCache.add(new historyRowModel("The Guardian","https://theguardian.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Paypal","https://paypal.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Spotify","https://spotify.com",-1 )); + mHintListLocalCache.add(new historyRowModel("ATT","https://att.com",-1 )); + mHintListLocalCache.add(new historyRowModel("NFL","https://nfl.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Realtor","https://realtor.com",-1 )); + mHintListLocalCache.add(new historyRowModel("CA Gov","https://ca.gov",-1 )); + mHintListLocalCache.add(new historyRowModel("Good Reads","https://goodreads.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Office","https://office.com",-1 )); + mHintListLocalCache.add(new historyRowModel("UFL","https://ufl.com",-1 )); + mHintListLocalCache.add(new historyRowModel("MLB","https://mlb.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Food Network","https://foodnetwork.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Apartments","https://apartments.com",-1 )); + mHintListLocalCache.add(new historyRowModel("NPR","https://npr.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Wow Head","https://wowhead.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Bing","https://bing.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Google","https://google.com",-1 )); + mHintListLocalCache.add(new historyRowModel("Genesis Search","https://genesis.onion",-1 )); + + return mHintListLocalCache; + } + + /*External Redirections*/ + + public Object onTrigger(dataEnums.eSuggestionCommands pCommands, List pData){ + + if(pCommands == dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS) + { + return getSuggestions((String) pData.get(0), (ArrayList)pData.get(1), (ArrayList)pData.get(2)); + } + else if(pCommands == dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION) + { + return getDefaultSuggestionsOnStart((String) pData.get(0)); + } + + return null; + } + + /*Local Overrides*/ + + @Override + public void onGetSuggestions(SuggestionsInfo[] results) { + + } + + @Override + public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] results) { + + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java b/app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java index 30f2b572..a04781fc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java @@ -1,11 +1,11 @@ -package com.darkweb.genesissearchengine; - -import java.util.List; - -public class eventObserver -{ - public interface eventListener - { - Object invokeObserver(List data, Object event_type); - } -} +package com.darkweb.genesissearchengine; + +import java.util.List; + +public class eventObserver +{ + public interface eventListener + { + Object invokeObserver(List data, Object event_type); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/sharedUIMethod.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/sharedUIMethod.java index b62db08b..996d9e90 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/sharedUIMethod.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/sharedUIMethod.java @@ -1,34 +1,34 @@ -package com.darkweb.genesissearchengine.helperManager; - - -import android.os.Build; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.example.myapplication.R; - -public class sharedUIMethod -{ - /*Shared UI Helper Methods General*/ - - public static void updateStatusBar(AppCompatActivity mContext) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } - } -} +package com.darkweb.genesissearchengine.helperManager; + + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; +import com.example.myapplication.R; + +public class sharedUIMethod +{ + /*Shared UI Helper Methods General*/ + + public static void updateStatusBar(AppCompatActivity mContext) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/NetCipher.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/NetCipher.java index 97897187..7e5cbfad 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/NetCipher.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/NetCipher.java @@ -47,7 +47,7 @@ public class NetCipher { } public final static Proxy ORBOT_HTTP_PROXY = new Proxy(Proxy.Type.HTTP, - new InetSocketAddress("127.0.0.1", 8118)); + new InetSocketAddress("127.0.0.1", 8125)); private static Proxy proxy; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilderBase.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilderBase.java index 955336f4..a4eb1cbc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilderBase.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilderBase.java @@ -173,7 +173,7 @@ abstract public class if (status.getStringExtra(OrbotHelper.EXTRA_STATUS) .equals(OrbotHelper.STATUS_ON)) { return(status.getIntExtra(OrbotHelper.EXTRA_PROXY_PORT_SOCKS, - 9050)); + 9055)); } return(-1); @@ -183,7 +183,7 @@ abstract public class if (status.getStringExtra(OrbotHelper.EXTRA_STATUS) .equals(OrbotHelper.STATUS_ON)) { return(status.getIntExtra(OrbotHelper.EXTRA_PROXY_PORT_HTTP, - 8118)); + 8125)); } return(-1); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/web/WebkitProxy.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/web/WebkitProxy.java index 6f2da811..5dbe2791 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/web/WebkitProxy.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/web/WebkitProxy.java @@ -47,8 +47,8 @@ import ch.boye.httpclientandroidlib.HttpHost; public class WebkitProxy { private final static String DEFAULT_HOST = "localhost";//"127.0.0.1"; - private final static int DEFAULT_PORT = 8118; - private final static int DEFAULT_SOCKS_PORT = 9050; + private final static int DEFAULT_PORT = 8125; + private final static int DEFAULT_SOCKS_PORT = 9055; private final static int REQUEST_CODE = 0; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/trueTime/trueTime.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/trueTime/trueTime.java index 4d060f72..9da24066 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/trueTime/trueTime.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/trueTime/trueTime.java @@ -1,35 +1,35 @@ -package com.darkweb.genesissearchengine.libs.trueTime; - -import com.darkweb.genesissearchengine.constants.strings; -import com.instacart.library.truetime.TrueTime; -import java.util.Date; - -public class trueTime { - - private static trueTime ourInstance = new trueTime(); - public static trueTime getInstance() - { - return ourInstance; - } - - public void initTime(){ - try{ - TrueTime.build().initialize(); - }catch (Exception ignored){ } - } - - - public String getGMT(){ - if (TrueTime.isInitialized()) { - Date trueTime = TrueTime.now(); - return trueTime.getTime()+strings.GENERIC_EMPTY_STR; - }else { - return "null"; - } - } - - public String getLTZ(){ - return System.currentTimeMillis()+strings.GENERIC_EMPTY_STR; - } - -} +package com.darkweb.genesissearchengine.libs.trueTime; + +import com.darkweb.genesissearchengine.constants.strings; +import com.instacart.library.truetime.TrueTime; +import java.util.Date; + +public class trueTime { + + private static trueTime ourInstance = new trueTime(); + public static trueTime getInstance() + { + return ourInstance; + } + + public void initTime(){ + try{ + TrueTime.build().initialize(); + }catch (Exception ignored){ } + } + + + public String getGMT(){ + if (TrueTime.isInitialized()) { + Date trueTime = TrueTime.now(); + return trueTime.getTime()+strings.GENERIC_EMPTY_STR; + }else { + return "null"; + } + } + + public String getLTZ(){ + return System.currentTimeMillis()+strings.GENERIC_EMPTY_STR; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ColorAnimator.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ColorAnimator.java index 5fabfe2c..2fff8841 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ColorAnimator.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ColorAnimator.java @@ -1,37 +1,37 @@ -package com.darkweb.genesissearchengine.libs.views; - -import android.graphics.Color; - -public class ColorAnimator -{ - private final int mStartColor, mEndColor; - private final float[] mStartHSV, mEndHSV; - private float[] mMove = new float[3]; - - - public ColorAnimator(int start, int end) { - mStartColor = start; - mEndColor = end; - mStartHSV = toHSV(start); - mEndHSV = toHSV(end); - } - - public int with(float delta) { - if (delta <= 0) return mStartColor; - if (delta >= 1) return mEndColor; - return Color.HSVToColor(move(delta)); - } - - private float[] move(float delta) { - mMove[0] = (mEndHSV[0] - mStartHSV[0]) * delta + mStartHSV[0]; - mMove[1] = (mEndHSV[1] - mStartHSV[1]) * delta + mStartHSV[1]; - mMove[2] = (mEndHSV[2] - mStartHSV[2]) * delta + mStartHSV[2]; - return mMove; - } - - private float[] toHSV(int color) { - float[] hsv = new float[3]; - Color.colorToHSV(color, hsv); - return hsv; - } +package com.darkweb.genesissearchengine.libs.views; + +import android.graphics.Color; + +public class ColorAnimator +{ + private final int mStartColor, mEndColor; + private final float[] mStartHSV, mEndHSV; + private float[] mMove = new float[3]; + + + public ColorAnimator(int start, int end) { + mStartColor = start; + mEndColor = end; + mStartHSV = toHSV(start); + mEndHSV = toHSV(end); + } + + public int with(float delta) { + if (delta <= 0) return mStartColor; + if (delta >= 1) return mEndColor; + return Color.HSVToColor(move(delta)); + } + + private float[] move(float delta) { + mMove[0] = (mEndHSV[0] - mStartHSV[0]) * delta + mStartHSV[0]; + mMove[1] = (mEndHSV[1] - mStartHSV[1]) * delta + mStartHSV[1]; + mMove[2] = (mEndHSV[2] - mStartHSV[2]) * delta + mStartHSV[2]; + return mMove; + } + + private float[] toHSV(int color) { + float[] hsv = new float[3]; + Color.colorToHSV(color, hsv); + return hsv; + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/KeyboardUtils.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/KeyboardUtils.java index 1d9370a6..f3ea0ce8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/KeyboardUtils.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/KeyboardUtils.java @@ -1,101 +1,101 @@ -package com.darkweb.genesissearchengine.libs.views; - -import android.app.Activity; -import android.graphics.Rect; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; -import android.content.Context; -import android.view.inputmethod.InputMethodManager; -import java.util.HashMap; -import java.util.Objects; - -public class KeyboardUtils implements ViewTreeObserver.OnGlobalLayoutListener -{ - private SoftKeyboardToggleListener mCallback; - private View mRootView; - - private final static int sMagicNumber = 200; - private static HashMap sListenerMap = new HashMap<>(); - - private Boolean mPrevValue = null; - private float mScreenDensity; - - public interface SoftKeyboardToggleListener - { - void onToggleSoftKeyboard(boolean isVisible); - } - - @Override - public void onGlobalLayout() - { - Rect r = new Rect(); - mRootView.getWindowVisibleDisplayFrame(r); - - int heightDiff = mRootView.getRootView().getHeight() - (r.bottom - r.top); - float dp = heightDiff/ mScreenDensity; - boolean isVisible = dp > sMagicNumber; - - if (mCallback != null && (mPrevValue == null || isVisible != mPrevValue)) { - mPrevValue = isVisible; - mCallback.onToggleSoftKeyboard(isVisible); - } - } - - public static void addKeyboardToggleListener(Activity act, SoftKeyboardToggleListener listener) - { - removeKeyboardToggleListener(listener); - sListenerMap.put(listener, new KeyboardUtils(act, listener)); - } - - public static void removeKeyboardToggleListener(SoftKeyboardToggleListener listener) - { - if(sListenerMap.containsKey(listener)) - { - KeyboardUtils k = sListenerMap.get(listener); - assert k != null; - k.removeListener(); - sListenerMap.remove(listener); - } - } - - public static void removeAllKeyboardToggleListeners() - { - for(SoftKeyboardToggleListener l : sListenerMap.keySet()){ - Objects.requireNonNull(sListenerMap.get(l)).removeListener(); - } - - sListenerMap.clear(); - } - - public static void toggleKeyboardVisibility(Context context) - { - InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); - if(inputMethodManager != null){ - inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); - } - } - - public static void forceCloseKeyboard(View activeView) - { - InputMethodManager inputMethodManager = (InputMethodManager) activeView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - if(inputMethodManager != null){ - inputMethodManager.hideSoftInputFromWindow(activeView.getWindowToken(), 0); - } - } - - private void removeListener() - { - mCallback = null; - mRootView.getViewTreeObserver().removeOnGlobalLayoutListener(this); - } - - private KeyboardUtils(Activity act, SoftKeyboardToggleListener listener) - { - mCallback = listener; - mRootView = ((ViewGroup) act.findViewById(android.R.id.content)).getChildAt(0); - mRootView.getViewTreeObserver().addOnGlobalLayoutListener(this); - mScreenDensity = act.getResources().getDisplayMetrics().density; - } - +package com.darkweb.genesissearchengine.libs.views; + +import android.app.Activity; +import android.graphics.Rect; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.content.Context; +import android.view.inputmethod.InputMethodManager; +import java.util.HashMap; +import java.util.Objects; + +public class KeyboardUtils implements ViewTreeObserver.OnGlobalLayoutListener +{ + private SoftKeyboardToggleListener mCallback; + private View mRootView; + + private final static int sMagicNumber = 200; + private static HashMap sListenerMap = new HashMap<>(); + + private Boolean mPrevValue = null; + private float mScreenDensity; + + public interface SoftKeyboardToggleListener + { + void onToggleSoftKeyboard(boolean isVisible); + } + + @Override + public void onGlobalLayout() + { + Rect r = new Rect(); + mRootView.getWindowVisibleDisplayFrame(r); + + int heightDiff = mRootView.getRootView().getHeight() - (r.bottom - r.top); + float dp = heightDiff/ mScreenDensity; + boolean isVisible = dp > sMagicNumber; + + if (mCallback != null && (mPrevValue == null || isVisible != mPrevValue)) { + mPrevValue = isVisible; + mCallback.onToggleSoftKeyboard(isVisible); + } + } + + public static void addKeyboardToggleListener(Activity act, SoftKeyboardToggleListener listener) + { + removeKeyboardToggleListener(listener); + sListenerMap.put(listener, new KeyboardUtils(act, listener)); + } + + public static void removeKeyboardToggleListener(SoftKeyboardToggleListener listener) + { + if(sListenerMap.containsKey(listener)) + { + KeyboardUtils k = sListenerMap.get(listener); + assert k != null; + k.removeListener(); + sListenerMap.remove(listener); + } + } + + public static void removeAllKeyboardToggleListeners() + { + for(SoftKeyboardToggleListener l : sListenerMap.keySet()){ + Objects.requireNonNull(sListenerMap.get(l)).removeListener(); + } + + sListenerMap.clear(); + } + + public static void toggleKeyboardVisibility(Context context) + { + InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); + if(inputMethodManager != null){ + inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } + } + + public static void forceCloseKeyboard(View activeView) + { + InputMethodManager inputMethodManager = (InputMethodManager) activeView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + if(inputMethodManager != null){ + inputMethodManager.hideSoftInputFromWindow(activeView.getWindowToken(), 0); + } + } + + private void removeListener() + { + mCallback = null; + mRootView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + } + + private KeyboardUtils(Activity act, SoftKeyboardToggleListener listener) + { + mCallback = listener; + mRootView = ((ViewGroup) act.findViewById(android.R.id.content)).getChildAt(0); + mRootView.getViewTreeObserver().addOnGlobalLayoutListener(this); + mScreenDensity = act.getResources().getDisplayMetrics().density; + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ThumbnailCrop.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ThumbnailCrop.java index 4b9a9cf9..8daf5b04 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ThumbnailCrop.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ThumbnailCrop.java @@ -1,70 +1,70 @@ -package com.darkweb.genesissearchengine.libs.views; - -import android.content.Context; -import android.graphics.Matrix; -import android.graphics.drawable.Drawable; -import android.util.AttributeSet; - -public class ThumbnailCrop extends androidx.appcompat.widget.AppCompatImageView { - - public ThumbnailCrop(Context context) { - super(context); - init(); - } - - public ThumbnailCrop(Context context, AttributeSet attrs) { - super(context, attrs); - init(); - } - - public ThumbnailCrop(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(); - } - - @Override - protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - super.onLayout(changed, left, top, right, bottom); - recomputeImgMatrix(); - } - - @Override - protected boolean setFrame(int l, int t, int r, int b) { - recomputeImgMatrix(); - return super.setFrame(l, t, r, b); - } - - private void init() { - setScaleType(ScaleType.MATRIX); - } - - private void recomputeImgMatrix() { - - final Drawable drawable = getDrawable(); - if (drawable == null) { - return; - } - - final Matrix matrix = getImageMatrix(); - - float scale; - final int viewWidth = getWidth() - getPaddingLeft() - getPaddingRight(); - final int viewHeight = getHeight() - getPaddingTop() - getPaddingBottom(); - final int drawableWidth = drawable.getIntrinsicWidth(); - final int drawableHeight = drawable.getIntrinsicHeight(); - - if (drawableWidth * viewHeight > drawableHeight * viewWidth) { - scale = (float) viewHeight / (float) drawableHeight; - } else { - scale = (float) viewWidth / (float) drawableWidth; - } - - if(drawableWidth drawableHeight * viewWidth) { + scale = (float) viewHeight / (float) drawableHeight; + } else { + scale = (float) viewWidth / (float) drawableWidth; + } + + if(drawableWidth mBannerAds; - private boolean mPaidStatus; - - private boolean bannerAdsLoading = false; - private boolean bannerAdsLoaded = false; - - /*Initializations*/ - - public adManager(eventObserver.eventListener pEvent, AdView pBannerAds, boolean pPaidStatus) { - this.mEvent = pEvent; - this.mPaidStatus = pPaidStatus; - this.mBannerAds = new WeakReference(pBannerAds); - } - - private void initializeBannerAds(){ - if(!mPaidStatus){ - AdRequest request = new AdRequest.Builder().build(); - mBannerAds.get().loadAd(request); - admobListeners(); - } - } - - /*Local Helper Methods*/ - - private void loadAds(AppCompatActivity pAppContext){ - if(!mPaidStatus) - { - if (!bannerAdsLoading) - { - bannerAdsLoading = true; - MobileAds.initialize(pAppContext.getApplicationContext(), initializationStatus -> { }); - - initializeBannerAds(); - } - } - } - - private boolean isAdvertLoaded(){ - return bannerAdsLoaded; - } - - /*Local Listeners*/ - - private void admobListeners(){ - if(!mPaidStatus){ - mBannerAds.get().setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - bannerAdsLoaded = true; - } - - @Override - public void onAdOpened() { - } - - @Override - public void onAdClicked() { - } - - @Override - public void onAdClosed() { - } - - @Override - public void onAdFailedToLoad(@NonNull LoadAdError var1) { - } - }); - } - } - - /*External Triggers*/ - - public Object onTrigger(List pData, pluginEnums.eAdManager pEventType) { - if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) - { - loadAds((AppCompatActivity)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) - { - return isAdvertLoaded(); - } - return null; - } -} +package com.darkweb.genesissearchengine.pluginManager.adPluginManager; + +import android.util.Log; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.google.android.gms.ads.*; +import java.lang.ref.WeakReference; +import java.util.List; + +public class adManager +{ + + /*Private Variables */ + + private eventObserver.eventListener mEvent; + private WeakReference mBannerAds; + private boolean mPaidStatus; + + private boolean bannerAdsLoading = false; + private boolean bannerAdsLoaded = false; + + /*Initializations*/ + + public adManager(eventObserver.eventListener pEvent, AdView pBannerAds, boolean pPaidStatus) { + this.mEvent = pEvent; + this.mPaidStatus = pPaidStatus; + this.mBannerAds = new WeakReference(pBannerAds); + } + + private void initializeBannerAds(){ + if(!mPaidStatus){ + AdRequest request = new AdRequest.Builder().build(); + mBannerAds.get().loadAd(request); + admobListeners(); + } + } + + /*Local Helper Methods*/ + + private void loadAds(AppCompatActivity pAppContext){ + if(!mPaidStatus) + { + if (!bannerAdsLoading) + { + bannerAdsLoading = true; + MobileAds.initialize(pAppContext.getApplicationContext(), initializationStatus -> { }); + + initializeBannerAds(); + } + } + } + + private boolean isAdvertLoaded(){ + return bannerAdsLoaded; + } + + /*Local Listeners*/ + + private void admobListeners(){ + if(!mPaidStatus){ + mBannerAds.get().setAdListener(new AdListener() { + @Override + public void onAdLoaded() { + bannerAdsLoaded = true; + } + + @Override + public void onAdOpened() { + } + + @Override + public void onAdClicked() { + } + + @Override + public void onAdClosed() { + } + + @Override + public void onAdFailedToLoad(@NonNull LoadAdError var1) { + Log.i("dsa","asd"); + } + }); + } + } + + /*External Triggers*/ + + public Object onTrigger(List pData, pluginEnums.eAdManager pEventType) { + if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) + { + loadAds((AppCompatActivity)pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) + { + return isAdvertLoaded(); + } + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java index 1426af1d..bd35452a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java @@ -1,50 +1,50 @@ -package com.darkweb.genesissearchengine.pluginManager.analyticPluginManager; - -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.flurry.android.FlurryAgent; -import java.lang.ref.WeakReference; -import java.util.List; - -public class analyticManager -{ - /*Private Variables*/ - - private WeakReference mAppContext; - private boolean mIsDeveloperBuild; - - /*Initializations*/ - - public analyticManager(WeakReference pAppContext, eventObserver.eventListener pEvent, boolean pIsDeveloperBuild){ - this.mAppContext = pAppContext; - this.mIsDeveloperBuild = pIsDeveloperBuild; - - initialize(); - } - - private void initialize() - { - if(mIsDeveloperBuild){ - new FlurryAgent.Builder() .withLogEnabled(true) .build(mAppContext.get().getApplicationContext(), "4C4K4T5ND9RJKT4H47GQ"); - }else { - new FlurryAgent.Builder() .withLogEnabled(true) .build(mAppContext.get().getApplicationContext(), "5RQYRV23928K6DXH8VWV"); - } - } - - /*External Triggers*/ - - private void logEvent(String pValue) - { - if(FlurryAgent.isSessionActive()){ - FlurryAgent.logEvent(pValue); - } - } - - public void onTrigger(List pData, pluginEnums.eAnalyticManager pEventType) { - if(pEventType.equals(pluginEnums.eAnalyticManager.M_LOG_EVENT)) - { - - } - } -} +package com.darkweb.genesissearchengine.pluginManager.analyticPluginManager; + +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.flurry.android.FlurryAgent; +import java.lang.ref.WeakReference; +import java.util.List; + +public class analyticManager +{ + /*Private Variables*/ + + private WeakReference mAppContext; + private boolean mIsDeveloperBuild; + + /*Initializations*/ + + public analyticManager(WeakReference pAppContext, eventObserver.eventListener pEvent, boolean pIsDeveloperBuild){ + this.mAppContext = pAppContext; + this.mIsDeveloperBuild = pIsDeveloperBuild; + + initialize(); + } + + private void initialize() + { + if(mIsDeveloperBuild){ + new FlurryAgent.Builder() .withLogEnabled(true) .build(mAppContext.get().getApplicationContext(), "4C4K4T5ND9RJKT4H47GQ"); + }else { + new FlurryAgent.Builder() .withLogEnabled(true) .build(mAppContext.get().getApplicationContext(), "5RQYRV23928K6DXH8VWV"); + } + } + + /*External Triggers*/ + + private void logEvent(String pValue) + { + if(FlurryAgent.isSessionActive()){ + FlurryAgent.logEvent(pValue); + } + } + + public void onTrigger(List pData, pluginEnums.eAnalyticManager pEventType) { + if(pEventType.equals(pluginEnums.eAnalyticManager.M_LOG_EVENT)) + { + + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadManager.java index a10cad63..e94a1394 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadManager.java @@ -1,89 +1,89 @@ -package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; - -import android.os.Environment; - -import androidx.appcompat.app.AppCompatActivity; - -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.darkweb.genesissearchengine.pluginManager.pluginReciever.downloadNotificationReciever; - -import java.lang.ref.WeakReference; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -public class downloadManager -{ - /* Private Variables */ - - private WeakReference mAppContext; - private Map mDownloads = new HashMap<>(); - private eventObserver.eventListener mEvent; - - /* Initializations */ - - public downloadManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ - this.mAppContext = pAppContext; - this.mEvent = pEvent; - - initialize(); - } - - private void initialize() - { - } - - private void startDownload(String pPath,String pFile) { - int mID = helperMethod.createNotificationID(); - downloadReciever mFileDownloader = (downloadReciever)new downloadReciever(mAppContext.get().getApplicationContext(),pPath, pFile, mID, mEvent, downloadNotificationReciever.class).execute(pPath); - mDownloads.put(mID,mFileDownloader); - } - - private void cancelDownload(int pID) { - Objects.requireNonNull(mDownloads.get(pID)).onCancel(); - } - - private void onTriggerDownload(int pID) { - if(mDownloads!=null && mDownloads.get(pID)!=null){ - mDownloads.get(pID).onTrigger(); - } - } - - private void onStartSercvice(String mURL, String mPath){ - mAppContext.get().startService(downloadService.getDownloadService(mAppContext.get().getApplicationContext(), mURL + "__" + mPath, Environment.DIRECTORY_DOWNLOADS)); - } - - private String downloadBlob(String pURL){ - return blobDownloader.getBase64StringFromBlobUrl(pURL); - } - - /* External Triggers */ - - public Object onTrigger(List pData, pluginEnums.eDownloadManager pEventType) { - if(pEventType.equals(pluginEnums.eDownloadManager.M_DOWNLOAD_FILE)) - { - startDownload((String) pData.get(0),(String)pData.get(1)); - } - else if(pEventType.equals(pluginEnums.eDownloadManager.M_CANCEL)) - { - cancelDownload((int) pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eDownloadManager.M_TRIGGER)) - { - onTriggerDownload((int) pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eDownloadManager.M_START_SERVICE)) - { - onStartSercvice((String) pData.get(0), (String) pData.get(1)); - } - else if(pEventType.equals(pluginEnums.eDownloadManager.M_DOWNLOAD_BLOB)) - { - return downloadBlob((String) pData.get(0)); - } - - return null; - } -} +package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; + +import android.os.Environment; + +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.darkweb.genesissearchengine.pluginManager.pluginReciever.downloadNotificationReciever; + +import java.lang.ref.WeakReference; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +public class downloadManager +{ + /* Private Variables */ + + private WeakReference mAppContext; + private Map mDownloads = new HashMap<>(); + private eventObserver.eventListener mEvent; + + /* Initializations */ + + public downloadManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ + this.mAppContext = pAppContext; + this.mEvent = pEvent; + + initialize(); + } + + private void initialize() + { + } + + private void startDownload(String pPath,String pFile) { + int mID = helperMethod.createNotificationID(); + downloadReciever mFileDownloader = (downloadReciever)new downloadReciever(mAppContext.get().getApplicationContext(),pPath, pFile, mID, mEvent, downloadNotificationReciever.class).execute(pPath); + mDownloads.put(mID,mFileDownloader); + } + + private void cancelDownload(int pID) { + Objects.requireNonNull(mDownloads.get(pID)).onCancel(); + } + + private void onTriggerDownload(int pID) { + if(mDownloads!=null && mDownloads.get(pID)!=null){ + mDownloads.get(pID).onTrigger(); + } + } + + private void onStartSercvice(String mURL, String mPath){ + mAppContext.get().startService(downloadService.getDownloadService(mAppContext.get().getApplicationContext(), mURL + "__" + mPath, Environment.DIRECTORY_DOWNLOADS)); + } + + private String downloadBlob(String pURL){ + return blobDownloader.getBase64StringFromBlobUrl(pURL); + } + + /* External Triggers */ + + public Object onTrigger(List pData, pluginEnums.eDownloadManager pEventType) { + if(pEventType.equals(pluginEnums.eDownloadManager.M_DOWNLOAD_FILE)) + { + startDownload((String) pData.get(0),(String)pData.get(1)); + } + else if(pEventType.equals(pluginEnums.eDownloadManager.M_CANCEL)) + { + cancelDownload((int) pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eDownloadManager.M_TRIGGER)) + { + onTriggerDownload((int) pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eDownloadManager.M_START_SERVICE)) + { + onStartSercvice((String) pData.get(0), (String) pData.get(1)); + } + else if(pEventType.equals(pluginEnums.eDownloadManager.M_DOWNLOAD_BLOB)) + { + return downloadBlob((String) pData.get(0)); + } + + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java index cf748550..d5c49aad 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java @@ -1,359 +1,359 @@ -package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; - -import android.annotation.SuppressLint; -import android.app.DownloadManager; -import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.ContentResolver; -import android.content.ContentValues; -import android.content.Context; -import android.content.Intent; -import android.graphics.Color; -import android.net.Uri; -import android.os.AsyncTask; -import android.os.Build; -import android.os.Environment; -import android.os.Handler; -import android.os.StrictMode; -import android.provider.MediaStore; - -import androidx.core.app.NotificationCompat; -import androidx.core.content.FileProvider; - -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.libs.netcipher.client.StrongHttpsClient; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log; -import org.torproject.android.proxy.util.Prefs; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.URI; -import java.net.URL; -import java.net.URLConnection; -import java.text.DecimalFormat; -import java.util.Arrays; -import java.util.Collections; - -import ch.boye.httpclientandroidlib.HttpResponse; -import ch.boye.httpclientandroidlib.client.methods.HttpGet; - -import static com.darkweb.genesissearchengine.constants.enums.etype.M_DOWNLOAD_FAILURE; -import static java.lang.Thread.sleep; - - -public class downloadReciever extends AsyncTask { - - @SuppressLint("StaticFieldLeak") - private Context context; - private NotificationManager mNotifyManager; - private NotificationCompat.Builder build; - private OutputStream output; - private InputStream mStream; - private Boolean mIsCanceled = false; - - private String PROXY_ADDRESS = "localhost"; - - private int mID; - private String mFileName; - private float mDownloadByte; - private String mURL; - private eventObserver.eventListener mEvent; - private Class mBroadcastReciever; - - public downloadReciever(Context pContext, String pURL, String pFileName, int pID, eventObserver.eventListener pEvent, Class pBroadcastReciever) { - this.context = pContext; - this.mFileName = pFileName; - this.mURL = pURL; - this.mID = pID; - this.mEvent = pEvent; - this.mBroadcastReciever = pBroadcastReciever; - - - StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); - StrictMode.setThreadPolicy(policy); - - mFileName = pFileName; - } - - protected void onPreExecute() { - super.onPreExecute(); - - Intent snoozeIntent = new Intent(context, mBroadcastReciever); - snoozeIntent.setAction("Download_Cancelled"); - snoozeIntent.putExtra("N_ID", mID); - snoozeIntent.putExtra("N_COMMAND", 0); - PendingIntent pendingIntent = PendingIntent.getBroadcast(context, mID, snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT); - - mNotifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - build = new NotificationCompat.Builder(context); - - if(mFileName.length()>30){ - mFileName = "..." + mFileName.substring(mFileName.length()-30); - } - build.setContentTitle(mFileName) - .setContentText("starting...") - .setChannelId(mID + "") - .setAutoCancel(false) - .setDefaults(0) - .setColor(Color.parseColor("#84989f")) - .setCategory(Notification.CATEGORY_SERVICE) - .setPriority(Notification.PRIORITY_DEFAULT) - .addAction(R.drawable.ic_download, "Cancel",pendingIntent) - .setSmallIcon(android.R.drawable.stat_sys_download); - - // build.setOngoing(Prefs.persistNotifications()); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel channel = new NotificationChannel(mID + "", - "Social Media Downloader", - NotificationManager.IMPORTANCE_HIGH); - channel.setDescription("no sound"); - channel.setSound(null, null); - channel.enableLights(false); - channel.setLightColor(Color.BLUE); - channel.enableVibration(false); - mNotifyManager.createNotificationChannel(channel); - - } - build.setProgress(100, 0, false); - mNotifyManager.notify(mID, build.build()); - } - - public static String getFileSize(long size) { - if (size <= 0) - return "0"; - - final String[] units = new String[] { "B Downloaded", "KB ⇣", "MB ⇣", "GB ⇣", "TB ⇣" }; - int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); - - return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; - } - - - @Override - protected String doInBackground(String... f_url) { - int count; - int mRequestCode = 0; - if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - try { - URL url = new URL(f_url[0]); - HttpURLConnection conection; - Proxy proxy; - if(helperMethod.getDomainName(f_url[0]).contains(".onion")){ - proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved(PROXY_ADDRESS, 9050)); - conection = (HttpURLConnection) url.openConnection(proxy); - }else { - Proxy mProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8118)); - URLConnection mURLConnection = new URI(f_url[0]).toURL().openConnection(mProxy); - conection = (HttpURLConnection) mURLConnection; - } - - conection.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"); - conection.setRequestProperty("Accept","*/*"); - - conection.connect(); - int lenghtOfFile = conection.getContentLength(); - mRequestCode = conection.getResponseCode(); - mStream = conection.getInputStream(); - // Output stream - output = new FileOutputStream(new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString()+"/"+mFileName)); - byte[] data = new byte[100000]; - - long total = 0; - - while ((count = mStream.read(data)) != -1) { - total += count; - int cur = (int) ((total * 100) / lenghtOfFile); - if(lenghtOfFile<0){ - cur = (int)total; - mDownloadByte = cur * -1; - }else { - mDownloadByte = cur; - } - publishProgress(Math.min(cur, 100)); - if (Math.min(cur, 100) > 98) { - sleep(500); - } - Log.i("currentProgress", "currentProgress: " + Math.min(cur, 100) + "\n " + cur); - - output.write(data, 0, count); - - } - - build.setContentText("saving file"); - build.setSmallIcon(android.R.drawable.stat_sys_download); - mNotifyManager.notify(mID, build.build()); - - output.flush(); - output.close(); - mStream.close(); - - } catch (Exception ex) { - Log.i("FIZZAHFUCK", ex.getMessage()); - if(mRequestCode!=200){ - mEvent.invokeObserver(Collections.singletonList(mRequestCode), M_DOWNLOAD_FAILURE); - onCancel(); - } - } - }else { - try { - String ALLOWED_URI_CHARS = "@#&=*+-_.,:!?()/~'%"; - String urlEncoded = Uri.encode(f_url[0], ALLOWED_URI_CHARS); - - StrongHttpsClient httpclient = new StrongHttpsClient(context); - - if(helperMethod.getDomainName(f_url[0]).contains(".onion")){ - httpclient.useProxy(true, "SOCKS", "127.0.0.1", 9050); - }else { - httpclient.useProxy(true, "SOCKS", "127.0.0.1", 9050); - } - - HttpGet httpget = new HttpGet(urlEncoded); - HttpResponse response = httpclient.execute(httpget); - - StringBuilder sb = new StringBuilder(); - sb.append(response.getStatusLine()).append("\n\n"); - - InputStream mStream = response.getEntity().getContent(); - - mRequestCode = response.getStatusLine().getStatusCode(); - output = new FileOutputStream(new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString()+"/"+mFileName)); - byte[] data = new byte[100000]; - - long total = 0; - - float lenghtOfFile = response.getEntity().getContentLength(); - int read; - while ((read = mStream.read(data)) != -1) { - total += read; - int cur = (int) ((total * 100) / response.getEntity().getContentLength()); - mDownloadByte = cur; - if(lenghtOfFile<0){ - cur = (int)total; - mDownloadByte = total * -1; - }else { - mDownloadByte = cur; - } - - publishProgress(Math.min(cur, 100)); - if (Math.min(cur, 100) > 98) { - sleep(500); - } - - Log.i("currentProgress", "currentProgress: " + Math.min(cur, 100) + "\n " + cur); - output.write(data, 0, read); - } - - build.setContentText("saving file"); - build.setSmallIcon(android.R.drawable.stat_sys_download); - mNotifyManager.notify(mID, build.build()); - - output.flush(); - output.close(); - mStream.close(); - }catch (Exception ex){ - if(mRequestCode!=200){ - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(Collections.singletonList(mRequestCode), activityContextManager.getInstance().getHomeController()), pluginEnums.eMessageManager.M_DOWNLOAD_FAILURE); - onCancel(); - } - } - } - return null; - } - - protected void onProgressUpdate(Integer... progress) { - int mPercentage = (int)(mDownloadByte); - if(mPercentage<0){ - build.setProgress(100, progress[0], true); - build.setContentText(getFileSize(mPercentage * -1)); - }else { - build.setProgress(100, progress[0], false); - build.setContentText(mPercentage+"%"); - } - mNotifyManager.notify(mID, build.build()); - super.onProgressUpdate(progress); - } - - @Override - protected void onPostExecute(String file_url) { - Intent snoozeIntentPost = new Intent(context, mBroadcastReciever); - snoozeIntentPost.setAction("Download_Open"); - snoozeIntentPost.putExtra("N_ID", mID); - snoozeIntentPost.putExtra("N_COMMAND", 1); - PendingIntent pendingIntent = PendingIntent.getBroadcast(context, mID, snoozeIntentPost, PendingIntent.FLAG_UPDATE_CURRENT); - - Intent snoozeIntentPost1 = new Intent(context, mBroadcastReciever); - snoozeIntentPost1.setAction("Download_Cancelled"); - snoozeIntentPost1.putExtra("N_ID", mID); - snoozeIntentPost1.putExtra("N_COMMAND", 2); - PendingIntent pendingIntent1 = PendingIntent.getBroadcast(context, mID, snoozeIntentPost1, PendingIntent.FLAG_UPDATE_CURRENT); - - build.addAction(0, null, null); - build.setContentIntent(pendingIntent); - build.setContentText("Download complete"); - build.setSmallIcon(R.drawable.ic_download_complete); - build.setColor(Color.parseColor("#84989f")); - build.setProgress(0, 0, false); - build.setAutoCancel(true); - build.setOngoing(false); - build.addAction(android.R.drawable.stat_sys_download, "Open",pendingIntent); - build.addAction(R.drawable.ic_download, "Cancel",pendingIntent1); - build.setPriority(Notification.PRIORITY_LOW); - mNotifyManager.notify(mID, build.build()); - - DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); - String mPath = (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath() + File.separator + mFileName).replace("File//","content://"); - File mFile = new File(mPath); - - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", mFile); - - ContentValues contentValues = new ContentValues(); - contentValues.put(MediaStore.Downloads.TITLE, mFileName); - contentValues.put(MediaStore.Downloads.DISPLAY_NAME, mFileName); - contentValues.put(MediaStore.Downloads.SIZE, mDownloadByte); - contentValues.put(MediaStore.Downloads.MIME_TYPE, helperMethod.getMimeType(uri.toString(), context)); - - contentValues.put(MediaStore.Downloads.RELATIVE_PATH, Environment.DIRECTORY_DOWNLOADS + File.separator + "Temp"); - - ContentResolver database = context.getContentResolver(); - database.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues); - } else { - Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", mFile); - String mime = helperMethod.getMimeType(uri.toString(), context); - if(mime!=null){ - dm.addCompletedDownload(mFileName, mURL, false, mime, mFile.getAbsolutePath(), mFile.length(), false); - } - } - - } - - public void onCancel(){ - mIsCanceled = true; - mNotifyManager.cancel(mID); - cancel(true); - } - - public void onTrigger(){ - if(!mIsCanceled){ - mNotifyManager.cancel(mID); - String mPath = (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath() + File.separator + mFileName).replace("File//","content://"); - File mFile = new File(mPath); - - new Handler().postDelayed(() -> helperMethod.openFile(mFile, context), 500); - } - } -} - +package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; + +import android.annotation.SuppressLint; +import android.app.DownloadManager; +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.ContentResolver; +import android.content.ContentValues; +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Environment; +import android.os.Handler; +import android.os.StrictMode; +import android.provider.MediaStore; + +import androidx.core.app.NotificationCompat; +import androidx.core.content.FileProvider; + +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.libs.netcipher.client.StrongHttpsClient; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log; +import org.torproject.android.proxy.util.Prefs; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URI; +import java.net.URL; +import java.net.URLConnection; +import java.text.DecimalFormat; +import java.util.Arrays; +import java.util.Collections; + +import ch.boye.httpclientandroidlib.HttpResponse; +import ch.boye.httpclientandroidlib.client.methods.HttpGet; + +import static com.darkweb.genesissearchengine.constants.enums.etype.M_DOWNLOAD_FAILURE; +import static java.lang.Thread.sleep; + + +public class downloadReciever extends AsyncTask { + + @SuppressLint("StaticFieldLeak") + private Context context; + private NotificationManager mNotifyManager; + private NotificationCompat.Builder build; + private OutputStream output; + private InputStream mStream; + private Boolean mIsCanceled = false; + + private String PROXY_ADDRESS = "localhost"; + + private int mID; + private String mFileName; + private float mDownloadByte; + private String mURL; + private eventObserver.eventListener mEvent; + private Class mBroadcastReciever; + + public downloadReciever(Context pContext, String pURL, String pFileName, int pID, eventObserver.eventListener pEvent, Class pBroadcastReciever) { + this.context = pContext; + this.mFileName = pFileName; + this.mURL = pURL; + this.mID = pID; + this.mEvent = pEvent; + this.mBroadcastReciever = pBroadcastReciever; + + + StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); + StrictMode.setThreadPolicy(policy); + + mFileName = pFileName; + } + + protected void onPreExecute() { + super.onPreExecute(); + + Intent snoozeIntent = new Intent(context, mBroadcastReciever); + snoozeIntent.setAction("Download_Cancelled"); + snoozeIntent.putExtra("N_ID", mID); + snoozeIntent.putExtra("N_COMMAND", 0); + PendingIntent pendingIntent = PendingIntent.getBroadcast(context, mID, snoozeIntent, PendingIntent.FLAG_UPDATE_CURRENT); + + mNotifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + build = new NotificationCompat.Builder(context); + + if(mFileName.length()>30){ + mFileName = "..." + mFileName.substring(mFileName.length()-30); + } + build.setContentTitle(mFileName) + .setContentText("starting...") + .setChannelId(mID + "") + .setAutoCancel(false) + .setDefaults(0) + .setColor(Color.parseColor("#84989f")) + .setCategory(Notification.CATEGORY_SERVICE) + .setPriority(Notification.PRIORITY_DEFAULT) + .addAction(R.drawable.ic_download, "Cancel",pendingIntent) + .setSmallIcon(android.R.drawable.stat_sys_download); + + // build.setOngoing(Prefs.persistNotifications()); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + NotificationChannel channel = new NotificationChannel(mID + "", + "Social Media Downloader", + NotificationManager.IMPORTANCE_HIGH); + channel.setDescription("no sound"); + channel.setSound(null, null); + channel.enableLights(false); + channel.setLightColor(Color.BLUE); + channel.enableVibration(false); + mNotifyManager.createNotificationChannel(channel); + + } + build.setProgress(100, 0, false); + mNotifyManager.notify(mID, build.build()); + } + + public static String getFileSize(long size) { + if (size <= 0) + return "0"; + + final String[] units = new String[] { "B Downloaded", "KB ⇣", "MB ⇣", "GB ⇣", "TB ⇣" }; + int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); + + return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; + } + + + @Override + protected String doInBackground(String... f_url) { + int count; + int mRequestCode = 0; + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + try { + URL url = new URL(f_url[0]); + HttpURLConnection conection; + Proxy proxy; + if(helperMethod.getDomainName(f_url[0]).contains(".onion")){ + proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved(PROXY_ADDRESS, 9055)); + conection = (HttpURLConnection) url.openConnection(proxy); + }else { + Proxy mProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8125)); + URLConnection mURLConnection = new URI(f_url[0]).toURL().openConnection(mProxy); + conection = (HttpURLConnection) mURLConnection; + } + + conection.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"); + conection.setRequestProperty("Accept","*/*"); + + conection.connect(); + int lenghtOfFile = conection.getContentLength(); + mRequestCode = conection.getResponseCode(); + mStream = conection.getInputStream(); + // Output stream + output = new FileOutputStream(new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString()+"/"+mFileName)); + byte[] data = new byte[100000]; + + long total = 0; + + while ((count = mStream.read(data)) != -1) { + total += count; + int cur = (int) ((total * 100) / lenghtOfFile); + if(lenghtOfFile<0){ + cur = (int)total; + mDownloadByte = cur * -1; + }else { + mDownloadByte = cur; + } + publishProgress(Math.min(cur, 100)); + if (Math.min(cur, 100) > 98) { + sleep(500); + } + Log.i("currentProgress", "currentProgress: " + Math.min(cur, 100) + "\n " + cur); + + output.write(data, 0, count); + + } + + build.setContentText("saving file"); + build.setSmallIcon(android.R.drawable.stat_sys_download); + mNotifyManager.notify(mID, build.build()); + + output.flush(); + output.close(); + mStream.close(); + + } catch (Exception ex) { + Log.i("FIZZAHFUCK", ex.getMessage()); + if(mRequestCode!=200){ + mEvent.invokeObserver(Collections.singletonList(mRequestCode), M_DOWNLOAD_FAILURE); + onCancel(); + } + } + }else { + try { + String ALLOWED_URI_CHARS = "@#&=*+-_.,:!?()/~'%"; + String urlEncoded = Uri.encode(f_url[0], ALLOWED_URI_CHARS); + + StrongHttpsClient httpclient = new StrongHttpsClient(context); + + if(helperMethod.getDomainName(f_url[0]).contains(".onion")){ + httpclient.useProxy(true, "SOCKS", "127.0.0.1", 9055); + }else { + httpclient.useProxy(true, "SOCKS", "127.0.0.1", 9055); + } + + HttpGet httpget = new HttpGet(urlEncoded); + HttpResponse response = httpclient.execute(httpget); + + StringBuilder sb = new StringBuilder(); + sb.append(response.getStatusLine()).append("\n\n"); + + InputStream mStream = response.getEntity().getContent(); + + mRequestCode = response.getStatusLine().getStatusCode(); + output = new FileOutputStream(new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString()+"/"+mFileName)); + byte[] data = new byte[100000]; + + long total = 0; + + float lenghtOfFile = response.getEntity().getContentLength(); + int read; + while ((read = mStream.read(data)) != -1) { + total += read; + int cur = (int) ((total * 100) / response.getEntity().getContentLength()); + mDownloadByte = cur; + if(lenghtOfFile<0){ + cur = (int)total; + mDownloadByte = total * -1; + }else { + mDownloadByte = cur; + } + + publishProgress(Math.min(cur, 100)); + if (Math.min(cur, 100) > 98) { + sleep(500); + } + + Log.i("currentProgress", "currentProgress: " + Math.min(cur, 100) + "\n " + cur); + output.write(data, 0, read); + } + + build.setContentText("saving file"); + build.setSmallIcon(android.R.drawable.stat_sys_download); + mNotifyManager.notify(mID, build.build()); + + output.flush(); + output.close(); + mStream.close(); + }catch (Exception ex){ + if(mRequestCode!=200){ + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(Collections.singletonList(mRequestCode), activityContextManager.getInstance().getHomeController()), pluginEnums.eMessageManager.M_DOWNLOAD_FAILURE); + onCancel(); + } + } + } + return null; + } + + protected void onProgressUpdate(Integer... progress) { + int mPercentage = (int)(mDownloadByte); + if(mPercentage<0){ + build.setProgress(100, progress[0], true); + build.setContentText(getFileSize(mPercentage * -1)); + }else { + build.setProgress(100, progress[0], false); + build.setContentText(mPercentage+"%"); + } + mNotifyManager.notify(mID, build.build()); + super.onProgressUpdate(progress); + } + + @Override + protected void onPostExecute(String file_url) { + Intent snoozeIntentPost = new Intent(context, mBroadcastReciever); + snoozeIntentPost.setAction("Download_Open"); + snoozeIntentPost.putExtra("N_ID", mID); + snoozeIntentPost.putExtra("N_COMMAND", 1); + PendingIntent pendingIntent = PendingIntent.getBroadcast(context, mID, snoozeIntentPost, PendingIntent.FLAG_UPDATE_CURRENT); + + Intent snoozeIntentPost1 = new Intent(context, mBroadcastReciever); + snoozeIntentPost1.setAction("Download_Cancelled"); + snoozeIntentPost1.putExtra("N_ID", mID); + snoozeIntentPost1.putExtra("N_COMMAND", 2); + PendingIntent pendingIntent1 = PendingIntent.getBroadcast(context, mID, snoozeIntentPost1, PendingIntent.FLAG_UPDATE_CURRENT); + + build.addAction(0, null, null); + build.setContentIntent(pendingIntent); + build.setContentText("Download complete"); + build.setSmallIcon(R.drawable.ic_download_complete); + build.setColor(Color.parseColor("#84989f")); + build.setProgress(0, 0, false); + build.setAutoCancel(true); + build.setOngoing(false); + build.addAction(android.R.drawable.stat_sys_download, "Open",pendingIntent); + build.addAction(R.drawable.ic_download, "Cancel",pendingIntent1); + build.setPriority(Notification.PRIORITY_LOW); + mNotifyManager.notify(mID, build.build()); + + DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); + String mPath = (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath() + File.separator + mFileName).replace("File//","content://"); + File mFile = new File(mPath); + + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", mFile); + + ContentValues contentValues = new ContentValues(); + contentValues.put(MediaStore.Downloads.TITLE, mFileName); + contentValues.put(MediaStore.Downloads.DISPLAY_NAME, mFileName); + contentValues.put(MediaStore.Downloads.SIZE, mDownloadByte); + contentValues.put(MediaStore.Downloads.MIME_TYPE, helperMethod.getMimeType(uri.toString(), context)); + + contentValues.put(MediaStore.Downloads.RELATIVE_PATH, Environment.DIRECTORY_DOWNLOADS + File.separator + "Temp"); + + ContentResolver database = context.getContentResolver(); + database.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues); + } else { + Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", mFile); + String mime = helperMethod.getMimeType(uri.toString(), context); + if(mime!=null){ + dm.addCompletedDownload(mFileName, mURL, false, mime, mFile.getAbsolutePath(), mFile.length(), false); + } + } + + } + + public void onCancel(){ + mIsCanceled = true; + mNotifyManager.cancel(mID); + cancel(true); + } + + public void onTrigger(){ + if(!mIsCanceled){ + mNotifyManager.cancel(mID); + String mPath = (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath() + File.separator + mFileName).replace("File//","content://"); + File mFile = new File(mPath); + + new Handler().postDelayed(() -> helperMethod.openFile(mFile, context), 500); + } + } +} + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadService.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadService.java index 1f975379..83e2328a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadService.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadService.java @@ -1,42 +1,42 @@ -package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; - -import android.annotation.SuppressLint; -import android.app.IntentService; -import android.content.Context; -import android.content.Intent; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; - -import java.util.Arrays; - -public class downloadService extends IntentService -{ - private static final String DOWNLOAD_PATH = "com.spartons.androiddownloadmanager_DownloadSongService_Download_path"; - private static final String DESTINATION_PATH = "com.spartons.androiddownloadmanager_DownloadSongService_Destination_path"; - - public downloadService() { - super("DownloadSongService"); - } - @SuppressLint("StaticFieldLeak") - static Context context; - - public static Intent getDownloadService(final @NonNull Context callingClassContext, final @NonNull String downloadPath, final @NonNull String destinationPath) { - downloadService.context = callingClassContext; - return new Intent(callingClassContext, downloadService.class) - .putExtra(DOWNLOAD_PATH, downloadPath) - .putExtra(DESTINATION_PATH, destinationPath); - } - @Override - protected void onHandleIntent(@Nullable Intent intent) { - String downloadPath = intent.getStringExtra(DOWNLOAD_PATH); - startDownload(downloadPath); - } - private void startDownload(String downloadPath) { - String []fn = (downloadPath+"__"+"as").split("__"); - pluginController.getInstance().onDownloadInvoke(Arrays.asList(fn[0],fn[1]), pluginEnums.eDownloadManager.M_DOWNLOAD_FILE); - } +package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; + +import android.annotation.SuppressLint; +import android.app.IntentService; +import android.content.Context; +import android.content.Intent; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; + +import java.util.Arrays; + +public class downloadService extends IntentService +{ + private static final String DOWNLOAD_PATH = "com.spartons.androiddownloadmanager_DownloadSongService_Download_path"; + private static final String DESTINATION_PATH = "com.spartons.androiddownloadmanager_DownloadSongService_Destination_path"; + + public downloadService() { + super("DownloadSongService"); + } + @SuppressLint("StaticFieldLeak") + static Context context; + + public static Intent getDownloadService(final @NonNull Context callingClassContext, final @NonNull String downloadPath, final @NonNull String destinationPath) { + downloadService.context = callingClassContext; + return new Intent(callingClassContext, downloadService.class) + .putExtra(DOWNLOAD_PATH, downloadPath) + .putExtra(DESTINATION_PATH, destinationPath); + } + @Override + protected void onHandleIntent(@Nullable Intent intent) { + String downloadPath = intent.getStringExtra(DOWNLOAD_PATH); + startDownload(downloadPath); + } + private void startDownload(String downloadPath) { + String []fn = (downloadPath+"__"+"as").split("__"); + pluginController.getInstance().onDownloadInvoke(Arrays.asList(fn[0],fn[1]), pluginEnums.eDownloadManager.M_DOWNLOAD_FILE); + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java index 6907245e..71707201 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java @@ -1,130 +1,132 @@ -package com.darkweb.genesissearchengine.pluginManager.langPluginManager; - -import android.content.res.Configuration; -import android.content.res.Resources; -import android.os.Build; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; - -import java.util.Collections; -import java.util.List; -import java.util.Locale; - -public class langManager { - - /*Private Variables*/ - - private eventObserver.eventListener mEvent; - private Locale mLanguage; - private Locale mSystemLocale; - - /*Initializations*/ - - public langManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, Locale pLanguage, Locale pSystemLocale, String pSettingLanguage, String pSettingRegionLanguage, boolean pThemeApplying) { - this.mEvent = pEvent; - this.mLanguage = pLanguage; - this.mSystemLocale = pSystemLocale; - - onInitLanguage(pAppContext, pSettingLanguage, pSettingRegionLanguage, pThemeApplying); - } - - private boolean initLocale(Boolean pThemeApplying){ - if(!pThemeApplying){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - Locale mSystemLocale = Resources.getSystem().getConfiguration().getLocales().get(0); - if(mSystemLocale!=mSystemLocale || !mSystemLocale.getLanguage().equals(mLanguage.getLanguage()) ){ - mEvent.invokeObserver(Collections.singletonList(mSystemLocale), pluginEnums.eLangManager.M_UPDATE_LOCAL); - } - } else { - Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; - if(mSystemLocale!=mSystemLocale || !mSystemLocale.getLanguage().equals(mLanguage.getLanguage())){ - mEvent.invokeObserver(Collections.singletonList(mSystemLocale), pluginEnums.eLangManager.M_UPDATE_LOCAL); - } - } - } - return false; - } - - private void onInitLanguage(AppCompatActivity pAppContext, String pSettingLanguage, String pSettingRegionLanguage, Boolean pThemeApplying) { - if(pSettingLanguage.equals("default")){ - if(!mLanguage.getLanguage().equals(Resources.getSystem().getConfiguration().locale.getLanguage()) || !mLanguage.getCountry().equals(Resources.getSystem().getConfiguration().locale.getCountry())) - { - if(mSystemLocale==null){ - initLocale(pThemeApplying); - } - String mSystemLangugage = mSystemLocale.toString(); - if(mSystemLangugage.equals("en_US") || mSystemLangugage.equals("de_DE") || mSystemLangugage.equals("ur_UR") || mSystemLangugage.equals("ur_PK") || mSystemLangugage.equals("ca_ES") || mSystemLangugage.equals("zh_CN") || mSystemLangugage.equals("ch_CZ") || mSystemLangugage.equals("nl_NL") || mSystemLangugage.equals("fr_FR") || mSystemLangugage.equals("el_GR") || mSystemLangugage.equals("hu_HU") || mSystemLangugage.equals("in_ID") || mSystemLangugage.equals("it_IT") || mSystemLangugage.equals("ja_JP") || mSystemLangugage.equals("ko_KR") || mSystemLangugage.equals("pt_PT") || mSystemLangugage.equals("ro_RO") || mSystemLangugage.equals("ru_RU") || mSystemLangugage.equals("th_TH") || mSystemLangugage.equals("tr_TR") || mSystemLangugage.equals("uk_UA") || mSystemLangugage.equals("vi_VN")){ - if(mSystemLangugage.equals("ur_PK")){ - mLanguage = new Locale("ur", "Ur"); - } else if(mSystemLangugage.equals("vi_VN")){ - mLanguage = new Locale("ch", "Cz"); - } else { - mLanguage = new Locale(mSystemLocale.getLanguage(), mSystemLocale.getCountry()); - } - }else { - mLanguage = new Locale("en", "Us"); - } - }else { - return; - } - }else { - mLanguage = new Locale(pSettingLanguage, pSettingRegionLanguage); - } - - Locale.setDefault(mLanguage); - Resources resources = pAppContext.getResources(); - Configuration config = resources.getConfiguration(); - config.setLocale(mLanguage); - resources.updateConfiguration(config, resources.getDisplayMetrics()); - } - - /*Helper Methods*/ - - private void onCreate(AppCompatActivity pActivity, String pSettingLanguage, String pSettingRegionLanguage, Boolean pThemeApplying) { - onInitLanguage(pActivity, pSettingLanguage, pSettingRegionLanguage, pThemeApplying); - } - - private void onResume(AppCompatActivity pActivity, String pSettingLanguage, String pSettingRegionLanguage, Boolean pThemeApplying) { - onInitLanguage(pActivity, pSettingLanguage, pSettingRegionLanguage, pThemeApplying); - } - - private String getSupportedSystemLanguageInfo(String pSettingLanguage) { - if(pSettingLanguage.equals("default")){ - Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; - String mSystemLangugage = mSystemLocale.toString(); - - if(mSystemLangugage.equals("cs_CZ") || mSystemLangugage.equals("ur_PK") || mSystemLangugage.equals("en_US") || mSystemLangugage.equals("de_DE") || mSystemLangugage.equals("ca_ES") || mSystemLangugage.equals("zh_CN") || mSystemLangugage.equals("ch_CZ") || mSystemLangugage.equals("nl_NL") || mSystemLangugage.equals("fr_FR") || mSystemLangugage.equals("el_GR") || mSystemLangugage.equals("hu_HU") || mSystemLangugage.equals("in_ID") || mSystemLangugage.equals("it_IT") || mSystemLangugage.equals("ja_JP") || mSystemLangugage.equals("ko_KR") || mSystemLangugage.equals("pt_PT") || mSystemLangugage.equals("ro_RO") || mSystemLangugage.equals("ru_RU") || mSystemLangugage.equals("th_TH") || mSystemLangugage.equals("tr_TR") || mSystemLangugage.equals("uk_UA") || mSystemLangugage.equals("vi_VN")){ - return "Default | " + mSystemLocale.getDisplayName(); - }else { - return mSystemLocale.getDisplayName() + " | is unsupported"; - } - }else { - return mLanguage.getDisplayName(); - } - } - - /*External Triggers*/ - - public Object onTrigger(List pData, pluginEnums.eLangManager pEventType) { - if(pEventType.equals(pluginEnums.eLangManager.M_ACTIVITY_CREATED)) - { - onCreate((AppCompatActivity) pData.get(0), (String)pData.get(1), (String)pData.get(2), (boolean)pData.get(3)); - } - else if(pEventType.equals(pluginEnums.eLangManager.M_RESUME)) - { - initLocale((boolean)pData.get(3)); - onResume((AppCompatActivity) pData.get(0), (String)pData.get(1), (String)pData.get(2), (boolean)pData.get(3)); - } - else if(pEventType.equals(pluginEnums.eLangManager.M_SET_LANGUAGE)) - { - onInitLanguage((AppCompatActivity) pData.get(0), (String) pData.get(1), (String) pData.get(2), (boolean)pData.get(3)); - } - else if(pEventType.equals(pluginEnums.eLangManager.M_SUPPORTED_SYSTEM_LANGUAGE_INFO)) - { - return getSupportedSystemLanguageInfo((String) pData.get(0)); - } - return null; - } - +package com.darkweb.genesissearchengine.pluginManager.langPluginManager; + +import android.content.res.Configuration; +import android.content.res.Resources; +import android.os.Build; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; + +import java.util.Collections; +import java.util.List; +import java.util.Locale; + +public class langManager { + + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private Locale mLanguage; + private Locale mSystemLocale; + + /*Initializations*/ + + public langManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, Locale pLanguage, Locale pSystemLocale, String pSettingLanguage, String pSettingRegionLanguage, boolean pThemeApplying) { + this.mEvent = pEvent; + this.mLanguage = pLanguage; + this.mSystemLocale = pSystemLocale; + + onInitLanguage(pAppContext, pSettingLanguage, pSettingRegionLanguage, pThemeApplying); + } + + private boolean initLocale(Boolean pThemeApplying){ + if(!pThemeApplying){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + Locale mSystemLocale = Resources.getSystem().getConfiguration().getLocales().get(0); + if(mSystemLocale!=mSystemLocale || !mSystemLocale.getLanguage().equals(mLanguage.getLanguage()) ){ + mEvent.invokeObserver(Collections.singletonList(mSystemLocale), pluginEnums.eLangManager.M_UPDATE_LOCAL); + } + } else { + Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; + if(mSystemLocale!=mSystemLocale || !mSystemLocale.getLanguage().equals(mLanguage.getLanguage())){ + mEvent.invokeObserver(Collections.singletonList(mSystemLocale), pluginEnums.eLangManager.M_UPDATE_LOCAL); + } + } + } + return false; + } + + private void onInitLanguage(AppCompatActivity pAppContext, String pSettingLanguage, String pSettingRegionLanguage, Boolean pThemeApplying) { + if(pSettingLanguage.equals("default")){ + if(!mLanguage.getLanguage().equals(Resources.getSystem().getConfiguration().locale.getLanguage()) || !mLanguage.getCountry().equals(Resources.getSystem().getConfiguration().locale.getCountry())) + { + if(mSystemLocale==null){ + initLocale(pThemeApplying); + } + String mSystemLangugage = mSystemLocale.toString(); + if(mSystemLangugage.equals("en_US") || mSystemLangugage.equals("de_DE") || mSystemLangugage.equals("ur_UR") || mSystemLangugage.equals("ur_PK") || mSystemLangugage.equals("ca_ES") || mSystemLangugage.equals("zh_CN") || mSystemLangugage.equals("ch_CZ") || mSystemLangugage.equals("nl_NL") || mSystemLangugage.equals("fr_FR") || mSystemLangugage.equals("el_GR") || mSystemLangugage.equals("hu_HU") || mSystemLangugage.equals("in_ID") || mSystemLangugage.equals("it_IT") || mSystemLangugage.equals("ja_JP") || mSystemLangugage.equals("ko_KR") || mSystemLangugage.equals("pt_PT") || mSystemLangugage.equals("ro_RO") || mSystemLangugage.equals("ru_RU") || mSystemLangugage.equals("th_TH") || mSystemLangugage.equals("tr_TR") || mSystemLangugage.equals("uk_UA") || mSystemLangugage.equals("vi_VN")){ + if(mSystemLangugage.equals("ur_PK")){ + mLanguage = new Locale("ur", "Ur"); + } else if(mSystemLangugage.equals("vi_VN")){ + mLanguage = new Locale("ch", "Cz"); + } else { + mLanguage = new Locale(mSystemLocale.getLanguage(), mSystemLocale.getCountry()); + } + }else { + mLanguage = new Locale("en", "Us"); + } + }else { + Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; + mEvent.invokeObserver(Collections.singletonList(mSystemLocale), pluginEnums.eLangManager.M_UPDATE_LOCAL); + return; + } + }else { + mLanguage = new Locale(pSettingLanguage, pSettingRegionLanguage); + } + + Locale.setDefault(mLanguage); + Resources resources = pAppContext.getResources(); + Configuration config = resources.getConfiguration(); + config.setLocale(mLanguage); + resources.updateConfiguration(config, resources.getDisplayMetrics()); + } + + /*Helper Methods*/ + + private void onCreate(AppCompatActivity pActivity, String pSettingLanguage, String pSettingRegionLanguage, Boolean pThemeApplying) { + onInitLanguage(pActivity, pSettingLanguage, pSettingRegionLanguage, pThemeApplying); + } + + private void onResume(AppCompatActivity pActivity, String pSettingLanguage, String pSettingRegionLanguage, Boolean pThemeApplying) { + onInitLanguage(pActivity, pSettingLanguage, pSettingRegionLanguage, pThemeApplying); + } + + private String getSupportedSystemLanguageInfo(String pSettingLanguage) { + if(pSettingLanguage.equals("default")){ + Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; + String mSystemLangugage = mSystemLocale.toString(); + + if(mSystemLangugage.equals("cs_CZ") || mSystemLangugage.equals("ur_PK") || mSystemLangugage.equals("en_US") || mSystemLangugage.equals("de_DE") || mSystemLangugage.equals("ca_ES") || mSystemLangugage.equals("zh_CN") || mSystemLangugage.equals("ch_CZ") || mSystemLangugage.equals("nl_NL") || mSystemLangugage.equals("fr_FR") || mSystemLangugage.equals("el_GR") || mSystemLangugage.equals("hu_HU") || mSystemLangugage.equals("in_ID") || mSystemLangugage.equals("it_IT") || mSystemLangugage.equals("ja_JP") || mSystemLangugage.equals("ko_KR") || mSystemLangugage.equals("pt_PT") || mSystemLangugage.equals("ro_RO") || mSystemLangugage.equals("ru_RU") || mSystemLangugage.equals("th_TH") || mSystemLangugage.equals("tr_TR") || mSystemLangugage.equals("uk_UA") || mSystemLangugage.equals("vi_VN")){ + return "Default | " + mSystemLocale.getDisplayName(); + }else { + return mSystemLocale.getDisplayName() + " | is unsupported"; + } + }else { + return mLanguage.getDisplayName(); + } + } + + /*External Triggers*/ + + public Object onTrigger(List pData, pluginEnums.eLangManager pEventType) { + if(pEventType.equals(pluginEnums.eLangManager.M_ACTIVITY_CREATED)) + { + onCreate((AppCompatActivity) pData.get(0), (String)pData.get(1), (String)pData.get(2), (boolean)pData.get(3)); + } + else if(pEventType.equals(pluginEnums.eLangManager.M_RESUME)) + { + initLocale((boolean)pData.get(3)); + onResume((AppCompatActivity) pData.get(0), (String)pData.get(1), (String)pData.get(2), (boolean)pData.get(3)); + } + else if(pEventType.equals(pluginEnums.eLangManager.M_SET_LANGUAGE)) + { + onInitLanguage((AppCompatActivity) pData.get(0), (String) pData.get(1), (String) pData.get(2), (boolean)pData.get(3)); + } + else if(pEventType.equals(pluginEnums.eLangManager.M_SUPPORTED_SYSTEM_LANGUAGE_INFO)) + { + return getSupportedSystemLanguageInfo((String) pData.get(0)); + } + return null; + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java index 20630feb..ed086529 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java @@ -1,759 +1,784 @@ -package com.darkweb.genesissearchengine.pluginManager.messagePluginManager; - -import android.app.Dialog; -import android.content.Intent; -import android.content.res.Resources; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.InsetDrawable; -import android.net.Uri; -import android.os.Handler; -import android.view.Gravity; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.EditText; -import android.widget.RatingBar; -import android.widget.TextView; -import androidx.appcompat.app.AppCompatActivity; -import androidx.constraintlayout.widget.ConstraintLayout; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import org.mozilla.geckoview.ContentBlocking; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.*; -import static com.darkweb.genesissearchengine.constants.strings.MESSAGE_PLAYSTORE_NOT_FOUND; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.*; - -public class messageManager -{ - /*Private Variables*/ - - private List mData; - private AppCompatActivity mContext; - private eventObserver.eventListener mEvent; - private Dialog mDialog = null; - - /*Initializations*/ - - private void onClearReference(){ - mContext = null; - mData = null; - } - - private void initializeDialog(int pLayout, int pGravity){ - try { - if(mDialog !=null && mDialog.isShowing()){ - mDialog.dismiss(); - } - - mDialog = new Dialog(mContext); - mDialog.getWindow().setGravity(pGravity); - mDialog.getWindow().getAttributes().windowAnimations = R.style.dialiog_animation; - - Drawable myDrawable; - Resources res = mContext.getResources(); - try { - myDrawable = Drawable.createFromXml(res, res.getXml(R.xml.hox_rounded_corner)); - mDialog.getWindow().setBackgroundDrawable(myDrawable); - } catch (Exception ignored) { - } - - mDialog.setCancelable(true); - mDialog.setContentView(pLayout); - - ColorDrawable back = new ColorDrawable(Color.TRANSPARENT); - InsetDrawable inset = new InsetDrawable(back, helperMethod.pxFromDp(15),0,helperMethod.pxFromDp(15),0); - mDialog.getWindow().setBackgroundDrawable(inset); - mDialog.getWindow().setLayout(helperMethod.pxFromDp(350), -1); - mDialog.getWindow().setLayout(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT); - mDialog.show(); - }catch (Exception ignored){} - } - - public messageManager(eventObserver.eventListener event) - { - this.mEvent = event; - } - - /*Helper Methods*/ - private void welcomeMessage() - { - initializeDialog(R.layout.popup_welcome, Gravity.CENTER); - mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_BLACK_MARKET_URL), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_LEAKED_DOCUMENT_URL), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_NEWS_URL), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_SOFTWARE_URL), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption5).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_SOFTWARE_FINANCE), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption6).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_COMMUNITIES), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pDontShowAgain).setOnClickListener(v -> { - mEvent.invokeObserver(null, M_CANCEL_WELCOME); - mDialog.dismiss(); - }); - - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void languageSupportFailure() - { - initializeDialog(R.layout.popup_language_support, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pLanguage)).setText((mData.get(0).toString())); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void rateFailure() - { - initializeDialog(R.layout.popup_rate_failure, Gravity.CENTER); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - final Handler handler = new Handler(); - Runnable runnable = () -> { - try{ - helperMethod.sendIssueEmail(mContext); - } - catch (Exception ex) - { - onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); - onClearReference(); - } - }; - handler.postDelayed(runnable, 1000); - }); - } - - private void reportedSuccessfully() - { - initializeDialog(R.layout.popup_reported_successfully, Gravity.BOTTOM); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void newIdentityCreated() - { - final Handler handler = new Handler(); - Runnable runnable = () -> mDialog.dismiss(); - - initializeDialog(R.layout.popup_new_circuit, Gravity.BOTTOM); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - - mDialog.setOnDismissListener(dialog -> { - handler.removeCallbacks(runnable); - onClearReference(); - }); - - handler.postDelayed(runnable, 1500); - } - - private void mDownloadFailure() - { - mContext.runOnUiThread(() -> { - final Handler handler = new Handler(); - Runnable runnable = () -> mDialog.dismiss(); - - initializeDialog(R.layout.popup_download_failure, Gravity.BOTTOM); - ((TextView)mDialog.findViewById(R.id.pDescription)).setText(("Request denied Error " + mData.get(0))); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - - mDialog.setOnDismissListener(dialog -> { - handler.removeCallbacks(runnable); - onClearReference(); - }); - - handler.postDelayed(runnable, 20000); - - }); - } - - private void popupBlocked() - { - final Handler handler = new Handler(); - Runnable runnable = () -> mDialog.dismiss(); - - initializeDialog(R.layout.popup_block_popup, Gravity.BOTTOM); - mDialog.findViewById(R.id.pOpenPrivacy).setOnClickListener(v -> { - mEvent.invokeObserver(null, M_OPEN_PRIVACY); - mDialog.dismiss(); - handler.removeCallbacks(runnable); - }); - - mDialog.setOnDismissListener(dialog -> { - handler.removeCallbacks(runnable); - onClearReference(); - }); - - handler.postDelayed(runnable, 1500); - } - - private void maxTabReached() - { - final Handler handler = new Handler(); - Runnable runnable = () -> mDialog.dismiss(); - - initializeDialog(R.layout.popup_max_tab, Gravity.BOTTOM); - mDialog.getWindow().setDimAmount(0); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> { - mDialog.dismiss(); - handler.removeCallbacks(runnable); - }); - - mDialog.setOnDismissListener(dialog -> { - handler.removeCallbacks(runnable); - onClearReference(); - }); - - handler.postDelayed(runnable, 1500); - - } - - private void notSupportMessage() - { - initializeDialog(R.layout.popup_not_supported, Gravity.BOTTOM); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void onPanic(){ - initializeDialog(R.layout.popup_panic, Gravity.BOTTOM); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - mEvent.invokeObserver(null, M_PANIC_RESET); - }); - } - - private void dataClearedSuccessfully() - { - initializeDialog(R.layout.popup_data_cleared, Gravity.BOTTOM); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void applicationCrashed() - { - initializeDialog(R.layout.application_crash, Gravity.BOTTOM); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void openSecureConnectionPopup() - { - initializeDialog(R.layout.secure_connection_popup, Gravity.TOP); - Window window = mDialog.getWindow(); - window.setLayout(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT); - - ColorDrawable back = new ColorDrawable(Color.TRANSPARENT); - InsetDrawable inset = new InsetDrawable(back, 0,0,0,0); - mDialog.getWindow().setBackgroundDrawable(inset); - mDialog.setCancelable(true); - mDialog.setCanceledOnTouchOutside(true); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mEvent.invokeObserver(null, M_SECURE_CONNECTION)); - - if((boolean) mData.get(1)){ - ((SwitchMaterial) mDialog.findViewById(R.id.pJSStatus)).setChecked(true); - }else { - ((SwitchMaterial) mDialog.findViewById(R.id.pJSStatus)).setChecked(false); - } - if((boolean) mData.get(2)){ - ((SwitchMaterial) mDialog.findViewById(R.id.pDTStatus)).setChecked(true); - }else { - ((SwitchMaterial) mDialog.findViewById(R.id.pDTStatus)).setChecked(false); - } - if((int) mData.get(3) != ContentBlocking.AntiTracking.NONE){ - ((SwitchMaterial) mDialog.findViewById(R.id.pTPStatus)).setChecked(true); - }else { - ((SwitchMaterial) mDialog.findViewById(R.id.pTPStatus)).setChecked(false); - } - - ((TextView) mDialog.findViewById(R.id.pHeaderSubpart)).setText(helperMethod.getDomainName(mData.get(0).toString())); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void bookmark() - { - initializeDialog(R.layout.popup_create_bookmark, Gravity.CENTER); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); - - mDialog.setOnShowListener(dialog -> mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)); - mDialog.setOnDismissListener(dialog -> { - final Handler handler = new Handler(); - Runnable runnable = () -> { - helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); - dialog.dismiss(); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - onClearReference(); - }; - handler.postDelayed(runnable, 50); - }); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> { - mDialog.dismiss(); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); - }); - - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - helperMethod.hideKeyboard(mContext); - mEvent.invokeObserver(Collections.singletonList(mData.get(0).toString().replace("genesis.onion","genesishiddentechnologies.com")+"split"+((EditText) mDialog.findViewById(R.id.pBridgeInput)).getText().toString()), M_BOOKMARK); - }); - } - - private void onUpdateBridges() - { - String mCustomBridge = (String) mEvent.invokeObserver(null, M_CUSTOM_BRIDGE); - String mBridgeType = (String) mEvent.invokeObserver(null, M_BRIDGE_TYPE); - - initializeDialog(R.layout.popup_update_bridges, Gravity.CENTER); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); - if(!mCustomBridge.equals("meek") && !mCustomBridge.equals("obfs4")){ - ((EditText)mDialog.findViewById(R.id.pBridgeInput)).setText(mCustomBridge); - ((EditText)mDialog.findViewById(R.id.pBridgeType)).setText(mBridgeType); - } - - mDialog.setOnShowListener(dialog -> mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)); - mDialog.setOnDismissListener(dialog -> { - final Handler handler = new Handler(); - Runnable runnable = () -> { - helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); - dialog.dismiss(); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - onClearReference(); - }; - handler.postDelayed(runnable, 50); - }); - mDialog.findViewById(R.id.pBridgeRequest).setOnClickListener(v -> { - final Handler handler = new Handler(); - Runnable runnable = () -> { - try{ - helperMethod.sendBridgeEmail(mContext); - } - catch (Exception ex){ - onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); - } - }; - handler.postDelayed(runnable, 200); - }); - - mDialog.findViewById(R.id.mClear).setOnClickListener(v -> { - EditText mBridges = mDialog.findViewById(R.id.pBridgeInput); - TextView mTextView = mDialog.findViewById(R.id.pDescriptionError); - - mBridges.setText(strings.GENERIC_EMPTY_STR); - mTextView.animate().setDuration(250).alpha(0); - }); - - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - String mBridges = ((EditText)mDialog.findViewById(R.id.pBridgeInput)).getText().toString(); - - boolean mBridgeTypeExist = !mBridges.contains("obfs3") && !mBridges.contains("obfs4") && !mBridges.contains("fle") && !mBridges.contains("meek"); - boolean mBridgeSize = mBridges.length()<10 || !mBridges.contains(".") || !mBridges.contains(" "); - - if(mBridgeTypeExist || mBridgeSize){ - TextView mTextView = mDialog.findViewById(R.id.pDescriptionError); - if(mTextView.getAlpha()==0 || mTextView.getAlpha()==1 || mTextView.getVisibility()!=View.VISIBLE){ - mTextView.setAlpha(0); - - mTextView.setVisibility(View.VISIBLE); - mTextView.animate().setDuration(250).alpha(1); - if(mBridgeTypeExist){ - mTextView.setText("➔ Invalid bridge string"); - } - else if(mBridgeSize){ - mTextView.setText("➔ Invalid bridge type"); - } - } - return; - } - - mDialog.dismiss(); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - helperMethod.hideKeyboard(mContext); - mEvent.invokeObserver(Arrays.asList(mBridges, ((EditText)mDialog.findViewById(R.id.pBridgeType)).getText().toString()), M_SET_BRIDGES); - }); - } - - private void clearHistory() - { - initializeDialog(R.layout.popup_clear_history, Gravity.CENTER); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - mEvent.invokeObserver(null, M_CLEAR_HISTORY); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void clearBookmark() - { - initializeDialog(R.layout.popup_clear_bookmark, Gravity.CENTER); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - mEvent.invokeObserver(null, M_CLEAR_BOOKMARK); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void reportURL() - { - initializeDialog(R.layout.popup_report_url, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pHeader)).setText(mData.get(0).toString()); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - final Handler handler = new Handler(); - Runnable runnable = () -> onTrigger(Arrays.asList(strings.GENERIC_EMPTY_STR, mContext),M_RATE_SUCCESS); - handler.postDelayed(runnable, 1000); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void downloadSingle() - { - initializeDialog(R.layout.popup_download_url, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pDescription)).setText(mData.get(0).toString()); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - ArrayList tempData = new ArrayList<>(); - if(mData!=null){ - tempData.addAll(mData); - } - mDialog.dismiss(); - final Handler handler = new Handler(); - Runnable runnable = () -> mEvent.invokeObserver(tempData, M_DOWNLOAD_SINGLE); - handler.postDelayed(runnable, 1000); - onClearReference(); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void rateApp() - { - initializeDialog(R.layout.popup_rate_us, Gravity.CENTER); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - RatingBar mRatingBar = mDialog.findViewById(R.id.pRating); - if(mRatingBar.getRating()>=3){ - mEvent.invokeObserver(null, M_APP_RATED); - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(CONST_PLAYSTORE_URL)); - try { - mContext.startActivity(intent); - } catch (Exception ignored) { - helperMethod.showToastMessage(MESSAGE_PLAYSTORE_NOT_FOUND, mContext); - } - - mDialog.dismiss(); - }else if(mRatingBar.getRating()>0) { - mEvent.invokeObserver(null, M_APP_RATED); - final Handler handler = new Handler(); - handler.postDelayed(() -> onTrigger(Arrays.asList(strings.GENERIC_EMPTY_STR, mContext),M_RATE_FAILURE), 1000); - mDialog.dismiss(); - } - }); - } - - private void downloadFileLongPress() - { - String title = mData.get(2).toString(); - - if(title.length()>0){ - title = title + " | "; - } - - initializeDialog(R.layout.popup_file_longpress, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pDescription)).setText((title + mData.get(0).toString())); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_DOWNLOAD_FILE_MANUAL); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_NEW_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK); - mDialog.dismiss(); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void openURLLongPress() - { - String title = mData.get(2).toString(); - - initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pDescription)).setText((title + mData.get(0))); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_NEW_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK); - mDialog.dismiss(); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void popupDownloadFull(){ - String url = mData.get(0).toString(); - String file = mData.get(2).toString(); - String title = mData.get(3).toString(); - - String data_local = mContext.getString(R.string.ALERT_LONG_URL_MESSAGE); - - if(!url.equals(strings.GENERIC_EMPTY_STR)){ - data_local = title + url; - } - else if(!file.equals(strings.GENERIC_EMPTY_STR)){ - data_local = file; - } - String mTitle = title; - if(mTitle.length()<=1){ - mTitle = mData.get(0).toString(); - } - - initializeDialog(R.layout.popup_download_full, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pHeader)).setText(mTitle); - ((TextView) mDialog.findViewById(R.id.pDescription)).setText((data_local)); - mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(url), M_OPEN_LINK_NEW_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(url), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(url), M_COPY_LINK); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(file), M_OPEN_LINK_NEW_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption5).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(file), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption6).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(file), M_COPY_LINK); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption7).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(file), M_DOWNLOAD_FILE_MANUAL); - mDialog.dismiss(); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void sendBridgeMail() - { - initializeDialog(R.layout.popup_bridge_mail, Gravity.CENTER); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - final Handler handler = new Handler(); - Runnable runnable = () -> { - try{ - helperMethod.sendBridgeEmail(mContext); - } - catch (Exception ex){ - onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); - } - }; - handler.postDelayed(runnable, 1000); - }); - } - - void onReset(){ - if(mDialog !=null){ - mDialog.dismiss(); - } - } - - /*External Triggers*/ - - public void onTrigger(List pData, pluginEnums.eMessageManager pEventType) - { - if(!pEventType.equals(M_RATE_FAILURE) && !pEventType.equals(M_RATE_SUCCESS) && !pEventType.equals(M_NOT_SUPPORTED)){ - onClearReference(); - } - if(pEventType.equals(pluginEnums.eMessageManager.M_RESET)){ - onReset(); - } - else { - this.mContext = (AppCompatActivity) pData.get(pData.size()-1); - this.mData = pData; - - switch (pEventType) { - case M_WELCOME: - /*VERIFIED*/ - welcomeMessage(); - break; - - case M_RATE_FAILURE: - /*VERIFIED*/ - rateFailure(); - break; - - case M_LANGUAGE_SUPPORT_FAILURE: - /*VERIFIED*/ - languageSupportFailure(); - break; - - case M_RATE_SUCCESS: - /*VERIFIED*/ - reportedSuccessfully(); - break; - - case M_BOOKMARK: - /*VERIFIED*/ - bookmark(); - break; - - case M_CLEAR_HISTORY: - /*VERIFIED*/ - clearHistory(); - break; - - case M_CLEAR_BOOKMARK: - /*VERIFIED*/ - clearBookmark(); - break; - - case M_REPORT_URL: - /*VERIFIED*/ - reportURL(); - break; - - case M_RATE_APP: - /*VERIFIED*/ - rateApp(); - break; - - case M_DOWNLOAD_FILE : - /*VERIFIED*/ - //downloadFileLongPress(); - break; - - case M_LONG_PRESS_DOWNLOAD : - /*VERIFIED*/ - downloadFileLongPress(); - break; - - case M_LONG_PRESS_URL: - /*VERIFIED*/ - openURLLongPress(); - break; - - case M_LONG_PRESS_WITH_LINK: - /*VERIFIED*/ - popupDownloadFull(); - break; - - case M_BRIDGE_MAIL: - /*VERIFIED*/ - sendBridgeMail(); - break; - - case M_NOT_SUPPORTED: - /*VERIFIED*/ - notSupportMessage(); - break; - - case M_PANIC_RESET: - /*VERIFIED*/ - onPanic(); - break; - - case M_DATA_CLEARED: - /*VERIFIED*/ - dataClearedSuccessfully(); - break; - - case M_APPLICATION_CRASH: - /*VERIFIED*/ - applicationCrashed(); - break; - - case M_SECURE_CONNECTION: - /*VERIFIED*/ - openSecureConnectionPopup(); - break; - - case M_DOWNLOAD_SINGLE: - /*VERIFIED*/ - downloadSingle(); - break; - - case M_UPDATE_BRIDGES: - /*VERIFIED*/ - onUpdateBridges(); - break; - - case M_NEW_IDENTITY: - /*VERIFIED*/ - newIdentityCreated(); - break; - - case M_DOWNLOAD_FAILURE: - /*VERIFIED*/ - mDownloadFailure(); - break; - - case M_POPUP_BLOCKED: - /*VERIFIED*/ - popupBlocked(); - break; - - case M_MAX_TAB_REACHED: - /*VERIFIED*/ - maxTabReached(); - break; - } - } - } -} +package com.darkweb.genesissearchengine.pluginManager.messagePluginManager; + +import android.app.Dialog; +import android.content.Intent; +import android.content.res.Resources; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.InsetDrawable; +import android.net.Uri; +import android.os.Handler; +import android.view.Gravity; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.EditText; +import android.widget.RatingBar; +import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.constraintlayout.widget.ConstraintLayout; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import org.mozilla.geckoview.ContentBlocking; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import static com.darkweb.genesissearchengine.constants.constants.*; +import static com.darkweb.genesissearchengine.constants.strings.MESSAGE_PLAYSTORE_NOT_FOUND; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.*; + +public class messageManager +{ + /*Private Variables*/ + + private List mData; + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + private Dialog mDialog = null; + + /*Initializations*/ + + private void onClearReference(){ + mContext = null; + mData = null; + } + + private void initializeDialog(int pLayout, int pGravity){ + try { + if(mDialog !=null && mDialog.isShowing()){ + mDialog.dismiss(); + } + + mDialog = new Dialog(mContext); + mDialog.getWindow().setGravity(pGravity); + mDialog.getWindow().getAttributes().windowAnimations = R.style.dialiog_animation; + + Drawable myDrawable; + Resources res = mContext.getResources(); + try { + myDrawable = Drawable.createFromXml(res, res.getXml(R.xml.hox_rounded_corner)); + mDialog.getWindow().setBackgroundDrawable(myDrawable); + } catch (Exception ignored) { + } + + mDialog.setCancelable(true); + mDialog.setContentView(pLayout); + + ColorDrawable back = new ColorDrawable(Color.TRANSPARENT); + InsetDrawable inset = new InsetDrawable(back, helperMethod.pxFromDp(15),0,helperMethod.pxFromDp(15),0); + mDialog.getWindow().setBackgroundDrawable(inset); + mDialog.getWindow().setLayout(helperMethod.pxFromDp(350), -1); + mDialog.getWindow().setLayout(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT); + mDialog.show(); + }catch (Exception ignored){} + } + + public messageManager(eventObserver.eventListener event) + { + this.mEvent = event; + } + + /*Helper Methods*/ + private void welcomeMessage() + { + initializeDialog(R.layout.popup_welcome, Gravity.CENTER); + mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_BLACK_MARKET_URL), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_LEAKED_DOCUMENT_URL), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_NEWS_URL), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_SOFTWARE_URL), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption5).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_SOFTWARE_FINANCE), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption6).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_COMMUNITIES), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pDontShowAgain).setOnClickListener(v -> { + mEvent.invokeObserver(null, M_CANCEL_WELCOME); + mDialog.dismiss(); + }); + + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void languageSupportFailure() + { + initializeDialog(R.layout.popup_language_support, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pLanguage)).setText((mData.get(0).toString())); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void rateFailure() + { + initializeDialog(R.layout.popup_rate_failure, Gravity.CENTER); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + final Handler handler = new Handler(); + Runnable runnable = () -> { + try{ + helperMethod.sendIssueEmail(mContext); + } + catch (Exception ex) + { + onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); + onClearReference(); + } + }; + handler.postDelayed(runnable, 1000); + }); + } + + private void reportedSuccessfully() + { + initializeDialog(R.layout.popup_reported_successfully, Gravity.BOTTOM); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void newIdentityCreated() + { + final Handler handler = new Handler(); + Runnable runnable = () -> mDialog.dismiss(); + + initializeDialog(R.layout.popup_new_circuit, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + + mDialog.setOnDismissListener(dialog -> { + handler.removeCallbacks(runnable); + onClearReference(); + }); + + handler.postDelayed(runnable, 1500); + } + + private void mDownloadFailure() + { + mContext.runOnUiThread(() -> { + final Handler handler = new Handler(); + Runnable runnable = () -> mDialog.dismiss(); + + initializeDialog(R.layout.popup_download_failure, Gravity.BOTTOM); + ((TextView)mDialog.findViewById(R.id.pDescription)).setText(("Request denied Error " + mData.get(0))); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + + mDialog.setOnDismissListener(dialog -> { + handler.removeCallbacks(runnable); + onClearReference(); + }); + + handler.postDelayed(runnable, 20000); + + }); + } + + private void popupBlocked() + { + final Handler handler = new Handler(); + Runnable runnable = () -> mDialog.dismiss(); + + initializeDialog(R.layout.popup_block_popup, Gravity.BOTTOM); + mDialog.findViewById(R.id.pOpenPrivacy).setOnClickListener(v -> { + mEvent.invokeObserver(null, M_OPEN_PRIVACY); + mDialog.dismiss(); + handler.removeCallbacks(runnable); + }); + + mDialog.setOnDismissListener(dialog -> { + handler.removeCallbacks(runnable); + onClearReference(); + }); + + handler.postDelayed(runnable, 1500); + } + + private void maxTabReached() + { + final Handler handler = new Handler(); + Runnable runnable = () -> mDialog.dismiss(); + + initializeDialog(R.layout.popup_max_tab, Gravity.BOTTOM); + mDialog.getWindow().setDimAmount(0); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> { + mDialog.dismiss(); + handler.removeCallbacks(runnable); + }); + + mDialog.setOnDismissListener(dialog -> { + handler.removeCallbacks(runnable); + onClearReference(); + }); + + handler.postDelayed(runnable, 1500); + + } + + private void notSupportMessage() + { + initializeDialog(R.layout.popup_not_supported, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void onPanic(){ + initializeDialog(R.layout.popup_panic, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + mEvent.invokeObserver(null, M_PANIC_RESET); + }); + } + + private void orbotLoading() + { + final Handler handler = new Handler(); + Runnable runnable = () -> mDialog.dismiss(); + + initializeDialog(R.layout.popup_orbot_connecting, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> { + mDialog.dismiss(); + handler.removeCallbacks(runnable); + }); + + mDialog.setOnDismissListener(dialog -> { + handler.removeCallbacks(runnable); + onClearReference(); + }); + + handler.postDelayed(runnable, 3500); + + } + + private void dataClearedSuccessfully() + { + initializeDialog(R.layout.popup_data_cleared, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void applicationCrashed() + { + initializeDialog(R.layout.application_crash, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void openSecureConnectionPopup() + { + initializeDialog(R.layout.secure_connection_popup, Gravity.TOP); + Window window = mDialog.getWindow(); + window.setLayout(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT); + + ColorDrawable back = new ColorDrawable(Color.TRANSPARENT); + InsetDrawable inset = new InsetDrawable(back, 0,0,0,0); + mDialog.getWindow().setBackgroundDrawable(inset); + mDialog.setCancelable(true); + mDialog.setCanceledOnTouchOutside(true); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mEvent.invokeObserver(null, M_SECURE_CONNECTION)); + + if((boolean) mData.get(1)){ + ((SwitchMaterial) mDialog.findViewById(R.id.pJSStatus)).setChecked(true); + }else { + ((SwitchMaterial) mDialog.findViewById(R.id.pJSStatus)).setChecked(false); + } + if((boolean) mData.get(2)){ + ((SwitchMaterial) mDialog.findViewById(R.id.pDTStatus)).setChecked(true); + }else { + ((SwitchMaterial) mDialog.findViewById(R.id.pDTStatus)).setChecked(false); + } + if((int) mData.get(3) != ContentBlocking.AntiTracking.NONE){ + ((SwitchMaterial) mDialog.findViewById(R.id.pTPStatus)).setChecked(true); + }else { + ((SwitchMaterial) mDialog.findViewById(R.id.pTPStatus)).setChecked(false); + } + + ((TextView) mDialog.findViewById(R.id.pHeaderSubpart)).setText(helperMethod.getDomainName(mData.get(0).toString())); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void bookmark() + { + initializeDialog(R.layout.popup_create_bookmark, Gravity.CENTER); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); + + mDialog.setOnShowListener(dialog -> mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)); + mDialog.setOnDismissListener(dialog -> { + final Handler handler = new Handler(); + Runnable runnable = () -> { + helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); + dialog.dismiss(); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + onClearReference(); + }; + handler.postDelayed(runnable, 50); + }); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> { + mDialog.dismiss(); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); + }); + + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + helperMethod.hideKeyboard(mContext); + mEvent.invokeObserver(Collections.singletonList(mData.get(0).toString().replace("genesis.onion","genesishiddentechnologies.com")+"split"+((EditText) mDialog.findViewById(R.id.pBridgeInput)).getText().toString()), M_BOOKMARK); + }); + } + + private void onUpdateBridges() + { + String mCustomBridge = (String) mEvent.invokeObserver(null, M_CUSTOM_BRIDGE); + String mBridgeType = (String) mEvent.invokeObserver(null, M_BRIDGE_TYPE); + + initializeDialog(R.layout.popup_update_bridges, Gravity.CENTER); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); + if(!mCustomBridge.equals("meek") && !mCustomBridge.equals("obfs4")){ + ((EditText)mDialog.findViewById(R.id.pBridgeInput)).setText(mCustomBridge); + ((EditText)mDialog.findViewById(R.id.pBridgeType)).setText(mBridgeType); + } + + mDialog.setOnShowListener(dialog -> mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)); + mDialog.setOnDismissListener(dialog -> { + final Handler handler = new Handler(); + Runnable runnable = () -> { + helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); + dialog.dismiss(); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + onClearReference(); + }; + handler.postDelayed(runnable, 50); + }); + mDialog.findViewById(R.id.pBridgeRequest).setOnClickListener(v -> { + final Handler handler = new Handler(); + Runnable runnable = () -> { + try{ + helperMethod.sendBridgeEmail(mContext); + } + catch (Exception ex){ + onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); + } + }; + handler.postDelayed(runnable, 200); + }); + + mDialog.findViewById(R.id.mClear).setOnClickListener(v -> { + EditText mBridges = mDialog.findViewById(R.id.pBridgeInput); + TextView mTextView = mDialog.findViewById(R.id.pDescriptionError); + + mBridges.setText(strings.GENERIC_EMPTY_STR); + mTextView.animate().setDuration(250).alpha(0); + }); + + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + String mBridges = ((EditText)mDialog.findViewById(R.id.pBridgeInput)).getText().toString(); + + boolean mBridgeTypeExist = !mBridges.contains("obfs3") && !mBridges.contains("obfs4") && !mBridges.contains("fle") && !mBridges.contains("meek"); + boolean mBridgeSize = mBridges.length()<10 || !mBridges.contains(".") || !mBridges.contains(" "); + + if(mBridgeTypeExist || mBridgeSize){ + TextView mTextView = mDialog.findViewById(R.id.pDescriptionError); + if(mTextView.getAlpha()==0 || mTextView.getAlpha()==1 || mTextView.getVisibility()!=View.VISIBLE){ + mTextView.setAlpha(0); + + mTextView.setVisibility(View.VISIBLE); + mTextView.animate().setDuration(250).alpha(1); + if(mBridgeTypeExist){ + mTextView.setText("➔ Invalid bridge string"); + } + else if(mBridgeSize){ + mTextView.setText("➔ Invalid bridge type"); + } + } + return; + } + + mDialog.dismiss(); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + helperMethod.hideKeyboard(mContext); + mEvent.invokeObserver(Arrays.asList(mBridges, ((EditText)mDialog.findViewById(R.id.pBridgeType)).getText().toString()), M_SET_BRIDGES); + }); + } + + private void clearHistory() + { + initializeDialog(R.layout.popup_clear_history, Gravity.CENTER); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + mEvent.invokeObserver(null, M_CLEAR_HISTORY); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void clearBookmark() + { + initializeDialog(R.layout.popup_clear_bookmark, Gravity.CENTER); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + mEvent.invokeObserver(null, M_CLEAR_BOOKMARK); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void reportURL() + { + initializeDialog(R.layout.popup_report_url, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pHeader)).setText(mData.get(0).toString()); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + final Handler handler = new Handler(); + Runnable runnable = () -> onTrigger(Arrays.asList(strings.GENERIC_EMPTY_STR, mContext),M_RATE_SUCCESS); + handler.postDelayed(runnable, 1000); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void downloadSingle() + { + initializeDialog(R.layout.popup_download_url, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pDescription)).setText(mData.get(0).toString()); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + ArrayList tempData = new ArrayList<>(); + if(mData!=null){ + tempData.addAll(mData); + } + mDialog.dismiss(); + final Handler handler = new Handler(); + Runnable runnable = () -> mEvent.invokeObserver(tempData, M_DOWNLOAD_SINGLE); + handler.postDelayed(runnable, 1000); + onClearReference(); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void rateApp() + { + initializeDialog(R.layout.popup_rate_us, Gravity.CENTER); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + RatingBar mRatingBar = mDialog.findViewById(R.id.pRating); + if(mRatingBar.getRating()>=3){ + mEvent.invokeObserver(null, M_APP_RATED); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(CONST_PLAYSTORE_URL)); + try { + mContext.startActivity(intent); + } catch (Exception ignored) { + helperMethod.showToastMessage(MESSAGE_PLAYSTORE_NOT_FOUND, mContext); + } + + mDialog.dismiss(); + }else if(mRatingBar.getRating()>0) { + mEvent.invokeObserver(null, M_APP_RATED); + final Handler handler = new Handler(); + handler.postDelayed(() -> onTrigger(Arrays.asList(strings.GENERIC_EMPTY_STR, mContext),M_RATE_FAILURE), 1000); + mDialog.dismiss(); + } + }); + } + + private void downloadFileLongPress() + { + String title = mData.get(2).toString(); + + if(title.length()>0){ + title = title + " | "; + } + + initializeDialog(R.layout.popup_file_longpress, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pDescription)).setText((title + mData.get(0).toString())); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_DOWNLOAD_FILE_MANUAL); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_NEW_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK); + mDialog.dismiss(); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void openURLLongPress() + { + String title = mData.get(2).toString(); + + initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pDescription)).setText((title + mData.get(0))); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_NEW_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK); + mDialog.dismiss(); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void popupDownloadFull(){ + String url = mData.get(0).toString(); + String file = mData.get(2).toString(); + String title = mData.get(3).toString(); + + String data_local = mContext.getString(R.string.ALERT_LONG_URL_MESSAGE); + + if(!url.equals(strings.GENERIC_EMPTY_STR)){ + data_local = title + url; + } + else if(!file.equals(strings.GENERIC_EMPTY_STR)){ + data_local = file; + } + String mTitle = title; + if(mTitle.length()<=1){ + mTitle = mData.get(0).toString(); + } + + initializeDialog(R.layout.popup_download_full, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pHeader)).setText(mTitle); + ((TextView) mDialog.findViewById(R.id.pDescription)).setText((data_local)); + mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(url), M_OPEN_LINK_NEW_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(url), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(url), M_COPY_LINK); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(file), M_OPEN_LINK_NEW_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption5).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(file), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption6).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(file), M_COPY_LINK); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption7).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(file), M_DOWNLOAD_FILE_MANUAL); + mDialog.dismiss(); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void sendBridgeMail() + { + initializeDialog(R.layout.popup_bridge_mail, Gravity.CENTER); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + final Handler handler = new Handler(); + Runnable runnable = () -> { + try{ + helperMethod.sendBridgeEmail(mContext); + } + catch (Exception ex){ + onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); + } + }; + handler.postDelayed(runnable, 1000); + }); + } + + void onReset(){ + if(mDialog !=null){ + mDialog.dismiss(); + } + } + + /*External Triggers*/ + + public void onTrigger(List pData, pluginEnums.eMessageManager pEventType) + { + if(!pEventType.equals(M_RATE_FAILURE) && !pEventType.equals(M_RATE_SUCCESS) && !pEventType.equals(M_NOT_SUPPORTED)){ + onClearReference(); + } + if(pEventType.equals(pluginEnums.eMessageManager.M_RESET)){ + onReset(); + } + else { + this.mContext = (AppCompatActivity) pData.get(pData.size()-1); + this.mData = pData; + + switch (pEventType) { + case M_WELCOME: + /*VERIFIED*/ + welcomeMessage(); + break; + + case M_RATE_FAILURE: + /*VERIFIED*/ + rateFailure(); + break; + + case M_LANGUAGE_SUPPORT_FAILURE: + /*VERIFIED*/ + languageSupportFailure(); + break; + + case M_RATE_SUCCESS: + /*VERIFIED*/ + reportedSuccessfully(); + break; + + case M_BOOKMARK: + /*VERIFIED*/ + bookmark(); + break; + + case M_CLEAR_HISTORY: + /*VERIFIED*/ + clearHistory(); + break; + + case M_CLEAR_BOOKMARK: + /*VERIFIED*/ + clearBookmark(); + break; + + case M_REPORT_URL: + /*VERIFIED*/ + reportURL(); + break; + + case M_RATE_APP: + /*VERIFIED*/ + rateApp(); + break; + + case M_DOWNLOAD_FILE : + /*VERIFIED*/ + //downloadFileLongPress(); + break; + + case M_LONG_PRESS_DOWNLOAD : + /*VERIFIED*/ + downloadFileLongPress(); + break; + + case M_LONG_PRESS_URL: + /*VERIFIED*/ + openURLLongPress(); + break; + + case M_LONG_PRESS_WITH_LINK: + /*VERIFIED*/ + popupDownloadFull(); + break; + + case M_BRIDGE_MAIL: + /*VERIFIED*/ + sendBridgeMail(); + break; + + case M_NOT_SUPPORTED: + /*VERIFIED*/ + notSupportMessage(); + break; + + case M_PANIC_RESET: + /*VERIFIED*/ + onPanic(); + break; + + case M_DATA_CLEARED: + /*VERIFIED*/ + dataClearedSuccessfully(); + break; + + case M_APPLICATION_CRASH: + /*VERIFIED*/ + applicationCrashed(); + break; + + case M_SECURE_CONNECTION: + /*VERIFIED*/ + openSecureConnectionPopup(); + break; + + case M_DOWNLOAD_SINGLE: + /*VERIFIED*/ + downloadSingle(); + break; + + case M_UPDATE_BRIDGES: + /*VERIFIED*/ + onUpdateBridges(); + break; + + case M_NEW_IDENTITY: + /*VERIFIED*/ + newIdentityCreated(); + break; + + case M_DOWNLOAD_FAILURE: + /*VERIFIED*/ + mDownloadFailure(); + break; + + case M_POPUP_BLOCKED: + /*VERIFIED*/ + popupBlocked(); + break; + + case M_MAX_TAB_REACHED: + /*VERIFIED*/ + maxTabReached(); + break; + + case M_ORBOT_LOADING: + /*VERIFIED*/ + orbotLoading(); + break; + } + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java index e706ac34..f0758d7e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java @@ -1,90 +1,90 @@ -package com.darkweb.genesissearchengine.pluginManager.notificationPluginManager; - -import android.app.Notification ; -import android.app.NotificationChannel ; -import android.app.NotificationManager ; -import android.app.PendingIntent; -import android.content.BroadcastReceiver ; -import android.content.Context ; -import android.content.Intent ; -import android.graphics.Color; -import android.os.Build; -import android.util.Log; -import androidx.core.app.NotificationCompat; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.strings; -import com.example.myapplication.R; -import java.util.Random; -import static com.darkweb.genesissearchengine.constants.constants.mUserEngagementNotificationID; - -public class localEngagementManager extends BroadcastReceiver { - - - public void onReceive (Context context , Intent intent) { - try{ - final int NOTIFY_ID = mUserEngagementNotificationID; - String pTitle = strings.NOTIFICATION_TITLE; - String pBody = strings.NOTIFICATION_BODY[new Random().nextInt(strings.NOTIFICATION_BODY.length)]; - - String name = "NOTIFICATION:INDENTIFIER:1001"; - String id = "NOTIFICATION:INDENTIFIER:1001"; - String description = "NOTIFICATION:INDENTIFIER:1001"; - - - NotificationCompat.Builder builder; - NotificationManager mNotifManager = (NotificationManager)context.getSystemService(Context. NOTIFICATION_SERVICE ) ; - - if (mNotifManager == null) { - mNotifManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); - } - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - int importance = NotificationManager.IMPORTANCE_HIGH; - NotificationChannel mChannel = mNotifManager.getNotificationChannel(id); - if (mChannel == null) { - mChannel = new NotificationChannel(id, name, importance); - mChannel.setDescription(description); - mChannel.enableVibration(true); - mChannel.setLightColor(Color.GREEN); - mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); - mNotifManager.createNotificationChannel(mChannel); - } - builder = new NotificationCompat.Builder(context, id); - - Intent mIntent = activityContextManager.getInstance().getHomeController().getIntent(); - PendingIntent pendIntent = PendingIntent.getActivity(activityContextManager.getInstance().getCurrentActivity(), 0, mIntent, PendingIntent.FLAG_ONE_SHOT); - - builder.setContentTitle(pTitle) // required - .setSmallIcon(R.mipmap.ic_stat_tor_logo) // required - .setContentText(pBody) // required - .setDefaults(Notification.DEFAULT_ALL) - .setAutoCancel(true) - .setCategory(Notification.CATEGORY_SERVICE) - .setContentIntent(pendIntent) - .setTicker(pTitle) - .setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); - } else { - - builder = new NotificationCompat.Builder(context); - Intent mIntent = activityContextManager.getInstance().getHomeController().getIntent(); - PendingIntent pendIntent = PendingIntent.getActivity(activityContextManager.getInstance().getCurrentActivity(), 0, mIntent, PendingIntent. FLAG_ONE_SHOT); - - builder.setContentTitle(pTitle) // required - .setSmallIcon(R.mipmap.ic_stat_tor_logo) // required - .setContentText(pBody) // required - .setDefaults(Notification.DEFAULT_ALL) - .setAutoCancel(true) - .setContentIntent(pendIntent) - .setCategory(Notification.CATEGORY_SERVICE) - .setTicker(pTitle) - .setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}) - .setPriority(Notification.PRIORITY_HIGH); - } - - Notification notification = builder.build(); - mNotifManager.notify(NOTIFY_ID, notification); - }catch (Exception ex){ - Log.i("",""); - } - } +package com.darkweb.genesissearchengine.pluginManager.notificationPluginManager; + +import android.app.Notification ; +import android.app.NotificationChannel ; +import android.app.NotificationManager ; +import android.app.PendingIntent; +import android.content.BroadcastReceiver ; +import android.content.Context ; +import android.content.Intent ; +import android.graphics.Color; +import android.os.Build; +import android.util.Log; +import androidx.core.app.NotificationCompat; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.constants.strings; +import com.example.myapplication.R; +import java.util.Random; +import static com.darkweb.genesissearchengine.constants.constants.mUserEngagementNotificationID; + +public class localEngagementManager extends BroadcastReceiver { + + + public void onReceive (Context context , Intent intent) { + try{ + final int NOTIFY_ID = mUserEngagementNotificationID; + String pTitle = strings.NOTIFICATION_TITLE; + String pBody = strings.NOTIFICATION_BODY[new Random().nextInt(strings.NOTIFICATION_BODY.length)]; + + String name = "NOTIFICATION:INDENTIFIER:1001"; + String id = "NOTIFICATION:INDENTIFIER:1001"; + String description = "NOTIFICATION:INDENTIFIER:1001"; + + + NotificationCompat.Builder builder; + NotificationManager mNotifManager = (NotificationManager)context.getSystemService(Context. NOTIFICATION_SERVICE ) ; + + if (mNotifManager == null) { + mNotifManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + int importance = NotificationManager.IMPORTANCE_HIGH; + NotificationChannel mChannel = mNotifManager.getNotificationChannel(id); + if (mChannel == null) { + mChannel = new NotificationChannel(id, name, importance); + mChannel.setDescription(description); + mChannel.enableVibration(true); + mChannel.setLightColor(Color.GREEN); + mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); + mNotifManager.createNotificationChannel(mChannel); + } + builder = new NotificationCompat.Builder(context, id); + + Intent mIntent = activityContextManager.getInstance().getHomeController().getIntent(); + PendingIntent pendIntent = PendingIntent.getActivity(activityContextManager.getInstance().getCurrentActivity(), 0, mIntent, PendingIntent.FLAG_ONE_SHOT); + + builder.setContentTitle(pTitle) // required + .setSmallIcon(R.mipmap.ic_stat_tor_logo) // required + .setContentText(pBody) // required + .setDefaults(Notification.DEFAULT_ALL) + .setAutoCancel(true) + .setCategory(Notification.CATEGORY_SERVICE) + .setContentIntent(pendIntent) + .setTicker(pTitle) + .setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); + } else { + + builder = new NotificationCompat.Builder(context); + Intent mIntent = activityContextManager.getInstance().getHomeController().getIntent(); + PendingIntent pendIntent = PendingIntent.getActivity(activityContextManager.getInstance().getCurrentActivity(), 0, mIntent, PendingIntent. FLAG_ONE_SHOT); + + builder.setContentTitle(pTitle) // required + .setSmallIcon(R.mipmap.ic_stat_tor_logo) // required + .setContentText(pBody) // required + .setDefaults(Notification.DEFAULT_ALL) + .setAutoCancel(true) + .setContentIntent(pendIntent) + .setCategory(Notification.CATEGORY_SERVICE) + .setTicker(pTitle) + .setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}) + .setPriority(Notification.PRIORITY_HIGH); + } + + Notification notification = builder.build(); + mNotifManager.notify(NOTIFY_ID, notification); + }catch (Exception ex){ + Log.i("",""); + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java index 0996a6a4..8112af70 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java @@ -1,78 +1,78 @@ -package com.darkweb.genesissearchengine.pluginManager.notificationPluginManager; - -import android.app.AlarmManager; -import android.app.Notification; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.graphics.Color; -import android.os.SystemClock; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.NotificationCompat; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.example.myapplication.R; -import java.lang.ref.WeakReference; -import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.*; - -public class notifictionManager -{ - /*Private Variables*/ - - private WeakReference mAppContext; - - /*Initializations*/ - - public notifictionManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ - this.mAppContext = pAppContext; - onNotificationClear(); - } - - private void onNotificationClear(){ - NotificationManager notificationManager = (NotificationManager) mAppContext.get().getSystemService(Context.NOTIFICATION_SERVICE); - notificationManager.cancel(mUserEngagementNotificationID); - } - - private void onCreateUserEngagementNotification(int pDelay){ - onSchedule(getNotification() , pDelay ) ; - } - - private void onSchedule(Notification pNotification , int pDelay){ - Intent notificationIntent = new Intent( mAppContext.get().getApplicationContext(), localEngagementManager.class) ; - notificationIntent.putExtra(CONST_NOTIFICATION_ID_NAME, CONST_NOTIFICATION_ID_VALUE) ; - notificationIntent.putExtra(CONST_NOTIFICATION_ID_NAME, pNotification) ; - PendingIntent pendingIntent = PendingIntent. getBroadcast ( mAppContext.get().getApplicationContext(), CONST_NOTIFICATION_REQUEST_CODE, notificationIntent , PendingIntent. FLAG_UPDATE_CURRENT ) ; - long futureInMillis = SystemClock. elapsedRealtime () + pDelay ; - AlarmManager alarmManager = (AlarmManager) mAppContext.get().getSystemService(Context. ALARM_SERVICE ) ; - assert alarmManager != null; - alarmManager.set(AlarmManager. ELAPSED_REALTIME_WAKEUP , futureInMillis , pendingIntent) ; - } - - private Notification getNotification () { - NotificationCompat.Builder builder = new NotificationCompat.Builder(mAppContext.get().getApplicationContext(), CONST_NOTIFICATION_ID_NAME) ; - builder.setContentTitle(CONST_NOTIFICATION_TITLE) ; - builder.setSmallIcon(R.mipmap.ic_stat_tor_logo); - builder.setAutoCancel(true); - builder.setColor(Color.parseColor("#84989f")); - builder.setChannelId(CONST_NOTIFICATION_ID_NAME); - return builder.build(); - } - - /*External Triggers*/ - - public Object onTrigger(List pData, pluginEnums.eNotificationManager pEventType) { - if(pEventType.equals(pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION)) - { - onCreateUserEngagementNotification((int)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eNotificationManager.M_CLEAR_NOTIFICATION)) - { - onNotificationClear(); - } - return null; - } - -} +package com.darkweb.genesissearchengine.pluginManager.notificationPluginManager; + +import android.app.AlarmManager; +import android.app.Notification; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.os.SystemClock; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.NotificationCompat; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import java.lang.ref.WeakReference; +import java.util.List; +import static com.darkweb.genesissearchengine.constants.constants.*; + +public class notifictionManager +{ + /*Private Variables*/ + + private WeakReference mAppContext; + + /*Initializations*/ + + public notifictionManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ + this.mAppContext = pAppContext; + onNotificationClear(); + } + + private void onNotificationClear(){ + NotificationManager notificationManager = (NotificationManager) mAppContext.get().getSystemService(Context.NOTIFICATION_SERVICE); + notificationManager.cancel(mUserEngagementNotificationID); + } + + private void onCreateUserEngagementNotification(int pDelay){ + onSchedule(getNotification() , pDelay ) ; + } + + private void onSchedule(Notification pNotification , int pDelay){ + Intent notificationIntent = new Intent( mAppContext.get().getApplicationContext(), localEngagementManager.class) ; + notificationIntent.putExtra(CONST_NOTIFICATION_ID_NAME, CONST_NOTIFICATION_ID_VALUE) ; + notificationIntent.putExtra(CONST_NOTIFICATION_ID_NAME, pNotification) ; + PendingIntent pendingIntent = PendingIntent. getBroadcast ( mAppContext.get().getApplicationContext(), CONST_NOTIFICATION_REQUEST_CODE, notificationIntent , PendingIntent. FLAG_UPDATE_CURRENT ) ; + long futureInMillis = SystemClock. elapsedRealtime () + pDelay ; + AlarmManager alarmManager = (AlarmManager) mAppContext.get().getSystemService(Context. ALARM_SERVICE ) ; + assert alarmManager != null; + alarmManager.set(AlarmManager. ELAPSED_REALTIME_WAKEUP , futureInMillis , pendingIntent) ; + } + + private Notification getNotification () { + NotificationCompat.Builder builder = new NotificationCompat.Builder(mAppContext.get().getApplicationContext(), CONST_NOTIFICATION_ID_NAME) ; + builder.setContentTitle(CONST_NOTIFICATION_TITLE) ; + builder.setSmallIcon(R.mipmap.ic_stat_tor_logo); + builder.setAutoCancel(true); + builder.setColor(Color.parseColor("#84989f")); + builder.setChannelId(CONST_NOTIFICATION_ID_NAME); + return builder.build(); + } + + /*External Triggers*/ + + public Object onTrigger(List pData, pluginEnums.eNotificationManager pEventType) { + if(pEventType.equals(pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION)) + { + onCreateUserEngagementNotification((int)pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eNotificationManager.M_CLEAR_NOTIFICATION)) + { + onNotificationClear(); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java index e6f3a600..b40010d4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java @@ -1,276 +1,310 @@ -package com.darkweb.genesissearchengine.pluginManager.orbotPluginManager; - -import android.content.Intent; -import android.os.Build; -import androidx.appcompat.app.AppCompatActivity; -import org.mozilla.gecko.PrefsHelper; -import org.torproject.android.proxy.OrbotService; -import org.torproject.android.proxy.util.Prefs; -import org.torproject.android.proxy.wrapper.orbotLocalConstants; - -import java.lang.ref.WeakReference; -import java.util.List; - -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; - -import static org.torproject.android.proxy.TorServiceConstants.ACTION_START; - -// https://github.com/guardianproject/orbot/blob/8fca5f8ecddb4da9565ac3fd8936e4f28acdd352/BUILD.md -public class orbotManager -{ - - /*Private Variables*/ - - private WeakReference mAppContext; - private boolean mLogsStarted = false; - - /*Initialization*/ - - private static orbotManager sOurInstance = new orbotManager(); - public static orbotManager getInstance() - { - return sOurInstance; - } - - public void initialize(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, int pNotificationStatus){ - this.mAppContext = new WeakReference(pAppContext); - - onInitNotificationStatus(pNotificationStatus); - } - - public void onRemoveInstances(){ - this.mAppContext = null; - } - - private void onStartOrbot(String pBridgeCustomBridge, boolean pBridgeGatewayManual, String pBridgeCustomType, boolean pBridgeStatus, int pShowImages, boolean mClearOnExit, String pBridgesDefault){ - orbotLocalConstants.mBridges = pBridgeCustomBridge; - orbotLocalConstants.mIsManualBridge = pBridgeGatewayManual; - orbotLocalConstants.mManualBridgeType = pBridgeCustomType; - orbotLocalConstants.mBridgesDefault = pBridgesDefault; - Prefs.putBridgesEnabled(pBridgeStatus); - Intent mServiceIntent = new Intent(mAppContext.get().getApplicationContext(), OrbotService.class); - mServiceIntent.setAction(ACTION_START); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - mAppContext.get().stopService(mServiceIntent); - mAppContext.get().startForegroundService(mServiceIntent); - } - else - { - mAppContext.get().startService(mServiceIntent); - } - - initializeProxy(pShowImages, mClearOnExit); - } - - /*Helper Methods*/ - - private int onGetNotificationStatus(){ - return orbotLocalConstants.mNotificationStatus; - } - private void onInitNotificationStatus(int status){ - orbotLocalConstants.mNotificationStatus = status; - } - private void onEnableTorNotification(){ - OrbotService.getServiceObject().enableNotification(); - } - private void onDisableTorNotification(){ - OrbotService.getServiceObject().disableNotification(); - } - private void onEnableTorNotificationNoBandwidth(){ - OrbotService service = OrbotService.getServiceObject(); - if(service!=null){ - OrbotService.getServiceObject().enableTorNotificationNoBandwidth(); - } - } - - private void onUpdateBridges(boolean p_status){ - Prefs.putBridgesEnabled(p_status); - } - private void onUpdateVPN(boolean p_status){ - Prefs.putUseVpn(p_status); - } - - /*Proxy Manager*/ - - private void onSetProxy(String url){ - - PrefsHelper.setPref(keys.PROXY_TYPE, 1); - PrefsHelper.setPref(keys.PROXY_SOCKS, constants.CONST_PROXY_SOCKS); - PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050); - PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); - PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); - } - - private void initializeProxy(int pShowImages, boolean mClearOnExit) - { - PrefsHelper.setPref(keys.PROXY_TYPE, 0); - PrefsHelper.setPref(keys.PROXY_SOCKS,null); - PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, null); - PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,null); - PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,null); - - PrefsHelper.setPref(keys.PROXY_TYPE, 1); - PrefsHelper.setPref(keys.PROXY_SOCKS,constants.CONST_PROXY_SOCKS); - PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050); - PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); - PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); - - PrefsHelper.setPref(keys.PROXY_CACHE,constants.CONST_PROXY_CACHE); - PrefsHelper.setPref(keys.PROXY_MEMORY,constants.CONST_PROXY_MEMORY); - PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_ENABLED,constants.CONST_PROXY_DO_NOT_TRACK_HEADER_ENABLED); - PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_VALUE,constants.CONST_PROXY_DO_NOT_TRACK_HEADER_VALUE); - - PrefsHelper.setPref("browser.cache.disk.enable",true); - PrefsHelper.setPref("browser.cache.memory.enable",true); - PrefsHelper.setPref("browser.cache.disk.capacity",1000); - - onUpdatePrivacyPreferences(pShowImages, mClearOnExit); - } - - private void onUpdatePrivacyPreferences(int pShowImages, boolean mClearOnExit) - { - PrefsHelper.setPref(keys.PROXY_IMAGE, pShowImages); - PrefsHelper.setPref("privacy.clearOnShutdown.cache",mClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.downloads",mClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.formdata",mClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.history",mClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",mClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.passwords",mClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.sessions",mClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",mClearOnExit); - - PrefsHelper.setPref("browser.display.show_image_placeholders",true); - PrefsHelper.setPref("browser.cache.disk.enable",false); - PrefsHelper.setPref("browser.cache.memory.enable",true); - PrefsHelper.setPref("browser.cache.disk.capacity",0); - PrefsHelper.setPref("privacy.resistFingerprinting",true); - PrefsHelper.setPref("privacy.donottrackheader.enabled",false); - PrefsHelper.setPref("privacy.donottrackheader.value",1); - PrefsHelper.setPref("network.http.sendRefererHeader", 0); - PrefsHelper.setPref("security.OCSP.require", true); - PrefsHelper.setPref("security.checkloaduri",true); - PrefsHelper.setPref("security.mixed_content.block_display_content", true); - PrefsHelper.setPref("media.peerconnection.enabled",false); //webrtc disabled - } - - /*Log Manager*/ - - private String getLogs() - { - String logs = orbotLocalConstants.mTorLogsStatus; - - if(orbotLocalConstants.mTorLogsStatus.equals("No internet connection")){ - return "Warning | " + orbotLocalConstants.mTorLogsStatus; - } - - else if(orbotLocalConstants.mTorLogsStatus.startsWith("Invalid Configuration")){ - return orbotLocalConstants.mTorLogsStatus; - } - - if(!logs.contains("Bootstrapped") && !mLogsStarted){ - logs = "Initializing Bootstrap"; - mLogsStarted = true; - } - - if(!logs.equals(strings.GENERIC_EMPTY_STR)) - { - String Logs = logs; - Logs="Installing | " + Logs.replace("FAILED","Securing"); - return Logs; - } - return "Loading Please Wait"; - } - - private boolean isOrbotRunning(){ - return orbotLocalConstants.mIsTorInitialized; - } - - private void newCircuit(){ - OrbotService.getServiceObject().newIdentity(); - } - - private String getOrbotStatus(){ - return OrbotService.getServiceObject().getProxyStatus(); - } - - private void onDestroy(boolean pThemeApplying){ - if(pThemeApplying) { - OrbotService.getServiceObject().onDestroy(); - } - } - - /*External Triggers*/ - - public Object onTrigger(List pData, pluginEnums.eOrbotManager pEventType) { - if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_NOTIFICATION_STATUS)) - { - return onGetNotificationStatus(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION)) - { - onEnableTorNotification(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION)) - { - onDisableTorNotification(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION_NO_BANDWIDTH)) - { - onEnableTorNotificationNoBandwidth(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_LOGS)) - { - return getLogs(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_PRIVACY)) - { - onUpdatePrivacyPreferences((int) pData.get(0),(boolean) pData.get(1)); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_START_ORBOT)) - { - onStartOrbot((String) pData.get(0),(boolean) pData.get(1),(String) pData.get(2),(boolean) pData.get(3),(int) pData.get(4),(boolean) pData.get(5),(String) pData.get(6)); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_IS_ORBOT_RUNNING)) - { - isOrbotRunning(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS)) - { - return getOrbotStatus(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_VPN)) - { - onUpdateVPN((boolean)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_BRIDGES)) - { - onUpdateBridges((boolean)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_SET_PROXY)) - { - onSetProxy((String)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_SHOW_NOTIFICATION_STATUS)) - { - onInitNotificationStatus((int)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_ORBOT_RUNNING)) - { - return isOrbotRunning(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_NEW_CIRCUIT)) - { - newCircuit(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_DESTROY)) - { - onDestroy((boolean) pData.get(0)); - } - return null; - } - -} +package com.darkweb.genesissearchengine.pluginManager.orbotPluginManager; + +import android.content.Intent; +import android.os.Build; +import androidx.appcompat.app.AppCompatActivity; +import org.mozilla.gecko.PrefsHelper; +import org.torproject.android.proxy.OrbotService; +import org.torproject.android.proxy.util.Prefs; +import org.torproject.android.proxy.wrapper.orbotLocalConstants; + +import java.lang.ref.WeakReference; +import java.util.List; + +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; + +import static org.torproject.android.proxy.TorServiceConstants.ACTION_START; + +// https://github.com/guardianproject/orbot/blob/8fca5f8ecddb4da9565ac3fd8936e4f28acdd352/BUILD.md +public class orbotManager +{ + + /*Private Variables*/ + + private WeakReference mAppContext; + private boolean mLogsStarted = false; + + /*Initialization*/ + + private static orbotManager sOurInstance = new orbotManager(); + public static orbotManager getInstance() + { + return sOurInstance; + } + + public void initialize(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, int pNotificationStatus){ + this.mAppContext = new WeakReference(pAppContext); + + onInitNotificationStatus(pNotificationStatus); + } + + public void onRemoveInstances(){ + this.mAppContext = null; + } + + private void onStartOrbot(String pBridgeCustomBridge, boolean pBridgeGatewayManual, String pBridgeCustomType, boolean pBridgeStatus, int pShowImages, boolean mClearOnExit, String pBridgesDefault){ + orbotLocalConstants.mBridges = pBridgeCustomBridge; + orbotLocalConstants.mIsManualBridge = pBridgeGatewayManual; + orbotLocalConstants.mManualBridgeType = pBridgeCustomType; + orbotLocalConstants.mBridgesDefault = pBridgesDefault; + Prefs.putBridgesEnabled(pBridgeStatus); + Intent mServiceIntent = new Intent(mAppContext.get().getApplicationContext(), OrbotService.class); + mServiceIntent.setAction(ACTION_START); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + mAppContext.get().stopService(mServiceIntent); + mAppContext.get().startForegroundService(mServiceIntent); + } + else + { + mAppContext.get().startService(mServiceIntent); + } + + initializeProxy(pShowImages, mClearOnExit); + } + + /*Helper Methods*/ + + private int onGetNotificationStatus(){ + return orbotLocalConstants.mNotificationStatus; + } + private void onInitNotificationStatus(int status){ + orbotLocalConstants.mNotificationStatus = status; + } + private void onEnableTorNotification(){ + OrbotService.getServiceObject().enableNotification(); + } + private void onDisableTorNotification(){ + OrbotService.getServiceObject().disableNotification(); + } + private void onEnableTorNotificationNoBandwidth(){ + OrbotService service = OrbotService.getServiceObject(); + if(service!=null){ + OrbotService.getServiceObject().enableTorNotificationNoBandwidth(); + } + } + + private void onUpdateBridges(boolean p_status){ + Prefs.putBridgesEnabled(p_status); + } + private void onUpdateVPN(boolean p_status){ + Prefs.putUseVpn(p_status); + } + + /*Proxy Manager*/ + + private void onSetProxy(){ + + PrefsHelper.setPref(keys.PROXY_TYPE, 1); + PrefsHelper.setPref(keys.PROXY_SOCKS, constants.CONST_PROXY_SOCKS); + PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9055); + PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); + PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); + } + + private void initializeProxy(int pShowImages, boolean mClearOnExit) + { + PrefsHelper.setPref(keys.PROXY_TYPE, 0); + PrefsHelper.setPref(keys.PROXY_SOCKS,null); + PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, null); + PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,null); + PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,null); + + PrefsHelper.setPref(keys.PROXY_TYPE, 1); + PrefsHelper.setPref(keys.PROXY_SOCKS,constants.CONST_PROXY_SOCKS); + PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9055); + PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); + PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); + + PrefsHelper.setPref(keys.PROXY_CACHE,constants.CONST_PROXY_CACHE); + PrefsHelper.setPref(keys.PROXY_MEMORY,constants.CONST_PROXY_MEMORY); + PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_ENABLED,constants.CONST_PROXY_DO_NOT_TRACK_HEADER_ENABLED); + PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_VALUE,constants.CONST_PROXY_DO_NOT_TRACK_HEADER_VALUE); + + PrefsHelper.setPref("browser.cache.disk.enable",true); + PrefsHelper.setPref("browser.cache.memory.enable",true); + PrefsHelper.setPref("browser.cache.disk.capacity",1000); + PrefsHelper.setPref("Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0","en-us,en;q=0.5"); + + PrefsHelper.setPref("browser.display.show_image_placeholders",true); + PrefsHelper.setPref("browser.cache.disk.enable",false); + PrefsHelper.setPref("browser.cache.memory.enable",true); + PrefsHelper.setPref("browser.cache.disk.capacity",0); + PrefsHelper.setPref("privacy.resistFingerprinting",true); + PrefsHelper.setPref("privacy.donottrackheader.enabled",false); + PrefsHelper.setPref("privacy.donottrackheader.value",1); + PrefsHelper.setPref("network.http.sendRefererHeader", 0); + PrefsHelper.setPref("security.OCSP.require", false); + PrefsHelper.setPref("security.checkloaduri",false); + PrefsHelper.setPref("security.mixed_content.block_active_content",false); + PrefsHelper.setPref("security.mixed_content.block_display_content", false); + PrefsHelper.setPref("media.peerconnection.enabled",false); //webrtc disabled + PrefsHelper.setPref("Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0","en-us,en;q=0.5"); + + PrefsHelper.setPref("browser.cache.disk_cache_ssl",true); + PrefsHelper.setPref("signon.formlessCapture.enabled",true); + PrefsHelper.setPref("signon.storeWhenAutocompleteOff",true); + PrefsHelper.setPref("signon.storeWhenAutocompleteOff",true); + PrefsHelper.setPref("dom.event.contextmenu.enabled",true); + PrefsHelper.setPref("layout.css.visited_links_enabled",true); + PrefsHelper.setPref("security.ssl3.ecdhe_rsa_aes_128_sha",true); + PrefsHelper.setPref("security.ssl3.ecdhe_ecdsa_aes_128_sha",true); + PrefsHelper.setPref("security.ssl3.dhe_rsa_aes_128_sha",true); + PrefsHelper.setPref("security.ssl3.rsa_des_ede3_sha",true); + PrefsHelper.setPref("security.ssl3.dhe_rsa_aes_256_sha",true); + + PrefsHelper.setPref("browser.send_pings.require_same_host",false); + PrefsHelper.setPref("webgl.disabled",false); + PrefsHelper.setPref("browser.safebrowsing.blockedURIs.enabled",false); + PrefsHelper.setPref("media.gmp-provider.enabled",false); + PrefsHelper.setPref("browser.send_pings.require_same_host",false); + PrefsHelper.setPref("webgl.disabled",false); + PrefsHelper.setPref("pdfjs.enableWebGL",false); + PrefsHelper.setPref("browser.safebrowsing.malware.enabled",false); + PrefsHelper.setPref("security.csp.experimentalEnabled",false); + PrefsHelper.setPref("network.http.referer.spoofSource",false); + PrefsHelper.setPref("security.OCSP.require",false); + PrefsHelper.setPref("security.ssl.treat_unsafe_negotiation_as_broken", false); + PrefsHelper.setPref("security.ssl.require_safe_negotiation",false); + + onUpdatePrivacyPreferences(pShowImages, mClearOnExit); + } + + private void onUpdatePrivacyPreferences(int pShowImages, boolean mClearOnExit) + { + PrefsHelper.setPref(keys.PROXY_IMAGE, pShowImages); + PrefsHelper.setPref("privacy.clearOnShutdown.cache",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.downloads",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.formdata",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.history",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.passwords",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.sessions",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",mClearOnExit); + + } + + /*Log Manager*/ + + private String getLogs() + { + String logs = orbotLocalConstants.mTorLogsStatus; + + if(logs.equals("Starting Genesis | Please Wait ...")){ + return logs; + } + + if(orbotLocalConstants.mTorLogsStatus.equals("No internet connection")){ + return "Warning | " + orbotLocalConstants.mTorLogsStatus; + } + + else if(orbotLocalConstants.mTorLogsStatus.startsWith("Invalid Configuration")){ + return orbotLocalConstants.mTorLogsStatus; + } + + if(!logs.contains("Bootstrapped") && !mLogsStarted){ + logs = "Initializing Bootstrap"; + mLogsStarted = true; + } + + if(!logs.equals(strings.GENERIC_EMPTY_STR)) + { + String Logs = logs; + Logs="Installing | " + Logs.replace("FAILED","Securing"); + return Logs; + } + return "Loading Please Wait"; + } + + private boolean isOrbotRunning(){ + return orbotLocalConstants.mIsTorInitialized; + } + + private void newCircuit(){ + OrbotService.getServiceObject().newIdentity(); + } + + private String getOrbotStatus(){ + return OrbotService.getServiceObject().getProxyStatus(); + } + + private void onDestroy(boolean pThemeApplying){ + if(pThemeApplying) { + OrbotService.getServiceObject().onDestroy(); + } + } + + /*External Triggers*/ + + public Object onTrigger(List pData, pluginEnums.eOrbotManager pEventType) { + if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_NOTIFICATION_STATUS)) + { + return onGetNotificationStatus(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION)) + { + onEnableTorNotification(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION)) + { + onDisableTorNotification(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION_NO_BANDWIDTH)) + { + onEnableTorNotificationNoBandwidth(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_LOGS)) + { + return getLogs(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_PRIVACY)) + { + onUpdatePrivacyPreferences((int) pData.get(0),(boolean) pData.get(1)); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_START_ORBOT)) + { + onStartOrbot((String) pData.get(0),(boolean) pData.get(1),(String) pData.get(2),(boolean) pData.get(3),(int) pData.get(4),(boolean) pData.get(5),(String) pData.get(6)); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_IS_ORBOT_RUNNING)) + { + isOrbotRunning(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS)) + { + return getOrbotStatus(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_VPN)) + { + onUpdateVPN((boolean)pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_BRIDGES)) + { + onUpdateBridges((boolean)pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_SET_PROXY)) + { + onSetProxy(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_SHOW_NOTIFICATION_STATUS)) + { + onInitNotificationStatus((int)pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_ORBOT_RUNNING)) + { + return isOrbotRunning(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_NEW_CIRCUIT)) + { + newCircuit(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_DESTROY)) + { + onDestroy((boolean) pData.get(0)); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java index cbcf790e..3a895240 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java @@ -1,51 +1,51 @@ -package com.darkweb.genesissearchengine.pluginManager; - -public class pluginEnums -{ - /*Advert Manager*/ - public enum eAdManager { - M_INITIALIZE_BANNER_ADS, M_IS_ADVERT_LOADED - } - public enum eAdManagerCallbacks { - M_SHOW_LOADED_ADS - } - - - /*Analytics Manager*/ - public enum eAnalyticManager { - M_LOG_EVENT - } - - - /*Lanuage Manager*/ - public enum eLangManager{ - M_SET_LANGUAGE, M_ACTIVITY_CREATED, M_RESUME, M_SUPPORTED_SYSTEM_LANGUAGE_INFO, M_INIT_LOCALE, M_UPDATE_LOCAL - } - - public enum eLangManagerCallbacks{ - - } - - /*Message Manager*/ - public enum eMessageManager{ - M_RESET, M_DATA_CLEARED, M_APPLICATION_CRASH, M_SECURE_CONNECTION, M_POPUP_BLOCKED, M_PANIC, M_MAX_TAB_REACHED,M_DOWNLOAD_SINGLE, M_UPDATE_BRIDGES, M_NEW_IDENTITY, M_NOT_SUPPORTED, M_BRIDGE_MAIL, M_LONG_PRESS_WITH_LINK, M_LONG_PRESS_URL, M_LONG_PRESS_DOWNLOAD, M_START_ORBOT, M_DOWNLOAD_FAILURE, M_DOWNLOAD_FILE, M_RATE_APP, M_REPORT_URL, M_CLEAR_BOOKMARK, M_CLEAR_HISTORY, M_BOOKMARK, M_PANIC_RESET, M_RATE_SUCCESS, M_RATE_FAILURE, M_LANGUAGE_SUPPORT_FAILURE, M_WELCOME - } - public enum eMessageManagerCallbacks{ - M_CANCEL_WELCOME, M_APP_RATED, M_DOWNLOAD_FILE_MANUAL, M_OPEN_LINK_CURRENT_TAB, M_COPY_LINK, M_REQUEST_BRIDGES, M_SET_BRIDGES, M_OPEN_LINK_NEW_TAB, M_CLEAR_TAB, M_RATE_APPLICATION, M_OPEN_PRIVACY, M_CUSTOM_BRIDGE, M_BRIDGE_TYPE - } - - /*Download Manager*/ - public enum eDownloadManager{ - M_DOWNLOAD_FILE, M_CANCEL, M_TRIGGER, M_START_SERVICE, M_DOWNLOAD_BLOB - } - - /*Notification Manager*/ - public enum eNotificationManager{ - M_CREATE_NOTIFICATION, M_CLEAR_NOTIFICATION - } - - /*Orbot Manager*/ - public enum eOrbotManager{ - M_GET_NOTIFICATION_STATUS, M_NEW_CIRCUIT, M_DESTROY,M_ENABLE_NOTIFICATION, M_DISABLE_NOTIFICATION, M_DISABLE_NOTIFICATION_NO_BANDWIDTH, M_GET_LOGS, M_UPDATE_PRIVACY,M_START_ORBOT,M_IS_ORBOT_RUNNING, M_GET_ORBOT_STATUS, M_UPDATE_BRIDGES, M_UPDATE_VPN, M_SET_PROXY, M_SHOW_NOTIFICATION_STATUS, M_ORBOT_RUNNING - } +package com.darkweb.genesissearchengine.pluginManager; + +public class pluginEnums +{ + /*Advert Manager*/ + public enum eAdManager { + M_INITIALIZE_BANNER_ADS, M_IS_ADVERT_LOADED + } + public enum eAdManagerCallbacks { + M_SHOW_LOADED_ADS + } + + + /*Analytics Manager*/ + public enum eAnalyticManager { + M_LOG_EVENT + } + + + /*Lanuage Manager*/ + public enum eLangManager{ + M_SET_LANGUAGE, M_ACTIVITY_CREATED, M_RESUME, M_SUPPORTED_SYSTEM_LANGUAGE_INFO, M_INIT_LOCALE, M_UPDATE_LOCAL + } + + public enum eLangManagerCallbacks{ + + } + + /*Message Manager*/ + public enum eMessageManager{ + M_RESET, M_DATA_CLEARED, M_APPLICATION_CRASH, M_SECURE_CONNECTION, M_POPUP_BLOCKED, M_PANIC, M_MAX_TAB_REACHED, M_ORBOT_LOADING,M_DOWNLOAD_SINGLE, M_UPDATE_BRIDGES, M_NEW_IDENTITY, M_NOT_SUPPORTED, M_BRIDGE_MAIL, M_LONG_PRESS_WITH_LINK, M_LONG_PRESS_URL, M_LONG_PRESS_DOWNLOAD, M_START_ORBOT, M_DOWNLOAD_FAILURE, M_DOWNLOAD_FILE, M_RATE_APP, M_REPORT_URL, M_CLEAR_BOOKMARK, M_CLEAR_HISTORY, M_BOOKMARK, M_PANIC_RESET, M_RATE_SUCCESS, M_RATE_FAILURE, M_LANGUAGE_SUPPORT_FAILURE, M_WELCOME + } + public enum eMessageManagerCallbacks{ + M_CANCEL_WELCOME, M_APP_RATED, M_DOWNLOAD_FILE_MANUAL, M_OPEN_LINK_CURRENT_TAB, M_COPY_LINK, M_REQUEST_BRIDGES, M_SET_BRIDGES, M_OPEN_LINK_NEW_TAB, M_CLEAR_TAB, M_RATE_APPLICATION, M_OPEN_PRIVACY, M_CUSTOM_BRIDGE, M_BRIDGE_TYPE + } + + /*Download Manager*/ + public enum eDownloadManager{ + M_DOWNLOAD_FILE, M_CANCEL, M_TRIGGER, M_START_SERVICE, M_DOWNLOAD_BLOB + } + + /*Notification Manager*/ + public enum eNotificationManager{ + M_CREATE_NOTIFICATION, M_CLEAR_NOTIFICATION + } + + /*Orbot Manager*/ + public enum eOrbotManager{ + M_GET_NOTIFICATION_STATUS, M_NEW_CIRCUIT, M_DESTROY,M_ENABLE_NOTIFICATION, M_DISABLE_NOTIFICATION, M_DISABLE_NOTIFICATION_NO_BANDWIDTH, M_GET_LOGS, M_UPDATE_PRIVACY,M_START_ORBOT,M_IS_ORBOT_RUNNING, M_GET_ORBOT_STATUS, M_UPDATE_BRIDGES, M_UPDATE_VPN, M_SET_PROXY, M_SHOW_NOTIFICATION_STATUS, M_ORBOT_RUNNING + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java index bbb55d08..c2021cf0 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java @@ -1,21 +1,21 @@ -package com.darkweb.genesissearchengine.pluginManager.pluginReciever; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import java.util.Collections; - -import static com.darkweb.genesissearchengine.constants.constants.*; - -public class downloadNotificationReciever extends BroadcastReceiver { - public void onReceive (Context context , Intent intent) { - int mCommand = intent.getExtras().getInt(CONST_DOWNLOAD_COMMAND); - if(mCommand==1){ - pluginController.getInstance().onDownloadInvoke(Collections.singletonList(intent.getExtras().getInt(CONST_DOWNLOAD_INTENT_KEY)), pluginEnums.eDownloadManager.M_TRIGGER); - }else if(mCommand==0 || mCommand==2) { - pluginController.getInstance().onDownloadInvoke(Collections.singletonList(intent.getExtras().getInt(CONST_DOWNLOAD_INTENT_KEY)), pluginEnums.eDownloadManager.M_CANCEL); - } - } -} +package com.darkweb.genesissearchengine.pluginManager.pluginReciever; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import java.util.Collections; + +import static com.darkweb.genesissearchengine.constants.constants.*; + +public class downloadNotificationReciever extends BroadcastReceiver { + public void onReceive (Context context , Intent intent) { + int mCommand = intent.getExtras().getInt(CONST_DOWNLOAD_COMMAND); + if(mCommand==1){ + pluginController.getInstance().onDownloadInvoke(Collections.singletonList(intent.getExtras().getInt(CONST_DOWNLOAD_INTENT_KEY)), pluginEnums.eDownloadManager.M_TRIGGER); + }else if(mCommand==0 || mCommand==2) { + pluginController.getInstance().onDownloadInvoke(Collections.singletonList(intent.getExtras().getInt(CONST_DOWNLOAD_INTENT_KEY)), pluginEnums.eDownloadManager.M_CANCEL); + } + } +} diff --git a/app/src/main/java/com/widget/search/searchWidgetManager.java b/app/src/main/java/com/widget/search/searchWidgetManager.java index 535e8269..7f0596c3 100644 --- a/app/src/main/java/com/widget/search/searchWidgetManager.java +++ b/app/src/main/java/com/widget/search/searchWidgetManager.java @@ -1,163 +1,163 @@ -package com.widget.search; - -import android.app.PendingIntent; -import android.appwidget.AppWidgetManager; -import android.appwidget.AppWidgetProvider; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.graphics.Color; -import android.os.Bundle; -import android.widget.RemoteViews; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; -import com.example.myapplication.R; - -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; -import static com.darkweb.genesissearchengine.constants.constants.CONST_WIDGET_NAME; - -public class searchWidgetManager extends AppWidgetProvider { - - /* Local Variables */ - - private static final String SHARED_PREF_FILE = CONST_WIDGET_NAME; - private static final String COUNT_KEY = "count"; - private static int mCurrentWidth = -1; - - /* Navigator Initializations */ - - private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { - - SharedPreferences prefs = context.getSharedPreferences(SHARED_PREF_FILE, 0); - int count = prefs.getInt(COUNT_KEY + appWidgetId, 0); - count++; - - RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); - - SharedPreferences.Editor prefEditor = prefs.edit(); - prefEditor.putInt(COUNT_KEY + appWidgetId, count); - prefEditor.apply(); - - int[] idArray = new int[]{appWidgetId}; - Intent intentUpdate = new Intent(context, searchWidgetManager.class); - intentUpdate.setAction("mOpenApplication"); - intentUpdate.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, idArray); - PendingIntent pendingUpdate = PendingIntent.getBroadcast(context, appWidgetId, intentUpdate, PendingIntent.FLAG_UPDATE_CURRENT); - - Intent mintentUpdate = new Intent(context, searchWidgetManager.class); - mintentUpdate.setAction("mOpenVoice"); - mintentUpdate.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, idArray); - PendingIntent mpintentUpdate = PendingIntent.getBroadcast(context, appWidgetId, mintentUpdate, PendingIntent.FLAG_UPDATE_CURRENT); - - views.setOnClickPendingIntent(R.id.pSearchLogo, pendingUpdate); - views.setOnClickPendingIntent(R.id.pTopBarContainer, pendingUpdate); - views.setOnClickPendingIntent(R.id.pSearchInputWidget, pendingUpdate); - views.setOnClickPendingIntent(R.id.pVoiceInput, mpintentUpdate); - appWidgetManager.updateAppWidget(appWidgetId, views); - - } - - public void onReceive(Context context, Intent intent) { - - String action = intent.getAction(); - switch (action) { - case enums.WidgetCommands.OPEN_APPLICATION: { - status.sWidgetResponse = enums.WidgetResponse.SEARCHBAR; - Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); - launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true); - context.startActivity(launchIntent); - break; - } - case enums.WidgetCommands.OPEN_VOICE: { - status.sWidgetResponse = enums.WidgetResponse.VOICE; - Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); - launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true); - context.startActivity(launchIntent); - break; - } - case AppWidgetManager.ACTION_APPWIDGET_UPDATE: { - Bundle extras = intent.getExtras(); - if (extras != null) { - int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); - if (appWidgetIds != null && appWidgetIds.length > 0) { - this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); - } - } - break; - } - case AppWidgetManager.ACTION_APPWIDGET_DELETED: { - Bundle extras = intent.getExtras(); - if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) { - final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); - this.onDeleted(context, new int[]{appWidgetId}); - } - break; - } - case AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED: { - Bundle extras = intent.getExtras(); - if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID) - && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) { - int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); - Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS); - this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context), - appWidgetId, widgetExtras); - } - break; - } - case AppWidgetManager.ACTION_APPWIDGET_ENABLED: - this.onEnabled(context); - break; - case AppWidgetManager.ACTION_APPWIDGET_DISABLED: - this.onDisabled(context); - break; - case AppWidgetManager.ACTION_APPWIDGET_RESTORED: { - Bundle extras = intent.getExtras(); - if (extras != null) { - int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS); - int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); - if (oldIds != null && oldIds.length > 0) { - this.onRestored(context, oldIds, newIds); - this.onUpdate(context, AppWidgetManager.getInstance(context), newIds); - } - } - break; - } - } - } - - /* Local Overrides */ - - @Override - public void onAppWidgetOptionsChanged (Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle widgetInfo) { - int width = widgetInfo.getInt (AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH); - mCurrentWidth = width; - int[] appWidgetIds = new int[1]; - appWidgetIds[0] = appWidgetId; - onUpdate(context, appWidgetManager, appWidgetIds); - } - - @Override - public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { - for (int appWidgetId : appWidgetIds) { - updateAppWidget(context, appWidgetManager, appWidgetId); - - int size = getColsNum(mCurrentWidth); - RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); - if(mCurrentWidth!=-1){ - if(size<=2){ - views.setTextColor(R.id.pSearchInputWidget, Color.WHITE); - }else { - views.setTextColor(R.id.pSearchInputWidget, Color.GRAY); - } - appWidgetManager.updateAppWidget(appWidgetIds, views); - } - } - } - - /* Helper Methods */ - - private int getColsNum (int size) { - return (int) Math.floor ((size - 30) / 70); - } - +package com.widget.search; + +import android.app.PendingIntent; +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProvider; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.Bundle; +import android.widget.RemoteViews; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.status; +import com.example.myapplication.R; + +import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; +import static com.darkweb.genesissearchengine.constants.constants.CONST_WIDGET_NAME; + +public class searchWidgetManager extends AppWidgetProvider { + + /* Local Variables */ + + private static final String SHARED_PREF_FILE = CONST_WIDGET_NAME; + private static final String COUNT_KEY = "count"; + private static int mCurrentWidth = -1; + + /* Navigator Initializations */ + + private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { + + SharedPreferences prefs = context.getSharedPreferences(SHARED_PREF_FILE, 0); + int count = prefs.getInt(COUNT_KEY + appWidgetId, 0); + count++; + + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); + + SharedPreferences.Editor prefEditor = prefs.edit(); + prefEditor.putInt(COUNT_KEY + appWidgetId, count); + prefEditor.apply(); + + int[] idArray = new int[]{appWidgetId}; + Intent intentUpdate = new Intent(context, searchWidgetManager.class); + intentUpdate.setAction("mOpenApplication"); + intentUpdate.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, idArray); + PendingIntent pendingUpdate = PendingIntent.getBroadcast(context, appWidgetId, intentUpdate, PendingIntent.FLAG_UPDATE_CURRENT); + + Intent mintentUpdate = new Intent(context, searchWidgetManager.class); + mintentUpdate.setAction("mOpenVoice"); + mintentUpdate.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, idArray); + PendingIntent mpintentUpdate = PendingIntent.getBroadcast(context, appWidgetId, mintentUpdate, PendingIntent.FLAG_UPDATE_CURRENT); + + views.setOnClickPendingIntent(R.id.pSearchLogo, pendingUpdate); + views.setOnClickPendingIntent(R.id.pTopBarContainer, pendingUpdate); + views.setOnClickPendingIntent(R.id.pSearchInputWidget, pendingUpdate); + views.setOnClickPendingIntent(R.id.pVoiceInput, mpintentUpdate); + appWidgetManager.updateAppWidget(appWidgetId, views); + + } + + public void onReceive(Context context, Intent intent) { + + String action = intent.getAction(); + switch (action) { + case enums.WidgetCommands.OPEN_APPLICATION: { + status.sWidgetResponse = enums.WidgetResponse.SEARCHBAR; + Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); + launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true); + context.startActivity(launchIntent); + break; + } + case enums.WidgetCommands.OPEN_VOICE: { + status.sWidgetResponse = enums.WidgetResponse.VOICE; + Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); + launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true); + context.startActivity(launchIntent); + break; + } + case AppWidgetManager.ACTION_APPWIDGET_UPDATE: { + Bundle extras = intent.getExtras(); + if (extras != null) { + int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); + if (appWidgetIds != null && appWidgetIds.length > 0) { + this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); + } + } + break; + } + case AppWidgetManager.ACTION_APPWIDGET_DELETED: { + Bundle extras = intent.getExtras(); + if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) { + final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); + this.onDeleted(context, new int[]{appWidgetId}); + } + break; + } + case AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED: { + Bundle extras = intent.getExtras(); + if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID) + && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) { + int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); + Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS); + this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context), + appWidgetId, widgetExtras); + } + break; + } + case AppWidgetManager.ACTION_APPWIDGET_ENABLED: + this.onEnabled(context); + break; + case AppWidgetManager.ACTION_APPWIDGET_DISABLED: + this.onDisabled(context); + break; + case AppWidgetManager.ACTION_APPWIDGET_RESTORED: { + Bundle extras = intent.getExtras(); + if (extras != null) { + int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS); + int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); + if (oldIds != null && oldIds.length > 0) { + this.onRestored(context, oldIds, newIds); + this.onUpdate(context, AppWidgetManager.getInstance(context), newIds); + } + } + break; + } + } + } + + /* Local Overrides */ + + @Override + public void onAppWidgetOptionsChanged (Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle widgetInfo) { + int width = widgetInfo.getInt (AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH); + mCurrentWidth = width; + int[] appWidgetIds = new int[1]; + appWidgetIds[0] = appWidgetId; + onUpdate(context, appWidgetManager, appWidgetIds); + } + + @Override + public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { + for (int appWidgetId : appWidgetIds) { + updateAppWidget(context, appWidgetManager, appWidgetId); + + int size = getColsNum(mCurrentWidth); + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); + if(mCurrentWidth!=-1){ + if(size<=2){ + views.setTextColor(R.id.pSearchInputWidget, Color.WHITE); + }else { + views.setTextColor(R.id.pSearchInputWidget, Color.GRAY); + } + appWidgetManager.updateAppWidget(appWidgetIds, views); + } + } + } + + /* Helper Methods */ + + private int getColsNum (int size) { + return (int) Math.floor ((size - 30) / 70); + } + } \ No newline at end of file diff --git a/app/src/main/res/anim/fade_in_instant.xml b/app/src/main/res/anim/fade_in_instant.xml index 3d5fdbcc..75ee879f 100644 --- a/app/src/main/res/anim/fade_in_instant.xml +++ b/app/src/main/res/anim/fade_in_instant.xml @@ -1,8 +1,8 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/anim/fade_in_lang.xml b/app/src/main/res/anim/fade_in_lang.xml index 04a4f737..0a08b417 100644 --- a/app/src/main/res/anim/fade_in_lang.xml +++ b/app/src/main/res/anim/fade_in_lang.xml @@ -1,8 +1,8 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/anim/fade_out.xml b/app/src/main/res/anim/fade_out.xml index 31650b1d..97285671 100644 --- a/app/src/main/res/anim/fade_out.xml +++ b/app/src/main/res/anim/fade_out.xml @@ -1,7 +1,7 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/anim/fade_out_instant.xml b/app/src/main/res/anim/fade_out_instant.xml index 4a036dee..30852186 100644 --- a/app/src/main/res/anim/fade_out_instant.xml +++ b/app/src/main/res/anim/fade_out_instant.xml @@ -1,7 +1,7 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/anim/fade_out_lang.xml b/app/src/main/res/anim/fade_out_lang.xml index 2cf3f175..60fe9202 100644 --- a/app/src/main/res/anim/fade_out_lang.xml +++ b/app/src/main/res/anim/fade_out_lang.xml @@ -1,7 +1,7 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/anim/left_to_right.xml b/app/src/main/res/anim/left_to_right.xml index c238e872..bb23d0f6 100644 --- a/app/src/main/res/anim/left_to_right.xml +++ b/app/src/main/res/anim/left_to_right.xml @@ -1,15 +1,15 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/list_layout_controller.xml b/app/src/main/res/anim/list_layout_controller.xml index a96205c2..79c78841 100644 --- a/app/src/main/res/anim/list_layout_controller.xml +++ b/app/src/main/res/anim/list_layout_controller.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/anim/log_layout_controller.xml b/app/src/main/res/anim/log_layout_controller.xml index 7390c29d..50bd91b7 100644 --- a/app/src/main/res/anim/log_layout_controller.xml +++ b/app/src/main/res/anim/log_layout_controller.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/anim/popup_scale_in.xml b/app/src/main/res/anim/popup_scale_in.xml index 62fefe5b..01e6c99a 100644 --- a/app/src/main/res/anim/popup_scale_in.xml +++ b/app/src/main/res/anim/popup_scale_in.xml @@ -1,21 +1,21 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/popup_scale_out.xml b/app/src/main/res/anim/popup_scale_out.xml index c263dad2..f65b86bf 100644 --- a/app/src/main/res/anim/popup_scale_out.xml +++ b/app/src/main/res/anim/popup_scale_out.xml @@ -1,21 +1,21 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/push_anim_in.xml b/app/src/main/res/anim/push_anim_in.xml index 2ccb33fb..f9c8768e 100644 --- a/app/src/main/res/anim/push_anim_in.xml +++ b/app/src/main/res/anim/push_anim_in.xml @@ -1,8 +1,8 @@ - - - + + + \ No newline at end of file diff --git a/app/src/main/res/anim/push_anim_in_reverse.xml b/app/src/main/res/anim/push_anim_in_reverse.xml index 4554d2dd..d796f98d 100644 --- a/app/src/main/res/anim/push_anim_in_reverse.xml +++ b/app/src/main/res/anim/push_anim_in_reverse.xml @@ -1,11 +1,11 @@ - - - - + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/push_anim_out.xml b/app/src/main/res/anim/push_anim_out.xml index 1595e488..698f9e94 100644 --- a/app/src/main/res/anim/push_anim_out.xml +++ b/app/src/main/res/anim/push_anim_out.xml @@ -1,8 +1,8 @@ - - - + + + \ No newline at end of file diff --git a/app/src/main/res/anim/push_anim_out_reverse.xml b/app/src/main/res/anim/push_anim_out_reverse.xml index da509840..aea81c60 100644 --- a/app/src/main/res/anim/push_anim_out_reverse.xml +++ b/app/src/main/res/anim/push_anim_out_reverse.xml @@ -1,11 +1,11 @@ - - - - + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/slide_down.xml b/app/src/main/res/anim/slide_down.xml index dfe25770..bcdb6b22 100644 --- a/app/src/main/res/anim/slide_down.xml +++ b/app/src/main/res/anim/slide_down.xml @@ -1,9 +1,9 @@ - - - - + + + + \ No newline at end of file diff --git a/app/src/main/res/animator/scale_animator.xml b/app/src/main/res/animator/scale_animator.xml index 4021c9c8..370bd48e 100644 --- a/app/src/main/res/animator/scale_animator.xml +++ b/app/src/main/res/animator/scale_animator.xml @@ -1,6 +1,6 @@ - - + + diff --git a/app/src/main/res/custom-xml/alert/xml/ax_background_inverted.xml b/app/src/main/res/custom-xml/alert/xml/ax_background_inverted.xml index 654425ee..f7ad3d9a 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_background_inverted.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_background_inverted.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/alert/xml/ax_border_top.xml b/app/src/main/res/custom-xml/alert/xml/ax_border_top.xml index a657aecf..9fe04d9b 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_border_top.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_border_top.xml @@ -1,16 +1,16 @@ - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/alert/xml/ax_bottom_rounded_corner_left.xml b/app/src/main/res/custom-xml/alert/xml/ax_bottom_rounded_corner_left.xml index 7c8204ac..e0620e74 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_bottom_rounded_corner_left.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_bottom_rounded_corner_left.xml @@ -1,13 +1,13 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/alert/xml/ax_bottom_rounded_corner_right.xml b/app/src/main/res/custom-xml/alert/xml/ax_bottom_rounded_corner_right.xml index dd163480..94ce5f48 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_bottom_rounded_corner_right.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_bottom_rounded_corner_right.xml @@ -1,13 +1,13 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/alert/xml/ax_load_new_tab.xml b/app/src/main/res/custom-xml/alert/xml/ax_load_new_tab.xml index f96a98d5..e950dc78 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_load_new_tab.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_load_new_tab.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round.xml b/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round.xml index 111ed5e4..e8eecf84 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round.xml @@ -1,13 +1,13 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_bottom.xml b/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_bottom.xml index 2c2af2ce..4e184e51 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_bottom.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_bottom.xml @@ -1,13 +1,13 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_left.xml b/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_left.xml index 93f43199..87afddf3 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_left.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_left.xml @@ -1,13 +1,13 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_right.xml b/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_right.xml index e399ab35..efeff72c 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_right.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_right.xml @@ -1,13 +1,13 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/alert/xml/ax_shadow.xml b/app/src/main/res/custom-xml/alert/xml/ax_shadow.xml index 71f20127..0c4ba6ee 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_shadow.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_shadow.xml @@ -1,70 +1,70 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/bookmark/xml/bx_popup_input.xml b/app/src/main/res/custom-xml/bookmark/xml/bx_popup_input.xml index d2161712..618a7497 100644 --- a/app/src/main/res/custom-xml/bookmark/xml/bx_popup_input.xml +++ b/app/src/main/res/custom-xml/bookmark/xml/bx_popup_input.xml @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/bookmark/xml/bx_primary_gradient.xml b/app/src/main/res/custom-xml/bookmark/xml/bx_primary_gradient.xml index 7ea3d69c..38ea82fe 100644 --- a/app/src/main/res/custom-xml/bookmark/xml/bx_primary_gradient.xml +++ b/app/src/main/res/custom-xml/bookmark/xml/bx_primary_gradient.xml @@ -1,8 +1,8 @@ - - - - - + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/file_path.xml b/app/src/main/res/custom-xml/generic/xml/file_path.xml index 01038999..7289ccb2 100644 --- a/app/src/main/res/custom-xml/generic/xml/file_path.xml +++ b/app/src/main/res/custom-xml/generic/xml/file_path.xml @@ -1,4 +1,4 @@ - - - - + + + + diff --git a/app/src/main/res/custom-xml/generic/xml/gx_border_left.xml b/app/src/main/res/custom-xml/generic/xml/gx_border_left.xml index a65f9328..4580da51 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_border_left.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_border_left.xml @@ -1,13 +1,13 @@ - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_notification_shadow.xml b/app/src/main/res/custom-xml/generic/xml/gx_notification_shadow.xml index 1f9c3679..b859359b 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_notification_shadow.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_notification_shadow.xml @@ -1,17 +1,17 @@ - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_ripple_blue.xml b/app/src/main/res/custom-xml/generic/xml/gx_ripple_blue.xml index 72ae4dc1..85c3a380 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_ripple_blue.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_ripple_blue.xml @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_ripple_default_round.xml b/app/src/main/res/custom-xml/generic/xml/gx_ripple_default_round.xml index 29103274..8290ae44 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_ripple_default_round.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_ripple_default_round.xml @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_ripple_gray.xml b/app/src/main/res/custom-xml/generic/xml/gx_ripple_gray.xml index ef31b852..59457ad2 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_ripple_gray.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_ripple_gray.xml @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_ripple_gray_round_left.xml b/app/src/main/res/custom-xml/generic/xml/gx_ripple_gray_round_left.xml index 2770a0bd..a0b3a925 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_ripple_gray_round_left.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_ripple_gray_round_left.xml @@ -1,12 +1,12 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_ripple_light.xml b/app/src/main/res/custom-xml/generic/xml/gx_ripple_light.xml index 84ed06e8..bee0743d 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_ripple_light.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_ripple_light.xml @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_rounded_corner_alert.xml b/app/src/main/res/custom-xml/generic/xml/gx_rounded_corner_alert.xml index 2b54d45f..5498a02b 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_rounded_corner_alert.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_rounded_corner_alert.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/generic/xml/gx_side_item.xml b/app/src/main/res/custom-xml/generic/xml/gx_side_item.xml index 58185999..cd012424 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_side_item.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_side_item.xml @@ -1,14 +1,14 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/generic/xml/gx_side_item_bottom.xml b/app/src/main/res/custom-xml/generic/xml/gx_side_item_bottom.xml index 4debc24a..e8b5894e 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_side_item_bottom.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_side_item_bottom.xml @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/generic/xml/gx_side_item_popup.xml b/app/src/main/res/custom-xml/generic/xml/gx_side_item_popup.xml index 20206895..b7ddde6a 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_side_item_popup.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_side_item_popup.xml @@ -1,44 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/generic/xml/gx_side_item_suggestions.xml b/app/src/main/res/custom-xml/generic/xml/gx_side_item_suggestions.xml index 163654fc..c88416b0 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_side_item_suggestions.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_side_item_suggestions.xml @@ -1,23 +1,23 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/generic/xml/gx_side_item_top.xml b/app/src/main/res/custom-xml/generic/xml/gx_side_item_top.xml index b10097de..c9303fe6 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_side_item_top.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_side_item_top.xml @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/generic/xml/gx_side_menu.xml b/app/src/main/res/custom-xml/generic/xml/gx_side_menu.xml index 56d5f7fe..4b92902f 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_side_menu.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_side_menu.xml @@ -1,44 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml b/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml index f20cc028..72c50037 100644 --- a/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml +++ b/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml @@ -1,13 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/provider_paths.xml b/app/src/main/res/custom-xml/generic/xml/provider_paths.xml index 52e1785d..ae45ab61 100644 --- a/app/src/main/res/custom-xml/generic/xml/provider_paths.xml +++ b/app/src/main/res/custom-xml/generic/xml/provider_paths.xml @@ -1,9 +1,9 @@ - - - - + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/shortcuts.xml b/app/src/main/res/custom-xml/generic/xml/shortcuts.xml index 082e2006..accc0916 100644 --- a/app/src/main/res/custom-xml/generic/xml/shortcuts.xml +++ b/app/src/main/res/custom-xml/generic/xml/shortcuts.xml @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/history/xml/hx_circle_favicon.xml b/app/src/main/res/custom-xml/history/xml/hx_circle_favicon.xml index e573e69e..3eadf52e 100644 --- a/app/src/main/res/custom-xml/history/xml/hx_circle_favicon.xml +++ b/app/src/main/res/custom-xml/history/xml/hx_circle_favicon.xml @@ -1,11 +1,11 @@ - - - - - + + + + + diff --git a/app/src/main/res/custom-xml/history/xml/hx_menu_popup.xml b/app/src/main/res/custom-xml/history/xml/hx_menu_popup.xml index aea4f3c1..054abd88 100644 --- a/app/src/main/res/custom-xml/history/xml/hx_menu_popup.xml +++ b/app/src/main/res/custom-xml/history/xml/hx_menu_popup.xml @@ -1,50 +1,50 @@ - - - - - - - - - - - - - #000000 - 5 - 3 - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + #000000 + 5 + 3 + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/history/xml/hx_menu_popup_container.xml b/app/src/main/res/custom-xml/history/xml/hx_menu_popup_container.xml index 6351a6fc..1f1852ba 100644 --- a/app/src/main/res/custom-xml/history/xml/hx_menu_popup_container.xml +++ b/app/src/main/res/custom-xml/history/xml/hx_menu_popup_container.xml @@ -1,44 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/home/xml/file_provider_paths.xml b/app/src/main/res/custom-xml/home/xml/file_provider_paths.xml index 2183ff4b..0a78a851 100644 --- a/app/src/main/res/custom-xml/home/xml/file_provider_paths.xml +++ b/app/src/main/res/custom-xml/home/xml/file_provider_paths.xml @@ -1,12 +1,12 @@ - - - - - - + + + + + + diff --git a/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_bottom.xml b/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_bottom.xml index 90222cae..bd6fc42a 100644 --- a/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_bottom.xml +++ b/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_bottom.xml @@ -1,11 +1,11 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_bar.xml b/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_bar.xml index 925358a1..554ee646 100644 --- a/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_bar.xml +++ b/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_bar.xml @@ -1,15 +1,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_left.xml b/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_left.xml index 97d59405..b3b1cad2 100644 --- a/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_left.xml +++ b/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_left.xml @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_right.xml b/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_right.xml index 34ad1fd1..e0075c79 100644 --- a/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_right.xml +++ b/app/src/main/res/custom-xml/home/xml/gx_ripple_gray_top_right.xml @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/home/xml/hox_menu_button.xml b/app/src/main/res/custom-xml/home/xml/hox_menu_button.xml index f6d52c11..0166f12d 100644 --- a/app/src/main/res/custom-xml/home/xml/hox_menu_button.xml +++ b/app/src/main/res/custom-xml/home/xml/hox_menu_button.xml @@ -1,8 +1,8 @@ - - - - - + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/home/xml/hox_photon_progress.xml b/app/src/main/res/custom-xml/home/xml/hox_photon_progress.xml index 7a3caf8c..9673953e 100644 --- a/app/src/main/res/custom-xml/home/xml/hox_photon_progress.xml +++ b/app/src/main/res/custom-xml/home/xml/hox_photon_progress.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/home/xml/hox_round_outline.xml b/app/src/main/res/custom-xml/home/xml/hox_round_outline.xml index 38e6c5c0..14ab0569 100644 --- a/app/src/main/res/custom-xml/home/xml/hox_round_outline.xml +++ b/app/src/main/res/custom-xml/home/xml/hox_round_outline.xml @@ -1,5 +1,5 @@ - - - ... + + + ... \ No newline at end of file diff --git a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner.xml b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner.xml index ca8356ce..ebcd1433 100644 --- a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner.xml +++ b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_bottom.xml b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_bottom.xml index 1fb3b044..116df670 100644 --- a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_bottom.xml +++ b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_bottom.xml @@ -1,23 +1,23 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash.xml b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash.xml index 426be64b..06848c0e 100644 --- a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash.xml +++ b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash_no_ripple.xml b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash_no_ripple.xml index 9ede16a3..198e529c 100644 --- a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash_no_ripple.xml +++ b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash_no_ripple.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash_right.xml b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash_right.xml index 05379af8..dca2ed44 100644 --- a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash_right.xml +++ b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_splash_right.xml @@ -1,50 +1,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/home/xml/hx_border_left.xml b/app/src/main/res/custom-xml/home/xml/hx_border_left.xml index bcfe725c..98bf9340 100644 --- a/app/src/main/res/custom-xml/home/xml/hx_border_left.xml +++ b/app/src/main/res/custom-xml/home/xml/hx_border_left.xml @@ -1,10 +1,10 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/home/xml/hx_border_left_right.xml b/app/src/main/res/custom-xml/home/xml/hx_border_left_right.xml index 24ed8780..a1eea6f2 100644 --- a/app/src/main/res/custom-xml/home/xml/hx_border_left_right.xml +++ b/app/src/main/res/custom-xml/home/xml/hx_border_left_right.xml @@ -1,10 +1,10 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/home/xml/hx_ripple_default_round.xml b/app/src/main/res/custom-xml/home/xml/hx_ripple_default_round.xml index b513b5e4..779dab36 100644 --- a/app/src/main/res/custom-xml/home/xml/hx_ripple_default_round.xml +++ b/app/src/main/res/custom-xml/home/xml/hx_ripple_default_round.xml @@ -1,37 +1,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_arrow_back.xml b/app/src/main/res/custom-xml/images/xml/ic_arrow_back.xml index 2ec2011c..b4cad5ce 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_arrow_back.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_arrow_back.xml @@ -1,10 +1,10 @@ - - - + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_check.xml b/app/src/main/res/custom-xml/images/xml/ic_check.xml index 3c728c59..12e2a3fb 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_check.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_check.xml @@ -1,9 +1,9 @@ - - - + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_close.xml b/app/src/main/res/custom-xml/images/xml/ic_close.xml index ede4b710..20a88e1c 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_close.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_close.xml @@ -1,9 +1,9 @@ - - - + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_down_arrow.xml b/app/src/main/res/custom-xml/images/xml/ic_down_arrow.xml index ad33063c..b7c7d1d4 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_down_arrow.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_down_arrow.xml @@ -1,9 +1,9 @@ - - - + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_gear.xml b/app/src/main/res/custom-xml/images/xml/ic_gear.xml index 1397d370..b8b731d3 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_gear.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_gear.xml @@ -1,5 +1,5 @@ - - - + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_home.xml b/app/src/main/res/custom-xml/images/xml/ic_home.xml index 70fb2910..f96bcd78 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_home.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_home.xml @@ -1,9 +1,9 @@ - - - + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_refresh.xml b/app/src/main/res/custom-xml/images/xml/ic_refresh.xml index 8229a9a6..e67459cf 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_refresh.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_refresh.xml @@ -1,9 +1,9 @@ - - - + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_secondary_gradinet.xml b/app/src/main/res/custom-xml/images/xml/ic_secondary_gradinet.xml index 59187ce1..977a4c85 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_secondary_gradinet.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_secondary_gradinet.xml @@ -1,11 +1,11 @@ - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/images/xml/ic_shortcut_erase.xml b/app/src/main/res/custom-xml/images/xml/ic_shortcut_erase.xml index 6864e95a..5983cc21 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_shortcut_erase.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_shortcut_erase.xml @@ -1,17 +1,17 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/images/xml/ic_shortcut_newtab.xml b/app/src/main/res/custom-xml/images/xml/ic_shortcut_newtab.xml index d0e182b0..41b28ea4 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_shortcut_newtab.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_shortcut_newtab.xml @@ -1,17 +1,17 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/images/xml/ic_shortcut_open.xml b/app/src/main/res/custom-xml/images/xml/ic_shortcut_open.xml index f147e62c..fd8c33ad 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_shortcut_open.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_shortcut_open.xml @@ -1,17 +1,17 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/orbot/xml/ox_rounded_corner_warning.xml b/app/src/main/res/custom-xml/orbot/xml/ox_rounded_corner_warning.xml index bf1d639f..ffa8edd8 100644 --- a/app/src/main/res/custom-xml/orbot/xml/ox_rounded_corner_warning.xml +++ b/app/src/main/res/custom-xml/orbot/xml/ox_rounded_corner_warning.xml @@ -1,21 +1,21 @@ - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/orbot_log/xml/olx_rounded_corner_warning.xml b/app/src/main/res/custom-xml/orbot_log/xml/olx_rounded_corner_warning.xml index c3d5caf0..64e06486 100644 --- a/app/src/main/res/custom-xml/orbot_log/xml/olx_rounded_corner_warning.xml +++ b/app/src/main/res/custom-xml/orbot_log/xml/olx_rounded_corner_warning.xml @@ -1,21 +1,21 @@ - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/setting/xml/sx_border_left.xml b/app/src/main/res/custom-xml/setting/xml/sx_border_left.xml index caea498e..7807c26c 100644 --- a/app/src/main/res/custom-xml/setting/xml/sx_border_left.xml +++ b/app/src/main/res/custom-xml/setting/xml/sx_border_left.xml @@ -1,10 +1,10 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/setting/xml/sx_button_round.xml b/app/src/main/res/custom-xml/setting/xml/sx_button_round.xml index ed43521b..dee4711f 100644 --- a/app/src/main/res/custom-xml/setting/xml/sx_button_round.xml +++ b/app/src/main/res/custom-xml/setting/xml/sx_button_round.xml @@ -1,21 +1,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/setting/xml/sx_font_change_round_background.xml b/app/src/main/res/custom-xml/setting/xml/sx_font_change_round_background.xml index 47824208..950cbaba 100644 --- a/app/src/main/res/custom-xml/setting/xml/sx_font_change_round_background.xml +++ b/app/src/main/res/custom-xml/setting/xml/sx_font_change_round_background.xml @@ -1,15 +1,15 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/setting/xml/sx_seekbar_trail.xml b/app/src/main/res/custom-xml/setting/xml/sx_seekbar_trail.xml index 527edf49..546d0c99 100644 --- a/app/src/main/res/custom-xml/setting/xml/sx_seekbar_trail.xml +++ b/app/src/main/res/custom-xml/setting/xml/sx_seekbar_trail.xml @@ -1,8 +1,8 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/tab/xml/tx_border_image.xml b/app/src/main/res/custom-xml/tab/xml/tx_border_image.xml index 661bc274..a91deb76 100644 --- a/app/src/main/res/custom-xml/tab/xml/tx_border_image.xml +++ b/app/src/main/res/custom-xml/tab/xml/tx_border_image.xml @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/app/src/main/res/custom-xml/tab/xml/tx_border_image_dark.xml b/app/src/main/res/custom-xml/tab/xml/tx_border_image_dark.xml index 1ea9c193..24aba6e3 100644 --- a/app/src/main/res/custom-xml/tab/xml/tx_border_image_dark.xml +++ b/app/src/main/res/custom-xml/tab/xml/tx_border_image_dark.xml @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + diff --git a/app/src/main/res/custom-xml/tab/xml/tx_border_image_dark_no_corner.xml b/app/src/main/res/custom-xml/tab/xml/tx_border_image_dark_no_corner.xml index 5b9b4d00..8d8322be 100644 --- a/app/src/main/res/custom-xml/tab/xml/tx_border_image_dark_no_corner.xml +++ b/app/src/main/res/custom-xml/tab/xml/tx_border_image_dark_no_corner.xml @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + diff --git a/app/src/main/res/custom-xml/tab/xml/tx_border_round_geckoview.xml b/app/src/main/res/custom-xml/tab/xml/tx_border_round_geckoview.xml index f0ebe3cb..9d1f1464 100644 --- a/app/src/main/res/custom-xml/tab/xml/tx_border_round_geckoview.xml +++ b/app/src/main/res/custom-xml/tab/xml/tx_border_round_geckoview.xml @@ -1,7 +1,7 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/tab/xml/tx_ripple_light.xml b/app/src/main/res/custom-xml/tab/xml/tx_ripple_light.xml index 30e269bb..1aedbc4c 100644 --- a/app/src/main/res/custom-xml/tab/xml/tx_ripple_light.xml +++ b/app/src/main/res/custom-xml/tab/xml/tx_ripple_light.xml @@ -1,13 +1,13 @@ - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-anydpi-v24/ic_download.xml b/app/src/main/res/drawable-anydpi-v24/ic_download.xml index 9af8cb60..2c56e6a4 100644 --- a/app/src/main/res/drawable-anydpi-v24/ic_download.xml +++ b/app/src/main/res/drawable-anydpi-v24/ic_download.xml @@ -1,15 +1,15 @@ - - - - - + + + + + diff --git a/app/src/main/res/drawable-anydpi-v24/ic_download_complete.xml b/app/src/main/res/drawable-anydpi-v24/ic_download_complete.xml index 05091152..4360c6ba 100644 --- a/app/src/main/res/drawable-anydpi-v24/ic_download_complete.xml +++ b/app/src/main/res/drawable-anydpi-v24/ic_download_complete.xml @@ -1,15 +1,15 @@ - - - - - + + + + + diff --git a/app/src/main/res/drawable-anydpi-v24/notification_logo.xml b/app/src/main/res/drawable-anydpi-v24/notification_logo.xml index 2e56bcd1..a843c6c3 100644 --- a/app/src/main/res/drawable-anydpi-v24/notification_logo.xml +++ b/app/src/main/res/drawable-anydpi-v24/notification_logo.xml @@ -1,48 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_genesis_vector.xml b/app/src/main/res/drawable/ic_genesis_vector.xml index 916960fa..16b0d288 100644 --- a/app/src/main/res/drawable/ic_genesis_vector.xml +++ b/app/src/main/res/drawable/ic_genesis_vector.xml @@ -1,1962 +1,1962 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layouts/alert/layout/application_crash.xml b/app/src/main/res/layouts/alert/layout/application_crash.xml index 970ff2be..c0ab7321 100644 --- a/app/src/main/res/layouts/alert/layout/application_crash.xml +++ b/app/src/main/res/layouts/alert/layout/application_crash.xml @@ -1,97 +1,97 @@ - - - - - - - - - - - - - - - -