diff --git a/app/.gitignore b/app/.gitignore old mode 100644 new mode 100755 diff --git a/app/build.gradle b/app/build.gradle old mode 100644 new mode 100755 index 6cd44add..0800cee9 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,127 +1,145 @@ -apply plugin: 'com.android.application' -apply from: 'variables.gradle' - -apply plugin: 'maven' -apply plugin: 'io.fabric' - - -ext { - geckoviewChannel = project.ext.firefox_channel - geckoviewVersion = project.ext.firefox_version -} - -repositories { - maven { - url "https://maven.mozilla.org/maven2/" - maven { url 'https://maven.fabric.io/public' } - mavenLocal() - mavenCentral() - google() - jcenter() - } -} - - -android { - compileSdkVersion project.ext.compileSdkVersion - defaultConfig { - applicationId project.ext.applicationId - minSdkVersion project.ext.minSdkVersion - targetSdkVersion project.ext.targetSdkVersion - versionCode project.ext.versionCode - versionName project.ext.versionName - } - - flavorDimensions "abi" - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - - flavorDimensions project.ext.dimen - - productFlavors { - arm { - versionCode project.ext.arm_vcode - versionName project.ext.arm_vname - dimension project.ext.dimen - } - aarch64 { - versionCode project.ext.aarch_vcode - versionName project.ext.aarch_vname - dimension project.ext.dimen - } - x86 { - versionCode project.ext.x86_vcode - versionName project.ext.x86_vname - dimension project.ext.dimen - } - x86_64 { - versionCode project.ext.x64_vcode - versionName project.ext.x64_vname - dimension project.ext.dimen - } - } - - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - splits { - abi { - enable true - reset() - include 'arm64-v8a' - include 'x86' - include 'armeabi-v7a' - include 'x86_64' - - universalApk false - } - } - } -} -dependencies { - - /*Default Libraries*/ - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta2' - implementation 'cz.msebera.android:httpclient:4.5.8' - implementation 'androidx.appcompat:appcompat:1.1.0-rc01' - implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2' - implementation 'com.google.android.material:material:1.1.0-alpha09' - implementation 'androidx.preference:preference:1.1.0-rc01' - implementation 'com.android.support:design:28.0.0' - implementation 'com.android.support:appcompat-v7:28.0.0' - - /*Firefox ABI Splits*/ - x86Implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}" - x86_64Implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}" - armImplementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}" - aarch64Implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}" - - /*Alert Dialog*/ - implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0' - implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') { - transitive = true; - } - - /*Onion Proxy*/ - implementation 'com.github.jehy:Tor-Onion-Proxy-Library:0.0.7' - implementation 'org.slf4j:slf4j-api:2.0.0-alpha0' - implementation 'org.slf4j:slf4j-android:1.7.26' - - /*Ads Manager*/ - implementation 'com.google.android.gms:play-services-ads:18.1.1' - - /*Crashlytics*/ - implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' - implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') - -} - -apply plugin: 'com.android.application' +apply plugin: 'com.android.application' +apply from: 'variables.gradle' + +apply plugin: 'maven' +apply plugin: 'io.fabric' + +ext { + geckoviewChannel = project.ext.firefox_channel + geckoviewVersion = project.ext.firefox_version +} + +repositories { + maven { + url "https://maven.mozilla.org/maven2/" + maven { url 'https://maven.fabric.io/public' } + mavenLocal() + mavenCentral() + google() + jcenter() + } +} + +android { + compileSdkVersion 29 + buildToolsVersion '29.0.2' + defaultConfig { + applicationId project.ext.applicationId + minSdkVersion 21 + versionCode project.ext.versionCode + versionName project.ext.versionName + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + + multiDexEnabled true + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + dexOptions { + preDexLibraries true + } + + lintOptions { + lintConfig file("lint.xml") + } + + // We have a three dimensional build configuration: + // BUILD TYPE (debug, release) X PRODUCT FLAVOR (focus, klar) X ARCHITECTURE (x86, arm, aarch64) + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + splits { + abi { + enable true + reset() + include 'arm64-v8a' + include 'x86' + include 'armeabi-v7a' + include 'x86_64' + universalApk false + } + } + } + + flavorDimensions project.ext.dimen + + productFlavors { + arm { + versionCode project.ext.arm_vcode + versionName project.ext.arm_vname + dimension project.ext.dimen + } + aarch64 { + versionCode project.ext.aarch_vcode + versionName project.ext.aarch_vname + dimension project.ext.dimen + } + x86 { + versionCode project.ext.x86_vcode + versionName project.ext.x86_vname + dimension project.ext.dimen + } + x86_64 { + versionCode project.ext.x64_vcode + versionName project.ext.x64_vname + dimension project.ext.dimen + } + } + + + sourceSets { + test { + resources { + srcDir "${projectDir}/src/main/assets/" + } + } + + } + configurations.all { + resolutionStrategy.force 'com.android.support:support-v4:26.1.0' // the lib is old dependencies version; + } +} + +dependencies { + + /*Default Libraries*/ + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4' + implementation 'com.google.android.material:material:1.2.0-alpha03' + implementation 'androidx.preference:preference:1.1.0' + implementation 'com.google.android.material:material:1.0.0' + + /*Firefox ABI Splits*/ + implementation "org.mozilla.components:browser-engine-gecko:$mozilla_components_version" + implementation "org.mozilla.geckoview:geckoview:$gecko_nightly_version" + + /*Alert Dialog*/ + implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0' + + /*Ads Manager*/ + implementation 'com.google.android.gms:play-services-ads:18.3.0' + + + /*Crashlytics*/ + implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' + implementation 'com.flurry.android:analytics:12.1.0@aar' + + /*View Animator*/ + implementation 'com.daimajia.easing:library:2.1@aar' + implementation 'com.daimajia.androidanimations:library:2.3@aar' + + /*Orbot Service*/ + implementation project(path: ':orbotservice') + +} + +apply plugin: 'com.android.application' +apply plugin: 'com.google.gms.google-services' diff --git a/app/fabric.properties b/app/fabric.properties old mode 100644 new mode 100755 diff --git a/app/google-services.json b/app/google-services.json old mode 100644 new mode 100755 index d231eab7..cbfb677e --- a/app/google-services.json +++ b/app/google-services.json @@ -1,48 +1,40 @@ -{ - "project_info": { - "project_number": "891955481900", - "firebase_url": "https://genesis-app-a512d.firebaseio.com", - "project_id": "genesis-app-a512d", - "storage_bucket": "genesis-app-a512d.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:891955481900:android:360c1798435c303f", - "android_client_info": { - "package_name": "com.darkweb.genesissearchengine" - } - }, - "oauth_client": [ - { - "client_id": "891955481900-20ves4hv1nujrthcs2u75to1gn6c3v59.apps.googleusercontent.com", - "client_type": 1, - "android_info": { - "package_name": "com.darkweb.genesissearchengine", - "certificate_hash": "fc03dc31bd3710e568f8a20d1818adc49af8d139" - } - }, - { - "client_id": "891955481900-94h8etf05qautcg9ue2vfc4ct2oikr3e.apps.googleusercontent.com", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "AIzaSyCwvxQTaK8F6nevbWkL2t1TTEljQNZeKXc" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "891955481900-94h8etf05qautcg9ue2vfc4ct2oikr3e.apps.googleusercontent.com", - "client_type": 3 - } - ] - } - } - } - ], - "configuration_version": "1" +{ + "project_info": { + "project_number": "1026582312920", + "firebase_url": "https://genesis-5cc48.firebaseio.com", + "project_id": "genesis-5cc48", + "storage_bucket": "genesis-5cc48.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:1026582312920:android:056aacc3b6f0c3b3f164ad", + "android_client_info": { + "package_name": "com.darkweb.genesissearchengine" + } + }, + "oauth_client": [ + { + "client_id": "1026582312920-ciidt1n08e3fh9akdrn38ph6on2c7d95.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBMzD4SV_-2_2tG9E5a475k5OkwP9V-Naw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "1026582312920-ciidt1n08e3fh9akdrn38ph6on2c7d95.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" } \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro old mode 100644 new mode 100755 diff --git a/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt old mode 100644 new mode 100755 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml old mode 100644 new mode 100755 index 67dd580f..f199e6de --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,63 +1,131 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/assets/adServer.txt b/app/src/main/assets/adServer.txt new file mode 100755 index 00000000..800bbee3 --- /dev/null +++ b/app/src/main/assets/adServer.txt @@ -0,0 +1,2946 @@ +101com.com +101order.com +123found.com +123freeavatars.com +180hits.de +180searchassistant.com +207.net +247media.com +24log.com +24log.de +24pm-affiliation.com +2mdn.net +2o7.net +2znp09oa.com +33across.com +360yield.com +3lift.com +4affiliate.net +4d5.net +4info.com +4jnzhl0d0.com +50websads.com +518ad.com +51yes.com +5mcwl.pw +600z.com +6ldu6qa.com +777partner.com +77tracking.com +7bpeople.com +7search.com +82o9v830.com +99count.com +a-ads.com +a-counter.kiev.ua +a.aproductmsg.com +a.consumer.net +a.mktw.net +a.sakh.com +a.ucoz.net +a.ucoz.ru +a.xanga.com +a135.wftv.com +aaddzz.com +abacho.net +abackchain.com +abandonedaction.com +abandonedclover.com +abashedangle.com +abc-ads.com +aboardlevel.com +abruptroad.com +absentstream.com +absorbingband.com +absurdwater.com +abz.com +ac.rnm.ca +acridtwist.com +actionsplash.com +actualdeals.com +actuallysheep.com +actuallysnake.com +acuityads.com +acuityplatform.com +ad-balancer.at +ad-balancer.net +ad-center.com +ad-delivery.net +ad-pay.de +ad-rotator.com +ad-score.com +ad-server.gulasidorna.se +ad-serverparc.nl +ad-souk.com +ad-space.net +ad-tech.com +ad-up.com +ad.100.tbn.ru +ad.71i.de +ad.a8.net +ad.abcnews.com +ad.abctv.com +ad.aboutwebservices.com +ad.abum.com +ad.admitad.com +ad.allstar.cz +ad.altervista.org +ad.amgdgt.com +ad.anuntis.com +ad.auditude.com +ad.bizo.com +ad.bnmla.com +ad.bondage.com +ad.caradisiac.com +ad.centrum.cz +ad.cgi.cz +ad.choiceradio.com +ad.clix.pt +ad.cooks.com +ad.crwdcntrl.net +ad.digitallook.com +ad.doctissimo.fr +ad.domainfactory.de +ad.eurosport.com +ad.flurry.com +ad.foxnetworks.com +ad.freecity.de +ad.gate24.ch +ad.grafika.cz +ad.hbv.de +ad.hodomobile.com +ad.httpool.com +ad.hyena.cz +ad.iinfo.cz +ad.ilove.ch +ad.infoseek.com +ad.jamba.net +ad.jamster.co.uk +ad.jetsoftware.com +ad.keenspace.com +ad.leadbolt.net +ad.liveinternet.ru +ad.lupa.cz +ad.media-servers.net +ad.mediastorm.hu +ad.mgd.de +ad.musicmatch.com +ad.nachtagenten.de +ad.nozonedata.com +ad.nttnavi.co.jp +ad.nwt.cz +ad.pandora.tv +ad.period-calendar.com +ad.preferances.com +ad.profiwin.de +ad.prv.pl +ad.rambler.ru +ad.reunion.com +ad.sensismediasmart.com.au +ad.seznam.cz +ad.simgames.net +ad.slutload.com +ad.smartclip.net +ad.tbn.ru +ad.technoratimedia.com +ad.thewheelof.com +ad.turn.com +ad.tv2.no +ad.twitchguru.com +ad.usatoday.com +ad.virtual-nights.com +ad.wavu.hu +ad.way.cz +ad.weatherbug.com +ad.wsod.com +ad.wz.cz +ad.xrea.com +ad.yadro.ru +ad.yourmedia.com +ad.zanox.com +ad0.bigmir.net +ad01.mediacorpsingapore.com +ad1.emediate.dk +ad1.emule-project.org +ad1.kde.cz +ad1.pamedia.com.au +ad2.iinfo.cz +ad2.lupa.cz +ad2.xrea.com +ad2flash.com +ad3.iinfo.cz +ad3.pamedia.com.au +ad3.xrea.com +ad4game.com +ad4mat.com +ad4mat.de +ad4mat.net +adaction.de +adadvisor.net +adalliance.io +adap.tv +adapt.tv +adbard.net +adblade.com +adblockanalytics.com +adbooth.net +adbot.com +adbrite.com +adbrn.com +adbroker.de +adbunker.com +adbutler.com +adbuyer.com +adbuyer3.lycos.com +adcash.com +adcast.deviantart.com +adcell.de +adcenter.net +adcentriconline.com +adcept.net +adclick.com +adclient.uimserv.net +adclient1.tucows.com +adcomplete.com +adconion.com +adcontent.gamespy.com +adcycle.com +add.newmedia.cz +addfreestats.com +addme.com +adecn.com +ademails.com +adengage.com +adexchangegate.com +adexchangeprediction.com +adexpose.com +adext.inkclub.com +adf.ly +adfarm.mediaplex.com +adflight.com +adforce.com +adform.com +adform.net +adformdsp.net +adgardener.com +adgoto.com +adhaven.com +adhese.be +adhese.com +adhoc4.net +adimage.guardian.co.uk +adimages.been.com +adimages.carsoup.com +adimages.go.com +adimages.homestore.com +adimages.omroepzeeland.nl +adimages.sanomawsoy.fi +adimg.cnet.com +adimg.com.com +adimg.uimserv.net +adimg1.chosun.com +adimgs.sapo.pt +adimpact.com +adincube.com +adinjector.net +adinterax.com +adisfy.com +adition.com +adition.de +adition.net +adizio.com +adjix.com +adjug.com +adjuggler.com +adjuggler.yourdictionary.com +adjustnetwork.com +adk2.co +adk2.com +adk2ads.tictacti.com +adland.ru +adledge.com +adlegend.com +adlightning.com +adlog.com.com +adloox.com +adlooxtracking.com +adlure.net +adm.fwmrm.net +admagnet.net +admailtiser.com +adman.gr +adman.otenet.gr +admanagement.ch +admanager.btopenworld.com +admanager.carsoup.com +admantx.com +admarketplace.net +admarvel.com +admax.nexage.com +admedia.com +admeld.com +admerize.be +admeta.com +admex.com +adminder.com +adminshop.com +admized.com +admob.com +admonitor.com +admotion.com.ar +adnet.asahi.com +adnet.biz +adnet.de +adnet.ru +adnet.worldreviewer.com +adnetinteractive.com +adnetwork.net +adnetworkperformance.com +adnews.maddog2000.de +adnotch.com +adnxs.com +adocean.pl +adonspot.com +adorigin.com +adotmob.com +adpenguin.biz +adpepper.dk +adpepper.nl +adperium.com +adpia.vn +adplus.co.id +adplxmd.com +adprofile.net +adrazzi.com +adreactor.com +adreclaim.com +adrecover.com +adrecreate.com +adremedy.com +adreporting.com +adres.internet.com +adrevolver.com +adriver.ru +adrolays.de +adrotate.de +adrotator.se +adrotic.girlonthenet.com +adrta.com +ads-click.com +ads-trk.vidible.tv +ads.4tube.com +ads.5ci.lt +ads.abovetopsecret.com +ads.aceweb.net +ads.activestate.com +ads.adfox.ru +ads.administrator.de +ads.adshareware.net +ads.adstream.com.ro +ads.adultfriendfinder.com +ads.advance.net +ads.adverline.com +ads.affiliates-spinit.com +ads.affiliates.match.com +ads.allvatar.com +ads.alt.com +ads.amdmb.com +ads.amigos.com +ads.aol.co.uk +ads.apn.co.nz +ads.appsgeyser.com +ads.as4x.tmcs.net +ads.as4x.tmcs.ticketmaster.com +ads.asiafriendfinder.com +ads.ask.com +ads.aspalliance.com +ads.avazu.net +ads.batpmturner.com +ads.belointeractive.com +ads.berlinonline.de +ads.betanews.com +ads.betfair.com +ads.betfair.com.au +ads.bigchurch.com +ads.bigfoot.com +ads.bing.com +ads.bittorrent.com +ads.blog.com +ads.bloomberg.com +ads.bluelithium.com +ads.bluemountain.com +ads.bluesq.com +ads.bonniercorp.com +ads.boylesports.com +ads.brabys.com +ads.brazzers.com +ads.bumq.com +ads.businessweek.com +ads.canalblog.com +ads.canoe.ca +ads.casinocity.com +ads.casumoaffiliates.com +ads.cbc.ca +ads.cc +ads.cc-dt.com +ads.centraliprom.com +ads.channel4.com +ads.clearchannel.com +ads.co.com +ads.colombiaonline.com +ads.com.com +ads.comeon.com +ads.contactmusic.com +ads.contentabc.com +ads.contextweb.com +ads.crakmedia.com +ads.creative-serving.com +ads.creativematch.com +ads.cricbuzz.com +ads.cybersales.cz +ads.dada.it +ads.datingyes.com +ads.dazoot.ro +ads.deltha.hu +ads.dennisnet.co.uk +ads.desmoinesregister.com +ads.detelefoongids.nl +ads.deviantart.com +ads.digital-digest.com +ads.digitalmedianet.com +ads.digitalpoint.com +ads.directionsmag.com +ads.domain.com +ads.domeus.com +ads.eagletribune.com +ads.easy-forex.com +ads.economist.com +ads.edbindex.dk +ads.egrana.com.br +ads.elcarado.com +ads.electrocelt.com +ads.elitetrader.com +ads.emirates.net.ae +ads.epltalk.com +ads.eu.msn.com +ads.exactdrive.com +ads.expat-blog.biz +ads.factorymedia.com +ads.fairfax.com.au +ads.fasttrack-ignite.com +ads.faxo.com +ads.ferianc.com +ads.filmup.com +ads.financialcontent.com +ads.flooble.com +ads.fool.com +ads.footymad.net +ads.forbes.com +ads.forbes.net +ads.forium.de +ads.fortunecity.com +ads.fotosidan.se +ads.foxnetworks.com +ads.freecity.de +ads.friendfinder.com +ads.ft.com +ads.gamecity.net +ads.gamershell.com +ads.gamespyid.com +ads.gamigo.de +ads.gaming-universe.de +ads.gaming1.com +ads.gawker.com +ads.geekswithblogs.net +ads.getlucky.com +ads.glispa.com +ads.gmodules.com +ads.goyk.com +ads.gplusmedia.com +ads.gradfinder.com +ads.grindinggears.com +ads.gsm-exchange.com +ads.gsmexchange.com +ads.guardian.co.uk +ads.guardianunlimited.co.uk +ads.guru3d.com +ads.harpers.org +ads.harvard.edu +ads.hbv.de +ads.hearstmags.com +ads.heartlight.org +ads.heias.com +ads.hollywood.com +ads.horsehero.com +ads.horyzon-media.com +ads.ibest.com.br +ads.ibryte.com +ads.icq.com +ads.ign.com +ads.img.co.za +ads.imgur.com +ads.indiatimes.com +ads.infi.net +ads.internic.co.il +ads.ipowerweb.com +ads.isoftmarketing.com +ads.itv.com +ads.iwon.com +ads.jewishfriendfinder.com +ads.jiwire.com +ads.joaffs.com +ads.jobsite.co.uk +ads.jpost.com +ads.jubii.dk +ads.justhungry.com +ads.kabooaffiliates.com +ads.kaktuz.net +ads.kelbymediagroup.com +ads.kinobox.cz +ads.kinxxx.com +ads.kompass.com +ads.krawall.de +ads.lapalingo.com +ads.larryaffiliates.com +ads.leovegas.com +ads.lesbianpersonals.com +ads.linkedin.com +ads.linuxfoundation.org +ads.livenation.com +ads.lordlucky.com +ads.mariuana.it +ads.massinfra.nl +ads.mcafee.com +ads.mediaodyssey.com +ads.medienhaus.de +ads.mgnetwork.com +ads.miarroba.com +ads.mmania.com +ads.mobilautomaten.com +ads.mobilebet.com +ads.motor-forum.nl +ads.motormedia.nl +ads.msn.com +ads.multimania.lycos.fr +ads.nationalgeographic.com +ads.ncm.com +ads.ndtv1.com +ads.networksolutions.com +ads.newgrounds.com +ads.newmedia.cz +ads.newsint.co.uk +ads.newsquest.co.uk +ads.ninemsn.com.au +ads.nj.com +ads.nola.com +ads.nordichardware.com +ads.nordichardware.se +ads.nwsource.com +ads.nyi.net +ads.nytimes.com +ads.nyx.cz +ads.nzcity.co.nz +ads.o2.pl +ads.oddschecker.com +ads.okcimg.com +ads.ole.com +ads.olivebrandresponse.com +ads.oneplace.com +ads.optusnet.com.au +ads.outpersonals.com +ads.passion.com +ads.pennet.com +ads.phpclasses.org +ads.planet.nl +ads.pni.com +ads.pof.com +ads.powweb.com +ads.primissima.it +ads.printscr.com +ads.prisacom.com +ads.program3.com +ads.programattik.com +ads.psd2html.com +ads.pushplay.com +ads.quasaraffiliates.com +ads.quoka.de +ads.rcs.it +ads.recoletos.es +ads.rediff.com +ads.redlightcenter.com +ads.redtube.com +ads.resoom.de +ads.satyamonline.com +ads.saymedia.com +ads.scifi.com +ads.seniorfriendfinder.com +ads.servebom.com +ads.sexinyourcity.com +ads.shizmoo.com +ads.shopstyle.com +ads.sift.co.uk +ads.silverdisc.co.uk +ads.smartclick.com +ads.socialtheater.com +ads.soft32.com +ads.space.com +ads.sptimes.com +ads.stackoverflow.com +ads.sun.com +ads.suomiautomaatti.com +ads.supplyframe.com +ads.tahono.com +ads.techtv.com +ads.themovienation.com +ads.thestar.com +ads.thrillsaffiliates.com +ads.tmcs.net +ads.toplayaffiliates.com +ads.totallyfreestuff.com +ads.townhall.com +ads.trinitymirror.co.uk +ads.tripod.com +ads.tripod.lycos.co.uk +ads.tripod.lycos.de +ads.tripod.lycos.es +ads.tripod.lycos.it +ads.tripod.lycos.nl +ads.tso.dennisnet.co.uk +ads.twitter.com +ads.uknetguide.co.uk +ads.ultimate-guitar.com +ads.uncrate.com +ads.undertone.com +ads.usatoday.com +ads.verticalresponse.com +ads.vgchartz.com +ads.videosz.com +ads.viksaffiliates.com +ads.virtual-nights.com +ads.vnumedia.com +ads.waps.cn +ads.wapx.cn +ads.watson.ch +ads.weather.ca +ads.web.aol.com +ads.web.cs.com +ads.web.de +ads.webmasterpoint.org +ads.websiteservices.com +ads.whoishostingthis.com +ads.wiezoekje.nl +ads.wikia.nocookie.net +ads.wineenthusiast.com +ads.wwe.biz +ads.xhamster.com +ads.xtra.co.nz +ads.xtribeapp.com +ads.y-0.net +ads.yahoo.com +ads.yap.yahoo.com +ads.yimg.com +ads.yldmgrimg.net +ads.yourfreedvds.com +ads.youtube.com +ads.zdnet.com +ads.ztod.com +ads03.redtube.com +ads1.canoe.ca +ads1.mediacapital.pt +ads1.msn.com +ads1.rne.com +ads1.virtual-nights.com +ads10.speedbit.com +ads180.com +ads2.brazzers.com +ads2.clearchannel.com +ads2.contentabc.com +ads2.gamecity.net +ads2.jubii.dk +ads2.net-communities.co.uk +ads2.oneplace.com +ads2.rne.com +ads2.virtual-nights.com +ads2.xnet.cz +ads2004.treiberupdate.de +ads3.contentabc.com +ads3.gamecity.net +ads3.virtual-nights.com +ads4.clearchannel.com +ads4.gamecity.net +ads4.virtual-nights.com +ads4homes.com +ads5.canoe.ca +ads5.virtual-nights.com +ads6.gamecity.net +ads7.gamecity.net +ads8.com +adsafeprotected.com +adsatt.abc.starwave.com +Adsatt.ABCNews.starwave.com +adsatt.espn.go.com +adsatt.espn.starwave.com +Adsatt.go.starwave.com +adsby.bidtheatre.com +adscale.de +adscholar.com +adscience.nl +adscpm.com +adsdaq.com +adsend.de +adsensecustomsearchads.com +adserv.gamezone.de +adserve.ams.rhythmxchange.com +adserver.43plc.com +adserver.71i.de +adserver.adultfriendfinder.com +adserver.aidameter.com +adserver.aol.fr +adserver.betandwin.de +adserver.bing.com +adserver.bizhat.com +adserver.break-even.it +adserver.cams.com +adserver.com +adserver.digitoday.com +adserver.flossiemediagroup.com +adserver.freecity.de +adserver.friendfinder.com +adserver.hardsextube.com +adserver.hardwareanalysis.com +adserver.html.it +adserver.hwupgrade.it +adserver.irishwebmasterforum.com +adserver.janes.com +adserver.libero.it +adserver.news.com.au +adserver.nydailynews.com +adserver.o2.pl +adserver.oddschecker.com +adserver.omroepzeeland.nl +adserver.pl +adserver.portalofevil.com +adserver.portugalmail.net +adserver.portugalmail.pt +adserver.pressboard.ca +adserver.sanomawsoy.fi +adserver.sciflicks.com +adserver.sharewareonline.com +adserver.spankaway.com +adserver.theonering.net +adserver.twitpic.com +adserver.viagogo.com +adserver.virginmedia.com +adserver.yahoo.com +adserver01.de +adserver1-images.backbeatmedia.com +adserver1.backbeatmedia.com +adserver1.mindshare.de +adserver1.ogilvy-interactive.de +adserver2.mindshare.de +adserverplus.com +adserverpub.com +adserversolutions.com +adserving.unibet.com +adservinginternational.com +adsfac.eu +adsfac.net +adsfac.us +adside.com +adsk2.co +adskeeper.co.uk +adsklick.de +adsmarket.com +adsmart.com +adsmart.net +adsmogo.com +adsnative.com +adsoftware.com +adsoldier.com +adspeed.net +adspirit.de +adsponse.de +adsrevenue.net +adsrv.deviantart.com +adsrv.eacdn.com +adsrv.iol.co.za +adsrvr.org +adsstat.com +adstage.io +adstat.4u.pl +adstest.weather.com +adsupply.com +adswizz.com +adsymptotic.com +adsynergy.com +adsys.townnews.com +adsystem.simplemachines.org +adtech.de +adtechjp.com +adtechus.com +adtegrity.net +adthis.com +adthrive.com +adtiger.de +adtoll.com +adtology.com +adtoma.com +adtrace.org +adtrade.net +adtrak.net +adtriplex.com +adultadvertising.com +adv-adserver.com +adv-banner.libero.it +adv.cooperhosting.net +adv.freeonline.it +adv.hwupgrade.it +adv.livedoor.com +adv.nexthardware.com +adv.webmd.com +adv.wp.pl +adv.yo.cz +advariant.com +adventory.com +advert.bayarea.com +advert.dyna.ultraweb.hu +adverticum.com +adverticum.net +adverticus.de +advertise.com +advertiseireland.com +advertisementafterthought.com +advertiserurl.com +advertisespace.com +advertisingbanners.com +advertisingbox.com +advertisingtag.net +advertmarket.com +advertmedia.de +advertpro.sitepoint.com +advertpro.ya.com +advertserve.com +advertstream.com +advertwizard.com +advfromnwl.com +advideo.uimserv.net +adview.ppro.de +advisormedia.cz +adviva.net +advnt.com +adwhirl.com +adwitserver.com +adworldnetwork.com +adworx.at +adworx.be +adworx.nl +adx.allstar.cz +adx.atnext.com +adxpansion.com +adxpose.com +adxprts.com +adxvalue.com +adyea.com +adz2you.com +adzbazar.com +adzerk.net +adzerk.s3.amazonaws.com +adzones.com +af-ad.co.uk +affbuzzads.com +affec.tv +affili.net +affiliate.1800flowers.com +affiliate.doubleyourdating.com +affiliate.dtiserv.com +affiliate.gamestop.com +affiliate.mercola.com +affiliate.mogs.com +affiliate.offgamers.com +affiliate.travelnow.com +affiliate.treated.com +affiliate.viator.com +affiliatefuel.com +affiliatefuture.com +affiliates.allposters.com +affiliates.babylon.com +affiliates.digitalriver.com +affiliates.globat.com +affiliates.internationaljock.com +affiliates.rozetka.com.ua +affiliates.streamray.com +affiliates.thinkhost.net +affiliates.thrixxx.com +affiliates.ultrahosting.com +affiliatetracking.com +affiliatetracking.net +affiliatewindow.com +affiliation-france.com +affrh2014.com +affrh2022.com +afftracking.justanswer.com +afterview.ru +agkn.com +agreeableprice.com +agreeablestew.com +agreemand.com +ah-ha.com +ahalogy.com +aheadday.com +aidu-ads.de +aim4media.com +aistat.net +ak0gsh40.com +aktrack.pubmatic.com +alclick.com +alenty.com +alert.com.mt +alexa-sitestats.s3.amazonaws.com +alexametrics.com +alipromo.com +all4spy.com +allosponsor.com +alphonso.tv +amazingcounters.com +amazon-adsystem.com +ambiguousquilt.com +ambitiousagreement.com +americash.com +amplitude.com +amung.us +anahtars.com +analytics.adpost.org +analytics.google.com +analytics.live.com +analytics.newsinc.com +analytics.yahoo.com +anm.intelli-direct.com +annonser.dagbladet.no +anrdoezrs.net +anxiousapples.com +apathetictheory.com +api.intensifier.de +apolloprogram.io +app-analytics.snapchat.com +app.pendo.io +appsflyer.com +aps.hearstnp.com +apture.com +apusx.com +aquaticowl.com +ar1nvz5.com +arc1.msn.com +archswimming.com +ard.xxxblackbook.com +are-ter.com +area51-ts.com +argyresthia.com +aromamirror.com +as.webmd.com +as1.advfn.com +assets1.exgfnetwork.com +assoc-amazon.com +aswpapius.com +at-adserver.alltop.com +atdmt.com +athena-ads.wikia.com +attractiveafternoon.com +attributiontracker.com +atwola.com +auctionads.com +auctionads.net +audience2media.com +audienceinsights.com +audit.median.hu +audit.webinform.hu +augur.io +auto-bannertausch.de +autohits.dk +automaticflock.com +avenuea.com +avocet.io +avpa.javalobby.org +avsads.com +awempire.com +awin1.com +awzbijw.com +axiomaticalley.com +b-1st.com +b59812ee54afcabd.com +ba.afl.rakuten.co.jp +babs.tv2.dk +backbeatmedia.com +balancebreath.com +balloontexture.com +banik.redigy.cz +banner-exchange-24.de +banner.ad.nu +banner.ambercoastcasino.com +banner.buempliz-online.ch +banner.casino.net +banner.casinodelrio.com +banner.cotedazurpalace.com +banner.coza.com +banner.cz +banner.easyspace.com +banner.elisa.net +banner.eurogrand.com +banner.goldenpalace.com +banner.img.co.za +banner.inyourpocket.com +banner.kiev.ua +banner.linux.se +banner.media-system.de +banner.mindshare.de +banner.nixnet.cz +banner.noblepoker.com +banner.northsky.com +banner.orb.net +banner.penguin.cz +banner.rbc.ru +banner.relcom.ru +banner.tanto.de +banner.titan-dsl.de +banner.vadian.net +banner.webmersion.com +banner.wirenode.com +bannerads.de +bannerboxes.com +bannercommunity.de +bannerconnect.com +bannerconnect.net +bannerexchange.cjb.net +bannerflow.com +bannergrabber.internet.gr +bannerhost.com +bannerimage.com +bannerlandia.com.ar +bannermall.com +bannermarkt.nl +bannerpower.com +banners.adultfriendfinder.com +banners.amigos.com +banners.asiafriendfinder.com +banners.babylon-x.com +banners.bol.com.br +banners.cams.com +banners.clubseventeen.com +banners.czi.cz +banners.dine.com +banners.direction-x.com +banners.directnic.com +banners.freett.com +banners.friendfinder.com +banners.getiton.com +banners.iq.pl +banners.isoftmarketing.com +banners.linkbuddies.com +banners.passion.com +banners.resultonline.com +banners.sexsearch.com +banners.sys-con.com +banners.thomsonlocal.com +banners.videosz.com +banners.virtuagirlhd.com +banners.wunderground.com +bannerserver.com +bannersgomlm.com +bannershotlink.perfectgonzo.com +bannersng.yell.com +bannerspace.com +bannerswap.com +bannertesting.com +bannery.cz +bannieres.acces-contenu.com +bans.adserver.co.il +bans.bride.ru +barbarousnerve.com +barnesandnoble.bfast.com +basebanner.com +baskettexture.com +bat.bing.com +batbuilding.com +bawdybeast.com +baypops.com +bbelements.com +bbn.img.com.ua +beacon.gu-web.net +beamincrease.com +beamkite.com +bebi.com +bedsbreath.com +begun.ru +behavioralengine.com +belstat.com +belstat.nl +berp.com +best-top.ro +bestboundary.com +bestsearch.net +bewilderedblade.com +bhcumsc.com +bidclix.com +bidclix.net +bidr.io +bidswitch.net +bidvertiser.com +bigbangmedia.com +bigclicks.com +billboard.cz +bitads.net +bitmedianetwork.com +bizad.nikkeibp.co.jp +bizographics.com +bizrate.com +blast4traffic.com +blingbucks.com +blockadblock.com +blogads.com +blogcounter.de +blogherads.com +blogtoplist.se +blogtopsites.com +blueadvertise.com +bluekai.com +bluelithium.com +bluewhaleweb.com +blushingbeast.com +blushingboundary.com +bm.annonce.cz +bn.bfast.com +boersego-ads.de +boilingbeetle.com +boilingumbrella.com +bombora.com +boomads.com +boost-my-pr.de +boredcrown.com +boringcoat.com +boudja.com +bounceexchange.com +box.anchorfree.net +bpath.com +braincash.com +branch.io +brand-display.com +brandreachsys.com +brassrule.com +bridgetrack.com +brightinfo.com +british-banners.com +broadboundary.com +broadcastbed.com +broaddoor.com +bs.yandex.ru +btez8.xyz +bttrack.com +bucketbean.com +budsinc.com +bullseye.backbeatmedia.com +businessbells.com +bustlinganimal.com +buysellads.com +buzzonclick.com +bwp.download.com +c.bigmir.net +c1.nowlinux.com +c1exchange.com +calculatingcircle.com +calculatingtoothbrush.com +calculatorcamera.com +callousbrake.com +calmfoot.com +campaign.bharatmatrimony.com +caniamedia.com +capablecows.com +captainbicycle.com +carambo.la +carbonads.com +carbonads.net +casalemedia.com +casalmedia.com +cash4members.com +cash4popup.de +cashcrate.com +cashengines.com +cashfiesta.com +cashpartner.com +casinopays.com +casinorewards.com +casinotraffic.com +cbanners.virtuagirlhd.com +cbsi.com +cdn.freefarcy.com +cdn.onesignal.com +cdn.segment.com +cecash.com +centerpointmedia.com +ceskydomov.alias.ngs.modry.cz +cetrk.com +cgicounter.puretec.de +chairscrack.com +chameleon.ad +channel1vids.com +channelintelligence.com +chardwardse.club +chart.dk +chartbeat.com +chartbeat.net +checkm8.com +checkstat.nl +cheerfulrange.com +cherrythread.com +chewcoat.com +chickensstation.com +chiefcurrent.com +chinsnakes.com +chitika.net +christingel.com +cityads.telus.net +cj.com +cjbmanagement.com +cjlog.com +claria.com +class-act-clicks.com +clearcomb.com +clevernt.com +click.fool.com +click.kmindex.ru +click2freemoney.com +clickability.com +clickadz.com +clickagents.com +clickbank.com +clickbooth.com +clickboothlnk.com +clickbrokers.com +clickcompare.co.uk +clickdensity.com +clickedyclick.com +clickhereforcellphones.com +clickhouse.com +clickhype.com +clicklink.jp +clickonometrics.pl +clicks.equantum.com +clicks.mods.de +clickserve.cc-dt.com +clicksor.com +clicktag.de +clickthruserver.com +clickthrutraffic.com +clicktrace.info +clicktrack.ziyu.net +clicktracks.com +clicktrade.com +clickwith.bid +clickxchange.com +clickz.com +clicmanager.fr +clientmetrics-pa.googleapis.com +clikerz.net +cliksolution.com +clixgalore.com +clk1005.com +clk1011.com +clk1015.com +clkrev.com +clksite.com +cloisteredhydrant.com +cloudcoins.biz +clrstm.com +cluster.adultworld.com +clustrmaps.com +cml.sad.ukrd.com +cnomy.com +cnt.spbland.ru +cnt1.pocitadlo.cz +code-server.biz +cognitiv.ai +coin-hive.com +coinhive.com +cointraffic.io +colonize.com +comclick.com +comfortablecheese.com +commandwalk.com +commindo-media-ressourcen.de +commissionmonster.com +commonswing.com +compactbanner.com +completecabbage.com +complextoad.com +comprabanner.it +concernedcondition.com +concernrain.com +confirmed-profits.com +connatix.com +connextra.com +consciouscabbage.com +consciouschairs.com +consensad.com +contadores.miarroba.com +contaxe.de +content.acc-hd.de +content.ad +contextweb.com +converge-digital.com +conversantmedia.com +conversionbet.com +conversionruler.com +convrse.media +cookies.cmpnet.com +coordinatedcub.com +cooster.ru +copperchickens.com +copycarpenter.com +copyrightaccesscontrols.com +coremetrics.com +count.rbc.ru +count.rin.ru +count.west263.com +counted.com +counter.bloke.com +counter.cnw.cz +counter.cz +counter.dreamhost.com +counter.fateback.com +counter.mirohost.net +counter.mojgorod.ru +counter.nowlinux.com +counter.rambler.ru +counter.search.bg +counter.snackly.co +counter.sparklit.com +counter.yadro.ru +counters.honesty.com +counting.kmindex.ru +counts.tucows.com +coupling-media.de +cp.abbp1.pw +cpalead.com +cpays.com +cpmstar.com +cpx.to +cpxinteractive.com +cqcounter.com +crabbychin.com +crakmedia.com +craktraffic.com +crawlability.com +crawlclocks.com +crazyegg.com +crazypopups.com +creafi-online-media.com +creatives.as4x.tmcs.net +creatives.livejasmin.com +credishe.com +criteo.com +critictruck.com +croissed.info +crowdgravity.com +crownclam.com +crtv.mate1.com +crwdcntrl.net +ctnetwork.hu +cubics.com +culturedcrayon.com +cumbersomecloud.com +curtaincows.com +customad.cnn.com +cutecushion.com +cuteturkey.com +cxense.com +cyberbounty.com +d.adroll.com +d2cmedia.ca +dakic-ia-300.com +damdoor.com +danban.com +dancemistake.com +dapper.net +dashingdirt.com +dashingsweater.com +data.namesakeoscilloscopemarquis.com +dbbsrv.com +dc-storm.com +de17a.com +deadpantruck.com +dealdotcom.com +debonairway.com +debtbusterloans.com +decisivedrawer.com +decisiveducks.com +decknetwork.net +decoycreation.com +deepintent.com +defectivesun.com +delegatediscussion.com +delightdriving.com +deloo.de +deloton.com +demandbase.com +demdex.net +deployads.com +desertedbreath.com +desertedrat.com +detailedglue.com +detailedgovernment.com +detectdiscovery.com +di1.shopping.com +dialerporn.com +dianomi.com +didtheyreadit.com +differentdesk.com +digital-ads.s3.amazonaws.com +digitalmerkat.com +direct-xxx-access.com +directaclick.com +directivepub.com +directleads.com +directorym.com +directtrack.com +discountclick.com +discreetfield.com +dispensablestranger.com +displayadsmedia.com +disqusads.com +dist.belnk.com +dk4ywix.com +dmtracker.com +dmtracking.alibaba.com +dmtracking2.alibaba.com +dnads.directnic.com +docksalmon.com +domaining.in +domainsponsor.com +domainsteam.de +domdex.com +doubleclick.com +doubleclick.de +doubleclick.net +doublepimp.com +doubtfulrainstorm.com +downloadr.xyz +dq95d35.com +drabsize.com +dragzebra.com +drumcash.com +drydrum.com +dsp.io +dstillery.com +dynamic.fmpub.net +dyntrk.com +e-adimages.scrippsnetworks.com +e-bannerx.com +e-debtconsolidation.com +e-m.fr +e-n-t-e-r-n-e-x.com +e-planning.net +e.kde.cz +eadexchange.com +earthquakescarf.com +earthycopy.com +eas.almamedia.fi +easyhits4u.com +ebayadvertising.com +ebocornac.com +ebuzzing.com +ecircle-ag.com +eclick.vn +eclkmpbn.com +eclkspbn.com +economicpizzas.com +ecoupons.com +edaa.eu +edgeio.com +effectivemeasure.com +effectivemeasure.net +efficaciouscactus.com +eiv.baidu.com +ejyymghi.com +elasticchange.com +elderlyscissors.com +elderlytown.com +elephantqueue.com +elitedollars.com +elitetoplist.com +elthamely.com +emarketer.com +emediate.dk +emediate.eu +emerse.com +emetriq.de +encouragingwilderness.com +endurableshop.com +engine.espace.netavenir.com +enginenetwork.com +enquisite.com +ensighten.com +entercasino.com +enthusiasticdad.com +entrecard.s3.amazonaws.com +enviousthread.com +eqads.com +erne.co +ero-advertising.com +errortablet.com +estat.com +etahub.com +etargetnet.com +etracker.de +eu-adcenter.net +eu1.madsone.com +eurekster.com +euros4click.de +eusta.de +eventbeacon.ca +everesttech.net +evergage.com +evyy.net +ewebcounter.com +exchange-it.com +exchange.bg +exchangead.com +exchangeclicksonline.com +exclusivebrass.com +exelator.com +exit76.com +exitexchange.com +exitfuel.com +exoclick.com +exogripper.com +exosrv.com +experianmarketingservices.digital +experteerads.com +exponea.com +exponential.com +express-submit.de +extreme-dm.com +extremetracking.com +eyeblaster.com +eyeota.net +eyereturn.com +eyeviewads.com +eyewonder.com +ezula.com +f5biz.com +facilitategrandfather.com +fadedprofit.com +familiarfloor.com +famousquarter.com +fanaticalfly.com +farethief.com +farmergoldfish.com +fascinatedfeather.com +fastclick.com +fastclick.com.edgesuite.net +fastclick.net +faultycanvas.com +faultyfowl.com +fc.webmasterpro.de +feebleshock.com +feedbackresearch.com +feefo.com +ffxcam.fairfax.com.au +fimserve.com +findcommerce.com +findepended.com +findyourcasino.com +first.nova.cz +firstlightera.com +flakyfeast.com +flashtalking.com +flavordecision.com +fleshlightcash.com +flexbanner.com +flimsycircle.com +floodprincipal.com +flowgo.com +flurry.com +foamybox.com +foo.cosmocode.de +foresee.com +forex-affiliate.net +fourarithmetic.com +fpctraffic.com +fpctraffic2.com +fqtag.com +frailoffer.com +free-banners.com +freebanner.com +freelogs.com +freeonlineusers.com +freepay.com +freeskreen.com +freestats.com +freestats.tv +freewebcounter.com +freshmarketer.com +frightenedpotato.com +frtyj.com +fullstory.com +functionalclam.com +functionalcrown.com +funklicks.com +funpageexchange.com +fusionads.net +fusionquest.com +futuristicapparatus.com +futuristicfairies.com +fuzzyflavor.com +fuzzyweather.com +fxstyle.net +ga.clearbit.com +ga87z2o.com +galaxien.com +game-advertising-online.com +gamehouse.com +gamesites100.net +gamesites200.com +gammamaximum.com +gbanners.hornymatches.com +geo.digitalpoint.com +geobanner.adultfriendfinder.com +geovisite.com +getclicky.com +getwisdom.io +giddycoat.com +globalismedia.com +globaltakeoff.net +globe7.com +globus-inter.com +glossysense.com +gmads.net +go-clicks.de +go-rank.de +go2affise.com +goingplatinum.com +goldstats.com +gondolagnome.com +google-analytics.com +googleadservices.com +googlesyndication.com +gorgeousground.com +gossipmiser.com +gostats.com +gp.dejanews.com +gracefulsock.com +grandioseguide.com +grapeshot.co.uk +graph.instagram.com +greetzebra.com +greyinstrument.com +greystripe.com +gtop100.com +guardedgovernor.com +guardedschool.com +gunggo.com +h78xb.pw +hammerhearing.com +handyfield.com +hardtofindmilk.com +harrenmedia.com +harrenmedianetwork.com +havamedia.net +heap.com +heapanalytics.com +heias.com +hellobar.com +hentaicounter.com +herbalaffiliateprogram.com +hexusads.fluent.ltd.uk +heyos.com +hfc195b.com +hgads.com +hidden.gogoceleb.com +highfalutinroom.com +hightrafficads.com +hilariouszinc.com +hilltopads.net +histats.com +historicalrequest.com +hit-parade.com +hit.bg +hit.ua +hit.webcentre.lycos.co.uk +hitbox.com +hitcounters.miarroba.com +hitfarm.com +hitiz.com +hitlist.ru +hitlounge.com +hitometer.com +hits.europuls.eu +hits.informer.com +hits.puls.lv +hits.theguardian.com +hits4me.com +hitslink.com +hittail.com +hollandbusinessadvertising.nl +hollowshake.com +homepageking.de +honeygoldfish.com +hostedads.realitykings.com +hotjar.com +hotkeys.com +hotlog.ru +hotrank.com.tw +hoverowl.com +hs-analytics.net +htmlhubing.xyz +httpool.com +hurricanedigitalmedia.com +hurtteeth.com +hydramedia.com +hyperbanner.net +hypertracker.com +hystericalhelp.com +i-clicks.net +i.xx.openx.com +i1img.com +i1media.no +ia.iinfo.cz +iad.anm.co.uk +iadnet.com +iasds01.com +icptrack.com +identads.com +idtargeting.com +ientrymail.com +iesnare.com +ifa.tube8live.com +ilbanner.com +ilead.itrack.it +illfatedsnail.com +illustriousoatmeal.com +imageads.canoe.ca +imagecash.net +images-pw.secureserver.net +imarketservices.com +img.prohardver.hu +imgpromo.easyrencontre.com +immensehoney.com +imonitor.nethost.cz +importedincrease.com +impossibleexpansion.com +imprese.cz +impressionmedia.cz +impressionz.co.uk +impulsehands.com +imrworldwide.com +inaccused.com +inboxdollars.com +incentaclick.com +inclk.com +incognitosearches.com +incrediblesugar.com +indexstats.com +indexww.com +indieclick.com +industrybrains.com +inetlog.ru +infinite-ads.com +infinityads.com +infolinks.com +information.com +inmobi.com +innocentwax.com +innovid.com +inquisitiveinvention.com +inringtone.com +insightexpress.com +insightexpressai.com +inspectlet.com +inspectorclick.com +install.365-stream.com +instantmadness.com +instinctiveads.com +instrumentsponge.com +intelliads.com +intellitxt.com +intentmedia.com +intentmedia.net +interactive.forthnet.gr +intergi.com +internetfuel.com +interreklame.de +interstat.hu +inventionpassenger.com +inviterabbits.com +invitesugar.com +ioam.de +ip.ro +ip193.cn +iperceptions.com +ipredictive.com +ipro.com +iqm.com +ireklama.cz +itfarm.com +itop.cz +its-that-easy.com +itsptp.com +ivwbox.de +ivykiosk.com +j93557g.com +jadeitite.com +jaizouji.com +jcount.com +jinkads.de +joetec.net +js.users.51.la +jsecoin.com +juicyads.com +jumptap.com +justicejudo.com +justpremium.com +justrelevant.com +k.iinfo.cz +kanoodle.com +kargo.com +karisimbi.net +karonty.com +keymedia.hu +keywee.co +kindads.com +kissmetrics.com +kliks.nl +kmpiframe.keepmeposted.com.mt +knifeoctopus.com +kniverto.com +knorex.com +komoona.com +kompasads.com +kontera.com +ktu.sv2.biz +lakequincy.com +laughablecopper.com +laughcloth.com +launchbit.com +layer-ad.de +layer-ads.de +lbn.ru +lead-analytics.nl +leadboltads.net +leadclick.com +leadingedgecash.com +leadplace.fr +leadzupc.com +leaplunchroom.com +lettucelimit.com +levelrate.de +lfstmedia.com +liadm.com +liftdna.com +ligatus.com +ligatus.de +lightcushion.com +lightspeedcash.com +lijit.com +limpingline.com +link-booster.de +link4ads.com +linkadd.de +linkbuddies.com +linkexchange.com +linkprice.com +linkrain.com +linkreferral.com +links-ranking.de +linkshighway.com +linkstorms.com +linkswaper.com +linktarget.com +liquidad.narrowcastmedia.com +liveadexchanger.com +liveintent.com +liverail.com +lizardslaugh.com +lkqd.com +loading321.com +log.btopenworld.com +log.logrocket.io +logger.snackly.co +logs.roku.com +logua.com +longinglettuce.com +lop.com +lopsidedspoon.com +loudloss.com +loudlunch.com +lp3tdqle.com +lucidmedia.com +lucklayed.info +lumpyleaf.com +lwfjd.today +lytics.io +lzjl.com +m.trb.com +m1.webstats4u.com +m32.media +m4n.nl +m6r.eu +mackeeperapp.mackeeper.com +madclient.uimserv.net +madisonavenue.com +mads.cnet.com +madvertise.de +magnificentmist.com +marchex.com +markedcrayon.com +markedpail.com +market-buster.com +marketing.888.com +marketing.hearstmagazines.nl +marketing.nyi.net +marketing.osijek031.com +marketingsolutions.yahoo.com +marketo.com +mas.sector.sk +matchcraft.com +matheranalytics.com +mathtag.com +max.i12.de +maximumcash.com +maxonclick.com +mbs.megaroticlive.com +mbuyu.nl +mdotm.com +measuremap.com +media-adrunner.mycomputer.com +media-servers.net +media.ftv-publicite.fr +media.funpic.de +media.net +media6degrees.com +mediaarea.eu +mediabridge.cc +mediacharger.com +mediageneral.com +mediaiqdigital.com +mediamath.com +mediamgr.ugo.com +mediaplazza.com +mediaplex.com +mediascale.de +mediaserver.bwinpartypartners.it +mediatext.com +mediatrking.com +mediavine.com +mediavoice.com +mediax.angloinfo.com +mediaz.angloinfo.com +medleyads.com +medyanetads.com +megacash.de +megastats.com +megawerbung.de +mellowads.com +memorizeneck.com +memorycobweb.com +messagenovice.com +metaffiliation.com +metanetwork.com +methodcash.com +metrics.cnn.com +metrics.consumerreports.org +metrics.ctv.ca +metrics.foxnews.com +metrics.govexec.com +metrics.windowsitpro.com +metrilo.com +mfadsrvr.com +mg2connext.com +mgid.com +microstatic.pl +microticker.com +militaryverse.com +minormeeting.com +misstrends.com +mixedreading.com +mixpanel.com +mixtraffic.com +mjxads.internet.com +ml314.com +mlm.de +mmismm.com +mmstat.com +mmtro.com +moatads.com +moatpixel.com +mobclix.com +mobileiconnect.com +modifyeyes.com +moggattice.com +moldyicicle.com +monetate.net +moneyexpert.co.uk +monsterpops.com +mookie1.com +mopub.com +mouseflow.com +mousestats.com +mowfruit.com +mpstat.us +mr-rank.de +mrskincash.com +mstrlytcs.com +mtrcs.samba.tv +mtree.com +musiccounter.ru +muwmedia.com +mxptint.net +myaffiliateprogram.com +mybestmv.com +mybloglog.com +mybuys.com +mycounter.ua +mydas.mobi +mylink-today.com +mymoneymakingapp.com +mypagerank.net +mypagerank.ru +mypowermall.com +mystat-in.net +mystat.pl +mysteriousmonth.com +mytop-in.net +myvisualiq.net +mzbcdn.net +n69.com +naganoadigei.com +naj.sk +nastydollars.com +nativeroll.tv +navegg.com +navigator.io +navrcholu.cz +nbjmp.com +ncaudienceexchange.com +ndnops.com +ndparking.com +nedstat.com +nedstat.nl +nedstatbasic.net +nedstatpro.net +neighborlywatch.com +nend.net +neocounter.neoworx-blog-tools.net +neoffic.com +nervoussummer.com +net-filter.com +netaffiliation.com +netagent.cz +netclickstats.com +netcommunities.com +netdirect.nl +netincap.com +netmng.com +netpool.netbookia.net +netshelter.net +neudesicmediagroup.com +newads.bangbros.com +newbie.com +newnet.qsrch.com +newnudecash.com +newopenx.detik.com +newstarads.com +newt1.adultadworld.com +newt1.adultworld.com +newtopsites.com +nexage.com +ng3.ads.warnerbros.com +nitratory.com +nitroclicks.com +noiselessplough.com +nondescriptcrowd.com +nondescriptsmile.com +nondescriptstocking.com +novem.pl +ns1p.net +ntv.io +ntvk1.ru +nugg.ad +nuggad.net +numax.nu-1.com +nuseek.com +nuttyorganization.com +nzaza.com +o0bc.com +oas.benchmark.fr +oas.foxnews.com +oas.repubblica.it +oas.roanoke.com +oas.toronto.com +oas.uniontrib.com +oas.villagevoice.com +oascentral.businessweek.com +oascentral.chicagobusiness.com +oascentral.fortunecity.com +oascentral.register.com +obscenesidewalk.com +observantice.com +oclasrv.com +oewa.at +offerforge.com +offermatica.com +olivebrandresponse.com +omniscientspark.com +omniture.com +omtrdc.net +onaudience.com +onclasrv.com +onclickads.net +oneandonlynetwork.com +onenetworkdirect.com +onestat.com +onestatfree.com +online-metrix.net +online.miarroba.com +onlinecash.com +onlinecashmethod.com +onlinerewardcenter.com +onscroll.com +onthe.io +open.oneplus.net +openad.tf1.fr +openad.travelnow.com +openads.friendfinder.com +openads.org +opentag-stats.qubit.com +openx.angelsgroup.org.uk +openx.blindferret.com +operationkettle.com +opienetwork.com +optimallimit.com +optimize-stats.voxmedia.com +optimizely.com +optimost.com +optmd.com +optmstr.com +optnmstr.com +ordingly.com +ota.cartrawler.com +otto-images.developershed.com +outbrain.com +overture.com +owebmoney.ru +owlsr.us +owneriq.net +oxado.com +oxcash.com +oxen.hillcountrytexas.com +pagead.l.google.com +pagefair.com +pagefair.net +pagerank-ranking.de +pagerank-submitter.de +pagerank4you.com +pageranktop.com +paleleaf.com +paradoxfactor.com +parchedangle.com +parketsy.pro +parsely.com +parsimoniouspolice.com +partner-ads.com +partner.pelikan.cz +partnerad.l.google.com +partnercash.de +partners.priceline.com +passion-4.net +pay-ads.com +paycounter.com +paypopup.com +payserve.com +pbnet.ru +pbterra.com +pcash.imlive.com +peacepowder.com +peep-auktion.de +peer39.com +pennyweb.com +pepperjamnetwork.com +perceivequarter.com +percentmobile.com +perfectaudience.com +perfiliate.com +performancerevenue.com +performancerevenues.com +performancing.com +permutive.com +personagraph.com +petiteumbrella.com +pgl.example0101 +pgmediaserve.com +pgpartner.com +pheedo.com +phoenix-adrunner.mycomputer.com +photographpan.com +phpadsnew.new.natuurpark.nl +phpmyvisites.net +picadmedia.com +piet2eix3l.com +pietexture.com +pimproll.com +ping.ublock.org +pippio.com +piquantpigs.com +pixel.adsafeprotected.com +pixel.condenastdigital.com +pixel.digitru.st +pixel.sojern.com +pixel.watch +play4traffic.com +playhaven.com +playmobileads.com +plista.com +plugrush.com +pointroll.com +popads.net +popflawlessads.com +popmyads.com +popub.com +popunder.ru +popup.msn.com +popupmoney.com +popupnation.com +popups.infostart.com +popuptraffic.com +porngraph.com +porntrack.com +possessivebucket.com +possibleboats.com +postrelease.com +potenza.cz +pr-star.de +practicetoothpaste.com +praddpro.de +prchecker.info +precisioncounter.com +predictad.com +premium-offers.com +presetrabbits.com +previousplayground.com +previouspotato.com +primaryads.com +primetime.net +privatecash.com +prmtracking.com +pro-advertising.com +producer.getwisdom.io +proext.com +profero.com +profitrumour.com +programattik.com +projectwonderful.com +promo.badoink.com +promo.ulust.com +promobenef.com +promos.bwin.it +promos.fling.com +promote.pair.com +promotion-campaigns.com +pronetadvertising.com +propellerads.com +props.id +proton-tm.com +protraffic.com +provexia.com +provideplant.com +prsitecheck.com +ps7894.com +pub.chez.com +pub.club-internet.fr +pub.hardware.fr +pub.realmedia.fr +pubdirecte.com +publicidad.elmundo.es +publicidees.com +pubmatic.com +pubs.lemonde.fr +puffyloss.com +puffypull.com +puffypurpose.com +pushazer.com +pushengage.com +puzzlingfall.com +px.dynamicyield.com +q.azcentral.com +qctop.com +qnsr.com +quacksquirrel.com +quaintcan.com +qualtrics.com +quantcast.com +quantcast.mgr.consensu.org +quantserve.com +quantummetric.com +quarterbean.com +quarterserver.de +questaffiliates.net +quicksandear.com +quietknowledge.com +quinst.com +quisma.com +quizzicalzephyr.com +r.scoota.co +radar.cedexis.com +radarurl.com +radiate.com +railwayrainstorm.com +rampidads.com +rank-master.com +rankchamp.de +ranking-charts.de +ranking-hits.de +ranking-id.de +ranking-links.de +ranking-liste.de +rankingchart.de +rankingscout.com +rankyou.com +rapidcounter.com +rapidkittens.com +raresummer.com +rate.ru +ratings.lycos.com +rb1.design.ru +re-directme.com +reachjunction.com +reactx.com +readgoldfish.com +readingguilt.com +readingopera.com +readserver.net +readymoon.com +realcastmedia.com +realclever.com +realclix.com +realmedia-a800.d4p.net +realtechnetwork.com +realtracker.com +rebelsubway.com +receptiveink.com +receptivereaction.com +record.affiliates.karjalakasino.com +record.bonniergaming.com +record.mrwin.com +redirectvoluum.com +reduxmedia.com +referralware.com +referrer.disqus.com +reflectivereward.com +regnow.com +reinvigorate.net +reklam.rfsl.se +reklama.mironet.cz +reklama.reflektor.cz +reklamcsere.hu +reklame.unwired-i.net +reklamer.com.ua +relevanz10.de +relmaxtop.com +remarketingpixel.com +remistrainew.club +remotead.cnet.com +remox.com +republika.onet.pl +resolutekey.com +resonantbrush.com +resonate.com +retargeter.com +revcontent.com +revenue.net +revenuedirect.com +revenuehits.com +revsci.net +revstats.com +richmails.com +richmedia.yimg.com +richstring.com +richwebmaster.com +rightstats.com +ringsrecord.com +ritzykey.com +ritzysponge.com +rlcdn.com +rle.ru +rmads.msn.com +rmedia.boston.com +roar.com +robotreplay.com +rockabox.co +roia.biz +rok.com.com +rose.ixbt.com +rotabanner.com +roughroll.com +roxr.net +rta.dailymail.co.uk +rtbpop.com +rtbpopd.com +rtmark.net +ru-traffic.com +ru4.com +rubiconproject.com +rulerabbit.com +runads.com +rundsp.com +ruthlessrobin.com +s.adroll.com +s2d6.com +sageanalyst.net +sail-horizon.com +samsungacr.com +samsungads.com +saysidewalk.com +sbx.pagesjaunes.fr +sc-analytics.appspot.com +scambiobanner.aruba.it +scanscout.com +scarcesign.com +scarcestream.com +scatteredheat.com +scintillatingscissors.com +scintillatingspace.com +scopelight.com +scorecardresearch.com +scratch2cash.com +screechingfurniture.com +scripte-monster.de +scrubsky.com +scrubswim.com +seadform.net +searchmarketing.com +searchramp.com +secretivecub.com +secretspiders.com +secure.webconnect.net +sedoparking.com +sedotracker.com +selectionsugar.com +selectivesummer.com +sendmepixel.com +sensismediasmart.com.au +separatesilver.com +serv0.com +servedby-buysellads.com +servedbyadbutler.com +servedbyopenx.com +servethis.com +services.hearstmags.com +serving-sys.com +sessioncam.com +sexcounter.com +sexinyourcity.com +sexlist.com +sextracker.com +shakesea.com +shakesuggestion.com +shakytaste.com +shallowsmile.com +shareadspace.com +shareasale.com +sharepointads.com +sharethrough.com +sharppatch.com +shelterstraw.com +sher.index.hu +shermore.info +shinystat.com +shinystat.it +shiveringsail.com +shoppingads.com +sicksmash.com +sidebar.angelfire.com +silkysquirrel.com +sillyscrew.com +similarsabine.com +simpli.fi +simplisticnose.com +sincerebuffalo.com +sincerespy.com +sinefight-skinesia.com +sinoa.com +sitedataprocessing.com +siteimproveanalytics.com +sitemeter.com +sitestat.com +sixscissors.com +sixsigmatraffic.com +sizesidewalk.com +sizmek.com +skimresources.com +skylink.vn +sleepcartoon.com +slipperysack.com +slopeaota.com +smart.brvaffs.com +smart4ads.com +smartadserver.com +smartlook.com +smashsurprise.com +smetrics.ctv.ca +smetrics.walgreens.com +smilingwaves.com +snakesort.com +snapads.com +sneakystamp.com +snoobi.com +socialspark.com +softclick.com.br +sombersea.com +sombersquirrel.com +sombersurprise.com +somniture.stuff.co.nz +sonobi.com +sortable.com +spacash.com +sparkstudios.com +specially4u.net +specificmedia.co.uk +specificpop.com +spectacularsnail.com +speedomizer.com +speedshiftmedia.com +spezialreporte.de +spidersboats.com +spiffymachine.com +spinbox.techtracker.com +spinbox.versiontracker.com +spirebaboon.com +sponsorads.de +sponsorpro.de +sponsors.thoughtsmedia.com +spot.fitness.com +spottysense.com +spotxchange.com +springaftermath.com +spurioussteam.com +spykemediatrack.com +spylog.com +spywarelabs.com +spywords.com +squeamishscarecrow.com +squirrelhands.com +srwww1.com +stackadapt.com +stakingscrew.com +stakingslope.com +standingnest.com +starffa.com +start.freeze.com +stat.cliche.se +stat.dealtime.com +stat.dyna.ultraweb.hu +stat.pl +stat.webmedia.pl +stat.zenon.net +stat24.com +stat24.meta.ua +statcounter.com +static.fmpub.net +static.itrack.it +staticads.btopenworld.com +statistik-gallup.net +statm.the-adult-company.com +stats.blogger.com +stats.directnic.com +stats.hyperinzerce.cz +stats.merriam-webster.com +stats.mirrorfootball.co.uk +stats.olark.com +stats.pusher.com +stats.self.com +stats.townnews.com +stats.unwired-i.net +stats.wordpress.com +stats.x14.eu +stats2.self.com +stats4all.com +statsie.com +statxpress.com +steadfastsound.com +steadfastsystem.com +steelhouse.com +steelhousemedia.com +stickssheep.com +stickyadstv.com +storesurprise.com +stormyachiever.com +stormysponge.com +storygize.net +stoveseashore.com +straightnest.com +straightschool.com +stripedburst.com +strivesidewalk.com +structurerod.com +stupendoussleet.com +subscribe.hearstmags.com +succeedscene.com +suddensidewalk.com +sugarcurtain.com +sugoicounter.com +sulkybutter.com +summerobject.com +sumo.com +sumome.com +superclix.de +superficialsink.com +superstats.com +supertop.ru +supertop100.com +surfmusik-adserver.de +swan-swan-goose.com +swimslope.com +swordfishdc.com +swordgoose.com +t.insigit.com +taboola.com +tagular.com +tailsweep.com +tailsweep.se +takru.com +talentedsteel.com +tangerinenet.biz +tangibleteam.com +tapad.com +tapfiliate.com +tapinfluence.com +targad.de +targetingnow.com +targetnet.com +targetpoint.com +tastefulsongs.com +tatsumi-sys.jp +tawdryson.com +tcads.net +tdxio.com +teads.tv +tealeaf.com +tealiumiq.com +techclicks.net +tedioustooth.com +teenrevenue.com +teenyvolcano.com +teethfan.com +teliad.de +temelio.com +tendertest.com +terriblethumb.com +terribleturkey.com +text-link-ads.com +textad.sexsearch.com +textads.biz +textlinks.com +tfag.de +theadex.com +theadhost.com +theads.me +thebugs.ws +therapistla.com +therichkids.com +thinkablerice.com +thirdrespect.com +thirstytwig.com +threechurch.com +throattrees.com +throtle.io +thruport.com +tia.timeinc.net +ticklesign.com +tidaltv.com +tinybar.com +tlvmedia.com +tnkexchange.com +tns-counter.ru +tntclix.co.uk +toecircle.com +toothbrushnote.com +top-casting-termine.de +top-site-list.com +top.list.ru +top.mail.ru +top.proext.com +top100-images.rambler.ru +top100.mafia.ru +top123.ro +top20free.com +top90.ro +topbarh.box.sk +topbucks.com +topforall.com +topgamesites.net +toplist.cz +toplist.pornhost.com +toplista.mw.hu +toplistcity.com +topping.com.ua +toprebates.com +topsafelist.net +topsir.com +topsite.lv +topsites.com.br +topstats.com +totemcash.com +touchclarity.com +touchclarity.natwest.com +tour.brazzers.com +tpnads.com +tracedesire.com +track.adform.net +track.anchorfree.com +track.contently.com +track.flexlinks.com +track.flexlinkspro.com +track.gawker.com +track.viewdeos.com +track1.viewdeos.com +trackalyzer.com +trackedlink.net +trackedweb.net +tracker-pm2.spilleren.com +tracker.icerocket.com +tracker.marinsm.com +tracker.trackerfix.com +tracking.crunchiemedia.com +tracking.gajmp.com +tracking.ibxlink.com +tracking.internetstores.de +tracking101.com +trackingsoft.com +trackmysales.com +tradeadexchange.com +tradedoubler.com +traffic-exchange.com +traffic.focuusing.com +trafficfactory.biz +trafficholder.com +traffichunt.com +trafficjunky.net +trafficleader.com +trafficsecrets.com +trafficspaces.net +trafficstrategies.com +trafficswarm.com +traffictrader.net +trafficz.com +trafficz.net +traffiq.com +trafic.ro +traktrafficflow.com +tranquilside.com +travis.bosscasinos.com +trekdata.com +tremendoustime.com +trendcounter.com +trendmd.com +tribalfusion.com +trickycelery.com +tritetongue.com +trix.net +trmit.com +truckstomatoes.com +truehits.net +truehits1.gits.net.th +truehits2.gits.net.th +tsyndicate.com +tubemogul.com +turboadv.com +turn.com +tvmtracker.com +twittad.com +twyn.com +tynt.com +typicalteeth.com +tyroo.com +uarating.com +ukbanners.com +ultimateclixx.com +ultramercial.com +ultraoranges.com +unarmedindustry.com +undertone.com +unknowntray.com +unrulymedia.com +untd.com +untidyquestion.com +unusualtitle.com +unwrittenspot.com +urlcash.net +us.a1.yimg.com +usapromotravel.com +useriq.com +userreplay.com +userreplay.net +utils.mediageneral.net +uttermosthobbies.com +v1.cnzz.com +validclick.com +valuead.com +valueclick.com +valueclickmedia.com +valuecommerce.com +valuesponsor.com +vanfireworks.com +variablefitness.com +veille-referencement.com +ventivmedia.com +verblife-3.co +vericlick.com +vertadnet.com +verticalmass.com +veruta.com +vervewireless.com +vibrantmedia.com +video-stats.video.google.com +videoadex.com +videoamp.com +videoegg.com +vidora.com +view4cash.de +visiblemeasures.com +visistat.com +visit.webhosting.yahoo.com +visitbox.de +visitpath.com +visual-pagerank.fr +visualrevenue.com +vmmpxl.com +voicefive.com +voicevegetable.com +volvelle.tech +vpon.com +vrs.cz +vs.tucows.com +vtracy.de +vungle.com +w55c.net +wa.and.co.uk +warlog.ru +waryfog.com +watchingthat.com +wateryvan.com +wdads.sx.atl.publicus.com +web-stat.com +web.informer.com +web2.deja.com +webads.co.nz +webads.nl +webangel.ru +webcash.nl +webcounter.cz +webcounter.goweb.de +webgains.com +webmaster-partnerprogramme24.de +webmasterplan.com +webmasterplan.de +weborama.com +weborama.fr +webpower.com +webseoanalytics.com +websponsors.com +webstat.channel4.com +webstat.com +webstat.net +webstats4u.com +webtrackerplus.com +webtracky.com +webtraffic.se +webtraxx.de +webtrends.telegraph.co.uk +webtrendslive.com +wellmadefrog.com +werbung.meteoxpress.com +wetrack.it +whaleads.com +whenu.com +whirlwealth.com +whiskyqueue.com +whispa.com +whisperingcrib.com +whoisonline.net +wholesaletraffic.info +widdit.com +widespace.com +widget.privy.com +widgetbucks.com +wikia-ads.wikia.com +window.nixnet.cz +wintricksbanner.googlepages.com +wirecomic.com +wisepops.com +witch-counter.de +wlmarketing.com +womanear.com +wonderlandads.com +wondoads.de +woopra.com +worldwide-cash.net +worriednumber.com +worrybutter.com +wpnrtnmrewunrtok.xyz +wryfinger.com +wt-eu02.net +wtlive.com +www-banner.chat.ru +www-google-analytics.l.google.com +www.dnps.com +www.kaplanindex.com +www.money4exit.de +www.photo-ads.co.uk +www8.glam.com +wwwpromoter.com +x-traceur.com +x6.yakiuchi.com +xchange.ro +xclicks.net +xertive.com +xg4ken.com +xiti.com +xovq5nemr.com +xplusone.com +xponsor.com +xq1.net +xtendmedia.com +xtremetop100.com +xxxcounter.com +xxxmyself.com +y.ibsys.com +yab-adimages.s3.amazonaws.com +yadro.ru +yepads.com +yesads.com +yesadvertising.com +yieldads.com +yieldlab.net +yieldmanager.com +yieldmanager.net +yieldmo.com +yieldtraffic.com +yldbt.com +ymetrica1.com +yoggrt.com +z5x.net +zangocash.com +zanox-affiliate.de +zanox.com +zantracker.com +zbwp6ghm.com +zealousfield.com +zedo.com +zemanta.com +zencudo.co.uk +zenkreka.com +zenzuu.com +zeus.developershed.com +zeusclicks.com +zlp6s.pw +zm232.com +zmedia.com +zqtk.net +zy16eoat1w.com \ No newline at end of file diff --git a/app/src/main/assets/error.html b/app/src/main/assets/error.html new file mode 100755 index 00000000..a29f5596 --- /dev/null +++ b/app/src/main/assets/error.html @@ -0,0 +1,36 @@ + + + + $TITLE + + + + + +
+

This site can't be reached

+

An error occurred during a connection

+

$ERROR

+ +
    +
  • The page you are trying to view cannot be shown because the authenticity of the received data could not be verified
  • +
  • The page is currently not live or down due to some reason
  • +
  • Please contact the website owners to inform them of this problem.
  • +
+ + +
+ + \ No newline at end of file diff --git a/app/src/main/assets/gpl.html b/app/src/main/assets/gpl.html new file mode 100644 index 00000000..551979e8 --- /dev/null +++ b/app/src/main/assets/gpl.html @@ -0,0 +1,713 @@ + + + + + + + + GNU General Public License 3.0 + + + + + + + +

GNU General Public License 3.0

+ +
Version 3, 29 June 2007
+
+Copyright © 2007 Free Software Foundation, Inc.
+<http://fsf.org/>
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+ +

Preamble

+ +

The GNU General Public License is a free, copyleft license for +software and other kinds of works.

+ +

The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too.

+ +

When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things.

+ +

To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others.

+ +

For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights.

+ +

Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it.

+ +

For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions.

+ +

Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users.

+ +

Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free.

+ +

The precise terms and conditions for copying, distribution and +modification follow.

+ +

TERMS AND CONDITIONS

+ +

0. Definitions.

+ +

“This License” refers to version 3 of the GNU General Public License.

+ +

“Copyright” also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks.

+ +

“The Program” refers to any copyrightable work licensed under this +License. Each licensee is addressed as “you”. “Licensees” and +“recipients” may be individuals or organizations.

+ +

To “modify” a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a “modified version” of the +earlier work or a work “based on” the earlier work.

+ +

A “covered work” means either the unmodified Program or a work based +on the Program.

+ +

To “propagate” a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well.

+ +

To “convey” a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying.

+ +

An interactive user interface displays “Appropriate Legal Notices” +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion.

+ +

1. Source Code.

+ +

The “source code” for a work means the preferred form of the work +for making modifications to it. “Object code” means any non-source +form of a work.

+ +

A “Standard Interface” means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language.

+ +

The “System Libraries” of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +“Major Component”, in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it.

+ +

The “Corresponding Source” for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work.

+ +

The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source.

+ +

The Corresponding Source for a work in source code form is that +same work.

+ +

2. Basic Permissions.

+ +

All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law.

+ +

You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you.

+ +

Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary.

+ +

3. Protecting Users' Legal Rights From Anti-Circumvention Law.

+ +

No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures.

+ +

When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures.

+ +

4. Conveying Verbatim Copies.

+ +

You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program.

+ +

You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee.

+ +

5. Conveying Modified Source Versions.

+ +

You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions:

+ +
    +
  • a) The work must carry prominent notices stating that you modified + it, and giving a relevant date.
  • + +
  • b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + “keep intact all notices”.
  • + +
  • c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it.
  • + +
  • d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so.
  • +
+ +

A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +“aggregate” if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate.

+ +

6. Conveying Non-Source Forms.

+ +

You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways:

+ +
    +
  • a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange.
  • + +
  • b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge.
  • + +
  • c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b.
  • + +
  • d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements.
  • + +
  • e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d.
  • +
+ +

A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work.

+ +

A “User Product” is either (1) a “consumer product”, which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, “normally used” refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product.

+ +

“Installation Information” for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made.

+ +

If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM).

+ +

The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network.

+ +

Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying.

+ +

7. Additional Terms.

+ +

“Additional permissions” are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions.

+ +

When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission.

+ +

Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms:

+ +
    +
  • a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or
  • + +
  • b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or
  • + +
  • c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or
  • + +
  • d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or
  • + +
  • e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or
  • + +
  • f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors.
  • +
+ +

All other non-permissive additional terms are considered “further +restrictions” within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying.

+ +

If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms.

+ +

Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way.

+ +

8. Termination.

+ +

You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11).

+ +

However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation.

+ +

Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice.

+ +

Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10.

+ +

9. Acceptance Not Required for Having Copies.

+ +

You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so.

+ +

10. Automatic Licensing of Downstream Recipients.

+ +

Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License.

+ +

An “entity transaction” is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts.

+ +

You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it.

+ +

11. Patents.

+ +

A “contributor” is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's “contributor version”.

+ +

A contributor's “essential patent claims” are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, “control” includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License.

+ +

Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version.

+ +

In the following three paragraphs, a “patent license” is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To “grant” such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party.

+ +

If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. “Knowingly relying” means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid.

+ +

If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it.

+ +

A patent license is “discriminatory” if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007.

+ +

Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law.

+ +

12. No Surrender of Others' Freedom.

+ +

If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program.

+ +

13. Use with the GNU Affero General Public License.

+ +

Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such.

+ +

14. Revised Versions of this License.

+ +

The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns.

+ +

Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License “or any later version” applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation.

+ +

If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program.

+ +

Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version.

+ +

15. Disclaimer of Warranty.

+ +

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

+ +

16. Limitation of Liability.

+ +

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES.

+ +

17. Interpretation of Sections 15 and 16.

+ +

If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee.

+ +

END OF TERMS AND CONDITIONS

+ +

How to Apply These Terms to Your New Programs

+ +

If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms.

+ +

To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the “copyright” line and a pointer to where the full notice is found.

+ +
    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+ +

Also add information on how to contact you by electronic and paper mail.

+ +

If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode:

+ +
    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+ +

The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an “about box”.

+ +

You should also get your employer (if you work as a programmer) or school, +if any, to sign a “copyright disclaimer” for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>.

+ +

The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>.

+ + + diff --git a/app/src/main/assets/jquery.js b/app/src/main/assets/jquery.js new file mode 100755 index 00000000..eb1d01d5 --- /dev/null +++ b/app/src/main/assets/jquery.js @@ -0,0 +1,2 @@ +/*! jQuery v3.4.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=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,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},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.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(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($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),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-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|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(m.childNodes),m.childNodes),t[m.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&&((e?e.ownerDocument||e:m)!==C&&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&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$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[k]=!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:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),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=k,!C.getElementsByName||!C.getElementsByName(k).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){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),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("!=",$)}),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===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,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]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[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){A(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=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(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 j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.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 k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.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(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(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,ge={option:[1,""],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)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").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 Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.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(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.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?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Vt.childNodes.length),k.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=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.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,k.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):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.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"===k.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"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.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)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.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?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.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){k.fn[n]=function(e,t){return 0 + + + + + + + + +

Licenses

+ +

+ Binaries of this product are made available to you by Mozilla under the Mozilla Public License 2.0 (MPL). +

+ +

+ More specifically, most of the source code for this product is available under the Mozilla Public License 2.0 (MPL) + and Apache License 2.0. Additional software components for this product are available under one of a variety of + other free and open source licenses. Those that require reproduction of the license text in the distribution are + given below. (Note: your copy of this product may not contain code covered by one or more of the licenses listed + here, depending on the exact product and version you choose.) +

+ + + + + + + + +

Mozilla Public License 2.0

+ +
    +
  • Focus - https://github.com/mozilla-mobile/focus-android
  • +
  • Telemetry - https://github.com/mozilla-mobile/telemetry-android
  • +
+ +

1. Definitions

+
+
1.1. “Contributor”
+

means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software.

+
+
1.2. “Contributor Version”
+

means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor’s Contribution.

+
+
1.3. “Contribution”
+

means Covered Software of a particular Contributor.

+
+
1.4. “Covered Software”
+

means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof.

+
+
1.5. “Incompatible With Secondary Licenses”
+

means

+
    +
  1. that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or

  2. +
  3. that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License.

  4. +
+
+
1.6. “Executable Form”
+

means any form of the work other than Source Code Form.

+
+
1.7. “Larger Work”
+

means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software.

+
+
1.8. “License”
+

means this document.

+
+
1.9. “Licensable”
+

means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License.

+
+
1.10. “Modifications”
+

means any of the following:

+
    +
  1. any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or

  2. +
  3. any new file in Source Code Form that contains any Covered Software.

  4. +
+
+
1.11. “Patent Claims” of a Contributor
+

means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version.

+
+
1.12. “Secondary License”
+

means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses.

+
+
1.13. “Source Code Form”
+

means the form of the work preferred for making modifications.

+
+
1.14. “You” (or “Your”)
+

means an individual or a legal entity exercising rights under this License. For legal entities, “You” includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.

+
+
+

2. License Grants and Conditions

+

2.1. Grants

+

Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:

+
    +
  1. under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and

  2. +
  3. under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version.

  4. +
+

2.2. Effective Date

+

The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution.

+

2.3. Limitations on Grant Scope

+

The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor:

+
    +
  1. for any code that a Contributor has removed from Covered Software; or

  2. +
  3. for infringements caused by: (i) Your and any other third party’s modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or

  4. +
  5. under Patent Claims infringed by Covered Software in the absence of its Contributions.

  6. +
+

This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4).

+

2.4. Subsequent Licenses

+

No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3).

+

2.5. Representation

+

Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License.

+

2.6. Fair Use

+

This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents.

+

2.7. Conditions

+

Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1.

+

3. Responsibilities

+

3.1. Distribution of Source Form

+

All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients’ rights in the Source Code Form.

+

3.2. Distribution of Executable Form

+

If You distribute Covered Software in Executable Form then:

+
    +
  1. such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and

  2. +
  3. You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients’ rights in the Source Code Form under this License.

  4. +
+

3.3. Distribution of a Larger Work

+

You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s).

+

3.4. Notices

+

You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies.

+

3.5. Application of Additional Terms

+

You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction.

+

4. Inability to Comply Due to Statute or Regulation

+

If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.

+

5. Termination

+

5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice.

+

5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate.

+

5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination.

+

6. Disclaimer of Warranty

+

Covered Software is provided under this License on an “as is” basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necessary servicing, repair, or correction. This disclaimer of warranty constitutes an essential part of this License. No use of any Covered Software is authorized under this License except under this disclaimer.

+

7. Limitation of Liability

+

Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party’s negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You.

+

8. Litigation

+

Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party’s ability to bring cross-claims or counter-claims.

+

9. Miscellaneous

+

This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor.

+

10. Versions of the License

+

10.1. New Versions

+

Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number.

+

10.2. Effect of New Versions

+

You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward.

+

10.3. Modified Versions

+

If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License).

+

10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses

+

If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached.

+

Exhibit A - Source Code Form License Notice

+
+

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

+
+

If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.

+

You may add additional accurate notices of copyright ownership.

+

Exhibit B - “Incompatible With Secondary Licenses” Notice

+
+

This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0.

+
+ + + + + +

Apache License 2.0

+ +
    +
  • com.android.support : animated-vector-drawable
  • +
  • org.jetbrains : annotations
  • +
  • com.android.support : appcompat-v7
  • +
  • com.android.support : cardview-v7
  • +
  • android.arch.lifecycle : common
  • +
  • android.arch.core : common
  • +
  • com.android.support : customtabs
  • +
  • com.android.support : design
  • +
  • android.arch.lifecycle : extensions
  • +
  • org.jetbrains.kotlin : kotlin-stdlib-jre7
  • +
  • org.jetbrains.kotlin : kotlin-stdlib
  • +
  • com.android.support : recyclerview-v7
  • +
  • android.arch.core : runtime
  • +
  • android.arch.lifecycle : runtime
  • +
  • com.android.support : support-annotations
  • +
  • com.android.support : support-compat
  • +
  • com.android.support : support-core-ui
  • +
  • com.android.support : support-core-utils
  • +
  • com.android.support : support-fragment
  • +
  • com.android.support : support-media-compat
  • +
  • com.android.support : support-v4
  • +
  • com.android.support :support-vector-drawable
  • +
  • com.android.support :transition
  • +
+ +

1. Definitions.

+

"License" shall mean the terms and conditions for use, reproduction, and + distribution as defined by Sections 1 through 9 of this document.

+

"Licensor" shall mean the copyright owner or entity authorized by the + copyright owner that is granting the License.

+

"Legal Entity" shall mean the union of the acting entity and all other + entities that control, are controlled by, or are under common control with + that entity. For the purposes of this definition, "control" means (i) the + power, direct or indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (ii) ownership of fifty + percent (50%) or more of the outstanding shares, or (iii) beneficial + ownership of such entity.

+

"You" (or "Your") shall mean an individual or Legal Entity exercising + permissions granted by this License.

+

"Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation source, + and configuration files.

+

"Object" form shall mean any form resulting from mechanical transformation + or translation of a Source form, including but not limited to compiled + object code, generated documentation, and conversions to other media types.

+

"Work" shall mean the work of authorship, whether in Source or Object form, + made available under the License, as indicated by a copyright notice that + is included in or attached to the work (an example is provided in the + Appendix below).

+

"Derivative Works" shall mean any work, whether in Source or Object form, + that is based on (or derived from) the Work and for which the editorial + revisions, annotations, elaborations, or other modifications represent, as + a whole, an original work of authorship. For the purposes of this License, + Derivative Works shall not include works that remain separable from, or + merely link (or bind by name) to the interfaces of, the Work and Derivative + Works thereof.

+

"Contribution" shall mean any work of authorship, including the original + version of the Work and any modifications or additions to that Work or + Derivative Works thereof, that is intentionally submitted to Licensor for + inclusion in the Work by the copyright owner or by an individual or Legal + Entity authorized to submit on behalf of the copyright owner. For the + purposes of this definition, "submitted" means any form of electronic, + verbal, or written communication sent to the Licensor or its + representatives, including but not limited to communication on electronic + mailing lists, source code control systems, and issue tracking systems that + are managed by, or on behalf of, the Licensor for the purpose of discussing + and improving the Work, but excluding communication that is conspicuously + marked or otherwise designated in writing by the copyright owner as "Not a + Contribution."

+

"Contributor" shall mean Licensor and any individual or Legal Entity on + behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work.

+

2. Grant of Copyright License. Subject to the + terms and conditions of this License, each Contributor hereby grants to You + a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, publicly + display, publicly perform, sublicense, and distribute the Work and such + Derivative Works in Source or Object form.

+

3. Grant of Patent License. Subject to the terms + and conditions of this License, each Contributor hereby grants to You a + perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, use, + offer to sell, sell, import, and otherwise transfer the Work, where such + license applies only to those patent claims licensable by such Contributor + that are necessarily infringed by their Contribution(s) alone or by + combination of their Contribution(s) with the Work to which such + Contribution(s) was submitted. If You institute patent litigation against + any entity (including a cross-claim or counterclaim in a lawsuit) alleging + that the Work or a Contribution incorporated within the Work constitutes + direct or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate as of the + date such litigation is filed.

+

4. Redistribution. You may reproduce and + distribute copies of the Work or Derivative Works thereof in any medium, + with or without modifications, and in Source or Object form, provided that + You meet the following conditions:

+
    +
  1. You must give any other recipients of the Work or Derivative Works a + copy of this License; and
  2. + +
  3. You must cause any modified files to carry prominent notices stating + that You changed the files; and
  4. + +
  5. You must retain, in the Source form of any Derivative Works that You + distribute, all copyright, patent, trademark, and attribution notices from + the Source form of the Work, excluding those notices that do not pertain to + any part of the Derivative Works; and
  6. + +
  7. If the Work includes a "NOTICE" text file as part of its distribution, + then any Derivative Works that You distribute must include a readable copy + of the attribution notices contained within such NOTICE file, excluding + those notices that do not pertain to any part of the Derivative Works, in + at least one of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or documentation, + if provided along with the Derivative Works; or, within a display generated + by the Derivative Works, if and wherever such third-party notices normally + appear. The contents of the NOTICE file are for informational purposes only + and do not modify the License. You may add Your own attribution notices + within Derivative Works that You distribute, alongside or as an addendum to + the NOTICE text from the Work, provided that such additional attribution + notices cannot be construed as modifying the License. +
    +
    + You may add Your own copyright statement to Your modifications and may + provide additional or different license terms and conditions for use, + reproduction, or distribution of Your modifications, or for any such + Derivative Works as a whole, provided Your use, reproduction, and + distribution of the Work otherwise complies with the conditions stated in + this License. +
  8. + +
+ +

5. Submission of Contributions. Unless You + explicitly state otherwise, any Contribution intentionally submitted for + inclusion in the Work by You to the Licensor shall be under the terms and + conditions of this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify the + terms of any separate license agreement you may have executed with Licensor + regarding such Contributions.

+

6. Trademarks. This License does not grant + permission to use the trade names, trademarks, service marks, or product + names of the Licensor, except as required for reasonable and customary use + in describing the origin of the Work and reproducing the content of the + NOTICE file.

+

7. Disclaimer of Warranty. Unless required by + applicable law or agreed to in writing, Licensor provides the Work (and + each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, + without limitation, any warranties or conditions of TITLE, + NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You + are solely responsible for determining the appropriateness of using or + redistributing the Work and assume any risks associated with Your exercise + of permissions under this License.

+

8. Limitation of Liability. In no event and + under no legal theory, whether in tort (including negligence), contract, or + otherwise, unless required by applicable law (such as deliberate and + grossly negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a result + of this License or out of the use or inability to use the Work (including + but not limited to damages for loss of goodwill, work stoppage, computer + failure or malfunction, or any and all other commercial damages or losses), + even if such Contributor has been advised of the possibility of such + damages.

+

9. Accepting Warranty or Additional Liability. + While redistributing the Work or Derivative Works thereof, You may choose + to offer, and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this License. + However, in accepting such obligations, You may act only on Your own behalf + and on Your sole responsibility, not on behalf of any other Contributor, + and only if You agree to indemnify, defend, and hold each Contributor + harmless for any liability incurred by, or claims asserted against, such + Contributor by reason of your accepting any such warranty or additional + liability.

+

END OF TERMS AND CONDITIONS

+ + + + + +

GNU Lesser General Public License 2.1

+ +
    +
  • findbugs annotations (com.google.code.findbugs:annotations)
  • +
+ +

GNU LESSER GENERAL PUBLIC LICENSE

+

+Version 2.1, February 1999 +

+ +

+Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed. +

+ +

+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.] +

+ +

Preamble

+ +

+ The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. +

+

+ This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. +

+

+ When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. +

+

+ To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. +

+

+ For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. +

+

+ We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. +

+

+ To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. +

+

+ Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. +

+

+ Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. +

+

+ When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. +

+

+ We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. +

+

+ For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. +

+

+ In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. +

+

+ Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. +

+

+ The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. +

+ +

TERMS AND CONDITIONS FOR COPYING, +DISTRIBUTION AND MODIFICATION

+ + +

+0. +This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". +

+

+ A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. +

+

+ The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) +

+

+ "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. +

+

+ Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. +

+

+1. +You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. +

+

+ You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. +

+

+2. +You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: +

+ +
    +
  • a) + The modified work must itself be a software library.
  • +
  • b) + You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change.
  • + +
  • c) + You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License.
  • + +
  • d) + If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. +

    + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.)

  • +
+ +

+These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Library, and can be +reasonably considered independent and separate works in themselves, then +this License, and its terms, do not apply to those sections when you +distribute them as separate works. But when you distribute the same +sections as part of a whole which is a work based on the Library, the +distribution of the whole must be on the terms of this License, whose +permissions for other licensees extend to the entire whole, and thus to +each and every part regardless of who wrote it. +

+

+Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise +the right to control the distribution of derivative or collective works +based on the Library. +

+

+In addition, mere aggregation of another work not based on the Library with +the Library (or with a work based on the Library) on a volume of a storage +or distribution medium does not bring the other work under the scope of +this License. +

+

+3. +You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. +

+

+ Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. +

+

+ This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. +

+

+4. +You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. +

+

+ If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. +

+

+5. +A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. +

+

+ However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. +

+

+ When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. +

+

+ If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) +

+

+ Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. +

+

+6. +As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. +

+

+ You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: +

+ +
    +
  • a) Accompany the work with the complete + corresponding machine-readable source code for the Library + including whatever changes were used in the work (which must be + distributed under Sections 1 and 2 above); and, if the work is an + executable linked with the Library, with the complete + machine-readable "work that uses the Library", as object code + and/or source code, so that the user can modify the Library and + then relink to produce a modified executable containing the + modified Library. (It is understood that the user who changes the + contents of definitions files in the Library will not necessarily + be able to recompile the application to use the modified + definitions.)
  • + +
  • b) Use a suitable shared library mechanism + for linking with the Library. A suitable mechanism is one that + (1) uses at run time a copy of the library already present on the + user's computer system, rather than copying library functions into + the executable, and (2) will operate properly with a modified + version of the library, if the user installs one, as long as the + modified version is interface-compatible with the version that the + work was made with.
  • + +
  • c) Accompany the work with a written offer, + valid for at least three years, to give the same user the + materials specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution.
  • + +
  • d) If distribution of the work is made by + offering access to copy from a designated place, offer equivalent + access to copy the above specified materials from the same + place.
  • + +
  • e) Verify that the user has already received + a copy of these materials or that you have already sent this user + a copy.
  • +
+ +

+ For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. +

+

+ It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. +

+

+7. You may place library facilities that are a work +based on the Library side-by-side in a single library together with +other library facilities not covered by this License, and distribute +such a combined library, provided that the separate distribution of +the work based on the Library and of the other library facilities is +otherwise permitted, and provided that you do these two things: +

+ +
    +
  • a) Accompany the combined library with a copy + of the same work based on the Library, uncombined with any other + library facilities. This must be distributed under the terms of + the Sections above.
  • + +
  • b) Give prominent notice with the combined + library of the fact that part of it is a work based on the + Library, and explaining where to find the accompanying uncombined + form of the same work.
  • +
+ +

+8. You may not copy, modify, sublicense, link with, +or distribute the Library except as expressly provided under this +License. Any attempt otherwise to copy, modify, sublicense, link +with, or distribute the Library is void, and will automatically +terminate your rights under this License. However, parties who have +received copies, or rights, from you under this License will not have +their licenses terminated so long as such parties remain in full +compliance. +

+

+9. +You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. +

+

+10. +Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. +

+

+11. +If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. +

+

+If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. +

+

+It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. +

+

+This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. +

+

+12. +If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. +

+

+13. +The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. +

+

+Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. +

+

+14. +If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. +

+

+NO WARRANTY +

+

+15. +BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +

+

+16. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. +

+ +

END OF TERMS AND CONDITIONS

+ + + + + +

adjust-android License

+ +

Copyright (c) 2012-2017 adjust GmbH,
+ http://www.adjust.com

+ +

Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions:

+ +

The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software.

+ +

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ + + diff --git a/app/src/main/assets/style.css b/app/src/main/assets/style.css new file mode 100644 index 00000000..651849a3 --- /dev/null +++ b/app/src/main/assets/style.css @@ -0,0 +1,39 @@ +body, html { + background: white; + color: #FFFFFF; + font-family: sans-serif; + line-height: 24px; + font-size: 14px; +} + +body{ + padding-left: 24px; + padding-right: 24px; + margin-left: 0px; + margin-right: 0px; +} + +a { + color: #0A9AF4; +} + +/* Make only about page links ("learn more") white */ +.about a { + color: #FFFFFF; +} + +p.subtitle { + text-align: center; + opacity: .7; + margin: 0; +} + +img#wordmark { + /* We need to set the dp size here, because by default webview assumes the image is not + density specific (but since it's an android resource, we get a density specific version). */ + width: 180px; + display: block; + margin-left: auto; + margin-right: auto; + padding-top: 24px; +} diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png old mode 100644 new mode 100755 index c2f8d9bc..f40c1cfe Binary files a/app/src/main/ic_launcher-web.png and b/app/src/main/ic_launcher-web.png differ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityContextManager.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityContextManager.java new file mode 100755 index 00000000..5359c07a --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/activityContextManager.java @@ -0,0 +1,66 @@ +package com.darkweb.genesissearchengine.appManager; + +import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; +import com.darkweb.genesissearchengine.appManager.historyManager.historyController; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController; +import com.darkweb.genesissearchengine.appManager.tabManager.tabController; + +public class activityContextManager +{ + /*Private Variables*/ + + private static final activityContextManager ourInstance = new activityContextManager(); + public static activityContextManager getInstance() + { + return ourInstance; + } + + /*Private Contexts*/ + private historyController history_controller; + private bookmarkController bookmark_controller; + private homeController home_controller; + private tabController tab_controller; + private android.app.Activity sCurrentActivity = null; + + /*Initialization*/ + + private activityContextManager() + { + } + + /*List ContextGetterSetters*/ + public historyController getHistoryController(){ + return history_controller; + } + public void setHistoryController(historyController history_controller){ + this.history_controller = history_controller; + } + + public bookmarkController getBookmarkController(){ + return bookmark_controller; + } + public void setBookmarkController(bookmarkController bookmark_controller){ + this.bookmark_controller = bookmark_controller; + } + + public homeController getHomeController(){ + return home_controller; + } + public void setHomeController(homeController home_controller){ + this.home_controller = home_controller; + } + + public tabController getTabController(){ + return tab_controller; + } + public void setTabController(tabController tab_controller){ + this.tab_controller = tab_controller; + } + + public void setCurrentActivity(android.app.Activity sCurrentActivity){ + this.sCurrentActivity = sCurrentActivity; + } + public android.app.Activity setCurrentActivity(){ + return sCurrentActivity; + } +} 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 new file mode 100755 index 00000000..e18c89ba --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java @@ -0,0 +1,147 @@ +package com.darkweb.genesissearchengine.appManager.bookmarkManager; + +import android.view.LayoutInflater; +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.recyclerview.widget.RecyclerView; + +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.example.myapplication.R; + +import java.util.ArrayList; +import java.util.Collections; + +public class bookmarkAdapter extends RecyclerView.Adapter +{ + /*Private Variables*/ + + private ArrayList mModelList; + private ArrayList temp_model_list; + private eventObserver.eventListener event; + private String filter = strings.EMPTY_STR; + private boolean isClosing = false; + + bookmarkAdapter(ArrayList model_list, eventObserver.eventListener event) { + this.mModelList = model_list; + this.event = event; + temp_model_list = new ArrayList<>(); + } + + /*Initializations*/ + + @NonNull + @Override + public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_row_view, parent, false); + return new listViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull bookmarkAdapter.listViewHolder holder, int position) + { + holder.bindListView(temp_model_list.get(position)); + clearMessageItem(holder.messageButton,position); + } + + @Override + public int getItemCount() { + return temp_model_list.size(); + } + + /*Listeners*/ + + private void setItemViewOnClickListener(View itemView, String url) + { + itemView.setOnClickListener(v ->event.invokeObserver(Collections.singletonList(url),enums.etype.url_triggered)); + } + + private void clearMessageItem(ImageButton clearButton, int index) + { + clearButton.setOnClickListener(v -> + { + if(!isClosing){ + isClosing = true; + int size = mModelList.size(); + + event.invokeObserver(Collections.singletonList(mModelList.get(temp_model_list.get(index).getmId()).getmId()),enums.etype.remove_from_database); + event.invokeObserver(Collections.singletonList(temp_model_list.get(index).getmId()),enums.etype.url_clear); + invokeFilter(false); + event.invokeObserver(Collections.singletonList(index),enums.etype.is_empty); + + if(size>1){ + new Thread(){ + public void run(){ + try + { + sleep(500); + isClosing = false; + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + }.start(); + } + } + }); + + } + + /*View Holder Extensions*/ + + class listViewHolder extends RecyclerView.ViewHolder + { + TextView heaaderText; + TextView descriptionText; + ImageButton messageButton; + ImageView empty_message; + LinearLayout itemContainer; + + listViewHolder(View itemView) { + super(itemView); + } + + void bindListView(bookmarkRowModel model) { + + heaaderText = itemView.findViewById(R.id.mHeader); + descriptionText = itemView.findViewById(R.id.mDescription); + itemContainer = itemView.findViewById(R.id.item_container); + + String header = model.getmHeader(); + + descriptionText.setText(model.getmHeader()); + heaaderText.setText(model.getmDescription()); + messageButton = itemView.findViewById(R.id.message_button); + empty_message = itemView.findViewById(R.id.empty_list); + + setItemViewOnClickListener(itemContainer,header); + } + } + + void setFilter(String filter){ + this.filter = filter; + } + + void invokeFilter(boolean notify){ + temp_model_list.clear(); + for(int counter = 0; counter< mModelList.size(); counter++){ + if(mModelList.get(counter).getmHeader().contains(filter) || mModelList.get(counter).getmDescription().contains(filter)){ + bookmarkRowModel model = mModelList.get(counter); + temp_model_list.add(new bookmarkRowModel(model.getmHeader(),model.getmDescription(),counter)); + } + } + + if(notify){ + notifyDataSetChanged(); + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java new file mode 100755 index 00000000..9f56ef97 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java @@ -0,0 +1,180 @@ +package com.darkweb.genesissearchengine.appManager.bookmarkManager; + +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.View; +import android.view.inputmethod.EditorInfo; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController; +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.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.example.myapplication.R; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +public class bookmarkController extends AppCompatActivity +{ + /*Private Variables*/ + + private bookmarkModel mListModel; + private homeController mHomeController; + private activityContextManager mContextManager; + + private ImageView mEmptyListNotifier; + private EditText mSearchBar; + private RecyclerView mListView; + private Button mClearButton; + + private bookmarkViewController mBookmarkViewController; + + /*Initializations*/ + + @Override + protected void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + setContentView(R.layout.bookmark_view); + initializeListModel(); + initializeViews(); + initializeList(); + onEditorInvoked(); + } + + public void initializeListModel(){ + mListModel = new bookmarkModel(); + mListModel.setList(dataController.getInstance().getBookmark()); + mContextManager = activityContextManager.getInstance(); + mHomeController = activityContextManager.getInstance().getHomeController(); + mContextManager.setBookmarkController(this); + pluginController.getInstance().logEvent(strings.BOOKMARK_OPENED); + } + public void initializeViews(){ + mEmptyListNotifier = findViewById(R.id.empty_list); + mSearchBar = findViewById(R.id.search); + mListView = findViewById(R.id.listview); + mClearButton = findViewById(R.id.clearButton); + mBookmarkViewController = new bookmarkViewController(mEmptyListNotifier, mSearchBar, mListView, mClearButton,this); + mClearButton.setText(strings.CLEAR_BOOKMARK); + } + public void initializeList(){ + bookmarkAdapter adapter = new bookmarkAdapter(mListModel.getList(),new adapterCallback()); + adapter.invokeFilter(false); + mListView.setAdapter(adapter); + mListView.setLayoutManager(new LinearLayoutManager(this)); + mBookmarkViewController.updateIfListEmpty(mListModel.getList().size(),0); + } + + /*View Handlers*/ + + public void onEditorInvoked(){ + + mSearchBar.setOnEditorActionListener((v, actionId, event) ->{ + if (actionId == EditorInfo.IME_ACTION_NEXT) + { + helperMethod.hideKeyboard(this); + return true; + } + return false; + }); + + mSearchBar.addTextChangedListener(new TextWatcher() { + + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2){ + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2){ + + } + + @Override + public void afterTextChanged(Editable editable) + { + ((bookmarkAdapter) Objects.requireNonNull(mListView.getAdapter())).setFilter(mSearchBar.getText().toString()); + ((bookmarkAdapter) mListView.getAdapter()).invokeFilter(true); + } + }); + } + + public void onBackPressed(View view){ + this.finish(); + } + public void onclearDataTrigger(View view){ + pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.EMPTY_STR),enums.etype.clear_bookmark); + } + public void onclearData(){ + mListModel.clearList(); + ((bookmarkAdapter) Objects.requireNonNull(mListView.getAdapter())).invokeFilter(true ); + mBookmarkViewController.clearList(); + databaseController.getInstance().execSQL("delete from bookmark where 1",null); + } + + @Override + public void onTrimMemory(int level) + { + if(status.sIsAppPaused && (level==80 || level==15)) + { + dataController.getInstance().setBool(keys.LOW_MEMORY,true); + finish(); + } + } + + @Override + public void onResume() + { + activityContextManager.getInstance().setCurrentActivity(this); + status.sIsAppPaused = false; + super.onResume(); + } + + @Override + public void onPause() + { + status.sIsAppPaused = true; + super.onPause(); + } + + /*Event Observer*/ + + public class adapterCallback implements eventObserver.eventListener{ + + @Override + public void invokeObserver(List data, enums.etype e_type) + { + if(e_type.equals(enums.etype.url_triggered)){ + String url_temp = helperMethod.completeURL(data.get(0).toString()); + pluginController.getInstance().logEvent(strings.BOOKMARK_TRIGGERED); + mHomeController.onLoadURL(url_temp); + finish(); + } + else if(e_type.equals(enums.etype.url_clear)){ + mListModel.onManualClear((int)data.get(0)); + } + else if(e_type.equals(enums.etype.is_empty)){ + mBookmarkViewController.removeFromList((int)data.get(0)); + mBookmarkViewController.updateIfListEmpty(mListModel.getList().size(),300); + } + else if(e_type.equals(enums.etype.remove_from_database)){ + databaseController.getInstance().deleteFromList((int)data.get(0),"bookmark"); + } + } + + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkModel.java new file mode 100755 index 00000000..0b9c4627 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkModel.java @@ -0,0 +1,36 @@ +package com.darkweb.genesissearchengine.appManager.bookmarkManager; + +import java.util.ArrayList; + +class bookmarkModel +{ + /*Private Variables*/ + + private ArrayList mModelList = new ArrayList<>(); + + /*Initializations*/ + + void setList(ArrayList model) + { + mModelList = model; + } + ArrayList getList() + { + return mModelList; + } + private void removeFromMainList(int index) + { + mModelList.remove(index); + } + + void onManualClear(int index){ + removeFromMainList(index); + } + + void clearList(){ + mModelList.clear(); + } + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkRowModel.java new file mode 100755 index 00000000..d9ca7bf6 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkRowModel.java @@ -0,0 +1,30 @@ +package com.darkweb.genesissearchengine.appManager.bookmarkManager; + +public class bookmarkRowModel +{ + /*Private Variables*/ + + private int mId; + private String mHeader; + private String mDescription; + + /*Initializations*/ + + public bookmarkRowModel(String mHeader, String mDescription, int mId) { + this.mId = mId; + this.mHeader = mHeader; + this.mDescription = mDescription; + } + + /*Variable Getters*/ + + String getmHeader() { + return mHeader; + } + String getmDescription() { + return mDescription; + } + public int getmId() { + return mId; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java new file mode 100755 index 00000000..b492376b --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java @@ -0,0 +1,82 @@ +package com.darkweb.genesissearchengine.appManager.bookmarkManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageView; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView; + +import com.darkweb.genesissearchengine.constants.strings; +import com.example.myapplication.R; + +import java.util.Objects; + +class bookmarkViewController +{ + /*Private Variables*/ + private AppCompatActivity mContext; + + private ImageView mEmptyListNotifier; + private EditText mSearchBar; + private RecyclerView mListView; + private Button mClearButton; + + /*Initializations*/ + + bookmarkViewController(ImageView mEmptyListNotifier, EditText mSearchBar, RecyclerView mListView, Button mClearButton,AppCompatActivity mContext) + { + this.mContext = mContext; + this.mEmptyListNotifier = mEmptyListNotifier; + this.mSearchBar = mSearchBar; + this.mListView = mListView; + this.mClearButton = mClearButton; + + 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)); + } + else { + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white)); + } + } + } + + void updateIfListEmpty(int size,int duration){ + if(size>0){ + mEmptyListNotifier.animate().setDuration(duration).alpha(0f); + mClearButton.animate().setDuration(duration).alpha(1f); + } + else { + mEmptyListNotifier.animate().setDuration(duration).alpha(1f); + mClearButton.animate().setDuration(duration).alpha(0f); + } + } + + void removeFromList(int index) + { + Objects.requireNonNull(mListView.getAdapter()).notifyItemRemoved(index); + mListView.getAdapter().notifyItemRangeChanged(index, mListView.getAdapter().getItemCount()); + } + + void clearList(){ + Objects.requireNonNull(mListView.getAdapter()).notifyDataSetChanged(); + updateIfListEmpty(mListView.getAdapter().getItemCount(),300); + mSearchBar.clearFocus(); + mSearchBar.setText(strings.EMPTY_STR); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/databaseManager/databaseController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/databaseManager/databaseController.java new file mode 100755 index 00000000..edcb8a25 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/databaseManager/databaseController.java @@ -0,0 +1,118 @@ +package com.darkweb.genesissearchengine.appManager.databaseManager; + +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteException; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel; +import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; +import com.darkweb.genesissearchengine.constants.constants; +import java.util.ArrayList; +import static android.content.Context.MODE_PRIVATE; + +public class databaseController +{ + + /*Private Variables*/ + + private static final databaseController sOurInstance = new databaseController(); + private SQLiteDatabase mDatabaseInstance; + + public static databaseController getInstance() + { + return sOurInstance; + } + + private databaseController() + { + } + + /*Initializations*/ + + public void initialize(AppCompatActivity app_context) + { + try + { + mDatabaseInstance = app_context.openOrCreateDatabase(constants.DATABASE_NAME, MODE_PRIVATE, null); + + mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "history" + " (id INT(4) PRIMARY KEY,date DATETIME,url VARCHAR,title VARCHAR);"); + try { + mDatabaseInstance.execSQL("ALTER TABLE history ADD COLUMN title VARCHAR default ''"); + } catch (SQLiteException ignored) { + } + mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "bookmark" + " (id INT(4) PRIMARY KEY,title VARCHAR,url VARCHAR);"); + + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + } + + /*Helper Methods*/ + + public void execSQL(String query,String[] params) + { + if(params==null) + { + mDatabaseInstance.execSQL(query); + } + else + { + mDatabaseInstance.execSQL(query,params); + } + } + + public ArrayList selectHistory(int startIndex,int endIndex){ + ArrayList tempmodel = new ArrayList<>(); + Cursor c = mDatabaseInstance.rawQuery("SELECT * FROM history ORDER BY date DESC LIMIT "+endIndex+" OFFSET "+startIndex, null); + if (c.moveToFirst()){ + do { + historyRowModel model = new historyRowModel(c.getString(2), c.getString(1),Integer.parseInt(c.getString(0))); + tempmodel.add(model); + model.updateTitle(c.getString(3)); + } while(c.moveToNext()); + } + c.close(); + + return tempmodel; + } + + public int getLargestHistoryID(){ + int id = 0; + Cursor c = mDatabaseInstance.rawQuery("SELECT max(id) FROM history", null); + + if (c.moveToFirst()){ + do { + if(c.getString(0)==null){ + break; + } + id = Integer.parseInt(c.getString(0)); + break; + } while(c.moveToNext()); + } + c.close(); + + return id; + } + + public ArrayList selectBookmark(){ + ArrayList tempmodel = new ArrayList<>(); + Cursor c = mDatabaseInstance.rawQuery("SELECT * FROM bookmark ORDER BY id DESC ", null); + + if (c.moveToFirst()){ + do { + tempmodel.add(new bookmarkRowModel(c.getString(2), c.getString(1),Integer.parseInt(c.getString(0)))); + } while(c.moveToNext()); + } + c.close(); + + return tempmodel; + } + + public void deleteFromList(int index,String table) { + databaseController.getInstance().execSQL("delete from "+table+" where id="+index,null); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java new file mode 100755 index 00000000..81142701 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java @@ -0,0 +1,143 @@ +package com.darkweb.genesissearchengine.appManager.historyManager; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.*; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.example.myapplication.R; + +import java.util.ArrayList; +import java.util.Collections; + +public class historyAdapter extends RecyclerView.Adapter +{ + /*Private Variables*/ + + private ArrayList mModelList; + private ArrayList tempModelList; + private eventObserver.eventListener mEvent; + private String filter = strings.EMPTY_STR; + private boolean isClosing = false; + + historyAdapter(ArrayList mModelList, eventObserver.eventListener mEvent) { + this.mModelList = mModelList; + this.mEvent = mEvent; + tempModelList = new ArrayList<>(); + } + + /*Initializations*/ + + @NonNull + @Override + public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_row_view, parent, false); + return new listViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull historyAdapter.listViewHolder holder, int position) + { + holder.bindListView(tempModelList.get(position)); + clearMessageItem(holder.mMessageButton,position); + } + + @Override + public int getItemCount() { + return tempModelList.size(); + } + + /*Listeners*/ + + private void setItemViewOnClickListener(View itemView, String url) + { + itemView.setOnClickListener(v -> mEvent.invokeObserver(Collections.singletonList(url),enums.etype.url_triggered)); + } + + private void clearMessageItem(ImageButton clearButton, int index) + { + clearButton.setOnClickListener(v -> + { + if(!isClosing){ + isClosing = true; + int size = mModelList.size(); + + int index_temp = tempModelList.get(index).getmId(); + mEvent.invokeObserver(Collections.singletonList(tempModelList.get(index).getmHeader()),enums.etype.url_clear_at); + mEvent.invokeObserver(Collections.singletonList(mModelList.get(index_temp).getmId()),enums.etype.remove_from_database); + mEvent.invokeObserver(Collections.singletonList(tempModelList.get(index).getmId()),enums.etype.url_clear); + invokeFilter(false); + mEvent.invokeObserver(Collections.singletonList(index),enums.etype.is_empty); + + if(size>1){ + new Thread(){ + public void run(){ + try + { + sleep(500); + isClosing = false; + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + }.start(); + } + } + }); + } + + /*View Holder Extensions*/ + + class listViewHolder extends RecyclerView.ViewHolder + { + TextView mHeaaderText; + TextView mDescriptionText; + ImageButton mMessageButton; + ImageView mEmptyMessage; + LinearLayout mItemContainer; + + listViewHolder(View itemView) { + super(itemView); + } + + void bindListView(historyRowModel model) { + + mHeaaderText = itemView.findViewById(R.id.mHeader); + mDescriptionText = itemView.findViewById(R.id.mDescription); + mItemContainer = itemView.findViewById(R.id.item_container); + + String header = model.getmHeader(); + + mDescriptionText.setText(model.getmDescription()); + mHeaaderText.setText(model.getmHeader()); + mMessageButton = itemView.findViewById(R.id.message_button); + mEmptyMessage = itemView.findViewById(R.id.empty_list); + + setItemViewOnClickListener(mItemContainer, header); + } + } + + void setFilter(String filter){ + this.filter = filter; + } + + void invokeFilter(boolean notify){ + tempModelList.clear(); + for(int counter = 0; counter< mModelList.size(); counter++){ + if(mModelList.get(counter).getmHeader().contains(filter)){ + historyRowModel model = mModelList.get(counter); + tempModelList.add(new historyRowModel(model.getmHeader(),model.getmDescription(),counter)); + } + } + + if(notify){ + notifyDataSetChanged(); + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java new file mode 100755 index 00000000..fc353f8a --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java @@ -0,0 +1,200 @@ +package com.darkweb.genesissearchengine.appManager.historyManager; + +import android.text.Editable; +import android.text.TextWatcher; +import android.view.View; +import android.view.inputmethod.EditorInfo; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.ImageView; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController; +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.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.example.myapplication.R; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +public class historyController extends AppCompatActivity +{ + /*Private Variables*/ + + private historyModel mListModel; + private homeController mHomeController; + private activityContextManager mContextManager; + + private ImageView mEmptyListNotifier; + private EditText mSearchBar; + private RecyclerView mListView; + private Button mClearButton; + private ImageButton mMoreButton; + + private historyViewController mHistoryViewController; + + /*Initializations*/ + + @Override + protected void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + setContentView(R.layout.history_view); + initializeListModel(); + initializeViews(); + initializeList(); + onEditorInvoked(); + } + + public void initializeListModel(){ + mListModel = new historyModel(); + mContextManager = activityContextManager.getInstance(); + mHomeController = activityContextManager.getInstance().getHomeController(); + mContextManager.setHistoryController(this); + activityContextManager.getInstance().setHistoryController(this); + pluginController.getInstance().logEvent(strings.HISTORY_OPENED); + } + public void initializeViews(){ + mEmptyListNotifier = findViewById(R.id.empty_list); + mSearchBar = findViewById(R.id.search); + mListView = findViewById(R.id.listview); + mClearButton = findViewById(R.id.clearButton); + mMoreButton = findViewById(R.id.load_more); + mHistoryViewController = new historyViewController(mEmptyListNotifier, mSearchBar, mListView, mClearButton, mMoreButton,this); + } + public void initializeList(){ + ArrayList model = dataController.getInstance().getHistory(); + mListModel.setList(model); + historyAdapter adapter = new historyAdapter(mListModel.getList(),new adapterCallback()); + adapter.invokeFilter(false); + mListView.setAdapter(adapter); + mListView.setLayoutManager(new LinearLayoutManager(this)); + mHistoryViewController.updateIfListEmpty(mListModel.getList().size(),0); + } + + /*View Handlers*/ + + public void onEditorInvoked(){ + + mSearchBar.setOnEditorActionListener((v, actionId, event) ->{ + if (actionId == EditorInfo.IME_ACTION_NEXT) + { + helperMethod.hideKeyboard(this); + return true; + } + return false; + }); + + mSearchBar.addTextChangedListener(new TextWatcher() { + + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2){ + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2){ + + } + + @Override + public void afterTextChanged(Editable editable) + { + ((historyAdapter) Objects.requireNonNull(mListView.getAdapter())).setFilter(mSearchBar.getText().toString()); + ((historyAdapter) mListView.getAdapter()).invokeFilter(true); + } + }); + } + + public void onBackPressed(View view){ + this.finish(); + } + public void onclearDataTrigger(View view){ + pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.EMPTY_STR),enums.etype.clear_history); + } + public void onclearData(){ + mListModel.clearList(); + ((historyAdapter) Objects.requireNonNull(mListView.getAdapter())).invokeFilter(true ); + mHistoryViewController.clearList(); + databaseController.getInstance().execSQL("delete from history where 1",null); + finish(); + } + + public void onLoadMoreHostory(View view) + { + dataController.getInstance().loadMoreHistory(); + } + + public void updateHistory(){ + initializeList(); + mHistoryViewController.updateList(); + } + + @Override + public void onTrimMemory(int level) + { + if(status.sIsAppPaused && (level==80 || level==15)) + { + dataController.getInstance().setBool(keys.LOW_MEMORY,true); + finish(); + } + } + + @Override + public void onResume() + { + activityContextManager.getInstance().setCurrentActivity(this); + status.sIsAppPaused = false; + super.onResume(); + } + + @Override + public void onPause() + { + status.sIsAppPaused = true; + super.onPause(); + } + + /*Event Observer*/ + + public class adapterCallback implements eventObserver.eventListener{ + + @Override + public void invokeObserver(List data, enums.etype e_type) + { + if(e_type.equals(enums.etype.url_triggered)){ + String url_temp = helperMethod.completeURL(data.get(0).toString()); + pluginController.getInstance().logEvent(strings.HISTORY_TRIGGERED); + mHomeController.onLoadURL(url_temp); + finish(); + } + else if(e_type.equals(enums.etype.url_clear)){ + mListModel.onManualClear((int)data.get(0)); + } + else if(e_type.equals(enums.etype.url_clear_at)){ + dataController.getInstance().removeHistory(data.toString()); + } + else if(e_type.equals(enums.etype.is_empty)){ + mHistoryViewController.removeFromList((int)data.get(0)); + mHistoryViewController.updateIfListEmpty(mListModel.getList().size(),300); + } + else if(e_type.equals(enums.etype.remove_from_database)){ + databaseController.getInstance().deleteFromList((int)data.get(0),"history"); + } + } + + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyModel.java new file mode 100755 index 00000000..fa1fc34f --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyModel.java @@ -0,0 +1,36 @@ +package com.darkweb.genesissearchengine.appManager.historyManager; + +import java.util.ArrayList; + +class historyModel +{ + /*Private Variables*/ + + private ArrayList mModelList = new ArrayList<>(); + + /*Initializations*/ + + void setList(ArrayList model) + { + mModelList = model; + } + ArrayList getList() + { + return mModelList; + } + private void removeFromMainList(int index) + { + mModelList.remove(index); + } + + void onManualClear(int index){ + removeFromMainList(index); + } + + void clearList(){ + mModelList.clear(); + } + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyRowModel.java new file mode 100755 index 00000000..dce90f1f --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyRowModel.java @@ -0,0 +1,45 @@ +package com.darkweb.genesissearchengine.appManager.historyManager; + +import com.darkweb.genesissearchengine.constants.strings; + +public class historyRowModel +{ + /*Private Variables*/ + + private int mId; + private String mTitle; + private String mHeader; + private String mDescription; + + /*Initializations*/ + + public historyRowModel(String mHeader, String mDescription,int mId) { + this.mId = mId; + this.mHeader = mHeader; + this.mDescription = mDescription; + this.mTitle = strings.EMPTY_STR; + } + + /*Variable Getters*/ + + public void updateTitle(String mTitle){ + this.mTitle = mTitle; + } + public void updateURL(String url){ + this.mHeader = url; + } + + public String getTitle(){ + return mTitle; + } + + public String getmHeader() { + return mHeader; + } + public String getmDescription() { + return mDescription; + } + public int getmId() { + return mId; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java new file mode 100755 index 00000000..dc10a4fe --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java @@ -0,0 +1,93 @@ +package com.darkweb.genesissearchengine.appManager.historyManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.ImageView; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView; + +import com.darkweb.genesissearchengine.constants.strings; +import com.example.myapplication.R; + +import java.util.Objects; + +class historyViewController +{ + /*Private Variables*/ + private AppCompatActivity mContext; + + private ImageView mEmptyListNotifier; + private EditText mSearchBar; + private RecyclerView mListView; + private Button mClearButton; + private ImageButton mMoreButton; + + /*Initializations*/ + + historyViewController(ImageView mEmptyListNotifier, EditText mSearchBar, RecyclerView mListView, Button mClearButton,ImageButton mMoreButton,AppCompatActivity mContext) + { + this.mContext = mContext; + this.mEmptyListNotifier = mEmptyListNotifier; + this.mSearchBar = mSearchBar; + this.mListView = mListView; + this.mClearButton = mClearButton; + this.mMoreButton = mMoreButton; + + 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)); + } + else { + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white)); + } + } + } + + void updateIfListEmpty(int size,int duration){ + if(size>0){ + mEmptyListNotifier.animate().setDuration(duration).alpha(0f); + mClearButton.animate().setDuration(duration).alpha(1f); + mMoreButton.animate().setDuration(duration).alpha(1f); + } + else { + mEmptyListNotifier.animate().setDuration(duration).alpha(1f); + mClearButton.animate().setDuration(duration).alpha(0f); + mMoreButton.animate().setDuration(duration).alpha(0f); + } + } + + void updateList(){ + int index = Objects.requireNonNull(mListView.getAdapter()).getItemCount()-1; + mListView.getAdapter().notifyDataSetChanged(); + mListView.scrollToPosition(index); + } + + void removeFromList(int index) + { + Objects.requireNonNull(mListView.getAdapter()).notifyItemRemoved(index); + mListView.getAdapter().notifyItemRangeChanged(index, mListView.getAdapter().getItemCount()); + } + + void clearList(){ + Objects.requireNonNull(mListView.getAdapter()).notifyDataSetChanged(); + updateIfListEmpty(mListView.getAdapter().getItemCount(),300); + mSearchBar.clearFocus(); + mSearchBar.setText(strings.EMPTY_STR); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java new file mode 100755 index 00000000..8bcf6cfd --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java @@ -0,0 +1,211 @@ +package com.darkweb.genesissearchengine.appManager.homeManager; + +import android.content.Intent; +import android.graphics.Color; +import android.net.Uri; +import android.view.View; + +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.constants.*; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import java.io.File; +import java.util.List; +import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent; +import static org.mozilla.geckoview.StorageController.ClearFlags.ALL; +import org.mozilla.geckoview.GeckoRuntime; +import org.mozilla.geckoview.GeckoSession; +import org.mozilla.geckoview.GeckoView; + + +class geckoClients +{ + /*Gecko Variables*/ + + private geckoSession mSession = null; + private GeckoRuntime mRuntime = null; + private int mSessionID=0; + private int mGlobalSessionCounter=0; + + private eventObserver.eventListener event; + private AppCompatActivity context; + + void initialize(GeckoView geckoView, eventObserver.eventListener event, AppCompatActivity context, boolean isForced) + { + this.context = context; + this.event = event; + mGlobalSessionCounter+=1; + mSessionID = mGlobalSessionCounter; + + runtimeSettings(context); + + if(!isForced && geckoView.getSession()!=null && geckoView.getSession().isOpen()){ + mSession = (geckoSession) geckoView.getSession(); + } + else { + geckoView.releaseSession(); + mSession = new geckoSession(new geckoViewClientCallback(),mGlobalSessionCounter,context); + mSession.open(mRuntime); + mSession.getSettings().setUseTrackingProtection(true); + mSession.getSettings().setAllowJavascript(status.sJavaStatus); + geckoView.releaseSession(); + geckoView.setSession(mSession); + + } + onUpdateFont(); + + } + + private void runtimeSettings(AppCompatActivity context){ + if(mRuntime==null){ + mRuntime = GeckoRuntime.getDefault(context); + mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour()); + mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sFontAdjustable); + } + } + + private int getCookiesBehaviour(){ + return status.sCookieStatus; + } + + void updateCookies(){ + mRuntime.getSettings().getContentBlocking().setCookieBehavior(status.sCookieStatus); + onReload(); + } + + void onClose(){ + } + + void initSession(geckoSession mSession){ + this.mSession = mSession; + mSessionID = mSession.getSessionID(); + } + + geckoSession getSession(){ + return mSession; + } + + void updateJavascript(){ + mSession.getSettings().setAllowJavascript(status.sJavaStatus); + if(status.sJavaStatus){ + mSession.reload(); + } + } + + void onUploadRequest(int resultCode,Intent data){ + mSession.onFileUploadRequest(resultCode,data); + } + + void setLoading(boolean status){ + mSession.setLoading(status); + } + + void loadURL(String url){ + mSession.initURL(url); + mSession.loadUri(url); + } + + void onClearSession(){ + mRuntime.getStorageController().clearData(ALL); + } + + void onBackPressed(boolean isFinishAllowed){ + if(mSession.canGoBack()){ + mSession.goBackSession(); + } + else if(isFinishAllowed){ + event.invokeObserver(null, enums.etype.back_list_empty); + } + } + + boolean canGoBack(){ + return mSession.canGoBack(); + } + + boolean canGoForward(){ + return mSession.canGoForward(); + } + + boolean isLoading(){ + return mSession.isLoading(); + } + + Uri getUriPermission(){ + return mSession.getUriPermission(); + } + + boolean getFullScreenStatus(){ + return mSession.getFullScreenStatus(); + } + + void onExitFullScreen(){ + mSession.exitScreen(); + } + + void onForwardPressed(){ + if(mSession.canGoForward()){ + mSession.goForwardSession(); + } + } + + void onStop(){ + mSession.stop(); + } + + void onReload(){ + mSession.reload(); + } + + void manual_download(String url, AppCompatActivity context){ + Uri downloadURL = Uri.parse(url); + File f = new File(url); + String downloadFile = f.getName() != null ? f.getName() : downloadURL.getLastPathSegment(); + + /*EXTERNAL STORAGE REQUEST*/ + if(helperMethod.checkPermissions(context)){ + mSession.downloadRequestedFile(downloadURL,downloadFile); + } + } + + void downloadFile() + { + if(helperMethod.checkPermissions(context)){ + mSession.downloadRequestedFile(); + } + } + + /*Session Updates*/ + + void onUpdateSettings(){ + mSession.reload(); + } + + void onUpdateFont(){ + float font = (status.sFontSize -100)/4+100; + mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sFontAdjustable); + if(!mRuntime.getSettings().getAutomaticFontSizeAdjustment()){ + mRuntime.getSettings().setFontSizeFactor(font/100); + } + } + + + public class geckoViewClientCallback implements eventObserver.eventListener{ + @Override + public void invokeObserver(List data, enums.etype e_type) + { + if (mSessionID == (int)data.get(1)) + { + if (e_type.equals(on_handle_external_intent)) + { + GeckoSession.WebResponseInfo responseInfo = (GeckoSession.WebResponseInfo)data.get(0); + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.contentType); + context.startActivity(intent); + } else + { + event.invokeObserver(data, e_type); + } + } + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoDownloadManager.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoDownloadManager.java new file mode 100755 index 00000000..625ffb07 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoDownloadManager.java @@ -0,0 +1,58 @@ +package com.darkweb.genesissearchengine.appManager.homeManager; + +import android.Manifest; +import android.content.pm.PackageManager; +import android.net.Uri; +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.helperManager.eventObserver; +import org.mozilla.geckoview.GeckoSession; +import java.util.Arrays; + +class geckoDownloadManager +{ + private Uri downloadURL; + private String downloadFile = strings.EMPTY_STR; + + geckoDownloadManager(){ + + } + + void downloadFile(GeckoSession.WebResponseInfo 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(GeckoSession.WebResponseInfo 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; + } + + + downloadURL = Uri.parse(response.uri); + downloadFile = response.filename != null ? response.filename : downloadURL.getLastPathSegment(); + + event.invokeObserver(Arrays.asList(0,session.getSessionID()), enums.etype.progress_update); + event.invokeObserver(Arrays.asList(downloadFile,session.getSessionID(),downloadURL), 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/geckoPromptView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoPromptView.java new file mode 100755 index 00000000..1ed522fa --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoPromptView.java @@ -0,0 +1,963 @@ +package com.darkweb.genesissearchengine.appManager.homeManager; + +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.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.helperManager.PathUtil; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + +import java.net.URISyntaxException; +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.GeckoSession.PermissionDelegate.MediaSource; +import org.mozilla.geckoview.SlowScriptResponse; + +final class geckoPromptView implements GeckoSession.PromptDelegate { + protected static final String LOGTAG = "geckoPromptView"; + + private final Activity mActivity; + public int filePickerRequestCode = 1; + private int mFileType; + private GeckoResult mFileResponse; + private FilePrompt mFilePrompt; + + public geckoPromptView(final Activity 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; + } + + 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.setText(prompt.authOptions.username); + container.addView(username); + } else { + username = null; + } + + final EditText password = new EditText(builder.getContext()); + password.setHint(""); + 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("Dismiss", 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()); + } + + if(!helperMethod.checkPermissions((AppCompatActivity)mActivity)){ + 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; + } + + 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 || data.getData()==null) { + res.complete(prompt.dismiss()); + return; + } + + Uri uri = data.getData(); + + String filePath = null; + + filePath = PathUtil.getPath(mActivity.getApplicationContext(),uri); + + if (filePath==null) { + res.complete(prompt.dismiss()); + return; + } + + uri = Uri.parse("file://"+filePath); + + 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 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 MediaSource item = getItem(position); + ((TextView) view).setText(sourceNames != null ? sourceNames[position] : item.name); + } + 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 MediaSource[] video, final 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 MediaSource video = (videoSpinner != null) + ? (MediaSource) videoSpinner.getSelectedItem() : null; + final MediaSource audio = (audioSpinner != null) + ? (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 MediaSource[] video, final 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/geckoSession.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoSession.java new file mode 100755 index 00000000..2abc8b0d --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoSession.java @@ -0,0 +1,573 @@ +package com.darkweb.genesissearchengine.appManager.homeManager; + +import android.app.Notification; +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.PackageManager; +import android.content.pm.ResolveInfo; +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.widget.Toast; +import androidx.annotation.AnyThread; +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.enums; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.JavaScriptInterface; +import com.darkweb.genesissearchengine.helperManager.downloadFileService; +import com.darkweb.genesissearchengine.helperManager.errorHandler; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; +import org.mozilla.gecko.GeckoSystemStateListener; +import org.mozilla.gecko.GeckoThread; +import org.mozilla.geckoview.AllowOrDeny; +import org.mozilla.geckoview.GeckoResult; +import org.mozilla.geckoview.GeckoSession; +import org.mozilla.geckoview.WebRequestError; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Arrays; +import java.util.List; + +public class geckoSession extends GeckoSession implements GeckoSession.PermissionDelegate,GeckoSession.ProgressDelegate, GeckoSession.HistoryDelegate,GeckoSession.NavigationDelegate,GeckoSession.ContentDelegate +{ + private eventObserver.eventListener event; + + private int mSessionID; + private boolean mCanGoBack = false; + private boolean mCanGoForward = false; + private boolean mFullScreen = false; + private boolean isPageLoading = false; + private int mProgress = 0; + private String mCurrentTitle = strings.EMPTY_STR; + private String mCurrentURL = "about:blank"; + private Uri mUriPermission = null; + private AppCompatActivity mContext; + private geckoDownloadManager mDownloadManager; + + /*Temp Variables*/ + private GeckoSession.HistoryDelegate.HistoryList mHistoryList = null; + private int rateCount=0; + + geckoSession(eventObserver.eventListener event,int mSessionID,AppCompatActivity mContext){ + + this.mContext = mContext; + this.mSessionID = mSessionID; + setProgressDelegate(this); + setHistoryDelegate(this); + setNavigationDelegate(this); + setContentDelegate(this); + mDownloadManager = new geckoDownloadManager(); + setPromptDelegate(new geckoPromptView(mContext)); + + this.event = event; + } + + void onFileUploadRequest(int resultCode, Intent data){ + + geckoPromptView mPromptDelegate = (geckoPromptView)getPromptDelegate(); + mPromptDelegate.onFileCallbackResult(resultCode,data); + } + + void initURL(String url){ + isPageLoading = true; + mCurrentURL = url; + mCurrentTitle = mCurrentURL; + + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion); + if(!url.equals("about:blank")) + { + mProgress = 5; + event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update); + } + } + + /*Progress Delegate*/ + + @Override + public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) { + if(!isPageLoading){ + mCurrentURL = "about:blank"; + } + isPageLoading = true; + if(!var2.equals("about:blank")){ + mProgress = 5; + } + + } + + @AnyThread + public void shutdown() { + GeckoSystemStateListener.getInstance().shutdown(); + GeckoThread.forceQuit(); + } + + @UiThread + public void onPageStop(@NonNull GeckoSession var1, boolean var2) { + } + + @Override + public void onProgressChange(@NonNull GeckoSession session, int progress) + { + if(!mFullScreen){ + mProgress = progress; + event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update); + } + + if(progress>=100){ + isPageLoading = false; + } + } + + /*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); + event.invokeObserver(Arrays.asList(var2,mSessionID,mCurrentTitle), enums.etype.on_request_completed); + isPageLoading = false; + } + return null; + } + + @UiThread + public void onHistoryStateChange(@NonNull GeckoSession var1, @NonNull GeckoSession.HistoryDelegate.HistoryList var2) { + mHistoryList = var2; + } + + /*Navigation Delegate*/ + public void onLocationChange(@NonNull GeckoSession var1, @Nullable String var2) { + + String newUrl = var2.split("#")[0]; + if(!mCurrentURL.equals("about:blank")){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,newUrl), enums.etype.on_update_suggestion_url); + } + mCurrentURL = newUrl; + + if (var2 != null && !var2.equals("about:blank")) + { + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.start_proxy); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.search_update); + event.invokeObserver(Arrays.asList(null,mSessionID), enums.etype.on_page_loaded); + checkApplicationRate(); + } + } + + @Override + public void loadData(@NonNull byte[] var1, @Nullable String var2) { + } + + public GeckoResult onLoadRequest(@NonNull GeckoSession var2, @NonNull GeckoSession.NavigationDelegate.LoadRequest var1) { + if(var1.uri.contains("boogle.store/advert__")){ + event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.on_playstore_load); + return GeckoResult.fromValue(AllowOrDeny.DENY); + } + else if(var1.uri.equals("about:blank")){ + return GeckoResult.fromValue(AllowOrDeny.ALLOW); + } + else if(var1.target==2){ + event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.open_new_tab); + return GeckoResult.fromValue(AllowOrDeny.DENY); + } + else { + event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.start_proxy); + return GeckoResult.fromValue(AllowOrDeny.ALLOW); + } + } + + @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) { + errorHandler handler = new errorHandler(); + mProgress = 0; + event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error); + event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update); + return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code,mContext,var2)); + } + + /*Content Delegate*/ + @Override + public void onExternalResponse(@NonNull GeckoSession session, @NonNull GeckoSession.WebResponseInfo response) { + try { + event.invokeObserver(Arrays.asList(response,mSessionID), enums.etype.on_handle_external_intent); + } catch (ActivityNotFoundException e) { + mDownloadManager.downloadFile(response,this,mContext,event); + stop(); + } + } + + @UiThread + public void onTitleChange(@NonNull GeckoSession var1, @Nullable String var2) { + if(var2!=null && !var2.equals(strings.EMPTY_STR) && var2.length()>2 && !mCurrentURL.equals("about:blank")){ + mCurrentTitle = var2; + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion); + } + } + + @Override + public void onFullScreen(@NonNull GeckoSession var1, boolean var2) { + mFullScreen = var2; + event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_full_screen); + } + + public void onContextMenu(@NonNull GeckoSession var1, int var2, int var3, @NonNull GeckoSession.ContentDelegate.ContextElement var4) { + + String title = strings.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), enums.etype.on_long_press_with_link); + } + else { + event.invokeObserver(Arrays.asList(var4.srcUri,mSessionID,title), enums.etype.on_long_press); + } + } + else{ + event.invokeObserver(Arrays.asList(var4.linkUri,mSessionID,title), enums.etype.on_long_press_url); + } + } + + /*Download Manager*/ + + void downloadRequestedFile() + { + if(mDownloadManager.getDownloadURL()!=null && mDownloadManager.getDownloadFile()!=null){ + if(!createAndSaveFileFromBase64Url(mDownloadManager.getDownloadURL().toString())){ + mContext.startService(downloadFileService.getDownloadService(mContext, mDownloadManager.getDownloadURL()+"__"+mDownloadManager.getDownloadFile(), Environment.DIRECTORY_DOWNLOADS)); + } + } + } + + void downloadRequestedFile(Uri downloadURL,String downloadFile) + { + if(downloadURL!=null && downloadFile!=null){ + if(!createAndSaveFileFromBase64Url(downloadURL.toString())){ + mContext.startService(downloadFileService.getDownloadService(mContext, downloadURL + "__" + downloadFile, Environment.DIRECTORY_DOWNLOADS)); + } + } + } + + public boolean downloadBlobFile(String url){ + + try{ + File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); + + String filetype = ""; + String filename = ""; + + 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, + new String[]{file.toString()}, null, + new MediaScannerConnection.OnScanCompletedListener() { + public void onScanCompleted(String path, Uri uri) { + Log.i("ExternalStorage", "Scanned " + path + ":"); + 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); + intent.setDataAndType(Uri.fromFile(file), (mimetype + "/*")); + PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, 0); + + Notification notification = new NotificationCompat.Builder(mContext) + .setSmallIcon(R.xml.ic_download) + .setContentTitle(filename) + .setContentIntent(pIntent) + .build(); + + notification.flags |= Notification.FLAG_AUTO_CANCEL; + int notificationId = 85851; + NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); + notificationManager.notify(notificationId, notification); + } catch (IOException e) { + e.printStackTrace(); + } + + return true; + } + catch (Exception ignored){ + + } + + return true; + } + + private boolean createAndSaveFileFromBase64Url(String url) { + + if(!url.startsWith("data") && !url.startsWith("blob")){ + return false; + } + else if(url.startsWith("blob")){ + Toast toast = Toast.makeText(mContext.getApplicationContext(), + "Unable to download urls that contain prefix blob. Not Supported", + Toast.LENGTH_SHORT); + + toast.show(); + return true; + } + + try{ + File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); + + String filetype = ""; + String filename = ""; + + if(url.startsWith("blob")){ + loadUri(JavaScriptInterface.getBase64StringFromBlobUrl(url)); + 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, + 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(); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + intent.setAction(android.content.Intent.ACTION_VIEW); + intent.setDataAndType(Uri.fromFile(file), (mimetype + "/*")); + } else { + intent.setAction(android.content.Intent.ACTION_VIEW); + Uri uri_temp = FileProvider.getUriForFile(mContext,mContext.getString(R.string.file_provider_authority), file); + intent.setDataAndType(uri_temp, (mimetype + "/*")); + + List resInfoList = mContext.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); + for (ResolveInfo resolveInfo : resInfoList) { + String packageName = resolveInfo.activityInfo.packageName; + mUriPermission = uri_temp; + mContext.grantUriPermission(packageName, uri_temp, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); + } + } + PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, 0); + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + Notification notification = new NotificationCompat.Builder(mContext) + .setSmallIcon(R.xml.ic_download) + .setContentTitle(filename) + .setContentIntent(pIntent) + .build(); + + notification.flags |= Notification.FLAG_AUTO_CANCEL; + int notificationId = 85851; + NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); + notificationManager.notify(notificationId, notification); + } else { + + String channel_id = createNotificationChannel(mContext); + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext, channel_id) + .setSmallIcon(R.xml.ic_download) + .setContentTitle(filename) + .setContentIntent(pIntent); + + notificationBuilder.setAutoCancel(true); + + int notificationId = 85851; + NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); + notificationManager.notify(notificationId, notificationBuilder.build()); + } + + + } catch (IOException 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; + boolean channelEnableVibrate = true; + NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, channelImportance); + notificationChannel.setDescription(channelDescription); + notificationChannel.enableVibration(channelEnableVibrate); + NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); + assert notificationManager != null; + notificationManager.createNotificationChannel(notificationChannel); + return channelId; + } else { + return null; + } + } + + /*Helper Methods*/ + + public String getCurrentURL(){ + return mCurrentURL; + } + + public String getTitle(){ + return mCurrentTitle; + } + + int getProgress(){ + return mProgress; + } + + public void setTitle(String title){ + mCurrentTitle = title; + } + + boolean canGoBack(){ + return mCanGoBack; + } + + boolean canGoForward(){ + return mCanGoForward; + } + + public int getSessionID(){ + return mSessionID; + } + + void exitScreen(){ + this.exitFullScreen(); + } + + boolean getFullScreenStatus(){ + return !mFullScreen; + } + + public void closeSession(){ + event.invokeObserver(Arrays.asList(null,mSessionID), enums.etype.on_close_sesson); + } + + void goBackSession(){ + + if(mHistoryList!=null){ + int index = mHistoryList.getCurrentIndex()-1; + + if(mHistoryList!=null && index>=0 && index + { + goBack(); + }, 100); + } + } + else { + goBack(); + } + } + + void goForwardSession(){ + + if(mHistoryList!=null) + { + int index = mHistoryList.getCurrentIndex() + 1; + + if (mHistoryList != null && index >= 0 && index < mHistoryList.size()) + { + + event.invokeObserver(Arrays.asList(mHistoryList.get(index), mSessionID), enums.etype.start_proxy); + + new Handler().postDelayed(() -> + { + goForward(); + }, 100); + } + }else { + goForward(); + } + } + + boolean isLoading(){ + return isPageLoading; + } + + void setLoading(boolean status){ + isPageLoading = status; + } + + Uri getUriPermission(){ + return mUriPermission; + } + + private void checkApplicationRate(){ + if(rateCount==7){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.rate_application); + } + rateCount+=1; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java new file mode 100755 index 00000000..4c2cbf7d --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java @@ -0,0 +1,812 @@ +package com.darkweb.genesissearchengine.appManager.homeManager; + +import android.annotation.SuppressLint; +import android.app.DownloadManager; +import android.content.BroadcastReceiver; +import android.content.ComponentCallbacks2; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.res.Configuration; +import android.database.Cursor; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.MotionEvent; +import android.view.View; +import android.view.inputmethod.EditorInfo; +import android.webkit.URLUtil; +import android.widget.*; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.constraintlayout.widget.ConstraintLayout; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; +import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; +import com.darkweb.genesissearchengine.appManager.historyManager.historyController; +import com.darkweb.genesissearchengine.appManager.settingManager.settingController; +import com.darkweb.genesissearchengine.appManager.tabManager.tabController; +import com.darkweb.genesissearchengine.appManager.tabManager.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.appManager.orbotManager.orbotController; +import com.darkweb.genesissearchengine.helperManager.KeyboardUtils; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.example.myapplication.R; +import com.google.android.gms.ads.AdView; + +import org.mozilla.geckoview.GeckoView; +import org.torproject.android.service.util.Prefs; +import org.torproject.android.service.wrapper.LocaleHelper; +import org.torproject.android.service.wrapper.orbotLocalConstants; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.Callable; + +public class homeController extends AppCompatActivity implements ComponentCallbacks2 +{ + /*Model Declaration*/ + private homeViewController mHomeViewController; + private homeModel mHomeModel; + private geckoClients mGeckoClient = null; + + /*View Webviews*/ + private GeckoView mGeckoView = null; + private FrameLayout mWebViewContainer; + + /*View Objects*/ + private com.darkweb.genesissearchengine.widget.AnimatedProgressBar mProgressBar; + private ConstraintLayout mSplashScreen; + private AutoCompleteTextView mSearchbar; + private ImageView mLoadingIcon; + private TextView mLoadingText; + private AdView mBannerAds = null; + private ImageView mEngineLogo; + private ImageButton mGatewaySplash; + private ImageButton mSwitchEngineBack; + private LinearLayout mTopBar; + private ImageView mBackSplash; + private Button mConnectButton; + private Button mNewTab; + + /*Redirection Objects*/ + private boolean mPageClosed = false; + private boolean isKeyboardOpened = false; + private boolean isSuggestionChanged = false; + + /*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/ + + @Override + protected void onCreate(Bundle savedInstanceState) + { + if(helperMethod.isBuildValid()) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.home_view); + initPreFixes(); + pluginController.getInstance().preInitialize(this); + databaseController.getInstance().initialize(this); + dataController.getInstance().initialize(this); + activityContextManager.getInstance().setHomeController(this); + pluginController.getInstance().initializeAllServices(this); + status.initStatus(); + dataController.getInstance().initializeListData(); + initializeAppModel(); + initializeAppModel(); + initializeConnections(); + pluginController.getInstance().initialize(); + initializeGeckoView(savedInstanceState == null); + initializeLocalEventHandlers(); + } + else { + super.onCreate(savedInstanceState); + setContentView(R.layout.invalid_setup_view); + pluginController.getInstance().initializeWithAbiError(); + pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.EMPTY_STR),enums.etype.abi_error); + } + } + + public void ignoreAbiError(){ + + } + + public void onClose(){ + mGeckoClient.onClose(); + } + + public void initializeAppModel() + { + mHomeViewController = new homeViewController(); + mHomeModel = new homeModel(); + } + + public void initializeConnections() + { + mGeckoView = findViewById(R.id.webLoader); + + mProgressBar = findViewById(R.id.progressBar); + mSplashScreen = findViewById(R.id.splashScreen); + mSearchbar = findViewById(R.id.search); + mLoadingIcon = findViewById(R.id.imageView_loading_back); + mLoadingText = findViewById(R.id.loadingText); + mWebViewContainer = findViewById(R.id.webviewContainer); + mBannerAds = findViewById(R.id.adView); + mEngineLogo = findViewById(R.id.switchEngine); + mGatewaySplash = findViewById(R.id.gateway_splash); + mTopBar = findViewById(R.id.topbar); + mBackSplash = findViewById(R.id.backsplash); + mConnectButton = findViewById(R.id.Connect); + mNewTab = findViewById(R.id.newButtonInvoke); + + mGeckoView.setSaveEnabled(false); + mGeckoView.setSaveFromParentEnabled(false); + + mGeckoClient = new geckoClients(); + boolean is_engine_switched = dataController.getInstance().getBool(keys.ENGINE_SWITCHED,false); + + mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,dataController.getInstance().getSuggestions(), mEngineLogo, mGatewaySplash, mTopBar, mGeckoView, mBackSplash,is_engine_switched, mConnectButton, mSwitchEngineBack); + } + + public void initPreFixes() { + try { + Class clazz = Class.forName("java.lang.Daemons$FinalizerWatchdogDaemon"); + + Method method = 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){ + mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,isForced); + onSaveCurrentTab(mGeckoClient.getSession(),false); + mHomeViewController.initTab(dataController.getInstance().getTotalTabs()); + } + + public void initTab(){ + onNewTab(false); + mHomeViewController.initTab(dataController.getInstance().getTotalTabs()); + } + + @Override + protected void attachBaseContext(Context base) { + Prefs.setContext(base); + orbotLocalConstants.sHomeContext = new WeakReference<>(base); + + super.attachBaseContext(LocaleHelper.onAttach(base, Prefs.getDefaultLocale())); + } + + /*-------------------------------------------------------Helper Methods-------------------------------------------------------*/ + + public void onLoadFont(){ + mGeckoClient.onUpdateFont(); + mHomeViewController.onReDraw(); + } + + public void onLoadProxy(View view){ + if(pluginController.getInstance().isInitialized() && !mPageClosed){ + pluginController.getInstance().logEvent(strings.GATEWAY_OPENED); + helperMethod.openActivity(orbotController.class, constants.LIST_HISTORY, homeController.this,true); + } + } + + public void onUpdateJavascript(){ + mGeckoView.clearFocus(); + mGeckoClient.updateJavascript(); + } + + public void onUpdateCookies(){ + mGeckoView.clearFocus(); + mGeckoClient.updateCookies(); + } + + public void onLoadURL(String url){ + mHomeViewController.onClearSelections(true); + mGeckoClient.loadURL(url.replace("genesis.onion","boogle.sts~>ore")); + } + + public void onLoadTab(geckoSession mTempSession,boolean isSessionClosed){ + if(!isSessionClosed){ + dataController.getInstance().moveTabToTop(mTempSession); + } + + mHomeViewController.onUpdateSearchBar(mTempSession.getCurrentURL()); + if(mTempSession.getProgress()>0 && mTempSession.getProgress()<100){ + mHomeViewController.onProgressBarUpdate(mTempSession.getProgress()); + }else { + mHomeViewController.progressBarReset(); + } + + mGeckoView.releaseSession(); + mGeckoView.setSession(mTempSession); + mGeckoClient.initSession(mTempSession); + mHomeViewController.onClearSelections(false); + + } + + /*-------------------------------------------------------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); + } + } + }; + + @Override + public void onDestroy() { + super.onDestroy(); + try{ + unregisterReceiver(downloadStatus); + }catch (Exception ignored){} + } + + @SuppressLint("ClickableViewAccessibility") + private void initializeLocalEventHandlers() { + + registerReceiver(downloadStatus,new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); + + mSearchbar.setOnEditorActionListener((v, actionId, event) -> + { + if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE) + { + helperMethod.hideKeyboard(homeController.this); + mGeckoClient.setLoading(true); + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + pluginController.getInstance().logEvent(strings.SEARCH_INVOKED); + onSearchBarInvoked(v); + mGeckoView.clearFocus(); + }, 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.setOnFocusChangeListener((v, hasFocus) -> { + if(hasFocus) + { + helperMethod.hideKeyboard(homeController.this); + status.sIsAppStarted = true; + pluginController.getInstance().onResetMessage(); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL()); + } + }); + + mSearchbar.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) { + } + }); + + mSearchbar.setOnFocusChangeListener((v, hasFocus) -> { + if(!hasFocus) + { + if(!mGeckoClient.isLoading()){ + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL()); + } + if(isSuggestionChanged){ + isSuggestionChanged = false; + mHomeViewController.initializeSuggestionView(dataController.getInstance().getSuggestions()); + } + } + }); + pluginController.getInstance().logEvent(strings.APP_STARTED); + + KeyboardUtils.addKeyboardToggleListener(this, isVisible -> isKeyboardOpened = isVisible); + } + + void onSearchBarInvoked(View view){ + String url = ((EditText)view).getText().toString(); + String validated_url = mHomeModel.urlComplete(url); + if(validated_url!=null){ + url = validated_url; + } + mHomeViewController.onUpdateSearchBar(url); + onLoadURL(url); + } + + public void onSuggestionInvoked(View view){ + String val = ((TextView)view.findViewById(R.id.hintCompletionUrl)).getText().toString(); + mSearchbar.clearFocus(); + mHomeViewController.onUpdateSearchBar(val); + onLoadURL(val); + } + + public void onHomeButton(View view){ + pluginController.getInstance().logEvent(strings.HOME_INVOKED); + onLoadURL(mHomeModel.getSearchEngine()); + mHomeViewController.onUpdateLogo(); + } + + public void onNewTab(boolean isKeyboardOpenedTemp){ + initializeGeckoView(true); + onLoadURL("about:blank"); + mHomeViewController.progressBarReset(); + mHomeViewController.onNewTab(true,isKeyboardOpenedTemp); + mHomeViewController.onSessionChanged(); + } + + public void onOpenTabView(View view){ + helperMethod.openActivity(tabController.class, constants.LIST_HISTORY, homeController.this,true); + } + + public void onNotificationInvoked(String message,enums.etype e_type){ + mHomeViewController.downloadNotification(message,e_type); + } + + public void onOpenMenuItem(View view){ + pluginController.getInstance().logEvent(strings.MENU_INVOKED); + status.sIsAppStarted = true; + pluginController.getInstance().onResetMessage(); + mHomeViewController.onOpenMenu(view,mGeckoClient.canGoBack(),mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() ==View.INVISIBLE)); + } + + @Override + public void onBackPressed(){ + pluginController.getInstance().logEvent(strings.ON_BACK); + mGeckoView.clearFocus(); + mSearchbar.clearFocus(); + if(mGeckoClient.getFullScreenStatus()){ + mGeckoClient.onBackPressed(true); + mHomeViewController.onClearSelections(true); + } + else { + mGeckoClient.onExitFullScreen(); + } + } + + public void onSwitchSearch(View view){ + mHomeViewController.stopSearchButtonAnimation(); + dataController.getInstance().setBool(keys.ENGINE_SWITCHED,true); + pluginController.getInstance().logEvent(strings.SEARCH_SWITCH); + + if(status.sSearchStatus.equals(constants.BACKEND_GOOGLE_URL)) + { + status.sSearchStatus = constants.BACKEND_GENESIS_URL; + mHomeViewController.onUpdateLogo(); + dataController.getInstance().setString(keys.SEARCH_ENGINE,constants.BACKEND_GENESIS_URL); + onHomeButton(null); + } + else if(status.sSearchStatus.equals(constants.BACKEND_GENESIS_URL)) + { + status.sSearchStatus = constants.BACKEND_DUCK_DUCK_GO_URL; + if(pluginController.getInstance().isOrbotRunning()) + { + mHomeViewController.onUpdateLogo(); + dataController.getInstance().setString(keys.SEARCH_ENGINE,constants.BACKEND_DUCK_DUCK_GO_URL); + onHomeButton(null); + } + else { + pluginController.getInstance().MessageManagerHandler(homeController.this, Collections.singletonList(constants.BACKEND_DUCK_DUCK_GO_URL),enums.etype.start_orbot); + } + } + else + { + status.sSearchStatus = constants.BACKEND_GOOGLE_URL; + if(pluginController.getInstance().isOrbotRunning()) + { + mHomeViewController.onUpdateLogo(); + dataController.getInstance().setString(keys.SEARCH_ENGINE,constants.BACKEND_GOOGLE_URL); + onHomeButton(null); + } + else { + pluginController.getInstance().MessageManagerHandler(homeController.this,Collections.singletonList(constants.BACKEND_GOOGLE_URL),enums.etype.start_orbot); + } + } + } + + /*Activity States*/ + + public void onReload(View view){ + mHomeViewController.onUpdateLogo(); + } + + public void onClearSession(){ + mGeckoClient.onClearSession(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + pluginController.getInstance().onResetMessage(); + mHomeViewController.closeMenu(); + + 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,pluginController.getInstance().isAdvertLoaded()); + } + } + + } + + @Override + public void onResume() + { + activityContextManager.getInstance().setCurrentActivity(this); + if (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); + } + super.onResume(); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data){ + if(requestCode==1){ + mGeckoClient.onUploadRequest(resultCode,data); + } + else { + super.onActivityResult(requestCode, resultCode, data); + } + } + + @Override + public void onPause(){ + super.onPause(); + if(mHomeViewController!=null){ + mHomeViewController.closeMenu(); + helperMethod.hideKeyboard(this); + } + pluginController.getInstance().onResetMessage(); + } + + public void onSetBannerAdMargin(){ + mHomeViewController.onSetBannerAdMargin(true,pluginController.getInstance().isAdvertLoaded()); + } + + /*-------------------------------------------------------External Callback Methods-------------------------------------------------------*/ + + public void onSuggestionUpdate(){ + if(!mSearchbar.isFocused()){ + mHomeViewController.initializeSuggestionView(dataController.getInstance().getSuggestions()); + }else { + isSuggestionChanged = true; + } + } + + public void onStartApplication(View view){ + pluginController.getInstance().initializeOrbot(); + onInvokeProxyLoading(); + mHomeViewController.initHomePage(); + } + + public void onDownloadFile(){ + mGeckoClient.downloadFile(); + } + + public void onManualDownload(String url){ + + /*EXTERNAL STORAGE REQUEST*/ + mGeckoClient.manual_download(url,this); + } + + public AdView getBannerAd() + { + return mBannerAds; + } + + public void onInvokeProxyLoading(){ + + Callable callable = () -> { + mHomeViewController.onUpdateLogs(pluginController.getInstance().orbotLogs()); + return strings.EMPTY_STR; + }; + + mHomeViewController.initProxyLoading(callable); + } + + public void onOpenLinkNewTab(String url){ + initializeGeckoView(true); + mHomeViewController.progressBarReset(); + mHomeViewController.onNewTab(false,isKeyboardOpened); + mHomeViewController.onUpdateSearchBar(url); + mGeckoClient.loadURL(url); + } + + public void onSaveCurrentTab(geckoSession session,boolean isHardCopy){ + dataController.getInstance().addTab(session,isHardCopy); + } + + public boolean onCloseCurrentTab(geckoSession session){ + dataController.getInstance().closeTab(session); + tabRowModel model = dataController.getInstance().getCurrentTab(); + + session.stop(); + session.close(); + initTabCount(); + + if(model!=null){ + onLoadTab(model.getSession(),true); + return true; + } + else { + return false; + } + } + + public void initTabCount(){ + mHomeViewController.initTab(dataController.getInstance().getTotalTabs()); + } + + public void releaseSession(){ + mGeckoView.releaseSession(); + } + + public void loadExistingTab() + { + tabRowModel model = dataController.getInstance().getCurrentTab(); + if (model != null) + { + onLoadTab(model.getSession(), true); + } + } + + /*-------------------------------------------------------CALLBACKS-------------------------------------------------------*/ + + 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); + } + else if (menuId == R.id.menu10) { + if(!onCloseCurrentTab(mGeckoClient.getSession())){ + onNewTab(isKeyboardOpened); + } + } + else { + helperMethod.hideKeyboard(this); + mSearchbar.clearFocus(); + if (menuId == R.id.menu9) { + helperMethod.openActivity(tabController.class, constants.LIST_HISTORY, homeController.this,true); + } + else if (menuId == R.id.menu8) { + onOpenDownloadFolder(null); + } + else if (menuId == R.id.menu7) { + helperMethod.openActivity(historyController.class, constants.LIST_HISTORY, homeController.this,true); + } + else if (menuId == R.id.menu6) + { + helperMethod.openActivity(settingController.class,constants.LIST_HISTORY, homeController.this,true); + } + else if (menuId == R.id.menu5) + { + pluginController.getInstance().MessageManagerHandler(homeController.this, Collections.singletonList(mSearchbar.getText().toString()),enums.etype.bookmark); + } + else if (menuId == R.id.menu4) + { + helperMethod.openActivity(bookmarkController.class,constants.LIST_BOOKMARK, homeController.this,true); + } + else if (menuId == R.id.menu3) + { + pluginController.getInstance().MessageManagerHandler(homeController.this,null,enums.etype.report_url); + } + else if (menuId == R.id.menu2) + { + dataController.getInstance().setBool(keys.IS_APP_RATED,true); + status.sIsAppRated = true; + pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.EMPTY_STR), enums.etype.rate_app); + } + else if (menuId == R.id.menu1) + { + helperMethod.shareApp(homeController.this); + } + if (menuId == R.id.menu20) { + mGeckoClient.onStop(); + } + if (menuId == R.id.menu21) { + mGeckoClient.onReload(); + } + if (menuId == R.id.menu22) { + mGeckoClient.onForwardPressed(); + } + if (menuId == R.id.menu23) { + mGeckoClient.onBackPressed(false); + } + if (menuId == R.id.menu24) { + onHomeButton(view); + } + } + mHomeViewController.closeMenu(); + } + + public class homeViewCallback implements eventObserver.eventListener{ + + @Override + public void invokeObserver(List data, enums.etype e_type) + { + if(e_type.equals(enums.etype.download_folder)) + { + onOpenDownloadFolder(null); + } + if(e_type.equals(enums.etype.on_init_ads)) + { + mHomeViewController.onSetBannerAdMargin((boolean)data.get(0),pluginController.getInstance().isAdvertLoaded()); + } + else if(e_type.equals(enums.etype.on_url_load)){ + mHomeViewController.onUpdateLogs("Starting | Genesis Search"); + onLoadURL(data.get(0).toString()); + } + else if(e_type.equals(enums.etype.recheck_orbot)){ + pluginController.getInstance().isOrbotRunning(); + } + + } + } + + String dataToStr(Object data,String defaultVal){ + if(data==null){ + return defaultVal; + } + else { + return data.toString(); + } + } + + String dataToStr(Object data){ + if(data==null){ + return strings.EMPTY_STR; + } + else { + return data.toString(); + } + } + + + public class geckoViewCallback implements eventObserver.eventListener{ + + @Override + public void invokeObserver(List data, enums.etype e_type) + { + if(e_type.equals(enums.etype.progress_update)){ + mHomeViewController.onProgressBarUpdate((int)data.get(0)); + } + else if(e_type.equals(enums.etype.on_url_load)){ + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mSearchbar.getText().toString())); + } + else if(e_type.equals(enums.etype.back_list_empty)){ + if(dataController.getInstance().getTotalTabs()>1){ + if(!onCloseCurrentTab(mGeckoClient.getSession())){ + onNewTab(false); + } + }else { + helperMethod.onMinimizeApp(homeController.this); + } + } + else if(e_type.equals(enums.etype.start_proxy)){ + pluginController.getInstance().setProxy(dataToStr(data.get(0))); + } + else if(e_type.equals(enums.etype.on_request_completed)){ + dataController.getInstance().addHistory(data.get(0).toString(),data.get(2).toString()); + } + else if(e_type.equals(enums.etype.on_update_suggestion)){ + dataController.getInstance().addSuggesion(data.get(0).toString(),data.get(2).toString()); + } + else if(e_type.equals(enums.etype.on_page_loaded)){ + pluginController.getInstance().logEvent(strings.PAGE_OPENED_SUCCESS); + dataController.getInstance().setBool(keys.IS_BOOTSTRAPPED,true); + mHomeViewController.onPageFinished(); + if(status.sIsWelcomeEnabled && !status.sIsAppStarted){ + final Handler handler = new Handler(); + Runnable runnable = () -> + { + if(!status.sIsAppStarted){ + pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.EMPTY_STR), enums.etype.welcome); + } + status.sIsAppStarted = true; + }; + handler.postDelayed(runnable, 1300); + }else { + pluginController.getInstance().initializeBannerAds(); + } + } + else if(e_type.equals(enums.etype.rate_application)){ + if(!status.sIsAppRated){ + dataController.getInstance().setBool(keys.IS_APP_RATED,true); + status.sIsAppRated = true; + pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.EMPTY_STR), enums.etype.rate_app); + } + } + else if(e_type.equals(enums.etype.on_load_error)){ + mHomeViewController.onPageFinished(); + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mSearchbar.getText().toString())); + } + else if(e_type.equals(enums.etype.search_update)){ + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mSearchbar.getText().toString())); + } + else if(e_type.equals(enums.etype.download_file_popup)){ + pluginController.getInstance().MessageManagerHandler(homeController.this,Collections.singletonList(dataToStr(data.get(0))),enums.etype.download_file); + } + else if(e_type.equals(enums.etype.on_full_screen)){ + boolean status = (Boolean)data.get(0); + mHomeViewController.onFullScreenUpdate(status); + } + else if(e_type.equals(enums.etype.on_long_press_with_link)){ + pluginController.getInstance().MessageManagerHandler(homeController.this, Arrays.asList(dataToStr(data.get(0)),dataToStr(data.get(2)),dataToStr(data.get(3))),enums.etype.on_long_press_with_link); + } + else if(e_type.equals(enums.etype.on_long_press)){ + pluginController.getInstance().MessageManagerHandler(homeController.this,Arrays.asList(dataToStr(data.get(0)),dataToStr(data.get(2))),enums.etype.download_file_long_press); + } + else if(e_type.equals(enums.etype.on_long_press_url)){ + pluginController.getInstance().MessageManagerHandler(homeController.this,Arrays.asList(dataToStr(data.get(0)),dataToStr(data.get(2))),enums.etype.on_long_press_url); + } + else if(e_type.equals(enums.etype.open_new_tab)){ + onOpenLinkNewTab(dataToStr(data.get(0))); + } + else if(e_type.equals(enums.etype.on_close_sesson)){ + if(!onCloseCurrentTab(mGeckoClient.getSession())){ + onNewTab(false); + } + } + 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_suggestion_url)){ + dataController.getInstance().updateSuggestionURL(dataToStr(data.get(0)),dataToStr(data.get(2))); + } + } + } +} + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeModel.java new file mode 100755 index 00000000..f524cd2a --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeModel.java @@ -0,0 +1,46 @@ +package com.darkweb.genesissearchengine.appManager.homeManager; + +import android.util.Patterns; + +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + +import java.net.URL; + +class homeModel +{ + + String getSearchEngine(){ + return status.sSearchStatus; + } + + String urlComplete(String url){ + try + { + String updateUrl = helperMethod.completeURL(url); + URL host = new URL(updateUrl); + boolean isUrlValid = Patterns.WEB_URL.matcher(updateUrl).matches(); + if(isUrlValid && host.getHost().replace("www.","").contains(".")) + { + return null; + } + } + + catch (Exception ex){ + ex.printStackTrace(); + } + + if(status.sSearchStatus.equals(constants.BACKEND_GOOGLE_URL)){ + return getSearchEngine()+"search?q="+url.replaceAll(" ","+"); + } + else if(status.sSearchStatus.equals(constants.BACKEND_GENESIS_URL)){ + return getSearchEngine()+"/search?s_type=all&p_num=1&q="+url.replaceAll(" ","+"); + } + else{ + return getSearchEngine()+"?q="+url.replaceAll(" ","+"); + } + } + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java new file mode 100755 index 00000000..52988033 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java @@ -0,0 +1,665 @@ +package com.darkweb.genesissearchengine.appManager.homeManager; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; +import android.animation.ValueAnimator; +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.pm.ActivityInfo; +import android.content.res.Resources; +import android.graphics.Color; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.os.Build; +import android.os.Handler; +import android.os.Message; +import android.util.Log; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewOutlineProvider; +import android.view.Window; +import android.view.WindowManager; +import android.view.animation.DecelerateInterpolator; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodManager; +import android.widget.*; +import androidx.annotation.RequiresApi; +import androidx.appcompat.app.AppCompatActivity; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.core.content.ContextCompat; +import com.daimajia.androidanimations.library.Techniques; +import com.daimajia.androidanimations.library.YoYo; +import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; +import com.darkweb.genesissearchengine.constants.*; +import com.darkweb.genesissearchengine.helperManager.animatedColor; +import com.darkweb.genesissearchengine.helperManager.autoCompleteAdapter; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; +import com.google.android.gms.ads.AdSize; +import com.google.android.gms.ads.AdView; +import org.mozilla.geckoview.GeckoView; +import org.torproject.android.service.wrapper.orbotLocalConstants; +//import org.torproject.android.service.wrapper.orbotLocalConstants; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Objects; +import java.util.concurrent.Callable; +import static android.content.Context.LAYOUT_INFLATER_SERVICE; +import static androidx.appcompat.widget.ListPopupWindow.WRAP_CONTENT; + +class homeViewController +{ + /*ViewControllers*/ + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + + /*ViewControllers*/ + private FrameLayout mWebviewContainer; + private com.darkweb.genesissearchengine.widget.AnimatedProgressBar mProgressBar; + private AutoCompleteTextView mSearchbar; + private ConstraintLayout mSplashScreen; + private ImageView mLoading; + private TextView mLoadingText; + private AdView mBannerAds = null; + private Handler mUpdateUIHandler = null; + private ImageView mEngineLogo; + private ImageButton mSwitchEngineBack; + private ImageButton mGatewaySplash; + private LinearLayout mTopBar; + private GeckoView mGeckoView; + private ImageView mBackSplash; + private Button mConnectButton; + private Button mNewTab; + private PopupWindow popupWindow = null; + + /*Local Variables*/ + private ValueAnimator mEngineAnimator = null; + private Callable mLogs = null; + private boolean isLandscape = false; + private boolean disableSplash = false; + + void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, FrameLayout webviewContainer, TextView loadingText, com.darkweb.genesissearchengine.widget.AnimatedProgressBar progressBar, AutoCompleteTextView searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ArrayList suggestions, ImageView engineLogo, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, boolean is_triggered, Button connect_button, ImageButton switch_engine_back){ + this.mContext = context; + this.mProgressBar = progressBar; + this.mSearchbar = searchbar; + this.mSplashScreen = splashScreen; + this.mLoading = loading; + this.mLoadingText = loadingText; + this.mWebviewContainer = webviewContainer; + this.mBannerAds = banner_ads; + this.mEvent = event; + this.mEngineLogo = engineLogo; + this.mGatewaySplash = gateway_splash; + this.mTopBar = top_bar; + this.mGeckoView = gecko_view; + this.mBackSplash = backsplash; + this.mConnectButton = connect_button; + //this.mSwitchEngineBack = switch_engine_back; + this.mNewTab = mNewTab; + this.popupWindow = null; + + initSplashScreen(); + initializeSuggestionView(suggestions); + initLock(); + initSearchImage(); + createUpdateUiHandler(); + initSearchButtonAnimation(is_triggered); + initTopBar(); + } + + private void initTopBar(){ + } + + private void initSearchImage(){ + if(status.sSearchStatus.equals(constants.BACKEND_GENESIS_URL)) + { + mEngineLogo.setImageResource(R.drawable.duck_logo); + } + else if(status.sSearchStatus.equals(constants.BACKEND_DUCK_DUCK_GO_URL)) + { + mEngineLogo.setImageResource(R.drawable.google_logo); + } + else + { + mEngineLogo.setImageResource(R.drawable.genesis_logo); + } + } + + void initTab(int count){ + mNewTab.setText(count+strings.EMPTY_STR); + + YoYo.with(Techniques.FlipInX) + .duration(450) + .repeat(0) + .playOn(mNewTab); + } + + private void initSearchButtonAnimation(boolean is_triggered){ + if(!is_triggered){ + //mEngineAnimator = ValueAnimator.ofFloat(0.3f, 1); + //mEngineAnimator.addUpdateListener(animation -> mSwitchEngineBack.setAlpha((Float) animation.getAnimatedValue())); + //mEngineAnimator.setDuration(1000); + //mEngineAnimator.setRepeatCount(ValueAnimator.INFINITE); + //mEngineAnimator.setRepeatMode(ValueAnimator.REVERSE); + //mEngineAnimator.start(); + } + } + + void stopSearchButtonAnimation(){ + if(mEngineAnimator !=null){ + //mEngineAnimator.end(); + //TypedValue outValue = new TypedValue(); + //mContext.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true); + //mEngineLogo.setBackgroundResource(outValue.resourceId); + //mEngineAnimator = null; + } + } + + private void initPostUI(boolean isSplash){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + if(isSplash){ + window.setStatusBarColor(mContext.getResources().getColor(R.color.ease_blue)); + } + else{ + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + } + else { + initStatusBarColor(); + } + } + } + } + + + + @RequiresApi(api = Build.VERSION_CODES.M) + private void initStatusBarColor() { + animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.ease_blue), ContextCompat.getColor(mContext, R.color.black_blue)); + animatedColor twoToThree = new animatedColor(ContextCompat.getColor(mContext, R.color.ease_blue), ContextCompat.getColor(mContext, R.color.ease_blue_light)); + animatedColor ThreeToFour = new animatedColor(ContextCompat.getColor(mContext, R.color.ease_blue_light), ContextCompat.getColor(mContext, R.color.white)); + + ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f).setDuration(0); + animator.addUpdateListener(animation -> + { + float v = (float) animation.getAnimatedValue(); + mContext.getWindow().setStatusBarColor(oneToTwo.with(v)); + mContext.getWindow().setStatusBarColor(oneToTwo.with(v)); + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark + }); + animator.start(); + + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + final ValueAnimator animator2 = ObjectAnimator.ofFloat(0f, 1f).setDuration(217); + animator2.addUpdateListener(animation1 -> + { + float v = (float) animation1.getAnimatedValue(); + mContext.getWindow().setStatusBarColor(twoToThree.with(v)); + }); + animator2.start(); + + animator2.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + final ValueAnimator animator3 = ObjectAnimator.ofFloat(0f, 1f).setDuration(0); + animator3.addUpdateListener(animation1 -> + { + float v = (float) animation1.getAnimatedValue(); + mContext.getWindow().setStatusBarColor(ThreeToFour.with(v)); + + }); + animator3.start(); + } + }); + animator2.start(); + + } + }); + animator.start(); + + } + + private void initLock(){ + Drawable img = mContext.getResources().getDrawable( R.drawable.icon_lock); + mSearchbar.measure(0, 0); + img.setBounds( 0, (int)(mSearchbar.getMeasuredHeight()*0.00), (int)(mSearchbar.getMeasuredHeight()*1.10), (int)(mSearchbar.getMeasuredHeight()*0.69) ); + mSearchbar.setCompoundDrawables( img, null, null, null ); + } + + void initializeSuggestionView(ArrayList suggestions){ + + if(mSearchbar.isFocused()){ + return; + } + + + autoCompleteAdapter suggestionAdapter = new autoCompleteAdapter(mContext, R.layout.hint_view, (ArrayList) suggestions.clone()); + + int width = Math.round(helperMethod.screenWidth()); + mSearchbar.setThreshold(2); + mSearchbar.setAdapter(suggestionAdapter); + mSearchbar.setDropDownVerticalOffset(helperMethod.pxFromDp(8)); + mSearchbar.setDropDownWidth(width); + mSearchbar.setDropDownHeight(WRAP_CONTENT); + + Drawable drawable; + Resources res = mContext.getResources(); + try { + drawable = Drawable.createFromXml(res, res.getXml(R.xml.sc_rounded_corner_suggestion)); + mSearchbar.setDropDownBackgroundDrawable(drawable); + mSearchbar.setOutlineProvider(ViewOutlineProvider.BACKGROUND); + mSearchbar.setClipToOutline(true); + } catch (Exception ignored) { + } + mSearchbar.setInputType(EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS); + } + + private void initSplashLoading(){ + + mLoading.setAnimation(helperMethod.getRotationAnimation()); + mLoading.setLayoutParams(helperMethod.getCenterScreenPoint(mLoading.getLayoutParams())); + mLoading.setAnimation(helperMethod.getRotationAnimation()); + mLoading.setLayoutParams(helperMethod.getCenterScreenPoint(mLoading.getLayoutParams())); + mLoadingText.setVisibility(View.VISIBLE); + + mConnectButton.setVisibility(View.GONE); + mGatewaySplash.setVisibility(View.GONE); + + } + + void initHomePage(){ + mConnectButton.setClickable(false); + mGatewaySplash.setClickable(false); + + mConnectButton.animate().setDuration(300).alpha(0f).withEndAction((() -> initSplashLoading())); + mGatewaySplash.animate().setDuration(300).alpha(0f); + } + + private void initSplashScreen(){ + mSearchbar.setEnabled(false); + helperMethod.hideKeyboard(mContext); + initPostUI(true); + + mBackSplash.getLayoutParams().height = helperMethod.getScreenHeight(mContext) - helperMethod.getStatusBarHeight(mContext)*2; + mSearchbar.setEnabled(false); + + View root = mSearchbar.getRootView(); + root.setBackgroundColor(ContextCompat.getColor(mContext, R.color.dark_purple)); + } + + void initProxyLoading(Callable logs){ + this.mLogs = logs; + + if(mSplashScreen.getAlpha()==1){ + new Thread(){ + public void run(){ + AppCompatActivity temp_context = mContext; + while (!orbotLocalConstants.sIsTorInitialized){ + try + { + sleep(1000); + mEvent.invokeObserver(Collections.singletonList(status.sSearchStatus), enums.etype.recheck_orbot); + if(temp_context.isDestroyed()){ + return; + } + startPostTask(messages.UPDATE_LOADING_TEXT); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + startPostTask(messages.ON_URL_LOAD); + } + }.start(); + } + } + + /*-------------------------------------------------------PAGE UI Methods-------------------------------------------------------*/ + + void onPageFinished(){ + mSearchbar.setEnabled(true); + mProgressBar.bringToFront(); + + if(mSplashScreen.getVisibility()!=View.GONE){ + mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER);//Set Portrait + } + splashScreenDisable(); + } + private void splashScreenDisable(){ + mTopBar.setAlpha(1); + if(mSplashScreen.getAlpha()>=1) + { + disableSplash = true; + mSplashScreen.animate().setDuration(300).alpha(0).withEndAction((() -> mSplashScreen.setVisibility(View.GONE))); + mProgressBar.animate().setStartDelay(250).alpha(1); + initPostUI(false); + } + } + + /*-------------------------------------------------------Helper Methods-------------------------------------------------------*/ + + void onOpenMenu(View view,boolean canGoForward,boolean canGoBack,boolean isLoading){ + + if(popupWindow!=null){ + popupWindow.dismiss(); + } + + LayoutInflater layoutInflater + = (LayoutInflater) mContext + .getSystemService(LAYOUT_INFLATER_SERVICE); + final View popupView = layoutInflater.inflate(R.layout.popup_menu, null); + + + int height = 0; + + 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); + } + popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.END,0,0); + + ImageButton back = popupView.findViewById(R.id.menu22); + ImageButton forward = popupView.findViewById(R.id.menu23); + ImageButton close = popupView.findViewById(R.id.menu20); + + if(!canGoForward){ + forward.setColorFilter(Color.argb(255, 191, 191, 191)); + forward.setEnabled(false); + } + if(!canGoBack){ + back.setEnabled(false); + back.setColorFilter(Color.argb(255, 191, 191, 191)); + } + if(!isLoading){ + close.setEnabled(false); + close.setColorFilter(Color.argb(255, 191, 191, 191)); + } + + } + + void downloadNotification(String message, enums.etype e_type){ + + if(popupWindow!=null){ + popupWindow.dismiss(); + } + + LayoutInflater layoutInflater + = (LayoutInflater) mContext + .getSystemService(LAYOUT_INFLATER_SERVICE); + assert layoutInflater != null; + 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.sSearchStatus), e_type); + popupWindow.dismiss(); + }); + + popupWindow.showAtLocation(parent, Gravity.BOTTOM|Gravity.START,0,-10); + } + + void closeMenu(){ + if(popupWindow!=null){ + popupWindow.dismiss(); + } + } + + public void setOrientation(boolean status){ + isLandscape = status; + } + + void onSetBannerAdMargin(boolean status,boolean isAdLoaded){ + if(isAdLoaded){ + if(status && !isLandscape){ + mWebviewContainer.setPadding(0,AdSize.SMART_BANNER.getHeightInPixels(mContext),0,0); + mBannerAds.setVisibility(View.VISIBLE); + mBannerAds.animate().setDuration(500).alpha(1f); + }else{ + mWebviewContainer.setPadding(0,0,0,0); + mBannerAds.setVisibility(View.GONE); + } + } + } + + void onUpdateSearchBar(String url){ + + if (mSearchbar == null || mSearchbar.isFocused() || url==null) + { + return; + } + + url = url.replace("boogle.store","genesis.onion"); + boolean isTextSelected = false; + + if(mSearchbar.isSelected()){ + isTextSelected = true; + } + + if(url.length()<=300){ + mSearchbar.setText(helperMethod.urlDesigner(url)); + mSearchbar.selectAll(); + + if(isTextSelected){ + mSearchbar.selectAll(); + } + + mSearchbar.setSelection(0); + } + } + + void onNewTab(boolean keyboard,boolean isKeyboardOpen){ + mSearchbar.setText(strings.BLANK_PAGE); + if(keyboard){ + + if(!isKeyboardOpen){ + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); + Objects.requireNonNull(imm).toggleSoftInput(InputMethodManager.RESULT_UNCHANGED_SHOWN, 0); + }, 250); + } + + mSearchbar.requestFocus(); + mSearchbar.selectAll(); + } + } + void onUpdateLogs(String log){ + mLoadingText.setText(log); + } + void progressBarReset(){ + mProgressBar.setProgress(5); + mProgressBar.setVisibility(View.INVISIBLE); + } + + void onProgressBarUpdate(int value){ + if(value==100){ + mProgressBar.setAlpha(1f); + mProgressBar.animate().setStartDelay(200).alpha(0); + setProgressAnimate(mProgressBar,value); + } + else if(mSplashScreen.getAlpha()==0) { + mProgressBar.setVisibility(View.VISIBLE); + mProgressBar.animate().setStartDelay(50).alpha(1); + } + setProgressAnimate(mProgressBar,value); + } + + private ObjectAnimator animation = null; + private void setProgressAnimate(ProgressBar pb, int progressTo) + { + int progress = 0; + if((progressTo)= Build.VERSION_CODES.M) { + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + }else { + mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + } + + mContext.getWindow().getDecorView().setSystemUiVisibility(defaultFlag); + mProgressBar.setVisibility(View.VISIBLE); + + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mWebviewContainer.getLayoutParams(); + params.setMargins(0, helperMethod.pxFromDp(55), 0, 0); + mWebviewContainer.setLayoutParams(params); + mBannerAds.setVisibility(View.GONE); + mEvent.invokeObserver(Collections.singletonList(!isLandscape), enums.etype.on_init_ads); + } + } + + 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.sSearchStatus) + { + case constants.BACKEND_GOOGLE_URL: + mEngineLogo.setImageResource(R.drawable.genesis_logo); + break; + case constants.BACKEND_GENESIS_URL: + mEngineLogo.setImageResource(R.drawable.duck_logo); + break; + case constants.BACKEND_DUCK_DUCK_GO_URL: + mEngineLogo.setImageResource(R.drawable.google_logo); + break; + } + } + + /*-------------------------------------------------------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.ON_URL_LOAD) + { + mEvent.invokeObserver(Collections.singletonList(status.sSearchStatus), enums.etype.on_url_load); + } + if(msg.what == messages.UPDATE_LOADING_TEXT) + { + if(mLogs !=null) + { + try + { + mLogs.call(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + } + }; + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/launcherManager/launcherController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/launcherManager/launcherController.java new file mode 100755 index 00000000..299ef446 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/launcherManager/launcherController.java @@ -0,0 +1,67 @@ +package com.darkweb.genesissearchengine.appManager.launcherManager; + +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.example.myapplication.R; +import java.util.List; + +/*Not Yet Registered Belongs To Previous Builds +* Application Error Fallback Restart Instead Of Crash +**/ + +public class launcherController extends AppCompatActivity +{ + /*Private Variables*/ + private launcherViewController mLauncherViewController; + private boolean mIsStarted = false; + + /*Initializations*/ + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.invalid_setup_view); + + initViews(); + helperMethod.openActivity(homeController.class, constants.LIST_HISTORY, this,false); + } + + private void initViews(){ + mLauncherViewController = new launcherViewController(this,new launcherViewCallback()); + } + + /*Activity State Manager*/ + @Override + public void onResume() + { + activityContextManager.getInstance().setCurrentActivity(this); + if(mIsStarted){ + helperMethod.openActivity(homeController.class, constants.LIST_HISTORY, this,false); + pluginController.getInstance().logEvent(strings.APP_RESTARTED); + } + else { + mIsStarted = true; + } + super.onResume(); + } + + /*Initializations Callbacks*/ + + public class launcherViewCallback implements eventObserver.eventListener + { + @Override + public void invokeObserver(List data, enums.etype e_type) + { + + } + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/launcherManager/launcherViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/launcherManager/launcherViewController.java new file mode 100755 index 00000000..dc1d59fb --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/launcherManager/launcherViewController.java @@ -0,0 +1,30 @@ +package com.darkweb.genesissearchengine.appManager.launcherManager; + +import android.os.Build; +import android.view.Window; +import android.view.WindowManager; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.example.myapplication.R; + +class launcherViewController +{ + /*Private Variables*/ + private AppCompatActivity mContext; + + + /*Initializations*/ + launcherViewController(AppCompatActivity mContext, eventObserver.eventListener event){ + this.mContext = mContext; + initUI(); + } + + private void initUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(mContext.getResources().getColor(R.color.ease_blue)); + } + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java new file mode 100755 index 00000000..bf1b01cc --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java @@ -0,0 +1,64 @@ +package com.darkweb.genesissearchengine.appManager.orbotManager; + +import android.os.Bundle; +import android.view.View; +import android.widget.Switch; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.example.myapplication.R; + +public class orbotController extends AppCompatActivity { + + private Switch mBridgeSwitch; + private orbotViewController mOrbotViewController; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.orbot_settings_view); + + viewsInitializations(); + listenersInitializations(); + } + + @Override + public void onResume() + { + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + } + + @Override + public void onPause() + { + super.onPause(); + } + + @Override + public void onBackPressed() { + finish(); + } + + public void onClose(View view){ + finish(); + } + + public void viewsInitializations() { + mBridgeSwitch = findViewById(R.id.bridgeSwitch); + + mOrbotViewController = new orbotViewController(mBridgeSwitch,this); + } + + public void listenersInitializations() { + + mBridgeSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> + { + status.sGateway = isChecked; + dataController.getInstance().setBool(keys.GATEWAY,isChecked); + }); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java new file mode 100755 index 00000000..107f5976 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java @@ -0,0 +1,54 @@ +package com.darkweb.genesissearchengine.appManager.orbotManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.CompoundButton; +import android.widget.Switch; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.status; +import com.example.myapplication.R; + +class orbotViewController +{ + /*Private Variables*/ + + private AppCompatActivity mContext; + + private Switch mBridgeSwitch; + + /*Initializations*/ + + orbotViewController(Switch mBridgeSwitch, AppCompatActivity mContext) + { + this.mContext = mContext; + this.mBridgeSwitch = mBridgeSwitch; + + initPostUI(); + initViews(); + } + + 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)); + } + else { + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white)); + } + } + } + + + private void initViews(){ + mBridgeSwitch.setChecked(status.sGateway); + } + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingController.java new file mode 100755 index 00000000..1a5ecee9 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingController.java @@ -0,0 +1,270 @@ +package com.darkweb.genesissearchengine.appManager.settingManager; + +import android.os.Bundle; +import android.view.View; +import android.widget.AdapterView; +import android.widget.SeekBar; +import android.widget.Spinner; +import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController; +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.helperManager.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.example.myapplication.R; +import java.util.List; +import static com.darkweb.genesissearchengine.constants.status.sCookieStatus; +import static com.darkweb.genesissearchengine.constants.status.sHistoryStatus; +import static com.darkweb.genesissearchengine.constants.status.sJavaStatus; + +public class settingController extends AppCompatActivity +{ + /*Private Observer Classes*/ + + private homeController mHomeController; + private settingViewController mSettingViewController; + private settingModel mSettingModel; + + /*Private Variables*/ + + private Spinner mSearch; + private Spinner mJavascript; + private Spinner mHistory; + private Spinner mCookies; + private Spinner mFontAdjustable; + private Spinner mNotification; + private SeekBar mFontSize; + private TextView mFontSizePercentage; + + /*Initializations*/ + + public settingController(){ + mHomeController = activityContextManager.getInstance().getHomeController(); + mSettingModel = new settingModel(new settingModelCallback()); + mSettingModel.initNotification(pluginController.getInstance().getNotificationStatus()); + } + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.settings_view); + + viewsInitializations(); + modelInitialization(); + listenersInitializations(); + initializeFontSizeListener(); + } + + public void modelInitialization(){ + mSettingModel.setJavaStatus(sJavaStatus); + mSettingModel.setHistoryStatus(sHistoryStatus); + mSettingModel.setSearchStatus(status.sSearchStatus); + mSettingModel.setAdjustableStatus(status.sFontAdjustable); + mSettingModel.setFontSize(status.sFontSize); + } + + public void viewsInitializations() + { + mSearch = findViewById(R.id.search_manager); + mJavascript = findViewById(R.id.javascript_manager); + mHistory = findViewById(R.id.history_manager); + mFontSize = findViewById(R.id.font_size); + mFontAdjustable = findViewById(R.id.font_adjustable); + mFontSizePercentage = findViewById(R.id.font_size_percentage); + mCookies = findViewById(R.id.cookies_manager); + mNotification = findViewById(R.id.notification_manager); + + mSettingViewController = new settingViewController(mSearch, mJavascript, mHistory, mFontSize, mFontAdjustable, mFontSizePercentage,this, new settingModelCallback(), mCookies,mNotification,pluginController.getInstance().getNotificationStatus()); + } + + public void listenersInitializations() + { + initializeItemSelectedListener(mSearch); + initializeItemSelectedListener(mJavascript); + initializeItemSelectedListener(mNotification); + initializeItemSelectedListener(mHistory); + initializeItemSelectedListener(mFontAdjustable); + initializeItemSelectedListener(mCookies); + pluginController.getInstance().logEvent(strings.SETTINGS_OPENED); + } + + /*Event Handlers*/ + + @Override + public void onTrimMemory(int level) + { + if(status.sIsAppPaused && (level==80 || level==15)) + { + dataController.getInstance().setBool(keys.LOW_MEMORY,true); + finish(); + } + } + + @Override + public void onResume() + { + activityContextManager.getInstance().setCurrentActivity(this); + status.sIsAppPaused = false; + super.onResume(); + } + + @Override + public void onPause() + { + super.onPause(); + } + + + @Override + public void onBackPressed(){ + mSettingModel.onCloseView(); + } + + public void initializeItemSelectedListener(Spinner view){ + view.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parentView, View selectedItemView, int position, long id) { + if(parentView.getId()== R.id.search_manager) + { + mSettingModel.setSearchStatus(getEngineURL(position)); + } + else if(parentView.getId()== R.id.javascript_manager) + { + mSettingModel.setJavaStatus(position==0); + } + else if(parentView.getId()== R.id.history_manager) + { + mSettingModel.setHistoryStatus(position==0); + } + else if(parentView.getId()== R.id.font_adjustable) + { + mSettingModel.setAdjustableStatus(position==0); + } + else if(parentView.getId()== R.id.cookies_manager) + { + mSettingModel.setCookieStatus(position); + } + else if(parentView.getId()== R.id.notification_manager) + { + mSettingModel.setmNotificationStatus(position); + } + } + @Override + public void onNothingSelected(AdapterView parentView) { + } + }); + } + + public void initializeFontSizeListener(){ + + mFontSize.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int i, boolean b) { + float cur_progress = seekBar.getProgress(); + mSettingModel.setFontSize((cur_progress)); + mSettingViewController.updatePercentage(mFontSize.getProgress()); + if(cur_progress<1){ + mFontSize.setProgress(1); + } + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + } + }); + } + + public void onNavigationBackPressed(View view){ + mSettingModel.onCloseView(); + } + + /*Event Observer*/ + + public class settingViewCallback implements eventObserver.eventListener{ + + @Override + public void invokeObserver(List data, enums.etype e_type) + { + + } + } + + public class settingModelCallback implements eventObserver.eventListener{ + + @Override + public void invokeObserver(List data, enums.etype e_type) + { + if(e_type == enums.etype.update_searcn){ + status.sSearchStatus = (String)data.get(0); + mHomeController.onHomeButton(null); + dataController.getInstance().setString(keys.SEARCH_ENGINE, mSettingModel.getSearchStatus()); + } + else if(e_type == enums.etype.update_javascript){ + status.sJavaStatus = (boolean)data.get(0); + mHomeController.onUpdateJavascript(); + dataController.getInstance().setBool(keys.JAVA_SCRIPT, status.sJavaStatus); + } + else if(e_type == enums.etype.update_history){ + sHistoryStatus = (boolean)data.get(0); + dataController.getInstance().setBool(keys.HISTORY_CLEAR, sHistoryStatus); + } + else if(e_type == enums.etype.update_notification){ + pluginController.getInstance().setNotificationStatus((int)data.get(0)); + dataController.getInstance().setInt(keys.NOTIFICATION_STATUS, pluginController.getInstance().getNotificationStatus()); + + int notificationStatus = pluginController.getInstance().getNotificationStatus(); + if(notificationStatus==0){ + pluginController.getInstance().enableTorNotification(); + } else if(notificationStatus==1){ + pluginController.getInstance().disableTorNotification(); + }else { + pluginController.getInstance().enableTorNotificationNoBandwidth(); + } + + } + else if(e_type == enums.etype.update_font_adjustable || e_type == enums.etype.update_font_size){ + mHomeController.onLoadFont(); + } + else if(e_type == enums.etype.update_cookies){ + sCookieStatus = (int)data.get(0); + dataController.getInstance().setInt(keys.COOKIE_ADJUSTABLE, sCookieStatus); + mHomeController.onUpdateCookies(); + pluginController.getInstance().updateCookiesStatus(); + } + else if(e_type == enums.etype.close_view){ + finish(); + } + } + } + + /*Helper Methods*/ + + public String getEngineURL(int index){ + + if (index == 0) + { + return constants.BACKEND_GENESIS_URL; + } + else if (index == 1) + { + return constants.BACKEND_GOOGLE_URL; + } + else + { + return constants.BACKEND_DUCK_DUCK_GO_URL; + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingModel.java new file mode 100755 index 00000000..7103ff39 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingModel.java @@ -0,0 +1,138 @@ +package com.darkweb.genesissearchengine.appManager.settingManager; + +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.helperManager.eventObserver; +import java.util.Collections; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; + +class settingModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + private String mSearchStatus = strings.EMPTY_STR; + private int mCookieStatus = ACCEPT_FIRST_PARTY; + private int mNotificationStatus = 0; + private boolean mJavaStatus = false; + private boolean mHistoryStatus = true; + private boolean mFontAdjustable = true; + private float mFontSize = 1; + private int notificationStatusGlobal; + + /*Initializations*/ + + settingModel(eventObserver.eventListener mEvent){ + init_status(); + this.mEvent = mEvent; + } + + /*Helper Methods*/ + + private void init_status() + { + mSearchStatus = status.sSearchStatus; + mHistoryStatus = status.sHistoryStatus; + mJavaStatus = status.sJavaStatus; + mCookieStatus = status.sCookieStatus; + } + + void initNotification(int notificationStatus){ + mNotificationStatus = notificationStatus; + notificationStatusGlobal = notificationStatus; + } + + /*Changed Status*/ + + String getSearchStatus(){ + return mSearchStatus; + } + + void setCookieStatus(int cookie_status){ + this.mCookieStatus = cookie_status; + } + + void setSearchStatus(String search_status){ + this.mSearchStatus = search_status; + } + + void setFontSize(float font_size){ + this.mFontSize = font_size; + } + + void setAdjustableStatus(boolean font_status){ + this.mFontAdjustable = font_status; + } + + + void setJavaStatus(boolean java_status){ + this.mJavaStatus = java_status; + } + + void setmNotificationStatus(int notification_status){ + this.mNotificationStatus = notification_status; + } + + void setHistoryStatus(boolean history_status){ + this.mHistoryStatus = history_status; + } + + void onCloseView() + { + if(!status.sSearchStatus.equals(mSearchStatus)) + { + mEvent.invokeObserver(Collections.singletonList(mSearchStatus), enums.etype.update_searcn); + } + if(status.sJavaStatus != mJavaStatus) + { + mEvent.invokeObserver(Collections.singletonList(mJavaStatus), enums.etype.update_javascript); + } + if(notificationStatusGlobal != mNotificationStatus) + { + mEvent.invokeObserver(Collections.singletonList(mNotificationStatus), enums.etype.update_notification); + } + if(status.sHistoryStatus != mHistoryStatus) + { + status.sHistoryStatus = mHistoryStatus; + mEvent.invokeObserver(Collections.singletonList(mHistoryStatus), enums.etype.update_history); + } + if(status.sFontAdjustable != mFontAdjustable) + { + dataController.getInstance().setBool(keys.FONT_ADJUSTABLE, mFontAdjustable); + dataController.getInstance().setInt(keys.FONT_SIZE,100); + + status.sFontAdjustable = mFontAdjustable; + status.sFontSize = 100; + mFontSize = 100; + + mEvent.invokeObserver(Collections.singletonList(mFontSize), enums.etype.update_font_adjustable); + } + if(status.sFontSize != mFontSize) + { + if(mFontSize <=0){ + mFontSize = 1; + } + + dataController.getInstance().setInt(keys.FONT_SIZE,(int) mFontSize); + dataController.getInstance().setBool(keys.FONT_ADJUSTABLE,false); + + status.sFontSize = mFontSize; + status.sFontAdjustable = false; + mFontAdjustable = false; + + mEvent.invokeObserver(Collections.singletonList(mFontSize), enums.etype.update_font_size); + } + if(status.sCookieStatus != mCookieStatus) + { + status.sCookieStatus = mCookieStatus; + dataController.getInstance().setInt(keys.COOKIE_ADJUSTABLE,status.sCookieStatus); + mEvent.invokeObserver(Collections.singletonList(mCookieStatus), enums.etype.update_cookies); + } + mEvent.invokeObserver(Collections.singletonList(mHistoryStatus), enums.etype.close_view); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingViewController.java new file mode 100755 index 00000000..03b31e72 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingViewController.java @@ -0,0 +1,170 @@ +package com.darkweb.genesissearchengine.appManager.settingManager; + +import android.annotation.SuppressLint; +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.SeekBar; +import android.widget.Spinner; +import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.example.myapplication.R; +import static com.darkweb.genesissearchengine.constants.status.sHistoryStatus; +import static com.darkweb.genesissearchengine.constants.status.sJavaStatus; + +class settingViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + + private Spinner mSearch; + private Spinner mJavaScript; + private Spinner mNotification; + private Spinner mHistory; + private Spinner mCookies; + private Spinner mFontAdjustable; + private SeekBar mFontSize; + private TextView mFontSizePercentage; + + /*Initializations*/ + + settingViewController(Spinner mSearch, Spinner mJavaScript, Spinner mHistory, SeekBar mFontSize, Spinner mFontAdjustable, TextView mFontSizePercentage, settingController mContext, eventObserver.eventListener mEvent, Spinner mCookies, Spinner mNotification, int notificationStatus) + { + this.mFontSizePercentage = mFontSizePercentage; + this.mSearch = mSearch; + this.mJavaScript = mJavaScript; + this.mNotification = mNotification; + this.mHistory = mHistory; + this.mFontAdjustable = mFontAdjustable; + this.mFontSize = mFontSize; + this.mCookies = mCookies; + + this.mEvent = mEvent; + this.mContext = mContext; + + initNotification(notificationStatus); + initViews(); + initJavascript(); + initHistory(); + initSearchEngine(); + initFontAdjustable(); + initCookies(); + initFontSize(); + 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)); + } + else { + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white)); + } + } + } + + private void initViews() + { + mSearch.setDropDownVerticalOffset(15); + mSearch.setDropDownHorizontalOffset(-15); + mJavaScript.setDropDownVerticalOffset(15); + mJavaScript.setDropDownHorizontalOffset(-15); + mNotification.setDropDownVerticalOffset(15); + mNotification.setDropDownHorizontalOffset(-15); + mHistory.setDropDownVerticalOffset(15); + mHistory.setDropDownHorizontalOffset(-15); + mCookies.setDropDownVerticalOffset(15); + mCookies.setDropDownHorizontalOffset(-15); + mFontAdjustable.setDropDownHorizontalOffset(-15); + mFontAdjustable.setDropDownVerticalOffset(15); + } + + private void initJavascript() + { + if (sJavaStatus) + { + mJavaScript.setSelection(0); + } + else + { + mJavaScript.setSelection(1); + } + } + + private void initNotification(int status) + { + mNotification.setSelection(status); + } + + private void initHistory() + { + if (sHistoryStatus) + { + mHistory.setSelection(0); + } + else + { + mHistory.setSelection(1); + } + } + + private void initCookies() + { + mCookies.setSelection(status.sCookieStatus); + } + + private void initFontAdjustable() + { + if (status.sFontAdjustable) + { + mFontAdjustable.setSelection(0); + } + else + { + mFontAdjustable.setSelection(1); + } + } + + private void initFontSize() + { + mFontSize.setProgress((int)status.sFontSize); + updatePercentage(mFontSize.getProgress()); + } + + private void initSearchEngine() + { + mSearch.setSelection(getEngineIndex()); + } + + /*External Helper Methods*/ + + private int getEngineIndex(){ + if(status.sSearchStatus.equals(constants.BACKEND_GENESIS_URL)){ + return 0; + } + else if(status.sSearchStatus.equals(constants.BACKEND_GOOGLE_URL)){ + return 1; + } + else + return 2; + } + + @SuppressLint("SetTextI18n") + void updatePercentage(int font_size){ + + mFontSizePercentage.setText(strings.CUSTOM_FONTS + strings.EMPTY_SPACE + font_size +strings.PERCENT_SIGN); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java new file mode 100755 index 00000000..ed1a9a59 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java @@ -0,0 +1,165 @@ +package com.darkweb.genesissearchengine.appManager.tabManager; + +import android.view.LayoutInflater; +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.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; +import java.util.ArrayList; +import java.util.Collections; + +public class tabAdapter extends RecyclerView.Adapter +{ + /*Private Variables*/ + + private ArrayList mModelList; + private ArrayList mTempModelList; + private eventObserver.eventListener mEvent; + private String filter = strings.EMPTY_STR; + private boolean isClosing = false; + + tabAdapter(ArrayList model_list, eventObserver.eventListener event) { + this.mModelList = model_list; + this.mEvent = event; + mTempModelList = new ArrayList<>(); + } + + /*Initializations*/ + + @NonNull + @Override + public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_row_view, parent, false); + return new listViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull tabAdapter.listViewHolder holder, int position) + { + holder.bindListView(mTempModelList.get(position)); + clearMessageItem(holder.messageButton,position,holder.data_model); + clearMessageItemContainer(holder.itemContainer,position,holder.data_model); + } + + @Override + public int getItemCount() { + return mTempModelList.size(); + } + + /*Listeners*/ + + private void clearMessageItem(ImageButton clearButton, int index,tabRowModel model) + { + clearButton.setOnClickListener(v -> + { + if(!isClosing){ + isClosing = true; + int size = mModelList.size(); + + mEvent.invokeObserver(Collections.singletonList(mTempModelList.get(index).getmId()),enums.etype.url_clear); + mEvent.invokeObserver(Collections.singletonList(index),enums.etype.is_empty); + invokeFilter(false); + model.getSession().stop(); + model.getSession().close(); + if(size>1){ + new Thread(){ + public void run(){ + try + { + sleep(500); + isClosing = false; + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + }.start(); + } + } + }); + } + + + + + private void clearMessageItemContainer(LinearLayout clearButton, int index,tabRowModel model) + { + clearButton.setOnClickListener(v -> + { + if(mTempModelList.size()>index){ + invokeFilter(false); + mEvent.invokeObserver(Collections.singletonList(model),enums.etype.url_triggered); + } + }); + } + + /*View Holder Extensions*/ + + class listViewHolder extends RecyclerView.ViewHolder + { + TextView heaaderText; + TextView descriptionText; + ImageButton messageButton; + ImageView empty_message; + LinearLayout itemContainer; + tabRowModel data_model; + + listViewHolder(View itemView) { + super(itemView); + } + + void bindListView(tabRowModel model) { + + heaaderText = itemView.findViewById(R.id.mHeader); + descriptionText = itemView.findViewById(R.id.mDescription); + itemContainer = itemView.findViewById(R.id.item_container); + + if(model.getSession().getTitle().equals("")){ + heaaderText.setText(helperMethod.getDomainName(model.getSession().getCurrentURL())); + } + else { + heaaderText.setText(model.getSession().getTitle()); + } + + /*Large file or content based url handling*/ + String url = model.getSession().getCurrentURL(); + if(url.length()>200){ + url = url.substring(0,200); + } + + descriptionText.setText(url); + messageButton = itemView.findViewById(R.id.message_button); + empty_message = itemView.findViewById(R.id.empty_list); + data_model = model; + } + } + + void setFilter(String filter){ + this.filter = filter; + } + + void invokeFilter(boolean notify){ + mTempModelList.clear(); + for(int counter = 0; counter< mModelList.size(); counter++){ + if(mModelList.get(counter).getSession().getTitle().contains(filter) || mModelList.get(counter).getSession().getCurrentURL().contains(filter)){ + tabRowModel model = mModelList.get(counter); + mTempModelList.add(new tabRowModel(model.getSession(),counter)); + } + } + + if(notify){ + mEvent.invokeObserver(null,enums.etype.clear_recycler); + notifyDataSetChanged(); + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java new file mode 100755 index 00000000..4e900986 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java @@ -0,0 +1,212 @@ +package com.darkweb.genesissearchengine.appManager.tabManager; + +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.View; +import android.view.inputmethod.EditorInfo; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController; +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.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.example.myapplication.R; + +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +public class tabController extends AppCompatActivity +{ + /*Private Variables*/ + + private tabModel mListModel; + private homeController mHomeController; + private activityContextManager mContextManager; + + private ImageView mEmptyListNotifier; + private EditText mSearchBar; + private RecyclerView mListView; + private Button mClearButton; + + private tabViewController mtabViewController; + + /*Initializations*/ + + @Override + protected void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + setContentView(R.layout.tab_view); + initializeListModel(); + initializeViews(); + initializeList(); + onEditorInvoked(); + } + + public void initializeListModel(){ + mListModel = new tabModel(); + mListModel.setList(dataController.getInstance().getTab()); + mContextManager = activityContextManager.getInstance(); + mHomeController = activityContextManager.getInstance().getHomeController(); + mContextManager.setTabController(this); + pluginController.getInstance().logEvent(strings.TAB_OPENED); + } + public void initializeViews(){ + mEmptyListNotifier = findViewById(R.id.empty_list); + mSearchBar = findViewById(R.id.search); + mListView = findViewById(R.id.listview); + mClearButton = findViewById(R.id.clearButton); + mtabViewController = new tabViewController(mEmptyListNotifier, mListView, mClearButton,this); + mClearButton.setText(strings.CLEAR_TABS); + } + public void initializeList(){ + tabAdapter adapter = new tabAdapter(mListModel.getList(),new adapterCallback()); + adapter.invokeFilter(false); + mListView.setAdapter(adapter); + mListView.setLayoutManager(new LinearLayoutManager(this)); + mtabViewController.updateIfListEmpty(mListModel.getList().size(),0); + } + + /*View Handlers*/ + + public void onEditorInvoked(){ + + mSearchBar.setOnEditorActionListener((v, actionId, event) ->{ + if (actionId == EditorInfo.IME_ACTION_NEXT) + { + helperMethod.hideKeyboard(this); + return true; + } + return false; + }); + + mSearchBar.addTextChangedListener(new TextWatcher() { + + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2){ + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2){ + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(mListView!=null){ + ((tabAdapter) Objects.requireNonNull(mListView.getAdapter())).setFilter(mSearchBar.getText().toString()); + ((tabAdapter) mListView.getAdapter()).invokeFilter(true); + } + } + }); + } + + public void reset(){ + if(mListView!=null){ + mListView.setAdapter(null); + } + mListView = null; + } + + @Override + public void onBackPressed() { + super.onBackPressed(); + reset(); + } + + public void onBackPressed(View view){ + this.finish(); + reset(); + } + + public void onclearDataTrigger(View view){ + pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.EMPTY_STR),enums.etype.clear_tab); + } + + @Override + public void onTrimMemory(int level) + { + if(status.sIsAppPaused && (level==80 || level==15)) + { + dataController.getInstance().setBool(keys.LOW_MEMORY,true); + finish(); + } + } + + public void onNewTabInvoked(View view) + { + mHomeController.onNewTab(false); + finish(); + } + + @Override + public void onResume() + { + activityContextManager.getInstance().setCurrentActivity(this); + status.sIsAppPaused = false; + super.onResume(); + } + + @Override + public void onStop() { + super.onStop(); + } + + @Override + public void onPause() + { + status.sIsAppPaused = true; + super.onPause(); + } + + /*Event Observer*/ + + public class adapterCallback implements eventObserver.eventListener{ + + @Override + public void invokeObserver(List data, enums.etype e_type) + { + if(e_type.equals(enums.etype.clear_recycler)){ + mListView.getRecycledViewPool().clear(); + } + if(e_type.equals(enums.etype.url_triggered)){ + tabRowModel model = (tabRowModel)data.get(0); + pluginController.getInstance().logEvent(strings.TAB_TRIGGERED); + mHomeController.onLoadTab(model.getSession(),false); + finish(); + } + else if(e_type.equals(enums.etype.url_clear)){ + mListModel.onManualClear((int)data.get(0)); + mHomeController.initTabCount(); + } + else if(e_type.equals(enums.etype.is_empty)){ + + mtabViewController.removeFromList((int)data.get(0)); + mtabViewController.updateIfListEmpty(mListModel.getList().size(),300); + mHomeController.releaseSession(); + if(dataController.getInstance().getTotalTabs()<1){ + mHomeController.onNewTab(false); + finish(); + }else { + mHomeController.loadExistingTab(); + } + mHomeController.initTabCount(); + } + } + + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java new file mode 100755 index 00000000..6b195551 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java @@ -0,0 +1,32 @@ +package com.darkweb.genesissearchengine.appManager.tabManager; + +import java.util.ArrayList; + +class tabModel +{ + /*Private Variables*/ + + private ArrayList mModelList = new ArrayList<>(); + + /*Initializations*/ + + void setList(ArrayList model) + { + mModelList = model; + } + ArrayList getList() + { + return mModelList; + } + private void removeFromMainList(int index) + { + if(mModelList.size()>0){ + mModelList.remove(index); + } + } + + void onManualClear(int index){ + removeFromMainList(index); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java new file mode 100755 index 00000000..12e74895 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java @@ -0,0 +1,31 @@ +package com.darkweb.genesissearchengine.appManager.tabManager; + +import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession; + +public class tabRowModel +{ + /*Private Variables*/ + + private geckoSession mSession; + private int mId; + + /*Initializations*/ + + public tabRowModel(geckoSession mSession,int mId) { + this.mSession = mSession; + this.mId = mId; + } + + public geckoSession getSession() + { + return mSession; + } + + public int getmId() { + return mId; + } + public void setId(int id) { + mId = id; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java new file mode 100755 index 00000000..0fa29afa --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java @@ -0,0 +1,69 @@ +package com.darkweb.genesissearchengine.appManager.tabManager; + +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.ImageView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import androidx.recyclerview.widget.RecyclerView; +import com.example.myapplication.R; + +import java.util.Objects; + +class tabViewController +{ + /*Private Variables*/ + private AppCompatActivity mContext; + + private ImageView mEmptyListNotifier; + private RecyclerView mListView; + private Button mClearButton; + + /*Initializations*/ + + tabViewController(ImageView mEmptyListNotifier, RecyclerView mListView, Button mClearButton, AppCompatActivity mContext) + { + this.mContext = mContext; + this.mEmptyListNotifier = mEmptyListNotifier; + this.mListView = mListView; + this.mClearButton = mClearButton; + + 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)); + } + else { + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white)); + } + } + } + + void updateIfListEmpty(int size,int duration){ + if(size>0){ + mEmptyListNotifier.animate().setDuration(duration).alpha(0f); + mClearButton.animate().setDuration(duration).alpha(1f); + } + else { + mEmptyListNotifier.animate().setDuration(duration).alpha(1f); + mClearButton.animate().setDuration(duration).alpha(0f); + } + } + + void removeFromList(int index) + { + Objects.requireNonNull(mListView.getAdapter()).notifyItemRemoved(index); + mListView.getAdapter().notifyItemRangeChanged(index, mListView.getAdapter().getItemCount()-1); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java old mode 100644 new mode 100755 index 6188ef35..9c6e3909 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java @@ -1,54 +1,55 @@ -package com.darkweb.genesissearchengine.constants; - -public class constants -{ - /*LOCAL URL CONSTANTS*/ - - public static String blackMarket = "https://boogle.store/search?q=black+market&p_num=1&s_type=all"; - public static String leakedDocument = "https://boogle.store/search?q=leaked+document&p_num=1&s_type=all&p_num=1&s_type=all"; - public static String news = "https://boogle.store/search?q=latest%20news&p_num=1&s_type=news"; - public static String softwares = "https://boogle.store/search?q=softwares+tools&p_num=1&s_type=all&p_num=1&s_type=all"; - - /*URL CONSTANTS*/ - - public static String backendGenesis = "https://boogle.store/"; - public static String backendUrlHost = "boogle.store"; - public static String updateUrl = "https://boogle.store/manual?abi="; - - public static String frontEndUrlHost = "genesis.store"; - public static String frontEndUrlHost_v1 = "genesis.onion"; - - public static String backendGoogle = "https://www.google.com/"; - public static String backendBing = "https://www.bing.com/"; - public static String allowedHost = ".onion"; - public static String playstoreUrl = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine"; - - /*BUILD CONSTANTS*/ - - public static String build_type = "playstore"; - //public static String build_type = "local"; - - /*PROXY CONSTANTS*/ - - public static int proxy_type = 1; - public static String proxy_socks = "127.0.0.1"; - public static int proxy_socks_version = 5; - public static boolean proxy_socks_remote_dns = true; - public static boolean proxy_cache = false; - public static boolean proxy_memory = false; - public static String proxy_useragent_override = "Mozilla/5.0 (Android 9; Mobile; rv:67.0) Gecko/67.0 Firefox/67.0"; - public static boolean proxy_donottrackheader_enabled = false; - public static int proxy_donottrackheader_value = 1; - - /*MENU CONSTANTS*/ - - public static int list_history = 1; - public static int list_bookmark = 2; - - /*SETTINGS CONSTANTS*/ - - public static int max_history_size=500; - public static int max_bookmark_size=500; - public static String databae_name="genesis_dbase"; - -} +package com.darkweb.genesissearchengine.constants; + +public class constants +{ + /*LOCAL URL CONSTANTS*/ + + public static final String BLACK_MARKET_URL = "https://boogle.store/search?q=black+market&p_num=1&s_type=all"; + public static final String LEAKED_DOCUMENT_URL = "https://boogle.store/search?q=leaked+document&p_num=1&s_type=all&p_num=1&s_type=all"; + public static final String NEWS_URL = "https://boogle.store/search?q=latest%20news&p_num=1&s_type=news"; + public static final String SOFTWARE_URL = "https://boogle.store/search?q=softwares+tools&p_num=1&s_type=all&p_num=1&s_type=all"; + + /*URL CONSTANTS*/ + + public static final String BACKEND_GENESIS_URL = "http://boogle.store"; + public static final String GENESIS_UPDATE_URL = "https://boogle.store/manual?abi="; + public static final String BACKEND_GOOGLE_URL = "https://www.google.com/"; + public static final String BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com/"; + public static final String PLAYSTORE_URL = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine"; + + /*PROXY CONSTANTS*/ + + public static final String PROXY_SOCKS = "127.0.0.1"; + public static final String PROXY_SOCKS_PORT = "9050"; + public static final int PROXY_SOCKS_VERSION = 5; + public static final boolean PROXY_SOCKS_REMOTE_DNS = true; + public static final boolean PROXY_CACHE = true; + public static final boolean PROXY_MEMORY = true; + public static final int DISK_CAPACITY = 10000; + public static final String PROXY_USER_AGENT_OVERRIDE = "Mozilla/5.0 (Android 9; Mobile; rv:67.0) Gecko/67.0 Firefox/67.0"; + public static final boolean PROXY_DO_NOT_TRACK_HEADER_ENABLED = false; + public static final int PROXY_DO_NOT_TRACK_HEADER_VALUE = 1; + + /*MENU CONSTANTS*/ + + public static final int LIST_HISTORY = 1; + public static final int LIST_BOOKMARK = 2; + + /*SETTINGS CONSTANTS*/ + + public static final int MAX_LIST_DATA_SIZE =5000; + public static final int MAX_LIST_SIZE =5000; + public static final int START_LIST_SIZE =100; + public static final String DATABASE_NAME ="genesis_dbase"; + + /*ADMOB CONSTANTS*/ + + public static final String ADMOB_KEY = "ca-app-pub-5074525529134731~2926711128"; + public static final String TEST_KEY = "5AAFC2DFAE5C3906292EB576F0822FD7"; + + /*ANALYTICS CONSTANTS*/ + + public static final String UNIQUE_KEY_ID = "*PREF_UNIQUE_ID"; + public static final String USER_EMAIL = "user@fabric.io"; + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java old mode 100644 new mode 100755 index 8f70003d..61464bff --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -1,11 +1,15 @@ -package com.darkweb.genesissearchengine.constants; - -public class enums -{ - /*SETTINGS*/ - - public enum searchEngine{Darkweb,Bing,Google} - public enum adID{hidden_onion, hidden_onion_start,hidden_base} - public enum navigationType{onion, base} - +package com.darkweb.genesissearchengine.constants; + +public class enums +{ + /*Settings Manager*/ + public enum etype{ + HiddenWeb, DuckDuckGo,Google, + hidden_onion, hidden_onion_start,hidden_base, + onion, base, + welcome,abi_error,rate_success,reported_success,bookmark, clear_tab,clear_history,clear_bookmark,report_url,rate_app,version_warning,start_orbot,download_file,download_file_long_press,tor_banned,on_long_press_url, + cancel_welcome,ignore_abi,reload,connect_vpn,start_home,disable_splash,app_rated,download_file_manual,download_folder, update_searcn, update_javascript,update_notification, update_history,update_cookies, update_font_size,update_font_adjustable,close_view,open_link_new_tab,open_link_current_tab,copy_link, + url_triggered,url_clear,clear_recycler,url_clear_at,remove_from_database,is_empty,load_more, + on_close_sesson,on_long_press,on_long_press_with_link,on_full_screen,on_error_cert,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,redraw,start_proxy,start_proxy_back,start_proxy_forward,onMenuSelected,on_request_completed,on_update_suggestion,on_page_loaded,on_load_error,update_tab_title,download_file_popup,proxy_error,on_init_ads,rate_application,search_update, open_new_tab + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java old mode 100644 new mode 100755 index 5165d60a..6ca5506f --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java @@ -1,36 +1,41 @@ -package com.darkweb.genesissearchengine.constants; - -public class keys -{ - /*Welcome Message Prefs*/ - - public static String first_time_loaded = "FirstTimeLoaded"; - - /*Home page*/ - - public static String homepage_html_key = "internalhtml"; - public static String low_memory = "low_memory"; - - /*Proxy Manager*/ - - public static String proxy_type = "network.proxy.type"; - public static String proxy_socks = "network.proxy.socks"; - public static String proxy_socks_port = "network.proxy.socks_port"; - public static String proxy_socks_version = "network.proxy.socks_version"; - public static String proxy_socks_remote_dns = "network.proxy.socks_remote_dns"; - public static String proxy_cache = "browser.cache.disk.enable"; - public static String proxy_memory = "browser.cache.memory.enable"; - public static String proxy_useragent_override = "general.useragent.override"; - public static String proxy_donottrackheader_enabled = "privacy.donottrackheader.enabled"; - public static String proxy_donottrackheader_value = "privacy.donottrackheader.value"; - public static String hasOrbotInstalled = "hasOrbotInstalled"; - public static String isAppRated = "isAppRated"; - public static String list_type = "list_type"; - - /*Settings*/ - - public static String search_engine = "search_engine"; - public static String java_script = "java_script"; - public static String history_clear = "history_clear"; - -} +package com.darkweb.genesissearchengine.constants; + +public class keys +{ + /*Home page*/ + + public static String LOW_MEMORY = "LOW_MEMORY"; + + /*Proxy Manager*/ + + public static final String PROXY_TYPE = "network.proxy.type"; + public static final String PROXY_SOCKS = "network.proxy.socks"; + public static final String PROXY_SOCKS_PORT = "network.proxy.socks_port"; + public static final String PROXY_SOCKS_VERSION = "network.proxy.socks_version"; + public static final String PROXY_SOCKS_REMOTE_DNS = "network.proxy.socks_remote_dns"; + public static final String PROXY_SOCKS_COOKIES = "privacy.clearOnShutdown.cookies"; + public static final String PROXY_CACHE = "browser.cache.disk.enable"; + public static final String PROXY_MEMORY = "browser.cache.memory.enable"; + public static final String PROXY_DISK_CAPACITY = "browser.cache.disk.capacity"; + public static final String PROXY_USER_AGENT_OVERRIDE = "general.useragent.override"; + public static final String PROXY_DO_NOT_TRACK_HEADER_ENABLED = "privacy.donottrackheader.enabled"; + public static final String PROXY_DO_NOT_TRACK_HEADER_VALUE = "privacy.donottrackheader.value"; + public static final String IS_APP_RATED = "IS_APP_RATED"; + public static final String list_type = "list_type"; + + /*Settings*/ + + public static final String SEARCH_ENGINE = "SEARCH_ENGINE"; + public static final String JAVA_SCRIPT = "JAVA_SCRIPT"; + public static final String HISTORY_CLEAR = "HISTORY_CLEAR"; + public static final String GATEWAY = "pref_bridges_enabled"; + public static final String IS_BOOTSTRAPPED = "IS_BOOTSTRAPPED"; + public static final String IS_WELCOME_ENABLED = "IS_WELCOME_ENABLED"; + public static final String ENGINE_SWITCHED = "ENGINE_SWITCHED"; + public static final String FONT_SIZE = "FONT_SIZE"; + public static final String FONT_ADJUSTABLE = "FONT_ADJUSTABLE"; + public static final String COOKIE_ADJUSTABLE = "COOKIE_ADJUSTABLE_NEW"; + public static final String CLEAR_PREFS = "CLEAR_PREFS"; + public static final String NOTIFICATION_STATUS = "NOTIFICATION_STATUS"; + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java old mode 100644 new mode 100755 index 50f2602d..62277b90 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java @@ -1,15 +1,9 @@ -package com.darkweb.genesissearchengine.constants; - -public class messages -{ - /*POST MESSAGES KEYS*/ - - public final static int INTERNET_ERROR =2; - public final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1; - public final static int DISABLE_SPLASH_SCREEN =3; - public final static int UPDATE_LOADING_TEXT =5; - public final static int SHOW_ADS =6; - public final static int DOWNLOAD_NOTIFICATION =7; - public final static int INSTALL_COMPLETED =8; - public final static int LOAD_COMPLETED =9; -} +package com.darkweb.genesissearchengine.constants; + +public class messages +{ + /*POST MESSAGES KEYS*/ + + public final static int UPDATE_LOADING_TEXT =1; + public final static int ON_URL_LOAD =2; +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java old mode 100644 new mode 100755 index 4f57a632..d1857752 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -1,28 +1,40 @@ -package com.darkweb.genesissearchengine.constants; - -import android.util.Log; -import com.darkweb.genesissearchengine.dataManager.preference_manager; - -public class status -{ - /*App Level*/ - - public static boolean isApplicationLoaded = false; - public static boolean isPlayStoreInstalled = true; - public static boolean isTorInitialized = false; - public static String version_code = "7.0"; - - /*Settings Level*/ - - public static String search_status = strings.emptyStr; - public static boolean java_status = false; - public static boolean history_status = true; - - public static void initStatus() - { - status.java_status = preference_manager.getInstance().getBool(keys.java_script,true); - status.history_status = preference_manager.getInstance().getBool(keys.history_clear,true); - status.search_status = preference_manager.getInstance().getString(keys.search_engine,"Hidden Web"); - } - -} +package com.darkweb.genesissearchengine.constants; + +import com.darkweb.genesissearchengine.dataManager.dataController; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; + +public class status +{ + /*App Status*/ + + public static String current_ABI = "7.0"; + public static boolean paid_status = false; + + /*Settings Status*/ + + public static String sSearchStatus = constants.BACKEND_GENESIS_URL; + public static boolean sJavaStatus = true; + public static boolean sHistoryStatus = true; + public static boolean sGateway = false; + public static boolean sIsAppPaused = false; + public static boolean sIsWelcomeEnabled = true; + public static boolean sIsAppStarted = false; + public static boolean sIsAppRated = false; + public static boolean sFontAdjustable = true; + public static int sCookieStatus = ACCEPT_FIRST_PARTY; + public static float sFontSize = 1; + + public static void initStatus() + { + status.sJavaStatus = dataController.getInstance().getBool(keys.JAVA_SCRIPT,true); + status.sHistoryStatus = dataController.getInstance().getBool(keys.HISTORY_CLEAR,true); + status.sSearchStatus = dataController.getInstance().getString(keys.SEARCH_ENGINE,constants.BACKEND_GENESIS_URL); + status.sGateway = dataController.getInstance().getBool(keys.GATEWAY,false); + status.sIsWelcomeEnabled = dataController.getInstance().getBool(keys.IS_WELCOME_ENABLED,true); + status.sIsAppRated = dataController.getInstance().getBool(keys.IS_APP_RATED,false); + status.sFontSize = dataController.getInstance().getFloat(keys.FONT_SIZE,100); + status.sFontAdjustable = dataController.getInstance().getBool(keys.FONT_ADJUSTABLE,true); + status.sCookieStatus = dataController.getInstance().getInt(keys.COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java old mode 100644 new mode 100755 index 6fb3b8d5..20693379 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java @@ -1,84 +1,138 @@ -package com.darkweb.genesissearchengine.constants; - -public class strings -{ - /*Orbot Manager*/ - - public static String torfolder = "torfiles"; - - /*Messsage Manager*/ - - public static String welcome_message_title = "Welcome | Deep Web Gateway"; - public static String welcome_message_desc = "\nWelcome to Deep Web | Dark Web Gateway. This application provide you a platform to Search and Open Dark Web urls.\n\nYou cannot open any url related to normal internet as its not the intended purpose. You can check out following urls to get yourself started\n\nHere are few Suggestions\n"; - public static String welcome_message_bt1 = "Deep Web Online Market"; - public static String welcome_message_bt2 = "Leaked Documents and Books"; - public static String welcome_message_bt3 = "Dark Web News and Articles"; - public static String welcome_message_bt4 = "Secret Softwares and Hacking Tools"; - public static String welcome_message_bt5 = "Don't Show Again"; - - public static String base_error_title = "Dark Web URL | Invalid URL"; - public static String base_error_desc = "This software can only be used to access hidden web such as \"Onion\" and \"I2P\" \n\nFor accessing Surface Web use Google or Bing\n"; - public static String base_error_bt1 = "Dismiss"; - - public static String abi_error_title = "Invalid Setup File"; - public static String abi_error_desc = "Looks like you messed up the installation. Either Install it from playstore or follow the link"; - public static String abi_error_bt1 = "Local Upgrade"; - public static String abi_error_bt2 = "Playstore Upgrade"; - - public static String report_url_title = "Report This Website"; - public static String report_url_desc = "If you think url is illegal or disturbing report us so that we can update our database\n"; - public static String report_url_bt1 = "Report"; - public static String report_url_bt2 = "Dismiss"; - - public static String orbot_init_title = "Initializing"; - public static String orbot_init_desc = "Please wait! While we connect you to hidden web. This might take few minutes\n"; - public static String orbot_init_bt1 = "Dismiss"; - public static String orbot_init_bt2 = "Try Again"; - - public static String version_title = "Update Pending"; - public static String version_desc = "You have not updated this app for a while please update it to get best performance\n"; - public static String version_bt1 = "Update"; - - public static String report_success_title = "URL Reported Successfully"; - public static String report_success_desc = "URL has been successfully reported. It will take about a week to completely remove this website from our servers\n"; - public static String report_success_bt1 = "Dismiss"; - - public static String rate_title = "Rate US"; - public static String rate_message = "We dont take donations or earn money from this app. We are trying to make a private anonymous internet \n\nIf you think this app works please rate us it gives us hope and strength to continue"; - public static String rate_positive = "Like This App"; - public static String rate_negative = "Don't Like This App"; - - public static String rate_success_title = "Sorry To Hear That!"; - public static String rate_success_desc = "If you are having any trouble and want to contact us please email us at gamesolstudios@gmail.com \n\nWe will try to solve your problem as soon as possible"; - public static String rate_success_bt1 = "Dismiss"; - - public static String bookmark_url_title = "Bookmark This Page"; - public static String bookmark_url_desc = "Bookmark this URL To Restore It Again Afterward\n"; - public static String bookmark_url_bt1 = "Bookmark"; - public static String bookmark_url_bt2 = "Dismiss"; - - public static String clear_title = "Warning | Clearing Data"; - public static String clear_desc = "You are about to clear your data if you are sure please continue\n"; - public static String clear_bt1 = "Clear Data"; - public static String clear_bt2 = "Dismiss"; - - public static String download_title = "Download Notification"; - public static String download_message = "Download File | "; - public static String download_positive = "Download"; - public static String download_negative = "Dismiss"; - - /*Text Manager*/ - - public static String darkweb = "Hidden Web"; - public static String emptyStr = ""; - public static String bookmark_text = "bookmark"; - public static String history_text = "history"; - public static String bing_text = "Bing"; - public static String google_text = "Google"; - - - - - -} - +package com.darkweb.genesissearchengine.constants; + +public class strings +{ + /*Orbot Manager*/ + + public static final String WELCOME_MESSAGE_TITLE = "Welcome | Hidden Web Gateway"; + public static final String WELCOME_MESSAGE_DESC = "This application provide you a platform to Search and Open Hidden Web urls.Here are few Suggestions\n"; + public static final String WELCOME_MESSAGE_BT_1 = "Deep Web Online Market"; + public static final String WELCOME_MESSAGE_BT_2 = "Leaked Documents and Books"; + public static final String WELCOME_MESSAGE_BT_3 = "Dark Web News and Articles"; + public static final String WELCOME_MESSAGE_BT_4 = "Secret Softwares and Hacking Tools"; + public static final String WELCOME_MESSAGE_BT_5 = "Don't Show Again"; + + public static final String ABI_ERROR_TITLE = "Invalid Setup File"; + public static final String ABI_ERROR_DESC = "Looks like you messed up the installation. Either Install it from playstore or follow the link"; + public static final String ABI_ERROR_BT_1 = "Local Upgrade"; + public static final String ABI_ERROR_BT_2 = "Playstore Upgrade"; + public static final String ABI_ERROR_BT_3 = "Continue Anyway"; + + public static final String REPORT_URL_TITLE = "Report This Website"; + public static final String REPORT_URL_DESC = "If you think url is illegal or disturbing report us so that we can update our database\n"; + public static final String REPORT_URL_BT_1 = "Report"; + public static final String REPORT_URL_BT_2 = "Dismiss"; + + public static final String ORBOT_INIT_TITLE = "Initializing"; + public static final String ORBOT_INIT_DESC = "Please wait! While we connect you to hidden web. This might take few minutes\n"; + public static final String ORBOT_INIT_BT_1 = "Dismiss"; + public static final String ORBOT_INIT_BT_2 = "Try Again"; + + public static final String VERSION_TITLE = "Update Pending"; + public static final String VERSION_DESC = "You have not updated this app for a while please update it to get best performance\n"; + public static final String VERSION_BT_1 = "Update"; + + public static final String REPORT_SUCCESS_TITLE = "URL Reported Successfully"; + public static final String REPORT_SUCCESS_DESC = "URL has been successfully reported. It will take about a week to completely remove this website from our servers\n"; + public static final String REPORT_SUCCESS_BT_1 = "Dismiss"; + + public static final String RATE_TITLE = "Rate US"; + public static final String RATE_MESSAGE = "We dont take donations or earn money from this app. We are trying to make a private anonymous internet \n\nIf you think this app works please rate us it gives us hope and strength to continue"; + public static final String RATE_POSITIVE = "Like This App"; + public static final String RATE_NEGATIVE = "Don't Like This App"; + + public static final String RATE_SUCCESS_TITLE = "Sorry To Hear That!"; + public static final String RATE_SUCCESS_DESC = "If you are having any trouble and want to contact us please email us at gamesolstudios@gmail.com We will try to solve your problem as soon as possible"; + public static final String RATE_SUCCESS_BT_1 = "Send Mail"; + + public static final String BOOKMARK_URL_BT_1 = "Bookmark"; + public static final String BOOKMARK_URL_BT_2 = "Dismiss"; + + public static final String CLEAR_HISTORY_TITLE = "Clear site storage?"; + public static final String CLEAR_HISTORY_DESC = "This will clear data for all sites"; + public static final String CLEAR_HISTORY_BT_1 = "Clear"; + public static final String CLEAR_HISTORY_BT_2 = "Dismiss"; + + public static final String CLEAR_TAB_TITLE = "Clear open tabs?"; + public static final String CLEAR_TAB_DESC = "This will clear all stored tabs"; + public static final String CLEAR_TAB_BT_1 = "Clear"; + + public static final String clear_bookmark_title = "Clear site bookmark?"; + public static final String clear_bookmark_desc = "This will clear data for all saved sites\n"; + public static final String clear_bookmark_bt1 = "Clear"; + public static final String clear_bookmark_bt2 = "Dismiss"; + + public static final String DOWNLOAD_TITLE = "Download Notification"; + public static final String DOWNLOAD_LONG_PRESS_TITLE = "File Notification"; + public static final String DOWNLOAD_LONG_PRESS_MESSAGE = "File | "; + public static final String DOWNLOAD_MESSAGE = "Download File | "; + public static final String DOWNLOAD_POSITIVE = "Download"; + public static final String DOWNLOAD_NEGATIVE = "Dismiss"; + + public static final String LONG_URL_TITLE = "URL Notification"; + public static final String LONG_URL_MESSAGE = ""; + public static final String LONG_URL_OPTION_1 = "Open In New Tab"; + public static final String LONG_URL_OPTION_2 = "Open In Current Tab"; + public static final String LONG_URL_OPTION_3 = "Copy to Clipboard"; + public static final String LONG_URL_OPTION_4 = "Download this file"; + + public static final String LONG_URL_FULL_MESSAGE = "URL Description"; + public static final String LONG_URL_FULL_OPTION_1 = "Open url in new tab"; + public static final String LONG_URL_FULL_OPTION_2 = "Open url in current tab"; + public static final String LONG_URL_FULL_OPTION_3 = "Copy url to clipboard"; + public static final String LONG_URL_FULL_OPTION_4 = "Open image in new tab"; + public static final String LONG_URL_FULL_OPTION_5 = "Open image current tab"; + public static final String LONG_URL_FULL_OPTION_6 = "Copy image to clipboard"; + public static final String LONG_URL_FULL_OPTION_7 = "Download image file"; + + public static final String BANNED_TITLE = "Is Tor Bannned In Your Country?"; + public static final String BANNED_DESC = "Enable free GATEWAY to tunnel through banned configuration | Use it only if tor is banned in your country"; + + /*Tab Manager*/ + + public static final String CLEAR_TABS = "CLEAR TABS"; + + /*Text Manager*/ + + public static final String DARK_WEB = "Hidden Web"; + public static final String EMPTY_STR = ""; + public static final String EMPTY_SPACE = " "; + + /*Settings Manager*/ + + public static final String CUSTOM_FONTS = "Custom Font"; + public static final String PERCENT_SIGN = "%"; + + /*Bookmark Manager*/ + + public static final String CLEAR_BOOKMARK = "CLEAR BOOKMARK"; + + /*Home Manager*/ + + public static final String BLANK_PAGE = "about:blank"; + + /*Events*/ + + public static final String APP_STARTED = "APP_STARTED"; + public static final String PROXY_CHANGED = "PROXY_CHANGED"; + public static final String APP_RESTARTED = "APP_RESTARTED"; + public static final String APP_FINISHED = "APP_FINISHED"; + public static final String SEARCH_SWITCH = "SEARCH_SWITCH"; + public static final String SETTINGS_OPENED = "SETTINGS_OPENED"; + public static final String URL_BOOKMARKED = "URL_BOOKMARKED"; + public static final String BOOKMARK_OPENED = "BOOKMARK_OPENED"; + public static final String TAB_OPENED = "TAB_OPENED"; + public static final String GATEWAY_OPENED = "GATEWAY_OPENED"; + public static final String HISTORY_OPENED = "HISTORY_OPENED"; + public static final String HISTORY_TRIGGERED = "HISTORY_TRIGGERED"; + public static final String BOOKMARK_TRIGGERED = "BOOKMARK_TRIGGERED"; + public static final String TAB_TRIGGERED = "TAB_TRIGGERED"; + public static final String URL_ERROR = "URL_ERROR"; + public static final String URL_ERROR_NOT_LOADED = "URL_ERROR_NOT_LOADED"; + public static final String PAGE_OPENED_SUCCESS = "PAGE_OPENED_SUCCESS"; + public static final String HOME_INVOKED = "HOME_INVOKED"; + public static final String SEARCH_INVOKED = "SEARCH_INVOKED"; + public static final String MENU_INVOKED = "MENU_INVOKED"; + public static final String ON_BACK = "ON_BACK"; +} + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java new file mode 100755 index 00000000..b754cfda --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java @@ -0,0 +1,162 @@ +package com.darkweb.genesissearchengine.dataManager; + +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel; +import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; +import com.darkweb.genesissearchengine.appManager.historyManager.historyController; +import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; +import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession; +import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.status; + + +import java.util.ArrayList; + +public class dataController +{ + /*Private Variables*/ + + private dataModel mPreferencesModel; + private historyController mHistoryController; + + /*Private Declarations*/ + + private static final dataController sOurInstance = new dataController(); + public static dataController getInstance() + { + return sOurInstance; + } + + /*Initializations*/ + + public void initialize(AppCompatActivity app_context){ + mPreferencesModel = new dataModel(app_context); + mPreferencesModel.initializeBookmarks(); + mPreferencesModel.setMaxHistoryID(databaseController.getInstance().getLargestHistoryID()); + mPreferencesModel.setHistorySize(databaseController.getInstance().getLargestHistoryID()); + } + public void initializeListData(){ + if(!status.sHistoryStatus) + { + mPreferencesModel.initializeHistory(databaseController.getInstance().selectHistory(0,constants.START_LIST_SIZE)); + } + else + { + databaseController.getInstance().execSQL("delete from history where 1",null); + } + mPreferencesModel.initSuggestions(); + } + + /*Saving Preferences*/ + + public void setString(String valueKey, String value){ + mPreferencesModel.setString(valueKey, value); + } + public void setBool(String valueKey, boolean value){ + if(mPreferencesModel!=null){ + mPreferencesModel.setBool(valueKey, value); + } + } + public void setInt(String valueKey, int value) + { + mPreferencesModel.setInt(valueKey, value); + } + + /*Recieving Preferences*/ + + public String getString(String valueKey, String valueDefault){ + return mPreferencesModel.getString(valueKey, valueDefault); + } + public boolean getBool(String valueKey, boolean valueDefault){ + return mPreferencesModel.getBool(valueKey, valueDefault); + } + public int getInt(String valueKey, int valueDefault){ + return mPreferencesModel.getInt(valueKey, valueDefault); + } + public float getFloat(String valueKey, int valueDefault){ + return mPreferencesModel.getFloat(valueKey, valueDefault); + } + + public void clearAllPrefs(){ + mPreferencesModel.clearPrefs(); + } + /*Recieving History*/ + + public ArrayList getHistory() { + return mPreferencesModel.getmHistory(); + } + public void addHistory(String url,String title) { + mPreferencesModel.addHistory(url); + activityContextManager.getInstance().getHomeController().onSuggestionUpdate(); + } + public void updateSuggestionURL(String url,String title) { + mPreferencesModel.updateSuggestionURL(url,title); + activityContextManager.getInstance().getHomeController().onSuggestionUpdate(); + } + public void addSuggesion(String url,String title) { + mPreferencesModel.addSuggenstions(url,title); + activityContextManager.getInstance().getHomeController().onSuggestionUpdate(); + } + public void removeHistory(String url){ + mPreferencesModel.removeHistory(url); + } + public void clearHistory(){ + mPreferencesModel.clearHistory(); + activityContextManager.getInstance().getHomeController().onSuggestionUpdate(); + } + public void loadMoreHistory(){ + ArrayList history = databaseController.getInstance().selectHistory(mPreferencesModel.getmHistory().size()-1,constants.MAX_LIST_SIZE); + if(history.size()>0){ + mPreferencesModel.loadMoreHistory(history); + } + activityContextManager.getInstance().getHistoryController().updateHistory(); + } + + /*Recieving Bookmarks*/ + + public ArrayList getBookmark(){ + return mPreferencesModel.getBookmark(); + } + public void addBookmark(String url,String title){ + mPreferencesModel.addBookmark(url,title); + } + public void clearBookmark(){ + mPreferencesModel.clearBookmark(); + } + + /*Recieving Suggestions*/ + + public ArrayList getSuggestions(){ + return mPreferencesModel.getmSuggestions(); + } + public void clearSuggestions(){ + mPreferencesModel.clearSuggestion(); + } + + /*Recieving Tabs*/ + + public ArrayList getTab(){ + return mPreferencesModel.getTab(); + } + public void addTab(geckoSession mSession,boolean isHardCopy){ + mPreferencesModel.addTabs(mSession,isHardCopy); + } + public void clearTabs(){ + mPreferencesModel.clearTab(); + } + public void closeTab(geckoSession session){ + mPreferencesModel.closeTab(session); + } + public void moveTabToTop(geckoSession session){ + mPreferencesModel.moveTabToTop(session); + } + public tabRowModel getCurrentTab(){ + return mPreferencesModel.getCurrentTab(); + } + public int getTotalTabs(){ + return mPreferencesModel.getTotalTabs(); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataModel.java new file mode 100755 index 00000000..fc3e4f4a --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataModel.java @@ -0,0 +1,428 @@ +package com.darkweb.genesissearchengine.dataManager; + +import android.annotation.SuppressLint; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; +import android.util.Log; + +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel; +import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; +import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; +import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession; +import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; +import com.darkweb.genesissearchengine.constants.constants; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +@SuppressLint("CommitPrefEdits") +class dataModel +{ + private SharedPreferences mPrefs; + private SharedPreferences.Editor mEdit; + + private ArrayList mHistory = new ArrayList<>(); + private ArrayList mBookmarks = new ArrayList<>(); + private ArrayList mTabs = new ArrayList<>(); + private ArrayList mSuggestions = new ArrayList<>(); + private Map mHistoryCache = new HashMap<>(); + private Map mSuggestionCache = new HashMap<>(); + + private int mMaxHistoryId = 0; + private int mHistorySize = 0; + + dataModel(AppCompatActivity app_context){ + mPrefs = PreferenceManager.getDefaultSharedPreferences(app_context); + mEdit = mPrefs.edit(); + } + void clearPrefs(){ + mEdit.clear(); + mEdit.apply(); + } + + /*Prefs Data Model*/ + + void setString(String valueKey, String value){ + mEdit.putString(valueKey, value); + mEdit.apply(); + } + String getString(String valueKey, String valueDefault){ + return mPrefs.getString(valueKey, valueDefault); + } + void setBool(String valueKey, boolean value){ + mEdit.putBoolean(valueKey, value); + mEdit.apply(); + } + boolean getBool(String valueKey, boolean valueDefault){ + return mPrefs.getBoolean(valueKey, valueDefault); + } + void setInt(String valueKey, int value){ + mEdit.putInt(valueKey, value); + mEdit.apply(); + } + int getInt(String valueKey, int valueDefault){ + return mPrefs.getInt(valueKey, valueDefault); + } + void setFloat(String valueKey, int value){ + mEdit.putInt(valueKey, value); + mEdit.apply(); + } + int getFloat(String valueKey, int valueDefault){ + return mPrefs.getInt(valueKey, valueDefault); + } + + + /*List History*/ + + void initializeHistory(ArrayList history){ + this.mHistory = history; + initializeCache(history); + Log.i("",""); + } + private void initializeCache(ArrayList history){ + for(int count=0;count<=history.size()-1;count++){ + mHistoryCache.put(history.get(count).getmHeader(),true); + historyRowModel tempSuggestion = new historyRowModel(history.get(count).getTitle(),history.get(count).getmHeader(),-1); + mSuggestions.add(tempSuggestion); + mSuggestionCache.put(history.get(count).getmHeader(),tempSuggestion); + } + } + void updateSuggestionURL(String url, String newURL){ + if(url.length()>1500){ + return; + } + historyRowModel model = mSuggestionCache.get(url); + if(model!=null){ + mSuggestionCache.remove(url); + model.updateURL(newURL); + mSuggestionCache.put(newURL,model); + } + + } + void addSuggenstions(String url, String title){ + if(url.length()>1500){ + return; + } + + historyRowModel tempModel = mSuggestionCache.get(url); + + if(tempModel==null){ + historyRowModel model = new historyRowModel(title,url,-1); + mSuggestions.add(0,model); + mSuggestionCache.put(url,model); + } + else { + historyRowModel model = mSuggestionCache.get(url); + if(model!=null){ + model.updateTitle(title); + } + } + + String[] params = new String[2]; + params[0] = title; + params[1] = url; + if(title.length()>0){ + databaseController.getInstance().execSQL("UPDATE history SET title = ? , date = DateTime('now') WHERE url = ?",params); + } + } + void addHistory(String url) { + + if(url.length()>1500){ + return; + } + @SuppressLint("SimpleDateFormat") SimpleDateFormat d_form = new SimpleDateFormat("dd MMMM | hh:mm a"); + String date = d_form.format(new Date()); + + Object url_exists = mHistoryCache.get(url); + if(url_exists!=null){ + for(int count = 0; count< mHistory.size(); count++){ + historyRowModel model = mHistory.get(count); + if(model.getmHeader().equals(url)){ + mHistory.remove(count); + mHistory.add(0,model); + databaseController.getInstance().execSQL("UPDATE history SET date = '"+date+"' WHERE id="+model.getmId(),null); + break; + } + } + + historyRowModel model = mSuggestionCache.get(url); + if(model!=null){ + Log.i("ERERER3",mSuggestions.size()+""); + mSuggestions.remove(model); + mSuggestions.add(0,model); + Log.i("ERERER4",mSuggestions.size()+""); + } + + return; + } + + if(mHistorySize > constants.MAX_LIST_DATA_SIZE) + { + databaseController.getInstance().execSQL("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.MAX_LIST_DATA_SIZE /2)+")",null); + } + + String[] params = new String[1]; + params[0] = url; + + mMaxHistoryId = mMaxHistoryId +1; + mHistorySize += 1; + + databaseController.getInstance().execSQL("INSERT INTO history(id,date,url,title) VALUES("+ mMaxHistoryId +",DateTime('now'),?,'');",params); + mHistory.add(0,new historyRowModel(url,date, mMaxHistoryId)); + mHistoryCache.put(url,true); + } + ArrayList getmHistory() { + return mHistory; + } + void setMaxHistoryID(int max_history_id){ + this.mMaxHistoryId = max_history_id; + } + void setHistorySize(int history_size){ + this.mHistorySize = history_size; + } + void removeHistory(String url) { + mHistoryCache.remove(url); + mHistorySize -= 1; + } + void clearHistory() { + mHistory.clear(); + mHistoryCache.clear(); + mSuggestionCache.clear(); + Log.i("ERERER5",mSuggestions.size()+""); + mSuggestions.clear(); + Log.i("ERERER6",mSuggestions.size()+""); + initSuggestions(); + } + void loadMoreHistory(ArrayList history){ + this.mHistory.addAll(history); + for(int count=0;count<=history.size()-1;count++){ + mHistoryCache.put(history.get(count).getmHeader(),true); + } + } + + /*List Bookmark*/ + + void initializeBookmarks(){ + mBookmarks = databaseController.getInstance().selectBookmark(); + } + void addBookmark(String url, String title){ + if(url.length()>1500){ + return; + } + int autoval = 0; + if(mBookmarks.size()> constants.MAX_LIST_SIZE) + { + databaseController.getInstance().execSQL("delete from bookmark where id="+ mBookmarks.get(mBookmarks.size()-1).getmId(),null); + mBookmarks.remove(mHistory.size()-1); + } + + if(mBookmarks.size()>0) + { + autoval = mBookmarks.get(0).getmId()+1; + } + + if(title.equals("")) + { + title = "New_Bookmark"+autoval; + } + + String[] params = new String[2]; + params[0] = title; + params[1] = url; + + databaseController.getInstance().execSQL("INSERT INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params); + mBookmarks.add(0,new bookmarkRowModel(url,title,autoval)); + } + ArrayList getBookmark(){ + return mBookmarks; + } + void clearBookmark() { + mBookmarks.clear(); + } + + /*List Tabs*/ + + void addTabs(geckoSession mSession,boolean isHardCopy){ + if(!isHardCopy){ + mTabs.add(0,new tabRowModel(mSession,mTabs.size())); + } + else { + mTabs.add(0,new tabRowModel(mSession,mTabs.size())); + } + } + ArrayList getTab(){ + return mTabs; + } + void clearTab() { + int size = mTabs.size(); + for(int counter = 0; counter< size; counter++){ + mTabs.get(0).getSession().stop(); + mTabs.remove(0); + } + if(mTabs.size()>0){ + Log.i("FUCKERRROR125:","_FERROR_"); + mTabs.get(0).getSession().closeSession(); + } + } + void closeTab(geckoSession mSession) { + + for(int counter = 0; counter< mTabs.size(); counter++){ + if(mTabs.get(counter).getSession().getSessionID()==mSession.getSessionID()) + { + mTabs.remove(counter); + break; + } + else { + mTabs.get(counter).setId(mTabs.get(counter).getmId()+1); + } + } + } + void moveTabToTop(geckoSession mSession) { + + for(int counter = 0; counter< mTabs.size(); counter++){ + + if(mTabs.get(counter).getSession().getSessionID()==mSession.getSessionID()) + { + /***BIG PROBLEM***/ + mTabs.remove(counter); + mTabs.add(0,new tabRowModel(mSession,0)); + break; + }else { + mTabs.get(counter).setId(mTabs.get(counter).getmId()+1); + } + } + } + tabRowModel getCurrentTab(){ + if(mTabs.size()>0){ + return mTabs.get(0); + } + else { + return null; + } + } + int getTotalTabs(){ + return mTabs.size(); + } + + /*List Suggestion*/ + + ArrayList getmSuggestions(){ + return mSuggestions; + } + void clearSuggestion(){ + mSuggestions.clear(); + initSuggestions(); + } + void initSuggestions(){ + + Log.i("ERERER9",mSuggestions.size()+""); + mSuggestions.add(new historyRowModel("Youtube","https://youtube.com",-1)); + mSuggestions.add(new historyRowModel("Facebook","https://facebook.com",-1)); + mSuggestions.add(new historyRowModel("Twitter","https://twitter.com",-1)); + mSuggestions.add(new historyRowModel("Amazon","https://amazon.com",-1)); + mSuggestions.add(new historyRowModel("IMDB","https://imdb.com",-1)); + mSuggestions.add(new historyRowModel("Reddit","https://reddit.com",-1)); + mSuggestions.add(new historyRowModel("Pinterest","https://pinterest.com",-1)); + mSuggestions.add(new historyRowModel("EBay","https://ebay.com",-1)); + mSuggestions.add(new historyRowModel("Trip Advisor","https://tripadvisor.com",-1)); + mSuggestions.add(new historyRowModel("Craigslist","https://craigslist.org",-1)); + mSuggestions.add(new historyRowModel("Walmart","https://walmart.com",-1)); + mSuggestions.add(new historyRowModel("Instagram","https://instagram.com",-1)); + mSuggestions.add(new historyRowModel("Google","https://google.com",-1)); + mSuggestions.add(new historyRowModel("NY Times","https://nytimes.com",-1)); + mSuggestions.add(new historyRowModel("Apple","https://apple.com",-1)); + mSuggestions.add(new historyRowModel("Linkedin","https://linkedin.com",-1)); + mSuggestions.add(new historyRowModel("Indeed","https://indeed.com",-1)); + mSuggestions.add(new historyRowModel("Play.Google","https://play.google.com",-1)); + mSuggestions.add(new historyRowModel("ESPN","https://espn.com",-1)); + mSuggestions.add(new historyRowModel("Webmd","https://webmd.com",-1)); + mSuggestions.add(new historyRowModel("CNN","https://cnn.com",-1)); + mSuggestions.add(new historyRowModel("Homedepot","https://homedepot.com",-1)); + mSuggestions.add(new historyRowModel("ETSY","https://etsy.com",-1)); + mSuggestions.add(new historyRowModel("Netflix","https://netflix.com",-1)); + mSuggestions.add(new historyRowModel("Quora","https://quora.com",-1)); + mSuggestions.add(new historyRowModel("Microsoft","https://microsoft.com",-1)); + mSuggestions.add(new historyRowModel("Target","https://target.com",-1)); + mSuggestions.add(new historyRowModel("Merriam Webster","https://merriam-webster.com",-1)); + mSuggestions.add(new historyRowModel("Forbes","https://forbes.com",-1)); + mSuggestions.add(new historyRowModel("Mapquest","https://mapquest.com",-1)); + mSuggestions.add(new historyRowModel("NIH","https://nih.gov",-1)); + mSuggestions.add(new historyRowModel("Gamepedia","https://gamepedia.com",-1)); + mSuggestions.add(new historyRowModel("Yahoo","https://yahoo.com",-1)); + mSuggestions.add(new historyRowModel("Healthline","https://healthline.com",-1)); + mSuggestions.add(new historyRowModel("Foxnews","https://foxnews.com",-1)); + mSuggestions.add(new historyRowModel("All Recipes","https://allrecipes.com",-1)); + mSuggestions.add(new historyRowModel("Quizlet","https://quizlet.com",-1)); + mSuggestions.add(new historyRowModel("Weather","https://weather.com",-1)); + mSuggestions.add(new historyRowModel("Bestbuy","https://bestbuy.com",-1)); + mSuggestions.add(new historyRowModel("Urbandictionary","https://urbandictionary.com",-1)); + mSuggestions.add(new historyRowModel("Mayoclinic","https://mayoclinic.org",-1)); + mSuggestions.add(new historyRowModel("AOL","https://aol.com",-1)); + mSuggestions.add(new historyRowModel("Genius","https://genius.com",-1)); + mSuggestions.add(new historyRowModel("Zillow","https://zillow.com",-1)); + mSuggestions.add(new historyRowModel("Usatoday","https://usatoday.com",-1)); + mSuggestions.add(new historyRowModel("Glassdoor","https://glassdoor.com",-1)); + mSuggestions.add(new historyRowModel("MSN","https://msn.com",-1)); + mSuggestions.add(new historyRowModel("Rotten Tomatoes","https://rottentomatoes.com",-1)); + mSuggestions.add(new historyRowModel("Lowes","https://lowes.com",-1)); + mSuggestions.add(new historyRowModel("Dictionary","https://dictionary.com",-1)); + mSuggestions.add(new historyRowModel("Business Insider","https://businessinsider.com",-1)); + mSuggestions.add(new historyRowModel("US News","https://usnews.com",-1)); + mSuggestions.add(new historyRowModel("Medical News Today","https://medicalnewstoday.com",-1)); + mSuggestions.add(new historyRowModel("Britannica","https://britannica.com",-1)); + mSuggestions.add(new historyRowModel("Washington Post","https://washingtonpost.com",-1)); + mSuggestions.add(new historyRowModel("USPS","https://usps.com",-1)); + mSuggestions.add(new historyRowModel("Finance Yahoo","https://finance.yahoo.com",-1)); + mSuggestions.add(new historyRowModel("IRS","https://irs.gov",-1)); + mSuggestions.add(new historyRowModel("Yellow Pages","https://yellowpages.com",-1)); + mSuggestions.add(new historyRowModel("Chase","https://chase.com",-1)); + mSuggestions.add(new historyRowModel("Retail Menot","https://retailmenot.com",-1)); + mSuggestions.add(new historyRowModel("Accuweather","https://accuweather.com",-1)); + mSuggestions.add(new historyRowModel("Way Fair","https://wayfair.com",-1)); + mSuggestions.add(new historyRowModel("GO","https://go.com",-1)); + mSuggestions.add(new historyRowModel("Live","https://live.com",-1)); + mSuggestions.add(new historyRowModel("Login Yahoo","https://login.yahoo.com",-1)); + mSuggestions.add(new historyRowModel("Steam Community","https://steamcommunity.com",-1)); + mSuggestions.add(new historyRowModel("XFinity","https://xfinity.com",-1)); + mSuggestions.add(new historyRowModel("CNET","https://cnet.com",-1)); + mSuggestions.add(new historyRowModel("IGN","https://ign.com",-1)); + mSuggestions.add(new historyRowModel("Steam Powered","https://steampowered.com",-1)); + mSuggestions.add(new historyRowModel("Macys","https://macys.com",-1)); + mSuggestions.add(new historyRowModel("Wikihow","https://wikihow.com",-1)); + mSuggestions.add(new historyRowModel("Mail Yahoo","https://mail.yahoo.com",-1)); + mSuggestions.add(new historyRowModel("Wiktionary","wiktionary.org",-1)); + mSuggestions.add(new historyRowModel("Cbssports","https://cbssports.com",-1)); + mSuggestions.add(new historyRowModel("CNBC","https://cnbc.com",-1)); + mSuggestions.add(new historyRowModel("Bank Of America","https://bankofamerica.com",-1)); + mSuggestions.add(new historyRowModel("Expedia","https://expedia.com",-1)); + mSuggestions.add(new historyRowModel("Wellsfargo","https://wellsfargo.com",-1)); + mSuggestions.add(new historyRowModel("Groupon","https://groupon.com",-1)); + mSuggestions.add(new historyRowModel("Twitch","https://twitch.tv",-1)); + mSuggestions.add(new historyRowModel("Khan Academy","https://khanacademy.org",-1)); + mSuggestions.add(new historyRowModel("The Guardian","https://theguardian.com",-1)); + mSuggestions.add(new historyRowModel("Paypal","https://paypal.com",-1)); + mSuggestions.add(new historyRowModel("Spotify","https://spotify.com",-1)); + mSuggestions.add(new historyRowModel("ATT","https://att.com",-1)); + mSuggestions.add(new historyRowModel("NFL","https://nfl.com",-1)); + mSuggestions.add(new historyRowModel("Realtor","https://realtor.com",-1)); + mSuggestions.add(new historyRowModel("CA Gov","https://ca.gov",-1)); + mSuggestions.add(new historyRowModel("Good Reads","https://goodreads.com",-1)); + mSuggestions.add(new historyRowModel("Office","https://office.com",-1)); + mSuggestions.add(new historyRowModel("UFL","https://ufl.edu",-1)); + mSuggestions.add(new historyRowModel("MLB","https://mlb.com",-1)); + mSuggestions.add(new historyRowModel("Food Network","https://foodnetwork.com",-1)); + mSuggestions.add(new historyRowModel("BBC","https://bbc.com",-1)); + mSuggestions.add(new historyRowModel("Apartments","https://apartments.com",-1)); + mSuggestions.add(new historyRowModel("NPR","https://npr.org",-1)); + mSuggestions.add(new historyRowModel("Wow Head","https://wowhead.com",-1)); + mSuggestions.add(new historyRowModel("Duckduckgo","https://duckduckgo.com",-1)); + mSuggestions.add(new historyRowModel("Bing","https://bing.com",-1)); + mSuggestions.add(new historyRowModel("Google","https://google.com",-1)); + mSuggestions.add(new historyRowModel("Genesis Search","https://boogle.store",-1)); + Log.i("ERERER10",mSuggestions.size()+""); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/JavaScriptInterface.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/JavaScriptInterface.java new file mode 100644 index 00000000..41451d2a --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/JavaScriptInterface.java @@ -0,0 +1,83 @@ +package com.darkweb.genesissearchengine.helperManager; + +import android.app.NotificationManager; +import android.content.Context; +import android.os.Environment; +import android.os.Handler; +import android.util.Base64; +import android.webkit.JavascriptInterface; + +import androidx.core.app.NotificationCompat; + +import com.example.myapplication.R; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.DateFormat; +import java.util.Date; + +public class JavaScriptInterface { + private Context context; + private NotificationManager nm; + public JavaScriptInterface(Context context) { + this.context = context; + } + + @JavascriptInterface + public void getBase64FromBlobData(String base64Data) throws IOException { + convertBase64StringToPdfAndStoreIt(base64Data); + } + public static String getBase64StringFromBlobUrl(String blobUrl){ + if(blobUrl.startsWith("blob")){ + return "javascript: var xhr = new XMLHttpRequest();" + + "xhr.open('GET', 'YOUR BLOB URL GOES HERE', true);" + + "xhr.setRequestHeader('Content-type','application/pdf');" + + "xhr.responseType = 'blob';" + + "xhr.onload = function(e) {" + + " if (this.status == 200) {" + + " var blobPdf = this.response;" + + " var reader = new FileReader();" + + " reader.readAsDataURL(blobPdf);" + + " reader.onloadend = function() {" + + " base64data = reader.result;" + + " Android.getBase64FromBlobData(base64data);" + + " }" + + " }" + + "};" + + "xhr.send();"; + } + return "javascript: console.log('It is not a Blob URL');"; + } + private void convertBase64StringToPdfAndStoreIt(String base64PDf) throws IOException { + final int notificationId = 1; + String currentDateTime = DateFormat.getDateTimeInstance().format(new Date()); + final File dwldsPath = new File(Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_DOWNLOADS) + "/YourFileName_" + currentDateTime + "_.pdf"); + byte[] pdfAsBytes = Base64.decode(base64PDf.replaceFirst("^data:application/pdf;base64,", ""), 0); + FileOutputStream os; + os = new FileOutputStream(dwldsPath, false); + os.write(pdfAsBytes); + os.flush(); + + if(dwldsPath.exists()) { + NotificationCompat.Builder b = new NotificationCompat.Builder(context, "MY_DL") + .setDefaults(NotificationCompat.DEFAULT_ALL) + .setWhen(System.currentTimeMillis()) + .setSmallIcon(R.xml.ic_download) + .setContentTitle("MY TITLE") + .setContentText("MY TEXT CONTENT"); + nm = (NotificationManager) this.context.getSystemService(Context.NOTIFICATION_SERVICE); + if(nm != null) { + nm.notify(notificationId, b.build()); + Handler h = new Handler(); + long delayInMilliseconds = 5000; + h.postDelayed(new Runnable() { + public void run() { + nm.cancel(notificationId); + } + }, delayInMilliseconds); + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/KeyboardUtils.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/KeyboardUtils.java new file mode 100755 index 00000000..9a573b89 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/KeyboardUtils.java @@ -0,0 +1,127 @@ +package com.darkweb.genesissearchengine.helperManager; + +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; + +/** + * Based on the following Stackoverflow answer: + * http://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android + */ +@SuppressWarnings("WeakerAccess") +public class KeyboardUtils implements ViewTreeObserver.OnGlobalLayoutListener +{ + private final static int MAGIC_NUMBER = 200; + + private SoftKeyboardToggleListener mCallback; + private View mRootView; + private Boolean prevValue = null; + private float mScreenDensity; + private static HashMap sListenerMap = new HashMap<>(); + + 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 > MAGIC_NUMBER; + + if (mCallback != null && (prevValue == null || isVisible != prevValue)) { + prevValue = isVisible; + mCallback.onToggleSoftKeyboard(isVisible); + } + } + + /** + * Add a new keyboard listener + * @param act calling activity + * @param listener callback + */ + public static void addKeyboardToggleListener(Activity act, SoftKeyboardToggleListener listener) + { + removeKeyboardToggleListener(listener); + + sListenerMap.put(listener, new KeyboardUtils(act, listener)); + } + + /** + * Remove a registered listener + * @param listener {@link SoftKeyboardToggleListener} + */ + public static void removeKeyboardToggleListener(SoftKeyboardToggleListener listener) + { + if(sListenerMap.containsKey(listener)) + { + KeyboardUtils k = sListenerMap.get(listener); + k.removeListener(); + + sListenerMap.remove(listener); + } + } + + /** + * Remove all registered keyboard listeners + */ + public static void removeAllKeyboardToggleListeners() + { + for(SoftKeyboardToggleListener l : sListenerMap.keySet()) + sListenerMap.get(l).removeListener(); + + sListenerMap.clear(); + } + + /** + * Manually toggle soft keyboard visibility + * @param context calling context + */ + public static void toggleKeyboardVisibility(Context context) + { + InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); + if(inputMethodManager != null) + inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } + + /** + * Force closes the soft keyboard + * @param activeView the view with the keyboard focus + */ + 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/helperManager/PathUtil.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/PathUtil.java new file mode 100755 index 00000000..0c9ac8a5 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/PathUtil.java @@ -0,0 +1,103 @@ +package com.darkweb.genesissearchengine.helperManager; + +import android.annotation.SuppressLint; +import android.content.ContentUris; +import android.content.Context; +import android.database.Cursor; +import android.net.Uri; +import android.os.Build; +import android.os.Environment; +import android.provider.DocumentsContract; +import android.provider.MediaStore; + +import java.net.URISyntaxException; + +/** + * Created by Aki on 1/7/2017. + */ + +public class PathUtil { + /* + * Gets the file path of the given Uri. + */ + @SuppressLint("NewApi") + public static String getPath(Context context, Uri uri) + { + final boolean needToCheckUri = Build.VERSION.SDK_INT >= 19; + String selection = null; + String[] selectionArgs = null; + + if(uri==null){ + return null; + } + + if (uri.getPathSegments()!=null && needToCheckUri && DocumentsContract.isDocumentUri(context.getApplicationContext(), uri)) { + if (isExternalStorageDocument(uri)) { + final String docId = DocumentsContract.getDocumentId(uri); + final String[] split = docId.split(":"); + return Environment.getExternalStorageDirectory() + "/" + split[1]; + } else if (isDownloadsDocument(uri)) { + final String id = DocumentsContract.getDocumentId(uri); + uri = ContentUris.withAppendedId( + Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); + } else if (isMediaDocument(uri)) { + final String docId = DocumentsContract.getDocumentId(uri); + final String[] split = docId.split(":"); + final String type = split[0]; + if ("image".equals(type)) { + uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; + } else if ("video".equals(type)) { + uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; + } else if ("audio".equals(type)) { + uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; + } + selection = "_id=?"; + selectionArgs = new String[]{ split[1] }; + } + } + + if(uri.getScheme()!=null){ + if ("content".equalsIgnoreCase(uri.getScheme())) { + String[] projection = { MediaStore.Images.Media.DATA }; + Cursor cursor = null; + try { + cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); + int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); + if (cursor.moveToFirst()) { + return cursor.getString(column_index); + } + } catch (Exception e) { + } + } else if ("file".equalsIgnoreCase(uri.getScheme())) { + return uri.getPath(); + } + } + return null; + } + + + /** + * @param uri The Uri to check. + * @return Whether the Uri authority is ExternalStorageProvider. + */ + public static boolean isExternalStorageDocument(Uri uri) { + return "com.android.externalstorage.documents".equals(uri.getAuthority()); + } + + /** + * @param uri The Uri to check. + * @return Whether the Uri authority is DownloadsProvider. + */ + public static boolean isDownloadsDocument(Uri uri) { + return "com.android.providers.downloads.documents".equals(uri.getAuthority()); + } + + /** + * @param uri The Uri to check. + * @return Whether the Uri authority is MediaProvider. + */ + public static boolean isMediaDocument(Uri uri) { + return "com.android.providers.media.documents".equals(uri.getAuthority()); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/animatedColor.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/animatedColor.java new file mode 100755 index 00000000..f953ea41 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/animatedColor.java @@ -0,0 +1,37 @@ +package com.darkweb.genesissearchengine.helperManager; + +import android.graphics.Color; + +public class animatedColor +{ + private final int mStartColor, mEndColor; + private final float[] mStartHSV, mEndHSV; + private float[] mMove = new float[3]; + + + public animatedColor(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/helperManager/autoCompleteAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/autoCompleteAdapter.java new file mode 100755 index 00000000..31bce8c6 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/autoCompleteAdapter.java @@ -0,0 +1,104 @@ +package com.darkweb.genesissearchengine.helperManager; + +import java.util.ArrayList; +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.Filter; +import android.widget.TextView; +import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; +import com.darkweb.genesissearchengine.constants.strings; +import com.example.myapplication.R; + +public class autoCompleteAdapter extends ArrayAdapter { + private final String MY_DEBUG_TAG = "CustomerAdapter"; + private ArrayList items; + private ArrayList itemsAll; + private ArrayList suggestions; + private int viewResourceId; + + public autoCompleteAdapter(Context context, int viewResourceId, ArrayList items) { + super(context, viewResourceId, items); + this.items = items; + this.itemsAll = (ArrayList) items.clone(); + this.suggestions = new ArrayList<>(); + this.viewResourceId = viewResourceId; + } + + public View getView(int position, View convertView, ViewGroup parent) { + View v = convertView; + if (v == null) { + LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + v = vi.inflate(viewResourceId, null); + } + historyRowModel customer = items.get(position); + if (customer != null) { + + TextView customerNameLabel = v.findViewById(R.id.hintCompletionTitle); + TextView myTv = v.findViewById( R.id.hintCompletionUrl); + + if (customerNameLabel != null) { + if(customer.getTitle().equals(strings.EMPTY_STR)){ + customerNameLabel.setText(customer.getmHeader() ); + }else { + customerNameLabel.setText(customer.getTitle()); + } + myTv.setText(customer.getmDescription()); + } + } + return v; + } + + @Override + public Filter getFilter() { + return nameFilter; + } + + Filter nameFilter = new Filter() { + @Override + public String convertResultToString(Object resultValue) { + String str = ((historyRowModel)(resultValue)).getmHeader(); + return str; + } + @Override + protected FilterResults performFiltering(CharSequence constraint) { + if(constraint != null && !constraint.equals("about:blank")) { + suggestions.clear(); + for (historyRowModel customer : itemsAll) { + if(suggestions.size()>10){ + break; + } + if(customer.getmHeader().length()>2 && customer.getmDescription().toLowerCase().length()>2 && (customer.getmHeader().toLowerCase().contains(constraint.toString().toLowerCase()) || customer.getmDescription().toLowerCase().contains(constraint.toString().toLowerCase()))){ + suggestions.add(customer); + } + } + FilterResults filterResults = new FilterResults(); + filterResults.values = suggestions; + filterResults.count = suggestions.size(); + return filterResults; + } else { + return new FilterResults(); + } + } + @Override + protected void publishResults(CharSequence constraint, FilterResults results) + { + try{ + if(results != null && results.count > 0) { + ArrayList filteredList = (ArrayList)((ArrayList)results.values).clone(); + + clear(); + for (historyRowModel c : filteredList) { + add(c); + } + notifyDataSetChanged(); + } + }catch (Exception ignored){ + + } + } + }; + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/downloadFileService.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/downloadFileService.java new file mode 100755 index 00000000..7f7568a0 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/downloadFileService.java @@ -0,0 +1,60 @@ +package com.darkweb.genesissearchengine.helperManager; + +import android.annotation.SuppressLint; +import android.app.DownloadManager; +import android.app.IntentService; +import android.content.ActivityNotFoundException; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.os.Environment; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import java.io.File; + +public class downloadFileService 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 downloadFileService() { + super("DownloadSongService"); + } + @SuppressLint("StaticFieldLeak") + static Context context; + + public static Intent getDownloadService(final @NonNull Context callingClassContext, final @NonNull String downloadPath, final @NonNull String destinationPath) { + downloadFileService.context = callingClassContext; + return new Intent(callingClassContext, downloadFileService.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.split("__"); + + try { + File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); + Uri mDestinationUri = Uri.withAppendedPath(Uri.fromFile(file), fn[1]); + + File myFile = new File(mDestinationUri.getPath()); + if(myFile.exists()) + myFile.delete(); + + Uri uri = Uri.parse(fn[0]); // Path where you want to download file. + DownloadManager manager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE); + DownloadManager.Request req = new DownloadManager.Request(uri); + req.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fn[1]); + req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); + manager.enqueue(req); + } catch ( ActivityNotFoundException e ) { + e.printStackTrace(); + Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS); + startActivity(intent); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/errorHandler.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/errorHandler.java new file mode 100755 index 00000000..26a32a01 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/errorHandler.java @@ -0,0 +1,182 @@ +package com.darkweb.genesissearchengine.helperManager; + +import android.webkit.URLUtil; + +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.constants.strings; + +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) { + this.mContext = mContext; + if (mErrorTemplate == null) { + InputStream stream = null; + BufferedReader reader = null; + StringBuilder builder = new StringBuilder(); + try { + stream = mContext.getResources().getAssets().open("error.html"); + 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; + } finally { + if (stream != null) { + try { + stream.close(); + } catch (IOException e) { + } + } + + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + } + } + } + } + + String title = helperMethod.getHost(url); + return createErrorPage("CODE : " + categoryToString(category) + "
TYPE : " + errorToString(error)).replace("$URL",url).replace("$TITLE",title); + } + + 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) { + if(error==null){ + return strings.EMPTY_STR; + } + + if (mErrorTemplate == null) { + InputStream stream = null; + BufferedReader reader = null; + StringBuilder builder = new StringBuilder(); + try { + stream = mContext.getResources().getAssets().open("error.html"); + 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; + } finally { + if (stream != null) { + try { + stream.close(); + } catch (IOException e) { + } + } + + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + } + } + } + } + + return mErrorTemplate.replace("$ERROR", error); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/eventObserver.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/eventObserver.java new file mode 100755 index 00000000..5c6b848e --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/eventObserver.java @@ -0,0 +1,13 @@ +package com.darkweb.genesissearchengine.helperManager; + +import com.darkweb.genesissearchengine.constants.enums; + +import java.util.List; + +public class eventObserver +{ + public interface eventListener + { + void invokeObserver(List data, enums.etype event_type); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java new file mode 100755 index 00000000..113ee873 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java @@ -0,0 +1,298 @@ +package com.darkweb.genesissearchengine.helperManager; + +import android.Manifest; +import android.app.DownloadManager; +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.res.Resources; +import android.graphics.Color; +import android.graphics.Point; +import android.net.Uri; +import android.os.Build; +import android.text.SpannableString; +import android.text.Spanned; +import android.text.style.ForegroundColorSpan; +import android.view.Display; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.RotateAnimation; +import android.view.inputmethod.InputMethodManager; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; +import androidx.core.app.ShareCompat; +import androidx.core.content.ContextCompat; + +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.example.myapplication.BuildConfig; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.List; + +import javax.net.ssl.HttpsURLConnection; + +import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; +import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; + +public class helperMethod +{ + /*Helper Methods General*/ + + public static String completeURL(String url){ + + URL weburl = null; + try + { + weburl = new URL(url); + URLConnection result = weburl.openConnection(); + + if (result instanceof HttpsURLConnection) { + + } + else if (result instanceof HttpURLConnection) { + // http + } + else { + // null or something bad happened + } + } catch (IOException e) + { + e.printStackTrace(); + } + + if(!url.startsWith("www.")&& !url.startsWith("http://")&& !url.startsWith("https://")){ + url = ""+url; + } + if(!url.startsWith("http://")&&!url.startsWith("https://")){ + url = "http://"+url; + } + return url; + } + + public static SpannableString urlDesigner(String url){ + + if (url.contains("https://")) + { + SpannableString ss = new SpannableString(url); + ss.setSpan(new ForegroundColorSpan(Color.argb(255, 0, 123, 43)), 0, 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + ss.setSpan(new ForegroundColorSpan(Color.GRAY), 5, 8, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + return ss; + } else if (url.contains("http://")) + { + SpannableString ss = new SpannableString(url); + ss.setSpan(new ForegroundColorSpan(Color.argb(255, 0, 128, 43)), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + ss.setSpan(new ForegroundColorSpan(Color.GRAY), 4, 7, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + return ss; + } else + { + SpannableString ss = new SpannableString(url); + ss.setSpan(new ForegroundColorSpan(Color.BLACK), 0, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + return ss; + } + } + + public static void sendRateEmail(Context context){ + Intent i = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "gamesolstudios@gmail.com", null)); + i.putExtra(Intent.EXTRA_SUBJECT, "Issue Report"); + i.putExtra(Intent.EXTRA_TEXT , ""); + try { + if (i.resolveActivity(context.getPackageManager()) != null) { + context.startActivity(i); + } + } catch (android.content.ActivityNotFoundException ignored) { + } + } + + public static void hideKeyboard(AppCompatActivity context) { + View view = context.findViewById(android.R.id.content); + if (view != null) + { + InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); + assert imm != null; + imm.hideSoftInputFromWindow(view.getWindowToken(), 0); + } + } + + public static void rateApp(AppCompatActivity context){ + dataController.getInstance().setBool(keys.IS_APP_RATED,true); + context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine"))); + } + + public static void shareApp(AppCompatActivity context) { + ShareCompat.IntentBuilder.from(context) + .setType("text/plain") + .setChooserTitle("Hi! Check out this Awesome App") + .setSubject("Hi! Check out this Awesome App") + .setText("Genesis | Onion Search | http://play.google.com/store/apps/details?id=" + context.getPackageName()) + .startChooser(); + } + + public static void openDownloadFolder(AppCompatActivity context) + { + Intent intent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS); + if(intent.resolveActivity(context.getPackageManager()) != null) + { + context.startActivity(intent); + }else { + helperMethod.showToastMessage("Download Folder Not Found",context); + } + } + + + static String getHost(String link){ + URL url; + try + { + url = new URL(link); + return url.getHost(); + } + catch (MalformedURLException e) + { + e.printStackTrace(); + return ""; + } + + } + + public static void openActivity( Class cls,int type,AppCompatActivity context,boolean animation){ + Intent myIntent = new Intent(context, cls); + myIntent.putExtra(keys.list_type, type); + if(!animation){ + myIntent.addFlags(FLAG_ACTIVITY_NO_ANIMATION); + } + context.startActivity(myIntent); + } + + public static void onMinimizeApp(AppCompatActivity context){ + Intent startMain = new Intent(Intent.ACTION_MAIN); + startMain.addCategory(Intent.CATEGORY_HOME); + startMain.setFlags(FLAG_ACTIVITY_NEW_TASK); + context.startActivity(startMain); + } + + public static int screenWidth() + { + return (Resources.getSystem().getDisplayMetrics().widthPixels); + } + + public static RotateAnimation getRotationAnimation(){ + RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f); + rotate.setDuration(2000); + rotate.setRepeatCount(Animation.INFINITE); + return rotate; + } + + public static String getDomainName(String url) + { + try{ + URI uri = new URI(url); + String domain = uri.getHost(); + return domain.startsWith("www.") ? domain.substring(4) : domain; + }catch (Exception ex){ + return url; + } + } + + public static ViewGroup.MarginLayoutParams getCenterScreenPoint(ViewGroup.LayoutParams itemLayoutParams) { + double heightloader = Resources.getSystem().getDisplayMetrics().heightPixels*0.78; + ViewGroup.MarginLayoutParams params_loading = (ViewGroup.MarginLayoutParams) itemLayoutParams; + params_loading.topMargin = (int)(heightloader); + + return params_loading; + } + + @SuppressWarnings("ConstantConditions") + public static boolean isBuildValid (){ + return BuildConfig.FLAVOR.equals("aarch64") && Build.SUPPORTED_ABIS[0].equals("arm64-v8a") || BuildConfig.FLAVOR.equals("arm") && Build.SUPPORTED_ABIS[0].equals("armeabi-v7a") || BuildConfig.FLAVOR.equals("x86") && Build.SUPPORTED_ABIS[0].equals("x86") || BuildConfig.FLAVOR.equals("x86_64") && Build.SUPPORTED_ABIS[0].equals("x86_64"); + } + + public static void openPlayStore(String packageName,AppCompatActivity context) + { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse("market://details?id="+packageName)); + + if(intent.resolveActivity(context.getPackageManager()) != null) + { + context.startActivity(intent); + }else { + helperMethod.showToastMessage("Playstore Not Found",context); + } + + } + + public static int dpFromPx(final Context context, final float px) { + return (int)(px / context.getResources().getDisplayMetrics().density); + } + + public static int pxFromDp(int dp){ + return (int) (dp * Resources.getSystem().getDisplayMetrics().density); + } + + public static int getScreenHeight(AppCompatActivity context) { + Display display = context.getWindowManager().getDefaultDisplay(); + Point size = new Point(); + display.getRealSize(size); + return size.y; + } + + public static int getStatusBarHeight(Context context) { + int result = 0; + int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); + if (resourceId > 0) { + result = context.getResources().getDimensionPixelSize(resourceId); + } + return result; + } + + + public static void copyURL(String url,Context context){ + ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText("link", url); + clipboard.setPrimaryClip(clip); + + showToastMessage("Copied to Clipboard",context); + + } + + public static void showToastMessage(String message,Context context){ + Toast toast=Toast.makeText(context.getApplicationContext(),message,Toast.LENGTH_SHORT); + toast.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM, 0, 0); + toast.show(); + } + + public static boolean checkPermissions(AppCompatActivity context) { + String[] permissions = new String[]{ + Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.READ_EXTERNAL_STORAGE, + }; + + int result; + List listPermissionsNeeded = new ArrayList<>(); + for (String p : permissions) { + result = ContextCompat.checkSelfPermission(context, p); + if (result != PackageManager.PERMISSION_GRANTED) { + listPermissionsNeeded.add(p); + } + } + if (!listPermissionsNeeded.isEmpty()) { + ActivityCompat.requestPermissions(context, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), 100); + return false; + } + return true; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adManager.java new file mode 100755 index 00000000..02e03d91 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adManager.java @@ -0,0 +1,93 @@ +package com.darkweb.genesissearchengine.pluginManager; + +import android.util.Log; + +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.google.android.gms.ads.*; + +import static com.darkweb.genesissearchengine.constants.status.paid_status; + +class adManager +{ + + /*Private Variables*/ + + private AppCompatActivity mAppContext; + private eventObserver.eventListener mEvent; + private AdView mBannerAds; + private boolean bannerAdsLoading = false; + private boolean bannerAdsLoaded = false; + + /*Initializations*/ + + adManager(AppCompatActivity app_context, eventObserver.eventListener event, AdView banner_ads) { + this.mAppContext = app_context; + this.mEvent = event; + mBannerAds = banner_ads; + } + + void loadAds(){ + if(!paid_status) + { + if (!bannerAdsLoading) + { + bannerAdsLoading = true; + MobileAds.initialize(mAppContext, constants.ADMOB_KEY); + mBannerAds.setAlpha(0f); + initializeBannerAds(); + } + } + } + + boolean isAdvertLoaded(){ + return bannerAdsLoaded; + } + + /*Local Helper Methods*/ + + private void admobListeners(){ + if(!paid_status){ + mBannerAds.setAdListener(new AdListener() { + @Override + public void onAdLoaded() { + bannerAdsLoaded = true; + mEvent.invokeObserver(null,null); + } + + @Override + public void onAdFailedToLoad(int errorCode) { + Log.i("Failure___",""+errorCode); + } + + @Override + public void onAdOpened() { + } + + @Override + public void onAdClicked() { + } + + @Override + public void onAdLeftApplication() { + } + + @Override + public void onAdClosed() { + } + }); + } + } + + /*External Helper Methods*/ + + private void initializeBannerAds(){ + if(!paid_status){ + AdRequest request = new AdRequest.Builder().addTestDevice("E731DE5933CDC0E42B335787CE3E23EF").build(); + mBannerAds.loadAd(request); + admobListeners(); + } + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticManager.java new file mode 100755 index 00000000..a73e4c82 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticManager.java @@ -0,0 +1,61 @@ +package com.darkweb.genesissearchengine.pluginManager; + +import android.content.Context; +import android.content.SharedPreferences; +import androidx.appcompat.app.AppCompatActivity; +import com.crashlytics.android.Crashlytics; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.helperManager.eventObserver; + +import java.util.UUID; + +class analyticManager +{ + /*Private Variables*/ + + private AppCompatActivity mAppContext; + private String mUniqueID = null; + + /*Initializations*/ + + analyticManager(AppCompatActivity app_context, eventObserver.eventListener event){ + this.mAppContext = app_context; + initialize(); + } + + private void initialize(){ + final String PREF_UNIQUE_ID = constants.UNIQUE_KEY_ID; + + if (mUniqueID == null) + { + SharedPreferences sharedPrefs = mAppContext.getSharedPreferences( + PREF_UNIQUE_ID, Context.MODE_PRIVATE); + mUniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null); + if (mUniqueID == null) { + + new Thread(){ + public void run(){ + try{ + mUniqueID = UUID.randomUUID().toString(); + }catch (Exception ex){ + mUniqueID = UUID.randomUUID().toString(); + } + + SharedPreferences.Editor editor = sharedPrefs.edit(); + editor.putString(PREF_UNIQUE_ID, mUniqueID); + editor.apply(); + } + }.start(); + } + } + } + + /*Helper Methods*/ + + void logUser(){ + Crashlytics.setUserIdentifier(mUniqueID); + Crashlytics.setUserEmail(constants.USER_EMAIL); + Crashlytics.setUserName(mUniqueID); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/exitManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/exitManager.java old mode 100644 new mode 100755 index da6de3b1..47c99584 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/exitManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/exitManager.java @@ -1,32 +1,34 @@ -package com.darkweb.genesissearchengine.pluginManager; - -import android.app.Service; -import android.content.Intent; -import android.os.IBinder; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.dataManager.preference_manager; - -public class exitManager 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() { - super.onDestroy(); - preference_manager.getInstance().setBool(keys.low_memory,false); - } - - @Override - public void onTaskRemoved(Intent rootIntent) { - stopSelf(); - preference_manager.getInstance().setBool(keys.low_memory,false); - } -} \ No newline at end of file +package com.darkweb.genesissearchengine.pluginManager; + +import android.app.Service; +import android.content.Intent; +import android.os.IBinder; + +/* +public class exitManager extends Service { + + @Override + public IBinder onBind(Intent intent) { + return null; + } + + public exitManager(){ + } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + return START_NOT_STICKY; + } + + @Override + public void onDestroy() { + super.onDestroy(); + pluginController.getInstance().proxyManagerExitInvoke(); + } + + @Override + public void onTaskRemoved(Intent rootIntent) { + stopSelf(); + pluginController.getInstance().proxyManagerExitInvoke(); + } +}*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/fabricManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/fabricManager.java old mode 100644 new mode 100755 index 476a6269..9d54f071 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/fabricManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/fabricManager.java @@ -1,38 +1,29 @@ -package com.darkweb.genesissearchengine.pluginManager; - -import android.content.Context; -import com.crashlytics.android.Crashlytics; -import com.darkweb.genesissearchengine.appManager.home_activity.home_model; -import io.fabric.sdk.android.Fabric; - -public class fabricManager -{ - /*Private Variables*/ - - private static final fabricManager ourInstance = new fabricManager(); - - /*Initializations*/ - - public static fabricManager getInstance() - { - return ourInstance; - } - - private fabricManager() - { - } - - public void init(Context context) - { - Fabric.with(context, new Crashlytics()); - analyticmanager.getInstance().initialize(home_model.getInstance().getAppContext()); - analyticmanager.getInstance().logUser(); - } - - /*Helper Methods*/ - - public void sendEvent(String value) - { - //analyticmanager.getInstance().sendEvent(value); - } -} +package com.darkweb.genesissearchengine.pluginManager; + +import androidx.appcompat.app.AppCompatActivity; + +import com.crashlytics.android.Crashlytics; +import com.darkweb.genesissearchengine.helperManager.eventObserver; + +import io.fabric.sdk.android.Fabric; + +class fabricManager +{ + /*Private Variables*/ + + private AppCompatActivity mAppContext; + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + fabricManager(AppCompatActivity mAppContext, eventObserver.eventListener mEvent){ + this.mAppContext = mAppContext; + this.mEvent = mEvent; + initialize(); + } + + private void initialize(){ + Fabric.with(mAppContext, new Crashlytics()); + mEvent.invokeObserver(null,null); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/firebaseManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/firebaseManager.java new file mode 100755 index 00000000..89d40c12 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/firebaseManager.java @@ -0,0 +1,40 @@ +package com.darkweb.genesissearchengine.pluginManager; + +import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.flurry.android.FlurryAgent; + +class firebaseManager +{ + /*Private Variables*/ + + private AppCompatActivity mAppContext; + + /*Initializations*/ + + firebaseManager(AppCompatActivity app_context, eventObserver.eventListener event){ + this.mAppContext = app_context; + + initialize(); + } + + public void initialize() + { + new FlurryAgent.Builder() + .withLogEnabled(true) + .build(mAppContext, "BKFSCH4CRS6RB9HSCM9H"); + } + + /*Helper Methods*/ + + void logEvent(String value) + { + if(FlurryAgent.isSessionActive()){ + FlurryAgent.logEvent(value); + } + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java new file mode 100755 index 00000000..181f8874 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java @@ -0,0 +1,629 @@ +package com.darkweb.genesissearchengine.pluginManager; + +import android.annotation.SuppressLint; +import android.app.DownloadManager; +import android.content.DialogInterface; +import android.content.Intent; +import android.graphics.Color; +import android.net.Uri; +import android.os.Handler; +import android.text.InputType; +import android.view.Gravity; +import android.widget.EditText; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import com.crowdfire.cfalertdialog.CFAlertDialog; +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.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; +import java.io.File; +import java.util.Collections; +import java.util.List; + +class messageManager +{ + /*Private Variables*/ + + private boolean is_popup_open = false; + private CFAlertDialog.Builder popup_instance; + private List data; + private boolean isDialogDismissed = true; + + private AppCompatActivity app_context; + private eventObserver.eventListener event; + private CFAlertDialog dialog_main = null; + + /*Initializations*/ + + messageManager(eventObserver.eventListener event) + { + this.event = event; + initialize(); + } + + private void initialize() + { + popup_instance = new CFAlertDialog.Builder(app_context); + } + + private void onDismissListener() + { + popup_instance.onDismissListener(dialogInterface -> is_popup_open = false); + } + + /*Helper Methods*/ + private void welcomeMessage() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) + .setTitle(strings.WELCOME_MESSAGE_TITLE) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha_v1)) + .setTextColor(app_context.getResources().getColor(R.color.blue_dark)) + .setMessage(strings.WELCOME_MESSAGE_DESC) + .onDismissListener(dialog -> is_popup_open = false) + .addButton(strings.WELCOME_MESSAGE_BT_1, -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (DialogInterface tempDialog, int which) -> + { + tempDialog.dismiss(); + event.invokeObserver(Collections.singletonList(constants.BLACK_MARKET_URL), enums.etype.welcome); + }) + .addButton(strings.WELCOME_MESSAGE_BT_2, -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + { + tempDialog.dismiss(); + event.invokeObserver(Collections.singletonList(constants.LEAKED_DOCUMENT_URL), enums.etype.welcome); + }) + .addButton(strings.WELCOME_MESSAGE_BT_3, -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + { + tempDialog.dismiss(); + event.invokeObserver(Collections.singletonList(constants.NEWS_URL), enums.etype.welcome); + }) + .addButton(strings.WELCOME_MESSAGE_BT_4, -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + { + tempDialog.dismiss(); + event.invokeObserver(Collections.singletonList(constants.SOFTWARE_URL), enums.etype.welcome); + }) + .addButton(strings.WELCOME_MESSAGE_BT_5, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + { + event.invokeObserver(null, enums.etype.cancel_welcome); + tempDialog.dismiss(); + }); + } + + private void abiErrorRestart() + { + is_popup_open = false; + final Handler handler = new Handler(); + Runnable runnable = () -> + { + is_popup_open = false; + createMessage(app_context,Collections.singletonList(strings.EMPTY_STR), enums.etype.abi_error); + }; + handler.postDelayed(runnable, 1500); + + } + + private void abiError() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(strings.ABI_ERROR_TITLE) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .onDismissListener(dialog -> abiErrorRestart()) + .setMessage(strings.ABI_ERROR_DESC) + .addButton(strings.ABI_ERROR_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.GENESIS_UPDATE_URL + status.current_ABI)); + if(browserIntent.resolveActivity(app_context.getPackageManager()) != null) + { + app_context.startActivity(browserIntent); + }else { + helperMethod.showToastMessage("Not Supported",app_context); + } + }) + .addButton(strings.ABI_ERROR_BT_2, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.PLAYSTORE_URL)); + if(browserIntent.resolveActivity(app_context.getPackageManager()) != null) + { + app_context.startActivity(browserIntent); + }else { + helperMethod.showToastMessage("Playstore Not Found",app_context); + } + }) + /* + .addButton(strings.ABI_ERROR_BT_3, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + { + event.invokeObserver(null, enums.etype.ignore_abi); + tempDialog.dismiss(); + })*/; + + + } + + private void ratedSuccessfully() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(strings.RATE_SUCCESS_TITLE) + .onDismissListener(dialog -> is_popup_open = false) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(strings.RATE_SUCCESS_DESC) + .addButton(strings.RATE_SUCCESS_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + { + helperMethod.sendRateEmail(app_context); + tempDialog.dismiss(); + }); + } + + private void reportedSuccessfully() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(strings.REPORT_SUCCESS_TITLE) + .onDismissListener(dialog -> is_popup_open = false) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(strings.REPORT_SUCCESS_DESC) + .addButton(strings.REPORT_SUCCESS_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + tempDialog.dismiss()); + } + + @SuppressLint("ResourceType") + private void bookmark() + { + final EditText input = new EditText(app_context); + input.setInputType(InputType.TYPE_CLASS_TEXT); + input.setText(""); + input.setBackground(ContextCompat.getDrawable(app_context, R.xml.sc_popup_input)); + input.setPadding(40, 15, 40, 15); + input.setHeight(80); + input.setTextSize(17); + input.setHint("Title..."); + + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setHeaderView(input) + .onDismissListener(dialog -> is_popup_open = false) + .setMessage("Bookmark URL | " + data.get(0) + "\n") + .addButton(strings.BOOKMARK_URL_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + { + event.invokeObserver(Collections.singletonList(data.get(0).replace("genesis.onion","boogle.store")+"split"+input.getText().toString()), enums.etype.bookmark); + + tempDialog.dismiss(); + }); + } + + private void clearHistory() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(strings.CLEAR_HISTORY_TITLE) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .onDismissListener(dialog -> is_popup_open = false) + .setMessage(strings.CLEAR_HISTORY_DESC) + .addButton(strings.CLEAR_HISTORY_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + { + tempDialog.dismiss(); + final Handler handler = new Handler(); + Runnable runnable = () -> + { + is_popup_open = false; + event.invokeObserver(null, enums.etype.clear_history); + }; + handler.postDelayed(runnable, 250); + }); + } + + private void clearTabs() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(strings.CLEAR_TAB_TITLE) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .onDismissListener(dialog -> is_popup_open = false) + .setMessage(strings.CLEAR_TAB_DESC) + .addButton(strings.CLEAR_TAB_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + { + tempDialog.dismiss(); + final Handler handler = new Handler(); + Runnable runnable = () -> + { + is_popup_open = false; + event.invokeObserver(null, enums.etype.clear_tab); + }; + handler.postDelayed(runnable, 250); + }); + } + + private void clearBookmark() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(strings.clear_bookmark_title) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .onDismissListener(dialog -> is_popup_open = false) + .setMessage(strings.clear_bookmark_desc) + .addButton(strings.clear_bookmark_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + { + is_popup_open = false; + event.invokeObserver(null, enums.etype.clear_bookmark); + tempDialog.dismiss(); + }); + } + + private void reportURL() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(strings.REPORT_URL_TITLE) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .onDismissListener(dialog -> is_popup_open = false) + .setMessage(strings.REPORT_URL_DESC) + .addButton(strings.REPORT_URL_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + { + tempDialog.dismiss(); + + final Handler handler = new Handler(); + Runnable runnable = () -> createMessage(app_context,Collections.singletonList(strings.EMPTY_STR), enums.etype.reported_success); + handler.postDelayed(runnable, 1000); + + }); + + + } + + private void rateApp() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) + .setTitle(strings.RATE_TITLE) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha_v1)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .onDismissListener(dialog -> is_popup_open = false) + .setMessage(strings.RATE_MESSAGE) + .addButton(strings.RATE_POSITIVE, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + { + event.invokeObserver(null, enums.etype.app_rated); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine")); + if(intent.resolveActivity(app_context.getPackageManager()) != null) + { + app_context.startActivity(intent); + }else { + helperMethod.showToastMessage("Playstore Not Found",app_context); + } + tempDialog.dismiss(); + }) + .addButton(strings.RATE_NEGATIVE, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + { + event.invokeObserver(null, enums.etype.app_rated); + tempDialog.dismiss(); + final Handler handler = new Handler(); + handler.postDelayed(() -> + createMessage(app_context,Collections.singletonList(strings.EMPTY_STR), enums.etype.rate_success), 1000); + }); + } + + private void downloadFile() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(strings.DOWNLOAD_TITLE) + .onDismissListener(dialog -> is_popup_open = false) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(strings.DOWNLOAD_MESSAGE + data.get(0)) + .addButton(strings.DOWNLOAD_POSITIVE, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) -> + { + event.invokeObserver(null, enums.etype.download_file); + dialog.dismiss(); + }); + } + + @SuppressLint("ResourceAsColor") + private void downloadFileLongPress() + { + File f = new File(data.get(0)); + String name = f.getName(); + String title = data.get(1); + + int size = name.length(); + if(size>35){ + size = 35; + } + + + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .onDismissListener(dialog -> is_popup_open = false) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(title + f.getName().substring(0,size)+"...") + .setTextGravity(Gravity.START) + .addButton(strings.LONG_URL_OPTION_4, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.download_file_manual); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_OPTION_1, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_new_tab); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_OPTION_2, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_current_tab); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_OPTION_3, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link); + dialog.dismiss(); + }); + } + + private void openURLLongPress() + { + + int size = data.get(0).length()-1; + String title = data.get(1); + + if(size>35){ + size = 35; + } + + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .onDismissListener(dialog -> is_popup_open = false) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(title + data.get(0).substring(0,size)+"...") + .addButton(strings.LONG_URL_OPTION_1, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_new_tab); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_OPTION_2, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_current_tab); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_OPTION_3, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link); + dialog.dismiss(); + }); + } + + private void popupDownloadFull(){ + + String url = data.get(0); + String file = data.get(1); + String title = data.get(2); + + String data_local = strings.LONG_URL_MESSAGE; + + int size = url.length(); + if(size>35){ + size = 35; + } + + int size1 = file.length(); + if(size1>35){ + size1 = 35; + } + + if(!url.equals("")){ + data_local = title + url.substring(0,size)+"..."; + } + else if(!file.equals("")){ + data_local = title + file.substring(0,size1)+"..."; + } + + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + + .onDismissListener(dialog -> is_popup_open = false) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(data_local) + + .addButton(strings.LONG_URL_FULL_OPTION_1, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(url), enums.etype.open_link_new_tab); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_FULL_OPTION_2, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(url), enums.etype.open_link_current_tab); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_FULL_OPTION_3, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(url), enums.etype.copy_link); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_FULL_OPTION_7, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(file), enums.etype.download_file_manual); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_FULL_OPTION_4, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(file), enums.etype.open_link_new_tab); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_FULL_OPTION_5, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(file), enums.etype.open_link_current_tab); + dialog.dismiss(); + }) + .addButton(strings.LONG_URL_FULL_OPTION_6, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + event.invokeObserver(Collections.singletonList(file), enums.etype.copy_link); + dialog.dismiss(); + }); + } + + private void startingOrbotInfo() + { + is_popup_open = true; + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(strings.ORBOT_INIT_TITLE) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(strings.ORBOT_INIT_DESC) + .onDismissListener(dialog -> is_popup_open = false) + .addButton(strings.ORBOT_INIT_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + tempDialog.dismiss()).addButton(strings.ORBOT_INIT_BT_2, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + { + dialog.dismiss(); + + final Handler handler = new Handler(); + handler.postDelayed(() -> + event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.reload), 250); + + }); + } + + private void versionWarning() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .onDismissListener(dialog -> is_popup_open = false) + .setTitle(strings.VERSION_TITLE) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(strings.VERSION_DESC) + .addButton(strings.VERSION_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.GENESIS_UPDATE_URL + data.get(0))); + app_context.startActivity(browserIntent); + }); + } + + private void torBanned() + { + isDialogDismissed = true; + + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(strings.BANNED_TITLE) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(strings.BANNED_DESC) + .onDismissListener(dialog -> is_popup_open = false) + .onDismissListener(dialog -> startHome()); + + String btn_text; + + if(status.sGateway){ + btn_text = "Disable Tor Gateway"; + } + else { + btn_text = "Enable Tor Gateway"; + } + + popup_instance.addButton(btn_text, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + { + isDialogDismissed = false; + tempDialog.dismiss(); + event.invokeObserver(Collections.singletonList(!status.sGateway), enums.etype.connect_vpn); + }); + } + + private void startHome(){ + if(!isDialogDismissed && data.get(0)==null){ + event.invokeObserver(null, enums.etype.start_home); + } + is_popup_open = false; + } + + void onReset(){ + if(dialog_main!=null && dialog_main.isShowing() && !app_context.isFinishing()){ + dialog_main.dismiss(); + dialog_main = null; + } + } + + /*External Helper Methods*/ + + void createMessage(AppCompatActivity app_context, List data, enums.etype type) + { + this.app_context = app_context; + this.data = data; + if (!is_popup_open && !app_context.isDestroyed()) + { + is_popup_open = true; + popup_instance = new CFAlertDialog.Builder(app_context); + + onDismissListener(); + switch (type) + { + case welcome: + welcomeMessage(); + break; + + case abi_error: + abiError(); + break; + + case rate_success: + ratedSuccessfully(); + break; + + case reported_success: + reportedSuccessfully(); + break; + + case bookmark: + bookmark(); + break; + + case clear_history: + clearHistory(); + break; + + case clear_tab: + clearTabs(); + break; + + case clear_bookmark: + clearBookmark(); + break; + + case report_url: + reportURL(); + break; + + case rate_app: + rateApp(); + break; + + case download_file: + downloadFile(); + break; + + case start_orbot: + startingOrbotInfo(); + break; + + case version_warning: + versionWarning(); + break; + + case tor_banned: + torBanned(); + break; + + case download_file_long_press: + downloadFileLongPress(); + break; + + case on_long_press_url: + openURLLongPress(); + break; + + case on_long_press_with_link: + popupDownloadFull(); + break; + } + + dialog_main = popup_instance.show(); + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java new file mode 100755 index 00000000..63f9048a --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java @@ -0,0 +1,173 @@ +package com.darkweb.genesissearchengine.pluginManager; + +import android.content.Context; +import android.content.Intent; +import android.os.Build; + +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.constants.*; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import org.mozilla.gecko.PrefsHelper; +import org.torproject.android.service.TorService; +import org.torproject.android.service.util.Prefs; +import org.torproject.android.service.wrapper.orbotLocalConstants; +import static org.torproject.android.service.TorServiceConstants.ACTION_START; + +class orbotManager +{ + + /*Private Variables*/ + + private Context mAppContext; + private boolean mLogsStarted = false; + + /*Initialization*/ + + private static orbotManager sOurInstance = new orbotManager(); + public static orbotManager getInstance() + { + return sOurInstance; + } + + public void initialize(AppCompatActivity app_context, eventObserver.eventListener event){ + initNotification(dataController.getInstance().getInt(keys.NOTIFICATION_STATUS,1)); + } + + void startOrbot(Context context){ + this.mAppContext = context; + Prefs.putBridgesEnabled(status.sGateway); + Intent mServiceIntent = new Intent(context, TorService.class); + mServiceIntent.setAction(ACTION_START); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + context.startForegroundService(mServiceIntent); + } + else + { + context.startService(mServiceIntent); + } + initializeProxy(); + } + + int getNotificationStatus(){ + return orbotLocalConstants.sNotificationStatus; + } + void initNotification(int status){ + orbotLocalConstants.sNotificationStatus = status; + } + void enableTorNotification(){ + TorService.getServiceObject().enableNotification(); + } + void disableTorNotification(){ + TorService.getServiceObject().disableNotification(); + } + + void enableTorNotificationNoBandwidth(){ + TorService.getServiceObject().enableTorNotificationNoBandwidth(); + } + + /*------------------------------------------------------- POST TASK HANDLER -------------------------------------------------------*/ + + void onClose(){ + if(mAppContext!=null){ + disableTorNotification(); + //Intent intent = new Intent(orbotLocalConstants.sHomeContext, TorService.class); + //mAppContext.getApplicationContext().stopService(intent); + } + } + + void setProxy(String url){ + if(url.contains("boogle.store")){ + 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); + } + else { + PrefsHelper.setPref(keys.PROXY_TYPE, 1); + PrefsHelper.setPref(keys.PROXY_SOCKS,constants.PROXY_SOCKS); + PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050); + PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.PROXY_SOCKS_VERSION); + PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.PROXY_SOCKS_REMOTE_DNS); + } + } + + private void initializeProxy() + { + 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.PROXY_SOCKS); + PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050); + PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.PROXY_SOCKS_VERSION); + PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.PROXY_SOCKS_REMOTE_DNS); + + PrefsHelper.setPref(keys.PROXY_CACHE,constants.PROXY_CACHE); + PrefsHelper.setPref(keys.PROXY_MEMORY,constants.PROXY_MEMORY); + PrefsHelper.setPref(keys.PROXY_USER_AGENT_OVERRIDE, constants.PROXY_USER_AGENT_OVERRIDE); + PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_ENABLED,constants.PROXY_DO_NOT_TRACK_HEADER_ENABLED); + PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_VALUE,constants.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); + + setPrivacyPrefs(); + } + + private void setPrivacyPrefs () + { + PrefsHelper.setPref("browser.cache.disk.enable",false); + PrefsHelper.setPref("browser.cache.memory.enable",true); + PrefsHelper.setPref(keys.PROXY_USER_AGENT_OVERRIDE, constants.PROXY_USER_AGENT_OVERRIDE); + PrefsHelper.setPref("browser.cache.disk.capacity",0); + PrefsHelper.setPref("privacy.clearOnShutdown.cache",status.sHistoryStatus); + PrefsHelper.setPref("privacy.clearOnShutdown.downloads",status.sHistoryStatus); + PrefsHelper.setPref("privacy.clearOnShutdown.formdata",status.sHistoryStatus); + PrefsHelper.setPref("privacy.clearOnShutdown.history",status.sHistoryStatus); + PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",status.sHistoryStatus); + PrefsHelper.setPref("privacy.clearOnShutdown.passwords",status.sHistoryStatus); + PrefsHelper.setPref("privacy.clearOnShutdown.sessions",status.sHistoryStatus); + PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",status.sHistoryStatus); + 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 + } + + + String getLogs() + { + String logs = orbotLocalConstants.tor_logs_status; + + if(!logs.contains("Bootstrapped") && !mLogsStarted){ + logs = "Initializing Bootstrap"; + mLogsStarted = true; + } + else { + logs = logs.replace("(","").replace(":","_FERROR_").replace("NOTICE","").replace(")",""); + } + + + if(!logs.equals(strings.EMPTY_STR)) + { + String Logs = logs; + Logs="Installing | " + Logs.replace("FAILED","Securing"); + return Logs; + } + return "Loading Please Wait"; + } + + boolean isOrbotRunning(){ + return orbotLocalConstants.sIsTorInitialized; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java new file mode 100755 index 00000000..527e2ccb --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java @@ -0,0 +1,265 @@ +package com.darkweb.genesissearchengine.pluginManager; + +import android.content.Context; +import android.content.Intent; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +//import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.torproject.android.service.wrapper.orbotLocalConstants; + +import java.util.Collections; +import java.util.List; + +public class pluginController +{ + /*Plugin Instance*/ + + private adManager mAdManager; + private analyticManager mAnalyticManager; + private fabricManager mFabricManager; + private firebaseManager mFirebaseManager; + private messageManager mMessageManager; + private activityContextManager mContextManager; + private boolean mIsInitialized = false; + private boolean mIsServiceInitialized = false; + + /*Private Variables*/ + + private static pluginController ourInstance = new pluginController(); + private homeController mHomeController; + + /*Initializations*/ + + public static pluginController getInstance() + { + return ourInstance; + } + + public void initialize(){ + instanceObjectInitialization(); + mIsInitialized = true; + } + + public void initializeWithAbiError(){ + mMessageManager = new messageManager(new messageCallback()); + mIsInitialized = true; + } + + public void preInitialize(homeController context){ + mFabricManager = new fabricManager(context,new fabricCallback()); + } + + private void instanceObjectInitialization() + { + mHomeController = activityContextManager.getInstance().getHomeController(); + mContextManager = activityContextManager.getInstance(); + + mAdManager = new adManager(getAppContext(),new admobCallback(), mHomeController.getBannerAd()); + mAnalyticManager = new analyticManager(getAppContext(),new analyticCallback()); + mFirebaseManager = new firebaseManager(getAppContext(),new firebaseCallback()); + mMessageManager = new messageManager(new messageCallback()); + + } + + public void initializeAllServices(AppCompatActivity context){ + orbotManager.getInstance().initialize(context,new orbotCallback()); + } + + /*Helper Methods*/ + + private AppCompatActivity getAppContext() + { + return mHomeController; + } + + public boolean isInitialized(){ + return mIsInitialized; + } + void proxyManagerExitInvoke(){ + + } + + /*---------------------------------------------- EXTERNAL REQUEST LISTENER-------------------------------------------------------*/ + + /*Message Manager*/ + public void MessageManagerHandler(AppCompatActivity app_context,List data,enums.etype type){ + mMessageManager.createMessage(app_context,data,type); + } + public void onResetMessage(){ + if(mMessageManager!=null){ + mMessageManager.onReset(); + } + } + + /*Firebase Manager*/ + public void logEvent(String value){ + if(mFirebaseManager!=null){ + mFirebaseManager.logEvent(value); + } + } + + /*Ad Manager*/ + public void initializeBannerAds(){ + mAdManager.loadAds(); + } + public boolean isAdvertLoaded(){ + return mAdManager.isAdvertLoaded(); + } + + /*Onion Proxy Manager*/ + public void initializeOrbot(){ + orbotManager.getInstance().startOrbot(getAppContext()); + } + public boolean isOrbotRunning(){ + return orbotManager.getInstance().isOrbotRunning(); + } + public void setProxy(String url){ + orbotManager.getInstance().setProxy(url); + } + public String orbotLogs(){ + return orbotManager.getInstance().getLogs(); + } + public void enableTorNotification(){ + orbotManager.getInstance().enableTorNotification(); + } + public void disableTorNotification(){ + orbotManager.getInstance().disableTorNotification(); + } + public void enableTorNotificationNoBandwidth(){ + orbotManager.getInstance().enableTorNotificationNoBandwidth(); + } + public void setNotificationStatus(int status){ + orbotManager.getInstance().initNotification(status); + } + public int getNotificationStatus(){ + return orbotManager.getInstance().getNotificationStatus(); + } + public void updateCookiesStatus(){ + } + + /*------------------------------------------------ CALLBACK LISTENERS------------------------------------------------------------*/ + + /*Ad Manager*/ + private class admobCallback implements eventObserver.eventListener{ + @Override + public void invokeObserver(List data, enums.etype event_type) + { + mHomeController.onSetBannerAdMargin(); + } + } + + /*Analytics Manager*/ + private class analyticCallback implements eventObserver.eventListener{ + @Override + public void invokeObserver(List data, enums.etype event_type) + { + mAnalyticManager.logUser(); + } + } + + /*Fabric Manager*/ + private class fabricCallback implements eventObserver.eventListener{ + @Override + public void invokeObserver(List data, enums.etype event_type) + { + } + } + + /*Firebase Manager*/ + private class firebaseCallback implements eventObserver.eventListener{ + @Override + public void invokeObserver(List data, enums.etype event_type) + { + } + } + + /*Onion Proxy Manager*/ + private class orbotCallback implements eventObserver.eventListener{ + @Override + public void invokeObserver(List data, enums.etype event_type) + { + + } + } + + /*Message Manager*/ + private class messageCallback implements eventObserver.eventListener{ + @Override + public void invokeObserver(List data, enums.etype event_type) + { + if(event_type.equals(enums.etype.welcome)) + { + mHomeController.onLoadURL(data.get(0).toString()); + } + else if(event_type.equals(enums.etype.cancel_welcome)){ + dataController.getInstance().setBool(keys.IS_WELCOME_ENABLED,false); + } + else if(event_type.equals(enums.etype.ignore_abi)){ + mHomeController.ignoreAbiError(); + } + else if(event_type.equals(enums.etype.reload)){ + if(orbotManager.getInstance().isOrbotRunning()) + { + mHomeController.onReload(null); + } + else { + mMessageManager.createMessage(mHomeController, Collections.singletonList(data.get(0).toString()),enums.etype.start_orbot); + } + } + else if(event_type.equals(enums.etype.clear_history)){ + dataController.getInstance().clearHistory(); + dataController.getInstance().clearSuggestions(); + mContextManager.getHistoryController().onclearData(); + mHomeController.onClearSession(); + dataController.getInstance().clearTabs(); + mHomeController.initTab(); + } + else if(event_type.equals(enums.etype.clear_bookmark)){ + dataController.getInstance().clearBookmark(); + mContextManager.getBookmarkController().onclearData(); + } + else if(event_type.equals(enums.etype.bookmark)){ + String [] dataParser = data.get(0).toString().split("split"); + if(dataParser.length>1){ + logEvent(strings.URL_BOOKMARKED); + dataController.getInstance().addBookmark(dataParser[0],dataParser[1]); + }else { + dataController.getInstance().addBookmark(dataParser[0],""); + } + } + else if(event_type.equals(enums.etype.app_rated)){ + dataController.getInstance().setBool(keys.IS_APP_RATED,true); + } + else if(event_type.equals(enums.etype.download_file)){ + mHomeController.onDownloadFile(); + } + else if(event_type.equals(enums.etype.download_file_manual)){ + mHomeController.onManualDownload(data.get(0).toString()); + } + else if(event_type.equals(enums.etype.connect_vpn)){ + //orbotLocalConstants.sIsTorInitialized = (boolean)data.get(0); + } + else if(event_type.equals(enums.etype.open_link_new_tab)){ + mHomeController.onOpenLinkNewTab(data.get(0).toString()); + } + else if(event_type.equals(enums.etype.open_link_current_tab)){ + mHomeController.onLoadURL(data.get(0).toString()); + } + else if(event_type.equals(enums.etype.copy_link)){ + helperMethod.copyURL(data.get(0).toString(),mContextManager.getHomeController()); + } + else if(event_type.equals(enums.etype.clear_tab)){ + dataController.getInstance().clearTabs(); + mHomeController.initTab(); + activityContextManager.getInstance().getTabController().finish(); + } + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/widget/AnimatedProgressBar.java b/app/src/main/java/com/darkweb/genesissearchengine/widget/AnimatedProgressBar.java new file mode 100755 index 00000000..703eef84 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/widget/AnimatedProgressBar.java @@ -0,0 +1,216 @@ +/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package com.darkweb.genesissearchengine.widget; + +import android.animation.Animator; +import android.animation.ValueAnimator; +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.os.Handler; +import android.util.AttributeSet; +import android.view.animation.AnimationUtils; +import android.view.animation.Interpolator; +import android.view.animation.LinearInterpolator; +import android.widget.ProgressBar; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.view.ViewCompat; + +import com.example.myapplication.R; + +public class AnimatedProgressBar extends ProgressBar { + private final static int PROGRESS_DURATION = 200; + private final static int CLOSING_DELAY = 300; + private final static int CLOSING_DURATION = 300; + private ValueAnimator mPrimaryAnimator; + private ValueAnimator mClosingAnimator = ValueAnimator.ofFloat(0f, 1f); + private float mClipRegion = 0f; + private int mExpectedProgress = 0; + private Rect tempRect; + private boolean mIsRtl; + + private ValueAnimator.AnimatorUpdateListener mListener = new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + setProgressImmediately((int) mPrimaryAnimator.getAnimatedValue()); + } + }; + + public AnimatedProgressBar(@NonNull Context context) { + super(context, null); + init(context, null); + } + + public AnimatedProgressBar(@NonNull Context context, + @Nullable AttributeSet attrs) { + super(context, attrs); + init(context, attrs); + } + + public AnimatedProgressBar(@NonNull Context context, + @Nullable AttributeSet attrs, + int defStyleAttr) { + + super(context, attrs, defStyleAttr); + init(context, attrs); + } + + public AnimatedProgressBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + init(context, attrs); + } + + @Override + public void setProgress(int nextProgress) { + nextProgress = Math.min(nextProgress, getMax()); + nextProgress = Math.max(0, nextProgress); + mExpectedProgress = nextProgress; + + // a dirty-hack for reloading page. + if (mExpectedProgress < getProgress() && getProgress() == getMax()) { + setProgressImmediately(0); + } + + if (mPrimaryAnimator != null) { + mPrimaryAnimator.cancel(); + mPrimaryAnimator.setIntValues(getProgress(), nextProgress); + mPrimaryAnimator.start(); + } else { + setProgressImmediately(nextProgress); + } + + if (mClosingAnimator != null) { + if (nextProgress != getMax()) { + // stop closing animation + mClosingAnimator.cancel(); + mClipRegion = 0f; + } + } + } + + @Override + public void onDraw(Canvas canvas) { + if (mClipRegion == 0) { + super.onDraw(canvas); + } else { + canvas.getClipBounds(tempRect); + final float clipWidth = tempRect.width() * mClipRegion; + final int saveCount = canvas.save(); + + + if (mIsRtl) { + canvas.clipRect(tempRect.left, tempRect.top, tempRect.right - clipWidth, tempRect.bottom); + } else { + canvas.clipRect(tempRect.left + clipWidth, tempRect.top, tempRect.right, tempRect.bottom); + } + super.onDraw(canvas); + canvas.restoreToCount(saveCount); + } + } + + @Override + public void setVisibility(int value) { + if (value == GONE) { + if (mExpectedProgress == getMax()) { + animateClosing(); + } else { + setVisibilityImmediately(value); + } + } else { + setVisibilityImmediately(value); + } + } + + private void setVisibilityImmediately(int value) { + super.setVisibility(value); + } + + private void animateClosing() { + mIsRtl = (ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL); + + mClosingAnimator.cancel(); + + final Handler handler = getHandler(); + if (handler != null) { + handler.postDelayed(new Runnable() { + @Override + public void run() { + mClosingAnimator.start(); + } + }, CLOSING_DELAY); + } + } + + private void setProgressImmediately(int progress) { + super.setProgress(progress); + } + + private void init(@NonNull Context context, @Nullable AttributeSet attrs) { + tempRect = new Rect(); + + final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AnimatedProgressBar); + final int duration = a.getInteger(R.styleable.AnimatedProgressBar_shiftDuration, 1000); + final int resID = a.getResourceId(R.styleable.AnimatedProgressBar_shiftInterpolator, 0); + final boolean wrap = a.getBoolean(R.styleable.AnimatedProgressBar_wrapShiftDrawable, false); + + mPrimaryAnimator = ValueAnimator.ofInt(getProgress(), getMax()); + mPrimaryAnimator.setInterpolator(new LinearInterpolator()); + mPrimaryAnimator.setDuration(PROGRESS_DURATION); + mPrimaryAnimator.addUpdateListener(mListener); + + mClosingAnimator.setDuration(CLOSING_DURATION); + mClosingAnimator.setInterpolator(new LinearInterpolator()); + mClosingAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator valueAnimator) { + final float region = (float) valueAnimator.getAnimatedValue(); + if (mClipRegion != region) { + mClipRegion = region; + invalidate(); + } + } + }); + mClosingAnimator.addListener(new Animator.AnimatorListener() { + @Override + public void onAnimationStart(Animator animator) { + mClipRegion = 0f; + } + + @Override + public void onAnimationEnd(Animator animator) { + setVisibilityImmediately(GONE); + } + + @Override + public void onAnimationCancel(Animator animator) { + mClipRegion = 0f; + } + + @Override + public void onAnimationRepeat(Animator animator) { + } + }); + setProgressDrawable(buildWrapDrawable(getProgressDrawable(), wrap, duration, resID)); + + a.recycle(); + } + + private Drawable buildWrapDrawable(Drawable original, boolean isWrap, int duration, int resID) { + if (isWrap) { + final Interpolator interpolator = (resID > 0) + ? AnimationUtils.loadInterpolator(getContext(), resID) + : null; + final ShiftDrawable wrappedDrawable = new ShiftDrawable(original, duration, interpolator); + return wrappedDrawable; + } else { + return original; + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/widget/DrawableWrapper.java b/app/src/main/java/com/darkweb/genesissearchengine/widget/DrawableWrapper.java new file mode 100755 index 00000000..ceec188d --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/widget/DrawableWrapper.java @@ -0,0 +1,175 @@ +package com.darkweb.genesissearchengine.widget; + +import android.content.res.Resources; +import android.graphics.Canvas; +import android.graphics.ColorFilter; +import android.graphics.PorterDuff; +import android.graphics.Rect; +import android.graphics.Region; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; + +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; + +import java.io.IOException; + +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** + * DrawableWrapper was added since API Level 23. But in v7 support library, it has annotation + * "@RestrictTo(LIBRARY_GROUP)". Hence we should not extends it, so we create this wrapper for now. + * Once we start to support API 23, or v7-support-library allows us to extends its DrawableWrapper, + * then this file can be removed. + */ + +public class DrawableWrapper extends Drawable { + + private final Drawable mWrapped; + + public DrawableWrapper(@NonNull Drawable drawable) { + mWrapped = drawable; + } + + public Drawable getWrappedDrawable() { + return mWrapped; + } + + @Override + public void draw(@NonNull Canvas canvas) { + mWrapped.draw(canvas); + } + + @Override + public int getChangingConfigurations() { + return mWrapped.getChangingConfigurations(); + } + + @Override + public ConstantState getConstantState() { + return mWrapped.getConstantState(); + } + + @Override + public Drawable getCurrent() { + return mWrapped.getCurrent(); + } + + @Override + public int getIntrinsicHeight() { + return mWrapped.getIntrinsicHeight(); + } + + @Override + public int getIntrinsicWidth() { + return mWrapped.getIntrinsicWidth(); + } + + @Override + public int getMinimumHeight() { + return mWrapped.getMinimumHeight(); + } + + @Override + public int getMinimumWidth() { + return mWrapped.getMinimumWidth(); + } + + @Override + public int getOpacity() { + return mWrapped.getOpacity(); + } + + @Override + public boolean getPadding(Rect padding) { + return mWrapped.getPadding(padding); + } + + @Override + public int[] getState() { + return mWrapped.getState(); + } + + @Override + public Region getTransparentRegion() { + return mWrapped.getTransparentRegion(); + } + + @Override + public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs) + throws XmlPullParserException, IOException { + mWrapped.inflate(r, parser, attrs); + } + + @Override + public boolean isStateful() { + return mWrapped.isStateful(); + } + + @Override + public void jumpToCurrentState() { + mWrapped.jumpToCurrentState(); + } + + @Override + public Drawable mutate() { + return mWrapped.mutate(); + } + + @Override + public void setAlpha(@IntRange(from = 0, to = 255) int i) { + mWrapped.setAlpha(i); + } + + @Override + public void scheduleSelf(Runnable what, long when) { + mWrapped.scheduleSelf(what, when); + } + + @Override + public void setChangingConfigurations(int configs) { + mWrapped.setChangingConfigurations(configs); + } + + @Override + public void setColorFilter(@Nullable ColorFilter colorFilter) { + mWrapped.setColorFilter(colorFilter); + } + + @Override + public void setColorFilter(int color, PorterDuff.Mode mode) { + mWrapped.setColorFilter(color, mode); + } + + @Override + public void setFilterBitmap(boolean filter) { + mWrapped.setFilterBitmap(filter); + } + + @Override + public boolean setVisible(boolean visible, boolean restart) { + return mWrapped.setVisible(visible, restart); + } + + @Override + public void unscheduleSelf(Runnable what) { + mWrapped.unscheduleSelf(what); + } + + @Override + protected void onBoundsChange(Rect bounds) { + mWrapped.setBounds(bounds); + } + + @Override + protected boolean onLevelChange(int level) { + return mWrapped.setLevel(level); + } + + @Override + protected boolean onStateChange(int[] state) { + return mWrapped.setState(state); + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/widget/ShiftDrawable.java b/app/src/main/java/com/darkweb/genesissearchengine/widget/ShiftDrawable.java new file mode 100755 index 00000000..42110057 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/widget/ShiftDrawable.java @@ -0,0 +1,115 @@ +package com.darkweb.genesissearchengine.widget; + +import android.animation.Animator; +import android.animation.ValueAnimator; +import android.graphics.Canvas; +import android.graphics.Path; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.view.animation.Interpolator; +import android.view.animation.LinearInterpolator; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +public class ShiftDrawable extends DrawableWrapper { + + private final ValueAnimator mAnimator = ValueAnimator.ofFloat(0f, 1f); + private final Rect mVisibleRect = new Rect(); + private Path mPath; + + // align to ScaleDrawable implementation + private static final int MAX_LEVEL = 10000; + + private static final int DEFAULT_DURATION = 1000; + + public ShiftDrawable(@NonNull Drawable d) { + this(d, DEFAULT_DURATION); + } + + public ShiftDrawable(@NonNull Drawable d, int duration) { + this(d, duration, new LinearInterpolator()); + } + + public ShiftDrawable(@NonNull Drawable d, int duration, @Nullable Interpolator interpolator) { + super(d); + mAnimator.setDuration(duration); + mAnimator.setRepeatCount(ValueAnimator.INFINITE); + mAnimator.setInterpolator((interpolator == null) ? new LinearInterpolator() : interpolator); + mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + if (isVisible()) { + invalidateSelf(); + } + } + }); + mAnimator.start(); + } + + public Animator getAnimator() { + return mAnimator; + } + + @Override + public boolean setVisible(boolean visible, boolean restart) { + final boolean result = super.setVisible(visible, restart); + if (isVisible()) { + mAnimator.start(); + } else { + mAnimator.end(); + } + return result; + } + + @Override + protected void onBoundsChange(Rect bounds) { + super.onBoundsChange(bounds); + updateBounds(); + } + + @Override + protected boolean onLevelChange(int level) { + final boolean result = super.onLevelChange(level); + updateBounds(); + return result; + } + + @Override + public void draw(Canvas canvas) { + final Drawable d = getWrappedDrawable(); + final float fraction = mAnimator.getAnimatedFraction(); + final int width = mVisibleRect.width(); + final int offset = (int) (width * fraction); + final int stack = canvas.save(); + + canvas.clipPath(mPath); + + // shift from right to left. + // draw left-half part + canvas.save(); + canvas.translate(-offset, 0); + d.draw(canvas); + canvas.restore(); + + // draw right-half part + canvas.save(); + canvas.translate(width - offset, 0); + d.draw(canvas); + canvas.restore(); + + canvas.restoreToCount(stack); + } + + private void updateBounds() { + final Rect b = getBounds(); + final int width = (int) ((float) b.width() * getLevel() / MAX_LEVEL); + final float radius = b.height() / 2.5f; + mVisibleRect.set(b.left, b.top, b.left + width, b.height()); + + // draw round to head of progressbar. I know it looks stupid, don't blame me now. + mPath = new Path(); + mPath.addRect(b.left, b.top, b.left + width - radius, b.height(), Path.Direction.CCW); + mPath.addCircle(b.left + width - radius, radius, radius, Path.Direction.CCW); + } +} diff --git a/app/src/main/res/anim/fade_in.xml b/app/src/main/res/anim/fade_in.xml new file mode 100755 index 00000000..b9abe68c --- /dev/null +++ b/app/src/main/res/anim/fade_in.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/popup_anim_in.xml b/app/src/main/res/anim/popup_anim_in.xml new file mode 100755 index 00000000..145f89ad --- /dev/null +++ b/app/src/main/res/anim/popup_anim_in.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/popup_anim_out.xml b/app/src/main/res/anim/popup_anim_out.xml new file mode 100755 index 00000000..a916353e --- /dev/null +++ b/app/src/main/res/anim/popup_anim_out.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/back_arrow.webp b/app/src/main/res/drawable-hdpi/back_arrow.webp new file mode 100755 index 00000000..1d0c464a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/back_arrow.webp differ diff --git a/app/src/main/res/drawable-hdpi/cancel.png b/app/src/main/res/drawable-hdpi/cancel.png new file mode 100755 index 00000000..e2a51441 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/cancel.png differ diff --git a/app/src/main/res/drawable-hdpi/cancel_v2.png b/app/src/main/res/drawable-hdpi/cancel_v2.png new file mode 100755 index 00000000..f96959d4 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/cancel_v2.png differ diff --git a/app/src/main/res/drawable-hdpi/circle_back.png b/app/src/main/res/drawable-hdpi/circle_back.png new file mode 100755 index 00000000..bdb40b40 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/circle_back.png differ diff --git a/app/src/main/res/drawable-hdpi/dropdown_arrow.webp b/app/src/main/res/drawable-hdpi/dropdown_arrow.webp new file mode 100755 index 00000000..019b9904 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/dropdown_arrow.webp differ diff --git a/app/src/main/res/drawable-hdpi/duck_logo.png b/app/src/main/res/drawable-hdpi/duck_logo.png new file mode 100644 index 00000000..7325621c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/duck_logo.png differ diff --git a/app/src/main/res/drawable-hdpi/dustbin.webp b/app/src/main/res/drawable-hdpi/dustbin.webp new file mode 100755 index 00000000..50451f82 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/dustbin.webp differ diff --git a/app/src/main/res/drawable-hdpi/empty_list.png b/app/src/main/res/drawable-hdpi/empty_list.png new file mode 100755 index 00000000..1e6642e2 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/empty_list.png differ diff --git a/app/src/main/res/drawable-hdpi/empty_tab.png b/app/src/main/res/drawable-hdpi/empty_tab.png new file mode 100755 index 00000000..50c19eae Binary files /dev/null and b/app/src/main/res/drawable-hdpi/empty_tab.png differ diff --git a/app/src/main/res/drawable-hdpi/genesis_logo.png b/app/src/main/res/drawable-hdpi/genesis_logo.png new file mode 100644 index 00000000..e549f990 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/genesis_logo.png differ diff --git a/app/src/main/res/drawable-hdpi/google_logo.png b/app/src/main/res/drawable-hdpi/google_logo.png new file mode 100644 index 00000000..0abdaec0 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/google_logo.png differ diff --git a/app/src/main/res/drawable-hdpi/homeicon.webp b/app/src/main/res/drawable-hdpi/homeicon.webp new file mode 100755 index 00000000..ed91d499 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/homeicon.webp differ diff --git a/app/src/main/res/drawable-hdpi/ic_launcher_background.xml b/app/src/main/res/drawable-hdpi/ic_launcher_background.xml new file mode 100755 index 00000000..8428ee45 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_launcher_background.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-hdpi/ic_refresh_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_refresh_white_24dp.png new file mode 100755 index 00000000..ffa7be93 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_refresh_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/icon_ban.webp b/app/src/main/res/drawable-hdpi/icon_ban.webp new file mode 100755 index 00000000..81fc1d43 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_ban.webp differ diff --git a/app/src/main/res/drawable-hdpi/icon_homeicon.webp b/app/src/main/res/drawable-hdpi/icon_homeicon.webp new file mode 100755 index 00000000..324eee0a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_homeicon.webp differ diff --git a/app/src/main/res/drawable-hdpi/icon_interneticon.webp b/app/src/main/res/drawable-hdpi/icon_interneticon.webp new file mode 100755 index 00000000..dd6481e0 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_interneticon.webp differ diff --git a/app/src/main/res/drawable-hdpi/icon_loading.webp b/app/src/main/res/drawable-hdpi/icon_loading.webp new file mode 100755 index 00000000..f0608dfb Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_loading.webp differ diff --git a/app/src/main/res/drawable-hdpi/icon_lock.webp b/app/src/main/res/drawable-hdpi/icon_lock.webp new file mode 100755 index 00000000..034519e6 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_lock.webp differ diff --git a/app/src/main/res/drawable-hdpi/menu_item.webp b/app/src/main/res/drawable-hdpi/menu_item.webp new file mode 100755 index 00000000..5d8e4edb Binary files /dev/null and b/app/src/main/res/drawable-hdpi/menu_item.webp differ diff --git a/app/src/main/res/layout/bookmark_view.xml b/app/src/main/res/layout/bookmark_view.xml new file mode 100755 index 00000000..b7e9883a --- /dev/null +++ b/app/src/main/res/layout/bookmark_view.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + +