|
@ -4,7 +4,6 @@ apply from: 'variables.gradle'
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven'
|
||||||
apply plugin: 'io.fabric'
|
apply plugin: 'io.fabric'
|
||||||
|
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
geckoviewChannel = project.ext.firefox_channel
|
geckoviewChannel = project.ext.firefox_channel
|
||||||
geckoviewVersion = project.ext.firefox_version
|
geckoviewVersion = project.ext.firefox_version
|
||||||
|
@ -21,24 +20,52 @@ repositories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion project.ext.compileSdkVersion
|
compileSdkVersion 29
|
||||||
|
buildToolsVersion '29.0.2'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId project.ext.applicationId
|
applicationId project.ext.applicationId
|
||||||
minSdkVersion project.ext.minSdkVersion
|
minSdkVersion 21
|
||||||
targetSdkVersion project.ext.targetSdkVersion
|
|
||||||
versionCode project.ext.versionCode
|
versionCode project.ext.versionCode
|
||||||
versionName project.ext.versionName
|
versionName project.ext.versionName
|
||||||
}
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
flavorDimensions "abi"
|
multiDexEnabled true
|
||||||
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility 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
|
flavorDimensions project.ext.dimen
|
||||||
|
|
||||||
|
@ -66,62 +93,53 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buildTypes {
|
sourceSets {
|
||||||
release {
|
test {
|
||||||
minifyEnabled true
|
resources {
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
srcDir "${projectDir}/src/main/assets/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
splits {
|
|
||||||
abi {
|
|
||||||
enable true
|
|
||||||
reset()
|
|
||||||
include 'arm64-v8a'
|
|
||||||
include 'x86'
|
|
||||||
include 'armeabi-v7a'
|
|
||||||
include 'x86_64'
|
|
||||||
|
|
||||||
universalApk false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy.force 'com.android.support:support-v4:26.1.0' // the lib is old dependencies version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
/*Default Libraries*/
|
/*Default Libraries*/
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta2'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation 'cz.msebera.android:httpclient:4.5.8'
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
|
implementation 'com.google.android.material:material:1.2.0-alpha03'
|
||||||
implementation 'com.google.android.material:material:1.1.0-alpha09'
|
implementation 'androidx.preference:preference:1.1.0'
|
||||||
implementation 'androidx.preference:preference:1.1.0-rc01'
|
implementation 'com.google.android.material:material:1.0.0'
|
||||||
implementation 'com.android.support:design:28.0.0'
|
|
||||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
|
||||||
|
|
||||||
/*Firefox ABI Splits*/
|
/*Firefox ABI Splits*/
|
||||||
x86Implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
|
implementation "org.mozilla.components:browser-engine-gecko:$mozilla_components_version"
|
||||||
x86_64Implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
|
implementation "org.mozilla.geckoview:geckoview:$gecko_nightly_version"
|
||||||
armImplementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
|
|
||||||
aarch64Implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
|
|
||||||
|
|
||||||
/*Alert Dialog*/
|
/*Alert Dialog*/
|
||||||
implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'
|
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*/
|
/*Ads Manager*/
|
||||||
implementation 'com.google.android.gms:play-services-ads:18.1.1'
|
implementation 'com.google.android.gms:play-services-ads:18.3.0'
|
||||||
|
|
||||||
|
|
||||||
/*Crashlytics*/
|
/*Crashlytics*/
|
||||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
|
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
|
||||||
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar')
|
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.android.application'
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
|
@ -1,42 +1,34 @@
|
||||||
{
|
{
|
||||||
"project_info": {
|
"project_info": {
|
||||||
"project_number": "891955481900",
|
"project_number": "1026582312920",
|
||||||
"firebase_url": "https://genesis-app-a512d.firebaseio.com",
|
"firebase_url": "https://genesis-5cc48.firebaseio.com",
|
||||||
"project_id": "genesis-app-a512d",
|
"project_id": "genesis-5cc48",
|
||||||
"storage_bucket": "genesis-app-a512d.appspot.com"
|
"storage_bucket": "genesis-5cc48.appspot.com"
|
||||||
},
|
},
|
||||||
"client": [
|
"client": [
|
||||||
{
|
{
|
||||||
"client_info": {
|
"client_info": {
|
||||||
"mobilesdk_app_id": "1:891955481900:android:360c1798435c303f",
|
"mobilesdk_app_id": "1:1026582312920:android:056aacc3b6f0c3b3f164ad",
|
||||||
"android_client_info": {
|
"android_client_info": {
|
||||||
"package_name": "com.darkweb.genesissearchengine"
|
"package_name": "com.darkweb.genesissearchengine"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"oauth_client": [
|
"oauth_client": [
|
||||||
{
|
{
|
||||||
"client_id": "891955481900-20ves4hv1nujrthcs2u75to1gn6c3v59.apps.googleusercontent.com",
|
"client_id": "1026582312920-ciidt1n08e3fh9akdrn38ph6on2c7d95.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
|
"client_type": 3
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"api_key": [
|
"api_key": [
|
||||||
{
|
{
|
||||||
"current_key": "AIzaSyCwvxQTaK8F6nevbWkL2t1TTEljQNZeKXc"
|
"current_key": "AIzaSyBMzD4SV_-2_2tG9E5a475k5OkwP9V-Naw"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"services": {
|
"services": {
|
||||||
"appinvite_service": {
|
"appinvite_service": {
|
||||||
"other_platform_oauth_client": [
|
"other_platform_oauth_client": [
|
||||||
{
|
{
|
||||||
"client_id": "891955481900-94h8etf05qautcg9ue2vfc4ct2oikr3e.apps.googleusercontent.com",
|
"client_id": "1026582312920-ciidt1n08e3fh9akdrn38ph6on2c7d95.apps.googleusercontent.com",
|
||||||
"client_type": 3
|
"client_type": 3
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
0
app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt
Normal file → Executable file
|
@ -3,61 +3,129 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="com.example.myapplication">
|
package="com.example.myapplication">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<!-- Permissions-->
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:networkSecurityConfig="@xml/network_security_config"
|
android:launchMode="singleTask"
|
||||||
|
android:fullBackupContent="false"
|
||||||
|
android:networkSecurityConfig="@xml/ex_network_security_config"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
<service android:name="com.darkweb.genesissearchengine.pluginManager.exitManager" android:stopWithTask="false" />
|
|
||||||
<activity
|
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.setting_manager.setting_controller"
|
|
||||||
android:windowSoftInputMode="adjustNothing"
|
|
||||||
android:screenOrientation="portrait"
|
|
||||||
android:label="@string/title_activity_setting_controller">
|
|
||||||
</activity>
|
|
||||||
<activity android:name="com.darkweb.genesissearchengine.appManager.list_manager.list_controller"
|
|
||||||
android:screenOrientation="portrait"
|
|
||||||
android:windowSoftInputMode="adjustNothing">
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<uses-library
|
<!-- Activities-->
|
||||||
android:name="org.apache.http.legacy"
|
|
||||||
android:required="false"/>
|
<activity android:name="com.darkweb.genesissearchengine.appManager.orbotManager.orbotController"
|
||||||
|
android:launchMode= "singleTop"
|
||||||
|
/>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.home_activity.home_controller"
|
android:name="com.darkweb.genesissearchengine.appManager.settingManager.settingController"
|
||||||
android:windowSoftInputMode="adjustNothing"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||||
android:screenOrientation="portrait">
|
android:label="@string/title_activity_setting_controller"
|
||||||
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.darkweb.genesissearchengine.appManager.historyManager.historyController"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.darkweb.genesissearchengine.appManager.tabManager.tabController"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||||
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.darkweb.genesissearchengine.appManager.homeManager.homeController"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
|
android:windowSoftInputMode="adjustResize">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data android:scheme="bridge" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
||||||
|
<action android:name="org.torproject.android.REQUEST_HS_PORT" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
||||||
|
<action android:name="org.torproject.android.START_TOR" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<!-- Services & Settings-->
|
||||||
|
|
||||||
|
<uses-library
|
||||||
|
android:name="org.apache.http.legacy"
|
||||||
|
android:required="false" />
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="io.fabric.ApiKey"
|
android:name="io.fabric.ApiKey"
|
||||||
android:value="be76c64dae2519d4ab8daaed88298da14c7c294f"/>
|
android:value="be76c64dae2519d4ab8daaed88298da14c7c294f" />
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.gms.ads.APPLICATION_ID"
|
android:name="com.google.android.gms.ads.APPLICATION_ID"
|
||||||
android:value="ca-app-pub-5074525529134731~2926711128"/>
|
android:value="ca-app-pub-5074525529134731~2926711128" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.home_activity.DownloadFileService"
|
android:name="com.darkweb.genesissearchengine.pluginManager.exitManager"
|
||||||
|
android:stopWithTask="false" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="com.darkweb.genesissearchengine.helperManager.downloadFileService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
|
android:stopWithTask="true"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="org.torproject.android.service.TorService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:stopWithTask="true"
|
||||||
|
android:exported="false"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name="org.torproject.android.service.StartTorReceiver"
|
||||||
|
android:exported="true"
|
||||||
|
android:stopWithTask="true"
|
||||||
|
android:permission="TODO">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.torproject.android.intent.action.USER_PRESENT" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -0,0 +1,36 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>$TITLE</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: white;
|
||||||
|
color: white;
|
||||||
|
font-family: sans;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.container {
|
||||||
|
width: 97%;
|
||||||
|
margin: auto;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1 style="text-align: left;font-family: Arial, Helvetica, sans-serif;color: LightSlateGrey;font-size: 1.3em">This site can't be reached</h1>
|
||||||
|
<p style="text-align: left;color: LightSlateGrey;font-size: 1em">An error occurred during a connection <br></p>
|
||||||
|
<p style="margin-top: -10px;text-align: left;color: LightSlateGrey;font-size: 0.8em">$ERROR</p>
|
||||||
|
|
||||||
|
<ul style="margin-left: -25px" >
|
||||||
|
<li style="font-size: 0.9em;margin-top: 40px;text-align: left;color: LightSlateGrey">The page you are trying to view cannot be shown because the authenticity of the received data could not be verified</li>
|
||||||
|
<li style="font-size: 0.9em;text-align: left;color: LightSlateGrey">The page is currently not live or down due to some reason</li>
|
||||||
|
<li style="font-size: 0.9em;text-align: left;color: LightSlateGrey">Please contact the website owners to inform them of this problem.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<a href="$URL"><button style="max-width: 450px;float:left;margin-top: 30px;width: 100%;font-weight: bold;font-family: Arial, Helvetica, sans-serif;font-size: 1em;border-radius: 5px;padding-bottom: 10px;padding-top: 10px;border: none;background:DodgerBlue;color: white"> Reload</button></a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,713 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<!-- 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/. -->
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||||
|
<title>GNU General Public License 3.0</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
|
<style type="text/css">
|
||||||
|
.path {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" href="chrome://global/skin/about.css" type="text/css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body id="lic-info" class="aboutPageWideContainer">
|
||||||
|
|
||||||
|
<h1 id="gpl-3.0">GNU General Public License 3.0</h1>
|
||||||
|
|
||||||
|
<pre>Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright © 2007 Free Software Foundation, Inc.
|
||||||
|
<<a href="http://fsf.org/">http://fsf.org/</a>>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.</pre>
|
||||||
|
|
||||||
|
<h2><a name="preamble"></a>Preamble</h2>
|
||||||
|
|
||||||
|
<p>The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.</p>
|
||||||
|
|
||||||
|
<h2><a name="terms"></a>TERMS AND CONDITIONS</h2>
|
||||||
|
|
||||||
|
<h3><a name="section0"></a>0. Definitions.</h3>
|
||||||
|
|
||||||
|
<p>“This License” refers to version 3 of the GNU General Public License.</p>
|
||||||
|
|
||||||
|
<p>“Copyright” also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.</p>
|
||||||
|
|
||||||
|
<p>“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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>A “covered work” means either the unmodified Program or a work based
|
||||||
|
on the Program.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section1"></a>1. Source Code.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.</p>
|
||||||
|
|
||||||
|
<p>The Corresponding Source for a work in source code form is that
|
||||||
|
same work.</p>
|
||||||
|
|
||||||
|
<h3><a name="section2"></a>2. Basic Permissions.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.</p>
|
||||||
|
|
||||||
|
<h3><a name="section3"></a>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section4"></a>4. Conveying Verbatim Copies.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section5"></a>5. Conveying Modified Source Versions.</h3>
|
||||||
|
|
||||||
|
<p>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:</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.</li>
|
||||||
|
|
||||||
|
<li>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”.</li>
|
||||||
|
|
||||||
|
<li>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.</li>
|
||||||
|
|
||||||
|
<li>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.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section6"></a>6. Conveying Non-Source Forms.</h3>
|
||||||
|
|
||||||
|
<p>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:</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>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.</li>
|
||||||
|
|
||||||
|
<li>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.</li>
|
||||||
|
|
||||||
|
<li>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.</li>
|
||||||
|
|
||||||
|
<li>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.</li>
|
||||||
|
|
||||||
|
<li>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.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>“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.</p>
|
||||||
|
|
||||||
|
<p>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).</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section7"></a>7. Additional Terms.</h3>
|
||||||
|
|
||||||
|
<p>“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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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:</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or</li>
|
||||||
|
|
||||||
|
<li>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</li>
|
||||||
|
|
||||||
|
<li>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</li>
|
||||||
|
|
||||||
|
<li>d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or</li>
|
||||||
|
|
||||||
|
<li>e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or</li>
|
||||||
|
|
||||||
|
<li>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.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section8"></a>8. Termination.</h3>
|
||||||
|
|
||||||
|
<p>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).</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section9"></a>9. Acceptance Not Required for Having Copies.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section10"></a>10. Automatic Licensing of Downstream Recipients.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section11"></a>11. Patents.</h3>
|
||||||
|
|
||||||
|
<p>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”.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section12"></a>12. No Surrender of Others' Freedom.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section13"></a>13. Use with the GNU Affero General Public License.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section14"></a>14. Revised Versions of this License.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section15"></a>15. Disclaimer of Warranty.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section16"></a>16. Limitation of Liability.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<h3><a name="section17"></a>17. Interpretation of Sections 15 and 16.</h3>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>END OF TERMS AND CONDITIONS</p>
|
||||||
|
|
||||||
|
<h2><a name="howto"></a>How to Apply These Terms to Your New Programs</h2>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
<pre> <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/>.
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>Also add information on how to contact you by electronic and paper mail.</p>
|
||||||
|
|
||||||
|
<p>If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:</p>
|
||||||
|
|
||||||
|
<pre> <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.
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>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”.</p>
|
||||||
|
|
||||||
|
<p>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
|
||||||
|
<<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>>.</p>
|
||||||
|
|
||||||
|
<p>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
|
||||||
|
<<a href="http://www.gnu.org/philosophy/why-not-lgpl.html">http://www.gnu.org/philosophy/why-not-lgpl.html</a>>.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,948 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Licenses</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Binaries of this product are made available to you by Mozilla under the Mozilla Public License 2.0 (MPL).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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.)
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><a href="#mpl2">Mozilla Public License 2.0</a></li>
|
||||||
|
<li><a href="#apache2">Apache License 2.0</a></li>
|
||||||
|
<li><a href="#lgpl21">GNU Lesser General Public License 2.1</a></li>
|
||||||
|
<li><a href="#adjust">adjust-android License</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
|
||||||
|
<h2><a name="mpl2">Mozilla Public License 2.0</a></h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Focus - https://github.com/mozilla-mobile/focus-android</li>
|
||||||
|
<li>Telemetry - https://github.com/mozilla-mobile/telemetry-android</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h4>1. Definitions</h4>
|
||||||
|
<dl>
|
||||||
|
<dt>1.1. “Contributor”</dt>
|
||||||
|
<dd><p>means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.2. “Contributor Version”</dt>
|
||||||
|
<dd><p>means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor’s Contribution.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.3. “Contribution”</dt>
|
||||||
|
<dd><p>means Covered Software of a particular Contributor.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.4. “Covered Software”</dt>
|
||||||
|
<dd><p>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.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.5. “Incompatible With Secondary Licenses”</dt>
|
||||||
|
<dd><p>means</p>
|
||||||
|
<ol type="a">
|
||||||
|
<li><p>that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or</p></li>
|
||||||
|
<li><p>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.</p></li>
|
||||||
|
</ol>
|
||||||
|
</dd>
|
||||||
|
<dt>1.6. “Executable Form”</dt>
|
||||||
|
<dd><p>means any form of the work other than Source Code Form.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.7. “Larger Work”</dt>
|
||||||
|
<dd><p>means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.8. “License”</dt>
|
||||||
|
<dd><p>means this document.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.9. “Licensable”</dt>
|
||||||
|
<dd><p>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.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.10. “Modifications”</dt>
|
||||||
|
<dd><p>means any of the following:</p>
|
||||||
|
<ol type="a">
|
||||||
|
<li><p>any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or</p></li>
|
||||||
|
<li><p>any new file in Source Code Form that contains any Covered Software.</p></li>
|
||||||
|
</ol>
|
||||||
|
</dd>
|
||||||
|
<dt>1.11. “Patent Claims” of a Contributor</dt>
|
||||||
|
<dd><p>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.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.12. “Secondary License”</dt>
|
||||||
|
<dd><p>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.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.13. “Source Code Form”</dt>
|
||||||
|
<dd><p>means the form of the work preferred for making modifications.</p>
|
||||||
|
</dd>
|
||||||
|
<dt>1.14. “You” (or “Your”)</dt>
|
||||||
|
<dd><p>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.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<h4>2. License Grants and Conditions</h4>
|
||||||
|
<h3>2.1. Grants</h3>
|
||||||
|
<p>Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:</p>
|
||||||
|
<ol type="a">
|
||||||
|
<li><p>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</p></li>
|
||||||
|
<li><p>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.</p></li>
|
||||||
|
</ol>
|
||||||
|
<h3>2.2. Effective Date</h3>
|
||||||
|
<p>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.</p>
|
||||||
|
<h3>2.3. Limitations on Grant Scope</h3>
|
||||||
|
<p>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:</p>
|
||||||
|
<ol type="a">
|
||||||
|
<li><p>for any code that a Contributor has removed from Covered Software; or</p></li>
|
||||||
|
<li><p>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</p></li>
|
||||||
|
<li><p>under Patent Claims infringed by Covered Software in the absence of its Contributions.</p></li>
|
||||||
|
</ol>
|
||||||
|
<p>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).</p>
|
||||||
|
<h3>2.4. Subsequent Licenses</h3>
|
||||||
|
<p>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).</p>
|
||||||
|
<h3>2.5. Representation</h3>
|
||||||
|
<p>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.</p>
|
||||||
|
<h3>2.6. Fair Use</h3>
|
||||||
|
<p>This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents.</p>
|
||||||
|
<h3>2.7. Conditions</h3>
|
||||||
|
<p>Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1.</p>
|
||||||
|
<h4>3. Responsibilities</h4>
|
||||||
|
<h3>3.1. Distribution of Source Form</h3>
|
||||||
|
<p>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.</p>
|
||||||
|
<h3>3.2. Distribution of Executable Form</h3>
|
||||||
|
<p>If You distribute Covered Software in Executable Form then:</p>
|
||||||
|
<ol type="a">
|
||||||
|
<li><p>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</p></li>
|
||||||
|
<li><p>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.</p></li>
|
||||||
|
</ol>
|
||||||
|
<h3>3.3. Distribution of a Larger Work</h3>
|
||||||
|
<p>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).</p>
|
||||||
|
<h3>3.4. Notices</h3>
|
||||||
|
<p>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.</p>
|
||||||
|
<h3>3.5. Application of Additional Terms</h3>
|
||||||
|
<p>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.</p>
|
||||||
|
<h4>4. Inability to Comply Due to Statute or Regulation</h4>
|
||||||
|
<p>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.</p>
|
||||||
|
<h4>5. Termination</h4>
|
||||||
|
<p>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.</p>
|
||||||
|
<p>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.</p>
|
||||||
|
<p>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.</p>
|
||||||
|
<h4>6. Disclaimer of Warranty</h4>
|
||||||
|
<p><em>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.</em></p>
|
||||||
|
<h4>7. Limitation of Liability</h4>
|
||||||
|
<p><em>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.</em></p>
|
||||||
|
<h4>8. Litigation</h4>
|
||||||
|
<p>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.</p>
|
||||||
|
<h4>9. Miscellaneous</h4>
|
||||||
|
<p>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.</p>
|
||||||
|
<h4>10. Versions of the License</h4>
|
||||||
|
<h3>10.1. New Versions</h3>
|
||||||
|
<p>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.</p>
|
||||||
|
<h3>10.2. Effect of New Versions</h3>
|
||||||
|
<p>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.</p>
|
||||||
|
<h3>10.3. Modified Versions</h3>
|
||||||
|
<p>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).</p>
|
||||||
|
<h3>10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses</h3>
|
||||||
|
<p>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.</p>
|
||||||
|
<h4>Exhibit A - Source Code Form License Notice</h4>
|
||||||
|
<blockquote>
|
||||||
|
<p>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 <a href="http://mozilla.org/MPL/2.0/" target="_blank">http://mozilla.org/MPL/2.0/</a>.</p>
|
||||||
|
</blockquote>
|
||||||
|
<p>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.</p>
|
||||||
|
<p>You may add additional accurate notices of copyright ownership.</p>
|
||||||
|
<h4>Exhibit B - “Incompatible With Secondary Licenses” Notice</h4>
|
||||||
|
<blockquote>
|
||||||
|
<p>This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0.</p>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
|
||||||
|
<h2><a name="apache2">Apache License 2.0</a></h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>com.android.support : animated-vector-drawable</li>
|
||||||
|
<li>org.jetbrains : annotations</li>
|
||||||
|
<li>com.android.support : appcompat-v7</li>
|
||||||
|
<li>com.android.support : cardview-v7</li>
|
||||||
|
<li>android.arch.lifecycle : common</li>
|
||||||
|
<li>android.arch.core : common</li>
|
||||||
|
<li>com.android.support : customtabs</li>
|
||||||
|
<li>com.android.support : design</li>
|
||||||
|
<li>android.arch.lifecycle : extensions</li>
|
||||||
|
<li>org.jetbrains.kotlin : kotlin-stdlib-jre7</li>
|
||||||
|
<li>org.jetbrains.kotlin : kotlin-stdlib</li>
|
||||||
|
<li>com.android.support : recyclerview-v7</li>
|
||||||
|
<li>android.arch.core : runtime</li>
|
||||||
|
<li>android.arch.lifecycle : runtime</li>
|
||||||
|
<li>com.android.support : support-annotations</li>
|
||||||
|
<li>com.android.support : support-compat</li>
|
||||||
|
<li>com.android.support : support-core-ui</li>
|
||||||
|
<li>com.android.support : support-core-utils</li>
|
||||||
|
<li>com.android.support : support-fragment</li>
|
||||||
|
<li>com.android.support : support-media-compat</li>
|
||||||
|
<li>com.android.support : support-v4</li>
|
||||||
|
<li>com.android.support :support-vector-drawable</li>
|
||||||
|
<li>com.android.support :transition</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><strong><a name="definitions">1. Definitions</a></strong>.</p>
|
||||||
|
<p>"License" shall mean the terms and conditions for use, reproduction, and
|
||||||
|
distribution as defined by Sections 1 through 9 of this document.</p>
|
||||||
|
<p>"Licensor" shall mean the copyright owner or entity authorized by the
|
||||||
|
copyright owner that is granting the License.</p>
|
||||||
|
<p>"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.</p>
|
||||||
|
<p>"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||||
|
permissions granted by this License.</p>
|
||||||
|
<p>"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation source,
|
||||||
|
and configuration files.</p>
|
||||||
|
<p>"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.</p>
|
||||||
|
<p>"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).</p>
|
||||||
|
<p>"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.</p>
|
||||||
|
<p>"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."</p>
|
||||||
|
<p>"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.</p>
|
||||||
|
<p><strong><a name="copyright">2. Grant of Copyright License</a></strong>. 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.</p>
|
||||||
|
<p><strong><a name="patent">3. Grant of Patent License</a></strong>. 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.</p>
|
||||||
|
<p><strong><a name="redistribution">4. Redistribution</a></strong>. 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:</p>
|
||||||
|
<ol style="list-style: lower-latin;">
|
||||||
|
<li>You must give any other recipients of the Work or Derivative Works a
|
||||||
|
copy of this License; and</li>
|
||||||
|
|
||||||
|
<li>You must cause any modified files to carry prominent notices stating
|
||||||
|
that You changed the files; and</li>
|
||||||
|
|
||||||
|
<li>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</li>
|
||||||
|
|
||||||
|
<li>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.
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
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.
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<p><strong><a name="contributions">5. Submission of Contributions</a></strong>. 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.</p>
|
||||||
|
<p><strong><a name="trademarks">6. Trademarks</a></strong>. 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.</p>
|
||||||
|
<p><strong><a name="no-warranty">7. Disclaimer of Warranty</a></strong>. 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.</p>
|
||||||
|
<p><strong><a name="no-liability">8. Limitation of Liability</a></strong>. 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.</p>
|
||||||
|
<p><strong><a name="additional">9. Accepting Warranty or Additional Liability</a></strong>.
|
||||||
|
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.</p>
|
||||||
|
<p>END OF TERMS AND CONDITIONS</p>
|
||||||
|
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
|
||||||
|
<h2><a name="lgpl21">GNU Lesser General Public License 2.1</a></h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>findbugs annotations (com.google.code.findbugs:annotations)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3><a id="SEC1">GNU LESSER GENERAL PUBLIC LICENSE</a></h3>
|
||||||
|
<p>
|
||||||
|
Version 2.1, February 1999
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.<br />
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA<br />
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies<br />
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
[This is the first released version of the Lesser GPL. It also counts<br />
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence<br />
|
||||||
|
the version number 2.1.]
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3><a id="SEC2">Preamble</a></h3>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3><a id="SEC3">TERMS AND CONDITIONS FOR COPYING,
|
||||||
|
DISTRIBUTION AND MODIFICATION</a></h3>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>0.</strong>
|
||||||
|
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".
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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".)
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
"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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>1.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>2.</strong>
|
||||||
|
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:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><strong>a)</strong>
|
||||||
|
The modified work must itself be a software library.</li>
|
||||||
|
<li><strong>b)</strong>
|
||||||
|
You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.</li>
|
||||||
|
|
||||||
|
<li><strong>c)</strong>
|
||||||
|
You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.</li>
|
||||||
|
|
||||||
|
<li><strong>d)</strong>
|
||||||
|
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.
|
||||||
|
<p>
|
||||||
|
(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.)</p></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>3.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>4.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>5.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.)
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>6.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><strong>a)</strong> 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.)</li>
|
||||||
|
|
||||||
|
<li><strong>b)</strong> 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.</li>
|
||||||
|
|
||||||
|
<li><strong>c)</strong> 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.</li>
|
||||||
|
|
||||||
|
<li><strong>d)</strong> 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.</li>
|
||||||
|
|
||||||
|
<li><strong>e)</strong> Verify that the user has already received
|
||||||
|
a copy of these materials or that you have already sent this user
|
||||||
|
a copy.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>7.</strong> 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:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><strong>a)</strong> 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.</li>
|
||||||
|
|
||||||
|
<li><strong>b)</strong> 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.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>8.</strong> 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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>9.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>10.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>11.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>12.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>13.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>14.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>NO WARRANTY</strong>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>15.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>16.</strong>
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>END OF TERMS AND CONDITIONS</h3>
|
||||||
|
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
<!-- ****************************************************************************************************************************** -->
|
||||||
|
|
||||||
|
<h2><a name="adjust">adjust-android License</a></h2>
|
||||||
|
|
||||||
|
<p>Copyright (c) 2012-2017 adjust GmbH,<br />
|
||||||
|
http://www.adjust.com</p>
|
||||||
|
|
||||||
|
<p>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:</p>
|
||||||
|
|
||||||
|
<p>The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.</p>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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;
|
||||||
|
}
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 23 KiB |
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<bookmarkAdapter.listViewHolder>
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private ArrayList<bookmarkRowModel> mModelList;
|
||||||
|
private ArrayList<bookmarkRowModel> temp_model_list;
|
||||||
|
private eventObserver.eventListener event;
|
||||||
|
private String filter = strings.EMPTY_STR;
|
||||||
|
private boolean isClosing = false;
|
||||||
|
|
||||||
|
bookmarkAdapter(ArrayList<bookmarkRowModel> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<Object> 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
class bookmarkModel
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private ArrayList<bookmarkRowModel> mModelList = new ArrayList<>();
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
void setList(ArrayList<bookmarkRowModel> model)
|
||||||
|
{
|
||||||
|
mModelList = model;
|
||||||
|
}
|
||||||
|
ArrayList<bookmarkRowModel> getList()
|
||||||
|
{
|
||||||
|
return mModelList;
|
||||||
|
}
|
||||||
|
private void removeFromMainList(int index)
|
||||||
|
{
|
||||||
|
mModelList.remove(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onManualClear(int index){
|
||||||
|
removeFromMainList(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearList(){
|
||||||
|
mModelList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<historyRowModel> selectHistory(int startIndex,int endIndex){
|
||||||
|
ArrayList<historyRowModel> 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<bookmarkRowModel> selectBookmark(){
|
||||||
|
ArrayList<bookmarkRowModel> 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<historyAdapter.listViewHolder>
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private ArrayList<historyRowModel> mModelList;
|
||||||
|
private ArrayList<historyRowModel> tempModelList;
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
private String filter = strings.EMPTY_STR;
|
||||||
|
private boolean isClosing = false;
|
||||||
|
|
||||||
|
historyAdapter(ArrayList<historyRowModel> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<historyRowModel> 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<Object> 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.historyManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
class historyModel
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private ArrayList<historyRowModel> mModelList = new ArrayList<>();
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
void setList(ArrayList<historyRowModel> model)
|
||||||
|
{
|
||||||
|
mModelList = model;
|
||||||
|
}
|
||||||
|
ArrayList<historyRowModel> getList()
|
||||||
|
{
|
||||||
|
return mModelList;
|
||||||
|
}
|
||||||
|
private void removeFromMainList(int index)
|
||||||
|
{
|
||||||
|
mModelList.remove(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onManualClear(int index){
|
||||||
|
removeFromMainList(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearList(){
|
||||||
|
mModelList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<Object> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<PromptResponse> mFileResponse;
|
||||||
|
private FilePrompt mFilePrompt;
|
||||||
|
|
||||||
|
public geckoPromptView(final Activity activity) {
|
||||||
|
mActivity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GeckoResult<PromptResponse> 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<PromptResponse> res = new GeckoResult<PromptResponse>();
|
||||||
|
createStandardDialog(builder, prompt, res).show();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GeckoResult<PromptResponse> 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<PromptResponse> res = new GeckoResult<PromptResponse>();
|
||||||
|
|
||||||
|
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<PromptResponse> 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<PromptResponse> 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<PromptResponse> res = new GeckoResult<PromptResponse>();
|
||||||
|
|
||||||
|
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<PromptResponse> 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<PromptResponse> res = new GeckoResult<PromptResponse>();
|
||||||
|
|
||||||
|
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<ModifiableChoice> 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<PromptResponse> 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<ModifiableChoice> adapter = new ArrayAdapter<ModifiableChoice>(
|
||||||
|
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<String> 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<PromptResponse> onChoicePrompt(final GeckoSession session,
|
||||||
|
final ChoicePrompt prompt) {
|
||||||
|
final GeckoResult<PromptResponse> res = new GeckoResult<PromptResponse>();
|
||||||
|
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<PromptResponse> 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<Integer> adapter = new ArrayAdapter<Integer>(
|
||||||
|
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<PromptResponse> res = new GeckoResult<PromptResponse>();
|
||||||
|
|
||||||
|
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<PromptResponse> 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<PromptResponse> res = new GeckoResult<PromptResponse>();
|
||||||
|
|
||||||
|
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<PromptResponse> 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<PromptResponse> res = new GeckoResult<PromptResponse>();
|
||||||
|
|
||||||
|
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<PromptResponse> 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<Uri> 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<SlowScriptResponse> 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<MediaSource> adapter = new ArrayAdapter<MediaSource>(
|
||||||
|
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<PromptResponse> onPopupPrompt(final GeckoSession session,
|
||||||
|
final PopupPrompt prompt) {
|
||||||
|
return GeckoResult.fromValue(prompt.confirm(AllowOrDeny.ALLOW));
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<Boolean> 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<AllowOrDeny> 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<String> 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<ResolveInfo> 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<mHistoryList.size()){
|
||||||
|
event.invokeObserver(Arrays.asList(mHistoryList.get(index).getUri(),mSessionID), enums.etype.start_proxy);
|
||||||
|
|
||||||
|
new Handler().postDelayed(() ->
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<String> 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<Object> 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<Object> 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)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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(" ","+");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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<String> 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<historyRowModel> 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<historyRowModel> suggestions){
|
||||||
|
|
||||||
|
if(mSearchbar.isFocused()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
autoCompleteAdapter suggestionAdapter = new autoCompleteAdapter(mContext, R.layout.hint_view, (ArrayList<historyRowModel>) 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<String> 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)<mProgressBar.getProgress()){
|
||||||
|
progress = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(animation!=null){
|
||||||
|
animation.removeAllListeners();
|
||||||
|
animation.end();
|
||||||
|
animation.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
animation = ObjectAnimator.ofInt(pb, "progress", pb.getProgress(), progressTo * 100);
|
||||||
|
animation.setDuration(progress);
|
||||||
|
animation.setInterpolator(new DecelerateInterpolator());
|
||||||
|
animation.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onClearSelections(boolean hideKeyboard){
|
||||||
|
mSearchbar.clearFocus();
|
||||||
|
if(hideKeyboard){
|
||||||
|
helperMethod.hideKeyboard(mContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int defaultFlag = 0;
|
||||||
|
void onFullScreenUpdate(boolean status){
|
||||||
|
int value = !status ? 1 : 0;
|
||||||
|
|
||||||
|
mTopBar.setClickable(!status);
|
||||||
|
mTopBar.setAlpha(value);
|
||||||
|
|
||||||
|
if(status){
|
||||||
|
mWebviewContainer.setPadding(0,0,0,0);
|
||||||
|
defaultFlag = mContext.getWindow().getDecorView().getSystemUiVisibility();
|
||||||
|
final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
|
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
|
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||||
|
|
||||||
|
mContext.getWindow().getDecorView().setSystemUiVisibility(flags);
|
||||||
|
mProgressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mWebviewContainer.getLayoutParams();
|
||||||
|
params.setMargins(0, 0, 0, 0);
|
||||||
|
mWebviewContainer.setLayoutParams(params);
|
||||||
|
mBannerAds.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (Build.VERSION.SDK_INT >= 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class settingModelCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invokeObserver(List<Object> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<tabAdapter.listViewHolder>
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private ArrayList<tabRowModel> mModelList;
|
||||||
|
private ArrayList<tabRowModel> mTempModelList;
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
private String filter = strings.EMPTY_STR;
|
||||||
|
private boolean isClosing = false;
|
||||||
|
|
||||||
|
tabAdapter(ArrayList<tabRowModel> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<Object> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.tabManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
class tabModel
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private ArrayList<tabRowModel> mModelList = new ArrayList<>();
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
void setList(ArrayList<tabRowModel> model)
|
||||||
|
{
|
||||||
|
mModelList = model;
|
||||||
|
}
|
||||||
|
ArrayList<tabRowModel> getList()
|
||||||
|
{
|
||||||
|
return mModelList;
|
||||||
|
}
|
||||||
|
private void removeFromMainList(int index)
|
||||||
|
{
|
||||||
|
if(mModelList.size()>0){
|
||||||
|
mModelList.remove(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onManualClear(int index){
|
||||||
|
removeFromMainList(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
69
app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java
Normal file → Executable file
|
@ -4,51 +4,52 @@ public class constants
|
||||||
{
|
{
|
||||||
/*LOCAL URL CONSTANTS*/
|
/*LOCAL URL CONSTANTS*/
|
||||||
|
|
||||||
public static String blackMarket = "https://boogle.store/search?q=black+market&p_num=1&s_type=all";
|
public static final String BLACK_MARKET_URL = "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 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 String news = "https://boogle.store/search?q=latest%20news&p_num=1&s_type=news";
|
public static final String NEWS_URL = "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";
|
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*/
|
/*URL CONSTANTS*/
|
||||||
|
|
||||||
public static String backendGenesis = "https://boogle.store/";
|
public static final String BACKEND_GENESIS_URL = "http://boogle.store";
|
||||||
public static String backendUrlHost = "boogle.store";
|
public static final String GENESIS_UPDATE_URL = "https://boogle.store/manual?abi=";
|
||||||
public static String updateUrl = "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 String frontEndUrlHost = "genesis.store";
|
public static final String PLAYSTORE_URL = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine";
|
||||||
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*/
|
/*PROXY CONSTANTS*/
|
||||||
|
|
||||||
public static int proxy_type = 1;
|
public static final String PROXY_SOCKS = "127.0.0.1";
|
||||||
public static String proxy_socks = "127.0.0.1";
|
public static final String PROXY_SOCKS_PORT = "9050";
|
||||||
public static int proxy_socks_version = 5;
|
public static final int PROXY_SOCKS_VERSION = 5;
|
||||||
public static boolean proxy_socks_remote_dns = true;
|
public static final boolean PROXY_SOCKS_REMOTE_DNS = true;
|
||||||
public static boolean proxy_cache = false;
|
public static final boolean PROXY_CACHE = true;
|
||||||
public static boolean proxy_memory = false;
|
public static final boolean PROXY_MEMORY = true;
|
||||||
public static String proxy_useragent_override = "Mozilla/5.0 (Android 9; Mobile; rv:67.0) Gecko/67.0 Firefox/67.0";
|
public static final int DISK_CAPACITY = 10000;
|
||||||
public static boolean proxy_donottrackheader_enabled = false;
|
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 int proxy_donottrackheader_value = 1;
|
public static final boolean PROXY_DO_NOT_TRACK_HEADER_ENABLED = false;
|
||||||
|
public static final int PROXY_DO_NOT_TRACK_HEADER_VALUE = 1;
|
||||||
|
|
||||||
/*MENU CONSTANTS*/
|
/*MENU CONSTANTS*/
|
||||||
|
|
||||||
public static int list_history = 1;
|
public static final int LIST_HISTORY = 1;
|
||||||
public static int list_bookmark = 2;
|
public static final int LIST_BOOKMARK = 2;
|
||||||
|
|
||||||
/*SETTINGS CONSTANTS*/
|
/*SETTINGS CONSTANTS*/
|
||||||
|
|
||||||
public static int max_history_size=500;
|
public static final int MAX_LIST_DATA_SIZE =5000;
|
||||||
public static int max_bookmark_size=500;
|
public static final int MAX_LIST_SIZE =5000;
|
||||||
public static String databae_name="genesis_dbase";
|
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";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
16
app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java
Normal file → Executable file
|
@ -2,10 +2,14 @@ package com.darkweb.genesissearchengine.constants;
|
||||||
|
|
||||||
public class enums
|
public class enums
|
||||||
{
|
{
|
||||||
/*SETTINGS*/
|
/*Settings Manager*/
|
||||||
|
public enum etype{
|
||||||
public enum searchEngine{Darkweb,Bing,Google}
|
HiddenWeb, DuckDuckGo,Google,
|
||||||
public enum adID{hidden_onion, hidden_onion_start,hidden_base}
|
hidden_onion, hidden_onion_start,hidden_base,
|
||||||
public enum navigationType{onion, 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
|
||||||
|
}
|
||||||
}
|
}
|
49
app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java
Normal file → Executable file
|
@ -2,35 +2,40 @@ package com.darkweb.genesissearchengine.constants;
|
||||||
|
|
||||||
public class keys
|
public class keys
|
||||||
{
|
{
|
||||||
/*Welcome Message Prefs*/
|
|
||||||
|
|
||||||
public static String first_time_loaded = "FirstTimeLoaded";
|
|
||||||
|
|
||||||
/*Home page*/
|
/*Home page*/
|
||||||
|
|
||||||
public static String homepage_html_key = "internalhtml";
|
public static String LOW_MEMORY = "LOW_MEMORY";
|
||||||
public static String low_memory = "low_memory";
|
|
||||||
|
|
||||||
/*Proxy Manager*/
|
/*Proxy Manager*/
|
||||||
|
|
||||||
public static String proxy_type = "network.proxy.type";
|
public static final String PROXY_TYPE = "network.proxy.type";
|
||||||
public static String proxy_socks = "network.proxy.socks";
|
public static final String PROXY_SOCKS = "network.proxy.socks";
|
||||||
public static String proxy_socks_port = "network.proxy.socks_port";
|
public static final String PROXY_SOCKS_PORT = "network.proxy.socks_port";
|
||||||
public static String proxy_socks_version = "network.proxy.socks_version";
|
public static final String PROXY_SOCKS_VERSION = "network.proxy.socks_version";
|
||||||
public static String proxy_socks_remote_dns = "network.proxy.socks_remote_dns";
|
public static final String PROXY_SOCKS_REMOTE_DNS = "network.proxy.socks_remote_dns";
|
||||||
public static String proxy_cache = "browser.cache.disk.enable";
|
public static final String PROXY_SOCKS_COOKIES = "privacy.clearOnShutdown.cookies";
|
||||||
public static String proxy_memory = "browser.cache.memory.enable";
|
public static final String PROXY_CACHE = "browser.cache.disk.enable";
|
||||||
public static String proxy_useragent_override = "general.useragent.override";
|
public static final String PROXY_MEMORY = "browser.cache.memory.enable";
|
||||||
public static String proxy_donottrackheader_enabled = "privacy.donottrackheader.enabled";
|
public static final String PROXY_DISK_CAPACITY = "browser.cache.disk.capacity";
|
||||||
public static String proxy_donottrackheader_value = "privacy.donottrackheader.value";
|
public static final String PROXY_USER_AGENT_OVERRIDE = "general.useragent.override";
|
||||||
public static String hasOrbotInstalled = "hasOrbotInstalled";
|
public static final String PROXY_DO_NOT_TRACK_HEADER_ENABLED = "privacy.donottrackheader.enabled";
|
||||||
public static String isAppRated = "isAppRated";
|
public static final String PROXY_DO_NOT_TRACK_HEADER_VALUE = "privacy.donottrackheader.value";
|
||||||
public static String list_type = "list_type";
|
public static final String IS_APP_RATED = "IS_APP_RATED";
|
||||||
|
public static final String list_type = "list_type";
|
||||||
|
|
||||||
/*Settings*/
|
/*Settings*/
|
||||||
|
|
||||||
public static String search_engine = "search_engine";
|
public static final String SEARCH_ENGINE = "SEARCH_ENGINE";
|
||||||
public static String java_script = "java_script";
|
public static final String JAVA_SCRIPT = "JAVA_SCRIPT";
|
||||||
public static String history_clear = "history_clear";
|
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";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
10
app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java
Normal file → Executable file
|
@ -4,12 +4,6 @@ public class messages
|
||||||
{
|
{
|
||||||
/*POST MESSAGES KEYS*/
|
/*POST MESSAGES KEYS*/
|
||||||
|
|
||||||
public final static int INTERNET_ERROR =2;
|
public final static int UPDATE_LOADING_TEXT =1;
|
||||||
public final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1;
|
public final static int ON_URL_LOAD =2;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
40
app/src/main/java/com/darkweb/genesissearchengine/constants/status.java
Normal file → Executable file
|
@ -1,28 +1,40 @@
|
||||||
package com.darkweb.genesissearchengine.constants;
|
package com.darkweb.genesissearchengine.constants;
|
||||||
|
|
||||||
import android.util.Log;
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
import com.darkweb.genesissearchengine.dataManager.preference_manager;
|
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
|
||||||
|
|
||||||
public class status
|
public class status
|
||||||
{
|
{
|
||||||
/*App Level*/
|
/*App Status*/
|
||||||
|
|
||||||
public static boolean isApplicationLoaded = false;
|
public static String current_ABI = "7.0";
|
||||||
public static boolean isPlayStoreInstalled = true;
|
public static boolean paid_status = false;
|
||||||
public static boolean isTorInitialized = false;
|
|
||||||
public static String version_code = "7.0";
|
|
||||||
|
|
||||||
/*Settings Level*/
|
/*Settings Status*/
|
||||||
|
|
||||||
public static String search_status = strings.emptyStr;
|
public static String sSearchStatus = constants.BACKEND_GENESIS_URL;
|
||||||
public static boolean java_status = false;
|
public static boolean sJavaStatus = true;
|
||||||
public static boolean history_status = 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()
|
public static void initStatus()
|
||||||
{
|
{
|
||||||
status.java_status = preference_manager.getInstance().getBool(keys.java_script,true);
|
status.sJavaStatus = dataController.getInstance().getBool(keys.JAVA_SCRIPT,true);
|
||||||
status.history_status = preference_manager.getInstance().getBool(keys.history_clear,true);
|
status.sHistoryStatus = dataController.getInstance().getBool(keys.HISTORY_CLEAR,true);
|
||||||
status.search_status = preference_manager.getInstance().getString(keys.search_engine,"Hidden Web");
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
164
app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java
Normal file → Executable file
|
@ -4,81 +4,135 @@ public class strings
|
||||||
{
|
{
|
||||||
/*Orbot Manager*/
|
/*Orbot Manager*/
|
||||||
|
|
||||||
public static String torfolder = "torfiles";
|
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";
|
||||||
|
|
||||||
/*Messsage Manager*/
|
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 String welcome_message_title = "Welcome | Deep Web Gateway";
|
public static final String REPORT_URL_TITLE = "Report This Website";
|
||||||
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 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 String welcome_message_bt1 = "Deep Web Online Market";
|
public static final String REPORT_URL_BT_1 = "Report";
|
||||||
public static String welcome_message_bt2 = "Leaked Documents and Books";
|
public static final String REPORT_URL_BT_2 = "Dismiss";
|
||||||
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 final String ORBOT_INIT_TITLE = "Initializing";
|
||||||
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 final String ORBOT_INIT_DESC = "Please wait! While we connect you to hidden web. This might take few minutes\n";
|
||||||
public static String base_error_bt1 = "Dismiss";
|
public static final String ORBOT_INIT_BT_1 = "Dismiss";
|
||||||
|
public static final String ORBOT_INIT_BT_2 = "Try Again";
|
||||||
|
|
||||||
public static String abi_error_title = "Invalid Setup File";
|
public static final String VERSION_TITLE = "Update Pending";
|
||||||
public static String abi_error_desc = "Looks like you messed up the installation. Either Install it from playstore or follow the link";
|
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 String abi_error_bt1 = "Local Upgrade";
|
public static final String VERSION_BT_1 = "Update";
|
||||||
public static String abi_error_bt2 = "Playstore Upgrade";
|
|
||||||
|
|
||||||
public static String report_url_title = "Report This Website";
|
public static final String REPORT_SUCCESS_TITLE = "URL Reported Successfully";
|
||||||
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 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 String report_url_bt1 = "Report";
|
public static final String REPORT_SUCCESS_BT_1 = "Dismiss";
|
||||||
public static String report_url_bt2 = "Dismiss";
|
|
||||||
|
|
||||||
public static String orbot_init_title = "Initializing";
|
public static final String RATE_TITLE = "Rate US";
|
||||||
public static String orbot_init_desc = "Please wait! While we connect you to hidden web. This might take few minutes\n";
|
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 String orbot_init_bt1 = "Dismiss";
|
public static final String RATE_POSITIVE = "Like This App";
|
||||||
public static String orbot_init_bt2 = "Try Again";
|
public static final String RATE_NEGATIVE = "Don't Like This App";
|
||||||
|
|
||||||
public static String version_title = "Update Pending";
|
public static final String RATE_SUCCESS_TITLE = "Sorry To Hear That!";
|
||||||
public static String version_desc = "You have not updated this app for a while please update it to get best performance\n";
|
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 String version_bt1 = "Update";
|
public static final String RATE_SUCCESS_BT_1 = "Send Mail";
|
||||||
|
|
||||||
public static String report_success_title = "URL Reported Successfully";
|
public static final String BOOKMARK_URL_BT_1 = "Bookmark";
|
||||||
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 final String BOOKMARK_URL_BT_2 = "Dismiss";
|
||||||
public static String report_success_bt1 = "Dismiss";
|
|
||||||
|
|
||||||
public static String rate_title = "Rate US";
|
public static final String CLEAR_HISTORY_TITLE = "Clear site storage?";
|
||||||
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 final String CLEAR_HISTORY_DESC = "This will clear data for all sites";
|
||||||
public static String rate_positive = "Like This App";
|
public static final String CLEAR_HISTORY_BT_1 = "Clear";
|
||||||
public static String rate_negative = "Don't Like This App";
|
public static final String CLEAR_HISTORY_BT_2 = "Dismiss";
|
||||||
|
|
||||||
public static String rate_success_title = "Sorry To Hear That!";
|
public static final String CLEAR_TAB_TITLE = "Clear open tabs?";
|
||||||
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 final String CLEAR_TAB_DESC = "This will clear all stored tabs";
|
||||||
public static String rate_success_bt1 = "Dismiss";
|
public static final String CLEAR_TAB_BT_1 = "Clear";
|
||||||
|
|
||||||
public static String bookmark_url_title = "Bookmark This Page";
|
public static final String clear_bookmark_title = "Clear site bookmark?";
|
||||||
public static String bookmark_url_desc = "Bookmark this URL To Restore It Again Afterward\n";
|
public static final String clear_bookmark_desc = "This will clear data for all saved sites\n";
|
||||||
public static String bookmark_url_bt1 = "Bookmark";
|
public static final String clear_bookmark_bt1 = "Clear";
|
||||||
public static String bookmark_url_bt2 = "Dismiss";
|
public static final String clear_bookmark_bt2 = "Dismiss";
|
||||||
|
|
||||||
public static String clear_title = "Warning | Clearing Data";
|
public static final String DOWNLOAD_TITLE = "Download Notification";
|
||||||
public static String clear_desc = "You are about to clear your data if you are sure please continue\n";
|
public static final String DOWNLOAD_LONG_PRESS_TITLE = "File Notification";
|
||||||
public static String clear_bt1 = "Clear Data";
|
public static final String DOWNLOAD_LONG_PRESS_MESSAGE = "File | ";
|
||||||
public static String clear_bt2 = "Dismiss";
|
public static final String DOWNLOAD_MESSAGE = "Download File | ";
|
||||||
|
public static final String DOWNLOAD_POSITIVE = "Download";
|
||||||
|
public static final String DOWNLOAD_NEGATIVE = "Dismiss";
|
||||||
|
|
||||||
public static String download_title = "Download Notification";
|
public static final String LONG_URL_TITLE = "URL Notification";
|
||||||
public static String download_message = "Download File | ";
|
public static final String LONG_URL_MESSAGE = "";
|
||||||
public static String download_positive = "Download";
|
public static final String LONG_URL_OPTION_1 = "Open In New Tab";
|
||||||
public static String download_negative = "Dismiss";
|
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*/
|
/*Text Manager*/
|
||||||
|
|
||||||
public static String darkweb = "Hidden Web";
|
public static final String DARK_WEB = "Hidden Web";
|
||||||
public static String emptyStr = "";
|
public static final String EMPTY_STR = "";
|
||||||
public static String bookmark_text = "bookmark";
|
public static final String EMPTY_SPACE = " ";
|
||||||
public static String history_text = "history";
|
|
||||||
public static String bing_text = "Bing";
|
|
||||||
public static String google_text = "Google";
|
|
||||||
|
|
||||||
|
/*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";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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<historyRowModel> 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<historyRowModel> 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<bookmarkRowModel> getBookmark(){
|
||||||
|
return mPreferencesModel.getBookmark();
|
||||||
|
}
|
||||||
|
public void addBookmark(String url,String title){
|
||||||
|
mPreferencesModel.addBookmark(url,title);
|
||||||
|
}
|
||||||
|
public void clearBookmark(){
|
||||||
|
mPreferencesModel.clearBookmark();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Recieving Suggestions*/
|
||||||
|
|
||||||
|
public ArrayList<historyRowModel> getSuggestions(){
|
||||||
|
return mPreferencesModel.getmSuggestions();
|
||||||
|
}
|
||||||
|
public void clearSuggestions(){
|
||||||
|
mPreferencesModel.clearSuggestion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Recieving Tabs*/
|
||||||
|
|
||||||
|
public ArrayList<tabRowModel> 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<historyRowModel> mHistory = new ArrayList<>();
|
||||||
|
private ArrayList<bookmarkRowModel> mBookmarks = new ArrayList<>();
|
||||||
|
private ArrayList<tabRowModel> mTabs = new ArrayList<>();
|
||||||
|
private ArrayList<historyRowModel> mSuggestions = new ArrayList<>();
|
||||||
|
private Map<String, Boolean> mHistoryCache = new HashMap<>();
|
||||||
|
private Map<String, historyRowModel> 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<historyRowModel> history){
|
||||||
|
this.mHistory = history;
|
||||||
|
initializeCache(history);
|
||||||
|
Log.i("","");
|
||||||
|
}
|
||||||
|
private void initializeCache(ArrayList<historyRowModel> 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<historyRowModel> 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<historyRowModel> 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<bookmarkRowModel> 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<tabRowModel> 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<historyRowModel> 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()+"");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<SoftKeyboardToggleListener, KeyboardUtils> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<historyRowModel> {
|
||||||
|
private final String MY_DEBUG_TAG = "CustomerAdapter";
|
||||||
|
private ArrayList<historyRowModel> items;
|
||||||
|
private ArrayList<historyRowModel> itemsAll;
|
||||||
|
private ArrayList<historyRowModel> suggestions;
|
||||||
|
private int viewResourceId;
|
||||||
|
|
||||||
|
public autoCompleteAdapter(Context context, int viewResourceId, ArrayList<historyRowModel> items) {
|
||||||
|
super(context, viewResourceId, items);
|
||||||
|
this.items = items;
|
||||||
|
this.itemsAll = (ArrayList<historyRowModel>) 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<historyRowModel> filteredList = (ArrayList<historyRowModel>)((ArrayList<historyRowModel>)results.values).clone();
|
||||||
|
|
||||||
|
clear();
|
||||||
|
for (historyRowModel c : filteredList) {
|
||||||
|
add(c);
|
||||||
|
}
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}catch (Exception ignored){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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) + " <br>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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<Object> data, enums.etype event_type);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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<String> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
12
app/src/main/java/com/darkweb/genesissearchengine/pluginManager/exitManager.java
Normal file → Executable file
|
@ -3,9 +3,8 @@ package com.darkweb.genesissearchengine.pluginManager;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
|
||||||
import com.darkweb.genesissearchengine.dataManager.preference_manager;
|
|
||||||
|
|
||||||
|
/*
|
||||||
public class exitManager extends Service {
|
public class exitManager extends Service {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,6 +12,9 @@ public class exitManager extends Service {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public exitManager(){
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
|
@ -21,12 +23,12 @@ public class exitManager extends Service {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
preference_manager.getInstance().setBool(keys.low_memory,false);
|
pluginController.getInstance().proxyManagerExitInvoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTaskRemoved(Intent rootIntent) {
|
public void onTaskRemoved(Intent rootIntent) {
|
||||||
stopSelf();
|
stopSelf();
|
||||||
preference_manager.getInstance().setBool(keys.low_memory,false);
|
pluginController.getInstance().proxyManagerExitInvoke();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
37
app/src/main/java/com/darkweb/genesissearchengine/pluginManager/fabricManager.java
Normal file → Executable file
|
@ -1,38 +1,29 @@
|
||||||
package com.darkweb.genesissearchengine.pluginManager;
|
package com.darkweb.genesissearchengine.pluginManager;
|
||||||
|
|
||||||
import android.content.Context;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
|
||||||
import io.fabric.sdk.android.Fabric;
|
import io.fabric.sdk.android.Fabric;
|
||||||
|
|
||||||
public class fabricManager
|
class fabricManager
|
||||||
{
|
{
|
||||||
/*Private Variables*/
|
/*Private Variables*/
|
||||||
|
|
||||||
private static final fabricManager ourInstance = new fabricManager();
|
private AppCompatActivity mAppContext;
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
|
||||||
/*Initializations*/
|
/*Initializations*/
|
||||||
|
|
||||||
public static fabricManager getInstance()
|
fabricManager(AppCompatActivity mAppContext, eventObserver.eventListener mEvent){
|
||||||
{
|
this.mAppContext = mAppContext;
|
||||||
return ourInstance;
|
this.mEvent = mEvent;
|
||||||
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
private fabricManager()
|
private void initialize(){
|
||||||
{
|
Fabric.with(mAppContext, new Crashlytics());
|
||||||
}
|
mEvent.invokeObserver(null,null);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<String> 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<String> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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<String> 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<Object> data, enums.etype event_type)
|
||||||
|
{
|
||||||
|
mHomeController.onSetBannerAdMargin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Analytics Manager*/
|
||||||
|
private class analyticCallback implements eventObserver.eventListener{
|
||||||
|
@Override
|
||||||
|
public void invokeObserver(List<Object> data, enums.etype event_type)
|
||||||
|
{
|
||||||
|
mAnalyticManager.logUser();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Fabric Manager*/
|
||||||
|
private class fabricCallback implements eventObserver.eventListener{
|
||||||
|
@Override
|
||||||
|
public void invokeObserver(List<Object> data, enums.etype event_type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Firebase Manager*/
|
||||||
|
private class firebaseCallback implements eventObserver.eventListener{
|
||||||
|
@Override
|
||||||
|
public void invokeObserver(List<Object> data, enums.etype event_type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Onion Proxy Manager*/
|
||||||
|
private class orbotCallback implements eventObserver.eventListener{
|
||||||
|
@Override
|
||||||
|
public void invokeObserver(List<Object> data, enums.etype event_type)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Message Manager*/
|
||||||
|
private class messageCallback implements eventObserver.eventListener{
|
||||||
|
@Override
|
||||||
|
public void invokeObserver(List<Object> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator">
|
||||||
|
<alpha
|
||||||
|
android:duration="100"
|
||||||
|
android:fromAlpha="0.1"
|
||||||
|
android:toAlpha="1.0">
|
||||||
|
</alpha>
|
||||||
|
</set>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<translate
|
||||||
|
android:duration="130"
|
||||||
|
android:fromXDelta="0%"
|
||||||
|
android:fromYDelta="-5%"
|
||||||
|
android:toXDelta="0%"
|
||||||
|
android:toYDelta="0%"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<alpha android:fromAlpha="0.0"
|
||||||
|
android:toAlpha="1.0"
|
||||||
|
android:interpolator="@android:anim/accelerate_interpolator"
|
||||||
|
android:duration="130"
|
||||||
|
android:repeatCount="0"/>
|
||||||
|
</set>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<translate
|
||||||
|
android:duration="130"
|
||||||
|
android:fromXDelta="0%"
|
||||||
|
android:fromYDelta="0%"
|
||||||
|
android:toXDelta="0%"
|
||||||
|
android:toYDelta="-5%"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<alpha android:fromAlpha="1.0"
|
||||||
|
android:toAlpha="0.0"
|
||||||
|
android:interpolator="@android:anim/accelerate_interpolator"
|
||||||
|
android:duration="130"
|
||||||
|
android:repeatCount="0"/>
|
||||||
|
</set>
|
After Width: | Height: | Size: 720 B |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 831 B |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 344 B |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 638 B |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 730 B |
|
@ -0,0 +1,76 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<vector
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:height="108dp"
|
||||||
|
android:width="108dp"
|
||||||
|
android:viewportHeight="108"
|
||||||
|
android:viewportWidth="108">
|
||||||
|
<item android:drawable="@android:color/black" />
|
||||||
|
<path android:fillColor="#008577"
|
||||||
|
android:pathData="M0,0h108v108h-108z"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||||
|
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||||
|
</vector>
|
After Width: | Height: | Size: 387 B |
After Width: | Height: | Size: 250 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 270 B |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 544 B |
|
@ -0,0 +1,114 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/white"
|
||||||
|
tools:context="com.darkweb.genesissearchengine.appManager.historyManager.historyController">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="@xml/ic_secondary_gradinet"
|
||||||
|
android:elevation="7dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:ignore="RtlHardcoded,RtlSymmetry,UselessParent">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/home"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="14dp"
|
||||||
|
android:layout_marginBottom="0dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:contentDescription="@string/todo"
|
||||||
|
android:onClick="onBackPressed"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/back_arrow"
|
||||||
|
android:tint="@color/black" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/search"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="0dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@xml/sc_generic_input"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="@string/SearchHint"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingLeft="18dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:textColor="@color/text_color_v2"
|
||||||
|
android:textColorHighlight="@color/text_color_highlight_v1"
|
||||||
|
android:textCursorDrawable="@xml/sc_search_cursor_state"
|
||||||
|
android:textSize="15sp"
|
||||||
|
tools:targetApi="o" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/listview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="0dp"
|
||||||
|
android:layout_marginTop="55dp"
|
||||||
|
android:paddingBottom="49dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/empty_list"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:contentDescription="@string/todo"
|
||||||
|
android:src="@drawable/empty_list"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="#fcfcfc"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:layout_height="48dp">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/clearButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:layout_marginEnd="2dp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:background="@xml/sc_primary_gradient"
|
||||||
|
android:onClick="onclearDataTrigger"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="-10dp"
|
||||||
|
android:text="@string/bookmark_clear_history"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -2,31 +2,49 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingRight="15dp"
|
android:paddingRight="0dp"
|
||||||
android:paddingLeft="15dp"
|
android:paddingLeft="0dp"
|
||||||
android:paddingBottom="-35dp"
|
android:paddingBottom="0dp"
|
||||||
android:background="@color/white"
|
|
||||||
android:elevation="0dp"
|
android:elevation="0dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:id="@+id/hintCompletionHeader"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/transparent"
|
android:paddingTop="10dp"
|
||||||
android:paddingBottom="10dp"
|
android:paddingBottom="10dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:onClick="onSuggestionInvoked"
|
||||||
|
android:background="@xml/sc_side_item_suggestions">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/hintCompletionTitle"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingRight="10dp"
|
android:paddingRight="10dp"
|
||||||
android:paddingTop="0dp"
|
android:textColor="@color/black"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:text="@string/hint_default_suggession" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/hintCompletionUrl"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:clickable="false"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:textColor="@color/text_color_v1"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="15.5sp"/>
|
android:paddingLeft="10dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:textColor="@color/holo_dark_gray"
|
||||||
|
android:textSize="12.5sp"
|
||||||
|
android:text="@string/hint_default_suggession" />
|
||||||
|
|
||||||
<View
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="@color/white_dark" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -0,0 +1,142 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/white"
|
||||||
|
tools:context="com.darkweb.genesissearchengine.appManager.historyManager.historyController">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:background="@xml/ic_secondary_gradinet"
|
||||||
|
android:elevation="7dp"
|
||||||
|
android:gravity="left"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:ignore="RtlHardcoded,RtlSymmetry,UselessParent">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/home"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="14dp"
|
||||||
|
android:layout_marginBottom="0dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:contentDescription="@string/todo"
|
||||||
|
android:onClick="onBackPressed"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/back_arrow"
|
||||||
|
android:tint="@color/black" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/search"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="0dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@xml/sc_generic_input"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="@string/SearchHint"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingLeft="18dp"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:textColor="@color/text_color_v2"
|
||||||
|
android:textColorHighlight="@color/text_color_highlight_v1"
|
||||||
|
android:textCursorDrawable="@xml/sc_search_cursor_state"
|
||||||
|
android:textSize="15sp"
|
||||||
|
tools:targetApi="o" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/listview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="0dp"
|
||||||
|
android:layout_marginTop="55dp"
|
||||||
|
android:paddingBottom="49dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/empty_list"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:contentDescription="@string/todo"
|
||||||
|
android:src="@drawable/empty_list"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="#fcfcfc"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/clearButton"
|
||||||
|
android:layout_width="406dp"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:layout_weight="90"
|
||||||
|
android:background="@xml/sc_primary_gradient"
|
||||||
|
android:onClick="onclearDataTrigger"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:layout_marginEnd="2dp"
|
||||||
|
android:stateListAnimator="@null"
|
||||||
|
|
||||||
|
android:text="@string/bookmark_clear_history"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/load_more"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:paddingRight="17dp"
|
||||||
|
android:paddingLeft="17dp"
|
||||||
|
android:tint="@color/white"
|
||||||
|
android:layout_weight="10"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:layout_marginStart="0dp"
|
||||||
|
android:layout_marginEnd="2dp"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:background="@xml/sc_primary_gradient"
|
||||||
|
android:onClick="onLoadMoreHostory"
|
||||||
|
android:src="@xml/ic_down_arrow"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="@color/holo_dark_gray"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:contentDescription="@string/todo" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1,109 +1,35 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
tools:context="com.darkweb.genesissearchengine.appManager.home_activity.home_controller">
|
tools:context="com.darkweb.genesissearchengine.appManager.homeManager.homeController">
|
||||||
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
android:id="@+id/webviewContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginTop="55dp"
|
||||||
|
android:background="@color/white"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<org.mozilla.geckoview.GeckoView
|
<org.mozilla.geckoview.GeckoView
|
||||||
android:id="@+id/webLoader"
|
android:id="@+id/webLoader"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:background="@color/clear_alpha_white"
|
||||||
android:alpha="1"
|
android:alpha="1"
|
||||||
android:layout_marginTop="55dp"
|
tools:layout_editor_absoluteX="8dp"
|
||||||
tools:layout_editor_absoluteY="8dp" tools:layout_editor_absoluteX="8dp">
|
tools:layout_editor_absoluteY="8dp" >
|
||||||
|
|
||||||
</org.mozilla.geckoview.GeckoView>
|
</org.mozilla.geckoview.GeckoView>
|
||||||
<!-- <ImageView
|
|
||||||
android:id="@+id/pageLoader2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:alpha="1"
|
|
||||||
android:clickable="false"
|
|
||||||
android:layout_marginTop="55dp"
|
|
||||||
tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp">
|
|
||||||
</ImageView> -->
|
|
||||||
<WebView
|
|
||||||
android:id="@+id/pageLoader1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginTop="55dp"
|
|
||||||
android:alpha="1"
|
|
||||||
android:background="@color/white"
|
|
||||||
tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp">
|
|
||||||
</WebView>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:id="@+id/requestFailure"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:alpha="0"
|
|
||||||
android:visibility="invisible"
|
|
||||||
android:background="@color/white"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/white_darker"
|
|
||||||
android:id="@+id/errorBack" app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent" android:contentDescription="@string/todo"/>
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:inputType="textPersonName"
|
|
||||||
android:text="@string/errorTiyle"
|
|
||||||
android:textColor="@color/text_color_v1"
|
|
||||||
android:ems="10"
|
|
||||||
android:id="@+id/editText"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="74dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent" tools:ignore="TextViewEdits"/>
|
|
||||||
<Button
|
|
||||||
android:text="@string/reload"
|
|
||||||
android:onClick="onReloadButtonPressed"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/reloadButton"
|
|
||||||
android:background="@xml/reload_default_state"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
android:radius="1dp"
|
|
||||||
android:bottomRightRadius="10dp"
|
|
||||||
android:bottomLeftRadius="10dp"
|
|
||||||
android:topLeftRadius="10dp"
|
|
||||||
android:topRightRadius="10dp"
|
|
||||||
android:layout_marginBottom="36dp" app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0.498" app:layout_constraintEnd_toEndOf="parent"/>
|
|
||||||
<TextView
|
|
||||||
android:text="@string/internetErrorMessage"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/textView"
|
|
||||||
android:textColor="@color/text_color_v1"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="120dp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginEnd="10dp" app:layout_constraintEnd_toEndOf="parent"/>
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="0dp" app:srcCompat="@drawable/icon_interneticon"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/reloadButton" android:layout_marginBottom="35dp"
|
|
||||||
android:layout_marginTop="35dp" android:contentDescription="@string/todo"/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="71dp"
|
android:layout_height="71dp"
|
||||||
|
@ -111,145 +37,240 @@
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="65dp"
|
|
||||||
android:id="@+id/topbar"
|
android:id="@+id/topbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:elevation="7dp"
|
||||||
|
android:background="@xml/ic_secondary_gradinet"
|
||||||
|
android:gravity="left"
|
||||||
|
android:paddingBottom="1dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="#00000000"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:gravity="left" app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:ignore="RtlHardcoded,UselessParent">
|
tools:ignore="RtlHardcoded,UselessParent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="56dp"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:elevation="7dp"
|
android:elevation="7dp"
|
||||||
android:background="@xml/floating_button_border"
|
android:gravity="left"
|
||||||
android:gravity="left" app:layout_constraintTop_toTopOf="parent"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:ignore="RtlHardcoded,UselessParent">
|
tools:ignore="RtlHardcoded,UselessParent">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:layout_width="30dp"
|
android:id="@+id/switchEngine"
|
||||||
android:layout_height="30dp"
|
android:layout_width="39dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_height="39dp"
|
||||||
android:layout_marginTop="14dp"
|
android:layout_marginStart="9dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
android:layout_marginBottom="0dp"
|
android:layout_marginBottom="0dp"
|
||||||
android:id="@+id/home"
|
|
||||||
android:onClick="onHomeButtonPressed"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:tint="@color/black"
|
|
||||||
android:src="@drawable/icon_homeicon"
|
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:contentDescription="@string/todo"/>
|
android:contentDescription="@string/todo"
|
||||||
|
android:onClick="onSwitchSearch"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/google_logo" />
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/search"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:textSize="16sp"
|
android:layout_marginStart="5dp"
|
||||||
android:textColor="@color/text_color_v2"
|
android:layout_marginTop="8dp"
|
||||||
android:selectAllOnFocus="true"
|
android:layout_marginEnd="0dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@xml/sc_generic_input"
|
||||||
|
android:completionHintView="@layout/hint_view"
|
||||||
|
android:ems="10"
|
||||||
|
android:popupElevation="5dp"
|
||||||
|
android:hint="@string/SearchHintMain"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
|
android:importantForAutofill="no"
|
||||||
|
android:maxLines="1"
|
||||||
android:paddingLeft="12dp"
|
android:paddingLeft="12dp"
|
||||||
android:paddingRight="15dp"
|
android:paddingRight="15dp"
|
||||||
android:textColorHighlight="@color/text_color_highlight_v1"
|
android:selectAllOnFocus="true"
|
||||||
android:background="@xml/search_back_default"
|
|
||||||
android:textCursorDrawable="@xml/search_cursor_state"
|
|
||||||
android:hint="@string/SearchHintMain"
|
|
||||||
android:text="@string/homeUrl"
|
android:text="@string/homeUrl"
|
||||||
android:ems="10"
|
android:textColor="@color/text_color_v2"
|
||||||
android:layout_marginTop="8dp"
|
android:textColorHighlight="@color/text_color_highlight_v1"
|
||||||
android:dropDownHeight="220dp"
|
android:textCursorDrawable="@xml/sc_search_cursor_state"
|
||||||
android:inputType="textNoSuggestions"
|
android:textSize="16sp"
|
||||||
android:layout_marginBottom="8dp"
|
tools:targetApi="o" />
|
||||||
android:completionHintView="@layout/hint_view"
|
|
||||||
android:layout_marginEnd="0dp"
|
<Button
|
||||||
android:dropDownSelector="@xml/rouned_corner"
|
android:id="@+id/newButtonInvoke"
|
||||||
|
android:layout_width="22dp"
|
||||||
|
android:layout_height="22dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:maxLines="1"
|
android:layout_marginTop="8dp"
|
||||||
android:id="@+id/search" android:layout_weight="1" android:importantForAutofill="no"
|
android:text="@string/home_tab_text"
|
||||||
tools:targetApi="o"/>
|
android:textSize="12.5sp"
|
||||||
|
android:layout_marginBottom="0dp"
|
||||||
|
android:background="@xml/sc_generic_tab_button"
|
||||||
|
android:contentDescription="@string/todo"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:onClick="onOpenTabView"
|
||||||
|
android:tint="@color/black" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:layout_width="30dp"
|
android:id="@+id/menu"
|
||||||
|
android:layout_width="32dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp"
|
||||||
android:layout_marginStart="0dp"
|
|
||||||
android:paddingBottom="19dp"
|
|
||||||
android:paddingTop="19dp"
|
|
||||||
android:paddingLeft="8dp"
|
|
||||||
android:paddingRight="8dp"
|
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:id="@+id/menu"
|
android:background="@xml/sc_menu_button"
|
||||||
|
android:contentDescription="@string/todo"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingTop="19dp"
|
||||||
|
android:onClick="onOpenMenuItem"
|
||||||
|
android:paddingRight="8dp"
|
||||||
|
android:paddingBottom="19dp"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@drawable/menu_item"
|
android:src="@drawable/menu_item" />
|
||||||
android:onClick="onMenuButtonPressed"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:contentDescription="@string/todo"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<ProgressBar
|
<com.darkweb.genesissearchengine.widget.AnimatedProgressBar
|
||||||
style="@android:style/Widget.Holo.Light.ProgressBar.Horizontal"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="112dp"
|
|
||||||
android:progressBackgroundTint="@color/white"
|
|
||||||
android:id="@+id/progressBar"
|
android:id="@+id/progressBar"
|
||||||
android:alpha="0"
|
style="@style/Base.Widget.AppCompat.ProgressBar.Horizontal"
|
||||||
android:scaleY="0.7"
|
|
||||||
android:progressTint="@color/progress_tint"
|
|
||||||
android:progress="50" app:layout_constraintTop_toTopOf="parent"
|
|
||||||
/>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:background="@color/ease_blue"
|
android:layout_height="4dp"
|
||||||
|
android:alpha="0"
|
||||||
|
android:progressDrawable="@xml/sc_photon_progress"
|
||||||
|
app:shiftDuration="@integer/progress_shift_duration"
|
||||||
|
app:wrapShiftDrawable="true"
|
||||||
|
android:layout_marginTop="53.5dp"
|
||||||
|
android:progress="50"
|
||||||
|
android:max="10000"
|
||||||
|
android:scaleY="0.7"
|
||||||
|
tools:progress="0"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/splashScreen"
|
android:id="@+id/splashScreen"
|
||||||
android:layout_height="match_parent">
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/ease_blue"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/backsplash"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/backsplash"
|
android:background="@xml/sc_splash_gradient"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:background="@xml/splash_gradient" app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:contentDescription="@string/todo" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/Connect"
|
||||||
|
android:layout_width="110dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginStart="53dp"
|
||||||
|
android:background="@xml/sc_rounded_corner"
|
||||||
|
android:onClick="onStartApplication"
|
||||||
|
android:text="@string/home_connect"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/imageView_loading_back"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/gateway_splash"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_marginEnd="6dp"
|
||||||
|
android:layout_marginBottom="25dp"
|
||||||
|
android:elevation="2dp"
|
||||||
|
android:background="@xml/sc_rounded_corner"
|
||||||
|
android:onClick="onLoadProxy"
|
||||||
|
android:src="@xml/ic_gateway_splash"
|
||||||
|
android:tint="@color/black"
|
||||||
|
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/loadingText"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/Connect"
|
||||||
|
android:contentDescription="@string/todo" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:text="Loading Please Wait"
|
android:id="@+id/loadingText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:layout_marginBottom="37dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/home_loading"
|
||||||
|
android:textAlignment="center"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textFontWeight="5"
|
android:textFontWeight="5"
|
||||||
android:layout_width="match_parent"
|
android:visibility="invisible"
|
||||||
android:gravity="center"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:textAlignment="center"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:singleLine="true"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
android:ellipsize="end"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:layout_height="wrap_content" android:id="@+id/loadingText"
|
tools:ignore="UnusedAttribute" />
|
||||||
app:layout_constraintStart_toStartOf="parent" app:layout_constraintHorizontal_bias="0.5"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
android:layout_marginBottom="37dp" android:layout_marginStart="50dp"
|
|
||||||
android:layout_marginEnd="50dp"/>
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/imageView_loading_back"
|
||||||
android:layout_width="35dp"
|
android:layout_width="35dp"
|
||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
app:srcCompat="@drawable/icon_loading"
|
android:layout_marginBottom="25dp"
|
||||||
android:id="@+id/imageView_loading_back"
|
android:visibility="invisible"
|
||||||
app:layout_constraintStart_toEndOf="@+id/backsplash"
|
app:layout_constraintBottom_toTopOf="@+id/loadingText"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/backsplash"
|
app:layout_constraintEnd_toStartOf="@+id/backsplash"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/loadingText" android:layout_marginBottom="25dp"/>
|
app:layout_constraintStart_toEndOf="@+id/backsplash"
|
||||||
|
app:srcCompat="@drawable/icon_loading"
|
||||||
|
android:contentDescription="@string/todo" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:src="@drawable/icon_ban"
|
android:src="@drawable/icon_ban"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:alpha="0"
|
android:alpha="0"
|
||||||
android:onClick="onFloatingButtonPressed"
|
|
||||||
app:borderWidth="0dp"
|
app:borderWidth="0dp"
|
||||||
app:elevation="10dp"
|
app:elevation="10dp"
|
||||||
android:backgroundTint="@color/white"
|
android:backgroundTint="@color/white"
|
||||||
android:clickable="true" app:srcCompat="?attr/actionModeSelectAllDrawable"
|
android:clickable="true" app:srcCompat="?attr/actionModeSelectAllDrawable"
|
||||||
android:id="@+id/floatingActionButton3" app:layout_constraintBottom_toBottomOf="parent"
|
android:id="@+id/floatingActionButton3" app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent" android:layout_marginBottom="24dp"
|
app:layout_constraintEnd_toEndOf="parent" android:layout_marginBottom="24dp"
|
||||||
android:layout_marginEnd="24dp"/>
|
android:layout_marginEnd="24dp"
|
||||||
|
android:focusable="true" />
|
||||||
|
|
||||||
|
<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/adView"
|
||||||
|
android:layout_width="395dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="56dp"
|
||||||
|
android:alpha="0"
|
||||||
|
ads:adSize="SMART_BANNER"
|
||||||
|
ads:adUnitId="ca-app-pub-5074525529134731/7816565677"
|
||||||
|
ads:layout_constraintEnd_toEndOf="parent"
|
||||||
|
ads:layout_constraintHorizontal_bias="0.5"
|
||||||
|
ads:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:elevation="10dp"
|
||||||
|
ads:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|