mirror of https://github.com/LeOS-GSI/LeOS-Genesis
Bug Fixes
parent
31192667e5
commit
19f96483f2
|
@ -11,7 +11,15 @@
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/Application" />
|
||||||
|
<option value="$PROJECT_DIR$/afservice" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
<option value="$PROJECT_DIR$/autofillLib" />
|
||||||
|
<option value="$PROJECT_DIR$/autofillManager" />
|
||||||
|
<option value="$PROJECT_DIR$/autofillServer" />
|
||||||
|
<option value="$PROJECT_DIR$/autofillService" />
|
||||||
|
<option value="$PROJECT_DIR$/autofillServices" />
|
||||||
|
<option value="$PROJECT_DIR$/chromiumTabs" />
|
||||||
<option value="$PROJECT_DIR$/orbotservice" />
|
<option value="$PROJECT_DIR$/orbotservice" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
|
|
|
@ -1,8 +1,21 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
<component name="InspectionProjectProfileManager">
|
||||||
<profile version="1.0">
|
<profile version="1.0">
|
||||||
<option name="myName" value="Project Default" />
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="AndroidLintPxUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="AndroidLintSuspiciousImport" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="BusyWait" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="EmptyStatementBody" enabled="false" level="WARNING" enabled_by_default="false">
|
||||||
|
<option name="m_reportEmptyBlocks" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
<inspection_tool class="FieldCanBeLocal" enabled="false" level="WARNING" enabled_by_default="false" />
|
<inspection_tool class="FieldCanBeLocal" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
<inspection_tool class="FieldMayBeFinal" enabled="false" level="WARNING" enabled_by_default="false" />
|
<inspection_tool class="FieldMayBeFinal" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="IfStatementWithIdenticalBranches" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="IgnoreResultOfCall" enabled="false" level="WARNING" enabled_by_default="false">
|
||||||
|
<option name="m_reportAllNonLibraryCalls" value="false" />
|
||||||
|
<option name="callCheckString" value="java.io.File,.*,java.io.InputStream,read|skip|available|markSupported,java.io.Reader,read|skip|ready|markSupported,java.lang.Boolean,.*,java.lang.Byte,.*,java.lang.Character,.*,java.lang.Double,.*,java.lang.Float,.*,java.lang.Integer,.*,java.lang.Long,.*,java.lang.Math,.*,java.lang.Object,equals|hashCode|toString,java.lang.Short,.*,java.lang.StrictMath,.*,java.lang.String,.*,java.lang.Thread,interrupted,java.math.BigInteger,.*,java.math.BigDecimal,.*,java.net.InetAddress,.*,java.net.URI,.*,java.util.Arrays,.*,java.util.List,of,java.util.Set,of,java.util.Map,of|ofEntries|entry,java.util.Collections,(?!addAll).*,java.util.UUID,.*,java.util.regex.Matcher,pattern|toMatchResult|start|end|group|groupCount|matches|find|lookingAt|quoteReplacement|replaceAll|replaceFirst|regionStart|regionEnd|hasTransparentBounds|hasAnchoringBounds|hitEnd|requireEnd,java.util.regex.Pattern,.*,java.util.stream.BaseStream,.*" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="InfiniteLoopStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
<inspection_tool class="InnerClassMayBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
|
<inspection_tool class="InnerClassMayBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
<inspection_tool class="SameParameterValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
<inspection_tool class="SameParameterValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||||
|
@ -13,5 +26,6 @@
|
||||||
<inspection_tool class="SuspiciousListRemoveInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
|
<inspection_tool class="SuspiciousListRemoveInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
<inspection_tool class="TrivialIf" enabled="false" level="WARNING" enabled_by_default="false" />
|
<inspection_tool class="TrivialIf" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
<inspection_tool class="UNCHECKED_WARNING" enabled="false" level="WARNING" enabled_by_default="false" />
|
<inspection_tool class="UNCHECKED_WARNING" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="UnusedReturnValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
|
@ -21,11 +21,12 @@ repositories {
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion project.ext.compileSdkVersion
|
compileSdkVersion project.ext.compileSdkVersion
|
||||||
|
ndkVersion "21.3.6528147"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId project.ext.applicationId
|
applicationId project.ext.applicationId
|
||||||
minSdkVersion project.ext.minSdkVersion
|
minSdkVersion project.ext.minSdkVersion
|
||||||
// targetSdkVersion project.ext.targetSdkVersion
|
targetSdkVersion project.ext.targetSdkVersion
|
||||||
versionCode project.ext.versionCode
|
versionCode project.ext.versionCode
|
||||||
versionName project.ext.versionName
|
versionName project.ext.versionName
|
||||||
}
|
}
|
||||||
|
@ -74,8 +75,10 @@ android {
|
||||||
res.srcDirs =
|
res.srcDirs =
|
||||||
[
|
[
|
||||||
'src/main/res/layouts/history',
|
'src/main/res/layouts/history',
|
||||||
|
'src/main/res/layouts/tab',
|
||||||
'src/main/res/layouts/language',
|
'src/main/res/layouts/language',
|
||||||
'src/main/res/layouts/orbot',
|
'src/main/res/layouts/orbot',
|
||||||
|
'src/main/res/layouts/orbotLog',
|
||||||
'src/main/res/layouts/setting',
|
'src/main/res/layouts/setting',
|
||||||
'src/main/res/layouts/bridge',
|
'src/main/res/layouts/bridge',
|
||||||
'src/main/res/layouts/alert',
|
'src/main/res/layouts/alert',
|
||||||
|
@ -84,6 +87,7 @@ android {
|
||||||
'src/main/res/layouts/shared/listviews',
|
'src/main/res/layouts/shared/listviews',
|
||||||
'src/main/res/layouts/other',
|
'src/main/res/layouts/other',
|
||||||
'src/main/res/custom-xml/alert',
|
'src/main/res/custom-xml/alert',
|
||||||
|
'src/main/res/custom-xml/tab',
|
||||||
'src/main/res/custom-xml/images',
|
'src/main/res/custom-xml/images',
|
||||||
'src/main/res/custom-xml/bookmark',
|
'src/main/res/custom-xml/bookmark',
|
||||||
'src/main/res/custom-xml/generic',
|
'src/main/res/custom-xml/generic',
|
||||||
|
@ -91,6 +95,7 @@ android {
|
||||||
'src/main/res/custom-xml/home',
|
'src/main/res/custom-xml/home',
|
||||||
'src/main/res/custom-xml/landing',
|
'src/main/res/custom-xml/landing',
|
||||||
'src/main/res/custom-xml/orbot',
|
'src/main/res/custom-xml/orbot',
|
||||||
|
'src/main/res/custom-xml/orbot_log',
|
||||||
'src/main/res/custom-xml/setting',
|
'src/main/res/custom-xml/setting',
|
||||||
'src/main/res/layouts',
|
'src/main/res/layouts',
|
||||||
'src/main/res/images',
|
'src/main/res/images',
|
||||||
|
@ -124,6 +129,7 @@ dependencies {
|
||||||
implementation 'androidx.preference:preference:1.1.1'
|
implementation 'androidx.preference:preference:1.1.1'
|
||||||
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
|
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||||
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
|
|
||||||
// Testing-only dependencies
|
// Testing-only dependencies
|
||||||
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0') {
|
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0') {
|
||||||
|
@ -149,7 +155,7 @@ dependencies {
|
||||||
implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'
|
implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'
|
||||||
|
|
||||||
/*Ads Manager*/
|
/*Ads Manager*/
|
||||||
implementation 'com.google.android.gms:play-services-ads:19.4.0'
|
implementation 'com.google.android.gms:play-services-ads:19.5.0'
|
||||||
|
|
||||||
|
|
||||||
/*Crashlytics*/
|
/*Crashlytics*/
|
||||||
|
@ -163,9 +169,11 @@ dependencies {
|
||||||
implementation project(path: ':orbotservice')
|
implementation project(path: ':orbotservice')
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.github.apl-devs:appintro:v4.2.2'
|
implementation 'com.github.apl-devs:appintro:v4.2.2'
|
||||||
|
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
|
||||||
|
|
||||||
/*Helper Libraries*/
|
/*Helper Libraries*/
|
||||||
implementation 'com.chauthai.overscroll:overscroll-bouncy:0.1.1'
|
implementation 'com.chauthai.overscroll:overscroll-bouncy:0.1.1'
|
||||||
|
androidTestImplementation "junit:junit:4.13.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
|
@ -28,58 +28,89 @@
|
||||||
<!-- Activities -->
|
<!-- Activities -->
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.orbotManager.orbotController"
|
android:name="com.darkweb.genesissearchengine.appManager.orbotManager.orbotController"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:launchMode="singleTop" />
|
android:launchMode="singleTop" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController"
|
android:name="com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:label="@string/SETTING_HEADER"
|
android:label="@string/SETTING_HEADER"
|
||||||
android:windowSoftInputMode="adjustNothing" />
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.historyManager.historyController"
|
android:name="com.darkweb.genesissearchengine.appManager.historyManager.historyController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:windowSoftInputMode="adjustNothing" />
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController"
|
android:name="com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:windowSoftInputMode="adjustNothing" />
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.languageManager.languageController"
|
android:name="com.darkweb.genesissearchengine.appManager.languageManager.languageController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:label="@string/SETTING_HEADER"
|
android:label="@string/SETTING_HEADER"
|
||||||
android:windowSoftInputMode="adjustNothing" />
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController"
|
android:name="com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
|
android:label="@string/SETTING_HEADER"
|
||||||
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
|
<activity
|
||||||
|
android:name="com.darkweb.genesissearchengine.appManager.settingManager.clearManager.settingClearController"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:label="@string/SETTING_HEADER"
|
android:label="@string/SETTING_HEADER"
|
||||||
android:windowSoftInputMode="adjustNothing" />
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController"
|
android:name="com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:windowSoftInputMode="adjustResize" />
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController"
|
android:name="com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:windowSoftInputMode="adjustResize" />
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.darkweb.genesissearchengine.appManager.settingManager.privacyManager.settingPrivacyController"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController"
|
||||||
|
android:configChanges="uiMode"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController"
|
||||||
|
android:configChanges="uiMode"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:windowSoftInputMode="adjustResize" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController"
|
android:name="com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:windowSoftInputMode="adjustResize" />
|
android:windowSoftInputMode="adjustResize" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.tabManager.tabController"
|
android:name="com.darkweb.genesissearchengine.appManager.tabManager.tabController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:windowSoftInputMode="adjustNothing" />
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.landingManager.landingController"
|
android:name="com.darkweb.genesissearchengine.appManager.landingManager.landingController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:windowSoftInputMode="adjustNothing" />
|
android:windowSoftInputMode="adjustNothing" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darkweb.genesissearchengine.appManager.homeManager.homeController"
|
android:name="com.darkweb.genesissearchengine.appManager.homeManager.homeController"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
|
@ -151,6 +182,15 @@
|
||||||
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
|
||||||
|
android:name="com.darkweb.genesissearchengine.helperManager.autoFillService"
|
||||||
|
android:label="Genesis | Secure Autofill"
|
||||||
|
android:permission="android.permission.BIND_AUTOFILL_SERVICE">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.service.autofill.AutofillService" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="com.darkweb.genesissearchengine.helperManager.downloadFileService"
|
android:name="com.darkweb.genesissearchengine.helperManager.downloadFileService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>
|
||||||
|
A Simple HTML Document
|
||||||
|
</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>This is a very simple HTML document</p>
|
||||||
|
<p>It only has two paragraphs</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -3,6 +3,8 @@ package com.darkweb.genesissearchengine.appManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
|
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
|
||||||
import com.darkweb.genesissearchengine.appManager.historyManager.historyController;
|
import com.darkweb.genesissearchengine.appManager.historyManager.historyController;
|
||||||
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
|
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController;
|
||||||
import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
|
import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
|
||||||
|
|
||||||
public class activityContextManager
|
public class activityContextManager
|
||||||
|
@ -16,11 +18,13 @@ public class activityContextManager
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Private Contexts*/
|
/*Private Contexts*/
|
||||||
private historyController history_controller;
|
private historyController pHistoryController;
|
||||||
private bookmarkController bookmark_controller;
|
private bookmarkController pBookmarkController;
|
||||||
private homeController home_controller;
|
private homeController pHomeController;
|
||||||
private tabController tab_controller;
|
private tabController pTabController;
|
||||||
private android.app.Activity sCurrentActivity = null;
|
private android.app.Activity pCurrentActivity = null;
|
||||||
|
private settingController pSettingController;
|
||||||
|
private orbotLogController pOrbotLogController;
|
||||||
|
|
||||||
/*Initialization*/
|
/*Initialization*/
|
||||||
|
|
||||||
|
@ -30,37 +34,51 @@ public class activityContextManager
|
||||||
|
|
||||||
/*List ContextGetterSetters*/
|
/*List ContextGetterSetters*/
|
||||||
public historyController getHistoryController(){
|
public historyController getHistoryController(){
|
||||||
return history_controller;
|
return pHistoryController;
|
||||||
}
|
}
|
||||||
public void setHistoryController(historyController history_controller){
|
public void setHistoryController(historyController history_controller){
|
||||||
this.history_controller = history_controller;
|
this.pHistoryController = history_controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bookmarkController getBookmarkController(){
|
public bookmarkController getBookmarkController(){
|
||||||
return bookmark_controller;
|
return pBookmarkController;
|
||||||
}
|
}
|
||||||
public void setBookmarkController(bookmarkController bookmark_controller){
|
public void setBookmarkController(bookmarkController bookmark_controller){
|
||||||
this.bookmark_controller = bookmark_controller;
|
this.pBookmarkController = bookmark_controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
public homeController getHomeController(){
|
public homeController getHomeController(){
|
||||||
return home_controller;
|
return pHomeController;
|
||||||
}
|
}
|
||||||
public void setHomeController(homeController home_controller){
|
public void setHomeController(homeController home_controller){
|
||||||
this.home_controller = home_controller;
|
this.pHomeController = home_controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
public tabController getTabController(){
|
public tabController getTabController(){
|
||||||
return tab_controller;
|
return pTabController;
|
||||||
}
|
}
|
||||||
public void setTabController(tabController tab_controller){
|
public void setTabController(tabController tab_controller){
|
||||||
this.tab_controller = tab_controller;
|
this.pTabController = tab_controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentActivity(android.app.Activity sCurrentActivity){
|
public orbotLogController getOrbotLogController(){
|
||||||
this.sCurrentActivity = sCurrentActivity;
|
return pOrbotLogController;
|
||||||
|
}
|
||||||
|
public void setOrbotLogController(orbotLogController pOrbotLogController){
|
||||||
|
this.pOrbotLogController = pOrbotLogController;
|
||||||
|
}
|
||||||
|
|
||||||
|
public settingController getSettingController(){
|
||||||
|
return pSettingController;
|
||||||
|
}
|
||||||
|
public void setSettingController(settingController pSettingController){
|
||||||
|
this.pSettingController = pSettingController;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentActivity(android.app.Activity pCurrentActivity){
|
||||||
|
this.pCurrentActivity = pCurrentActivity;
|
||||||
}
|
}
|
||||||
public android.app.Activity setCurrentActivity(){
|
public android.app.Activity setCurrentActivity(){
|
||||||
return sCurrentActivity;
|
return pCurrentActivity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
|
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
@ -28,6 +27,7 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.HISTORY_LOAD_MORE;
|
||||||
|
|
||||||
public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listViewHolder>
|
public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listViewHolder>
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
private ArrayList<Date> mLongSelectedDate = new ArrayList<>();
|
private ArrayList<Date> mLongSelectedDate = new ArrayList<>();
|
||||||
private ArrayList<String> mLongSelectedIndex = new ArrayList<>();
|
private ArrayList<String> mLongSelectedIndex = new ArrayList<>();
|
||||||
private ArrayList<Integer> mLongSelectedID = new ArrayList<>();
|
private ArrayList<Integer> mLongSelectedID = new ArrayList<>();
|
||||||
private ArrayList<View> mLongPressedViewHolders = new ArrayList<>();
|
|
||||||
|
|
||||||
private AppCompatActivity mContext;
|
private AppCompatActivity mContext;
|
||||||
private bookmarkAdapterView mHistroyAdapterView;
|
private bookmarkAdapterView mHistroyAdapterView;
|
||||||
|
@ -70,15 +69,14 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
|
|
||||||
private void onLoading(){
|
private void onLoading(){
|
||||||
mContext.runOnUiThread(() -> {
|
mContext.runOnUiThread(() -> {
|
||||||
mCurrentList.add(new bookmarkRowModel(null, "loading",-2));
|
mCurrentList.add(new bookmarkRowModel(HISTORY_LOAD_MORE,null,-2));
|
||||||
notifyItemInserted(mCurrentList.size());
|
notifyItemInserted(mCurrentList.size());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLoadingClear(){
|
private void onLoadingClear(){
|
||||||
|
|
||||||
for(int mCounter = 0; mCounter< mCurrentList.size(); mCounter++){
|
for(int mCounter = 0; mCounter< mCurrentList.size(); mCounter++){
|
||||||
if(mCurrentList.get(mCounter).getHeader().equals("loading")){
|
if(mCurrentList.get(mCounter).getHeader().equals(HISTORY_LOAD_MORE)){
|
||||||
int finalM_counter = mCounter;
|
int finalM_counter = mCounter;
|
||||||
mContext.runOnUiThread(() -> {
|
mContext.runOnUiThread(() -> {
|
||||||
mCurrentList.remove(finalM_counter);
|
mCurrentList.remove(finalM_counter);
|
||||||
|
@ -121,7 +119,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
|
|
||||||
if(diff==0){
|
if(diff==0){
|
||||||
if(m_date_state!=1){
|
if(m_date_state!=1){
|
||||||
this.mModelList.add(new bookmarkRowModel(null, "Today ",-1));
|
this.mModelList.add(new bookmarkRowModel("Today ",null,-1));
|
||||||
mRealID.add(m_real_counter);
|
mRealID.add(m_real_counter);
|
||||||
mRealIndex.add(m_real_counter);
|
mRealIndex.add(m_real_counter);
|
||||||
m_date_state = 1;
|
m_date_state = 1;
|
||||||
|
@ -130,14 +128,14 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
|
|
||||||
if(m_date_state!=2 || m_last_day!=(int)(Math.ceil(diff/7)*7)){
|
if(m_date_state!=2 || m_last_day!=(int)(Math.ceil(diff/7)*7)){
|
||||||
m_last_day = (int)(Math.ceil(diff/7)*7);
|
m_last_day = (int)(Math.ceil(diff/7)*7);
|
||||||
this.mModelList.add(new bookmarkRowModel(null, "Last " + m_last_day + " Days",-1));
|
this.mModelList.add(new bookmarkRowModel("Last " + m_last_day + " Days",null,-1));
|
||||||
mRealID.add(m_real_counter);
|
mRealID.add(m_real_counter);
|
||||||
mRealIndex.add(m_real_counter);
|
mRealIndex.add(m_real_counter);
|
||||||
m_date_state = 2;
|
m_date_state = 2;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(m_date_state!=3){
|
if(m_date_state!=3){
|
||||||
this.mModelList.add(new bookmarkRowModel(null, "Older ",-1));
|
this.mModelList.add(new bookmarkRowModel("Older ",null,-1));
|
||||||
mRealID.add(m_real_counter);
|
mRealID.add(m_real_counter);
|
||||||
mRealIndex.add(m_real_counter);
|
mRealIndex.add(m_real_counter);
|
||||||
m_date_state = 3;
|
m_date_state = 3;
|
||||||
|
@ -154,22 +152,21 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
|
|
||||||
/*Initializations*/
|
/*Initializations*/
|
||||||
|
|
||||||
private ArrayList<String> getLongSelectedURL(){
|
private ArrayList<String> getLongSelectedleURL(){
|
||||||
return mLongSelectedIndex;
|
return mLongSelectedIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDeleteSelected(){
|
public void onDeleteSelected(){
|
||||||
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
|
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
|
||||||
for(int m_counter_inner = 0; m_counter_inner< mCurrentList.size(); m_counter_inner++){
|
for(int m_counter_inner = 0; m_counter_inner< mCurrentList.size(); m_counter_inner++){
|
||||||
if(mCurrentList.get(m_counter_inner).getDate() == mLongSelectedDate.get(m_counter) && mLongSelectedIndex.get(m_counter).equals(mCurrentList.get(m_counter_inner).getDescription())){
|
if(mCurrentList.get(m_counter_inner).getDate() == mLongSelectedDate.get(m_counter) && mLongSelectedIndex.get(m_counter).equals("https://"+ mCurrentList.get(m_counter_inner).getDescription())){
|
||||||
mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(m_counter_inner)),enums.etype.url_clear);
|
mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(m_counter_inner)),enums.etype.url_clear);
|
||||||
mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)),enums.etype.url_clear_at);
|
mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)),enums.etype.url_clear_at);
|
||||||
invokeFilter(false);
|
invokeFilter(false);
|
||||||
mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.is_empty);
|
mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.is_empty);
|
||||||
|
|
||||||
boolean mDateVerify = false;
|
boolean mDateVerify = false;
|
||||||
initializeModelWithDate(false);
|
if(mCurrentList.size()>0 && mCurrentList.get(m_counter_inner-1).getDescription()==null && (mCurrentList.size()>m_counter_inner+1 && mCurrentList.get(m_counter_inner+1).getDescription()==null || mCurrentList.size()==m_counter_inner+1)){
|
||||||
if(mCurrentList.size()>0 && mCurrentList.get(m_counter_inner-1).getHeader()==null && (mCurrentList.size()>m_counter_inner+1 && mCurrentList.get(m_counter_inner+1).getHeader()==null || mCurrentList.size()==m_counter_inner+1)){
|
|
||||||
mDateVerify = true;
|
mDateVerify = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,18 +194,10 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearLongSelectedURL(){
|
private void clearLongSelectedURL(){
|
||||||
|
|
||||||
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
|
|
||||||
|
|
||||||
View m_item_view = mLongPressedViewHolders.get(m_counter);
|
|
||||||
ImageButton m_popup_menu = m_item_view.findViewById(R.id.pRowMenu);
|
|
||||||
ImageView p_logo_image = m_item_view.findViewById(R.id.pLogoImage);
|
|
||||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW, Arrays.asList(m_popup_menu, p_logo_image, m_item_view));
|
|
||||||
}
|
|
||||||
mLongSelectedDate.clear();
|
mLongSelectedDate.clear();
|
||||||
mLongSelectedIndex.clear();
|
mLongSelectedIndex.clear();
|
||||||
mLongSelectedID.clear();
|
mLongSelectedID.clear();
|
||||||
mLongPressedViewHolders.clear();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSelectedURL(){
|
private String getSelectedURL(){
|
||||||
|
@ -247,7 +236,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
mSearchEnabled = p_is_searched;
|
mSearchEnabled = p_is_searched;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSelectView(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){
|
public void onSelectView(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){
|
||||||
if(!mSearchEnabled){
|
if(!mSearchEnabled){
|
||||||
try {
|
try {
|
||||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced, true));
|
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced, true));
|
||||||
|
@ -261,7 +250,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
mLongSelectedDate.add(pDate);
|
mLongSelectedDate.add(pDate);
|
||||||
mLongSelectedIndex.add(pUrl);
|
mLongSelectedIndex.add(pUrl);
|
||||||
mLongSelectedID.add(pId);
|
mLongSelectedID.add(pId);
|
||||||
mLongPressedViewHolders.add(pItem);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
onVerifyLongSelectedURL();
|
onVerifyLongSelectedURL();
|
||||||
|
@ -276,14 +264,13 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClearHighlight(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate)
|
public void onClearHighlight(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced));
|
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced));
|
||||||
mLongSelectedDate.remove(pDate);
|
mLongSelectedDate.remove(pDate);
|
||||||
mLongSelectedIndex.remove(pUrl);
|
mLongSelectedIndex.remove(pUrl);
|
||||||
mLongSelectedID.remove((Integer) pId);
|
mLongSelectedID.remove((Integer) pId);
|
||||||
mLongPressedViewHolders.remove(pItem);
|
|
||||||
if(mLongSelectedID.size()==0){
|
if(mLongSelectedID.size()==0){
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
@ -295,7 +282,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
|
|
||||||
private float mPointerPosition = 0;
|
private float mPointerPosition = 0;
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
public void onSwipe(View pItem, View pItemView, int pPosition, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){
|
public void onSwipe(View pItemView, int pPosition, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){
|
||||||
|
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
|
|
||||||
|
@ -303,9 +290,10 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
if(!mDisableCallable && Math.abs(mRecyclerPositionX1-mPointerPosition) <= 20){
|
if(!mDisableCallable && Math.abs(mRecyclerPositionX1-mPointerPosition) <= 20){
|
||||||
if(!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
|
if(!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
|
||||||
mLongPressedMenuActive = true;
|
mLongPressedMenuActive = true;
|
||||||
onSelectView(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
onSelectView(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
||||||
}else {
|
}else {
|
||||||
onClearHighlight(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
Log.i("I AM HERE 22","I AM HERE");
|
||||||
|
onClearHighlight(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
||||||
mLongPressedMenuActive = true;
|
mLongPressedMenuActive = true;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
|
@ -314,76 +302,78 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pItemView.setOnTouchListener((v, event) -> {
|
pItemView.setOnTouchListener((v, event) -> {
|
||||||
|
|
||||||
if (mRecyclerPositionX1!=0 && Math.abs(event.getX() - mRecyclerPositionX1) > 400 && !mLongPressedMenuActive) {
|
if (mRecyclerPositionX1!=0 && Math.abs(event.getX() - mRecyclerPositionX1) > 400 && !mLongPressedMenuActive) {
|
||||||
v.setPressed(false);
|
v.setPressed(false);
|
||||||
pItemView.clearFocus();
|
pItemView.clearFocus();
|
||||||
handler.removeCallbacks(mLongPressed);
|
handler.removeCallbacks(mLongPressed);
|
||||||
pItemView.setOnTouchListener(null);
|
pItemView.setOnTouchListener(null);
|
||||||
pItemView.clearFocus();
|
pItemView.clearFocus();
|
||||||
if(mPassedList.size()<=1){
|
if(mPassedList.size()<=1){
|
||||||
mPassedList.clear();
|
mPassedList.clear();
|
||||||
initializeModelWithDate(false);
|
initializeModelWithDate(false);
|
||||||
notifyItemRemoved(0);
|
notifyItemRemoved(0);
|
||||||
notifyItemRangeChanged(0, 1);
|
notifyItemRangeChanged(0, 1);
|
||||||
mEvent.invokeObserver(Collections.singletonList(0),enums.etype.is_empty);
|
mEvent.invokeObserver(Collections.singletonList(0),enums.etype.is_empty);
|
||||||
}else {
|
}else {
|
||||||
bookmarkAdapter.this.onClose(pPosition);
|
initializeModelWithDate(false);
|
||||||
}
|
bookmarkAdapter.this.onClose(pPosition);
|
||||||
return true;
|
}
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
mPointerPosition = event.getX();
|
mPointerPosition = event.getX();
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
mRecyclerPositionX2 = event.getX();
|
mRecyclerPositionX2 = event.getX();
|
||||||
float deltaX = mRecyclerPositionX2 - mRecyclerPositionX1;
|
float deltaX = mRecyclerPositionX2 - mRecyclerPositionX1;
|
||||||
|
|
||||||
if (mLongSelectedIndex.size() > 0) {
|
Log.i("FCK2","FCK2 : " + mLongSelectedIndex.size());
|
||||||
if (Math.abs(deltaX) <= 20 && !mLongPressedMenuActive) {
|
if (mLongSelectedIndex.size() > 0) {
|
||||||
if (mLongSelectedIndex.contains(pUrl) && mLongSelectedID.contains(pId)) {
|
if (Math.abs(deltaX) <= 20 && !mLongPressedMenuActive) {
|
||||||
handler.removeCallbacks(mLongPressed);
|
if (mLongSelectedIndex.contains(pUrl) && mLongSelectedID.contains(pId)) {
|
||||||
bookmarkAdapter.this.onClearHighlight(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
handler.removeCallbacks(mLongPressed);
|
||||||
} else{
|
bookmarkAdapter.this.onClearHighlight(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
||||||
handler.removeCallbacks(mLongPressed);
|
} else{
|
||||||
bookmarkAdapter.this.onSelectView(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
handler.removeCallbacks(mLongPressed);
|
||||||
}
|
bookmarkAdapter.this.onSelectView(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (Math.abs(deltaX) > 100) {
|
if (Math.abs(deltaX) > 100) {
|
||||||
v.setPressed(false);
|
v.setPressed(false);
|
||||||
handler.removeCallbacks(mLongPressed);
|
handler.removeCallbacks(mLongPressed);
|
||||||
bookmarkAdapter.this.onClose(pPosition);
|
bookmarkAdapter.this.onClose(pPosition);
|
||||||
} else {
|
} else {
|
||||||
v.setPressed(false);
|
v.setPressed(false);
|
||||||
handler.removeCallbacks(mLongPressed);
|
handler.removeCallbacks(mLongPressed);
|
||||||
mEvent.invokeObserver(Collections.singletonList(pUrl), enums.etype.url_triggered);
|
mEvent.invokeObserver(Collections.singletonList(pUrl), enums.etype.url_triggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
} else if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
mDisableCallable = false;
|
mDisableCallable = false;
|
||||||
mLongPressedMenuActive = false;
|
mLongPressedMenuActive = false;
|
||||||
v.setPressed(true);
|
v.setPressed(true);
|
||||||
mRecyclerPositionX1 = event.getX();
|
mRecyclerPositionX1 = event.getX();
|
||||||
Log.i("1WOW : ","WOW : " + event.getX() + " -- " + mRecyclerPositionX1);
|
Log.i("1WOW : ","WOW : " + event.getX() + " -- " + mRecyclerPositionX1);
|
||||||
handler.postDelayed(mLongPressed, ViewConfiguration.getLongPressTimeout());
|
handler.postDelayed(mLongPressed, ViewConfiguration.getLongPressTimeout());
|
||||||
return true;
|
return true;
|
||||||
} else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
|
} else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||||
handler.removeCallbacks(mLongPressed);
|
handler.removeCallbacks(mLongPressed);
|
||||||
mDisableCallable = true;
|
mDisableCallable = true;
|
||||||
if (!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
|
if (!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
|
||||||
v.setPressed(false);
|
v.setPressed(false);
|
||||||
}
|
}
|
||||||
handler.removeCallbacks(mLongPressed);
|
handler.removeCallbacks(mLongPressed);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void onOpenMenu(View pView, String pUrl, int pPosition, String pTitle){
|
void onOpenMenu(View pView, String pUrl, int pPosition, String pTitle){
|
||||||
|
@ -417,61 +407,62 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
mPopupWindow.dismiss();
|
mPopupWindow.dismiss();
|
||||||
}
|
}
|
||||||
else if(v.getId() == R.id.pMenuDelete){
|
else if(v.getId() == R.id.pMenuDelete){
|
||||||
|
initializeModelWithDate(false);
|
||||||
onClose(pPosition);
|
onClose(pPosition);
|
||||||
mPopupWindow.dismiss();
|
mPopupWindow.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setItemViewOnClickListener(View pItem, View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate)
|
private void setItemViewOnClickListener(View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate)
|
||||||
{
|
{
|
||||||
pItemMenu.setOnClickListener((View v) -> onOpenMenu(v, pUrl, pPosition, pTitle));
|
pItemMenu.setOnClickListener((View v) -> onOpenMenu(v, pUrl, pPosition, pTitle));
|
||||||
onSwipe(pItem, pItemView, pPosition, pUrl,pMenuItem, pLogoImage, pId, pDate);
|
onSwipe(pItemView, pPosition, pUrl,pMenuItem, pLogoImage, pId, pDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onClose(int pIndex){
|
private void onClose(int pIndex){
|
||||||
mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(pIndex)),enums.etype.url_clear);
|
mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(pIndex)),enums.etype.url_clear);
|
||||||
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.url_clear_at);
|
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.url_clear_at);
|
||||||
invokeFilter(false);
|
invokeFilter(false);
|
||||||
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.is_empty);
|
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.is_empty);
|
||||||
boolean mDateVerify = false;
|
boolean mDateVerify = false;
|
||||||
if(mPassedList.size()>0){
|
if(mPassedList.size()>0){
|
||||||
if(mCurrentList.size()>0 && mCurrentList.get(pIndex-1).getHeader()==null && (mCurrentList.size()>pIndex+1 && mCurrentList.get(pIndex+1).getHeader()==null || mCurrentList.size()==pIndex+1)){
|
if(mCurrentList.size()>0 && mCurrentList.get(pIndex-1).getDescription()==null && (mCurrentList.size()>pIndex+1 && mCurrentList.get(pIndex+1).getDescription()==null || mCurrentList.size()==pIndex+1)){
|
||||||
mDateVerify = true;
|
mDateVerify = true;
|
||||||
}
|
|
||||||
}else {
|
|
||||||
mCurrentList.clear();
|
|
||||||
notifyDataSetChanged();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
int size = mCurrentList.size();
|
}else {
|
||||||
|
mCurrentList.clear();
|
||||||
|
notifyDataSetChanged();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int size = mCurrentList.size();
|
||||||
|
|
||||||
if(mDateVerify){
|
if(mDateVerify){
|
||||||
notifyItemRemoved(pIndex-1);
|
notifyItemRemoved(pIndex-1);
|
||||||
mCurrentList.remove(pIndex-1);
|
mCurrentList.remove(pIndex-1);
|
||||||
notifyItemRemoved(pIndex-1);
|
notifyItemRemoved(pIndex-1);
|
||||||
mCurrentList.remove(pIndex-1);
|
mCurrentList.remove(pIndex-1);
|
||||||
notifyItemRangeChanged(pIndex-1, mCurrentList.size());
|
notifyItemRangeChanged(pIndex-1, mCurrentList.size());
|
||||||
}else {
|
}else {
|
||||||
notifyItemRemoved(pIndex);
|
notifyItemRemoved(pIndex);
|
||||||
mCurrentList.remove(pIndex);
|
mCurrentList.remove(pIndex);
|
||||||
notifyItemRangeChanged(pIndex, mCurrentList.size());
|
notifyItemRangeChanged(pIndex, mCurrentList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(size>1){
|
if(size>1){
|
||||||
new Thread(){
|
new Thread(){
|
||||||
public void run(){
|
public void run(){
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sleep(500);
|
sleep(500);
|
||||||
}
|
|
||||||
catch (InterruptedException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}.start();
|
catch (InterruptedException e)
|
||||||
}
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*View Holder Extensions*/
|
/*View Holder Extensions*/
|
||||||
|
@ -504,18 +495,20 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
|
|
||||||
|
|
||||||
if(model.getID() == -1){
|
if(model.getID() == -1){
|
||||||
mDate.setText(model.getDescription());
|
mDate.setText(model.getHeader());
|
||||||
mDateContainer.setVisibility(View.VISIBLE);
|
mDateContainer.setVisibility(View.VISIBLE);
|
||||||
mRowContainer.setVisibility(View.GONE);
|
mRowContainer.setVisibility(View.GONE);
|
||||||
mRowMenu.setVisibility(View.GONE);
|
mRowMenu.setVisibility(View.INVISIBLE);
|
||||||
|
mRowMenu.setClickable(false);
|
||||||
mWebLogo.setVisibility(View.GONE);
|
mWebLogo.setVisibility(View.GONE);
|
||||||
mLoadingContainer.setVisibility(View.GONE);
|
mLoadingContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
else if(model.getID() == -2){
|
else if(model.getID() == -2){
|
||||||
mDate.setText(model.getDescription());
|
mDate.setText(model.getHeader());
|
||||||
mDateContainer.setVisibility(View.GONE);
|
mDateContainer.setVisibility(View.GONE);
|
||||||
mRowContainer.setVisibility(View.GONE);
|
mRowContainer.setVisibility(View.GONE);
|
||||||
mRowMenu.setVisibility(View.GONE);
|
mRowMenu.setVisibility(View.INVISIBLE);
|
||||||
|
mRowMenu.setClickable(false);
|
||||||
mWebLogo.setVisibility(View.GONE);
|
mWebLogo.setVisibility(View.GONE);
|
||||||
mLoadingContainer.setVisibility(View.VISIBLE);
|
mLoadingContainer.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -524,24 +517,26 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
mLoadingContainer.setVisibility(View.GONE);
|
mLoadingContainer.setVisibility(View.GONE);
|
||||||
mRowContainer.setVisibility(View.VISIBLE);
|
mRowContainer.setVisibility(View.VISIBLE);
|
||||||
mRowMenu.setVisibility(View.VISIBLE);
|
mRowMenu.setVisibility(View.VISIBLE);
|
||||||
|
mRowMenu.setClickable(true);
|
||||||
mWebLogo.setVisibility(View.VISIBLE);
|
mWebLogo.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0)+""));
|
||||||
mWebLogo.setText((helperMethod.getDomainName(model.getDescription()).toUpperCase().charAt(0)+""));
|
|
||||||
String header = model.getHeader();
|
String header = model.getHeader();
|
||||||
mDescription.setText((model.getDescription()));
|
mDescription.setText(("https://"+model.getDescription()));
|
||||||
mHeader.setText(model.getHeader());
|
mHeader.setText(model.getHeader());
|
||||||
|
|
||||||
setItemViewOnClickListener(itemView, mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate());
|
setItemViewOnClickListener(mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mLongSelectedID.size()>0){
|
if(mLongSelectedID.size()>0){
|
||||||
mRowMenu.setVisibility(View.GONE);
|
mRowMenu.setVisibility(View.INVISIBLE);
|
||||||
|
mRowMenu.setClickable(false);
|
||||||
}else {
|
}else {
|
||||||
mRowMenu.setVisibility(View.VISIBLE);
|
mRowMenu.setVisibility(View.VISIBLE);
|
||||||
|
mRowMenu.setClickable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mLongSelectedIndex.contains(model.getDescription()) && mLongSelectedID.contains(model.getID())){
|
if(mLongSelectedIndex.contains("https://" + model.getDescription()) && mLongSelectedID.contains(model.getID())){
|
||||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false));
|
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false));
|
||||||
}else if(mLogoImage.getAlpha()>0){
|
}else if(mLogoImage.getAlpha()>0){
|
||||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false));
|
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false));
|
||||||
|
@ -562,7 +557,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
}
|
}
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLongPressMenuActive(){
|
public boolean isLongPressMenuActive(){
|
||||||
return mLongSelectedIndex.size()>0;
|
return mLongSelectedIndex.size()>0;
|
||||||
|
@ -582,7 +577,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
|
||||||
clearLongSelectedURL();
|
clearLongSelectedURL();
|
||||||
}
|
}
|
||||||
else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_URL){
|
else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_URL){
|
||||||
return getLongSelectedURL();
|
return getLongSelectedleURL();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.widget.ImageView;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
|
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -18,7 +18,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
||||||
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
|
|
||||||
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
|
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
|
@ -37,7 +36,7 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU;
|
import static com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU;
|
||||||
|
|
||||||
|
|
||||||
public class bookmarkController extends AppCompatActivity
|
public class bookmarkController extends AppCompatActivity
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.historyManager;
|
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
|
||||||
|
|
||||||
public class bookmarkEnums
|
public class bookmarkEnums
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,10 +12,11 @@ import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
|
@ -57,24 +58,26 @@ class bookmarkViewController
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateIfListEmpty(int pSize,int pDuration){
|
private void updateIfListEmpty(int pSize,int pDuration){
|
||||||
if(pSize>0){
|
if(pSize>0){
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
|
||||||
mEmptyListNotification.animate().setDuration(pDuration).alpha(0f);
|
mEmptyListNotification.animate().setDuration(pDuration).alpha(0f);
|
||||||
mClearButton.setText(strings.BOOKMARK_CLEAR_BOOKMARK);
|
mClearButton.setText(strings.BOOKMARK_CLEAR_BOOKMARK);
|
||||||
mClearButton.setClickable(true);
|
mClearButton.setClickable(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
mEmptyListNotification.animate().setDuration(pDuration).alpha(1f);
|
mEmptyListNotification.animate().setDuration(pDuration).alpha(1f);
|
||||||
|
|
||||||
mClearButton.animate().setDuration(pDuration).alpha(0.4f);
|
mClearButton.animate().setDuration(pDuration).alpha(0.4f);
|
||||||
|
@ -82,10 +85,13 @@ class bookmarkViewController
|
||||||
mMenuButton.animate().setDuration(pDuration).alpha(0f);
|
mMenuButton.animate().setDuration(pDuration).alpha(0f);
|
||||||
|
|
||||||
mClearButton.setEnabled(false);
|
mClearButton.setEnabled(false);
|
||||||
mClearButton.setClickable(false);
|
|
||||||
mSearchButton.setClickable(false);
|
mSearchButton.setClickable(false);
|
||||||
mMenuButton.setClickable(false);
|
mMenuButton.setClickable(false);
|
||||||
|
mSearchInput.setVisibility(View.GONE);
|
||||||
|
mClearButton.setAlpha(0f);
|
||||||
|
mClearButton.animate().setDuration(300).alpha(1);
|
||||||
|
|
||||||
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
mClearButton.setText(strings.BOOKMARK_NO_BOOKMARK_FOUND);
|
mClearButton.setText(strings.BOOKMARK_NO_BOOKMARK_FOUND);
|
||||||
mClearButton.setClickable(false);
|
mClearButton.setClickable(false);
|
||||||
}
|
}
|
||||||
|
@ -95,14 +101,15 @@ class bookmarkViewController
|
||||||
if(mPopupWindow !=null && mPopupWindow.isShowing()){
|
if(mPopupWindow !=null && mPopupWindow.isShowing()){
|
||||||
mPopupWindow.dismiss();
|
mPopupWindow.dismiss();
|
||||||
}
|
}
|
||||||
|
onSelectionMenu(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSelectionMenu(boolean pStatus){
|
private void onSelectionMenu(boolean pStatus){
|
||||||
if(!pStatus){
|
if(!pStatus){
|
||||||
mClearButton.setClickable(false);
|
mClearButton.setClickable(false);
|
||||||
mClearButton.animate().cancel();
|
mClearButton.animate().cancel();
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
mClearButton.animate().setDuration(150).alpha(0.4f);
|
mClearButton.animate().setDuration(200).alpha(0.4f);
|
||||||
mMenuButton.setVisibility(View.VISIBLE);
|
mMenuButton.setVisibility(View.VISIBLE);
|
||||||
mSearchButton.setVisibility(View.GONE);
|
mSearchButton.setVisibility(View.GONE);
|
||||||
if (mSearchInput.getVisibility() == View.VISIBLE){
|
if (mSearchInput.getVisibility() == View.VISIBLE){
|
||||||
|
@ -111,9 +118,9 @@ class bookmarkViewController
|
||||||
}else {
|
}else {
|
||||||
if (mSearchInput.getVisibility() != View.VISIBLE) {
|
if (mSearchInput.getVisibility() != View.VISIBLE) {
|
||||||
mClearButton.setClickable(true);
|
mClearButton.setClickable(true);
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
|
||||||
mClearButton.animate().cancel();
|
mClearButton.animate().cancel();
|
||||||
mClearButton.animate().setDuration(150).alpha(1);
|
mClearButton.animate().setDuration(200).alpha(1);
|
||||||
}
|
}
|
||||||
mMenuButton.setVisibility(View.GONE);
|
mMenuButton.setVisibility(View.GONE);
|
||||||
mSearchButton.setVisibility(View.VISIBLE);
|
mSearchButton.setVisibility(View.VISIBLE);
|
||||||
|
@ -123,7 +130,6 @@ class bookmarkViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateList(){
|
private void updateList(){
|
||||||
int index = Objects.requireNonNull(mRecycleView.getAdapter()).getItemCount()-1;
|
|
||||||
mRecycleView.getAdapter().notifyDataSetChanged();
|
mRecycleView.getAdapter().notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +144,7 @@ class bookmarkViewController
|
||||||
updateIfListEmpty(mRecycleView.getAdapter().getItemCount(),300);
|
updateIfListEmpty(mRecycleView.getAdapter().getItemCount(),300);
|
||||||
mSearchInput.clearFocus();
|
mSearchInput.clearFocus();
|
||||||
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
||||||
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean onHideSearch() {
|
private boolean onHideSearch() {
|
||||||
|
@ -151,7 +158,7 @@ class bookmarkViewController
|
||||||
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
||||||
mSearchInput.setClickable(false);
|
mSearchInput.setClickable(false);
|
||||||
mClearButton.setClickable(true);
|
mClearButton.setClickable(true);
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
|
||||||
mClearButton.animate().cancel();
|
mClearButton.animate().cancel();
|
||||||
mClearButton.animate().setDuration(150).alpha(1f);
|
mClearButton.animate().setDuration(150).alpha(1f);
|
||||||
return false;
|
return false;
|
||||||
|
@ -163,7 +170,7 @@ class bookmarkViewController
|
||||||
mSearchInput.setClickable(true);
|
mSearchInput.setClickable(true);
|
||||||
mClearButton.setClickable(false);
|
mClearButton.setClickable(false);
|
||||||
mSearchInput.requestFocus();
|
mSearchInput.requestFocus();
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
mClearButton.animate().cancel();
|
mClearButton.animate().cancel();
|
||||||
mClearButton.animate().setDuration(150).alpha(0.4f);
|
mClearButton.animate().setDuration(150).alpha(0.4f);
|
||||||
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
|
|
@ -1,33 +1,42 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.bridgeManager;
|
package com.darkweb.genesissearchengine.appManager.bridgeManager;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.historyManager.historyAdapter;
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class bridgeController extends AppCompatActivity {
|
public class bridgeController extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
/*Private Variables*/
|
/*Private Variables*/
|
||||||
|
private bridgeModel mBridgeModel;
|
||||||
private bridgeViewController mBridgeViewController;
|
private bridgeViewController mBridgeViewController;
|
||||||
|
|
||||||
private RadioButton mBridgeObfs;
|
private RadioButton mBridgeObfs;
|
||||||
private RadioButton mBridgeChina;
|
private RadioButton mBridgeChina;
|
||||||
private RadioButton mBridgeCustom;
|
private RadioButton mBridgeCustom;
|
||||||
|
@ -63,11 +72,18 @@ public class bridgeController extends AppCompatActivity {
|
||||||
mCustomBridgeBlocker = findViewById(R.id.pCustomBridgeBlocker);
|
mCustomBridgeBlocker = findViewById(R.id.pCustomBridgeBlocker);
|
||||||
|
|
||||||
mBridgeViewController.initialization(mCustomPort, mBridgeButton,this, mBridgeObfs, mBridgeChina, mBridgeCustom, mCustomBridgeBlocker);
|
mBridgeViewController.initialization(mCustomPort, mBridgeButton,this, mBridgeObfs, mBridgeChina, mBridgeCustom, mCustomBridgeBlocker);
|
||||||
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,0));
|
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,0));
|
||||||
|
mBridgeModel = new bridgeModel(new bridgeController.bridgeModelCallback(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeLocalEventHandlers()
|
private void initializeLocalEventHandlers()
|
||||||
{
|
{
|
||||||
|
mCustomPort.setOnFocusChangeListener((v, hasFocus) -> {
|
||||||
|
if (!hasFocus) {
|
||||||
|
helperMethod.hideKeyboard(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mCustomPort.addTextChangedListener(new TextWatcher() {
|
mCustomPort.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2)
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2)
|
||||||
|
@ -86,6 +102,18 @@ public class bridgeController extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* LISTENERS */
|
||||||
|
|
||||||
|
public class bridgeModelCallback implements eventObserver.eventListener{
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LOCAL OVERRIDES */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause()
|
protected void onPause()
|
||||||
{
|
{
|
||||||
|
@ -109,30 +137,28 @@ public class bridgeController extends AppCompatActivity {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Helper Method*/
|
||||||
|
|
||||||
public void onClose(View view){
|
public void onClose(View view){
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Helper Method*/
|
|
||||||
|
|
||||||
public void requestBridges(View view){
|
public void requestBridges(View view){
|
||||||
|
mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_REQUEST_BRIDGE, null);
|
||||||
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL), enums.etype.on_bridge_mail);
|
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL), enums.etype.on_bridge_mail);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCustomChecked(View view){
|
public void onCustomChecked(View view){
|
||||||
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_CUSTOM;
|
mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_CUSTOM_BRIDGE, null);
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
|
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
|
||||||
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void onMeekChecked(View view){
|
public void onMeekChecked(View view){
|
||||||
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
|
mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_MEEK_BRIDGE, null);
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
|
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
|
||||||
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
|
|
||||||
}
|
}
|
||||||
public void onObfsChecked(View view){
|
public void onObfsChecked(View view){
|
||||||
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_MEEK;
|
mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_OBFS_CHECK, null);
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
|
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
|
||||||
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,6 +4,11 @@ public class bridgeEnums
|
||||||
{
|
{
|
||||||
/*Settings Manager*/
|
/*Settings Manager*/
|
||||||
public enum eBridgeViewCommands {
|
public enum eBridgeViewCommands {
|
||||||
S_INIT_VIEWS
|
M_INIT_VIEWS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum eBridgeModelCommands {
|
||||||
|
M_REQUEST_BRIDGE, M_CUSTOM_BRIDGE, M_MEEK_BRIDGE, M_OBFS_CHECK
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.bridgeManager;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class bridgeModel
|
||||||
|
{
|
||||||
|
/*Variable Declaration*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
private AppCompatActivity mContext;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
bridgeModel(eventObserver.eventListener mEvent, AppCompatActivity pContext){
|
||||||
|
this.mEvent = mEvent;
|
||||||
|
mContext = pContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Helper Methods*/
|
||||||
|
|
||||||
|
public void requestBridges(){
|
||||||
|
pluginController.getInstance().MessageManagerHandler(mContext, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL), enums.etype.on_bridge_mail);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCustomChecked(){
|
||||||
|
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_CUSTOM;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
|
||||||
|
|
||||||
|
}
|
||||||
|
public void onMeekChecked(){
|
||||||
|
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_MEEK;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
|
||||||
|
}
|
||||||
|
public void onObfsChecked(){
|
||||||
|
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTrigger(bridgeEnums.eBridgeModelCommands pCommands, List<Object> pData){
|
||||||
|
if(pCommands == bridgeEnums.eBridgeModelCommands.M_REQUEST_BRIDGE){
|
||||||
|
requestBridges();
|
||||||
|
}
|
||||||
|
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_CUSTOM_BRIDGE){
|
||||||
|
onCustomChecked();
|
||||||
|
}
|
||||||
|
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_MEEK_BRIDGE){
|
||||||
|
onMeekChecked();
|
||||||
|
}
|
||||||
|
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_OBFS_CHECK){
|
||||||
|
onObfsChecked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -15,7 +15,10 @@ import android.widget.RadioButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
|
@ -56,8 +59,10 @@ class bridgeViewController
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,17 +75,17 @@ class bridgeViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetRadioButtons(int p_duration){
|
private void resetRadioButtons(int p_duration){
|
||||||
animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.float_white), "textColor", p_duration);
|
animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.holo_dark_gray), "textColor", p_duration);
|
||||||
animateColor(mBridgeCustom, mBridgeCustom.getCurrentTextColor(), mContext.getResources().getColor(R.color.float_white), "textColor", p_duration);
|
animateColor(mBridgeCustom, mBridgeCustom.getCurrentTextColor(), mContext.getResources().getColor(R.color.holo_dark_gray), "textColor", p_duration);
|
||||||
animateColor(mBridgeChina, mBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.float_white), "textColor", p_duration);
|
animateColor(mBridgeChina, mBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.holo_dark_gray), "textColor", p_duration);
|
||||||
|
|
||||||
mBridgeObfs.setHighlightColor(mContext.getResources().getColor(R.color.float_white));
|
mBridgeObfs.setHighlightColor(mContext.getResources().getColor(R.color.holo_dark_gray));
|
||||||
mBridgeCustom.setHighlightColor(mContext.getResources().getColor(R.color.float_white));
|
mBridgeCustom.setHighlightColor(mContext.getResources().getColor(R.color.holo_dark_gray));
|
||||||
mBridgeChina.setHighlightColor(mContext.getResources().getColor(R.color.float_white));
|
mBridgeChina.setHighlightColor(mContext.getResources().getColor(R.color.holo_dark_gray));
|
||||||
|
|
||||||
mBridgeObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.float_white)));
|
mBridgeObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.holo_dark_gray)));
|
||||||
mBridgeCustom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.float_white)));
|
mBridgeCustom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.holo_dark_gray)));
|
||||||
mBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.float_white)));
|
mBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.holo_dark_gray)));
|
||||||
|
|
||||||
helperMethod.hideKeyboard(mContext);
|
helperMethod.hideKeyboard(mContext);
|
||||||
mCustomPort.clearFocus();
|
mCustomPort.clearFocus();
|
||||||
|
@ -93,22 +98,21 @@ class bridgeViewController
|
||||||
resetRadioButtons(p_duration);
|
resetRadioButtons(p_duration);
|
||||||
switch (p_bridge) {
|
switch (p_bridge) {
|
||||||
case strings.BRIDGE_CUSTOM_BRIDGE_OBFS4:
|
case strings.BRIDGE_CUSTOM_BRIDGE_OBFS4:
|
||||||
|
animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration);
|
||||||
animateColor(mBridgeChina, mBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.black), "textColor", p_duration);
|
|
||||||
mBridgeChina.setHighlightColor(Color.BLACK);
|
|
||||||
mBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.cursor_blue)));
|
|
||||||
mBridgeChina.setChecked(true);
|
|
||||||
break;
|
|
||||||
case strings.BRIDGE_CUSTOM_BRIDGE_MEEK:
|
|
||||||
animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.black), "textColor", p_duration);
|
|
||||||
mBridgeObfs.setHighlightColor(Color.BLACK);
|
mBridgeObfs.setHighlightColor(Color.BLACK);
|
||||||
mBridgeObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.cursor_blue)));
|
mBridgeObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
mBridgeObfs.setChecked(true);
|
mBridgeObfs.setChecked(true);
|
||||||
break;
|
break;
|
||||||
|
case strings.BRIDGE_CUSTOM_BRIDGE_MEEK:
|
||||||
|
animateColor(mBridgeChina, mBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration);
|
||||||
|
mBridgeChina.setHighlightColor(Color.BLACK);
|
||||||
|
mBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mBridgeChina.setChecked(true);
|
||||||
|
break;
|
||||||
case strings.BRIDGE_CUSTOM_BRIDGE_CUSTOM:
|
case strings.BRIDGE_CUSTOM_BRIDGE_CUSTOM:
|
||||||
animateColor(mBridgeCustom, mBridgeCustom.getCurrentTextColor(), mContext.getResources().getColor(R.color.black), "textColor", p_duration);
|
animateColor(mBridgeCustom, mBridgeCustom.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration);
|
||||||
mBridgeCustom.setHighlightColor(Color.BLACK);
|
mBridgeCustom.setHighlightColor(Color.BLACK);
|
||||||
mBridgeCustom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.cursor_blue)));
|
mBridgeCustom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
mBridgeCustom.setChecked(true);
|
mBridgeCustom.setChecked(true);
|
||||||
|
|
||||||
mCustomPort.animate().setDuration(p_duration).alpha(1f);
|
mCustomPort.animate().setDuration(p_duration).alpha(1f);
|
||||||
|
@ -119,7 +123,7 @@ class bridgeViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTrigger(bridgeEnums.eBridgeViewCommands p_commands, List<Object> p_data){
|
public void onTrigger(bridgeEnums.eBridgeViewCommands p_commands, List<Object> p_data){
|
||||||
if(p_commands == bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS){
|
if(p_commands == bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS){
|
||||||
initViews((String) p_data.get(0), (int)p_data.get(1));
|
initViews((String) p_data.get(0), (int)p_data.get(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||||
|
import static com.darkweb.genesissearchengine.constants.constants.HISTORY_LOAD_MORE;
|
||||||
|
|
||||||
public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listViewHolder>
|
public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listViewHolder>
|
||||||
{
|
{
|
||||||
|
@ -40,7 +41,6 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
private ArrayList<Date> mLongSelectedDate = new ArrayList<>();
|
private ArrayList<Date> mLongSelectedDate = new ArrayList<>();
|
||||||
private ArrayList<String> mLongSelectedIndex = new ArrayList<>();
|
private ArrayList<String> mLongSelectedIndex = new ArrayList<>();
|
||||||
private ArrayList<Integer> mLongSelectedID = new ArrayList<>();
|
private ArrayList<Integer> mLongSelectedID = new ArrayList<>();
|
||||||
private ArrayList<View> mLongPressedViewHolders = new ArrayList<>();
|
|
||||||
|
|
||||||
private AppCompatActivity mContext;
|
private AppCompatActivity mContext;
|
||||||
private historyAdapterView mHistroyAdapterView;
|
private historyAdapterView mHistroyAdapterView;
|
||||||
|
@ -69,15 +69,14 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
|
|
||||||
private void onLoading(){
|
private void onLoading(){
|
||||||
mContext.runOnUiThread(() -> {
|
mContext.runOnUiThread(() -> {
|
||||||
mCurrentList.add(new historyRowModel("loading",null,-2));
|
mCurrentList.add(new historyRowModel(HISTORY_LOAD_MORE,null,-2));
|
||||||
notifyItemInserted(mCurrentList.size());
|
notifyItemInserted(mCurrentList.size());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLoadingClear(){
|
private void onLoadingClear(){
|
||||||
|
|
||||||
for(int mCounter = 0; mCounter< mCurrentList.size(); mCounter++){
|
for(int mCounter = 0; mCounter< mCurrentList.size(); mCounter++){
|
||||||
if(mCurrentList.get(mCounter).getHeader().equals("loading")){
|
if(mCurrentList.get(mCounter).getHeader().equals(HISTORY_LOAD_MORE)){
|
||||||
int finalM_counter = mCounter;
|
int finalM_counter = mCounter;
|
||||||
mContext.runOnUiThread(() -> {
|
mContext.runOnUiThread(() -> {
|
||||||
mCurrentList.remove(finalM_counter);
|
mCurrentList.remove(finalM_counter);
|
||||||
|
@ -195,18 +194,10 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearLongSelectedURL(){
|
private void clearLongSelectedURL(){
|
||||||
|
|
||||||
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
|
|
||||||
|
|
||||||
View m_item_view = mLongPressedViewHolders.get(m_counter);
|
|
||||||
ImageButton m_popup_menu = m_item_view.findViewById(R.id.pRowMenu);
|
|
||||||
ImageView p_logo_image = m_item_view.findViewById(R.id.pLogoImage);
|
|
||||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW, Arrays.asList(m_popup_menu, p_logo_image, m_item_view));
|
|
||||||
}
|
|
||||||
mLongSelectedDate.clear();
|
mLongSelectedDate.clear();
|
||||||
mLongSelectedIndex.clear();
|
mLongSelectedIndex.clear();
|
||||||
mLongSelectedID.clear();
|
mLongSelectedID.clear();
|
||||||
mLongPressedViewHolders.clear();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSelectedURL(){
|
private String getSelectedURL(){
|
||||||
|
@ -245,7 +236,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
mSearchEnabled = p_is_searched;
|
mSearchEnabled = p_is_searched;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSelectView(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){
|
public void onSelectView(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){
|
||||||
if(!mSearchEnabled){
|
if(!mSearchEnabled){
|
||||||
try {
|
try {
|
||||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced, true));
|
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced, true));
|
||||||
|
@ -259,7 +250,6 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
mLongSelectedDate.add(pDate);
|
mLongSelectedDate.add(pDate);
|
||||||
mLongSelectedIndex.add(pUrl);
|
mLongSelectedIndex.add(pUrl);
|
||||||
mLongSelectedID.add(pId);
|
mLongSelectedID.add(pId);
|
||||||
mLongPressedViewHolders.add(pItem);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
onVerifyLongSelectedURL();
|
onVerifyLongSelectedURL();
|
||||||
|
@ -274,14 +264,13 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClearHighlight(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate)
|
public void onClearHighlight(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced));
|
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced));
|
||||||
mLongSelectedDate.remove(pDate);
|
mLongSelectedDate.remove(pDate);
|
||||||
mLongSelectedIndex.remove(pUrl);
|
mLongSelectedIndex.remove(pUrl);
|
||||||
mLongSelectedID.remove((Integer) pId);
|
mLongSelectedID.remove((Integer) pId);
|
||||||
mLongPressedViewHolders.remove(pItem);
|
|
||||||
if(mLongSelectedID.size()==0){
|
if(mLongSelectedID.size()==0){
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
@ -293,7 +282,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
|
|
||||||
private float mPointerPosition = 0;
|
private float mPointerPosition = 0;
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
public void onSwipe(View pItem, View pItemView, int pPosition, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){
|
public void onSwipe(View pItemView, int pPosition, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){
|
||||||
|
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
|
|
||||||
|
@ -301,10 +290,10 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
if(!mDisableCallable && Math.abs(mRecyclerPositionX1-mPointerPosition) <= 20){
|
if(!mDisableCallable && Math.abs(mRecyclerPositionX1-mPointerPosition) <= 20){
|
||||||
if(!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
|
if(!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
|
||||||
mLongPressedMenuActive = true;
|
mLongPressedMenuActive = true;
|
||||||
onSelectView(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
onSelectView(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
||||||
}else {
|
}else {
|
||||||
Log.i("I AM HERE 22","I AM HERE");
|
Log.i("I AM HERE 22","I AM HERE");
|
||||||
onClearHighlight(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
onClearHighlight(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
|
||||||
mLongPressedMenuActive = true;
|
mLongPressedMenuActive = true;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
|
@ -344,10 +333,10 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
if (Math.abs(deltaX) <= 20 && !mLongPressedMenuActive) {
|
if (Math.abs(deltaX) <= 20 && !mLongPressedMenuActive) {
|
||||||
if (mLongSelectedIndex.contains(pUrl) && mLongSelectedID.contains(pId)) {
|
if (mLongSelectedIndex.contains(pUrl) && mLongSelectedID.contains(pId)) {
|
||||||
handler.removeCallbacks(mLongPressed);
|
handler.removeCallbacks(mLongPressed);
|
||||||
historyAdapter.this.onClearHighlight(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
historyAdapter.this.onClearHighlight(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
||||||
} else{
|
} else{
|
||||||
handler.removeCallbacks(mLongPressed);
|
handler.removeCallbacks(mLongPressed);
|
||||||
historyAdapter.this.onSelectView(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
historyAdapter.this.onSelectView(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -425,10 +414,10 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setItemViewOnClickListener(View pItem, View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate)
|
private void setItemViewOnClickListener(View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate)
|
||||||
{
|
{
|
||||||
pItemMenu.setOnClickListener((View v) -> onOpenMenu(v, pUrl, pPosition, pTitle));
|
pItemMenu.setOnClickListener((View v) -> onOpenMenu(v, pUrl, pPosition, pTitle));
|
||||||
onSwipe(pItem, pItemView, pPosition, pUrl,pMenuItem, pLogoImage, pId, pDate);
|
onSwipe(pItemView, pPosition, pUrl,pMenuItem, pLogoImage, pId, pDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onClose(int pIndex){
|
private void onClose(int pIndex){
|
||||||
|
@ -509,7 +498,8 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
mDate.setText(model.getHeader());
|
mDate.setText(model.getHeader());
|
||||||
mDateContainer.setVisibility(View.VISIBLE);
|
mDateContainer.setVisibility(View.VISIBLE);
|
||||||
mRowContainer.setVisibility(View.GONE);
|
mRowContainer.setVisibility(View.GONE);
|
||||||
mRowMenu.setVisibility(View.GONE);
|
mRowMenu.setVisibility(View.INVISIBLE);
|
||||||
|
mRowMenu.setClickable(false);
|
||||||
mWebLogo.setVisibility(View.GONE);
|
mWebLogo.setVisibility(View.GONE);
|
||||||
mLoadingContainer.setVisibility(View.GONE);
|
mLoadingContainer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -517,7 +507,8 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
mDate.setText(model.getHeader());
|
mDate.setText(model.getHeader());
|
||||||
mDateContainer.setVisibility(View.GONE);
|
mDateContainer.setVisibility(View.GONE);
|
||||||
mRowContainer.setVisibility(View.GONE);
|
mRowContainer.setVisibility(View.GONE);
|
||||||
mRowMenu.setVisibility(View.GONE);
|
mRowMenu.setVisibility(View.INVISIBLE);
|
||||||
|
mRowMenu.setClickable(false);
|
||||||
mWebLogo.setVisibility(View.GONE);
|
mWebLogo.setVisibility(View.GONE);
|
||||||
mLoadingContainer.setVisibility(View.VISIBLE);
|
mLoadingContainer.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -526,6 +517,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
mLoadingContainer.setVisibility(View.GONE);
|
mLoadingContainer.setVisibility(View.GONE);
|
||||||
mRowContainer.setVisibility(View.VISIBLE);
|
mRowContainer.setVisibility(View.VISIBLE);
|
||||||
mRowMenu.setVisibility(View.VISIBLE);
|
mRowMenu.setVisibility(View.VISIBLE);
|
||||||
|
mRowMenu.setClickable(true);
|
||||||
mWebLogo.setVisibility(View.VISIBLE);
|
mWebLogo.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0)+""));
|
mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0)+""));
|
||||||
|
@ -533,13 +525,15 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
|
||||||
mDescription.setText(("https://"+model.getDescription()));
|
mDescription.setText(("https://"+model.getDescription()));
|
||||||
mHeader.setText(model.getHeader());
|
mHeader.setText(model.getHeader());
|
||||||
|
|
||||||
setItemViewOnClickListener(itemView, mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate());
|
setItemViewOnClickListener(mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mLongSelectedID.size()>0){
|
if(mLongSelectedID.size()>0){
|
||||||
mRowMenu.setVisibility(View.GONE);
|
mRowMenu.setVisibility(View.INVISIBLE);
|
||||||
|
mRowMenu.setClickable(false);
|
||||||
}else {
|
}else {
|
||||||
mRowMenu.setVisibility(View.VISIBLE);
|
mRowMenu.setVisibility(View.VISIBLE);
|
||||||
|
mRowMenu.setClickable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mLongSelectedIndex.contains("https://" + model.getDescription()) && mLongSelectedID.contains(model.getID())){
|
if(mLongSelectedIndex.contains("https://" + model.getDescription()) && mLongSelectedID.contains(model.getID())){
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class historyAdapterView
|
||||||
pView.getLocationOnScreen(location);
|
pView.getLocationOnScreen(location);
|
||||||
int y = location[1];
|
int y = location[1];
|
||||||
int height = helperMethod.getScreenHeight(mContext);
|
int height = helperMethod.getScreenHeight(mContext);
|
||||||
int m_offset_height = 0;
|
int m_offset_height;
|
||||||
if(y + helperMethod.pxFromDp(300) >height){
|
if(y + helperMethod.pxFromDp(300) >height){
|
||||||
m_offset_height = helperMethod.pxFromDp(203);
|
m_offset_height = helperMethod.pxFromDp(203);
|
||||||
}
|
}
|
||||||
|
@ -59,15 +59,16 @@ public class historyAdapterView
|
||||||
|
|
||||||
private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){
|
private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){
|
||||||
mItemView.setPressed(false);
|
mItemView.setPressed(false);
|
||||||
pPopupMenu.setVisibility(View.VISIBLE);
|
pPopupMenu.setVisibility(View.GONE);
|
||||||
pPopupMenu.animate().setDuration(150).alpha(1);
|
pPopupMenu.animate().setDuration(150).alpha(0);
|
||||||
pPopupMenu.setClickable(true);
|
pPopupMenu.setClickable(true);
|
||||||
pLogoImage.setAlpha(1f);
|
pLogoImage.setAlpha(0f);
|
||||||
pLogoImage.animate().cancel();
|
pLogoImage.animate().cancel();
|
||||||
|
pLogoImage.setVisibility(View.GONE);
|
||||||
pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
|
pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSelectView(View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){
|
public void onSelectView(View pItemView, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){
|
||||||
pItemView.setPressed(false);
|
pItemView.setPressed(false);
|
||||||
int speed = 150;
|
int speed = 150;
|
||||||
if(pIsForced){
|
if(pIsForced){
|
||||||
|
@ -83,7 +84,7 @@ public class historyAdapterView
|
||||||
pLogoImage.animate().setDuration(speed).alpha(1);
|
pLogoImage.animate().setDuration(speed).alpha(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClearHighlight( View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced)
|
public void onClearHighlight(View pItemView, ImageView pLogoImage, boolean pIsForced)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if(pLogoImage.getAlpha()>0){
|
if(pLogoImage.getAlpha()>0){
|
||||||
|
@ -109,10 +110,10 @@ public class historyAdapterView
|
||||||
clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2));
|
clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2));
|
||||||
}
|
}
|
||||||
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW){
|
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW){
|
||||||
onSelectView((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4));
|
onSelectView((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4));
|
||||||
}
|
}
|
||||||
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT){
|
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT){
|
||||||
onClearHighlight((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3));
|
onClearHighlight((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import static com.darkweb.genesissearchengine.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU;
|
import static com.darkweb.genesissearchengine.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU;
|
||||||
|
|
||||||
public class historyController extends AppCompatActivity
|
public class historyController extends AppCompatActivity
|
||||||
|
@ -59,7 +57,6 @@ public class historyController extends AppCompatActivity
|
||||||
|
|
||||||
private historyViewController mHistoryViewController;
|
private historyViewController mHistoryViewController;
|
||||||
private boolean isUpdatingRecyclerView = false;
|
private boolean isUpdatingRecyclerView = false;
|
||||||
private boolean mIsScrollingUp;
|
|
||||||
|
|
||||||
/*Initializations*/
|
/*Initializations*/
|
||||||
|
|
||||||
|
@ -152,8 +149,8 @@ public class historyController extends AppCompatActivity
|
||||||
if (!hasFocus) {
|
if (!hasFocus) {
|
||||||
mSearchInput.clearFocus();
|
mSearchInput.clearFocus();
|
||||||
}else {
|
}else {
|
||||||
((historyAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).setFilter(mSearchInput.getText().toString());
|
mHistoryAdapter.setFilter(mSearchInput.getText().toString());
|
||||||
((historyAdapter) mRecycleView.getAdapter()).invokeFilter(true);
|
mHistoryAdapter.invokeFilter(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -172,8 +169,8 @@ public class historyController extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable editable)
|
public void afterTextChanged(Editable editable)
|
||||||
{
|
{
|
||||||
((historyAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).setFilter(mSearchInput.getText().toString());
|
mHistoryAdapter.setFilter(mSearchInput.getText().toString());
|
||||||
((historyAdapter) mRecycleView.getAdapter()).invokeFilter(true);
|
mHistoryAdapter.invokeFilter(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -240,7 +237,7 @@ public class historyController extends AppCompatActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onHideSearch(View view) {
|
public void onHideSearch(View view) {
|
||||||
((historyAdapter) mRecycleView.getAdapter()).onUpdateSearchStatus((boolean) mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_HIDE_SEARCH, null));
|
mHistoryAdapter.onUpdateSearchStatus((boolean) mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_HIDE_SEARCH, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLongPressMenu(View view) {
|
public void onLongPressMenu(View view) {
|
||||||
|
@ -279,7 +276,7 @@ public class historyController extends AppCompatActivity
|
||||||
|
|
||||||
public void onclearData(){
|
public void onclearData(){
|
||||||
mHistoryModel.clearList();
|
mHistoryModel.clearList();
|
||||||
((historyAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).invokeFilter(true );
|
mHistoryAdapter.invokeFilter(true );
|
||||||
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLEAR_LIST, null);
|
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLEAR_LIST, null);
|
||||||
databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null);
|
databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null);
|
||||||
}
|
}
|
||||||
|
@ -295,9 +292,7 @@ public class historyController extends AppCompatActivity
|
||||||
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY ,null);
|
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY ,null);
|
||||||
try {
|
try {
|
||||||
sleep(500);
|
sleep(500);
|
||||||
activityContextManager.getInstance().getHistoryController().runOnUiThread(() -> {
|
activityContextManager.getInstance().getHistoryController().runOnUiThread(() -> mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_LOADING_CLEAR, null));
|
||||||
mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_LOADING_CLEAR, null);
|
|
||||||
});
|
|
||||||
sleep(1000);
|
sleep(1000);
|
||||||
isUpdatingRecyclerView = false;
|
isUpdatingRecyclerView = false;
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
|
@ -24,14 +25,12 @@ class historyViewController
|
||||||
{
|
{
|
||||||
/*Private Variables*/
|
/*Private Variables*/
|
||||||
private AppCompatActivity mContext;
|
private AppCompatActivity mContext;
|
||||||
|
|
||||||
private ImageView mEmptyListNotification;
|
private ImageView mEmptyListNotification;
|
||||||
private EditText mSearchInput;
|
private EditText mSearchInput;
|
||||||
private RecyclerView mRecycleView;
|
private RecyclerView mRecycleView;
|
||||||
private Button mClearButton;
|
private Button mClearButton;
|
||||||
private ImageButton mMenuButton;
|
private ImageButton mMenuButton;
|
||||||
private ImageButton mSearchButton;
|
private ImageButton mSearchButton;
|
||||||
|
|
||||||
private PopupWindow mPopupWindow = null;
|
private PopupWindow mPopupWindow = null;
|
||||||
|
|
||||||
/*Initializations*/
|
/*Initializations*/
|
||||||
|
@ -55,24 +54,26 @@ class historyViewController
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateIfListEmpty(int pSize,int pDuration){
|
private void updateIfListEmpty(int pSize,int pDuration){
|
||||||
if(pSize>0){
|
if(pSize>0){
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
|
||||||
mEmptyListNotification.animate().setDuration(pDuration).alpha(0f);
|
mEmptyListNotification.animate().setDuration(pDuration).alpha(0f);
|
||||||
mClearButton.setText(strings.HISTORY_CLEAR_HISTORY);
|
mClearButton.setText(strings.HISTORY_CLEAR_HISTORY);
|
||||||
mClearButton.setClickable(true);
|
mClearButton.setClickable(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
mEmptyListNotification.animate().setDuration(pDuration).alpha(1f);
|
mEmptyListNotification.animate().setDuration(pDuration).alpha(1f);
|
||||||
|
|
||||||
mClearButton.animate().setDuration(pDuration).alpha(0.4f);
|
mClearButton.animate().setDuration(pDuration).alpha(0.4f);
|
||||||
|
@ -82,7 +83,10 @@ class historyViewController
|
||||||
mClearButton.setEnabled(false);
|
mClearButton.setEnabled(false);
|
||||||
mSearchButton.setClickable(false);
|
mSearchButton.setClickable(false);
|
||||||
mMenuButton.setClickable(false);
|
mMenuButton.setClickable(false);
|
||||||
|
mSearchInput.setVisibility(View.GONE);
|
||||||
|
mClearButton.animate().setDuration(300).alpha(1);
|
||||||
|
|
||||||
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
mClearButton.setText(strings.HISTORY_NO_HISTORY_FOUND);
|
mClearButton.setText(strings.HISTORY_NO_HISTORY_FOUND);
|
||||||
mClearButton.setClickable(false);
|
mClearButton.setClickable(false);
|
||||||
}
|
}
|
||||||
|
@ -92,14 +96,15 @@ class historyViewController
|
||||||
if(mPopupWindow !=null && mPopupWindow.isShowing()){
|
if(mPopupWindow !=null && mPopupWindow.isShowing()){
|
||||||
mPopupWindow.dismiss();
|
mPopupWindow.dismiss();
|
||||||
}
|
}
|
||||||
|
onSelectionMenu(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSelectionMenu(boolean pStatus){
|
private void onSelectionMenu(boolean pStatus){
|
||||||
if(!pStatus){
|
if(!pStatus){
|
||||||
mClearButton.setClickable(false);
|
mClearButton.setClickable(false);
|
||||||
mClearButton.animate().cancel();
|
mClearButton.animate().cancel();
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
mClearButton.animate().setDuration(150).alpha(0.4f);
|
mClearButton.animate().setDuration(200).alpha(0.4f);
|
||||||
mMenuButton.setVisibility(View.VISIBLE);
|
mMenuButton.setVisibility(View.VISIBLE);
|
||||||
mSearchButton.setVisibility(View.GONE);
|
mSearchButton.setVisibility(View.GONE);
|
||||||
if (mSearchInput.getVisibility() == View.VISIBLE){
|
if (mSearchInput.getVisibility() == View.VISIBLE){
|
||||||
|
@ -108,9 +113,9 @@ class historyViewController
|
||||||
}else {
|
}else {
|
||||||
if (mSearchInput.getVisibility() != View.VISIBLE) {
|
if (mSearchInput.getVisibility() != View.VISIBLE) {
|
||||||
mClearButton.setClickable(true);
|
mClearButton.setClickable(true);
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
|
||||||
mClearButton.animate().cancel();
|
mClearButton.animate().cancel();
|
||||||
mClearButton.animate().setDuration(150).alpha(1);
|
mClearButton.animate().setDuration(200).alpha(1);
|
||||||
}
|
}
|
||||||
mMenuButton.setVisibility(View.GONE);
|
mMenuButton.setVisibility(View.GONE);
|
||||||
mSearchButton.setVisibility(View.VISIBLE);
|
mSearchButton.setVisibility(View.VISIBLE);
|
||||||
|
@ -120,7 +125,6 @@ class historyViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateList(){
|
private void updateList(){
|
||||||
int index = Objects.requireNonNull(mRecycleView.getAdapter()).getItemCount()-1;
|
|
||||||
mRecycleView.getAdapter().notifyDataSetChanged();
|
mRecycleView.getAdapter().notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +139,7 @@ class historyViewController
|
||||||
updateIfListEmpty(mRecycleView.getAdapter().getItemCount(),300);
|
updateIfListEmpty(mRecycleView.getAdapter().getItemCount(),300);
|
||||||
mSearchInput.clearFocus();
|
mSearchInput.clearFocus();
|
||||||
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
||||||
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean onHideSearch() {
|
private boolean onHideSearch() {
|
||||||
|
@ -148,7 +153,7 @@ class historyViewController
|
||||||
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
|
||||||
mSearchInput.setClickable(false);
|
mSearchInput.setClickable(false);
|
||||||
mClearButton.setClickable(true);
|
mClearButton.setClickable(true);
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
|
||||||
mClearButton.animate().cancel();
|
mClearButton.animate().cancel();
|
||||||
mClearButton.animate().setDuration(150).alpha(1f);
|
mClearButton.animate().setDuration(150).alpha(1f);
|
||||||
return false;
|
return false;
|
||||||
|
@ -160,7 +165,7 @@ class historyViewController
|
||||||
mSearchInput.setClickable(true);
|
mSearchInput.setClickable(true);
|
||||||
mClearButton.setClickable(false);
|
mClearButton.setClickable(false);
|
||||||
mSearchInput.requestFocus();
|
mSearchInput.requestFocus();
|
||||||
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
|
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
mClearButton.animate().cancel();
|
mClearButton.animate().cancel();
|
||||||
mClearButton.animate().setDuration(150).alpha(0.4f);
|
mClearButton.animate().setDuration(150).alpha(0.4f);
|
||||||
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
|
|
@ -2,17 +2,24 @@ package com.darkweb.genesissearchengine.appManager.homeManager;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.darkweb.genesissearchengine.constants.*;
|
import com.darkweb.genesissearchengine.constants.*;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent;
|
import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent;
|
||||||
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
|
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
|
||||||
import static org.mozilla.geckoview.StorageController.ClearFlags.ALL;
|
import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS;
|
||||||
|
import static org.mozilla.geckoview.StorageController.ClearFlags.COOKIES;
|
||||||
|
import static org.mozilla.geckoview.StorageController.ClearFlags.DOM_STORAGES;
|
||||||
|
import static org.mozilla.geckoview.StorageController.ClearFlags.IMAGE_CACHE;
|
||||||
|
import static org.mozilla.geckoview.StorageController.ClearFlags.NETWORK_CACHE;
|
||||||
|
import static org.mozilla.geckoview.StorageController.ClearFlags.PERMISSIONS;
|
||||||
|
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_DATA;
|
||||||
|
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_SETTINGS;
|
||||||
|
|
||||||
import org.mozilla.geckoview.ContentBlocking;
|
import org.mozilla.geckoview.ContentBlocking;
|
||||||
import org.mozilla.geckoview.GeckoRuntime;
|
import org.mozilla.geckoview.GeckoRuntime;
|
||||||
|
@ -29,6 +36,7 @@ class geckoClients
|
||||||
private int mSessionID=0;
|
private int mSessionID=0;
|
||||||
private int mGlobalSessionCounter=0;
|
private int mGlobalSessionCounter=0;
|
||||||
|
|
||||||
|
|
||||||
private eventObserver.eventListener event;
|
private eventObserver.eventListener event;
|
||||||
private AppCompatActivity context;
|
private AppCompatActivity context;
|
||||||
|
|
||||||
|
@ -38,19 +46,18 @@ class geckoClients
|
||||||
this.event = event;
|
this.event = event;
|
||||||
mGlobalSessionCounter+=1;
|
mGlobalSessionCounter+=1;
|
||||||
mSessionID = mGlobalSessionCounter;
|
mSessionID = mGlobalSessionCounter;
|
||||||
runtimeSettings(context);
|
initRuntimeSettings(context);
|
||||||
|
|
||||||
if(!isForced && geckoView.getSession()!=null && geckoView.getSession().isOpen()){
|
if(!isForced && geckoView.getSession()!=null && geckoView.getSession().isOpen()){
|
||||||
mSession = (geckoSession) geckoView.getSession();
|
mSession = (geckoSession) geckoView.getSession();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
geckoView.releaseSession();
|
geckoView.releaseSession();
|
||||||
Log.i("GCHECKS:","GCHECKS:"+mGlobalSessionCounter);
|
mSession = new geckoSession(new geckoViewClientCallback(),mGlobalSessionCounter,context, geckoView);
|
||||||
mSession = new geckoSession(new geckoViewClientCallback(),mGlobalSessionCounter,context);
|
|
||||||
mSession.open(mRuntime);
|
mSession.open(mRuntime);
|
||||||
mSession.getSettings().setUseTrackingProtection(true);
|
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
|
||||||
mSession.getSettings().setFullAccessibilityTree(true);
|
mSession.getSettings().setFullAccessibilityTree(true);
|
||||||
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE );
|
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
|
||||||
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
|
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
|
||||||
geckoView.releaseSession();
|
geckoView.releaseSession();
|
||||||
geckoView.setSession(mSession);
|
geckoView.setSession(mSession);
|
||||||
|
@ -67,13 +74,21 @@ class geckoClients
|
||||||
return mSession.getUserAgentMode();
|
return mSession.getUserAgentMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runtimeSettings(AppCompatActivity context){
|
public void initRuntimeSettings(AppCompatActivity context){
|
||||||
if(mRuntime==null){
|
if(mRuntime==null){
|
||||||
mRuntime = GeckoRuntime.getDefault(context);
|
mRuntime = GeckoRuntime.getDefault(context);
|
||||||
|
mRuntime.getSettings().setAboutConfigEnabled(true);
|
||||||
|
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
|
||||||
|
mRuntime.getSettings().setRemoteDebuggingEnabled(false);
|
||||||
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
|
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
|
||||||
|
mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT);
|
||||||
mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sSettingFontAdjustable);
|
mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sSettingFontAdjustable);
|
||||||
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.AD);
|
if(status.sSettingTrackingProtection){
|
||||||
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.FINGERPRINTING);
|
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.AD);
|
||||||
|
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.FINGERPRINTING);
|
||||||
|
}else {
|
||||||
|
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,12 +96,25 @@ class geckoClients
|
||||||
return status.sSettingCookieStatus;
|
return status.sSettingCookieStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateCookies(){
|
void updateSetting(){
|
||||||
mRuntime.getSettings().getContentBlocking().setCookieBehavior(status.sSettingCookieStatus);
|
mRuntime.getSettings().setRemoteDebuggingEnabled(false);
|
||||||
onReload();
|
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
|
||||||
}
|
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
|
||||||
|
mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sSettingFontAdjustable);
|
||||||
|
mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT);
|
||||||
|
if(status.sSettingTrackingProtection){
|
||||||
|
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.AD);
|
||||||
|
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.FINGERPRINTING);
|
||||||
|
}else {
|
||||||
|
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT);
|
||||||
|
}
|
||||||
|
|
||||||
void onClose(){
|
|
||||||
|
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
|
||||||
|
mSession.getSettings().setFullAccessibilityTree(true);
|
||||||
|
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE );
|
||||||
|
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
|
||||||
|
onReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSession(geckoSession mSession){
|
void initSession(geckoSession mSession){
|
||||||
|
@ -118,8 +146,24 @@ class geckoClients
|
||||||
mSession.loadUri(url);
|
mSession.loadUri(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onClearSiteData(){
|
||||||
|
mRuntime.getStorageController().clearData(SITE_SETTINGS);
|
||||||
|
mRuntime.getStorageController().clearData(SITE_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
void onClearSession(){
|
void onClearSession(){
|
||||||
mRuntime.getStorageController().clearData(ALL);
|
mRuntime.getStorageController().clearData(AUTH_SESSIONS);
|
||||||
|
mRuntime.getStorageController().clearData(PERMISSIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onClearCache(){
|
||||||
|
mRuntime.getStorageController().clearData(NETWORK_CACHE);
|
||||||
|
mRuntime.getStorageController().clearData(IMAGE_CACHE);
|
||||||
|
mRuntime.getStorageController().clearData(DOM_STORAGES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onClearCookies(){
|
||||||
|
mRuntime.getStorageController().clearData(COOKIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onBackPressed(boolean isFinishAllowed){
|
void onBackPressed(boolean isFinishAllowed){
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.homeManager;
|
package com.darkweb.genesissearchengine.appManager.homeManager;
|
||||||
|
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
@ -9,6 +8,9 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
|
import android.graphics.Matrix;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.graphics.RectF;
|
||||||
import android.media.MediaScannerConnection;
|
import android.media.MediaScannerConnection;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -16,8 +18,9 @@ import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.autofill.AutofillManager;
|
||||||
|
import android.view.autofill.AutofillValue;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.annotation.AnyThread;
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.UiThread;
|
import androidx.annotation.UiThread;
|
||||||
|
@ -25,17 +28,19 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
import com.darkweb.genesissearchengine.helperManager.JavaScriptInterface;
|
import com.darkweb.genesissearchengine.helperManager.JavaScriptInterface;
|
||||||
import com.darkweb.genesissearchengine.helperManager.downloadFileService;
|
import com.darkweb.genesissearchengine.helperManager.downloadFileService;
|
||||||
import com.darkweb.genesissearchengine.helperManager.errorHandler;
|
import com.darkweb.genesissearchengine.helperManager.errorHandler;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import org.mozilla.gecko.GeckoSystemStateListener;
|
import org.mozilla.gecko.util.ThreadUtils;
|
||||||
import org.mozilla.gecko.GeckoThread;
|
|
||||||
import org.mozilla.geckoview.AllowOrDeny;
|
import org.mozilla.geckoview.AllowOrDeny;
|
||||||
|
import org.mozilla.geckoview.Autofill;
|
||||||
import org.mozilla.geckoview.GeckoResult;
|
import org.mozilla.geckoview.GeckoResult;
|
||||||
import org.mozilla.geckoview.GeckoSession;
|
import org.mozilla.geckoview.GeckoSession;
|
||||||
|
import org.mozilla.geckoview.GeckoView;
|
||||||
import org.mozilla.geckoview.WebRequestError;
|
import org.mozilla.geckoview.WebRequestError;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -43,7 +48,7 @@ import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP;
|
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP;
|
||||||
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
|
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
|
||||||
|
|
||||||
|
@ -67,15 +72,19 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
private GeckoSession.HistoryDelegate.HistoryList mHistoryList = null;
|
private GeckoSession.HistoryDelegate.HistoryList mHistoryList = null;
|
||||||
private int rateCount=0;
|
private int rateCount=0;
|
||||||
private int m_current_url_id = -1;
|
private int m_current_url_id = -1;
|
||||||
|
private GeckoView mGeckoView;
|
||||||
|
|
||||||
geckoSession(eventObserver.eventListener event,int mSessionID,AppCompatActivity mContext){
|
geckoSession(eventObserver.eventListener event,int mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){
|
||||||
|
|
||||||
|
this.mGeckoView = pGeckoView;
|
||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
this.mSessionID = mSessionID;
|
this.mSessionID = mSessionID;
|
||||||
setProgressDelegate(this);
|
setProgressDelegate(this);
|
||||||
setHistoryDelegate(this);
|
setHistoryDelegate(this);
|
||||||
setNavigationDelegate(this);
|
setNavigationDelegate(this);
|
||||||
setContentDelegate(this);
|
setContentDelegate(this);
|
||||||
|
setAutoFillDelegate();
|
||||||
|
setPermissionDelegate(this);
|
||||||
mDownloadManager = new geckoDownloadManager();
|
mDownloadManager = new geckoDownloadManager();
|
||||||
setPromptDelegate(new geckoPromptView(mContext));
|
setPromptDelegate(new geckoPromptView(mContext));
|
||||||
this.event = event;
|
this.event = event;
|
||||||
|
@ -84,7 +93,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
void onFileUploadRequest(int resultCode, Intent data){
|
void onFileUploadRequest(int resultCode, Intent data){
|
||||||
|
|
||||||
geckoPromptView mPromptDelegate = (geckoPromptView)getPromptDelegate();
|
geckoPromptView mPromptDelegate = (geckoPromptView)getPromptDelegate();
|
||||||
mPromptDelegate.onFileCallbackResult(resultCode,data);
|
Objects.requireNonNull(mPromptDelegate).onFileCallbackResult(resultCode,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initURL(String url){
|
void initURL(String url){
|
||||||
|
@ -93,7 +102,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
mCurrentTitle = mCurrentURL;
|
mCurrentTitle = mCurrentURL;
|
||||||
|
|
||||||
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion);
|
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion);
|
||||||
if(!url.equals("about:blank"))
|
if(!url.equals("about:blank") && !url.equals("about:config"))
|
||||||
{
|
{
|
||||||
mProgress = 5;
|
mProgress = 5;
|
||||||
event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update);
|
event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update);
|
||||||
|
@ -101,6 +110,69 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
m_current_url_id = -1;
|
m_current_url_id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Autofill Delegate*/
|
||||||
|
|
||||||
|
public void setAutoFillDelegate(){
|
||||||
|
this.setAutofillDelegate(new AndroidAutofillDelegate());
|
||||||
|
}
|
||||||
|
|
||||||
|
private class AndroidAutofillDelegate implements Autofill.Delegate {
|
||||||
|
|
||||||
|
private Rect displayRectForId(@NonNull final GeckoSession session,
|
||||||
|
@NonNull final Autofill.Node node) {
|
||||||
|
final Matrix matrix = new Matrix();
|
||||||
|
final RectF rectF = new RectF(node.getDimensions());
|
||||||
|
session.getPageToScreenMatrix(matrix);
|
||||||
|
matrix.mapRect(rectF);
|
||||||
|
|
||||||
|
final Rect screenRect = new Rect();
|
||||||
|
rectF.roundOut(screenRect);
|
||||||
|
return screenRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAutofill(@NonNull final GeckoSession session,
|
||||||
|
final int notification,
|
||||||
|
final Autofill.Node node) {
|
||||||
|
ThreadUtils.assertOnUiThread();
|
||||||
|
if (Build.VERSION.SDK_INT < 26) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final AutofillManager manager =
|
||||||
|
mContext.getSystemService(AutofillManager.class);
|
||||||
|
if (manager == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (notification) {
|
||||||
|
case Autofill.Notify.SESSION_STARTED:
|
||||||
|
case Autofill.Notify.SESSION_CANCELED:
|
||||||
|
manager.cancel();
|
||||||
|
break;
|
||||||
|
case Autofill.Notify.SESSION_COMMITTED:
|
||||||
|
manager.commit();
|
||||||
|
break;
|
||||||
|
case Autofill.Notify.NODE_FOCUSED:
|
||||||
|
manager.notifyViewEntered(
|
||||||
|
mGeckoView, node.getId(),
|
||||||
|
displayRectForId(session, node));
|
||||||
|
break;
|
||||||
|
case Autofill.Notify.NODE_BLURRED:
|
||||||
|
manager.notifyViewExited(mGeckoView, node.getId());
|
||||||
|
break;
|
||||||
|
case Autofill.Notify.NODE_UPDATED:
|
||||||
|
manager.notifyValueChanged(
|
||||||
|
mGeckoView,
|
||||||
|
node.getId(),
|
||||||
|
AutofillValue.forText(node.getValue()));
|
||||||
|
break;
|
||||||
|
case Autofill.Notify.NODE_ADDED:
|
||||||
|
case Autofill.Notify.NODE_REMOVED:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/*Progress Delegate*/
|
/*Progress Delegate*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -116,12 +188,6 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AnyThread
|
|
||||||
public void shutdown() {
|
|
||||||
GeckoSystemStateListener.getInstance().shutdown();
|
|
||||||
GeckoThread.forceQuit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
public void onPageStop(@NonNull GeckoSession var1, boolean var2) {
|
public void onPageStop(@NonNull GeckoSession var1, boolean var2) {
|
||||||
|
|
||||||
|
@ -159,13 +225,13 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
/*Navigation Delegate*/
|
/*Navigation Delegate*/
|
||||||
public void onLocationChange(@NonNull GeckoSession var1, @Nullable String var2) {
|
public void onLocationChange(@NonNull GeckoSession var1, @Nullable String var2) {
|
||||||
|
|
||||||
String newUrl = var2.split("#")[0];
|
String newUrl = Objects.requireNonNull(var2).split("#")[0];
|
||||||
if(!mCurrentTitle.equals("loading")){
|
if(!mCurrentTitle.equals("loading")){
|
||||||
m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.on_update_history);
|
m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.on_update_history);
|
||||||
}
|
}
|
||||||
mCurrentURL = newUrl;
|
mCurrentURL = newUrl;
|
||||||
|
|
||||||
if (var2 != null && !var2.equals("about:blank"))
|
if (!var2.equals("about:blank"))
|
||||||
{
|
{
|
||||||
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.start_proxy);
|
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.start_proxy);
|
||||||
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.search_update);
|
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.search_update);
|
||||||
|
@ -260,6 +326,21 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Permission Delegate*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onContentPermissionRequest(final GeckoSession session, final String uri,
|
||||||
|
final int type, final Callback callback) {
|
||||||
|
if (PERMISSION_AUTOPLAY_AUDIBLE == type || PERMISSION_AUTOPLAY_INAUDIBLE == type) {
|
||||||
|
if (!status.sAutoPlay) {
|
||||||
|
callback.reject();
|
||||||
|
} else {
|
||||||
|
callback.grant();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
callback.reject();
|
||||||
|
}
|
||||||
|
}
|
||||||
/*Download Manager*/
|
/*Download Manager*/
|
||||||
|
|
||||||
void downloadRequestedFile()
|
void downloadRequestedFile()
|
||||||
|
@ -280,70 +361,6 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
private boolean createAndSaveFileFromBase64Url(String url) {
|
||||||
|
|
||||||
if(!url.startsWith("data") && !url.startsWith("blob")){
|
if(!url.startsWith("data") && !url.startsWith("blob")){
|
||||||
|
@ -361,8 +378,8 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
try{
|
try{
|
||||||
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
|
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
|
||||||
|
|
||||||
String filetype = "";
|
String filetype;
|
||||||
String filename = "";
|
String filename;
|
||||||
|
|
||||||
if(url.startsWith("blob")){
|
if(url.startsWith("blob")){
|
||||||
loadUri(JavaScriptInterface.getBase64StringFromBlobUrl(url));
|
loadUri(JavaScriptInterface.getBase64StringFromBlobUrl(url));
|
||||||
|
@ -397,49 +414,30 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
//Set notification after download complete and add "click to view" action to that
|
//Set notification after download complete and add "click to view" action to that
|
||||||
String mimetype = url.substring(url.indexOf(":") + 1, url.indexOf("/"));
|
String mimetype = url.substring(url.indexOf(":") + 1, url.indexOf("/"));
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
intent.setAction(android.content.Intent.ACTION_VIEW);
|
||||||
intent.setAction(android.content.Intent.ACTION_VIEW);
|
Uri uri_temp = FileProvider.getUriForFile(mContext,mContext.getString(R.string.GENERAL_FILE_PROVIDER_AUTHORITY), file);
|
||||||
intent.setDataAndType(Uri.fromFile(file), (mimetype + "/*"));
|
intent.setDataAndType(uri_temp, (mimetype + "/*"));
|
||||||
} else {
|
|
||||||
intent.setAction(android.content.Intent.ACTION_VIEW);
|
|
||||||
Uri uri_temp = FileProvider.getUriForFile(mContext,mContext.getString(R.string.GENERAL_FILE_PROVIDER_AUTHORITY), file);
|
|
||||||
intent.setDataAndType(uri_temp, (mimetype + "/*"));
|
|
||||||
|
|
||||||
List<ResolveInfo> resInfoList = mContext.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
List<ResolveInfo> resInfoList = mContext.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||||
for (ResolveInfo resolveInfo : resInfoList) {
|
for (ResolveInfo resolveInfo : resInfoList) {
|
||||||
String packageName = resolveInfo.activityInfo.packageName;
|
String packageName = resolveInfo.activityInfo.packageName;
|
||||||
mUriPermission = uri_temp;
|
mUriPermission = uri_temp;
|
||||||
mContext.grantUriPermission(packageName, uri_temp, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
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);
|
PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
String channel_id = createNotificationChannel(mContext);
|
||||||
Notification notification = new NotificationCompat.Builder(mContext)
|
assert channel_id != null;
|
||||||
.setSmallIcon(R.xml.ic_download)
|
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext, channel_id)
|
||||||
.setContentTitle(filename)
|
.setSmallIcon(R.xml.ic_download)
|
||||||
.setContentIntent(pIntent)
|
.setContentTitle(filename)
|
||||||
.build();
|
.setContentIntent(pIntent);
|
||||||
|
|
||||||
notification.flags |= Notification.FLAG_AUTO_CANCEL;
|
notificationBuilder.setAutoCancel(true);
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int notificationId = 85851;
|
||||||
|
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
notificationManager.notify(notificationId, notificationBuilder.build());
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -461,10 +459,9 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
CharSequence channelName = "Application_name";
|
CharSequence channelName = "Application_name";
|
||||||
String channelDescription = "Application_name Alert";
|
String channelDescription = "Application_name Alert";
|
||||||
int channelImportance = NotificationManager.IMPORTANCE_DEFAULT;
|
int channelImportance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||||
boolean channelEnableVibrate = true;
|
|
||||||
NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, channelImportance);
|
NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, channelImportance);
|
||||||
notificationChannel.setDescription(channelDescription);
|
notificationChannel.setDescription(channelDescription);
|
||||||
notificationChannel.enableVibration(channelEnableVibrate);
|
notificationChannel.enableVibration(true);
|
||||||
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
assert notificationManager != null;
|
assert notificationManager != null;
|
||||||
notificationManager.createNotificationChannel(notificationChannel);
|
notificationManager.createNotificationChannel(notificationChannel);
|
||||||
|
@ -536,11 +533,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
|
|
||||||
if(mHistoryList!=null && index>=0 && index<mHistoryList.size()){
|
if(mHistoryList!=null && index>=0 && index<mHistoryList.size()){
|
||||||
event.invokeObserver(Arrays.asList(mHistoryList.get(index).getUri(),mSessionID), enums.etype.start_proxy);
|
event.invokeObserver(Arrays.asList(mHistoryList.get(index).getUri(),mSessionID), enums.etype.start_proxy);
|
||||||
|
new Handler().postDelayed(this::goBack, 100);
|
||||||
new Handler().postDelayed(() ->
|
|
||||||
{
|
|
||||||
goBack();
|
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -558,11 +551,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
|
||||||
{
|
{
|
||||||
|
|
||||||
event.invokeObserver(Arrays.asList(mHistoryList.get(index), mSessionID), enums.etype.start_proxy);
|
event.invokeObserver(Arrays.asList(mHistoryList.get(index), mSessionID), enums.etype.start_proxy);
|
||||||
|
new Handler().postDelayed(this::goForward, 100);
|
||||||
new Handler().postDelayed(() ->
|
|
||||||
{
|
|
||||||
goForward();
|
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
goForward();
|
goForward();
|
||||||
|
|
|
@ -23,14 +23,18 @@ import android.webkit.URLUtil;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
|
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
|
||||||
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
||||||
import com.darkweb.genesissearchengine.appManager.historyManager.historyController;
|
import com.darkweb.genesissearchengine.appManager.historyManager.historyController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
|
||||||
import com.darkweb.genesissearchengine.appManager.landingManager.landingController;
|
import com.darkweb.genesissearchengine.appManager.landingManager.landingController;
|
||||||
import com.darkweb.genesissearchengine.appManager.languageManager.languageController;
|
import com.darkweb.genesissearchengine.appManager.languageManager.languageController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController;
|
||||||
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController;
|
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController;
|
||||||
import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
|
import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
|
||||||
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
|
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
|
||||||
|
@ -40,7 +44,6 @@ import com.darkweb.genesissearchengine.constants.keys;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController;
|
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
import com.darkweb.genesissearchengine.helperManager.KeyboardUtils;
|
import com.darkweb.genesissearchengine.helperManager.KeyboardUtils;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
@ -57,6 +60,7 @@ import org.torproject.android.service.wrapper.orbotLocalConstants;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -82,9 +86,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
private ImageView mLoadingIcon;
|
private ImageView mLoadingIcon;
|
||||||
private TextView mLoadingText;
|
private TextView mLoadingText;
|
||||||
private AdView mBannerAds = null;
|
private AdView mBannerAds = null;
|
||||||
private ImageView mEngineLogo;
|
|
||||||
private ImageButton mGatewaySplash;
|
private ImageButton mGatewaySplash;
|
||||||
private ImageButton mSwitchEngineBack;
|
|
||||||
private LinearLayout mTopBar;
|
private LinearLayout mTopBar;
|
||||||
private ImageView mBackSplash;
|
private ImageView mBackSplash;
|
||||||
private Button mConnectButton;
|
private Button mConnectButton;
|
||||||
|
@ -94,17 +96,21 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
private boolean mPageClosed = false;
|
private boolean mPageClosed = false;
|
||||||
private boolean isKeyboardOpened = false;
|
private boolean isKeyboardOpened = false;
|
||||||
private boolean isSuggestionChanged = false;
|
private boolean isSuggestionChanged = false;
|
||||||
|
private boolean isTabMenuOpened = false;
|
||||||
|
|
||||||
/*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/
|
/*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState)
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
|
|
||||||
pluginController.getInstance().preInitialize(this);
|
pluginController.getInstance().preInitialize(this);
|
||||||
databaseController.getInstance().initialize(this);
|
databaseController.getInstance().initialize(this);
|
||||||
dataController.getInstance().initialize(this);
|
dataController.getInstance().initialize(this);
|
||||||
|
onChangeTheme();
|
||||||
status.initStatus();
|
status.initStatus();
|
||||||
pluginController.getInstance().onCreate(this);
|
pluginController.getInstance().onCreate(this);
|
||||||
|
onInitTheme();
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.home_view);
|
setContentView(R.layout.home_view);
|
||||||
|
@ -123,6 +129,29 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
initLocalLanguage();
|
initLocalLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onInitTheme(){
|
||||||
|
|
||||||
|
if(status.sTheme == enums.Theme.THEME_DARK){
|
||||||
|
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
|
}
|
||||||
|
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
|
||||||
|
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO){
|
||||||
|
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initLocalLanguage() {
|
private void initLocalLanguage() {
|
||||||
|
|
||||||
String lang = Resources.getSystem().getConfiguration().locale.getLanguage();
|
String lang = Resources.getSystem().getConfiguration().locale.getLanguage();
|
||||||
|
@ -167,7 +196,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
|
|
||||||
public void initializeConnections()
|
public void initializeConnections()
|
||||||
{
|
{
|
||||||
mGeckoView = findViewById(R.id.webLoader);
|
mGeckoView = findViewById(R.id.pWebView);
|
||||||
|
|
||||||
mProgressBar = findViewById(R.id.progressBar);
|
mProgressBar = findViewById(R.id.progressBar);
|
||||||
mSplashScreen = findViewById(R.id.splashScreen);
|
mSplashScreen = findViewById(R.id.splashScreen);
|
||||||
|
@ -186,9 +215,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mGeckoView.setSaveFromParentEnabled(false);
|
mGeckoView.setSaveFromParentEnabled(false);
|
||||||
|
|
||||||
mGeckoClient = new geckoClients();
|
mGeckoClient = new geckoClients();
|
||||||
boolean is_engine_switched = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_ENGINE_SWITCHED,false));
|
mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,(ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null), mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton);
|
||||||
|
}
|
||||||
|
|
||||||
mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,dataController.getInstance().getSuggestions(), mGatewaySplash, mTopBar, mGeckoView, mBackSplash,is_engine_switched, mConnectButton, mSwitchEngineBack);
|
public void onChangeTheme(){
|
||||||
|
if(!status.sSettingIsAppStarted){
|
||||||
|
status.sDefaultNightMode = (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initPreFixes() {
|
public void initPreFixes() {
|
||||||
|
@ -212,18 +245,18 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,isForced);
|
mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,isForced);
|
||||||
//mGeckoClient.loadURL("about:blank");
|
//mGeckoClient.loadURL("about:blank");
|
||||||
onSaveCurrentTab(mGeckoClient.getSession(),false);
|
onSaveCurrentTab(mGeckoClient.getSession(),false);
|
||||||
mHomeViewController.initTab(dataController.getInstance().getTotalTabs());
|
mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initTab(boolean isKeyboardOpened){
|
public void initTab(boolean isKeyboardOpened){
|
||||||
onNewTab(isKeyboardOpened, false);
|
onNewTab(isKeyboardOpened, false);
|
||||||
mHomeViewController.initTab(dataController.getInstance().getTotalTabs());
|
mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context base) {
|
protected void attachBaseContext(Context base) {
|
||||||
Prefs.setContext(base);
|
Prefs.setContext(base);
|
||||||
orbotLocalConstants.sHomeContext = new WeakReference<>(base);
|
orbotLocalConstants.mHomeContext = new WeakReference<>(base);
|
||||||
|
|
||||||
super.attachBaseContext(LocaleHelper.onAttach(base, Prefs.getDefaultLocale()));
|
super.attachBaseContext(LocaleHelper.onAttach(base, Prefs.getDefaultLocale()));
|
||||||
}
|
}
|
||||||
|
@ -242,14 +275,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdateJavascript(){
|
|
||||||
mGeckoView.clearFocus();
|
|
||||||
mGeckoClient.updateJavascript();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onUpdateCookies(){
|
public void initRuntimeSettings()
|
||||||
mGeckoView.clearFocus();
|
{
|
||||||
mGeckoClient.updateCookies();
|
mGeckoClient.updateSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadURL(String url){
|
public void onLoadURL(String url){
|
||||||
|
@ -257,9 +286,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mGeckoClient.loadURL(url.replace("genesis.onion","boogle.store"));
|
mGeckoClient.loadURL(url.replace("genesis.onion","boogle.store"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GeckoView getmGeckoView(){
|
||||||
|
return mGeckoView;
|
||||||
|
}
|
||||||
|
|
||||||
public void onLoadTab(geckoSession mTempSession,boolean isSessionClosed){
|
public void onLoadTab(geckoSession mTempSession,boolean isSessionClosed){
|
||||||
if(!isSessionClosed){
|
if(!isSessionClosed){
|
||||||
dataController.getInstance().moveTabToTop(mTempSession);
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession));
|
||||||
}
|
}
|
||||||
|
|
||||||
mGeckoView.releaseSession();
|
mGeckoView.releaseSession();
|
||||||
|
@ -365,7 +398,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
if(isSuggestionChanged){
|
if(isSuggestionChanged){
|
||||||
isSuggestionChanged = false;
|
isSuggestionChanged = false;
|
||||||
mHomeViewController.initializeSuggestionView(dataController.getInstance().getSuggestions());
|
mHomeViewController.initializeSuggestionView((ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null));
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true);
|
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true);
|
||||||
|
@ -401,7 +434,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
|
|
||||||
public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){
|
public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){
|
||||||
initializeGeckoView(true);
|
initializeGeckoView(true);
|
||||||
onLoadURL("about:blank");
|
if(status.sOpenURLInNewTab){
|
||||||
|
onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus));
|
||||||
|
mHomeViewController. onUpdateSearchBar(helperMethod.getDomainName(status.sSettingSearchStatus),false);
|
||||||
|
}else {
|
||||||
|
mGeckoView.releaseSession();
|
||||||
|
onLoadURL("about:blank");
|
||||||
|
mHomeViewController. onUpdateSearchBar(strings.HOME_BLANK_PAGE,false);
|
||||||
|
}
|
||||||
mHomeViewController.progressBarReset();
|
mHomeViewController.progressBarReset();
|
||||||
mHomeViewController.onNewTab(isKeyboardOpened,isKeyboardOpenedTemp);
|
mHomeViewController.onNewTab(isKeyboardOpened,isKeyboardOpenedTemp);
|
||||||
mHomeViewController.onSessionChanged();
|
mHomeViewController.onSessionChanged();
|
||||||
|
@ -409,7 +449,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
|
|
||||||
public void onOpenTabViewBoundary(View view){
|
public void onOpenTabViewBoundary(View view){
|
||||||
mNewTab.setPressed(true);
|
mNewTab.setPressed(true);
|
||||||
|
isTabMenuOpened = true;
|
||||||
helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
||||||
|
overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNotificationInvoked(String message,enums.etype e_type){
|
public void onNotificationInvoked(String message,enums.etype e_type){
|
||||||
|
@ -451,6 +493,19 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mGeckoClient.onClearSession();
|
mGeckoClient.onClearSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onClearSiteData(){
|
||||||
|
mGeckoClient.onClearSiteData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClearCache(){
|
||||||
|
mGeckoClient.onClearCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClearCookies(){
|
||||||
|
mGeckoClient.onClearCookies();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
|
@ -493,9 +548,23 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
if (mGeckoClient!=null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mGeckoClient.getUriPermission()!=null) {
|
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);
|
this.revokeUriPermission(mGeckoClient.getUriPermission(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
}
|
}
|
||||||
|
if(status.sSettingIsAppStarted){
|
||||||
|
onStartApplication(null);
|
||||||
|
}
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onAcquireDisplay(){
|
||||||
|
isTabMenuOpened = false;
|
||||||
|
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
|
||||||
|
if(model==null){
|
||||||
|
onLoadTab(model.getSession(),true);
|
||||||
|
}else {
|
||||||
|
mGeckoView.releaseSession();
|
||||||
|
mGeckoView.setSession(model.getSession());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data){
|
protected void onActivityResult(int requestCode, int resultCode, Intent data){
|
||||||
if(requestCode==1){
|
if(requestCode==1){
|
||||||
|
@ -514,7 +583,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
|
|
||||||
public void onSuggestionUpdate(){
|
public void onSuggestionUpdate(){
|
||||||
if(!mSearchbar.isFocused()){
|
if(!mSearchbar.isFocused()){
|
||||||
mHomeViewController.initializeSuggestionView(dataController.getInstance().getSuggestions());
|
mHomeViewController.initializeSuggestionView((ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null));
|
||||||
}else {
|
}else {
|
||||||
isSuggestionChanged = true;
|
isSuggestionChanged = true;
|
||||||
}
|
}
|
||||||
|
@ -560,37 +629,42 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSaveCurrentTab(geckoSession session,boolean isHardCopy){
|
public void onSaveCurrentTab(geckoSession session,boolean isHardCopy){
|
||||||
dataController.getInstance().addTab(session,isHardCopy);
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_ADD_TAB, Arrays.asList(session,isHardCopy));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCloseCurrentTab(geckoSession session){
|
public boolean onCloseCurrentTab(geckoSession session){
|
||||||
dataController.getInstance().closeTab(session);
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.CLOSE_TAB, Collections.singletonList(session));
|
||||||
tabRowModel model = dataController.getInstance().getCurrentTab();
|
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
|
||||||
|
|
||||||
session.stop();
|
session.stop();
|
||||||
session.close();
|
session.close();
|
||||||
initTabCount();
|
initTabCount();
|
||||||
|
|
||||||
if(model!=null){
|
if(model!=null){
|
||||||
onLoadTab(model.getSession(),true);
|
if(activityContextManager.getInstance().getTabController()==null || activityContextManager.getInstance().getTabController()!=null && (activityContextManager.getInstance().getTabController().isDestroyed())){
|
||||||
|
onLoadTab(model.getSession(),true);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
if(activityContextManager.getInstance().getTabController()==null || activityContextManager.getInstance().getTabController()!=null && (activityContextManager.getInstance().getTabController().isDestroyed())){
|
||||||
|
return false;
|
||||||
|
}else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initTabCount(){
|
public void initTabCount(){
|
||||||
mHomeViewController.initTab(dataController.getInstance().getTotalTabs());
|
mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseSession(){
|
public void releaseSession(){
|
||||||
mGeckoView.releaseSession();
|
mGeckoView.releaseSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadExistingTab()
|
public void loadExistingTab(){
|
||||||
{
|
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
|
||||||
tabRowModel model = dataController.getInstance().getCurrentTab();
|
|
||||||
if (model != null)
|
if (model != null)
|
||||||
{
|
{
|
||||||
onLoadTab(model.getSession(), true);
|
onLoadTab(model.getSession(), true);
|
||||||
|
@ -615,7 +689,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mSearchbar.clearFocus();
|
mSearchbar.clearFocus();
|
||||||
if (menuId == R.id.menu9) {
|
if (menuId == R.id.menu12) {
|
||||||
|
helperMethod.hideKeyboard(this);
|
||||||
|
helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
||||||
|
}
|
||||||
|
else if (menuId == R.id.menu9) {
|
||||||
helperMethod.hideKeyboard(this);
|
helperMethod.hideKeyboard(this);
|
||||||
helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
||||||
}
|
}
|
||||||
|
@ -672,7 +750,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
if (menuId == R.id.menu23) {
|
if (menuId == R.id.menu23) {
|
||||||
helperMethod.hideKeyboard(this);
|
helperMethod.hideKeyboard(this);
|
||||||
mGeckoClient.onBackPressed(false);
|
pluginController.getInstance().MessageManagerHandler(homeController.this, Collections.singletonList(mGeckoClient.getSession().getCurrentURL()),enums.etype.bookmark);
|
||||||
}
|
}
|
||||||
if (menuId == R.id.menu24) {
|
if (menuId == R.id.menu24) {
|
||||||
helperMethod.hideKeyboard(this);
|
helperMethod.hideKeyboard(this);
|
||||||
|
@ -691,6 +769,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mHomeViewController.closeMenu();
|
mHomeViewController.closeMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onOrbotLog(View view) {
|
||||||
|
helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
|
||||||
|
}
|
||||||
|
|
||||||
public class homeViewCallback implements eventObserver.eventListener{
|
public class homeViewCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -746,7 +828,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false);
|
mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.back_list_empty)){
|
else if(e_type.equals(enums.etype.back_list_empty)){
|
||||||
if(dataController.getInstance().getTotalTabs()>1){
|
if((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null)>1){
|
||||||
if(!onCloseCurrentTab(mGeckoClient.getSession())){
|
if(!onCloseCurrentTab(mGeckoClient.getSession())){
|
||||||
onNewTab(true,false);
|
onNewTab(true,false);
|
||||||
}
|
}
|
||||||
|
@ -758,10 +840,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
pluginController.getInstance().setProxy(dataToStr(data.get(0)));
|
pluginController.getInstance().setProxy(dataToStr(data.get(0)));
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.on_update_history)){
|
else if(e_type.equals(enums.etype.on_update_history)){
|
||||||
|
if(activityContextManager.getInstance().getTabController()!=null && !activityContextManager.getInstance().getTabController().isDestroyed() && !activityContextManager.getInstance().getTabController().isFinishing()){
|
||||||
|
activityContextManager.getInstance().getTabController().onTabRowChanged((int)data.get(1));
|
||||||
|
}
|
||||||
return dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_ADD_HISTORY ,data);
|
return dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_ADD_HISTORY ,data);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.on_update_suggestion)){
|
else if(e_type.equals(enums.etype.on_update_suggestion)){
|
||||||
dataController.getInstance().addSuggesion(data.get(0).toString(),data.get(2).toString());
|
dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_ADD_SUGGESTION, Arrays.asList(data.get(0).toString(),data.get(2).toString()));
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.on_page_loaded)){
|
else if(e_type.equals(enums.etype.on_page_loaded)){
|
||||||
pluginController.getInstance().logEvent(strings.EVENT_PAGE_OPENED_SUCCESS);
|
pluginController.getInstance().logEvent(strings.EVENT_PAGE_OPENED_SUCCESS);
|
||||||
|
@ -779,10 +864,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
handler.postDelayed(runnable, 1300);
|
handler.postDelayed(runnable, 1300);
|
||||||
}else {
|
}else {
|
||||||
final Handler handler = new Handler();
|
final Handler handler = new Handler();
|
||||||
Runnable runnable = () ->
|
Runnable runnable = () -> pluginController.getInstance().initializeBannerAds();
|
||||||
{
|
|
||||||
pluginController.getInstance().initializeBannerAds();
|
|
||||||
};
|
|
||||||
handler.postDelayed(runnable, 2000);
|
handler.postDelayed(runnable, 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -810,7 +892,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mHomeViewController.onFullScreenUpdate(status);
|
mHomeViewController.onFullScreenUpdate(status);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.on_update_favicon)){
|
else if(e_type.equals(enums.etype.on_update_favicon)){
|
||||||
boolean status = (Boolean)data.get(0);
|
|
||||||
dataController.getInstance().invokeImageCache(dataEnums.eImageCacheCommands.M_SET_IMAGE ,data);
|
dataController.getInstance().invokeImageCache(dataEnums.eImageCacheCommands.M_SET_IMAGE ,data);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.on_long_press_with_link)){
|
else if(e_type.equals(enums.etype.on_long_press_with_link)){
|
||||||
|
@ -834,7 +915,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
helperMethod.openPlayStore(dataToStr(data.get(0)).split("__")[1],homeController.this);
|
helperMethod.openPlayStore(dataToStr(data.get(0)).split("__")[1],homeController.this);
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.on_update_suggestion_url)){
|
else if(e_type.equals(enums.etype.on_update_suggestion_url)){
|
||||||
dataController.getInstance().updateSuggestionURL(dataToStr(data.get(0)),dataToStr(data.get(2)));
|
dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_UPDATE_SUGGESTION, Arrays.asList(dataToStr(data.get(0)),dataToStr(data.get(2))));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,22 +16,26 @@ class homeModel
|
||||||
}
|
}
|
||||||
|
|
||||||
String urlComplete(String url){
|
String urlComplete(String url){
|
||||||
try
|
if(url.equals("about:config")){
|
||||||
{
|
return url;
|
||||||
String updateUrl = helperMethod.completeURL(url);
|
}else {
|
||||||
URL host = new URL(updateUrl);
|
try
|
||||||
boolean isUrlValid = Patterns.WEB_URL.matcher(updateUrl).matches();
|
|
||||||
if(isUrlValid && host.getHost().replace("www.","").contains("."))
|
|
||||||
{
|
{
|
||||||
return null;
|
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){
|
catch (Exception ex){
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return constants.CONST_BACKEND_GOOGLE_URL.replace("$s",url.replaceAll(" ","+"));
|
return constants.CONST_BACKEND_GOOGLE_URL.replace("$s",url.replaceAll(" ","+"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import com.daimajia.androidanimations.library.Techniques;
|
import com.daimajia.androidanimations.library.Techniques;
|
||||||
|
@ -42,7 +43,6 @@ import com.google.android.gms.ads.AdSize;
|
||||||
import com.google.android.gms.ads.AdView;
|
import com.google.android.gms.ads.AdView;
|
||||||
import org.mozilla.geckoview.GeckoView;
|
import org.mozilla.geckoview.GeckoView;
|
||||||
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
||||||
//import org.torproject.android.service.wrapper.orbotLocalConstants;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -66,7 +66,6 @@ class homeViewController
|
||||||
private TextView mLoadingText;
|
private TextView mLoadingText;
|
||||||
private AdView mBannerAds = null;
|
private AdView mBannerAds = null;
|
||||||
private Handler mUpdateUIHandler = null;
|
private Handler mUpdateUIHandler = null;
|
||||||
private ImageButton mSwitchEngineBack;
|
|
||||||
private ImageButton mGatewaySplash;
|
private ImageButton mGatewaySplash;
|
||||||
private LinearLayout mTopBar;
|
private LinearLayout mTopBar;
|
||||||
private GeckoView mGeckoView;
|
private GeckoView mGeckoView;
|
||||||
|
@ -76,12 +75,10 @@ class homeViewController
|
||||||
private PopupWindow popupWindow = null;
|
private PopupWindow popupWindow = null;
|
||||||
|
|
||||||
/*Local Variables*/
|
/*Local Variables*/
|
||||||
private ValueAnimator mEngineAnimator = null;
|
|
||||||
private Callable<String> mLogs = null;
|
private Callable<String> mLogs = null;
|
||||||
private boolean isLandscape = false;
|
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, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, boolean is_triggered, Button connect_button, ImageButton switch_engine_back){
|
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, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button){
|
||||||
this.mContext = context;
|
this.mContext = context;
|
||||||
this.mProgressBar = progressBar;
|
this.mProgressBar = progressBar;
|
||||||
this.mSearchbar = searchbar;
|
this.mSearchbar = searchbar;
|
||||||
|
@ -96,7 +93,6 @@ class homeViewController
|
||||||
this.mGeckoView = gecko_view;
|
this.mGeckoView = gecko_view;
|
||||||
this.mBackSplash = backsplash;
|
this.mBackSplash = backsplash;
|
||||||
this.mConnectButton = connect_button;
|
this.mConnectButton = connect_button;
|
||||||
//this.mSwitchEngineBack = switch_engine_back;
|
|
||||||
this.mNewTab = mNewTab;
|
this.mNewTab = mNewTab;
|
||||||
this.popupWindow = null;
|
this.popupWindow = null;
|
||||||
|
|
||||||
|
@ -111,7 +107,7 @@ class homeViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTab(int count){
|
void initTab(int count){
|
||||||
mNewTab.setText(count+strings.GENERIC_EMPTY_STR);
|
mNewTab.setText((count+strings.GENERIC_EMPTY_STR));
|
||||||
|
|
||||||
YoYo.with(Techniques.FlipInX)
|
YoYo.with(Techniques.FlipInX)
|
||||||
.duration(450)
|
.duration(450)
|
||||||
|
@ -127,16 +123,22 @@ class homeViewController
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.landing_ease_blue));
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.landing_ease_blue));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
initStatusBarColor();
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||||
private void initStatusBarColor() {
|
private void initStatusBarColor() {
|
||||||
animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.landing_ease_blue_light_1));
|
animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.landing_ease_blue_light_1));
|
||||||
|
@ -237,7 +239,7 @@ class homeViewController
|
||||||
mConnectButton.setClickable(false);
|
mConnectButton.setClickable(false);
|
||||||
mGatewaySplash.setClickable(false);
|
mGatewaySplash.setClickable(false);
|
||||||
|
|
||||||
mConnectButton.animate().setDuration(300).alpha(0f).withEndAction((() -> initSplashLoading()));
|
mConnectButton.animate().setDuration(300).alpha(0f).withEndAction((this::initSplashLoading));
|
||||||
mGatewaySplash.animate().setDuration(300).alpha(0f);
|
mGatewaySplash.animate().setDuration(300).alpha(0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +264,7 @@ class homeViewController
|
||||||
new Thread(){
|
new Thread(){
|
||||||
public void run(){
|
public void run(){
|
||||||
AppCompatActivity temp_context = mContext;
|
AppCompatActivity temp_context = mContext;
|
||||||
while (!orbotLocalConstants.sIsTorInitialized || !orbotLocalConstants.sNetworkState){
|
while (!orbotLocalConstants.mIsTorInitialized || !orbotLocalConstants.mNetworkState){
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sleep(1000);
|
sleep(1000);
|
||||||
|
@ -298,8 +300,7 @@ class homeViewController
|
||||||
mTopBar.setAlpha(1);
|
mTopBar.setAlpha(1);
|
||||||
if(mSplashScreen.getAlpha()>=1)
|
if(mSplashScreen.getAlpha()>=1)
|
||||||
{
|
{
|
||||||
disableSplash = true;
|
mSplashScreen.animate().setDuration(300).setStartDelay(500).alpha(0).withEndAction((this::triggerPostUI));
|
||||||
mSplashScreen.animate().setDuration(300).setStartDelay(500).alpha(0).withEndAction((() -> triggerPostUI()));
|
|
||||||
initPostUI(false);
|
initPostUI(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -326,9 +327,7 @@ class homeViewController
|
||||||
final View popupView = layoutInflater.inflate(R.layout.popup_menu, null);
|
final View popupView = layoutInflater.inflate(R.layout.popup_menu, null);
|
||||||
|
|
||||||
|
|
||||||
int height = 0;
|
int height = helperMethod.getScreenHeight(mContext)*90 /100;
|
||||||
|
|
||||||
height = helperMethod.getScreenHeight(mContext)*90 /100;
|
|
||||||
|
|
||||||
popupWindow = new PopupWindow(
|
popupWindow = new PopupWindow(
|
||||||
popupView,
|
popupView,
|
||||||
|
@ -346,16 +345,15 @@ class homeViewController
|
||||||
}
|
}
|
||||||
popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.END,0,0);
|
popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.END,0,0);
|
||||||
|
|
||||||
|
if(!status.sCharacterEncoding){
|
||||||
|
popupView.findViewById(R.id.menu30).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
ImageButton back = popupView.findViewById(R.id.menu22);
|
ImageButton back = popupView.findViewById(R.id.menu22);
|
||||||
ImageButton forward = popupView.findViewById(R.id.menu23);
|
|
||||||
ImageButton close = popupView.findViewById(R.id.menu20);
|
ImageButton close = popupView.findViewById(R.id.menu20);
|
||||||
CheckBox desktop = popupView.findViewById(R.id.menu27);
|
CheckBox desktop = popupView.findViewById(R.id.menu27);
|
||||||
desktop.setChecked(userAgent==USER_AGENT_MODE_DESKTOP);
|
desktop.setChecked(userAgent==USER_AGENT_MODE_DESKTOP);
|
||||||
|
|
||||||
if(!canGoForward){
|
|
||||||
forward.setColorFilter(Color.argb(255, 191, 191, 191));
|
|
||||||
forward.setEnabled(false);
|
|
||||||
}
|
|
||||||
if(!canGoBack){
|
if(!canGoBack){
|
||||||
back.setEnabled(false);
|
back.setEnabled(false);
|
||||||
back.setColorFilter(Color.argb(255, 191, 191, 191));
|
back.setColorFilter(Color.argb(255, 191, 191, 191));
|
||||||
|
@ -444,7 +442,6 @@ class homeViewController
|
||||||
handlerLocalUrl = url;
|
handlerLocalUrl = url;
|
||||||
|
|
||||||
if(searchBarUpdateHandler.hasMessages(100)){
|
if(searchBarUpdateHandler.hasMessages(100)){
|
||||||
delay=0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +475,7 @@ class homeViewController
|
||||||
|
|
||||||
if(url.length()<=300){
|
if(url.length()<=300){
|
||||||
url = removeEndingSlash(url);
|
url = removeEndingSlash(url);
|
||||||
mSearchbar.setText(helperMethod.urlDesigner(url));
|
mSearchbar.setText(helperMethod.urlDesigner(url, mContext));
|
||||||
mSearchbar.selectAll();
|
mSearchbar.selectAll();
|
||||||
|
|
||||||
if(isTextSelected){
|
if(isTextSelected){
|
||||||
|
@ -502,7 +499,6 @@ class homeViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
void onNewTab(boolean keyboard,boolean isKeyboardOpen){
|
void onNewTab(boolean keyboard,boolean isKeyboardOpen){
|
||||||
onUpdateSearchBar(strings.HOME_BLANK_PAGE,false);
|
|
||||||
if(keyboard){
|
if(keyboard){
|
||||||
|
|
||||||
if(!isKeyboardOpen){
|
if(!isKeyboardOpen){
|
||||||
|
|
|
@ -5,6 +5,10 @@ import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
|
|
||||||
|
@ -23,12 +27,15 @@ class languageViewController
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
Window window = mContext.getWindow();
|
Window window = mContext.getWindow();
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mContext.getWindow().setStatusBarColor(mContext.getColor(R.color.white));
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import org.torproject.android.service.wrapper.orbotLocalConstants;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class orbotLogController extends AppCompatActivity {
|
||||||
|
|
||||||
|
/* PRIVATE VARIABLES */
|
||||||
|
private orbotLogModel mOrbotModel;
|
||||||
|
private orbotLogViewController mOrbotViewController;
|
||||||
|
|
||||||
|
private TextView mLogs;
|
||||||
|
private int mLogCounter=0;
|
||||||
|
private boolean mActivityClosed = false;
|
||||||
|
|
||||||
|
/* INITIALIZATIONS */
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
pluginController.getInstance().onCreate(this);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.orbot_log_view);
|
||||||
|
|
||||||
|
viewsInitializations();
|
||||||
|
onUpdateLogs();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void viewsInitializations() {
|
||||||
|
mLogs = findViewById(R.id.pLogs);
|
||||||
|
|
||||||
|
activityContextManager.getInstance().setOrbotLogController(this);
|
||||||
|
mOrbotViewController = new orbotLogViewController(this, mLogs);
|
||||||
|
mOrbotModel = new orbotLogModel(new orbotModelCallback());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LISTENERS */
|
||||||
|
|
||||||
|
public void onUpdateLogs(){
|
||||||
|
new Thread(){
|
||||||
|
public void run(){
|
||||||
|
while (true){
|
||||||
|
try {
|
||||||
|
if(mActivityClosed){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){
|
||||||
|
sleep(0);
|
||||||
|
}else {
|
||||||
|
sleep(400);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(orbotLocalConstants.mTorLogsHistory.size()>0){
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){
|
||||||
|
mOrbotViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(orbotLocalConstants.mTorLogsHistory.get(mLogCounter)));
|
||||||
|
mLogCounter+=1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class orbotModelCallback implements eventObserver.eventListener{
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LOCAL OVERRIDES */
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume()
|
||||||
|
{
|
||||||
|
activityContextManager.getInstance().setCurrentActivity(this);
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause()
|
||||||
|
{
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
finish();
|
||||||
|
mActivityClosed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClose(View view){
|
||||||
|
finish();
|
||||||
|
mActivityClosed = true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
|
||||||
|
|
||||||
|
public class orbotLogEnums
|
||||||
|
{
|
||||||
|
/*Settings Manager*/
|
||||||
|
public enum eOrbotLogViewCommands {
|
||||||
|
M_UPDATE_LOGS
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eOrbotLogModelCommands {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class orbotLogModel
|
||||||
|
{
|
||||||
|
/*Variable Declaration*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
orbotLogModel(eventObserver.eventListener mEvent){
|
||||||
|
this.mEvent = mEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Helper Methods*/
|
||||||
|
|
||||||
|
public void onTrigger(orbotLogEnums.eOrbotLogModelCommands pCommands, List<Object> pData){
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class orbotLogViewController
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private AppCompatActivity mContext;
|
||||||
|
private TextView mLogs;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
orbotLogViewController(AppCompatActivity pContext, TextView pLogs)
|
||||||
|
{
|
||||||
|
this.mContext = pContext;
|
||||||
|
this.mLogs = pLogs;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void onUpdateLogs(String pLogs){
|
||||||
|
mLogs.append("\n\n~ " + (pLogs));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS)){
|
||||||
|
onUpdateLogs((String) pData.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,25 +7,25 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController;
|
import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController;
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class orbotController extends AppCompatActivity {
|
public class orbotController extends AppCompatActivity {
|
||||||
|
|
||||||
/* PRIVATE VARIABLES */
|
/* PRIVATE VARIABLES */
|
||||||
|
private com.darkweb.genesissearchengine.appManager.orbotManager.orbotModel mOrbotModel;
|
||||||
|
private com.darkweb.genesissearchengine.appManager.orbotManager.orbotViewController mOrbotViewController;
|
||||||
|
|
||||||
private SwitchMaterial mBridgeSwitch;
|
private SwitchMaterial mBridgeSwitch;
|
||||||
private SwitchMaterial mVpnSwitch;
|
private SwitchMaterial mVpnSwitch;
|
||||||
private orbotViewController mOrbotViewController;
|
|
||||||
private LinearLayout mCustomizableBridgeMenu;
|
private LinearLayout mCustomizableBridgeMenu;
|
||||||
|
|
||||||
/* INITIALIZATIONS */
|
/* INITIALIZATIONS */
|
||||||
|
@ -44,18 +44,24 @@ public class orbotController extends AppCompatActivity {
|
||||||
mVpnSwitch = findViewById(R.id.pVpnSwitch);
|
mVpnSwitch = findViewById(R.id.pVpnSwitch);
|
||||||
mCustomizableBridgeMenu = findViewById(R.id.pCustomizableBridgeMenu);
|
mCustomizableBridgeMenu = findViewById(R.id.pCustomizableBridgeMenu);
|
||||||
|
|
||||||
mOrbotViewController = new orbotViewController(mBridgeSwitch, mVpnSwitch, this, mCustomizableBridgeMenu);
|
mOrbotViewController = new com.darkweb.genesissearchengine.appManager.orbotManager.orbotViewController(mBridgeSwitch, mVpnSwitch, this, mCustomizableBridgeMenu);
|
||||||
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.S_INIT_UI, Arrays.asList(status.sBridgeVPNStatus,status.sBridgeStatus));
|
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.M_INIT_UI, Arrays.asList(status.sBridgeVPNStatus,status.sBridgeStatus));
|
||||||
|
mOrbotModel = new com.darkweb.genesissearchengine.appManager.orbotManager.orbotModel(new orbotModelCallback());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LISTENERS */
|
/* LISTENERS */
|
||||||
|
|
||||||
|
public class orbotModelCallback implements eventObserver.eventListener{
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onBridgeSwitch(View view){
|
public void onBridgeSwitch(View view){
|
||||||
status.sBridgeStatus = !mBridgeSwitch.isChecked();
|
mOrbotModel.onTrigger(orbotEnums.eOrbotModelCommands.M_BRIDGE_SWITCH,Collections.singletonList(!mBridgeSwitch.isChecked()));
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_BRIDGE_ENABLES,status.sBridgeStatus));
|
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.M_UPDATE_BRIDGE_SETTINGS_VIEWS, Collections.singletonList(status.sBridgeStatus));
|
||||||
pluginController.getInstance().updateBridges(status.sBridgeStatus);
|
|
||||||
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.S_UPDATE_BRIDGE_SETTINGS_VIEWS, Collections.singletonList(status.sBridgeStatus));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openBridgeSettings(View view){
|
public void openBridgeSettings(View view){
|
||||||
|
@ -63,10 +69,8 @@ public class orbotController extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVPNSwitch(View view){
|
public void onVPNSwitch(View view){
|
||||||
status.sBridgeVPNStatus = !mVpnSwitch.isChecked();
|
mOrbotModel.onTrigger(orbotEnums.eOrbotModelCommands.M_VPN_SWITCH,Collections.singletonList(!mVpnSwitch.isChecked()));
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,status.sBridgeVPNStatus));
|
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.M_UPDATE_VPN,Collections.singletonList(status.sBridgeVPNStatus));
|
||||||
mOrbotViewController.updateVPN(status.sBridgeVPNStatus);
|
|
||||||
pluginController.getInstance().updateVPN(status.sBridgeVPNStatus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LOCAL OVERRIDES */
|
/* LOCAL OVERRIDES */
|
||||||
|
@ -75,7 +79,7 @@ public class orbotController extends AppCompatActivity {
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
activityContextManager.getInstance().setCurrentActivity(this);
|
activityContextManager.getInstance().setCurrentActivity(this);
|
||||||
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.S_INIT_POST_UI,null);
|
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.M_INIT_POST_UI,null);
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,10 @@ public class orbotEnums
|
||||||
{
|
{
|
||||||
/*Settings Manager*/
|
/*Settings Manager*/
|
||||||
public enum eOrbotViewCommands {
|
public enum eOrbotViewCommands {
|
||||||
S_UPDATE_BRIDGE_SETTINGS_VIEWS, S_INIT_POST_UI, S_INIT_UI
|
M_UPDATE_BRIDGE_SETTINGS_VIEWS, M_INIT_POST_UI, M_INIT_UI, M_UPDATE_VPN, M_UPDATE_BRIDGES
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eOrbotModelCommands {
|
||||||
|
M_BRIDGE_SWITCH, M_VPN_SWITCH
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.orbotManager;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class orbotModel
|
||||||
|
{
|
||||||
|
/*Variable Declaration*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
orbotModel(eventObserver.eventListener mEvent){
|
||||||
|
this.mEvent = mEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Helper Methods*/
|
||||||
|
|
||||||
|
public void onBridgeSwitch(boolean pStatus){
|
||||||
|
status.sBridgeStatus = pStatus;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_BRIDGE_ENABLES,status.sBridgeStatus));
|
||||||
|
pluginController.getInstance().updateBridges(status.sBridgeStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onVPNSwitch(boolean pStatus){
|
||||||
|
status.sBridgeVPNStatus = pStatus;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,status.sBridgeVPNStatus));
|
||||||
|
pluginController.getInstance().updateVPN(status.sBridgeVPNStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onTrigger(com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands pCommands, List<Object> pData){
|
||||||
|
if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_BRIDGE_SWITCH){
|
||||||
|
onBridgeSwitch((boolean) pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_VPN_SWITCH){
|
||||||
|
onVPNSwitch((boolean) pData.get(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -6,7 +6,9 @@ import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -41,34 +43,36 @@ class orbotViewController
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bridgeSettingsStatus(boolean p_status){
|
private void bridgeSettingsStatus(boolean pStatus){
|
||||||
updateBridgeViews(p_status, true);
|
updateBridgeViews(pStatus, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateVPN(boolean p_status){
|
private void updateVPN(boolean pStatus){
|
||||||
mVpnSwitch.setChecked(p_status);
|
mVpnSwitch.setChecked(pStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateBridgeViews(boolean p_status,boolean p_is_invoked){
|
private void updateBridgeViews(boolean pStatus,boolean pIsInvoked){
|
||||||
mBridgeSwitch.setChecked(p_status);
|
mBridgeSwitch.setChecked(pStatus);
|
||||||
if(p_status){
|
if(pStatus){
|
||||||
mCustomizableBridgeMenu.setClickable(true);
|
mCustomizableBridgeMenu.setClickable(true);
|
||||||
mCustomizableBridgeMenu.setAlpha(0);
|
mCustomizableBridgeMenu.setAlpha(0);
|
||||||
mCustomizableBridgeMenu.setVisibility(View.VISIBLE);
|
mCustomizableBridgeMenu.setVisibility(View.VISIBLE);
|
||||||
if(p_is_invoked){
|
if(pIsInvoked){
|
||||||
mCustomizableBridgeMenu.animate().alpha(1);
|
mCustomizableBridgeMenu.animate().alpha(1);
|
||||||
}else {
|
}else {
|
||||||
mCustomizableBridgeMenu.setAlpha(1);
|
mCustomizableBridgeMenu.setAlpha(1);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
mCustomizableBridgeMenu.setClickable(false);
|
mCustomizableBridgeMenu.setClickable(false);
|
||||||
if(p_is_invoked){
|
if(pIsInvoked){
|
||||||
mCustomizableBridgeMenu.animate().alpha(0).withEndAction(() -> mCustomizableBridgeMenu.setVisibility(View.GONE));
|
mCustomizableBridgeMenu.animate().alpha(0).withEndAction(() -> mCustomizableBridgeMenu.setVisibility(View.GONE));
|
||||||
}else {
|
}else {
|
||||||
mCustomizableBridgeMenu.setAlpha(0);
|
mCustomizableBridgeMenu.setAlpha(0);
|
||||||
|
@ -77,20 +81,26 @@ class orbotViewController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initViews(boolean p_vpn_status, boolean p_gateway_status){
|
private void initViews(boolean pVPNStatus, boolean pGatewayStatus){
|
||||||
updateBridgeViews(p_gateway_status, false);
|
updateBridgeViews(pGatewayStatus, false);
|
||||||
updateVPN(p_vpn_status);
|
updateVPN(pVPNStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTrigger(orbotEnums.eOrbotViewCommands p_commands, List<Object> p_data){
|
public void onTrigger(orbotEnums.eOrbotViewCommands pCommands, List<Object> pData){
|
||||||
if(p_commands == orbotEnums.eOrbotViewCommands.S_UPDATE_BRIDGE_SETTINGS_VIEWS){
|
if(pCommands == orbotEnums.eOrbotViewCommands.M_UPDATE_BRIDGE_SETTINGS_VIEWS){
|
||||||
bridgeSettingsStatus((boolean) p_data.get(0));
|
bridgeSettingsStatus((boolean) pData.get(0));
|
||||||
}
|
}
|
||||||
else if(p_commands == orbotEnums.eOrbotViewCommands.S_INIT_POST_UI){
|
else if(pCommands == orbotEnums.eOrbotViewCommands.M_INIT_POST_UI){
|
||||||
initPostUI();
|
initPostUI();
|
||||||
}
|
}
|
||||||
else if(p_commands == orbotEnums.eOrbotViewCommands.S_INIT_UI){
|
else if(pCommands == orbotEnums.eOrbotViewCommands.M_INIT_UI){
|
||||||
initViews((boolean)p_data.get(0),(boolean) p_data.get(1));
|
initViews((boolean)pData.get(0),(boolean) pData.get(1));
|
||||||
|
}
|
||||||
|
else if(pCommands == orbotEnums.eOrbotViewCommands.M_UPDATE_VPN){
|
||||||
|
updateVPN((boolean) pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands == orbotEnums.eOrbotViewCommands.M_UPDATE_BRIDGES){
|
||||||
|
updateBridgeViews((boolean) pData.get(1), (boolean) pData.get(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
@ -16,8 +16,8 @@ import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class settingAccessibilityController extends AppCompatActivity {
|
public class settingAccessibilityController extends AppCompatActivity {
|
||||||
|
@ -27,7 +27,6 @@ public class settingAccessibilityController extends AppCompatActivity {
|
||||||
private settingAccessibilityViewController mSettingAccessibilityViewController;
|
private settingAccessibilityViewController mSettingAccessibilityViewController;
|
||||||
private SwitchMaterial mZoom;
|
private SwitchMaterial mZoom;
|
||||||
private SwitchMaterial mVoiceInput;
|
private SwitchMaterial mVoiceInput;
|
||||||
private SwitchMaterial mFontSizeAdjustable;
|
|
||||||
private SeekBar mSeekBar;
|
private SeekBar mSeekBar;
|
||||||
private TextView mSeekBarSample;
|
private TextView mSeekBarSample;
|
||||||
private TextView mScalePercentage;
|
private TextView mScalePercentage;
|
||||||
|
@ -45,12 +44,11 @@ public class settingAccessibilityController extends AppCompatActivity {
|
||||||
public void viewsInitializations() {
|
public void viewsInitializations() {
|
||||||
mZoom = findViewById(R.id.pZoom);
|
mZoom = findViewById(R.id.pZoom);
|
||||||
mVoiceInput = findViewById(R.id.pVoiceInput);
|
mVoiceInput = findViewById(R.id.pVoiceInput);
|
||||||
mFontSizeAdjustable = findViewById(R.id.pFontSizeAdjustable);
|
|
||||||
mSeekBar = findViewById(R.id.pSeekBar);
|
mSeekBar = findViewById(R.id.pSeekBar);
|
||||||
mSeekBarSample = findViewById(R.id.pSeekBarSample);
|
mSeekBarSample = findViewById(R.id.pSeekBarSample);
|
||||||
mScalePercentage = findViewById(R.id.pScalePercentage);
|
mScalePercentage = findViewById(R.id.pScalePercentage);
|
||||||
|
|
||||||
mSettingAccessibilityViewController = new settingAccessibilityViewController(this, new settingAccessibilityController.settingAccessibilityViewCallback(), mZoom, mVoiceInput, mFontSizeAdjustable, mSeekBar, mSeekBarSample, mScalePercentage);
|
mSettingAccessibilityViewController = new settingAccessibilityViewController(this, new settingAccessibilityController.settingAccessibilityViewCallback(), mZoom, mVoiceInput, mSeekBar, mSeekBarSample, mScalePercentage);
|
||||||
mSettingAccessibilityModel = new settingAccessibilityModel(new settingAccessibilityController.settingAccessibilityModelCallback());
|
mSettingAccessibilityModel = new settingAccessibilityModel(new settingAccessibilityController.settingAccessibilityModelCallback());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,8 +86,9 @@ public class settingAccessibilityController extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
|
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
|
||||||
int percentage = ((progress+5)*10);
|
int percentage = ((progress+5)*10);
|
||||||
mSeekBarSample.setTextSize((int)((12.0*percentage)/100));
|
mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT, Collections.singletonList((int)((12.0*percentage)/100)));
|
||||||
mScalePercentage.setText(percentage+"%");
|
mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE, Collections.singletonList((percentage+ constants.CONST_PERCENTAGE_SIGN)));
|
||||||
|
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,percentage));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,percentage));
|
||||||
status.sSettingFontSize = percentage;
|
status.sSettingFontSize = percentage;
|
||||||
activityContextManager.getInstance().getHomeController().onLoadFont();
|
activityContextManager.getInstance().getHomeController().onLoadFont();
|
||||||
|
@ -123,25 +122,13 @@ public class settingAccessibilityController extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onZoomSettingUpdate(View view){
|
public void onZoomSettingUpdate(View view){
|
||||||
mSettingAccessibilityModel.onZoomSettingUpdate(!mZoom.isChecked());
|
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING, Collections.singletonList(!mZoom.isChecked()));
|
||||||
mZoom.toggle();
|
mZoom.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVoiceInputSettingUpdate(View view){
|
public void onVoiceInputSettingUpdate(View view){
|
||||||
mSettingAccessibilityModel.onVoiceInputSettingUpdate(!mVoiceInput.isChecked());
|
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING, Collections.singletonList(!mVoiceInput.isChecked()));
|
||||||
mVoiceInput.toggle();
|
mVoiceInput.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFontSizeAdjustableUpdate(View view){
|
|
||||||
mSettingAccessibilityModel.onFontSizeAdjustableUpdate(!mFontSizeAdjustable.isChecked());
|
|
||||||
mFontSizeAdjustable.toggle();
|
|
||||||
|
|
||||||
if(!mFontSizeAdjustable.isChecked()){
|
|
||||||
mSettingAccessibilityViewController.enableFontManual();
|
|
||||||
}else {
|
|
||||||
mSettingAccessibilityViewController.disableFontManual();
|
|
||||||
}
|
|
||||||
activityContextManager.getInstance().getHomeController().onLoadFont();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
|
||||||
|
|
||||||
|
class settingAccessibilityEnums
|
||||||
|
{
|
||||||
|
/*History Manager*/
|
||||||
|
public enum eAccessibilityModel {
|
||||||
|
M_UPDATE_SAMPLE_TEXT, M_UPDATE_PERCENTAGE
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eAccessibilityViewController {
|
||||||
|
M_ZOOM_SETTING, M_VOICE_INPUT_SETTING
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,14 +1,12 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
|
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
|
||||||
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
class settingAccessibilityModel
|
class settingAccessibilityModel
|
||||||
{
|
{
|
||||||
|
@ -24,21 +22,24 @@ class settingAccessibilityModel
|
||||||
|
|
||||||
/*Helper Methods*/
|
/*Helper Methods*/
|
||||||
|
|
||||||
public void onZoomSettingUpdate(boolean pStatus){
|
private void onZoomSettingUpdate(boolean pStatus){
|
||||||
status.sSettingEnableZoom = pStatus;
|
status.sSettingEnableZoom = pStatus;
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,pStatus));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,pStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVoiceInputSettingUpdate(boolean pStatus){
|
private void onVoiceInputSettingUpdate(boolean pStatus){
|
||||||
status.sSettingEnableVoiceInput = pStatus;
|
status.sSettingEnableVoiceInput = pStatus;
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,pStatus));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,pStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFontSizeAdjustableUpdate(boolean pStatus){
|
public Object onTrigger(settingAccessibilityEnums.eAccessibilityViewController pCommands, List<Object> pData){
|
||||||
status.sSettingFontAdjustable = pStatus;
|
if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING)){
|
||||||
status.sSettingFontSize = 5;
|
onZoomSettingUpdate((boolean)pData.get(0));
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,pStatus));
|
}
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,(int)status.sSettingFontSize));
|
else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING)){
|
||||||
|
onVoiceInputSettingUpdate((boolean)pData.get(0));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,15 @@ import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
class settingAccessibilityViewController
|
class settingAccessibilityViewController
|
||||||
{
|
{
|
||||||
|
@ -24,20 +25,18 @@ class settingAccessibilityViewController
|
||||||
|
|
||||||
private SwitchMaterial mZoom;
|
private SwitchMaterial mZoom;
|
||||||
private SwitchMaterial mVoiceInput;
|
private SwitchMaterial mVoiceInput;
|
||||||
private SwitchMaterial mFontSizeAdjustable;
|
|
||||||
private SeekBar mSeekBar;
|
private SeekBar mSeekBar;
|
||||||
private TextView mSeekBarSample;
|
private TextView mSeekBarSample;
|
||||||
private TextView mScalePercentage;
|
private TextView mScalePercentage;
|
||||||
|
|
||||||
/*Initializations*/
|
/*Initializations*/
|
||||||
|
|
||||||
settingAccessibilityViewController(settingAccessibilityController pContext, eventObserver.eventListener pEvent, SwitchMaterial pZoom, SwitchMaterial pVoiceInput, SwitchMaterial pFontSizeAdjustable, SeekBar pSeekBar, TextView mSeekBarSample, TextView pScalePercentage)
|
settingAccessibilityViewController(settingAccessibilityController pContext, eventObserver.eventListener pEvent, SwitchMaterial pZoom, SwitchMaterial pVoiceInput, SeekBar pSeekBar, TextView mSeekBarSample, TextView pScalePercentage)
|
||||||
{
|
{
|
||||||
this.mEvent = pEvent;
|
this.mEvent = pEvent;
|
||||||
this.mContext = pContext;
|
this.mContext = pContext;
|
||||||
this.mZoom = pZoom;
|
this.mZoom = pZoom;
|
||||||
this.mVoiceInput = pVoiceInput;
|
this.mVoiceInput = pVoiceInput;
|
||||||
this.mFontSizeAdjustable = pFontSizeAdjustable;
|
|
||||||
this.mSeekBar = pSeekBar;
|
this.mSeekBar = pSeekBar;
|
||||||
this.mSeekBarSample = mSeekBarSample;
|
this.mSeekBarSample = mSeekBarSample;
|
||||||
this.mScalePercentage = pScalePercentage;
|
this.mScalePercentage = pScalePercentage;
|
||||||
|
@ -55,8 +54,10 @@ class settingAccessibilityViewController
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,50 +74,38 @@ class settingAccessibilityViewController
|
||||||
}else {
|
}else {
|
||||||
mVoiceInput.setChecked(false);
|
mVoiceInput.setChecked(false);
|
||||||
}
|
}
|
||||||
if(status.sSettingFontAdjustable){
|
|
||||||
mFontSizeAdjustable.setChecked(true);
|
|
||||||
mSeekBar.setProgress(5);
|
|
||||||
mScalePercentage.setText("100%");
|
|
||||||
mSeekBar.setEnabled(false);
|
|
||||||
mSeekBar.setAlpha(0.5f);
|
|
||||||
mScalePercentage.setAlpha(0.5f);
|
|
||||||
mSeekBarSample.setAlpha(0.3f);
|
|
||||||
disableFontManual();
|
|
||||||
}else {
|
|
||||||
mFontSizeAdjustable.setChecked(false);
|
|
||||||
mSeekBar.setProgress((int)status.sSettingFontSize/10-5);
|
|
||||||
int percentage = (int)status.sSettingFontSize;
|
|
||||||
if(status.sSettingFontSize<100){
|
|
||||||
mSeekBarSample.setTextSize((int)(12.0*percentage)/100);
|
|
||||||
}else if(status.sSettingFontSize>100){
|
|
||||||
mSeekBarSample.setTextSize((int)(12.0*percentage)/100);
|
|
||||||
}
|
|
||||||
|
|
||||||
mScalePercentage.setText(percentage+"%");
|
mSeekBar.setProgress((int)status.sSettingFontSize/10-5);
|
||||||
mSeekBar.setAlpha(1f);
|
float percentage = status.sSettingFontSize;
|
||||||
mScalePercentage.setAlpha(1f);
|
if(status.sSettingFontSize<100){
|
||||||
mSeekBarSample.setAlpha(1f);
|
mSeekBarSample.setTextSize((int)((12*percentage)/100));
|
||||||
mSeekBar.setEnabled(true);
|
}else if(status.sSettingFontSize>100){
|
||||||
|
mSeekBarSample.setTextSize((int)((12*percentage)/100));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void disableFontManual(){
|
mScalePercentage.setText(((int)percentage + constants.CONST_PERCENTAGE_SIGN));
|
||||||
mSeekBar.setProgress(5);
|
mSeekBar.setAlpha(1f);
|
||||||
mSeekBarSample.setTextSize(12);
|
mScalePercentage.setAlpha(1f);
|
||||||
mScalePercentage.setText("100%");
|
mSeekBarSample.setAlpha(1f);
|
||||||
mSeekBar.setEnabled(false);
|
|
||||||
mSeekBar.animate().setDuration(250).alpha(0.5f);
|
|
||||||
mScalePercentage.animate().setDuration(250).alpha(0.5f);
|
|
||||||
mSeekBarSample.animate().setDuration(250).alpha(0.3f);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void enableFontManual(){
|
|
||||||
mSeekBar.setProgress(5);
|
|
||||||
mSeekBarSample.setTextSize(12);
|
|
||||||
mScalePercentage.setText("100%");
|
|
||||||
mSeekBar.setEnabled(true);
|
mSeekBar.setEnabled(true);
|
||||||
mSeekBar.animate().setDuration(250).alpha(1f);
|
|
||||||
mScalePercentage.animate().setDuration(250).alpha(1f);
|
|
||||||
mSeekBarSample.animate().setDuration(250).alpha(1f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateSampleTextSize(int pText){
|
||||||
|
mSeekBarSample.setTextSize(pText);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updatePercentage(String pText){
|
||||||
|
mScalePercentage.setText(pText);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingAccessibilityEnums.eAccessibilityModel pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT)){
|
||||||
|
updateSampleTextSize((int)pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE)){
|
||||||
|
updatePercentage((String)pData.get(0));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class settingAdvanceController extends AppCompatActivity {
|
||||||
|
|
||||||
|
/* PRIVATE VARIABLES */
|
||||||
|
private settingAdvanceModel mSettingAdvanceModel;
|
||||||
|
private settingAdvanceViewController mSettingAdvanceViewController;
|
||||||
|
private SwitchMaterial mRestoreTabs;
|
||||||
|
private SwitchMaterial mShowWebFonts;
|
||||||
|
private SwitchMaterial mAllowAutoPlay;
|
||||||
|
private ArrayList<RadioButton> mImageOption = new ArrayList<>();
|
||||||
|
private boolean mIsChanged = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
pluginController.getInstance().onCreate(this);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.setting_advance_view);
|
||||||
|
|
||||||
|
viewsInitializations();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void viewsInitializations() {
|
||||||
|
mRestoreTabs = findViewById(R.id.pRestoreTabs);
|
||||||
|
mShowWebFonts = findViewById(R.id.pShowWebFonts);
|
||||||
|
mAllowAutoPlay = findViewById(R.id.pAllowAutoPlay);
|
||||||
|
mImageOption.add(findViewById(R.id.pAdvanceImageOption1));
|
||||||
|
mImageOption.add(findViewById(R.id.pAdvanceImageOption2));
|
||||||
|
|
||||||
|
mSettingAdvanceViewController = new settingAdvanceViewController(this, new settingAdvanceViewCallback(), mRestoreTabs, mShowWebFonts, mAllowAutoPlay, mImageOption);
|
||||||
|
mSettingAdvanceModel = new settingAdvanceModel(new settingAdvanceModelCallback());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LISTENERS */
|
||||||
|
public class settingAdvanceViewCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class settingAdvanceModelCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LOCAL OVERRIDES */
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume()
|
||||||
|
{
|
||||||
|
activityContextManager.getInstance().setCurrentActivity(this);
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
int notificationStatus = pluginController.getInstance().getNotificationStatus();
|
||||||
|
if(notificationStatus==0){
|
||||||
|
pluginController.getInstance().disableTorNotification();
|
||||||
|
} else if(notificationStatus==1){
|
||||||
|
pluginController.getInstance().enableTorNotification();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause()
|
||||||
|
{
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if(mIsChanged){
|
||||||
|
pluginController.getInstance().updatePrivacy();
|
||||||
|
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*UI Redirection*/
|
||||||
|
|
||||||
|
public void onClose(View view){
|
||||||
|
if(mIsChanged){
|
||||||
|
pluginController.getInstance().updatePrivacy();
|
||||||
|
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRestoreTabs(View view) {
|
||||||
|
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB, Collections.singletonList(!mRestoreTabs.isChecked()));
|
||||||
|
mRestoreTabs.toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onShowImages(View view) {
|
||||||
|
mIsChanged = true;
|
||||||
|
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE, Collections.singletonList(null));
|
||||||
|
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE, Collections.singletonList(view));
|
||||||
|
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE, Collections.singletonList(view));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onShowWebFonts(View view) {
|
||||||
|
mIsChanged = true;
|
||||||
|
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS, Collections.singletonList(!mShowWebFonts.isChecked()));
|
||||||
|
mShowWebFonts.toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onAllowAutoPlay(View view) {
|
||||||
|
mIsChanged = true;
|
||||||
|
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_ALLOW_AUTOPLAY, Collections.singletonList(!mAllowAutoPlay.isChecked()));
|
||||||
|
mAllowAutoPlay.toggle();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
|
||||||
|
|
||||||
|
class settingAdvanceEnums
|
||||||
|
{
|
||||||
|
/*History Manager*/
|
||||||
|
public enum eAdvanceModel {
|
||||||
|
M_RESTORE_TAB, M_SHOW_IMAGE, M_SHOW_WEB_FONTS, M_ALLOW_AUTOPLAY
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eAdvanceViewController {
|
||||||
|
M_CLEAR_IMAGE, M_SET_IMAGE
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class settingAdvanceModel
|
||||||
|
{
|
||||||
|
/*Variable Declaration*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
settingAdvanceModel(eventObserver.eventListener mEvent){
|
||||||
|
this.mEvent = mEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Helper Methods*/
|
||||||
|
|
||||||
|
private void onRestoreTabs(boolean pStatus) {
|
||||||
|
status.sRestoreTabs = pStatus;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,pStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onShowImages(View pView) {
|
||||||
|
|
||||||
|
if(pView.getId() == R.id.pAdvanceOption1){
|
||||||
|
status.sShowImages = 0;
|
||||||
|
}
|
||||||
|
else if(pView.getId() == R.id.pAdvanceOption2){
|
||||||
|
status.sShowImages = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,status.sShowImages));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onShowWebFonts(boolean pStatus) {
|
||||||
|
status.sShowWebFonts = pStatus;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,pStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onAllowAutoPlay(boolean pStatus) {
|
||||||
|
status.sAutoPlay = pStatus;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_AUTO_PLAY,pStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingAdvanceEnums.eAdvanceModel pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB)){
|
||||||
|
onRestoreTabs((boolean)pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE)){
|
||||||
|
onShowImages((View)pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS)){
|
||||||
|
onShowWebFonts((boolean)pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_ALLOW_AUTOPLAY)){
|
||||||
|
onAllowAutoPlay((boolean)pData.get(0));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class settingAdvanceViewController
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
private AppCompatActivity mContext;
|
||||||
|
|
||||||
|
private SwitchMaterial mRestoreTabs;
|
||||||
|
private SwitchMaterial mShowWebFonts;
|
||||||
|
private SwitchMaterial mAllowAutoPlay;
|
||||||
|
private ArrayList<RadioButton> mImageOption;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
settingAdvanceViewController(settingAdvanceController pContext, eventObserver.eventListener pEvent, SwitchMaterial pRestoreTabs, SwitchMaterial pShowWebFonts, SwitchMaterial pAllowAutoPlay, ArrayList<RadioButton> pImageOption)
|
||||||
|
{
|
||||||
|
this.mEvent = pEvent;
|
||||||
|
this.mContext = pContext;
|
||||||
|
this.mRestoreTabs = pRestoreTabs;
|
||||||
|
this.mShowWebFonts = pShowWebFonts;
|
||||||
|
this.mAllowAutoPlay = pAllowAutoPlay;
|
||||||
|
this.mImageOption = pImageOption;
|
||||||
|
|
||||||
|
initViews();
|
||||||
|
initPostUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViews()
|
||||||
|
{
|
||||||
|
if(status.sRestoreTabs){
|
||||||
|
mRestoreTabs.setChecked(true);
|
||||||
|
}else {
|
||||||
|
mRestoreTabs.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(status.sShowWebFonts){
|
||||||
|
mShowWebFonts.setChecked(true);
|
||||||
|
}else {
|
||||||
|
mShowWebFonts.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(status.sAutoPlay){
|
||||||
|
mAllowAutoPlay.setChecked(true);
|
||||||
|
}else {
|
||||||
|
mAllowAutoPlay.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearImageOptions();
|
||||||
|
if(status.sShowImages == 0){
|
||||||
|
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mImageOption.get(0).setChecked(true);
|
||||||
|
}
|
||||||
|
else if(status.sShowImages == 2){
|
||||||
|
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mImageOption.get(1).setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearImageOptions(){
|
||||||
|
mImageOption.get(0).setChecked(false);
|
||||||
|
mImageOption.get(1).setChecked(false);
|
||||||
|
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
|
||||||
|
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setImageOptions(View pView){
|
||||||
|
clearImageOptions();
|
||||||
|
if(pView.getId() == R.id.pAdvanceOption1){
|
||||||
|
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mImageOption.get(0).setChecked(true);
|
||||||
|
}
|
||||||
|
else if(pView.getId() == R.id.pAdvanceOption2){
|
||||||
|
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mImageOption.get(1).setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingAdvanceEnums.eAdvanceViewController pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE)){
|
||||||
|
clearImageOptions();
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE)){
|
||||||
|
setImageOptions((View) pData.get(0));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,167 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
||||||
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
import com.darkweb.genesissearchengine.constants.sql;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class settingClearController extends AppCompatActivity {
|
||||||
|
|
||||||
|
/* PRIVATE VARIABLES */
|
||||||
|
private settingClearModel mSettingClearModel;
|
||||||
|
private settingClearViewController mSettingClearViewController;
|
||||||
|
private ArrayList<CheckBox> mCheckBoxList = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.setting_clear_view);
|
||||||
|
|
||||||
|
pluginController.getInstance().onCreate(this);
|
||||||
|
viewsInitializations();
|
||||||
|
initializeListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void viewsInitializations() {
|
||||||
|
mCheckBoxList.add(findViewById(R.id.pClearChecked_1));
|
||||||
|
mCheckBoxList.add(findViewById(R.id.pClearChecked_2));
|
||||||
|
mCheckBoxList.add(findViewById(R.id.pClearChecked_3));
|
||||||
|
mCheckBoxList.add(findViewById(R.id.pClearChecked_4));
|
||||||
|
mCheckBoxList.add(findViewById(R.id.pClearChecked_6));
|
||||||
|
mCheckBoxList.add(findViewById(R.id.pClearChecked_7));
|
||||||
|
mCheckBoxList.add(findViewById(R.id.pClearChecked_8));
|
||||||
|
mCheckBoxList.add(findViewById(R.id.pClearChecked_9));
|
||||||
|
|
||||||
|
mSettingClearViewController = new settingClearViewController(this, new settingClearController.settingClearViewCallback(), mCheckBoxList);
|
||||||
|
mSettingClearModel = new settingClearModel(new settingClearController.settingClearModelCallback());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LISTENERS */
|
||||||
|
public class settingClearViewCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class settingClearModelCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initializeListeners(){
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCheckBoxTriggered(View view){
|
||||||
|
mSettingClearViewController.onTrigger(settingClearEnums.eClearViewController.M_CHECK_INVOKE, Arrays.asList(view.getTag(),!mCheckBoxList.get(Integer.parseInt(view.getTag().toString())).isChecked()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClearData(View view){
|
||||||
|
try{
|
||||||
|
if(mCheckBoxList.get(0).isChecked()){
|
||||||
|
mCheckBoxList.get(0).setChecked(false);
|
||||||
|
mCheckBoxList.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
|
||||||
|
activityContextManager.getInstance().getHomeController().onClearSession();
|
||||||
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
|
||||||
|
activityContextManager.getInstance().getHomeController().initTab(false);
|
||||||
|
}
|
||||||
|
if(mCheckBoxList.get(1).isChecked()){
|
||||||
|
mCheckBoxList.get(1).setChecked(false);
|
||||||
|
mCheckBoxList.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
|
||||||
|
databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null);
|
||||||
|
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null);
|
||||||
|
}
|
||||||
|
if(mCheckBoxList.get(2).isChecked()){
|
||||||
|
mCheckBoxList.get(2).setChecked(false);
|
||||||
|
mCheckBoxList.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
|
||||||
|
databaseController.getInstance().execSQL(sql.SQL_CLEAR_BOOKMARK,null);
|
||||||
|
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,null);
|
||||||
|
}
|
||||||
|
if(mCheckBoxList.get(3).isChecked()){
|
||||||
|
mCheckBoxList.get(3).setChecked(false);
|
||||||
|
mCheckBoxList.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
|
||||||
|
activityContextManager.getInstance().getHomeController().onClearCache();
|
||||||
|
}
|
||||||
|
if(mCheckBoxList.get(4).isChecked()){
|
||||||
|
mCheckBoxList.get(4).setChecked(false);
|
||||||
|
mCheckBoxList.get(4).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
|
||||||
|
dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_CLEAR_SUGGESTION ,null);
|
||||||
|
}
|
||||||
|
if(mCheckBoxList.get(5).isChecked()){
|
||||||
|
mCheckBoxList.get(5).setChecked(false);
|
||||||
|
mCheckBoxList.get(5).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
|
||||||
|
activityContextManager.getInstance().getHomeController().onClearSiteData();
|
||||||
|
}
|
||||||
|
if(mCheckBoxList.get(6).isChecked()){
|
||||||
|
mCheckBoxList.get(6).setChecked(false);
|
||||||
|
mCheckBoxList.get(6).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
|
||||||
|
activityContextManager.getInstance().getHomeController().onClearSession();
|
||||||
|
}
|
||||||
|
if(mCheckBoxList.get(7).isChecked()){
|
||||||
|
mCheckBoxList.get(7).setChecked(false);
|
||||||
|
mCheckBoxList.get(7).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
|
||||||
|
activityContextManager.getInstance().getHomeController().onClearCookies();
|
||||||
|
}
|
||||||
|
if(mCheckBoxList.get(8).isChecked()){
|
||||||
|
mCheckBoxList.get(8).setChecked(false);
|
||||||
|
mCheckBoxList.get(8).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_CLEAR_PREFS, null);
|
||||||
|
status.initStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
|
||||||
|
pluginController.getInstance().MessageManagerHandler(this, null, enums.etype.data_cleared);
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LOCAL OVERRIDES */
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume()
|
||||||
|
{
|
||||||
|
activityContextManager.getInstance().setCurrentActivity(this);
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause()
|
||||||
|
{
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*UI Redirection*/
|
||||||
|
public void onClose(View view){
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
|
||||||
|
|
||||||
|
class settingClearEnums
|
||||||
|
{
|
||||||
|
/*History Manager*/
|
||||||
|
public enum eClearModel {
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eClearViewController {
|
||||||
|
M_CHECK_INVOKE
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
|
||||||
|
class settingClearModel
|
||||||
|
{
|
||||||
|
/*Variable Declaration*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
settingClearModel(eventObserver.eventListener mEvent){
|
||||||
|
this.mEvent = mEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Helper Methods*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class settingClearViewController
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
private AppCompatActivity mContext;
|
||||||
|
private ArrayList<CheckBox> mCheckBoxList;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
settingClearViewController(settingClearController pContext, eventObserver.eventListener pEvent, ArrayList<CheckBox> pCheckBoxList)
|
||||||
|
{
|
||||||
|
this.mEvent = pEvent;
|
||||||
|
this.mContext = pContext;
|
||||||
|
this.mCheckBoxList = pCheckBoxList;
|
||||||
|
|
||||||
|
initViews();
|
||||||
|
initPostUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPostUI(){
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
Window window = mContext.getWindow();
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||||
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViews()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onClearCheckbox(int pIndex, boolean pStatus){
|
||||||
|
mCheckBoxList.get(pIndex).setChecked(pStatus);
|
||||||
|
if(pStatus){
|
||||||
|
mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint)));
|
||||||
|
}else {
|
||||||
|
mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint_default)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingClearEnums.eClearViewController pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingClearEnums.eClearViewController.M_CHECK_INVOKE)){
|
||||||
|
onClearCheckbox(Integer.parseInt(pData.get(0).toString()), (boolean)pData.get(1));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,170 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
|
||||||
|
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.languageManager.languageController;
|
||||||
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
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.material.switchmaterial.SwitchMaterial;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class settingGeneralController extends AppCompatActivity {
|
||||||
|
|
||||||
|
/* PRIVATE VARIABLES */
|
||||||
|
private settingGeneralModel mSettingGeneralModel;
|
||||||
|
private settingGeneralViewController mSettingGeneralViewController;
|
||||||
|
private SwitchMaterial mFullScreenMode;
|
||||||
|
private SwitchMaterial mOpenURLInNewTab;
|
||||||
|
private RadioButton mThemeLight;
|
||||||
|
private RadioButton mThemeDark;
|
||||||
|
private RadioButton mThemeDefault;
|
||||||
|
private TextView mHomePageText;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
pluginController.getInstance().onCreate(this);
|
||||||
|
onInitTheme();
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.setting_general_view);
|
||||||
|
|
||||||
|
viewsInitializations();
|
||||||
|
initializeListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void viewsInitializations() {
|
||||||
|
|
||||||
|
mFullScreenMode = findViewById(R.id.pFullScreenMode);
|
||||||
|
mThemeLight = findViewById(R.id.pThemeLight);
|
||||||
|
mThemeDark = findViewById(R.id.pThemeDark);
|
||||||
|
mThemeDefault = findViewById(R.id.pThemeDefault);
|
||||||
|
mHomePageText = findViewById(R.id.pHomePageText);
|
||||||
|
mOpenURLInNewTab = findViewById(R.id.pOpenURLInNewTab);
|
||||||
|
|
||||||
|
mSettingGeneralViewController = new settingGeneralViewController(this, new settingGeneralViewCallback(), mFullScreenMode, mThemeLight, mThemeDark, mThemeDefault, mHomePageText, mOpenURLInNewTab);
|
||||||
|
mSettingGeneralModel = new settingGeneralModel(new settingGeneralModelCallback());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onInitTheme(){
|
||||||
|
|
||||||
|
if(status.sTheme == enums.Theme.THEME_DARK){
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
|
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
}else {
|
||||||
|
if(!status.sDefaultNightMode){
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
}else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LISTENERS */
|
||||||
|
public class settingGeneralViewCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
if(enums.etype.M_RESET_THEME_INVOKED_BACK.equals(e_type))
|
||||||
|
{
|
||||||
|
helperMethod.restartActivity(getIntent(), settingGeneralController.this);
|
||||||
|
new Handler().postDelayed(() -> {
|
||||||
|
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
|
||||||
|
activityContextManager.getInstance().getSettingController().applyTheme();
|
||||||
|
}, 150);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class settingGeneralModelCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initializeListeners(){
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LOCAL OVERRIDES */
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume()
|
||||||
|
{
|
||||||
|
activityContextManager.getInstance().setCurrentActivity(this);
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause()
|
||||||
|
{
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*UI Redirection*/
|
||||||
|
public void onClose(View view){
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onManageLanguage(View view) {
|
||||||
|
helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, this,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onFullScreenBrowsing(View view){
|
||||||
|
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING, Collections.singletonList(!mFullScreenMode.isChecked()));
|
||||||
|
mFullScreenMode.toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSelectTheme(View view){
|
||||||
|
if(view.getId() == R.id.pOption1){
|
||||||
|
if(status.sTheme != enums.Theme.THEME_DARK) {
|
||||||
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
|
||||||
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DARK));
|
||||||
|
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DARK));
|
||||||
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DARK));
|
||||||
|
}
|
||||||
|
}else if(view.getId() == R.id.pOption2) {
|
||||||
|
if(status.sTheme != enums.Theme.THEME_LIGHT) {
|
||||||
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
|
||||||
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT));
|
||||||
|
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT));
|
||||||
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_LIGHT));
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if(status.sTheme != enums.Theme.THEME_DEFAULT) {
|
||||||
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
|
||||||
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT));
|
||||||
|
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT));
|
||||||
|
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DEFAULT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onURLInNewTab(View view) {
|
||||||
|
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB, Collections.singletonList(!mOpenURLInNewTab.isChecked()));
|
||||||
|
mOpenURLInNewTab.toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
|
||||||
|
|
||||||
|
class settingGeneralEnums
|
||||||
|
{
|
||||||
|
/*History Manager*/
|
||||||
|
public enum eGeneralModel {
|
||||||
|
M_FULL_SCREEN_BROWSING, M_SELECT_THEME, M_URL_NEW_TAB
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eGeneralViewController {
|
||||||
|
M_SET_THEME, M_RESET_THEME, M_UPDATE_THEME_BLOCKER
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class settingGeneralModel
|
||||||
|
{
|
||||||
|
/*Variable Declaration*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
settingGeneralModel(eventObserver.eventListener mEvent){
|
||||||
|
this.mEvent = mEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Helper Methods*/
|
||||||
|
private void onFullScreenBrowsing(boolean pStatus){
|
||||||
|
status.sFullScreenBrowsing = pStatus;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,pStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onSelectThemeLight(int pStatus){
|
||||||
|
status.sTheme = pStatus;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,pStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onURLInNewTab(boolean pStatus) {
|
||||||
|
status.sOpenURLInNewTab = pStatus;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,pStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingGeneralEnums.eGeneralModel pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING)){
|
||||||
|
onFullScreenBrowsing((boolean)pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_SELECT_THEME)){
|
||||||
|
onSelectThemeLight((int)pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB)){
|
||||||
|
onURLInNewTab((boolean)pData.get(0));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,140 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class settingGeneralViewController
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
private AppCompatActivity mContext;
|
||||||
|
private SwitchMaterial mFullScreenMode;
|
||||||
|
private SwitchMaterial mOpenURLInNewTab;
|
||||||
|
private RadioButton mThemeLight;
|
||||||
|
private RadioButton mThemeDark;
|
||||||
|
private RadioButton mThemeDefault;
|
||||||
|
private TextView mHomePageText;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
|
||||||
|
settingGeneralViewController(settingGeneralController pContext, eventObserver.eventListener pEvent, SwitchMaterial pFullScreenMode, RadioButton pThemeLight, RadioButton pThemeDark, RadioButton pThemeDefault, TextView pHomePageText, SwitchMaterial pOpenURLInNewTab)
|
||||||
|
{
|
||||||
|
this.mEvent = pEvent;
|
||||||
|
this.mContext = pContext;
|
||||||
|
this.mFullScreenMode = pFullScreenMode;
|
||||||
|
this.mThemeLight = pThemeLight;
|
||||||
|
this.mThemeDark = pThemeDark;
|
||||||
|
this.mThemeDefault = pThemeDefault;
|
||||||
|
this.mHomePageText = pHomePageText;
|
||||||
|
this.mOpenURLInNewTab = pOpenURLInNewTab;
|
||||||
|
|
||||||
|
initViews();
|
||||||
|
initPostUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initPostUI(){
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
Window window = mContext.getWindow();
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||||
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViews()
|
||||||
|
{
|
||||||
|
resetThemeSelection();
|
||||||
|
|
||||||
|
if(status.sTheme == enums.Theme.THEME_LIGHT){
|
||||||
|
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mThemeLight.setChecked(true);
|
||||||
|
}else if(status.sTheme == enums.Theme.THEME_DARK){
|
||||||
|
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mThemeDark.setChecked(true);
|
||||||
|
}else{
|
||||||
|
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mThemeDefault.setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(status.sFullScreenBrowsing){
|
||||||
|
mFullScreenMode.setChecked(true);
|
||||||
|
}else {
|
||||||
|
mFullScreenMode.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(status.sOpenURLInNewTab){
|
||||||
|
mOpenURLInNewTab.setChecked(true);
|
||||||
|
}else {
|
||||||
|
mOpenURLInNewTab.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
mHomePageText.setText(helperMethod.getDomainName(status.sSettingSearchStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateThemeChanger(int pStatus){
|
||||||
|
mEvent.invokeObserver(Collections.singletonList(status.sTheme), enums.etype.M_RESET_THEME_INVOKED_BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetThemeSelection(){
|
||||||
|
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
|
||||||
|
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
|
||||||
|
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
|
||||||
|
mThemeDark.setChecked(false);
|
||||||
|
mThemeLight.setChecked(false);
|
||||||
|
mThemeDefault.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setThemeLight(int pTheme){
|
||||||
|
if(pTheme == enums.Theme.THEME_LIGHT){
|
||||||
|
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mThemeLight.setChecked(true);
|
||||||
|
}else if(pTheme == enums.Theme.THEME_DARK){
|
||||||
|
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mThemeDark.setChecked(true);
|
||||||
|
}else{
|
||||||
|
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mThemeDefault.setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingGeneralEnums.eGeneralViewController pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_SET_THEME)){
|
||||||
|
setThemeLight((int)pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_RESET_THEME)){
|
||||||
|
resetThemeSelection();
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER)){
|
||||||
|
updateThemeChanger((int)pData.get(0));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
|
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class settingNotificationController extends AppCompatActivity {
|
public class settingNotificationController extends AppCompatActivity {
|
||||||
|
@ -90,14 +90,11 @@ public class settingNotificationController extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onOpenNotificationSettings(View view){
|
public void onOpenNotificationSettings(View view){
|
||||||
Intent intent = new Intent();
|
helperMethod.openNotification(this);
|
||||||
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
|
|
||||||
intent.putExtra("android.provider.extra.APP_PACKAGE", getPackageName());
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSaveLocalNotificationSettings(View view){
|
public void onSaveLocalNotificationSettings(View view){
|
||||||
mSettingNotificationModel.updateLocalNotification(!mNotificationManual.isChecked());
|
mSettingNotificationModel.onTrigger(settingNotificationEnums.eNotificationModel.M_UPDATE_LOCAL_NOTIFICATION, Collections.singletonList(!mNotificationManual.isChecked()));
|
||||||
mNotificationManual.toggle();
|
mNotificationManual.toggle();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
|
||||||
|
|
||||||
|
class settingNotificationEnums
|
||||||
|
{
|
||||||
|
/*History Manager*/
|
||||||
|
public enum eNotificationModel {
|
||||||
|
M_UPDATE_LOCAL_NOTIFICATION
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eNotificationViewController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,18 +1,13 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
|
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
|
|
||||||
|
|
||||||
class settingNotificationModel
|
class settingNotificationModel
|
||||||
{
|
{
|
||||||
|
@ -29,7 +24,7 @@ class settingNotificationModel
|
||||||
|
|
||||||
/*Helper Methods*/
|
/*Helper Methods*/
|
||||||
|
|
||||||
public void updateLocalNotification(boolean pStatus){
|
private void updateLocalNotification(boolean pStatus){
|
||||||
|
|
||||||
int mStatus = pStatus ? 1 : 0;
|
int mStatus = pStatus ? 1 : 0;
|
||||||
status.sBridgeNotificationManual = mStatus;
|
status.sBridgeNotificationManual = mStatus;
|
||||||
|
@ -46,5 +41,11 @@ class settingNotificationModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingNotificationEnums.eNotificationModel pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingNotificationEnums.eNotificationModel.M_UPDATE_LOCAL_NOTIFICATION)){
|
||||||
|
updateLocalNotification((boolean)pData.get(0));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,19 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
|
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.SeekBar;
|
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController;
|
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
|
||||||
import static com.darkweb.genesissearchengine.constants.status.sSettingHistoryStatus;
|
|
||||||
import static com.darkweb.genesissearchengine.constants.status.sSettingJavaStatus;
|
|
||||||
|
|
||||||
class settingNotificationViewController
|
class settingNotificationViewController
|
||||||
{
|
{
|
||||||
/*Private Variables*/
|
/*Private Variables*/
|
||||||
|
@ -62,8 +53,10 @@ class settingNotificationViewController
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class settingPrivacyController extends AppCompatActivity {
|
||||||
|
|
||||||
|
/* PRIVATE VARIABLES */
|
||||||
|
private settingPrivacyModel mSettingPrivacyModel;
|
||||||
|
private settingPrivacyViewController mSettingPrivacyViewController;
|
||||||
|
private SwitchMaterial mJavaScript;
|
||||||
|
private SwitchMaterial mDoNotTrack;
|
||||||
|
private SwitchMaterial mTrackingProtection;
|
||||||
|
private SwitchMaterial mClearDataOnExit;
|
||||||
|
private ArrayList<RadioButton> mCookie = new ArrayList<>();
|
||||||
|
private boolean mSettingChanged = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
pluginController.getInstance().onCreate(this);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.setting_privacy_view);
|
||||||
|
|
||||||
|
viewsInitializations();
|
||||||
|
initializeListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void viewsInitializations() {
|
||||||
|
mJavaScript = findViewById(R.id.pJavascript);
|
||||||
|
mDoNotTrack = findViewById(R.id.pDoNotTrack);
|
||||||
|
mTrackingProtection = findViewById(R.id.pTrackingProtection);
|
||||||
|
mClearDataOnExit = findViewById(R.id.pClearDataOnExit);
|
||||||
|
mCookie.add(findViewById(R.id.pCookieRadioOption1));
|
||||||
|
mCookie.add(findViewById(R.id.pCookieRadioOption2));
|
||||||
|
mCookie.add(findViewById(R.id.pCookieRadioOption3));
|
||||||
|
mCookie.add(findViewById(R.id.pCookieRadioOption4));
|
||||||
|
|
||||||
|
mSettingPrivacyViewController = new settingPrivacyViewController(this, new settingPrivacyController.settingAccessibilityViewCallback(), mJavaScript, mDoNotTrack, mTrackingProtection, mClearDataOnExit, mCookie);
|
||||||
|
mSettingPrivacyModel = new settingPrivacyModel(new settingPrivacyController.settingAccessibilityModelCallback());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LISTENERS */
|
||||||
|
public class settingAccessibilityViewCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class settingAccessibilityModelCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initializeListeners(){
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LOCAL OVERRIDES */
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume()
|
||||||
|
{
|
||||||
|
if(mSettingChanged){
|
||||||
|
activityContextManager.getInstance().setCurrentActivity(this);
|
||||||
|
}
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause()
|
||||||
|
{
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if(mSettingChanged){
|
||||||
|
activityContextManager.getInstance().setCurrentActivity(this);
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*UI Redirection*/
|
||||||
|
public void onClose(View view){
|
||||||
|
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onJavaScript(View view){
|
||||||
|
mSettingChanged = true;
|
||||||
|
mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_JAVASCRIPT, Collections.singletonList(!status.sSettingJavaStatus));
|
||||||
|
mJavaScript.toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDoNotTrack(View view){
|
||||||
|
mSettingChanged = true;
|
||||||
|
mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.SET_DONOT_TRACK, Collections.singletonList(!status.sStatusDoNotTrack));
|
||||||
|
mDoNotTrack.toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTrackingProtection(View view){
|
||||||
|
mSettingChanged = true;
|
||||||
|
mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.SET_TRACKING_PROTECTION, Collections.singletonList(!status.sSettingTrackingProtection));
|
||||||
|
mTrackingProtection.toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCookies(View view){
|
||||||
|
mSettingChanged = true;
|
||||||
|
mSettingPrivacyViewController.onTrigger(settingPrivacyEnums.ePrivacyViewController.SET_COOKIE_STATUS, Collections.singletonList(view));
|
||||||
|
mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.SET_COOKIES, Collections.singletonList(view));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClearPrivateData(View view){
|
||||||
|
mSettingChanged = true;
|
||||||
|
mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.SET_CLEAR_PRIVATE_DATA, Collections.singletonList(!status.sClearOnExit));
|
||||||
|
mClearDataOnExit.toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager;
|
||||||
|
|
||||||
|
class settingPrivacyEnums
|
||||||
|
{
|
||||||
|
/*History Manager*/
|
||||||
|
public enum ePrivacyModel {
|
||||||
|
M_SET_JAVASCRIPT, SET_DONOT_TRACK, SET_TRACKING_PROTECTION, SET_COOKIES, SET_CLEAR_PRIVATE_DATA
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ePrivacyViewController {
|
||||||
|
SET_COOKIE_STATUS
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_ALL;
|
||||||
|
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
|
||||||
|
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NONE;
|
||||||
|
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS;
|
||||||
|
|
||||||
|
class settingPrivacyModel
|
||||||
|
{
|
||||||
|
/*Variable Declaration*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
settingPrivacyModel(eventObserver.eventListener mEvent){
|
||||||
|
this.mEvent = mEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Helper Methods*/
|
||||||
|
|
||||||
|
private void onJavaScript(boolean pStatus){
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,pStatus));
|
||||||
|
status.sSettingJavaStatus = pStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onDoNotTrack(boolean pStatus){
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,pStatus));
|
||||||
|
status.sStatusDoNotTrack = pStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onTrackingProtection(boolean pStatus){
|
||||||
|
status.sSettingTrackingProtection = pStatus;
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TRACKING_PROTECTION,pStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onCookies(View pView){
|
||||||
|
if(pView.getId() == R.id.pCookieOption1){
|
||||||
|
status.sSettingCookieStatus = ACCEPT_ALL;
|
||||||
|
}
|
||||||
|
if(pView.getId() == R.id.pCookieOption2){
|
||||||
|
status.sSettingCookieStatus = ACCEPT_NON_TRACKERS;
|
||||||
|
}
|
||||||
|
if(pView.getId() == R.id.pCookieOption3){
|
||||||
|
status.sSettingCookieStatus = ACCEPT_FIRST_PARTY;
|
||||||
|
}
|
||||||
|
if(pView.getId() == R.id.pCookieOption4){
|
||||||
|
status.sSettingCookieStatus = ACCEPT_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,status.sSettingCookieStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onClearPrivateData(boolean pStatus){
|
||||||
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,pStatus));
|
||||||
|
status.sClearOnExit = pStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingPrivacyEnums.ePrivacyModel pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_JAVASCRIPT)){
|
||||||
|
onJavaScript((boolean)pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.SET_DONOT_TRACK)){
|
||||||
|
onDoNotTrack((boolean)pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.SET_TRACKING_PROTECTION)){
|
||||||
|
onTrackingProtection((boolean)pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.SET_COOKIES)){
|
||||||
|
onCookies((View) pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.SET_CLEAR_PRIVATE_DATA)){
|
||||||
|
onClearPrivateData((Boolean) pData.get(0));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,148 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager;
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_ALL;
|
||||||
|
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
|
||||||
|
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NONE;
|
||||||
|
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS;
|
||||||
|
|
||||||
|
class settingPrivacyViewController
|
||||||
|
{
|
||||||
|
/*Private Variables*/
|
||||||
|
|
||||||
|
private eventObserver.eventListener mEvent;
|
||||||
|
private AppCompatActivity mContext;
|
||||||
|
private SwitchMaterial mJavaScript;
|
||||||
|
private SwitchMaterial mDoNotTrack;
|
||||||
|
private SwitchMaterial mTrackingProtection;
|
||||||
|
private SwitchMaterial mClearDataOnExit;
|
||||||
|
private ArrayList<RadioButton> mCookie;
|
||||||
|
|
||||||
|
/*Initializations*/
|
||||||
|
|
||||||
|
settingPrivacyViewController(settingPrivacyController pContext, eventObserver.eventListener pEvent, SwitchMaterial pJavaScript, SwitchMaterial pDoNotTrack, SwitchMaterial pTrackingProtection, SwitchMaterial pClearDataOnExit, ArrayList<RadioButton> pCookie)
|
||||||
|
{
|
||||||
|
this.mEvent = pEvent;
|
||||||
|
this.mContext = pContext;
|
||||||
|
this.mJavaScript = pJavaScript;
|
||||||
|
this.mTrackingProtection = pTrackingProtection;
|
||||||
|
this.mClearDataOnExit = pClearDataOnExit;
|
||||||
|
this.mCookie = pCookie;
|
||||||
|
this.mDoNotTrack = pDoNotTrack;
|
||||||
|
|
||||||
|
initViews();
|
||||||
|
initPostUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPostUI(){
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
Window window = mContext.getWindow();
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||||
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initViews(){
|
||||||
|
if(status.sSettingJavaStatus){
|
||||||
|
this.mJavaScript.setChecked(true);
|
||||||
|
}else{
|
||||||
|
this.mJavaScript.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(status.sClearOnExit){
|
||||||
|
this.mClearDataOnExit.setChecked(true);
|
||||||
|
}else{
|
||||||
|
this.mClearDataOnExit.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(status.sSettingTrackingProtection){
|
||||||
|
this.mTrackingProtection.setChecked(true);
|
||||||
|
}else{
|
||||||
|
this.mTrackingProtection.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(status.sStatusDoNotTrack){
|
||||||
|
this.mDoNotTrack.setChecked(true);
|
||||||
|
}else{
|
||||||
|
this.mDoNotTrack.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearCookieSetting();
|
||||||
|
if(status.sSettingCookieStatus == ACCEPT_ALL){
|
||||||
|
mCookie.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mCookie.get(0).setChecked(true);
|
||||||
|
}
|
||||||
|
if(status.sSettingCookieStatus == ACCEPT_NON_TRACKERS){
|
||||||
|
mCookie.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mCookie.get(1).setChecked(true);
|
||||||
|
}
|
||||||
|
if(status.sSettingCookieStatus == ACCEPT_FIRST_PARTY){
|
||||||
|
mCookie.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mCookie.get(2).setChecked(true);
|
||||||
|
}
|
||||||
|
if(status.sSettingCookieStatus == ACCEPT_NONE){
|
||||||
|
mCookie.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mCookie.get(3).setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearCookieSetting(){
|
||||||
|
for(int mCounter=0; mCounter<mCookie.size();mCounter++){
|
||||||
|
mCookie.get(mCounter).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
|
||||||
|
mCookie.get(mCounter).setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCookieStatus(View pView){
|
||||||
|
clearCookieSetting();
|
||||||
|
|
||||||
|
if(pView.getId() == R.id.pCookieOption1){
|
||||||
|
mCookie.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mCookie.get(0).setChecked(true);
|
||||||
|
}
|
||||||
|
else if(pView.getId() == R.id.pCookieOption2){
|
||||||
|
mCookie.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mCookie.get(1).setChecked(true);
|
||||||
|
}
|
||||||
|
else if(pView.getId() == R.id.pCookieOption3){
|
||||||
|
mCookie.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mCookie.get(2).setChecked(true);
|
||||||
|
}
|
||||||
|
else if(pView.getId() == R.id.pCookieOption4){
|
||||||
|
mCookie.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mCookie.get(3).setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingPrivacyEnums.ePrivacyViewController pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingPrivacyEnums.ePrivacyViewController.SET_COOKIE_STATUS)){
|
||||||
|
setCookieStatus((View)pData.get(0));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,13 +1,9 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
|
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.Spinner;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
@ -15,8 +11,8 @@ import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class settingSearchController extends AppCompatActivity {
|
public class settingSearchController extends AppCompatActivity {
|
||||||
|
@ -52,32 +48,32 @@ public class settingSearchController extends AppCompatActivity {
|
||||||
|
|
||||||
public void onSelectSearchEngine(View view) {
|
public void onSelectSearchEngine(View view) {
|
||||||
if(view.getId() == R.id.pOption1){
|
if(view.getId() == R.id.pOption1){
|
||||||
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_GENESIS_URL);
|
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_GENESIS_URL));
|
||||||
}
|
}
|
||||||
else if(view.getId() == R.id.pOption2){
|
else if(view.getId() == R.id.pOption2){
|
||||||
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_DUCK_DUCK_GO_URL);
|
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_DUCK_DUCK_GO_URL));
|
||||||
}
|
}
|
||||||
else if(view.getId() == R.id.pOption3){
|
else if(view.getId() == R.id.pOption3){
|
||||||
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_GOOGLE_URL);
|
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL));
|
||||||
}
|
}
|
||||||
else if(view.getId() == R.id.pOption4){
|
else if(view.getId() == R.id.pOption4){
|
||||||
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_BING_URL);
|
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_BING_URL));
|
||||||
}
|
}
|
||||||
else if(view.getId() == R.id.pOption5){
|
else if(view.getId() == R.id.pOption5){
|
||||||
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_WIKI_URL);
|
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_WIKI_URL));
|
||||||
}
|
}
|
||||||
|
|
||||||
mSettingSearchViewController.resetSearchEngine();
|
mSettingSearchViewController.onTrigger(settingSearchEnums.eSearchViewController.M_RESET_SEARCH_ENGINE, Collections.singletonList(null));
|
||||||
mSettingSearchViewController.initSearchEngine();
|
mSettingSearchViewController.onTrigger(settingSearchEnums.eSearchViewController.M_INIT_SEARCH_ENGINE, Collections.singletonList(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSearchHistory(View view){
|
public void setSearchHistory(View view){
|
||||||
mSettingSearchModel.setSearchHistory(!mSearchHistory.isChecked());
|
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_HISTORY, Collections.singletonList(!mSearchHistory.isChecked()));
|
||||||
mSearchHistory.toggle();
|
mSearchHistory.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSearchStatus(View view){
|
public void setSearchStatus(View view){
|
||||||
mSettingSearchModel.setSearchStatus(!mSearchSuggestions.isChecked());
|
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_HISTORY, Collections.singletonList(!mSearchSuggestions.isChecked()));
|
||||||
mSearchSuggestions.toggle();
|
mSearchSuggestions.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
|
||||||
|
|
||||||
|
class settingSearchEnums
|
||||||
|
{
|
||||||
|
/*History Manager*/
|
||||||
|
public enum eSearchModel {
|
||||||
|
M_SET_SEARCH_ENGINE, M_SET_SEARCH_HISTORY, M_SET_SEARCH_STATUS
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eSearchViewController {
|
||||||
|
M_INIT_SEARCH_ENGINE, M_RESET_SEARCH_ENGINE
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,12 +1,15 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
|
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.appManager.historyManager.historyEnums;
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
class settingSearchModel
|
class settingSearchModel
|
||||||
|
@ -24,18 +27,33 @@ class settingSearchModel
|
||||||
|
|
||||||
/*Helper Methods*/
|
/*Helper Methods*/
|
||||||
|
|
||||||
public void onSetSearchEngine(String pUrl){
|
private void onSetSearchEngine(String pUrl){
|
||||||
status.sSettingSearchStatus = pUrl;
|
status.sSettingSearchStatus = pUrl;
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, pUrl));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, pUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSearchHistory(boolean pStatus){
|
private void setSearchHistory(boolean pStatus){
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY, pStatus));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY, pStatus));
|
||||||
status.sSettingSearchHistory = pStatus;
|
status.sSettingSearchHistory = pStatus;
|
||||||
}
|
}
|
||||||
public void setSearchStatus(boolean pStatus){
|
private void setSearchStatus(boolean pStatus){
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION, pStatus));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION, pStatus));
|
||||||
status.getsSettingSearchSuggestion = pStatus;
|
status.getsSettingSearchSuggestion = pStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingSearchEnums.eSearchModel pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE)){
|
||||||
|
onSetSearchEngine((String) pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_HISTORY)){
|
||||||
|
|
||||||
|
setSearchHistory((boolean) pData.get(0));
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_STATUS)){
|
||||||
|
|
||||||
|
setSearchStatus((boolean) pData.get(0));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,21 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
|
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
|
||||||
|
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
import android.widget.Spinner;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
class settingSearchViewController
|
class settingSearchViewController
|
||||||
{
|
{
|
||||||
|
@ -48,41 +47,6 @@ class settingSearchViewController
|
||||||
initSearchViews();
|
initSearchViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initSearchViews(){
|
|
||||||
if(status.sSettingSearchHistory){
|
|
||||||
mSearchHistory.setChecked(true);
|
|
||||||
}
|
|
||||||
if(status.getsSettingSearchSuggestion){
|
|
||||||
mSearchSuggestions.setChecked(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initSearchEngine(){
|
|
||||||
switch (status.sSettingSearchStatus) {
|
|
||||||
case constants.CONST_BACKEND_GOOGLE_URL:
|
|
||||||
mSearchEngines.get(2).setChecked(true);
|
|
||||||
break;
|
|
||||||
case constants.CONST_BACKEND_GENESIS_URL:
|
|
||||||
mSearchEngines.get(0).setChecked(true);
|
|
||||||
break;
|
|
||||||
case constants.CONST_BACKEND_DUCK_DUCK_GO_URL:
|
|
||||||
mSearchEngines.get(1).setChecked(true);
|
|
||||||
break;
|
|
||||||
case constants.CONST_BACKEND_BING_URL:
|
|
||||||
mSearchEngines.get(3).setChecked(true);
|
|
||||||
break;
|
|
||||||
case constants.CONST_BACKEND_WIKI_URL:
|
|
||||||
mSearchEngines.get(4).setChecked(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetSearchEngine(){
|
|
||||||
for(int mCounter=0;mCounter<mSearchEngines.size();mCounter++){
|
|
||||||
mSearchEngines.get(mCounter).setChecked(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initPostUI(){
|
private void initPostUI(){
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
Window window = mContext.getWindow();
|
Window window = mContext.getWindow();
|
||||||
|
@ -92,10 +56,64 @@ class settingSearchViewController
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initSearchViews(){
|
||||||
|
if(status.sSettingSearchHistory){
|
||||||
|
mSearchHistory.setChecked(true);
|
||||||
|
}
|
||||||
|
if(status.getsSettingSearchSuggestion){
|
||||||
|
mSearchSuggestions.setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSearchEngine(){
|
||||||
|
resetSearchEngine();
|
||||||
|
switch (status.sSettingSearchStatus) {
|
||||||
|
case constants.CONST_BACKEND_GOOGLE_URL:
|
||||||
|
mSearchEngines.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mSearchEngines.get(2).setChecked(true);
|
||||||
|
break;
|
||||||
|
case constants.CONST_BACKEND_GENESIS_URL:
|
||||||
|
mSearchEngines.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mSearchEngines.get(0).setChecked(true);
|
||||||
|
break;
|
||||||
|
case constants.CONST_BACKEND_DUCK_DUCK_GO_URL:
|
||||||
|
mSearchEngines.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mSearchEngines.get(1).setChecked(true);
|
||||||
|
break;
|
||||||
|
case constants.CONST_BACKEND_BING_URL:
|
||||||
|
mSearchEngines.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mSearchEngines.get(3).setChecked(true);
|
||||||
|
break;
|
||||||
|
case constants.CONST_BACKEND_WIKI_URL:
|
||||||
|
mSearchEngines.get(4).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
|
||||||
|
mSearchEngines.get(4).setChecked(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetSearchEngine(){
|
||||||
|
for(int mCounter=0;mCounter<mSearchEngines.size();mCounter++){
|
||||||
|
mSearchEngines.get(mCounter).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
|
||||||
|
mSearchEngines.get(mCounter).setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object onTrigger(settingSearchEnums.eSearchViewController pCommands, List<Object> pData){
|
||||||
|
if(pCommands.equals(settingSearchEnums.eSearchViewController.M_INIT_SEARCH_ENGINE)){
|
||||||
|
initSearchEngine();
|
||||||
|
}
|
||||||
|
else if(pCommands.equals(settingSearchEnums.eSearchViewController.M_RESET_SEARCH_ENGINE)){
|
||||||
|
resetSearchEngine();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
|
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
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 androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
|
|
||||||
import com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController;
|
import com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.settingManager.clearManager.settingClearController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController;
|
||||||
import com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController;
|
import com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.settingManager.privacyManager.settingPrivacyController;
|
||||||
import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController;
|
import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController;
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
@ -28,80 +30,59 @@ import com.example.myapplication.R;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import static com.darkweb.genesissearchengine.constants.enums.etype.on_not_support;
|
import static com.darkweb.genesissearchengine.constants.enums.etype.on_not_support;
|
||||||
import static com.darkweb.genesissearchengine.constants.status.sSettingCookieStatus;
|
|
||||||
import static com.darkweb.genesissearchengine.constants.status.sSettingHistoryStatus;
|
|
||||||
import static com.darkweb.genesissearchengine.constants.status.sSettingJavaStatus;
|
|
||||||
|
|
||||||
public class settingController extends AppCompatActivity
|
public class settingController extends AppCompatActivity
|
||||||
{
|
{
|
||||||
/*Private Observer Classes*/
|
/*Private Observer Classes*/
|
||||||
|
|
||||||
private homeController mHomeController;
|
|
||||||
private settingViewController mSettingViewController;
|
private settingViewController mSettingViewController;
|
||||||
private settingModel mSettingModel;
|
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*/
|
/*Initializations*/
|
||||||
|
|
||||||
public settingController(){
|
public settingController(){
|
||||||
mHomeController = activityContextManager.getInstance().getHomeController();
|
|
||||||
mSettingModel = new settingModel(new settingModelCallback());
|
mSettingModel = new settingModel(new settingModelCallback());
|
||||||
mSettingModel.initNotification(pluginController.getInstance().getNotificationStatus());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState)
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
pluginController.getInstance().onCreate(this);
|
onInitTheme();
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.setting);
|
setContentView(R.layout.setting);
|
||||||
|
|
||||||
|
pluginController.getInstance().onCreate(this);
|
||||||
viewsInitializations();
|
viewsInitializations();
|
||||||
modelInitialization();
|
|
||||||
listenersInitializations();
|
listenersInitializations();
|
||||||
initializeFontSizeListener();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void modelInitialization(){
|
public void onInitTheme(){
|
||||||
mSettingModel.setJavaStatus(sSettingJavaStatus, true);
|
|
||||||
mSettingModel.setHistoryStatus(sSettingHistoryStatus, true);
|
if(status.sTheme == enums.Theme.THEME_DARK){
|
||||||
mSettingModel.setSearchStatus(status.sSettingSearchStatus, true);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
mSettingModel.setAdjustableStatus(status.sSettingFontAdjustable, true);
|
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
|
||||||
mSettingModel.setFontSize(status.sSettingFontSize, true);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
}else {
|
||||||
|
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO){
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
}else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyTheme(){
|
||||||
|
recreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void viewsInitializations()
|
public void viewsInitializations()
|
||||||
{
|
{
|
||||||
mSearch = findViewById(R.id.search_manager);
|
activityContextManager.getInstance().setSettingController(this);
|
||||||
mJavascript = findViewById(R.id.javascript_manager);
|
mSettingViewController = new settingViewController(this, new settingModelCallback());
|
||||||
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()
|
public void listenersInitializations()
|
||||||
{
|
{
|
||||||
initializeItemSelectedListener(mSearch);
|
|
||||||
initializeItemSelectedListener(mJavascript);
|
|
||||||
initializeItemSelectedListener(mNotification);
|
|
||||||
initializeItemSelectedListener(mHistory);
|
|
||||||
initializeItemSelectedListener(mFontAdjustable);
|
|
||||||
initializeItemSelectedListener(mCookies);
|
|
||||||
pluginController.getInstance().logEvent(strings.EVENT_SETTINGS_OPENED);
|
pluginController.getInstance().logEvent(strings.EVENT_SETTINGS_OPENED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,11 +98,13 @@ public class settingController extends AppCompatActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
activityContextManager.getInstance().setCurrentActivity(this);
|
activityContextManager.getInstance().setCurrentActivity(this);
|
||||||
status.sSettingIsAppPaused = false;
|
status.sSettingIsAppPaused = false;
|
||||||
|
onInitTheme();
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,73 +120,7 @@ public class settingController extends AppCompatActivity
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
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), false);
|
|
||||||
}
|
|
||||||
else if(parentView.getId()== R.id.javascript_manager)
|
|
||||||
{
|
|
||||||
mSettingModel.setJavaStatus(position==0, false);
|
|
||||||
}
|
|
||||||
else if(parentView.getId()== R.id.history_manager)
|
|
||||||
{
|
|
||||||
mSettingModel.setHistoryStatus(position==0, false);
|
|
||||||
}
|
|
||||||
else if(parentView.getId()== R.id.font_adjustable)
|
|
||||||
{
|
|
||||||
if(position==0){
|
|
||||||
mSettingModel.setFontSize(100, false);
|
|
||||||
}
|
|
||||||
mSettingViewController.setFontSizeAdjustable(position==0);
|
|
||||||
mSettingModel.setAdjustableStatus(position==0, false);
|
|
||||||
}
|
|
||||||
else if(parentView.getId()== R.id.cookies_manager)
|
|
||||||
{
|
|
||||||
mSettingModel.setCookieStatus(position, false);
|
|
||||||
}
|
|
||||||
else if(parentView.getId()== R.id.notification_manager)
|
|
||||||
{
|
|
||||||
mSettingModel.setmNotificationStatus(position, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@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), false);
|
|
||||||
mSettingViewController.updatePercentage(mFontSize.getProgress());
|
|
||||||
mSettingViewController.setFontSize(b);
|
|
||||||
mSettingModel.setAdjustableStatus(b, false);
|
|
||||||
if(cur_progress<1){
|
|
||||||
mFontSize.setProgress(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onNavigationBackPressed(View view){
|
public void onNavigationBackPressed(View view){
|
||||||
mSettingModel.onSaveSettings();
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,6 +144,22 @@ public class settingController extends AppCompatActivity
|
||||||
helperMethod.openActivity(settingAccessibilityController.class, constants.CONST_LIST_HISTORY, this,true);
|
helperMethod.openActivity(settingAccessibilityController.class, constants.CONST_LIST_HISTORY, this,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onManageGeneral(View view) {
|
||||||
|
helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, this,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onManageSearchClearData(View view) {
|
||||||
|
helperMethod.openActivity(settingClearController.class, constants.CONST_LIST_HISTORY, this,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onManageSearchPrivacy(View view) {
|
||||||
|
helperMethod.openActivity(settingPrivacyController.class, constants.CONST_LIST_HISTORY, this,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onManageSearchAdvanced(View view) {
|
||||||
|
helperMethod.openActivity(settingAdvanceController.class, constants.CONST_LIST_HISTORY, this,true);
|
||||||
|
}
|
||||||
|
|
||||||
/*Event Observer*/
|
/*Event Observer*/
|
||||||
|
|
||||||
public class settingViewCallback implements eventObserver.eventListener{
|
public class settingViewCallback implements eventObserver.eventListener{
|
||||||
|
@ -243,67 +176,8 @@ public class settingController extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
||||||
{
|
{
|
||||||
if(e_type == enums.etype.update_searcn){
|
|
||||||
status.sSettingSearchStatus = (String)data.get(0);
|
|
||||||
mHomeController.onHomeButton(null);
|
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, mSettingModel.getSearchStatus()));
|
|
||||||
}
|
|
||||||
else if(e_type == enums.etype.update_javascript){
|
|
||||||
status.sSettingJavaStatus = (boolean)data.get(0);
|
|
||||||
mHomeController.onUpdateJavascript();
|
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT, status.sSettingJavaStatus));
|
|
||||||
}
|
|
||||||
else if(e_type == enums.etype.update_history){
|
|
||||||
sSettingHistoryStatus = (boolean)data.get(0);
|
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR, sSettingHistoryStatus));
|
|
||||||
}
|
|
||||||
else if(e_type == enums.etype.update_notification){
|
|
||||||
pluginController.getInstance().setNotificationStatus((int)data.get(0));
|
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS, pluginController.getInstance().getNotificationStatus()));
|
|
||||||
|
|
||||||
int notificationStatus = pluginController.getInstance().getNotificationStatus();
|
|
||||||
if(notificationStatus==0){
|
|
||||||
pluginController.getInstance().disableTorNotification();
|
|
||||||
} else if(notificationStatus==1){
|
|
||||||
pluginController.getInstance().enableTorNotification();
|
|
||||||
}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){
|
|
||||||
sSettingCookieStatus = (int)data.get(0);
|
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE, sSettingCookieStatus));
|
|
||||||
mHomeController.onUpdateCookies();
|
|
||||||
pluginController.getInstance().updateCookiesStatus();
|
|
||||||
}
|
|
||||||
else if(e_type == enums.etype.close_view){
|
|
||||||
finish();
|
|
||||||
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Helper Methods*/
|
|
||||||
|
|
||||||
public String getEngineURL(int index){
|
|
||||||
|
|
||||||
if (index == 0)
|
|
||||||
{
|
|
||||||
return constants.CONST_BACKEND_GENESIS_URL;
|
|
||||||
}
|
|
||||||
else if (index == 1)
|
|
||||||
{
|
|
||||||
return constants.CONST_BACKEND_GOOGLE_URL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return constants.CONST_BACKEND_DUCK_DUCK_GO_URL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
|
||||||
|
|
||||||
|
public class settingHomeEnums
|
||||||
|
{
|
||||||
|
/*History Manager*/
|
||||||
|
public enum eHomeModel {
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eHomeViewController {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,135 +1,19 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
|
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
|
|
||||||
|
|
||||||
class settingModel
|
class settingModel
|
||||||
{
|
{
|
||||||
/*Variable Declaration*/
|
/*Variable Declaration*/
|
||||||
|
|
||||||
private eventObserver.eventListener mEvent;
|
private eventObserver.eventListener mEvent;
|
||||||
|
|
||||||
private String mSearchStatus = strings.GENERIC_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*/
|
/*Initializations*/
|
||||||
|
|
||||||
settingModel(eventObserver.eventListener mEvent){
|
settingModel(eventObserver.eventListener mEvent){
|
||||||
init_status();
|
|
||||||
this.mEvent = mEvent;
|
this.mEvent = mEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Helper Methods*/
|
/*Helper Methods*/
|
||||||
|
|
||||||
private void init_status()
|
|
||||||
{
|
|
||||||
mSearchStatus = status.sSettingSearchStatus;
|
|
||||||
mHistoryStatus = status.sSettingHistoryStatus;
|
|
||||||
mJavaStatus = status.sSettingJavaStatus;
|
|
||||||
mCookieStatus = status.sSettingCookieStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initNotification(int notificationStatus){
|
|
||||||
mNotificationStatus = notificationStatus;
|
|
||||||
notificationStatusGlobal = notificationStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Changed Status*/
|
|
||||||
|
|
||||||
String getSearchStatus(){
|
|
||||||
return mSearchStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCookieStatus(int cookie_status, boolean isActivityLoading){
|
|
||||||
this.mCookieStatus = cookie_status;
|
|
||||||
if(!isActivityLoading){
|
|
||||||
onSaveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSearchStatus(String search_status, boolean isActivityLoading){
|
|
||||||
this.mSearchStatus = search_status;
|
|
||||||
if(!isActivityLoading){
|
|
||||||
onSaveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setFontSize(float font_size, boolean isActivityLoading){
|
|
||||||
this.mFontSize = font_size;
|
|
||||||
if(!isActivityLoading){
|
|
||||||
onSaveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setAdjustableStatus(boolean font_status, boolean isActivityLoading){
|
|
||||||
this.mFontAdjustable = font_status;
|
|
||||||
if(!isActivityLoading){
|
|
||||||
onSaveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void setJavaStatus(boolean java_status, boolean isActivityLoading){
|
|
||||||
this.mJavaStatus = java_status;
|
|
||||||
if(!isActivityLoading){
|
|
||||||
onSaveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setmNotificationStatus(int notification_status, boolean isActivityLoading){
|
|
||||||
this.mNotificationStatus = notification_status;
|
|
||||||
if(!isActivityLoading){
|
|
||||||
onSaveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setHistoryStatus(boolean history_status, boolean isActivityLoading){
|
|
||||||
this.mHistoryStatus = history_status;
|
|
||||||
if(!isActivityLoading){
|
|
||||||
onSaveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onSaveSettings()
|
|
||||||
{
|
|
||||||
if(!status.sSettingSearchStatus.equals(mSearchStatus))
|
|
||||||
{
|
|
||||||
mEvent.invokeObserver(Collections.singletonList(mSearchStatus), enums.etype.update_searcn);
|
|
||||||
}
|
|
||||||
if(status.sSettingJavaStatus != mJavaStatus)
|
|
||||||
{
|
|
||||||
mEvent.invokeObserver(Collections.singletonList(mJavaStatus), enums.etype.update_javascript);
|
|
||||||
}
|
|
||||||
if(notificationStatusGlobal != mNotificationStatus)
|
|
||||||
{
|
|
||||||
mEvent.invokeObserver(Collections.singletonList(mNotificationStatus), enums.etype.update_notification);
|
|
||||||
}
|
|
||||||
if(status.sSettingHistoryStatus != mHistoryStatus)
|
|
||||||
{
|
|
||||||
status.sSettingHistoryStatus = mHistoryStatus;
|
|
||||||
mEvent.invokeObserver(Collections.singletonList(mHistoryStatus), enums.etype.update_history);
|
|
||||||
}
|
|
||||||
if(status.sSettingCookieStatus != mCookieStatus)
|
|
||||||
{
|
|
||||||
status.sSettingCookieStatus = mCookieStatus;
|
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,status.sSettingCookieStatus));
|
|
||||||
mEvent.invokeObserver(Collections.singletonList(mCookieStatus), enums.etype.update_cookies);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,17 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
|
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.SeekBar;
|
|
||||||
import android.widget.Spinner;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
import static com.darkweb.genesissearchengine.constants.status.sSettingHistoryStatus;
|
|
||||||
import static com.darkweb.genesissearchengine.constants.status.sSettingJavaStatus;
|
|
||||||
|
|
||||||
class settingViewController
|
class settingViewController
|
||||||
{
|
{
|
||||||
|
@ -25,39 +20,13 @@ class settingViewController
|
||||||
private eventObserver.eventListener mEvent;
|
private eventObserver.eventListener mEvent;
|
||||||
private AppCompatActivity mContext;
|
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*/
|
/*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)
|
settingViewController(settingController mContext, eventObserver.eventListener mEvent)
|
||||||
{
|
{
|
||||||
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.mEvent = mEvent;
|
||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
|
|
||||||
initNotification(notificationStatus);
|
|
||||||
initViews();
|
|
||||||
initJavascript();
|
|
||||||
initHistory();
|
|
||||||
initSearchEngine();
|
|
||||||
initFontAdjustable();
|
|
||||||
initCookies();
|
|
||||||
initFontSize();
|
|
||||||
initPostUI();
|
initPostUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,113 +39,12 @@ class settingViewController
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 (sSettingJavaStatus)
|
|
||||||
{
|
|
||||||
mJavaScript.setSelection(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mJavaScript.setSelection(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initNotification(int status)
|
|
||||||
{
|
|
||||||
mNotification.setSelection(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initHistory()
|
|
||||||
{
|
|
||||||
if (sSettingHistoryStatus)
|
|
||||||
{
|
|
||||||
mHistory.setSelection(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mHistory.setSelection(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initCookies()
|
|
||||||
{
|
|
||||||
mCookies.setSelection(status.sSettingCookieStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initFontAdjustable()
|
|
||||||
{
|
|
||||||
if (status.sSettingFontAdjustable)
|
|
||||||
{
|
|
||||||
mFontAdjustable.setSelection(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFontAdjustable.setSelection(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initFontSize()
|
|
||||||
{
|
|
||||||
mFontSize.setProgress((int)status.sSettingFontSize);
|
|
||||||
updatePercentage(mFontSize.getProgress());
|
|
||||||
}
|
|
||||||
|
|
||||||
void setFontSize(boolean status){
|
|
||||||
if(status){
|
|
||||||
mFontAdjustable.setSelection(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setFontSizeAdjustable(boolean status){
|
|
||||||
if(status){
|
|
||||||
mFontSize.setProgress(100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initSearchEngine()
|
|
||||||
{
|
|
||||||
mSearch.setSelection(getEngineIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*External Helper Methods*/
|
|
||||||
|
|
||||||
private int getEngineIndex(){
|
|
||||||
if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GENESIS_URL)){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GOOGLE_URL)){
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
void updatePercentage(int font_size){
|
|
||||||
|
|
||||||
mFontSizePercentage.setText(strings.SETTING_CUSTOM_FONTS + strings.GENERIC_EMPTY_SPACE + font_size +strings.SETTING_PERCENT_SIGN);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.tabManager;
|
package com.darkweb.genesissearchengine.appManager.tabManager;
|
||||||
|
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -9,11 +11,16 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
|
|
||||||
|
import org.mozilla.geckoview.GeckoView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
@ -22,15 +29,17 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
|
||||||
/*Private Variables*/
|
/*Private Variables*/
|
||||||
|
|
||||||
private ArrayList<tabRowModel> mModelList;
|
private ArrayList<tabRowModel> mModelList;
|
||||||
private ArrayList<tabRowModel> mTempModelList;
|
|
||||||
private eventObserver.eventListener mEvent;
|
private eventObserver.eventListener mEvent;
|
||||||
private String filter = strings.GENERIC_EMPTY_STR;
|
|
||||||
private boolean isClosing = false;
|
|
||||||
|
|
||||||
tabAdapter(ArrayList<tabRowModel> model_list, eventObserver.eventListener event) {
|
private GeckoView mCurrentGeckoView = null;
|
||||||
|
private int mCurrentSession;
|
||||||
|
|
||||||
|
tabAdapter(ArrayList<tabRowModel> model_list, eventObserver.eventListener event, GeckoView pGeckoView, int pCurrentSession) {
|
||||||
this.mModelList = model_list;
|
this.mModelList = model_list;
|
||||||
this.mEvent = event;
|
this.mEvent = event;
|
||||||
mTempModelList = new ArrayList<>();
|
|
||||||
|
pGeckoView.releaseSession();
|
||||||
|
this.mCurrentSession = pCurrentSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Initializations*/
|
/*Initializations*/
|
||||||
|
@ -38,128 +47,76 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recyclerview_row, parent, false);
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.tabview_row, parent, false);
|
||||||
return new listViewHolder(view);
|
return new listViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull tabAdapter.listViewHolder holder, int position)
|
public void onBindViewHolder(@NonNull tabAdapter.listViewHolder holder, int position)
|
||||||
{
|
{
|
||||||
holder.bindListView(mTempModelList.get(position));
|
holder.bindListView(mModelList.get(position));
|
||||||
clearMessageItem(holder.messageButton,position,holder.data_model);
|
|
||||||
clearMessageItemContainer(holder.itemContainer,position,holder.data_model);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return mTempModelList.size();
|
return mModelList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Listeners*/
|
/*Listeners*/
|
||||||
|
|
||||||
private void clearMessageItem(ImageButton clearButton, int index,tabRowModel model)
|
public void onClose(){
|
||||||
{
|
if(mCurrentGeckoView!=null){
|
||||||
clearButton.setOnClickListener(v ->
|
mCurrentGeckoView.releaseSession();
|
||||||
{
|
}
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOnClickListener(ImageView pLoadSession, tabRowModel model, GeckoView pGeckoView, ImageButton mRemoveRow){
|
||||||
|
pLoadSession.setOnClickListener(v -> {
|
||||||
|
pGeckoView.releaseSession();
|
||||||
|
activityContextManager.getInstance().getHomeController().onLoadTab(model.getSession(), false);
|
||||||
|
activityContextManager.getInstance().getTabController().onBackPressed(null);
|
||||||
|
activityContextManager.getInstance().getTabController().initTabCount();
|
||||||
|
});
|
||||||
|
|
||||||
|
mRemoveRow.setOnClickListener(v -> {
|
||||||
|
model.getSession().closeSession();
|
||||||
private void clearMessageItemContainer(LinearLayout clearButton, int index,tabRowModel model)
|
activityContextManager.getInstance().getTabController().onRemoveView(model.getSession().getSessionID());
|
||||||
{
|
notifyDataSetChanged();
|
||||||
clearButton.setOnClickListener(v ->
|
activityContextManager.getInstance().getTabController().initTabCount();
|
||||||
{
|
|
||||||
if(mTempModelList.size()>index){
|
|
||||||
invokeFilter(false);
|
|
||||||
mEvent.invokeObserver(Collections.singletonList(model),enums.etype.url_triggered);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*View Holder Extensions*/
|
/*View Holder Extensions*/
|
||||||
|
|
||||||
class listViewHolder extends RecyclerView.ViewHolder
|
class listViewHolder extends RecyclerView.ViewHolder
|
||||||
{
|
{
|
||||||
TextView heaaderText;
|
GeckoView mGeckoView;
|
||||||
TextView descriptionText;
|
TextView mHeader;
|
||||||
ImageButton messageButton;
|
TextView mDescription;
|
||||||
ImageView empty_message;
|
ImageView mLoadSession;
|
||||||
LinearLayout itemContainer;
|
ImageButton mRemoveRow;
|
||||||
tabRowModel data_model;
|
|
||||||
|
|
||||||
listViewHolder(View itemView) {
|
listViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bindListView(tabRowModel model) {
|
void bindListView(tabRowModel model) {
|
||||||
|
mGeckoView = itemView.findViewById(R.id.pGeckoView);
|
||||||
|
mHeader = itemView.findViewById(R.id.pHeader);
|
||||||
|
mDescription = itemView.findViewById(R.id.pDescription);
|
||||||
|
mLoadSession = itemView.findViewById(R.id.pLoadSession);
|
||||||
|
mRemoveRow = itemView.findViewById(R.id.pRemoveRow);
|
||||||
|
|
||||||
heaaderText = itemView.findViewById(R.id.pHeader);
|
mGeckoView.releaseSession();
|
||||||
descriptionText = itemView.findViewById(R.id.pDescription);
|
mGeckoView.setSession(model.getSession());
|
||||||
//itemContainer = itemView.findViewById(R.id.pRowContainer);
|
if(model.getmId() == mCurrentSession){
|
||||||
|
mCurrentGeckoView = mGeckoView;
|
||||||
if(model.getSession().getTitle().equals("") || model.getSession().getTitle().equals("loading")){
|
|
||||||
heaaderText.setText(helperMethod.getDomainName(model.getSession().getCurrentURL()));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
heaaderText.setText(model.getSession().getTitle());
|
|
||||||
}
|
}
|
||||||
|
model.setGeckoView(mGeckoView);
|
||||||
|
mHeader.setText(model.getSession().getTitle());
|
||||||
|
mDescription.setText(model.getSession().getCurrentURL());
|
||||||
|
|
||||||
/*Large file or content based url handling*/
|
setOnClickListener(mLoadSession, model, mGeckoView, mRemoveRow);
|
||||||
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.pEmptyListNotification);
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.tabManager;
|
package com.darkweb.genesissearchengine.appManager.tabManager;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.os.Handler;
|
||||||
import android.text.TextWatcher;
|
import android.os.Looper;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.EditorInfo;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
|
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController;
|
||||||
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
import com.darkweb.genesissearchengine.constants.keys;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
|
@ -23,26 +22,24 @@ import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
import com.darkweb.genesissearchengine.pluginManager.pluginController;
|
||||||
import com.example.myapplication.R;
|
import com.example.myapplication.R;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class tabController extends AppCompatActivity
|
public class tabController extends AppCompatActivity
|
||||||
{
|
{
|
||||||
|
/*Private Views*/
|
||||||
|
private Button mTabs;
|
||||||
|
|
||||||
/*Private Variables*/
|
/*Private Variables*/
|
||||||
|
|
||||||
private tabModel mListModel;
|
private tabModel mListModel;
|
||||||
private homeController mHomeController;
|
private homeController mHomeController;
|
||||||
private activityContextManager mContextManager;
|
private activityContextManager mContextManager;
|
||||||
|
|
||||||
private ImageView mEmptyListNotifier;
|
|
||||||
private EditText mSearchBar;
|
|
||||||
private RecyclerView mListView;
|
|
||||||
private Button mClearButton;
|
|
||||||
|
|
||||||
private tabViewController mtabViewController;
|
private tabViewController mtabViewController;
|
||||||
|
private RecyclerView mRecycleView;
|
||||||
|
private tabAdapter mTabAdapter;
|
||||||
|
|
||||||
/*Initializations*/
|
/*Initializations*/
|
||||||
|
|
||||||
|
@ -54,88 +51,115 @@ public class tabController extends AppCompatActivity
|
||||||
initializeListModel();
|
initializeListModel();
|
||||||
initializeViews();
|
initializeViews();
|
||||||
initializeList();
|
initializeList();
|
||||||
onEditorInvoked();
|
onCustomeListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeListModel(){
|
public void initializeListModel(){
|
||||||
mListModel = new tabModel();
|
mListModel = new tabModel();
|
||||||
mListModel.setList(dataController.getInstance().getTab());
|
mListModel.setList((ArrayList<tabRowModel>)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TAB, null));
|
||||||
mContextManager = activityContextManager.getInstance();
|
mContextManager = activityContextManager.getInstance();
|
||||||
mHomeController = activityContextManager.getInstance().getHomeController();
|
mHomeController = activityContextManager.getInstance().getHomeController();
|
||||||
mContextManager.setTabController(this);
|
mContextManager.setTabController(this);
|
||||||
pluginController.getInstance().logEvent(strings.EVENT_TAB_OPENED);
|
pluginController.getInstance().logEvent(strings.EVENT_TAB_OPENED);
|
||||||
}
|
}
|
||||||
public void initializeViews(){
|
public void initializeViews(){
|
||||||
mEmptyListNotifier = findViewById(R.id.pEmptyListNotification);
|
mRecycleView = findViewById(R.id.pRecycleView);
|
||||||
mSearchBar = findViewById(R.id.pSearchInput);
|
mTabs = findViewById(R.id.pTabs);
|
||||||
mListView = findViewById(R.id.pRecycleView);
|
|
||||||
mClearButton = findViewById(R.id.pClearButton);
|
mtabViewController = new tabViewController(this, mTabs);
|
||||||
mtabViewController = new tabViewController(mEmptyListNotifier, mListView, mClearButton,this);
|
|
||||||
}
|
}
|
||||||
public void initializeList(){
|
public void initializeList(){
|
||||||
tabAdapter adapter = new tabAdapter(mListModel.getList(),new adapterCallback());
|
LinearLayoutManager layoutManager = new LinearLayoutManager(tabController.this);
|
||||||
adapter.invokeFilter(false);
|
tabAdapter adapter = new tabAdapter(mListModel.getList(),new adapterCallback(), mHomeController.getmGeckoView(), ((tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB,null)).getmId());
|
||||||
mListView.setAdapter(adapter);
|
mTabAdapter = adapter;
|
||||||
mListView.setLayoutManager(new LinearLayoutManager(this));
|
layoutManager.setReverseLayout(true);
|
||||||
mtabViewController.updateIfListEmpty(mListModel.getList().size(),0);
|
|
||||||
|
mRecycleView.setAdapter(adapter);
|
||||||
|
mRecycleView.setItemViewCacheSize(100);
|
||||||
|
mRecycleView.setNestedScrollingEnabled(false);
|
||||||
|
mRecycleView.setHasFixedSize(true);
|
||||||
|
mRecycleView.setAdapter(adapter);
|
||||||
|
mRecycleView.setItemViewCacheSize(100);
|
||||||
|
mRecycleView.setDrawingCacheEnabled(true);
|
||||||
|
mRecycleView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
|
||||||
|
mRecycleView.setLayoutManager(new LinearLayoutManager(tabController.this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*View Handlers*/
|
/*View Handlers*/
|
||||||
|
|
||||||
public void onEditorInvoked(){
|
public void onCustomeListeners(){
|
||||||
|
|
||||||
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(){
|
public void onReleaseDisplay(){
|
||||||
if(mListView!=null){
|
mTabAdapter.onClose();
|
||||||
mListView.setAdapter(null);
|
mHomeController.onAcquireDisplay();
|
||||||
}
|
|
||||||
mListView = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
reset();
|
overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onBackPressed(View view){
|
public void onBackPressed(View view) {
|
||||||
this.finish();
|
onReleaseDisplay();
|
||||||
reset();
|
finish();
|
||||||
|
overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onclearDataTrigger(View view){
|
public void onRemoveView(int pId){
|
||||||
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.GENERIC_EMPTY_STR),enums.etype.clear_tab);
|
for(int mCounter=0; mCounter<mListModel.getList().size();mCounter++){
|
||||||
|
if(mListModel.getList().get(mCounter).getSession().getSessionID() == pId){
|
||||||
|
mListModel.getList().get(mCounter).releaseGeckoView();
|
||||||
|
mListModel.getList().remove(mCounter);
|
||||||
|
mTabAdapter.notifyDataSetChanged();
|
||||||
|
//mTabAdapter.notifyItemRemoved(mCounter);
|
||||||
|
//mTabAdapter.notifyItemRangeChanged(mCounter-1, mListModel.getList().size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initTabCount()
|
||||||
|
{
|
||||||
|
mtabViewController.onTrigger(tabEnums.eTabViewCommands.INIT_TAB_COUNT, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onNewTabInvoked(){
|
||||||
|
mHomeController.onNewTab(true,false);
|
||||||
|
onReleaseDisplay();
|
||||||
|
finish();
|
||||||
|
overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*UI Triggers*/
|
||||||
|
|
||||||
|
public void openTabMenu(View view) {
|
||||||
|
mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_SHOW_MENU, Collections.singletonList(view));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Tab Menu*/
|
||||||
|
|
||||||
|
public void onMenuTrigger(View pView){
|
||||||
|
if(pView.getId() == R.id.pNewTab){
|
||||||
|
onNewTabInvoked();
|
||||||
|
}
|
||||||
|
else if(pView.getId() == R.id.pCloseTab){
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(pView.getId() == R.id.pOpenSetting){
|
||||||
|
mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_DISMISS_MENU, null);
|
||||||
|
helperMethod.openActivity(settingController.class, constants.CONST_LIST_HISTORY, this,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTabRowChanged(int pId){
|
||||||
|
for(int mCounter=0; mCounter<mListModel.getList().size();mCounter++){
|
||||||
|
if(mListModel.getList().get(mCounter).getSession().getSessionID() == pId){
|
||||||
|
mListModel.getList().get(mCounter).releaseGeckoView();
|
||||||
|
mTabAdapter.notifyItemChanged(mCounter);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -144,16 +168,11 @@ public class tabController extends AppCompatActivity
|
||||||
if(status.sSettingIsAppPaused && (level==80 || level==15))
|
if(status.sSettingIsAppPaused && (level==80 || level==15))
|
||||||
{
|
{
|
||||||
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HOME_LOW_MEMORY,true));
|
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HOME_LOW_MEMORY,true));
|
||||||
|
onReleaseDisplay();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNewTabInvoked(View view)
|
|
||||||
{
|
|
||||||
mHomeController.onNewTab(true,false);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
|
@ -177,39 +196,10 @@ public class tabController extends AppCompatActivity
|
||||||
/*Event Observer*/
|
/*Event Observer*/
|
||||||
|
|
||||||
public class adapterCallback implements eventObserver.eventListener{
|
public class adapterCallback implements eventObserver.eventListener{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object invokeObserver(List<Object> data, enums.etype e_type)
|
public Object 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.EVENT_TAB_TRIGGERED);
|
|
||||||
mHomeController.onLoadTab(model.getSession(),false);
|
|
||||||
tabController.this.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(true,false);
|
|
||||||
finish();
|
|
||||||
}else {
|
|
||||||
mHomeController.loadExistingTab();
|
|
||||||
}
|
|
||||||
mHomeController.initTabCount();
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.darkweb.genesissearchengine.appManager.tabManager;
|
||||||
|
|
||||||
|
public class tabEnums
|
||||||
|
{
|
||||||
|
/*Settings Manager*/
|
||||||
|
public enum eTabViewCommands {
|
||||||
|
M_DISMISS_MENU, M_SHOW_MENU, INIT_TAB_COUNT
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eTabModelCommands {
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,19 +14,10 @@ class tabModel
|
||||||
{
|
{
|
||||||
mModelList = model;
|
mModelList = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<tabRowModel> getList()
|
ArrayList<tabRowModel> getList()
|
||||||
{
|
{
|
||||||
return mModelList;
|
return mModelList;
|
||||||
}
|
}
|
||||||
private void removeFromMainList(int index)
|
|
||||||
{
|
|
||||||
if(mModelList.size()>index){
|
|
||||||
mModelList.remove(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onManualClear(int index){
|
|
||||||
removeFromMainList(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,12 +2,15 @@ package com.darkweb.genesissearchengine.appManager.tabManager;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession;
|
import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession;
|
||||||
|
|
||||||
|
import org.mozilla.geckoview.GeckoView;
|
||||||
|
|
||||||
public class tabRowModel
|
public class tabRowModel
|
||||||
{
|
{
|
||||||
/*Private Variables*/
|
/*Private Variables*/
|
||||||
|
|
||||||
private geckoSession mSession;
|
private geckoSession mSession;
|
||||||
private int mId;
|
private int mId;
|
||||||
|
private GeckoView mGeckoView = null;
|
||||||
|
|
||||||
/*Initializations*/
|
/*Initializations*/
|
||||||
|
|
||||||
|
@ -21,6 +24,16 @@ public class tabRowModel
|
||||||
return mSession;
|
return mSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGeckoView(GeckoView pGeckoView){
|
||||||
|
mGeckoView = pGeckoView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void releaseGeckoView(){
|
||||||
|
if(mGeckoView!=null){
|
||||||
|
mGeckoView.releaseSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getmId() {
|
public int getmId() {
|
||||||
return mId;
|
return mId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,52 @@
|
||||||
package com.darkweb.genesissearchengine.appManager.tabManager;
|
package com.darkweb.genesissearchengine.appManager.tabManager;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.ActionMenuView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.PopupWindow;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import com.example.myapplication.R;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
|
import com.example.myapplication.R;
|
||||||
|
import java.util.List;
|
||||||
|
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
|
||||||
|
|
||||||
class tabViewController
|
class tabViewController
|
||||||
{
|
{
|
||||||
/*Private Variables*/
|
/*Private Variables*/
|
||||||
private AppCompatActivity mContext;
|
private AppCompatActivity mContext;
|
||||||
|
private PopupWindow mTabOptionMenu = null;
|
||||||
private ImageView mEmptyListNotifier;
|
private Button mTabs;
|
||||||
private RecyclerView mListView;
|
|
||||||
private Button mClearButton;
|
|
||||||
|
|
||||||
/*Initializations*/
|
/*Initializations*/
|
||||||
|
|
||||||
tabViewController(ImageView mEmptyListNotifier, RecyclerView mListView, Button mClearButton, AppCompatActivity mContext)
|
tabViewController(AppCompatActivity mContext, Button pTabs)
|
||||||
{
|
{
|
||||||
this.mContext = mContext;
|
this.mContext = mContext;
|
||||||
this.mEmptyListNotifier = mEmptyListNotifier;
|
this.mTabs = pTabs;
|
||||||
this.mListView = mListView;
|
|
||||||
this.mClearButton = mClearButton;
|
|
||||||
|
|
||||||
initPostUI();
|
initPostUI();
|
||||||
|
initUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initUI(){
|
||||||
|
initTabCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initTabCount(){
|
||||||
|
mTabs.setText((((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null))+ strings.GENERIC_EMPTY_STR));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initPostUI(){
|
private void initPostUI(){
|
||||||
|
@ -40,30 +55,45 @@ class tabViewController
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
||||||
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
|
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
|
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
|
||||||
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
|
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateIfListEmpty(int size,int duration){
|
private void onOpenTabMenu(View view) {
|
||||||
if(size>0){
|
onCloseTabMenu();
|
||||||
mEmptyListNotifier.animate().setDuration(duration).alpha(0f);
|
LayoutInflater layoutInflater = (LayoutInflater) view.getContext().getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||||
mClearButton.animate().setDuration(duration).alpha(1f);
|
@SuppressLint("InflateParams") final View mPopupView = layoutInflater.inflate(R.layout.tab_menu, null);
|
||||||
}
|
mTabOptionMenu = new PopupWindow( mPopupView, ActionMenuView.LayoutParams.WRAP_CONTENT, ActionMenuView.LayoutParams.WRAP_CONTENT, true);
|
||||||
else {
|
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
|
||||||
mEmptyListNotifier.animate().setDuration(duration).alpha(1f);
|
mTabOptionMenu.setOutsideTouchable(true);
|
||||||
mClearButton.animate().setDuration(duration).alpha(0f);
|
mTabOptionMenu.setFocusable(true);
|
||||||
|
mTabOptionMenu.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
mTabOptionMenu.setAnimationStyle(R.style.popup_window_animation);
|
||||||
|
mTabOptionMenu.setElevation(7);
|
||||||
|
mTabOptionMenu.showAsDropDown(view,0, helperMethod.pxFromDp(-45));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onCloseTabMenu() {
|
||||||
|
if(mTabOptionMenu!=null){
|
||||||
|
mTabOptionMenu.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeFromList(int index)
|
public void onTrigger(tabEnums.eTabViewCommands pCommands, List<Object> pData){
|
||||||
{
|
if(pCommands.equals(tabEnums.eTabViewCommands.M_SHOW_MENU)){
|
||||||
Objects.requireNonNull(mListView.getAdapter()).notifyItemRemoved(index);
|
onOpenTabMenu((View) pData.get(0));
|
||||||
mListView.getAdapter().notifyItemRangeChanged(index, mListView.getAdapter().getItemCount()-1);
|
}else if(pCommands.equals(tabEnums.eTabViewCommands.M_DISMISS_MENU)){
|
||||||
|
onCloseTabMenu();
|
||||||
|
}else if(pCommands.equals(tabEnums.eTabViewCommands.INIT_TAB_COUNT)){
|
||||||
|
initTabCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ public class constants
|
||||||
|
|
||||||
public static final String CONST_GENESIS_UPDATE_URL = "https://boogle.store/manual?abi=";
|
public static final String CONST_GENESIS_UPDATE_URL = "https://boogle.store/manual?abi=";
|
||||||
public static final String CONST_PLAYSTORE_URL = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine";
|
public static final String CONST_PLAYSTORE_URL = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine";
|
||||||
|
|
||||||
public static final String CONST_BACKEND_GENESIS_URL = "http://boogle.store/q=$s";
|
public static final String CONST_BACKEND_GENESIS_URL = "http://boogle.store/q=$s";
|
||||||
public static final String CONST_BACKEND_GOOGLE_URL = "https://www.google.com/q=$s";
|
public static final String CONST_BACKEND_GOOGLE_URL = "https://www.google.com/q=$s";
|
||||||
public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com/q=$s";
|
public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com/q=$s";
|
||||||
|
@ -32,6 +31,14 @@ public class constants
|
||||||
public static final boolean CONST_PROXY_DO_NOT_TRACK_HEADER_ENABLED = false;
|
public static final boolean CONST_PROXY_DO_NOT_TRACK_HEADER_ENABLED = false;
|
||||||
public static final int CONST_PROXY_DO_NOT_TRACK_HEADER_VALUE = 1;
|
public static final int CONST_PROXY_DO_NOT_TRACK_HEADER_VALUE = 1;
|
||||||
|
|
||||||
|
/*HISTORY CONSTANTS*/
|
||||||
|
|
||||||
|
public static final String HISTORY_LOAD_MORE = "loading_more";
|
||||||
|
|
||||||
|
/*BOOKMARK CONSTANTS*/
|
||||||
|
|
||||||
|
public static final String BOOKMARK_LOAD_MORE = "loading_more";
|
||||||
|
|
||||||
/*MENU CONSTANTS*/
|
/*MENU CONSTANTS*/
|
||||||
|
|
||||||
public static final int CONST_LIST_HISTORY = 1;
|
public static final int CONST_LIST_HISTORY = 1;
|
||||||
|
@ -43,6 +50,8 @@ public class constants
|
||||||
public static final int CONST_FETCHABLE_LIST_SIZE =100;
|
public static final int CONST_FETCHABLE_LIST_SIZE =100;
|
||||||
public static final int CONST_MAX_BOOKMARK_SIZE =500;
|
public static final int CONST_MAX_BOOKMARK_SIZE =500;
|
||||||
public static final String CONST_DATABASE_NAME ="genesis_dbase";
|
public static final String CONST_DATABASE_NAME ="genesis_dbase";
|
||||||
|
public static final String CONST_PERCENTAGE_SIGN ="%";
|
||||||
|
public static final String CONST_PERCENTAGE_SIGN_100 ="100%";
|
||||||
|
|
||||||
/*ADMOB CONSTANTS*/
|
/*ADMOB CONSTANTS*/
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,17 @@ public class enums
|
||||||
{
|
{
|
||||||
/*Settings Manager*/
|
/*Settings Manager*/
|
||||||
public enum etype{
|
public enum etype{
|
||||||
on_update_favicon,
|
on_update_favicon,M_RESET_THEME_INVOKED_BACK,
|
||||||
onion,on_verify_selected_url_menu,
|
onion,on_verify_selected_url_menu,
|
||||||
welcome,abi_error, rate_failure,reported_success,bookmark, clear_tab,clear_history,clear_bookmark,report_url,rate_app,version_warning,start_orbot,download_file,download_file_long_press,on_long_press_url,
|
welcome,abi_error, rate_failure,reported_success,bookmark, clear_tab,clear_history,clear_bookmark,report_url,default_home,rate_app,version_warning,start_orbot,download_file,download_file_long_press,on_long_press_url,
|
||||||
cancel_welcome,ignore_abi,reload,connect_vpn,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,
|
cancel_welcome,ignore_abi,reload,connect_vpn,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_triggered_new_tab,url_clear,clear_recycler,url_clear_at,remove_from_database,is_empty,
|
url_triggered, url_triggered_new_tab,url_clear,clear_recycler,url_clear_at,remove_from_database,is_empty,
|
||||||
on_close_sesson,on_long_press,on_long_press_with_link,on_reset_app,on_bridge_mail,on_not_support,on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy,on_request_completed, on_update_history,on_update_suggestion,on_page_loaded,on_load_error,download_file_popup,on_init_ads,rate_application,search_update, open_new_tab
|
on_close_sesson,on_long_press,on_long_press_with_link,on_reset_app,on_bridge_mail,on_not_support, data_cleared,on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy,on_request_completed, on_update_history,on_update_suggestion,on_page_loaded,on_load_error,download_file_popup,on_init_ads,rate_application,search_update, open_new_tab
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Theme {
|
||||||
|
public static final int THEME_LIGHT = 0;
|
||||||
|
public static final int THEME_DARK = 1;
|
||||||
|
public static final int THEME_DEFAULT = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,6 +19,7 @@ public class keys
|
||||||
public static final String PROXY_DO_NOT_TRACK_HEADER_VALUE = "privacy.donottrackheader.value";
|
public static final String PROXY_DO_NOT_TRACK_HEADER_VALUE = "privacy.donottrackheader.value";
|
||||||
public static final String PROXY_IS_APP_RATED = "IS_APP_RATED";
|
public static final String PROXY_IS_APP_RATED = "IS_APP_RATED";
|
||||||
public static final String PROXY_LIST_TYPE = "list_type";
|
public static final String PROXY_LIST_TYPE = "list_type";
|
||||||
|
public static final String PROXY_IMAGE = "permissions.default.image";
|
||||||
|
|
||||||
/*Settings*/
|
/*Settings*/
|
||||||
|
|
||||||
|
@ -40,6 +41,16 @@ public class keys
|
||||||
public static final String SETTING_SEARCH_SUGGESTION = "SETTING_SEARCH_STATUS";
|
public static final String SETTING_SEARCH_SUGGESTION = "SETTING_SEARCH_STATUS";
|
||||||
public static final String SETTING_ZOOM = "SETTING_ZOOM";
|
public static final String SETTING_ZOOM = "SETTING_ZOOM";
|
||||||
public static final String SETTING_VOICE_INPUT = "SETTING_VOICE_INPUT";
|
public static final String SETTING_VOICE_INPUT = "SETTING_VOICE_INPUT";
|
||||||
|
public static final String SETTING_TRACKING_PROTECTION = "SETTING_TRACKING_PROTECTION";
|
||||||
|
public static final String SETTING_DONOT_TRACK = "SETTING_DONOT_TRACK";
|
||||||
|
public static final String SETTING_RESTORE_TAB = "SETTING_RESTORE_TAB";
|
||||||
|
public static final String SETTING_CHARACTER_ENCODING = "SETTING_CHARACTER_ENCODING";
|
||||||
|
public static final String SETTING_SHOW_IMAGES = "SETTING_SHOW_IMAGES";
|
||||||
|
public static final String SETTING_SHOW_FONTS = "SETTING_SHOW_FONTS";
|
||||||
|
public static final String SETTING_AUTO_PLAY = "SETTING_AUTO_PLAY";
|
||||||
|
public static final String SETTING_THEME = "SETTING_THEME_LIGHT";
|
||||||
|
public static final String SETTING_FULL_SCREEN_BROWSIING = "SETTING_FULL_SCREEN_BROWSIING";
|
||||||
|
public static final String SETTING_OPEN_URL_IN_NEW_TAB = "SETTING_OPEN_URL_IN_NEW_TAB";
|
||||||
|
|
||||||
/*Bridge Settings*/
|
/*Bridge Settings*/
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.darkweb.genesissearchengine.constants;
|
package com.darkweb.genesissearchengine.constants;
|
||||||
|
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
|
||||||
|
@ -11,8 +13,8 @@ public class status
|
||||||
{
|
{
|
||||||
/*App Status*/
|
/*App Status*/
|
||||||
|
|
||||||
public static String sAppCurrentABI = "7.0";
|
|
||||||
public static boolean sPaidStatus = false;
|
public static boolean sPaidStatus = false;
|
||||||
|
public static String sAppCurrentABI = "7.0";
|
||||||
|
|
||||||
/*Settings Status*/
|
/*Settings Status*/
|
||||||
|
|
||||||
|
@ -20,29 +22,41 @@ public class status
|
||||||
public static String sSettingRedirectStatus = strings.GENERIC_EMPTY_STR;
|
public static String sSettingRedirectStatus = strings.GENERIC_EMPTY_STR;
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean sThemeChanged = false;
|
||||||
public static boolean sSettingEnableZoom = true;
|
public static boolean sSettingEnableZoom = true;
|
||||||
public static boolean sSettingEnableVoiceInput = true;
|
public static boolean sSettingEnableVoiceInput = true;
|
||||||
public static boolean sSettingSearchHistory = false;
|
public static boolean sSettingSearchHistory = false;
|
||||||
public static boolean getsSettingSearchSuggestion = false;
|
public static boolean getsSettingSearchSuggestion = false;
|
||||||
public static boolean sSettingJavaStatus = true;
|
public static boolean sSettingJavaStatus = true;
|
||||||
public static boolean sSettingHistoryStatus = true;
|
public static boolean sClearOnExit = true;
|
||||||
public static boolean sSettingIsAppPaused = false;
|
public static boolean sSettingIsAppPaused = false;
|
||||||
public static boolean sSettingIsWelcomeEnabled = true;
|
public static boolean sSettingIsWelcomeEnabled = true;
|
||||||
public static boolean sSettingIsAppStarted = false;
|
public static boolean sSettingIsAppStarted = false;
|
||||||
public static boolean sSettingIsAppRated = false;
|
public static boolean sSettingIsAppRated = false;
|
||||||
public static boolean sSettingFontAdjustable = true;
|
public static boolean sSettingFontAdjustable = true;
|
||||||
public static boolean sSettingFirstStart = true;
|
public static boolean sSettingFirstStart = true;
|
||||||
|
public static boolean sSettingTrackingProtection = true;
|
||||||
|
public static boolean sStatusDoNotTrack = true;
|
||||||
|
public static boolean sRestoreTabs = false;
|
||||||
|
public static boolean sCharacterEncoding = false;
|
||||||
|
public static boolean sShowWebFonts = false;
|
||||||
|
public static boolean sAutoPlay = false;
|
||||||
|
public static boolean sFullScreenBrowsing = false;
|
||||||
|
public static boolean sOpenURLInNewTab = false;
|
||||||
|
public static int sTheme = enums.Theme.THEME_DEFAULT;
|
||||||
public static int sSettingCookieStatus = ACCEPT_FIRST_PARTY;
|
public static int sSettingCookieStatus = ACCEPT_FIRST_PARTY;
|
||||||
|
public static int sShowImages = -1;
|
||||||
public static float sSettingFontSize = 1;
|
public static float sSettingFontSize = 1;
|
||||||
public static String sSettingLanguage = "en";
|
public static String sSettingLanguage = "en";
|
||||||
|
public static boolean sDefaultNightMode;
|
||||||
|
|
||||||
/*Bridge Status*/
|
/*Bridge Status*/
|
||||||
|
|
||||||
public static int sBridgeNotificationManual = 0;
|
|
||||||
public static boolean sBridgeGatewayAuto = false;
|
public static boolean sBridgeGatewayAuto = false;
|
||||||
public static boolean sBridgeGatewayManual = false;
|
public static boolean sBridgeGatewayManual = false;
|
||||||
public static boolean sBridgeVPNStatus = false;
|
public static boolean sBridgeVPNStatus = false;
|
||||||
public static boolean sBridgeStatus = false;
|
public static boolean sBridgeStatus = false;
|
||||||
|
public static int sBridgeNotificationManual = 0;
|
||||||
public static String sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
|
public static String sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +65,7 @@ public class status
|
||||||
status.sSettingSearchHistory = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true));
|
status.sSettingSearchHistory = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true));
|
||||||
status.getsSettingSearchSuggestion = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true));
|
status.getsSettingSearchSuggestion = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true));
|
||||||
status.sSettingJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true));
|
status.sSettingJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true));
|
||||||
status.sSettingHistoryStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true));
|
status.sClearOnExit = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true));
|
||||||
status.sBridgeGatewayAuto = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_AUTO,true));
|
status.sBridgeGatewayAuto = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_AUTO,true));
|
||||||
status.sBridgeGatewayManual = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
|
status.sBridgeGatewayManual = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
|
||||||
status.sSettingIsWelcomeEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true));
|
status.sSettingIsWelcomeEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true));
|
||||||
|
@ -62,7 +76,8 @@ public class status
|
||||||
status.sSettingFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FIRST_INSTALLED,true));
|
status.sSettingFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FIRST_INSTALLED,true));
|
||||||
status.sSettingEnableZoom = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true));
|
status.sSettingEnableZoom = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true));
|
||||||
status.sSettingEnableVoiceInput = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true));
|
status.sSettingEnableVoiceInput = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true));
|
||||||
|
status.sSettingTrackingProtection = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_TRACKING_PROTECTION,true));
|
||||||
|
status.sStatusDoNotTrack = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true));
|
||||||
status.sSettingCookieStatus = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
|
status.sSettingCookieStatus = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
|
||||||
status.sSettingFontSize = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
|
status.sSettingFontSize = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
|
||||||
|
|
||||||
|
@ -70,6 +85,15 @@ public class status
|
||||||
status.sSettingSearchStatus = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
|
status.sSettingSearchStatus = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
|
||||||
status.sBridgeCustomBridge = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
|
status.sBridgeCustomBridge = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
|
||||||
status.sBridgeNotificationManual = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,0));
|
status.sBridgeNotificationManual = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,0));
|
||||||
|
|
||||||
|
status.sRestoreTabs = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false));
|
||||||
|
status.sCharacterEncoding = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
|
||||||
|
status.sShowImages = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0));
|
||||||
|
status.sShowWebFonts = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,false));
|
||||||
|
status.sAutoPlay = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_AUTO_PLAY,false));
|
||||||
|
status.sFullScreenBrowsing = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,false));
|
||||||
|
status.sTheme = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_THEME,enums.Theme.THEME_DEFAULT));
|
||||||
|
status.sOpenURLInNewTab = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,false));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class strings
|
||||||
public static final String SETTING_CUSTOM_FONTS = "Custom Font";
|
public static final String SETTING_CUSTOM_FONTS = "Custom Font";
|
||||||
public static final String SETTING_PERCENT_SIGN = "%";
|
public static final String SETTING_PERCENT_SIGN = "%";
|
||||||
public static final String SETTING_DEFAULT_LANGUAGE = "en";
|
public static final String SETTING_DEFAULT_LANGUAGE = "en";
|
||||||
|
public static final String SETTING_DEFAULT_NEW_TAB_URL = "about:blank";
|
||||||
|
|
||||||
/*Home Manager*/
|
/*Home Manager*/
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,10 @@ public class bookmarkDataModel {
|
||||||
return mBookmarks;
|
return mBookmarks;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addBookmark(String url, String title){
|
void addBookmark(String pURL, String pTitle){
|
||||||
if(url.length()>1500){
|
if(pURL.endsWith("about:blank"))
|
||||||
|
pURL = "about:blank";
|
||||||
|
if(pURL.length()>1500){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int autoval = 0;
|
int autoval = 0;
|
||||||
|
@ -38,20 +40,26 @@ public class bookmarkDataModel {
|
||||||
autoval = mBookmarks.get(0).getID()+1;
|
autoval = mBookmarks.get(0).getID()+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(title.equals(""))
|
if(pTitle.equals(""))
|
||||||
{
|
{
|
||||||
title = "New_Bookmark"+autoval;
|
pTitle = "New_Bookmark"+autoval;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] params = new String[2];
|
String[] params = new String[2];
|
||||||
params[0] = title;
|
params[0] = pTitle;
|
||||||
params[1] = url;
|
params[1] = pURL;
|
||||||
|
|
||||||
databaseController.getInstance().execSQL("INSERT INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params);
|
if(!pTitle.equals("loading")){
|
||||||
mBookmarks.add(0,new bookmarkRowModel(title, url,autoval));
|
databaseController.getInstance().execSQL("INSERT INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params);
|
||||||
|
}
|
||||||
|
mBookmarks.add(0,new bookmarkRowModel(pTitle, pURL,autoval));
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearBookmark(int pID) {
|
void clearBookmark(){
|
||||||
|
mBookmarks.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void deleteBookmark(int pID) {
|
||||||
for(int mCounter=0;mCounter<mBookmarks.size();mCounter++){
|
for(int mCounter=0;mCounter<mBookmarks.size();mCounter++){
|
||||||
if(mBookmarks.get(mCounter).getID()==pID){
|
if(mBookmarks.get(mCounter).getID()==pID){
|
||||||
mBookmarks.remove(mCounter);
|
mBookmarks.remove(mCounter);
|
||||||
|
@ -60,15 +68,18 @@ public class bookmarkDataModel {
|
||||||
databaseController.getInstance().execSQL("delete from bookmark where id="+ pID,null);
|
databaseController.getInstance().execSQL("delete from bookmark where id="+ pID,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object onTrigger(dataEnums.eBookmarkCommands p_commands, List<Object> p_data){
|
public Object onTrigger(dataEnums.eBookmarkCommands p_commands, List<Object> pData){
|
||||||
if(p_commands == dataEnums.eBookmarkCommands.M_GET_BOOKMARK){
|
if(p_commands == dataEnums.eBookmarkCommands.M_GET_BOOKMARK){
|
||||||
return getBookmark();
|
return getBookmark();
|
||||||
}
|
}
|
||||||
if(p_commands == dataEnums.eBookmarkCommands.M_ADD_BOOKMARK){
|
if(p_commands == dataEnums.eBookmarkCommands.M_ADD_BOOKMARK){
|
||||||
addBookmark((String)p_data.get(0), (String)p_data.get(1));
|
addBookmark((String)pData.get(0), (String)pData.get(1));
|
||||||
}
|
}
|
||||||
if(p_commands == dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK){
|
if(p_commands == dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK){
|
||||||
clearBookmark((int)p_data.get(0));
|
deleteBookmark((int)pData.get(0));
|
||||||
|
}
|
||||||
|
if(p_commands == dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK){
|
||||||
|
clearBookmark();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -3,13 +3,8 @@ package com.darkweb.genesissearchengine.dataManager;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
import com.darkweb.genesissearchengine.appManager.activityContextManager;
|
||||||
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
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 com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.constants.status;
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -18,11 +13,12 @@ public class dataController
|
||||||
{
|
{
|
||||||
/*Private Variables*/
|
/*Private Variables*/
|
||||||
|
|
||||||
private dataModel mDataModel;
|
private tabDataModel mTabModel;
|
||||||
private preferenceDataModel mPreferenceModel;
|
private preferenceDataModel mPreferenceModel;
|
||||||
private historyDataModel mHistoryModel;
|
private historyDataModel mHistoryModel;
|
||||||
private imageCacheModel mImageCacheModel;
|
private imageCacheModel mImageCacheModel;
|
||||||
private bookmarkDataModel mBookMarkDataModel;
|
private bookmarkDataModel mBookMarkDataModel;
|
||||||
|
private suggestionDataModel mSuggestionDataModel;
|
||||||
|
|
||||||
/*Private Declarations*/
|
/*Private Declarations*/
|
||||||
|
|
||||||
|
@ -36,15 +32,16 @@ public class dataController
|
||||||
|
|
||||||
public void initialize(AppCompatActivity app_context){
|
public void initialize(AppCompatActivity app_context){
|
||||||
mHistoryModel = new historyDataModel();
|
mHistoryModel = new historyDataModel();
|
||||||
mDataModel = new dataModel();
|
mTabModel = new tabDataModel();
|
||||||
mPreferenceModel = new preferenceDataModel(app_context);
|
mPreferenceModel = new preferenceDataModel(app_context);
|
||||||
mImageCacheModel = new imageCacheModel();
|
mImageCacheModel = new imageCacheModel();
|
||||||
mBookMarkDataModel = new bookmarkDataModel();
|
mBookMarkDataModel = new bookmarkDataModel();
|
||||||
|
mSuggestionDataModel = new suggestionDataModel();
|
||||||
}
|
}
|
||||||
public void initializeListData(){
|
public void initializeListData(){
|
||||||
mDataModel.initSuggestions();
|
invokeSuggestion(dataEnums.eSuggestionCommands.M_INIT_SUGGESTION, null);
|
||||||
mBookMarkDataModel.initializebookmark(databaseController.getInstance().selectBookmark());
|
mBookMarkDataModel.initializebookmark(databaseController.getInstance().selectBookmark());
|
||||||
if(!status.sSettingHistoryStatus)
|
if(!status.sClearOnExit)
|
||||||
{
|
{
|
||||||
mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY, Arrays.asList(databaseController.getInstance().selectHistory(0,constants.CONST_FETCHABLE_LIST_SIZE), databaseController.getInstance().getLargestHistoryID(),databaseController.getInstance().getLargestHistoryID()));
|
mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY, Arrays.asList(databaseController.getInstance().selectHistory(0,constants.CONST_FETCHABLE_LIST_SIZE), databaseController.getInstance().getLargestHistoryID(),databaseController.getInstance().getLargestHistoryID()));
|
||||||
}
|
}
|
||||||
|
@ -74,71 +71,27 @@ public class dataController
|
||||||
return mPreferenceModel.onTrigger(p_commands, p_data);
|
return mPreferenceModel.onTrigger(p_commands, p_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*Recieving History*/
|
/*Recieving History*/
|
||||||
public Object invokeBookmark(dataEnums.eBookmarkCommands p_commands, List<Object> p_data){
|
public Object invokeBookmark(dataEnums.eBookmarkCommands p_commands, List<Object> p_data){
|
||||||
return mBookMarkDataModel.onTrigger(p_commands, p_data);
|
return mBookMarkDataModel.onTrigger(p_commands, p_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object invokeSuggestion(dataEnums.eSuggestionCommands p_commands, List<Object> p_data){
|
||||||
|
if(dataEnums.eSuggestionCommands.M_UPDATE_SUGGESTION.equals(p_commands)){
|
||||||
|
mSuggestionDataModel.onTrigger(p_commands, p_data);
|
||||||
|
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
|
||||||
|
}
|
||||||
|
else if(dataEnums.eSuggestionCommands.M_ADD_SUGGESTION.equals(p_commands)){
|
||||||
|
mSuggestionDataModel.onTrigger(p_commands, p_data);
|
||||||
|
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
|
||||||
|
}else {
|
||||||
|
return mSuggestionDataModel.onTrigger(p_commands, p_data);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*Recieving Suggestions*/
|
|
||||||
|
|
||||||
public ArrayList<historyRowModel> getSuggestions(){
|
|
||||||
return mDataModel.getmSuggestions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Recieving Tabs*/
|
public Object invokeTab(dataEnums.eTabCommands p_commands, List<Object> p_data){
|
||||||
|
return mTabModel.onTrigger(p_commands, p_data);
|
||||||
public ArrayList<tabRowModel> getTab(){
|
|
||||||
return mDataModel.getTab();
|
|
||||||
}
|
}
|
||||||
public void addTab(geckoSession mSession,boolean isHardCopy){
|
|
||||||
mDataModel.addTabs(mSession,isHardCopy);
|
|
||||||
}
|
|
||||||
public void clearTabs(){
|
|
||||||
mDataModel.clearTab();
|
|
||||||
}
|
|
||||||
public void closeTab(geckoSession session){
|
|
||||||
mDataModel.closeTab(session);
|
|
||||||
}
|
|
||||||
public void moveTabToTop(geckoSession session){
|
|
||||||
mDataModel.moveTabToTop(session);
|
|
||||||
}
|
|
||||||
public tabRowModel getCurrentTab(){
|
|
||||||
return mDataModel.getCurrentTab();
|
|
||||||
}
|
|
||||||
public int getTotalTabs(){
|
|
||||||
return mDataModel.getTotalTabs();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateSuggestionURL(String url,String title) {
|
|
||||||
url = helperMethod.removeLastSlash(url);
|
|
||||||
mDataModel.updateSuggestionURL(url,title,false);
|
|
||||||
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
|
|
||||||
}
|
|
||||||
public void addSuggesion(String url,String title) {
|
|
||||||
url = helperMethod.removeLastSlash(url);
|
|
||||||
mDataModel.addSuggenstions(url,title,false);
|
|
||||||
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,12 @@ public class dataEnums
|
||||||
public enum eImageCacheCommands{
|
public enum eImageCacheCommands{
|
||||||
M_SET_IMAGE, M_GET_IMAGE, M_CLEAR_IMAGE, M_CLEAR_OLD_IMAGES
|
M_SET_IMAGE, M_GET_IMAGE, M_CLEAR_IMAGE, M_CLEAR_OLD_IMAGES
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum eSuggestionCommands{
|
||||||
|
M_UPDATE_SUGGESTION, M_CLEAR_SUGGESTION, M_INIT_SUGGESTION, M_ADD_SUGGESTION, M_GET_SUGGESTION
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eTabCommands{
|
||||||
|
M_ADD_TAB, M_CLEAR_TAB, M_CLOSE_TAB_PARAMETERIZED, CLOSE_TAB, GET_TAB, GET_CURRENT_TAB, GET_TOTAL_TAB, MOVE_TAB_TO_TOP
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -29,7 +29,7 @@ public class historyDataModel {
|
||||||
m_max_history_Id = pMaxHistoryId;
|
m_max_history_Id = pMaxHistoryId;
|
||||||
m_history_size = pHistorySize;
|
m_history_size = pHistorySize;
|
||||||
this.m_history = history;
|
this.m_history = history;
|
||||||
if(!status.sSettingHistoryStatus){
|
if(!status.sClearOnExit){
|
||||||
initializeCache(history);
|
initializeCache(history);
|
||||||
}else {
|
}else {
|
||||||
clearHistory();
|
clearHistory();
|
||||||
|
@ -117,7 +117,11 @@ public class historyDataModel {
|
||||||
m_history_size += 1;
|
m_history_size += 1;
|
||||||
|
|
||||||
String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime());
|
String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime());
|
||||||
databaseController.getInstance().execSQL("INSERT INTO history(id,date,url,title) VALUES("+ m_max_history_Id +",'" + m_date + "',?,?);",params);
|
|
||||||
|
if(!p_header.equals("loading")){
|
||||||
|
databaseController.getInstance().execSQL("INSERT INTO history(id,date,url,title) VALUES("+ m_max_history_Id +",'" + m_date + "',?,?);",params);
|
||||||
|
}
|
||||||
|
|
||||||
m_history.add(0,new historyRowModel(p_header,p_url, m_max_history_Id));
|
m_history.add(0,new historyRowModel(p_header,p_url, m_max_history_Id));
|
||||||
m_history_cache.put(m_max_history_Id,m_history.get(0));
|
m_history_cache.put(m_max_history_Id,m_history.get(0));
|
||||||
removeDuplicateURLFromHistory(m_max_history_Id, p_url);
|
removeDuplicateURLFromHistory(m_max_history_Id, p_url);
|
||||||
|
|
|
@ -1,253 +1,188 @@
|
||||||
package com.darkweb.genesissearchengine.dataManager;
|
package com.darkweb.genesissearchengine.dataManager;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
|
||||||
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
|
import java.util.ArrayList;
|
||||||
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
|
import java.util.HashMap;
|
||||||
import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession;
|
import java.util.List;
|
||||||
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
|
import java.util.Map;
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
public class suggestionDataModel {
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
private ArrayList<historyRowModel> mSuggestions = new ArrayList<>();
|
||||||
import java.util.Map;
|
private Map<String, historyRowModel> mSuggestionCache = new HashMap<>();
|
||||||
|
|
||||||
@SuppressLint("CommitPrefEdits")
|
private void initSuggestions(){
|
||||||
class dataModel
|
|
||||||
{
|
addSuggenstions("https://duckduckgo.com","Duckduckgo",true);
|
||||||
private ArrayList<tabRowModel> mTabs = new ArrayList<>();
|
addSuggenstions("https://bbc.com","BBC",true);
|
||||||
private ArrayList<historyRowModel> mSuggestions = new ArrayList<>();
|
addSuggenstions("https://youtube.com","Youtube",true);
|
||||||
private Map<String, historyRowModel> mSuggestionCache = new HashMap<>();
|
addSuggenstions("https://facebook.com","Facebook",true);
|
||||||
|
addSuggenstions("https://twitter.com","Twitter",true);
|
||||||
|
addSuggenstions("https://amazon.com","Amazon",true);
|
||||||
/*List History*/
|
addSuggenstions("https://imdb.com","IMDB",true);
|
||||||
void updateSuggestionURL(String url, String newURL,boolean isLoading){
|
addSuggenstions("https://reddit.com","Reddit",true);
|
||||||
if(url.length()>1500){
|
addSuggenstions("https://pinterest.com","Pinterest",true);
|
||||||
return;
|
addSuggenstions("https://ebay.com","EBay",true);
|
||||||
}
|
addSuggenstions("https://tripadvisor.com","Trip Advisor",true);
|
||||||
url = helperMethod.removeLastSlash(url);
|
addSuggenstions("https://craigslist.org","Craigslist",true);
|
||||||
url = helperMethod.urlWithoutPrefix(url);
|
addSuggenstions("https://walmart.com","Walmart",true);
|
||||||
historyRowModel model = mSuggestionCache.get(url);
|
addSuggenstions("https://instagram.com","Instagram",true);
|
||||||
if(model!=null){
|
addSuggenstions("https://google.com","Google",true);
|
||||||
mSuggestionCache.remove(url);
|
addSuggenstions("https://nytimes.com","NY Times",true);
|
||||||
if(!newURL.equals("loading"))
|
addSuggenstions("https://apple.com","Apple",true);
|
||||||
model.setHeader(newURL);
|
addSuggenstions("https://linkedin.com","Linkedin",true);
|
||||||
mSuggestionCache.put(url,model);
|
addSuggenstions("https://indeed.com","Indeed",true);
|
||||||
}
|
addSuggenstions("https://play.google.com","Play.Google",true);
|
||||||
|
addSuggenstions("https://espn.com","ESPN",true);
|
||||||
String[] params = new String[2];
|
addSuggenstions("https://webmd.com","Webmd",true);
|
||||||
params[0] = newURL;
|
addSuggenstions("https://cnn.com","CNN",true);
|
||||||
params[1] = url;
|
addSuggenstions("https://homedepot.com","Homedepot",true);
|
||||||
if(newURL.length()>0 && !isLoading){
|
addSuggenstions("https://etsy.com","ETSY",true);
|
||||||
// databaseController.getInstance().execSQL("UPDATE history SET title = ? , date = DateTime('now') WHERE url = ?",params);
|
addSuggenstions("https://netflix.com","Netflix",true);
|
||||||
}
|
addSuggenstions("https://quora.com","Quora",true);
|
||||||
}
|
addSuggenstions("https://microsoft.com","Microsoft",true);
|
||||||
void addSuggenstions(String url, String title,boolean isLoading){
|
addSuggenstions("https://target.com","Target",true);
|
||||||
if(url.length()>1500 || title.equals("$TITLE") || title.equals("loading")){
|
addSuggenstions("https://merriam-webster.com","Merriam Webster",true);
|
||||||
return;
|
addSuggenstions("https://forbes.com","Forbes",true);
|
||||||
}
|
addSuggenstions("https://mapquest.com","Mapquest",true);
|
||||||
|
addSuggenstions("https://nih.gov","NIH",true);
|
||||||
url = helperMethod.removeLastSlash(url);
|
addSuggenstions("https://gamepedia.com","Gamepedia",true);
|
||||||
url = helperMethod.urlWithoutPrefix(url);
|
addSuggenstions("https://yahoo.com","Yahoo",true);
|
||||||
historyRowModel tempModel = mSuggestionCache.get(url);
|
addSuggenstions("https://healthline.com","Healthline",true);
|
||||||
|
addSuggenstions("https://foxnews.com","Foxnews",true);
|
||||||
if(tempModel==null) {
|
addSuggenstions("https://allrecipes.com","All Recipes",true);
|
||||||
historyRowModel model = new historyRowModel(title, url, -1);
|
addSuggenstions("https://quizlet.com","Quizlet",true);
|
||||||
mSuggestionCache.put(url, model);
|
addSuggenstions("https://weather.com","Weather",true);
|
||||||
mSuggestions.add(0, mSuggestionCache.get(url));
|
addSuggenstions("https://bestbuy.com","Bestbuy",true);
|
||||||
|
addSuggenstions("https://urbandictionary.com","Urbandictionary",true);
|
||||||
}
|
addSuggenstions("https://mayoclinic.org","Mayoclinic",true);
|
||||||
else {
|
addSuggenstions("https://aol.com" ,"AOL",true);
|
||||||
updateSuggestionURL(url,title,isLoading);
|
addSuggenstions("https://genius.com","Genius",true);
|
||||||
}
|
addSuggenstions("https://zillow.com","Zillow",true);
|
||||||
|
addSuggenstions("https://usatoday.com","Usatoday",true);
|
||||||
String[] params = new String[2];
|
addSuggenstions("https://glassdoor.com","Glassdoor",true);
|
||||||
params[0] = title;
|
addSuggenstions("https://msn.com","MSN",true);
|
||||||
params[1] = url;
|
addSuggenstions("https://rottentomatoes.com","Rotten Tomatoes",true);
|
||||||
if(title.length()>0 && !isLoading){
|
addSuggenstions("https://lowes.com","Lowes",true);
|
||||||
//databaseController.getInstance().execSQL("UPDATE history SET title = ? , date = DateTime('now') WHERE url = ?",params);
|
addSuggenstions("https://dictionary.com","Dictionary",true);
|
||||||
}
|
addSuggenstions("https://businessinsider.com","Business Insider",true);
|
||||||
}
|
addSuggenstions("https://usnews.com","US News",true);
|
||||||
|
addSuggenstions("https://medicalnewstoday.com","Medical News Today",true);
|
||||||
|
addSuggenstions("https://britannica.com","Britannica",true);
|
||||||
/*List Tabs*/
|
addSuggenstions("https://washingtonpost.com","Washington Post",true);
|
||||||
|
addSuggenstions("https://usps.com","USPS",true);
|
||||||
void addTabs(geckoSession mSession,boolean isHardCopy){
|
addSuggenstions("https://finance.yahoo.com","Finance Yahoo",true);
|
||||||
if(!isHardCopy){
|
addSuggenstions("https://irs.gov","IRS",true);
|
||||||
mTabs.add(0,new tabRowModel(mSession,mTabs.size()));
|
addSuggenstions("https://yellowpages.com","Yellow Pages",true);
|
||||||
}
|
addSuggenstions("https://chase.com","Chase",true);
|
||||||
else {
|
addSuggenstions("https://retailmenot.com","Retail Menot",true);
|
||||||
mTabs.add(0,new tabRowModel(mSession,mTabs.size()));
|
addSuggenstions("https://accuweather.com","Accuweather",true);
|
||||||
}
|
addSuggenstions("https://wayfair.com","Way Fair",true);
|
||||||
}
|
addSuggenstions("https://go.com","GO",true);
|
||||||
ArrayList<tabRowModel> getTab(){
|
addSuggenstions("https://live.com","Live",true);
|
||||||
return mTabs;
|
addSuggenstions("https://login.yahoo.com","Login Yahoo",true);
|
||||||
}
|
addSuggenstions("https://steamcommunity.com","Steam Community",true);
|
||||||
void clearTab() {
|
addSuggenstions("https://xfinity.com","XFinity",true);
|
||||||
int size = mTabs.size();
|
addSuggenstions("https://cnet.com","CNET",true);
|
||||||
for(int counter = 0; counter< size; counter++){
|
addSuggenstions("https://ign.com","IGN",true);
|
||||||
mTabs.get(0).getSession().stop();
|
addSuggenstions("https://steampowered.com","Steam Powered",true);
|
||||||
mTabs.remove(0);
|
addSuggenstions("https://macys.com","Macys",true);
|
||||||
}
|
addSuggenstions("https://wikihow.com","Wikihow",true);
|
||||||
if(mTabs.size()>0){
|
addSuggenstions("https://mail.yahoo.com","Mail Yahoo",true);
|
||||||
//Log.i("FUCKERRROR125:","_FERROR_");
|
addSuggenstions("wiktionary.org","Wiktionary",true);
|
||||||
mTabs.get(0).getSession().closeSession();
|
addSuggenstions("https://cbssports.com","Cbssports",true);
|
||||||
}
|
addSuggenstions("https://cnbc.com","CNBC",true);
|
||||||
}
|
addSuggenstions("https://bankofamerica.com","Bank Of America",true);
|
||||||
void closeTab(geckoSession mSession) {
|
addSuggenstions("https://expedia.com","Expedia",true);
|
||||||
|
addSuggenstions("https://wellsfargo.com","Wellsfargo",true);
|
||||||
for(int counter = 0; counter< mTabs.size(); counter++){
|
addSuggenstions("https://groupon.com","Groupon",true);
|
||||||
if(mTabs.get(counter).getSession().getSessionID()==mSession.getSessionID())
|
addSuggenstions("https://twitch.tv","Twitch",true);
|
||||||
{
|
addSuggenstions("https://khanacademy.org","Khan Academy",true);
|
||||||
mTabs.remove(counter);
|
addSuggenstions("https://theguardian.com","The Guardian",true);
|
||||||
break;
|
addSuggenstions("https://paypal.com","Paypal",true);
|
||||||
}
|
addSuggenstions("https://spotify.com","Spotify",true);
|
||||||
else {
|
addSuggenstions("https://att.com","ATT",true);
|
||||||
mTabs.get(counter).setId(mTabs.get(counter).getmId()+1);
|
addSuggenstions("https://nfl.com","NFL",true);
|
||||||
}
|
addSuggenstions("https://realtor.com","Realtor",true);
|
||||||
}
|
addSuggenstions("https://ca.gov","CA Gov",true);
|
||||||
}
|
addSuggenstions("https://goodreads.com","Good Reads",true);
|
||||||
void moveTabToTop(geckoSession mSession) {
|
addSuggenstions("https://office.com","Office",true);
|
||||||
|
addSuggenstions("https://ufl.edu","UFL",true);
|
||||||
for(int counter = 0; counter< mTabs.size(); counter++){
|
addSuggenstions("https://mlb.com","MLB",true);
|
||||||
|
addSuggenstions("https://foodnetwork.com","Food Network",true);
|
||||||
if(mTabs.get(counter).getSession().getSessionID()==mSession.getSessionID())
|
addSuggenstions("https://apartments.com","Apartments",true);
|
||||||
{
|
addSuggenstions("https://npr.org","NPR",true);
|
||||||
/***BIG PROBLEM***/
|
addSuggenstions("https://wowhead.com","Wow Head",true);
|
||||||
mTabs.remove(counter);
|
addSuggenstions("https://bing.com","Bing",true);
|
||||||
mTabs.add(0,new tabRowModel(mSession,0));
|
addSuggenstions("https://google.com","Google",true);
|
||||||
break;
|
addSuggenstions("https://boogle.store","Genesis Search",true);
|
||||||
}else {
|
}
|
||||||
mTabs.get(counter).setId(mTabs.get(counter).getmId()+1);
|
|
||||||
}
|
private void addSuggenstions(String url, String title,boolean isLoading){
|
||||||
}
|
url = helperMethod.removeLastSlash(url);
|
||||||
}
|
if(url.length()>1500 || title.equals("$TITLE") || title.equals("loading")){
|
||||||
tabRowModel getCurrentTab(){
|
return;
|
||||||
if(mTabs.size()>0){
|
}
|
||||||
return mTabs.get(0);
|
|
||||||
}
|
url = helperMethod.removeLastSlash(url);
|
||||||
else {
|
url = helperMethod.urlWithoutPrefix(url);
|
||||||
return null;
|
historyRowModel tempModel = mSuggestionCache.get(url);
|
||||||
}
|
|
||||||
}
|
if(tempModel==null) {
|
||||||
int getTotalTabs(){
|
historyRowModel model = new historyRowModel(title, url, -1);
|
||||||
return mTabs.size();
|
mSuggestionCache.put(url, model);
|
||||||
}
|
mSuggestions.add(0, mSuggestionCache.get(url));
|
||||||
|
|
||||||
/*List Suggestion*/
|
}
|
||||||
|
else {
|
||||||
ArrayList<historyRowModel> getmSuggestions(){
|
updateSuggestionURL(url,title);
|
||||||
return mSuggestions;
|
}
|
||||||
}
|
|
||||||
void clearSuggestion(){
|
}
|
||||||
mSuggestions.clear();
|
|
||||||
initSuggestions();
|
private void clearSuggestion(){
|
||||||
}
|
mSuggestions.clear();
|
||||||
void initSuggestions(){
|
initSuggestions();
|
||||||
|
}
|
||||||
addSuggenstions("https://duckduckgo.com","Duckduckgo",true);
|
|
||||||
addSuggenstions("https://bbc.com","BBC",true);
|
private void updateSuggestionURL(String url, String newURL){
|
||||||
addSuggenstions("https://youtube.com","Youtube",true);
|
url = helperMethod.removeLastSlash(url);
|
||||||
addSuggenstions("https://facebook.com","Facebook",true);
|
if(url.length()>1500){
|
||||||
addSuggenstions("https://twitter.com","Twitter",true);
|
return;
|
||||||
addSuggenstions("https://amazon.com","Amazon",true);
|
}
|
||||||
addSuggenstions("https://imdb.com","IMDB",true);
|
url = helperMethod.removeLastSlash(url);
|
||||||
addSuggenstions("https://reddit.com","Reddit",true);
|
url = helperMethod.urlWithoutPrefix(url);
|
||||||
addSuggenstions("https://pinterest.com","Pinterest",true);
|
historyRowModel model = mSuggestionCache.get(url);
|
||||||
addSuggenstions("https://ebay.com","EBay",true);
|
if(model!=null){
|
||||||
addSuggenstions("https://tripadvisor.com","Trip Advisor",true);
|
mSuggestionCache.remove(url);
|
||||||
addSuggenstions("https://craigslist.org","Craigslist",true);
|
if(!newURL.equals("loading"))
|
||||||
addSuggenstions("https://walmart.com","Walmart",true);
|
model.setHeader(newURL);
|
||||||
addSuggenstions("https://instagram.com","Instagram",true);
|
mSuggestionCache.put(url,model);
|
||||||
addSuggenstions("https://google.com","Google",true);
|
}
|
||||||
addSuggenstions("https://nytimes.com","NY Times",true);
|
}
|
||||||
addSuggenstions("https://apple.com","Apple",true);
|
|
||||||
addSuggenstions("https://linkedin.com","Linkedin",true);
|
private ArrayList<historyRowModel> getmSuggestions(){
|
||||||
addSuggenstions("https://indeed.com","Indeed",true);
|
return mSuggestions;
|
||||||
addSuggenstions("https://play.google.com","Play.Google",true);
|
}
|
||||||
addSuggenstions("https://espn.com","ESPN",true);
|
|
||||||
addSuggenstions("https://webmd.com","Webmd",true);
|
public Object onTrigger(dataEnums.eSuggestionCommands p_commands, List<Object> p_data){
|
||||||
addSuggenstions("https://cnn.com","CNN",true);
|
if(p_commands.equals(dataEnums.eSuggestionCommands.M_CLEAR_SUGGESTION)){
|
||||||
addSuggenstions("https://homedepot.com","Homedepot",true);
|
clearSuggestion();
|
||||||
addSuggenstions("https://etsy.com","ETSY",true);
|
}
|
||||||
addSuggenstions("https://netflix.com","Netflix",true);
|
else if(p_commands.equals(dataEnums.eSuggestionCommands.M_INIT_SUGGESTION)){
|
||||||
addSuggenstions("https://quora.com","Quora",true);
|
initSuggestions();
|
||||||
addSuggenstions("https://microsoft.com","Microsoft",true);
|
}
|
||||||
addSuggenstions("https://target.com","Target",true);
|
else if(p_commands.equals(dataEnums.eSuggestionCommands.M_GET_SUGGESTION)){
|
||||||
addSuggenstions("https://merriam-webster.com","Merriam Webster",true);
|
return getmSuggestions();
|
||||||
addSuggenstions("https://forbes.com","Forbes",true);
|
}
|
||||||
addSuggenstions("https://mapquest.com","Mapquest",true);
|
else if(p_commands.equals(dataEnums.eSuggestionCommands.M_UPDATE_SUGGESTION)){
|
||||||
addSuggenstions("https://nih.gov","NIH",true);
|
updateSuggestionURL((String)p_data.get(0),(String) p_data.get(1));
|
||||||
addSuggenstions("https://gamepedia.com","Gamepedia",true);
|
}
|
||||||
addSuggenstions("https://yahoo.com","Yahoo",true);
|
else if(p_commands.equals(dataEnums.eSuggestionCommands.M_ADD_SUGGESTION)){
|
||||||
addSuggenstions("https://healthline.com","Healthline",true);
|
addSuggenstions((String)p_data.get(0),(String) p_data.get(1),true);
|
||||||
addSuggenstions("https://foxnews.com","Foxnews",true);
|
}
|
||||||
addSuggenstions("https://allrecipes.com","All Recipes",true);
|
return null;
|
||||||
addSuggenstions("https://quizlet.com","Quizlet",true);
|
}
|
||||||
addSuggenstions("https://weather.com","Weather",true);
|
|
||||||
addSuggenstions("https://bestbuy.com","Bestbuy",true);
|
}
|
||||||
addSuggenstions("https://urbandictionary.com","Urbandictionary",true);
|
|
||||||
addSuggenstions("https://mayoclinic.org","Mayoclinic",true);
|
|
||||||
addSuggenstions("https://aol.com" ,"AOL",true);
|
|
||||||
addSuggenstions("https://genius.com","Genius",true);
|
|
||||||
addSuggenstions("https://zillow.com","Zillow",true);
|
|
||||||
addSuggenstions("https://usatoday.com","Usatoday",true);
|
|
||||||
addSuggenstions("https://glassdoor.com","Glassdoor",true);
|
|
||||||
addSuggenstions("https://msn.com","MSN",true);
|
|
||||||
addSuggenstions("https://rottentomatoes.com","Rotten Tomatoes",true);
|
|
||||||
addSuggenstions("https://lowes.com","Lowes",true);
|
|
||||||
addSuggenstions("https://dictionary.com","Dictionary",true);
|
|
||||||
addSuggenstions("https://businessinsider.com","Business Insider",true);
|
|
||||||
addSuggenstions("https://usnews.com","US News",true);
|
|
||||||
addSuggenstions("https://medicalnewstoday.com","Medical News Today",true);
|
|
||||||
addSuggenstions("https://britannica.com","Britannica",true);
|
|
||||||
addSuggenstions("https://washingtonpost.com","Washington Post",true);
|
|
||||||
addSuggenstions("https://usps.com","USPS",true);
|
|
||||||
addSuggenstions("https://finance.yahoo.com","Finance Yahoo",true);
|
|
||||||
addSuggenstions("https://irs.gov","IRS",true);
|
|
||||||
addSuggenstions("https://yellowpages.com","Yellow Pages",true);
|
|
||||||
addSuggenstions("https://chase.com","Chase",true);
|
|
||||||
addSuggenstions("https://retailmenot.com","Retail Menot",true);
|
|
||||||
addSuggenstions("https://accuweather.com","Accuweather",true);
|
|
||||||
addSuggenstions("https://wayfair.com","Way Fair",true);
|
|
||||||
addSuggenstions("https://go.com","GO",true);
|
|
||||||
addSuggenstions("https://live.com","Live",true);
|
|
||||||
addSuggenstions("https://login.yahoo.com","Login Yahoo",true);
|
|
||||||
addSuggenstions("https://steamcommunity.com","Steam Community",true);
|
|
||||||
addSuggenstions("https://xfinity.com","XFinity",true);
|
|
||||||
addSuggenstions("https://cnet.com","CNET",true);
|
|
||||||
addSuggenstions("https://ign.com","IGN",true);
|
|
||||||
addSuggenstions("https://steampowered.com","Steam Powered",true);
|
|
||||||
addSuggenstions("https://macys.com","Macys",true);
|
|
||||||
addSuggenstions("https://wikihow.com","Wikihow",true);
|
|
||||||
addSuggenstions("https://mail.yahoo.com","Mail Yahoo",true);
|
|
||||||
addSuggenstions("wiktionary.org","Wiktionary",true);
|
|
||||||
addSuggenstions("https://cbssports.com","Cbssports",true);
|
|
||||||
addSuggenstions("https://cnbc.com","CNBC",true);
|
|
||||||
addSuggenstions("https://bankofamerica.com","Bank Of America",true);
|
|
||||||
addSuggenstions("https://expedia.com","Expedia",true);
|
|
||||||
addSuggenstions("https://wellsfargo.com","Wellsfargo",true);
|
|
||||||
addSuggenstions("https://groupon.com","Groupon",true);
|
|
||||||
addSuggenstions("https://twitch.tv","Twitch",true);
|
|
||||||
addSuggenstions("https://khanacademy.org","Khan Academy",true);
|
|
||||||
addSuggenstions("https://theguardian.com","The Guardian",true);
|
|
||||||
addSuggenstions("https://paypal.com","Paypal",true);
|
|
||||||
addSuggenstions("https://spotify.com","Spotify",true);
|
|
||||||
addSuggenstions("https://att.com","ATT",true);
|
|
||||||
addSuggenstions("https://nfl.com","NFL",true);
|
|
||||||
addSuggenstions("https://realtor.com","Realtor",true);
|
|
||||||
addSuggenstions("https://ca.gov","CA Gov",true);
|
|
||||||
addSuggenstions("https://goodreads.com","Good Reads",true);
|
|
||||||
addSuggenstions("https://office.com","Office",true);
|
|
||||||
addSuggenstions("https://ufl.edu","UFL",true);
|
|
||||||
addSuggenstions("https://mlb.com","MLB",true);
|
|
||||||
addSuggenstions("https://foodnetwork.com","Food Network",true);
|
|
||||||
addSuggenstions("https://apartments.com","Apartments",true);
|
|
||||||
addSuggenstions("https://npr.org","NPR",true);
|
|
||||||
addSuggenstions("https://wowhead.com","Wow Head",true);
|
|
||||||
addSuggenstions("https://bing.com","Bing",true);
|
|
||||||
addSuggenstions("https://google.com","Google",true);
|
|
||||||
addSuggenstions("https://boogle.store","Genesis Search",true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
package com.darkweb.genesissearchengine.dataManager;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
|
||||||
|
import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession;
|
||||||
|
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressLint("CommitPrefEdits")
|
||||||
|
class tabDataModel
|
||||||
|
{
|
||||||
|
private ArrayList<tabRowModel> mTabs = new ArrayList<>();
|
||||||
|
|
||||||
|
/*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){
|
||||||
|
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*/
|
||||||
|
public Object onTrigger(dataEnums.eTabCommands p_commands, List<Object> p_data){
|
||||||
|
if(p_commands == dataEnums.eTabCommands.GET_TOTAL_TAB){
|
||||||
|
return getTotalTabs();
|
||||||
|
}
|
||||||
|
else if(p_commands == dataEnums.eTabCommands.GET_CURRENT_TAB){
|
||||||
|
return getCurrentTab();
|
||||||
|
}
|
||||||
|
else if(p_commands == dataEnums.eTabCommands.MOVE_TAB_TO_TOP){
|
||||||
|
moveTabToTop((geckoSession)p_data.get(0));
|
||||||
|
}
|
||||||
|
else if(p_commands == dataEnums.eTabCommands.CLOSE_TAB){
|
||||||
|
closeTab((geckoSession)p_data.get(0));
|
||||||
|
}
|
||||||
|
else if(p_commands == dataEnums.eTabCommands.M_CLEAR_TAB){
|
||||||
|
clearTab();
|
||||||
|
}
|
||||||
|
else if(p_commands == dataEnums.eTabCommands.M_CLOSE_TAB_PARAMETERIZED){
|
||||||
|
closeTab((geckoSession)p_data.get(0));
|
||||||
|
}
|
||||||
|
else if(p_commands == dataEnums.eTabCommands.M_ADD_TAB){
|
||||||
|
addTabs((geckoSession)p_data.get(0), (boolean)p_data.get(1));
|
||||||
|
}
|
||||||
|
else if(p_commands == dataEnums.eTabCommands.GET_TAB){
|
||||||
|
return getTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.darkweb.genesissearchengine.helperManager;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.CancellationSignal;
|
||||||
|
import android.service.autofill.AutofillService;
|
||||||
|
import android.service.autofill.FillCallback;
|
||||||
|
import android.service.autofill.FillRequest;
|
||||||
|
import android.service.autofill.SaveCallback;
|
||||||
|
import android.service.autofill.SaveRequest;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
|
public class autoFillService extends AutofillService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFillRequest(@NonNull FillRequest request, @NonNull CancellationSignal cancellationSignal, @NonNull FillCallback callback) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveRequest(@NonNull SaveRequest request, @NonNull SaveCallback callback) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -61,12 +61,14 @@ public class helperMethod
|
||||||
{
|
{
|
||||||
/*Helper Methods General*/
|
/*Helper Methods General*/
|
||||||
|
|
||||||
public static String completeURL(String url){
|
public static String completeURL(String pURL){
|
||||||
|
if(pURL.equals("about:blank")){
|
||||||
|
return pURL;
|
||||||
|
}
|
||||||
URL weburl = null;
|
URL weburl = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
weburl = new URL(url);
|
weburl = new URL(pURL);
|
||||||
URLConnection result = weburl.openConnection();
|
URLConnection result = weburl.openConnection();
|
||||||
|
|
||||||
if (result instanceof HttpsURLConnection) {
|
if (result instanceof HttpsURLConnection) {
|
||||||
|
@ -83,16 +85,16 @@ public class helperMethod
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!url.startsWith("www.")&& !url.startsWith("http://")&& !url.startsWith("https://")){
|
if(!pURL.startsWith("www.")&& !pURL.startsWith("http://")&& !pURL.startsWith("https://")){
|
||||||
url = ""+url;
|
pURL = ""+pURL;
|
||||||
}
|
}
|
||||||
if(!url.startsWith("http://")&&!url.startsWith("https://")){
|
if(!pURL.startsWith("http://")&&!pURL.startsWith("https://")){
|
||||||
url = "http://"+url;
|
pURL = "http://"+pURL;
|
||||||
}
|
}
|
||||||
return url;
|
return pURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SpannableString urlDesigner(String url){
|
public static SpannableString urlDesigner(String url, Context pContext){
|
||||||
|
|
||||||
if (url.contains("https://"))
|
if (url.contains("https://"))
|
||||||
{
|
{
|
||||||
|
@ -109,7 +111,7 @@ public class helperMethod
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
SpannableString ss = new SpannableString(url);
|
SpannableString ss = new SpannableString(url);
|
||||||
ss.setSpan(new ForegroundColorSpan(Color.BLACK), 0, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
ss.setSpan(new ForegroundColorSpan(pContext.getResources().getColor(R.color.c_text_v1)), 0, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
return ss;
|
return ss;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,6 +257,11 @@ public class helperMethod
|
||||||
context.startActivity(myIntent);
|
context.startActivity(myIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void restartActivity( Intent pIntent, AppCompatActivity pContext){
|
||||||
|
pContext.finish();
|
||||||
|
pContext.startActivity(pIntent);
|
||||||
|
}
|
||||||
|
|
||||||
public static void onMinimizeApp(AppCompatActivity context){
|
public static void onMinimizeApp(AppCompatActivity context){
|
||||||
Intent startMain = new Intent(Intent.ACTION_MAIN);
|
Intent startMain = new Intent(Intent.ACTION_MAIN);
|
||||||
startMain.addCategory(Intent.CATEGORY_HOME);
|
startMain.addCategory(Intent.CATEGORY_HOME);
|
||||||
|
@ -274,6 +281,23 @@ public class helperMethod
|
||||||
return rotate;
|
return rotate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void openNotification(AppCompatActivity pContext)
|
||||||
|
{
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
|
||||||
|
intent.putExtra("android.provider.extra.APP_PACKAGE", pContext.getPackageName());
|
||||||
|
pContext.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String ellipsize(String input, int maxLength) {
|
||||||
|
String ellip = "...";
|
||||||
|
if (input == null || input.length() <= maxLength
|
||||||
|
|| input.length() < ellip.length()) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
return input.substring(0, maxLength - ellip.length()).concat(ellip);
|
||||||
|
}
|
||||||
|
|
||||||
public static String getDomainName(String url)
|
public static String getDomainName(String url)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
package com.darkweb.genesissearchengine.pluginManager;
|
package com.darkweb.genesissearchengine.pluginManager;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
import com.google.android.gms.ads.*;
|
import com.google.android.gms.ads.*;
|
||||||
|
|
||||||
import static com.darkweb.genesissearchengine.constants.status.paid_status;
|
import static com.darkweb.genesissearchengine.constants.status.sPaidStatus;
|
||||||
|
|
||||||
class adManager
|
class adManager
|
||||||
{
|
{
|
||||||
|
|
||||||
/*Private Variables*/
|
/*Private Variables */
|
||||||
|
|
||||||
private AppCompatActivity mAppContext;
|
private AppCompatActivity mAppContext;
|
||||||
private eventObserver.eventListener mEvent;
|
private eventObserver.eventListener mEvent;
|
||||||
|
@ -29,12 +27,12 @@ class adManager
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadAds(){
|
void loadAds(){
|
||||||
if(!paid_status)
|
if(!sPaidStatus)
|
||||||
{
|
{
|
||||||
if (!bannerAdsLoading)
|
if (!bannerAdsLoading)
|
||||||
{
|
{
|
||||||
bannerAdsLoading = true;
|
bannerAdsLoading = true;
|
||||||
MobileAds.initialize(mAppContext, constants.ADMOB_KEY);
|
MobileAds.initialize(mAppContext, constants.CONST_ADMOB_KEY);
|
||||||
mBannerAds.setAlpha(0f);
|
mBannerAds.setAlpha(0f);
|
||||||
initializeBannerAds();
|
initializeBannerAds();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +46,7 @@ class adManager
|
||||||
/*Local Helper Methods*/
|
/*Local Helper Methods*/
|
||||||
|
|
||||||
private void admobListeners(){
|
private void admobListeners(){
|
||||||
if(!paid_status){
|
if(!sPaidStatus){
|
||||||
mBannerAds.setAdListener(new AdListener() {
|
mBannerAds.setAdListener(new AdListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAdLoaded() {
|
public void onAdLoaded() {
|
||||||
|
@ -83,7 +81,7 @@ class adManager
|
||||||
/*External Helper Methods*/
|
/*External Helper Methods*/
|
||||||
|
|
||||||
private void initializeBannerAds(){
|
private void initializeBannerAds(){
|
||||||
if(!paid_status){
|
if(!sPaidStatus){
|
||||||
AdRequest request = new AdRequest.Builder().addTestDevice("E731DE5933CDC0E42B335787CE3E23EF").build();
|
AdRequest request = new AdRequest.Builder().addTestDevice("E731DE5933CDC0E42B335787CE3E23EF").build();
|
||||||
mBannerAds.loadAd(request);
|
mBannerAds.loadAd(request);
|
||||||
admobListeners();
|
admobListeners();
|
||||||
|
|
|
@ -1,91 +0,0 @@
|
||||||
package com.darkweb.genesissearchengine.pluginManager;
|
|
||||||
|
|
||||||
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.sPaidStatus;
|
|
||||||
|
|
||||||
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(!sPaidStatus)
|
|
||||||
{
|
|
||||||
if (!bannerAdsLoading)
|
|
||||||
{
|
|
||||||
bannerAdsLoading = true;
|
|
||||||
MobileAds.initialize(mAppContext, constants.CONST_ADMOB_KEY);
|
|
||||||
mBannerAds.setAlpha(0f);
|
|
||||||
initializeBannerAds();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isAdvertLoaded(){
|
|
||||||
return bannerAdsLoaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Local Helper Methods*/
|
|
||||||
|
|
||||||
private void admobListeners(){
|
|
||||||
if(!sPaidStatus){
|
|
||||||
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(!sPaidStatus){
|
|
||||||
AdRequest request = new AdRequest.Builder().addTestDevice("E731DE5933CDC0E42B335787CE3E23EF").build();
|
|
||||||
mBannerAds.loadAd(request);
|
|
||||||
admobListeners();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -3,7 +3,6 @@ package com.darkweb.genesissearchengine.pluginManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.crashlytics.android.Crashlytics;
|
|
||||||
import com.darkweb.genesissearchengine.constants.constants;
|
import com.darkweb.genesissearchengine.constants.constants;
|
||||||
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
import com.darkweb.genesissearchengine.helperManager.eventObserver;
|
||||||
|
|
||||||
|
@ -11,7 +10,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
class analyticManager
|
class analyticManager
|
||||||
{
|
{
|
||||||
/*Private Variables*/
|
/*Private Variables */
|
||||||
|
|
||||||
private AppCompatActivity mAppContext;
|
private AppCompatActivity mAppContext;
|
||||||
private String mUniqueID = null;
|
private String mUniqueID = null;
|
||||||
|
@ -24,7 +23,7 @@ class analyticManager
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize(){
|
private void initialize(){
|
||||||
final String PREF_UNIQUE_ID = constants.UNIQUE_KEY_ID;
|
final String PREF_UNIQUE_ID = constants.CONST_UNIQUE_KEY_ID;
|
||||||
|
|
||||||
if (mUniqueID == null)
|
if (mUniqueID == null)
|
||||||
{
|
{
|
||||||
|
@ -53,9 +52,6 @@ class analyticManager
|
||||||
/*Helper Methods*/
|
/*Helper Methods*/
|
||||||
|
|
||||||
void logUser(){
|
void logUser(){
|
||||||
Crashlytics.setUserIdentifier(mUniqueID);
|
|
||||||
Crashlytics.setUserEmail(constants.USER_EMAIL);
|
|
||||||
Crashlytics.setUserName(mUniqueID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
package com.darkweb.genesissearchengine.pluginManager;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
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.CONST_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(){
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -79,11 +79,11 @@ class messageManager
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("QueryPermissionsNeeded")
|
||||||
private void abiError()
|
private void abiError()
|
||||||
{
|
{
|
||||||
initializeDialog(R.layout.popup_abi_error, Gravity.CENTER);
|
initializeDialog(R.layout.popup_abi_error, Gravity.CENTER);
|
||||||
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> dialog.dismiss());
|
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
|
||||||
dialog.findViewById(R.id.pOption2).setOnClickListener(v -> {
|
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_GENESIS_UPDATE_URL + status.sAppCurrentABI));
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_GENESIS_UPDATE_URL + status.sAppCurrentABI));
|
||||||
if(browserIntent.resolveActivity(app_context.getPackageManager()) != null)
|
if(browserIntent.resolveActivity(app_context.getPackageManager()) != null)
|
||||||
|
@ -136,6 +136,12 @@ class messageManager
|
||||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void dataClearedSuccessfully()
|
||||||
|
{
|
||||||
|
initializeDialog(R.layout.popup_data_cleared, Gravity.BOTTOM);
|
||||||
|
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("ResourceType")
|
@SuppressLint("ResourceType")
|
||||||
private void bookmark()
|
private void bookmark()
|
||||||
{
|
{
|
||||||
|
@ -211,6 +217,7 @@ class messageManager
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("QueryPermissionsNeeded")
|
||||||
private void rateApp()
|
private void rateApp()
|
||||||
{
|
{
|
||||||
initializeDialog(R.layout.popup_rate_us, Gravity.CENTER);
|
initializeDialog(R.layout.popup_rate_us, Gravity.CENTER);
|
||||||
|
@ -251,12 +258,12 @@ class messageManager
|
||||||
String title = data.get(1);
|
String title = data.get(1);
|
||||||
|
|
||||||
int size = name.length();
|
int size = name.length();
|
||||||
if(size>35){
|
if(size>235){
|
||||||
size = 35;
|
size = 235;
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeDialog(R.layout.popup_file_longpress, Gravity.CENTER);
|
initializeDialog(R.layout.popup_file_longpress, Gravity.CENTER);
|
||||||
((TextView)dialog.findViewById(R.id.pDescription)).setText((title + data.get(0).substring(0,size)+"..."));
|
((TextView)dialog.findViewById(R.id.pDescription)).setText((title + " | " + data.get(0).substring(0,size)+"..."));
|
||||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||||
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
|
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
|
||||||
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.download_file_manual);
|
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.download_file_manual);
|
||||||
|
@ -281,8 +288,8 @@ class messageManager
|
||||||
int size = data.get(0).length()-1;
|
int size = data.get(0).length()-1;
|
||||||
String title = data.get(1);
|
String title = data.get(1);
|
||||||
|
|
||||||
if(size>35){
|
if(size>235){
|
||||||
size = 35;
|
size = 235;
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER);
|
initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER);
|
||||||
|
@ -303,7 +310,6 @@ class messageManager
|
||||||
}
|
}
|
||||||
|
|
||||||
private void popupDownloadFull(){
|
private void popupDownloadFull(){
|
||||||
|
|
||||||
String url = data.get(0);
|
String url = data.get(0);
|
||||||
String file = data.get(1);
|
String file = data.get(1);
|
||||||
String title = data.get(2);
|
String title = data.get(2);
|
||||||
|
@ -311,25 +317,28 @@ class messageManager
|
||||||
String data_local = app_context.getString(R.string.ALERT_LONG_URL_MESSAGE);
|
String data_local = app_context.getString(R.string.ALERT_LONG_URL_MESSAGE);
|
||||||
|
|
||||||
int size = url.length();
|
int size = url.length();
|
||||||
if(size>35){
|
if(size>235){
|
||||||
size = 35;
|
size = 235;
|
||||||
}
|
}
|
||||||
|
|
||||||
int size1 = file.length();
|
int size1 = file.length();
|
||||||
if(size1>35){
|
if(size1>235){
|
||||||
size1 = 35;
|
size1 = 235;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!url.equals("")){
|
if(!url.equals("")){
|
||||||
data_local = title + url.substring(0,size)+"...";
|
data_local = title + url.substring(0,size)+"...";
|
||||||
}
|
}
|
||||||
else if(!file.equals("")){
|
else if(!file.equals("")){
|
||||||
data_local = title + file.substring(0,size1)+"...";
|
data_local = file.substring(0,size1)+"...";
|
||||||
|
}
|
||||||
|
String mTitle = title;
|
||||||
|
if(mTitle.length()<=1){
|
||||||
|
mTitle = data.get(0).substring(0,size)+"...";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initializeDialog(R.layout.popup_download_full, Gravity.CENTER);
|
||||||
initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER);
|
((TextView)dialog.findViewById(R.id.pHeader)).setText(mTitle);
|
||||||
((TextView)dialog.findViewById(R.id.pHeader)).setText((title + data.get(0).substring(0,size)+"..."));
|
|
||||||
((TextView)dialog.findViewById(R.id.pDescription)).setText((data_local));
|
((TextView)dialog.findViewById(R.id.pDescription)).setText((data_local));
|
||||||
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
|
||||||
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
|
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
|
||||||
|
@ -456,7 +465,7 @@ class messageManager
|
||||||
|
|
||||||
case on_long_press_with_link:
|
case on_long_press_with_link:
|
||||||
popupDownloadFull();
|
popupDownloadFull();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case on_bridge_mail:
|
case on_bridge_mail:
|
||||||
sendBridgeMail();
|
sendBridgeMail();
|
||||||
|
@ -465,6 +474,10 @@ class messageManager
|
||||||
case on_not_support:
|
case on_not_support:
|
||||||
notSupportMessage();
|
notSupportMessage();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case data_cleared:
|
||||||
|
dataClearedSuccessfully();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.constants.*;
|
import com.darkweb.genesissearchengine.constants.*;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataController;
|
import com.darkweb.genesissearchengine.dataManager.dataController;
|
||||||
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
import com.darkweb.genesissearchengine.dataManager.dataEnums;
|
||||||
|
@ -41,8 +42,8 @@ class orbotManager
|
||||||
}
|
}
|
||||||
|
|
||||||
void startOrbot(Context context){
|
void startOrbot(Context context){
|
||||||
orbotLocalConstants.bridges = status.sBridgeCustomBridge;
|
orbotLocalConstants.mBridges = status.sBridgeCustomBridge;
|
||||||
orbotLocalConstants.sIsManualBridge = status.sBridgeGatewayManual;
|
orbotLocalConstants.mIsManualBridge = status.sBridgeGatewayManual;
|
||||||
this.mAppContext = context;
|
this.mAppContext = context;
|
||||||
Prefs.putBridgesEnabled(status.sBridgeGatewayManual |status.sBridgeGatewayAuto);
|
Prefs.putBridgesEnabled(status.sBridgeGatewayManual |status.sBridgeGatewayAuto);
|
||||||
Intent mServiceIntent = new Intent(context, OrbotService.class);
|
Intent mServiceIntent = new Intent(context, OrbotService.class);
|
||||||
|
@ -58,10 +59,10 @@ class orbotManager
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNotificationStatus(){
|
int getNotificationStatus(){
|
||||||
return orbotLocalConstants.sNotificationStatus;
|
return orbotLocalConstants.mNotificationStatus;
|
||||||
}
|
}
|
||||||
void initNotification(int status){
|
void initNotification(int status){
|
||||||
orbotLocalConstants.sNotificationStatus = status;
|
orbotLocalConstants.mNotificationStatus = status;
|
||||||
}
|
}
|
||||||
void enableTorNotification(){
|
void enableTorNotification(){
|
||||||
OrbotService.getServiceObject().enableNotification();
|
OrbotService.getServiceObject().enableNotification();
|
||||||
|
@ -129,20 +130,22 @@ class orbotManager
|
||||||
setPrivacyPrefs();
|
setPrivacyPrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPrivacyPrefs ()
|
public void setPrivacyPrefs ()
|
||||||
{
|
{
|
||||||
|
PrefsHelper.setPref(keys.PROXY_IMAGE, status.sShowImages);
|
||||||
|
PrefsHelper.setPref("browser.display.show_image_placeholders",true);
|
||||||
PrefsHelper.setPref("browser.cache.disk.enable",false);
|
PrefsHelper.setPref("browser.cache.disk.enable",false);
|
||||||
PrefsHelper.setPref("browser.cache.memory.enable",true);
|
PrefsHelper.setPref("browser.cache.memory.enable",true);
|
||||||
PrefsHelper.setPref("browser.cache.disk.capacity",0);
|
PrefsHelper.setPref("browser.cache.disk.capacity",0);
|
||||||
PrefsHelper.setPref("privacy.resistFingerprinting",true);
|
PrefsHelper.setPref("privacy.resistFingerprinting",true);
|
||||||
PrefsHelper.setPref("privacy.clearOnShutdown.cache",status.sSettingHistoryStatus);
|
PrefsHelper.setPref("privacy.clearOnShutdown.cache",status.sClearOnExit);
|
||||||
PrefsHelper.setPref("privacy.clearOnShutdown.downloads",status.sSettingHistoryStatus);
|
PrefsHelper.setPref("privacy.clearOnShutdown.downloads",status.sClearOnExit);
|
||||||
PrefsHelper.setPref("privacy.clearOnShutdown.formdata",status.sSettingHistoryStatus);
|
PrefsHelper.setPref("privacy.clearOnShutdown.formdata",status.sClearOnExit);
|
||||||
PrefsHelper.setPref("privacy.clearOnShutdown.history",status.sSettingHistoryStatus);
|
PrefsHelper.setPref("privacy.clearOnShutdown.history",status.sClearOnExit);
|
||||||
PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",status.sSettingHistoryStatus);
|
PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",status.sClearOnExit);
|
||||||
PrefsHelper.setPref("privacy.clearOnShutdown.passwords",status.sSettingHistoryStatus);
|
PrefsHelper.setPref("privacy.clearOnShutdown.passwords",status.sClearOnExit);
|
||||||
PrefsHelper.setPref("privacy.clearOnShutdown.sessions",status.sSettingHistoryStatus);
|
PrefsHelper.setPref("privacy.clearOnShutdown.sessions",status.sClearOnExit);
|
||||||
PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",status.sSettingHistoryStatus);
|
PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",status.sClearOnExit);
|
||||||
PrefsHelper.setPref("privacy.donottrackheader.enabled",false);
|
PrefsHelper.setPref("privacy.donottrackheader.enabled",false);
|
||||||
PrefsHelper.setPref("privacy.donottrackheader.value",1);
|
PrefsHelper.setPref("privacy.donottrackheader.value",1);
|
||||||
PrefsHelper.setPref("network.http.sendRefererHeader", 0);
|
PrefsHelper.setPref("network.http.sendRefererHeader", 0);
|
||||||
|
@ -155,7 +158,7 @@ class orbotManager
|
||||||
|
|
||||||
String getLogs()
|
String getLogs()
|
||||||
{
|
{
|
||||||
String logs = orbotLocalConstants.tor_logs_status;
|
String logs = orbotLocalConstants.mTorLogsStatus;
|
||||||
|
|
||||||
if(!logs.contains("Bootstrapped") && !mLogsStarted){
|
if(!logs.contains("Bootstrapped") && !mLogsStarted){
|
||||||
logs = "Initializing Bootstrap";
|
logs = "Initializing Bootstrap";
|
||||||
|
@ -178,7 +181,7 @@ class orbotManager
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isOrbotRunning(){
|
boolean isOrbotRunning(){
|
||||||
return orbotLocalConstants.sIsTorInitialized;
|
return orbotLocalConstants.mIsTorInitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,9 @@ public class pluginController
|
||||||
public void setProxy(String url){
|
public void setProxy(String url){
|
||||||
orbotManager.getInstance().setProxy(url);
|
orbotManager.getInstance().setProxy(url);
|
||||||
}
|
}
|
||||||
|
public void updatePrivacy(){
|
||||||
|
orbotManager.getInstance().setPrivacyPrefs();
|
||||||
|
}
|
||||||
public String orbotLogs(){
|
public String orbotLogs(){
|
||||||
return orbotManager.getInstance().getLogs();
|
return orbotManager.getInstance().getLogs();
|
||||||
}
|
}
|
||||||
|
@ -245,7 +248,7 @@ public class pluginController
|
||||||
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null);
|
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null);
|
||||||
mContextManager.getHistoryController().onclearData();
|
mContextManager.getHistoryController().onclearData();
|
||||||
mHomeController.onClearSession();
|
mHomeController.onClearSession();
|
||||||
dataController.getInstance().clearTabs();
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
|
||||||
mHomeController.initTab(false);
|
mHomeController.initTab(false);
|
||||||
}
|
}
|
||||||
else if(event_type.equals(enums.etype.clear_bookmark)){
|
else if(event_type.equals(enums.etype.clear_bookmark)){
|
||||||
|
@ -283,7 +286,7 @@ public class pluginController
|
||||||
helperMethod.copyURL(data.get(0).toString(),mContextManager.getHomeController());
|
helperMethod.copyURL(data.get(0).toString(),mContextManager.getHomeController());
|
||||||
}
|
}
|
||||||
else if(event_type.equals(enums.etype.clear_tab)){
|
else if(event_type.equals(enums.etype.clear_tab)){
|
||||||
dataController.getInstance().clearTabs();
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
|
||||||
mHomeController.initTab(true);
|
mHomeController.initTab(true);
|
||||||
activityContextManager.getInstance().getTabController().finish();
|
activityContextManager.getInstance().getTabController().finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator">
|
|
||||||
<alpha
|
<alpha
|
||||||
android:duration="100"
|
android:duration="100"
|
||||||
android:fromAlpha="0.1"
|
android:fromAlpha="0.5"
|
||||||
android:toAlpha="1.0">
|
android:interpolator="@android:anim/linear_interpolator"
|
||||||
</alpha>
|
android:toAlpha="1.0" />
|
||||||
</set>
|
</set>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<alpha
|
||||||
|
android:duration="100"
|
||||||
|
android:fromAlpha="1.0"
|
||||||
|
android:interpolator="@android:anim/linear_interpolator"
|
||||||
|
android:toAlpha="0.5" />
|
||||||
|
</set>
|
|
@ -1,5 +1,5 @@
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:color="@color/button_gray">
|
android:color="@color/c_view_divier_background">
|
||||||
<item android:id="@android:id/mask">
|
<item android:id="@android:id/mask">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<solid android:color="@color/button_gray" />
|
<solid android:color="@color/button_gray" />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:color="@color/button_gray">
|
android:color="@color/c_ripple">
|
||||||
<item android:id="@android:id/mask">
|
<item android:id="@android:id/mask">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<solid android:color="@color/button_gray" />
|
<solid android:color="@color/button_gray" />
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="@color/c_ripple">
|
||||||
|
<item android:id="@android:id/mask">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/c_button_text_v2" />
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="4dp"
|
||||||
|
android:bottomRightRadius="4dp"
|
||||||
|
android:topLeftRadius="0dp"
|
||||||
|
android:topRightRadius="0dp"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</ripple>
|
|
@ -1,11 +1,11 @@
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:color="@color/button_gray">
|
android:color="@color/c_ripple">
|
||||||
<item android:id="@android:id/mask">
|
<item android:id="@android:id/mask">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<solid android:color="@color/button_gray" />
|
<solid android:color="@color/button_gray" />
|
||||||
<corners
|
<corners
|
||||||
android:bottomLeftRadius="0dp"
|
android:bottomLeftRadius="4dp"
|
||||||
android:bottomRightRadius="4dp"
|
android:bottomRightRadius="0dp"
|
||||||
android:topLeftRadius="0dp"
|
android:topLeftRadius="0dp"
|
||||||
android:topRightRadius="0dp"/>
|
android:topRightRadius="0dp"/>
|
||||||
</shape>
|
</shape>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:color="@color/button_gray">
|
android:color="@color/c_ripple">
|
||||||
<item android:id="@android:id/mask">
|
<item android:id="@android:id/mask">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<solid android:color="@color/button_gray" />
|
<solid android:color="@color/c_button_text_v2" />
|
||||||
<corners
|
<corners
|
||||||
android:bottomLeftRadius="4dp"
|
android:bottomLeftRadius="0dp"
|
||||||
android:bottomRightRadius="0dp"
|
android:bottomRightRadius="4dp"
|
||||||
android:topLeftRadius="0dp"
|
android:topLeftRadius="0dp"
|
||||||
android:topRightRadius="0dp"/>
|
android:topRightRadius="0dp"/>
|
||||||
</shape>
|
</shape>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
android:top="113dp">
|
android:top="113dp">
|
||||||
<shape
|
<shape
|
||||||
android:shape="rectangle" android:padding="10dp" >
|
android:shape="rectangle" android:padding="10dp" >
|
||||||
<solid android:color="@color/button_gray"/>
|
<solid android:color="@color/c_edittext_background"/>
|
||||||
<corners android:radius="5dp"/>
|
<corners android:radius="5dp"/>
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
android:top="113dp">
|
android:top="113dp">
|
||||||
<shape
|
<shape
|
||||||
android:shape="rectangle" android:padding="10dp">
|
android:shape="rectangle" android:padding="10dp">
|
||||||
<solid android:color="@color/white_dark"/>
|
<solid android:color="@color/c_edittext_background"/>
|
||||||
<corners android:radius="5dp"/>
|
<corners android:radius="5dp"/>
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:top="113dp">
|
||||||
|
<shape
|
||||||
|
android:shape="rectangle" android:padding="10dp" >
|
||||||
|
<solid android:color="@color/c_border_background"/>
|
||||||
|
<corners android:radius="0dp"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:state_pressed="false"
|
||||||
|
android:top="113dp">
|
||||||
|
<shape
|
||||||
|
android:shape="rectangle" android:padding="10dp">
|
||||||
|
<solid android:color="@color/c_border_background"/>
|
||||||
|
<corners android:radius="0dp"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
||||||
|
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue