Bug Fixes

Bug Fixes
master
Abdul Mannan Saeed 2023-02-12 19:31:17 +05:00
parent faac9cd676
commit 3641c1a49a
388 changed files with 9149 additions and 22622 deletions

View File

@ -43,6 +43,8 @@
<inspection_tool class="IntegerDivisionInFloatingPointContext" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="IntegerDivisionInFloatingPointContext" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LambdaParameterTypeCanBeSpecified" enabled="false" level="INFORMATION" enabled_by_default="false" /> <inspection_tool class="LambdaParameterTypeCanBeSpecified" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="RegExpDuplicateCharacterInClass" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="RegExpRedundantEscape" 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="SingleStatementInBlock" enabled="false" level="INFORMATION" enabled_by_default="false" /> <inspection_tool class="SingleStatementInBlock" enabled="false" level="INFORMATION" 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">
@ -63,7 +65,7 @@
<option name="m_ignoreAnnotatedVariables" value="false" /> <option name="m_ignoreAnnotatedVariables" value="false" />
</inspection_tool> </inspection_tool>
<inspection_tool class="UnusedReturnValue" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="UnusedReturnValue" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="unused" enabled="true" level="WARNING" enabled_by_default="true" parameter="packageLocal"> <inspection_tool class="unused" enabled="true" level="WARNING" enabled_by_default="true" parameter="packageLocal" checkParameterExcludingHierarchy="false">
<option name="LOCAL_VARIABLE" value="true" /> <option name="LOCAL_VARIABLE" value="true" />
<option name="FIELD" value="true" /> <option name="FIELD" value="true" />
<option name="METHOD" value="true" /> <option name="METHOD" value="true" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,3 @@
#Thu Feb 09 03:08:42 PKT 2023 #Sun Feb 12 18:54:23 PKT 2023
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000= \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
json=-1378969876 json=321093871

View File

@ -1,6 +1,6 @@
# #
#Thu Feb 09 03:08:42 PKT 2023 #Sun Feb 12 19:27:01 PKT 2023
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000= \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
sdk_analysis_plugin_version=4.8.3 sdk_analysis_plugin_version=4.8.5
set_multidex=true set_multidex=true
pCPe4EeU2ZQVwQPeHLgseRqHBX1V5pvo9Piuu4J809dRhadEgukXa1A8po_UeXu5hmPOTaP1v4QPaMKIEOhh50=hGlhanpemGqPOKKAgaXvhyxwZaG9uD68csy1OadWTNhEgKvBWR7-7KSpyFr6nfZ4KMOuBBV5J49s2LLSg-SVxg pCPe4EeU2ZQVwQPeHLgseRqHBX1V5pvo9Piuu4J809dRhadEgukXa1A8po_UeXu5hmPOTaP1v4QPaMKIEOhh50=hGlhanpemGqPOKKAgaXvhyxwZaG9uD68csy1OadWTNhEgKvBWR7-7KSpyFr6nfZ4KMOuBBV5J49s2LLSg-SVxg

View File

@ -0,0 +1 @@
i/AndroidManifest.xml

View File

@ -0,0 +1 @@
o/jetified-OrbotLib-runtime.jar

View File

@ -0,0 +1 @@
o/go.IPtProxy.gojni

View File

@ -0,0 +1 @@
o/jetified-OrbotLib

View File

@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="go.IPtProxy.gojni">
<uses-sdk android:minSdkVersion="16"/></manifest>

View File

@ -0,0 +1,2 @@
-keep class go.** { *; }
-keep class IPtProxy.** { *; }

View File

@ -0,0 +1 @@
o/jetified-OrbotLib.aar

View File

@ -0,0 +1 @@
o/go.IPtProxy.gojni-r.txt

View File

@ -0,0 +1 @@
o/jetified-OrbotLib-api.jar

View File

@ -0,0 +1 @@
i/jars/classes.jar

View File

@ -0,0 +1 @@
o/jetified-OrbotLib-runtime

View File

@ -17,6 +17,9 @@ android {
compileSdkVersion project.ext.compile_sdk_version compileSdkVersion project.ext.compile_sdk_version
ndkVersion project.ext.ndk_version ndkVersion project.ext.ndk_version
lintOptions {
disable project.ext.lintoption
}
defaultConfig { defaultConfig {
applicationId project.ext.application_id applicationId project.ext.application_id
@ -92,7 +95,7 @@ dependencies {
/* Firefox ABI Splits */ /* Firefox ABI Splits */
implementation "org.mozilla.components:browser-engine-gecko:108.2.0" implementation "org.mozilla.components:browser-engine-gecko:108.2.0"
implementation "org.mozilla.components:browser-icons:100.0.9" implementation "org.mozilla.components:browser-icons:108.2.0"
implementation "org.mozilla.components:concept-fetch:108.2.0" implementation "org.mozilla.components:concept-fetch:108.2.0"
implementation "org.mozilla.components:concept-base:108.2.0" implementation "org.mozilla.components:concept-base:108.2.0"
implementation "org.mozilla.components:support-utils:108.2.0" implementation "org.mozilla.components:support-utils:108.2.0"

View File

@ -66,7 +66,7 @@
<activity <activity
android:name="com.hiddenservices.onionservices.appManager.languageManager.languageController" android:name="com.hiddenservices.onionservices.appManager.languageManager.languageController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode|locale|layoutDirection"
android:label="@string/SETTING_HEADER" android:label="@string/SETTING_HEADER"
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
@ -109,11 +109,6 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
<activity
android:name="com.hiddenservices.onionservices.appManager.settingManager.advertSetttings.advertSettingController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:windowSoftInputMode="adjustPan" />
<activity <activity
android:name="com.hiddenservices.onionservices.appManager.settingManager.advanceManager.settingAdvanceController" android:name="com.hiddenservices.onionservices.appManager.settingManager.advanceManager.settingAdvanceController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
@ -163,18 +158,6 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name="com.hiddenservices.onionservices.appManager.homeManager.FakeLauncherActivity"
android:enabled="false"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity <activity
android:name="com.hiddenservices.onionservices.appManager.externalCommandManager.externalShortcutController" android:name="com.hiddenservices.onionservices.appManager.externalCommandManager.externalShortcutController"
android:launchMode="singleTop" /> android:launchMode="singleTop" />
@ -236,12 +219,6 @@
<!-- Reciever & Settings --> <!-- Reciever & Settings -->
<receiver
android:name="com.hiddenservices.onionservices.pluginManager.notificationPluginManager.localEngagementManager"
android:exported="true"
android:permission="TODO"
tools:ignore="ExportedReceiver" />
<receiver <receiver
android:name="com.hiddenservices.onionservices.pluginManager.pluginReciever.downloadNotificationReciever" android:name="com.hiddenservices.onionservices.pluginManager.pluginReciever.downloadNotificationReciever"
android:exported="false"> android:exported="false">
@ -291,7 +268,8 @@
<service <service
android:name=".MediaSessionService" android:name=".MediaSessionService"
android:enabled="true" android:enabled="true"
android:exported="true"> android:exported="false"
android:permission="TODO">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON"/> <action android:name="android.intent.action.MEDIA_BUTTON"/>
</intent-filter> </intent-filter>

View File

@ -208,7 +208,7 @@ public class activityContextManager {
} }
} }
public void onClearStack() { public void onGoHome() {
for (int mCounter = 0; mCounter < mStackList.size(); mCounter++) { for (int mCounter = 0; mCounter < mStackList.size(); mCounter++) {
try { try {
if (!mStackList.get(mCounter).get().isFinishing()) { if (!mStackList.get(mCounter).get().isFinishing()) {
@ -220,6 +220,7 @@ public class activityContextManager {
} }
} }
} }
public void onCheckPurgeStack() { public void onCheckPurgeStack() {
if(pHomeController==null || pHomeController.get() == null){ if(pHomeController==null || pHomeController.get() == null){
for (int mCounter = 0; mCounter < mStackList.size(); mCounter++) { for (int mCounter = 0; mCounter < mStackList.size(); mCounter++) {

View File

@ -3,14 +3,9 @@ package com.hiddenservices.onionservices.appManager;
import android.app.Service; import android.app.Service;
import android.content.Intent; import android.content.Intent;
import android.os.Binder; import android.os.Binder;
import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.util.Log;
import androidx.core.app.NotificationManagerCompat; import androidx.core.app.NotificationManagerCompat;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import org.torproject.android.service.OrbotService; import org.torproject.android.service.OrbotService;
import org.torproject.android.service.wrapper.orbotLocalConstants; import org.torproject.android.service.wrapper.orbotLocalConstants;

View File

@ -45,6 +45,21 @@ public class activityThemeManager {
return false; return false;
} }
public Context onInitThemeContext(Context pContext) {
boolean sDefaultNightMode = (pContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if (status.sSettingIsAppStarted) {
status.mThemeApplying = true;
}
status.sDefaultNightMode = sDefaultNightMode;
pContext = setupTheme(pContext);
mode = -1;
return pContext;
}
public void setupThemeLocal(Context context, boolean sDefaultNightMode) { public void setupThemeLocal(Context context, boolean sDefaultNightMode) {
Resources res = context.getResources(); Resources res = context.getResources();
mode = res.getConfiguration().uiMode; mode = res.getConfiguration().uiMode;
@ -112,19 +127,4 @@ public class activityThemeManager {
return context; return context;
} }
public Context initTheme(Context pContext) {
boolean sDefaultNightMode = (pContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if (status.sSettingIsAppStarted) {
status.mThemeApplying = true;
}
status.sDefaultNightMode = sDefaultNightMode;
pContext = setupTheme(pContext);
mode = -1;
return pContext;
}
} }

View File

@ -2,6 +2,7 @@ package com.hiddenservices.onionservices.appManager.advertManager;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.webkit.WebChromeClient; import android.webkit.WebChromeClient;
@ -34,9 +35,10 @@ public class advertController extends AppCompatActivity {
private void initializeViews() { private void initializeViews() {
mWebView = findViewById(R.id.pWebView); mWebView = findViewById(R.id.pWebView);
mProgressBar = findViewById(R.id.mProgressBar); mProgressBar = findViewById(R.id.mProgressBar);
mAdvertViewController = new advertViewController(this, null, mWebView, mProgressBar); mAdvertViewController = new advertViewController(this, null, mProgressBar);
} }
@SuppressLint("SetJavaScriptEnabled")
void onInitAdvert() { void onInitAdvert() {
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setDomStorageEnabled(true);

View File

@ -1,11 +1,8 @@
package com.hiddenservices.onionservices.appManager.advertManager; package com.hiddenservices.onionservices.appManager.advertManager;
import android.os.Bundle; import android.os.Bundle;
import android.webkit.WebView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.R; import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.sharedUIMethod; import com.hiddenservices.onionservices.helperManager.sharedUIMethod;
@ -14,7 +11,6 @@ import java.util.List;
public class advertViewController extends AppCompatActivity { public class advertViewController extends AppCompatActivity {
private WebView mWebView;
private AppCompatActivity mContext; private AppCompatActivity mContext;
private ProgressBar mProgressBar; private ProgressBar mProgressBar;
@ -24,9 +20,8 @@ public class advertViewController extends AppCompatActivity {
setContentView(R.layout.activity_adview_controller); setContentView(R.layout.activity_adview_controller);
} }
advertViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent, WebView pGeckoView, ProgressBar pProgressBar) { advertViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent, ProgressBar pProgressBar) {
this.mContext = pContext; this.mContext = pContext;
this.mWebView = pGeckoView;
this.mProgressBar = pProgressBar; this.mProgressBar = pProgressBar;
initViews(); initViews();

View File

@ -30,6 +30,7 @@ import java.util.List;
import static android.content.Context.LAYOUT_INFLATER_SERVICE; import static android.content.Context.LAYOUT_INFLATER_SERVICE;
@SuppressLint("NotifyDataSetChanged")
public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listViewHolder> { public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listViewHolder> {
/*Private Variables*/ /*Private Variables*/
@ -66,8 +67,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
} }
private void initializeModelWithDate(boolean pFilterEnabled) { private void initializeModelWithDate(boolean pFilterEnabled) {
int m_real_counter = 0;
mRealID.clear(); mRealID.clear();
mRealIndex.clear(); mRealIndex.clear();
mCurrentList.clear(); mCurrentList.clear();
@ -86,7 +85,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mRealID.add(p_model_list.get(counter).getID()); mRealID.add(p_model_list.get(counter).getID());
mRealIndex.add(counter); mRealIndex.add(counter);
this.mModelList.add(p_model_list.get(counter)); this.mModelList.add(p_model_list.get(counter));
m_real_counter += 1;
} }
mCurrentList.addAll(this.mModelList); mCurrentList.addAll(this.mModelList);
} }
@ -101,10 +99,10 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
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(helperMethod.completeURL(mCurrentList.get(m_counter_inner).getDescription()))) { if (mCurrentList.get(m_counter_inner).getDate() == mLongSelectedDate.get(m_counter) && mLongSelectedIndex.get(m_counter).equals(helperMethod.completeURL(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)), bookmarkEnums.eBookmarkAdapterCallback.ON_URL_CLEAR);
mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)), enums.etype.url_clear_at); mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)), bookmarkEnums.eBookmarkAdapterCallback.ON_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), bookmarkEnums.eBookmarkAdapterCallback.IS_EMPTY);
boolean mDateVerify = false; boolean mDateVerify = false;
if (mCurrentList.size() > 0 && mCurrentList.size() < m_counter_inner + 1 && mCurrentList.get(m_counter_inner - 1).getDescription() == null && (mCurrentList.size() > m_counter_inner + 1 && mCurrentList.get(m_counter_inner + 1).getDescription() == null || mCurrentList.size() == m_counter_inner + 1)) { if (mCurrentList.size() > 0 && mCurrentList.size() < m_counter_inner + 1 && 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)) {
@ -210,12 +208,12 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
public void onVerifyLongSelectedURL(boolean pIsComputing) { public void onVerifyLongSelectedURL(boolean pIsComputing) {
if (mLongSelectedIndex.size() > 0) { if (mLongSelectedIndex.size() > 0) {
mEvent.invokeObserver(Collections.singletonList(false), enums.etype.on_verify_selected_url_menu); mEvent.invokeObserver(Collections.singletonList(false), bookmarkEnums.eBookmarkAdapterCallback.ON_VERIFY_SELECTED_URL_MENU);
} else { } else {
if (!pIsComputing) { if (!pIsComputing) {
notifyDataSetChanged(); notifyDataSetChanged();
} }
mEvent.invokeObserver(Collections.singletonList(true), enums.etype.on_verify_selected_url_menu); mEvent.invokeObserver(Collections.singletonList(true), bookmarkEnums.eBookmarkAdapterCallback.ON_VERIFY_SELECTED_URL_MENU);
} }
} }
@ -279,7 +277,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
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), bookmarkEnums.eBookmarkAdapterCallback.ON_URL_TRIGGER);
initializeModelWithDate(true); initializeModelWithDate(true);
return true; return true;
@ -329,14 +327,15 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
if (v.getId() == R.id.pMenuCopy) { if (v.getId() == R.id.pMenuCopy) {
helperMethod.copyURL(pUrl, mListHolderContext); helperMethod.copyURL(pUrl, mListHolderContext);
mPopupWindow.dismiss(); mPopupWindow.dismiss();
helperMethod.showToastMessage("copied to clipboard", mContext);
} else if (v.getId() == R.id.pMenuShare) { } else if (v.getId() == R.id.pMenuShare) {
helperMethod.shareApp((AppCompatActivity) mListHolderContext, pUrl, pTitle); helperMethod.shareApp((AppCompatActivity) mListHolderContext, pUrl, pTitle);
mPopupWindow.dismiss(); mPopupWindow.dismiss();
} else if (v.getId() == R.id.pMenuOpenCurrentTab) { } else if (v.getId() == R.id.pMenuOpenCurrentTab) {
mEvent.invokeObserver(Collections.singletonList(pUrl), enums.etype.url_triggered); mEvent.invokeObserver(Collections.singletonList(pUrl), bookmarkEnums.eBookmarkAdapterCallback.ON_URL_TRIGGER);
mPopupWindow.dismiss(); mPopupWindow.dismiss();
} else if (v.getId() == R.id.pMenuOpenNewTab) { } else if (v.getId() == R.id.pMenuOpenNewTab) {
mEvent.invokeObserver(Collections.singletonList(pUrl), enums.etype.url_triggered_new_tab); mEvent.invokeObserver(Collections.singletonList(pUrl), bookmarkEnums.eBookmarkAdapterCallback.ON_URL_TRIGGER_NEW_TAB);
mPopupWindow.dismiss(); mPopupWindow.dismiss();
} else if (v.getId() == R.id.pMenuDelete) { } else if (v.getId() == R.id.pMenuDelete) {
onClose(pPosition); onClose(pPosition);
@ -353,8 +352,8 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
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)), bookmarkEnums.eBookmarkAdapterCallback.ON_URL_CLEAR_AT);
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)), enums.etype.is_empty); mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)), bookmarkEnums.eBookmarkAdapterCallback.IS_EMPTY);
if (mPassedList.size() <= 0) { if (mPassedList.size() <= 0) {
mCurrentList.clear(); mCurrentList.clear();
@ -451,11 +450,11 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
if (model.getDescription().contains("167.86.99.31") || model.getDescription().contains("orion.onion")) { if (model.getDescription().contains("167.86.99.31") || model.getDescription().contains("orion.onion")) {
mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis)); mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis));
} else { } else {
mEvent.invokeObserver(Arrays.asList(mFaviconLogo, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon); mEvent.invokeObserver(Arrays.asList(mFaviconLogo, "https://" + helperMethod.getDomainName(model.getDescription())), bookmarkEnums.eBookmarkAdapterCallback.ON_FETCH_FAVICON);
} }
} }
mRowMenu.setOnClickListener(this::onClick); mRowMenu.setOnClickListener(this);
setItemViewOnClickListener(mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mSelectionImage, model.getID(), model.getDate()); setItemViewOnClickListener(mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mSelectionImage, model.getID(), model.getDate());
} }
@ -478,13 +477,13 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(mRowContainer, mRowMenu, mSelectionImage, true, false)); mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(mRowContainer, mRowMenu, mSelectionImage, true, false));
} }
mBookmarkEdit.setOnClickListener(this::onClick); mBookmarkEdit.setOnClickListener(this);
} }
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (view.getId() == R.id.pBookmarkEdit) { if (view.getId() == R.id.pBookmarkEdit) {
mEvent.invokeObserver(Arrays.asList(mHeader.getText(), mDescription.getText(), mModelList.get(getLayoutPosition()).getID()), enums.etype.M_OPEN_BOOKMARK_SETTING); mEvent.invokeObserver(Arrays.asList(mHeader.getText(), mDescription.getText(), mModelList.get(getLayoutPosition()).getID()), bookmarkEnums.eBookmarkAdapterCallback.M_OPEN_BOOKMARK_SETTING);
} }
} }
} }

View File

@ -42,7 +42,7 @@ public class bookmarkAdapterView {
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);
} else { } else {
@ -78,9 +78,6 @@ public class bookmarkAdapterView {
if (pIsForced) { if (pIsForced) {
speed = 150; speed = 150;
} }
if (pVibrate) {
helperMethod.vibrate(mContext);
}
pLogoImage.setAlpha(0f); pLogoImage.setAlpha(0f);

View File

@ -1,5 +1,6 @@
package com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkHome; package com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkHome;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
@ -15,24 +16,19 @@ import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkSettings.bookmarkSettingController; import com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkSettings.bookmarkSettingController;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.dataManager.models.bookmarkRowModel; import com.hiddenservices.onionservices.dataManager.models.bookmarkRowModel;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.editTextManager; import com.hiddenservices.onionservices.appManager.editTextManager;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController; import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.keys; import com.hiddenservices.onionservices.constants.keys;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings; import com.hiddenservices.onionservices.constants.strings;
@ -44,13 +40,11 @@ import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController; import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums; import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.hiddenservices.onionservices.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import static com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkHome.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU; import static com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkHome.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU;
import static com.hiddenservices.onionservices.constants.keys.M_ACTIVITY_RESPONSE; import static com.hiddenservices.onionservices.constants.keys.M_ACTIVITY_RESPONSE;
import static com.hiddenservices.onionservices.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT; import static com.hiddenservices.onionservices.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT;
@ -60,14 +54,13 @@ import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessag
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_DELETE_BOOKMARK; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_DELETE_BOOKMARK;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_UPDATE_BOOKMARK; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_UPDATE_BOOKMARK;
@SuppressLint("NotifyDataSetChanged")
public class bookmarkController extends AppCompatActivity { public class bookmarkController extends AppCompatActivity {
/*Private Variables*/ /*Private Variables*/
private bookmarkModel mbookmarkModel; private bookmarkModel mbookmarkModel;
private homeController mHomeController; private homeController mHomeController;
private bookmarkAdapter mbookmarkAdapter; private bookmarkAdapter mbookmarkAdapter;
private LinearLayout mHeaderContainer;
private TextView mTitle; private TextView mTitle;
private bookmarkViewController mbookmarkViewController; private bookmarkViewController mbookmarkViewController;
@ -124,9 +117,8 @@ public class bookmarkController extends AppCompatActivity {
mMenuButton = findViewById(R.id.pMenuButton); mMenuButton = findViewById(R.id.pMenuButton);
mSearchButton = findViewById(R.id.pSearchButton); mSearchButton = findViewById(R.id.pSearchButton);
mTitle = findViewById(R.id.pTitle); mTitle = findViewById(R.id.pTitle);
mHeaderContainer = findViewById(R.id.pHeaderContainer);
mbookmarkViewController = new bookmarkViewController(mEmptyListNotification, mSearchInput, mRecycleView, mClearButton, this, mMenuButton, mSearchButton, mHeaderContainer, mTitle); mbookmarkViewController = new bookmarkViewController(mEmptyListNotification, mSearchInput, mRecycleView, mClearButton, this, mMenuButton, mSearchButton, mTitle);
} }
public void initializeList() { public void initializeList() {
@ -211,7 +203,7 @@ public class bookmarkController extends AppCompatActivity {
} }
@Override @Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
final int swipeFlags = 0; final int swipeFlags = 0;
return makeMovementFlags(swipeFlags, dragFlags); return makeMovementFlags(swipeFlags, dragFlags);
@ -363,7 +355,7 @@ public class bookmarkController extends AppCompatActivity {
@Override @Override
public Object invokeObserver(List<Object> data, Object e_type) { public Object invokeObserver(List<Object> data, Object e_type) {
if (e_type.equals(enums.etype.ON_KEYBOARD_CLOSE)) { if (e_type.equals(homeEnums.eEdittextCallbacks.ON_KEYBOARD_CLOSE)) {
onBackPressed(); onBackPressed();
} }
return null; return null;
@ -373,27 +365,25 @@ public class bookmarkController extends AppCompatActivity {
public class adapterCallback implements eventObserver.eventListener { public class adapterCallback implements eventObserver.eventListener {
@Override @Override
public Object invokeObserver(List<Object> data, Object e_type) { public Object invokeObserver(List<Object> data, Object e_type) {
if (e_type.equals(enums.etype.url_triggered)) { if (e_type.equals(bookmarkEnums.eBookmarkAdapterCallback.ON_URL_TRIGGER)) {
String url_temp = helperMethod.completeURL(data.get(0).toString()); String url_temp = helperMethod.completeURL(data.get(0).toString());
mHomeController.onLoadURL(url_temp); mHomeController.onLoadURL(url_temp);
finish(); finish();
} else if (e_type.equals(enums.etype.url_triggered_new_tab)) { } else if (e_type.equals(bookmarkEnums.eBookmarkAdapterCallback.ON_URL_TRIGGER_NEW_TAB)) {
String url_temp = helperMethod.completeURL(data.get(0).toString()); String url_temp = helperMethod.completeURL(data.get(0).toString());
mHomeController.onOpenLinkNewTab(url_temp); mHomeController.onOpenLinkNewTabLoaded(url_temp);
finish(); finish();
} else if (e_type.equals(enums.etype.fetch_favicon)) { } else if (e_type.equals(bookmarkEnums.eBookmarkAdapterCallback.ON_FETCH_FAVICON)) {
mHomeController.onGetFavIcon((ImageView) data.get(0), (String) data.get(1)); mHomeController.onGetFavIcon((ImageView) data.get(0), (String) data.get(1));
} else if (e_type.equals(enums.etype.url_clear)) { } else if (e_type.equals(bookmarkEnums.eBookmarkAdapterCallback.ON_URL_CLEAR)) {
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK, data); dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK, data);
} else if (e_type.equals(enums.etype.url_clear_at)) { } else if (e_type.equals(bookmarkEnums.eBookmarkAdapterCallback.ON_URL_CLEAR_AT)) {
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK, data); dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK, data);
} else if (e_type.equals(enums.etype.is_empty)) { } else if (e_type.equals(bookmarkEnums.eBookmarkAdapterCallback.IS_EMPTY)) {
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mbookmarkModel.getList().size(), 300)); mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mbookmarkModel.getList().size(), 300));
} else if (e_type.equals(enums.etype.remove_from_database)) { } else if (e_type.equals(bookmarkEnums.eBookmarkAdapterCallback.ON_VERIFY_SELECTED_URL_MENU)) {
dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_DELETE_FROM_HISTORY, Arrays.asList(data.get(0), strings.HISTORY_TITLE));
} else if (e_type.equals(enums.etype.on_verify_selected_url_menu)) {
mbookmarkViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data); mbookmarkViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data);
} else if (e_type.equals(enums.etype.M_OPEN_BOOKMARK_SETTING)) { } else if (e_type.equals(bookmarkEnums.eBookmarkAdapterCallback.M_OPEN_BOOKMARK_SETTING)) {
Intent intent = new Intent(bookmarkController.this, bookmarkSettingController.class); Intent intent = new Intent(bookmarkController.this, bookmarkSettingController.class);
intent.putExtra(keys.BOOKMARK_SETTING_NAME, (String) data.get(0)); intent.putExtra(keys.BOOKMARK_SETTING_NAME, (String) data.get(0));
intent.putExtra(keys.BOOKMARK_SETTING_URL, (String) data.get(1)); intent.putExtra(keys.BOOKMARK_SETTING_URL, (String) data.get(1));

View File

@ -10,6 +10,10 @@ public class bookmarkEnums {
M_ON_LOADING, M_LOADING_CLEAR, M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE M_ON_LOADING, M_LOADING_CLEAR, M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE
} }
public enum eBookmarkAdapterCallback {
ON_URL_TRIGGER, ON_URL_TRIGGER_NEW_TAB, ON_FETCH_FAVICON, ON_URL_CLEAR, ON_URL_CLEAR_AT, IS_EMPTY, ON_VERIFY_SELECTED_URL_MENU, M_OPEN_BOOKMARK_SETTING
}
public enum eBookmarkViewAdapterCommands { public enum eBookmarkViewAdapterCommands {
M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT
} }

View File

@ -19,11 +19,11 @@ class bookmarkModel {
mModelList.remove(index); mModelList.remove(index);
} }
void onManualClear(int index) { public void onManualClear(int index) {
removeFromList(index); removeFromList(index);
} }
void clearList() { public void clearList() {
mModelList.clear(); mModelList.clear();
} }

View File

@ -1,5 +1,6 @@
package com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkHome; package com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkHome;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
@ -16,7 +17,6 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import android.widget.TextView; import android.widget.TextView;
@ -35,7 +35,8 @@ import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
class bookmarkViewController { @SuppressLint("NotifyDataSetChanged")
public class bookmarkViewController {
/*Private Variables*/ /*Private Variables*/
private AppCompatActivity mContext; private AppCompatActivity mContext;
private TextView mEmptyListNotification; private TextView mEmptyListNotification;
@ -45,7 +46,6 @@ class bookmarkViewController {
private ImageButton mMenuButton; private ImageButton mMenuButton;
private ImageButton mSearchButton; private ImageButton mSearchButton;
private PopupWindow mPopupWindow = null; private PopupWindow mPopupWindow = null;
private LinearLayout mHeaderContainer;
private TextView mTitle; private TextView mTitle;
/*Private Local Variables*/ /*Private Local Variables*/
@ -54,7 +54,7 @@ class bookmarkViewController {
/*Initializations*/ /*Initializations*/
bookmarkViewController(TextView pEmptyListNotification, EditText pSearchInput, RecyclerView pRecycleView, Button pClearButton, AppCompatActivity pContext, ImageButton pMenuButton, ImageButton pSearchButton, LinearLayout pHeaderContainer, TextView pTitle) { bookmarkViewController(TextView pEmptyListNotification, EditText pSearchInput, RecyclerView pRecycleView, Button pClearButton, AppCompatActivity pContext, ImageButton pMenuButton, ImageButton pSearchButton, TextView pTitle) {
this.mEmptyListNotification = pEmptyListNotification; this.mEmptyListNotification = pEmptyListNotification;
this.mSearchInput = pSearchInput; this.mSearchInput = pSearchInput;
this.mRecycleView = pRecycleView; this.mRecycleView = pRecycleView;
@ -62,7 +62,6 @@ class bookmarkViewController {
this.mContext = pContext; this.mContext = pContext;
this.mMenuButton = pMenuButton; this.mMenuButton = pMenuButton;
this.mSearchButton = pSearchButton; this.mSearchButton = pSearchButton;
this.mHeaderContainer = pHeaderContainer;
this.mTitle = pTitle; this.mTitle = pTitle;
initPostUI(); initPostUI();
@ -73,7 +72,6 @@ class bookmarkViewController {
mSearchInput.setLongClickable(false); mSearchInput.setLongClickable(false);
mSearchInput.setOnLongClickListener(v -> false); mSearchInput.setOnLongClickListener(v -> false);
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);
@ -87,7 +85,6 @@ class bookmarkViewController {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); 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) {

View File

@ -85,6 +85,15 @@ class bridgeViewController {
} }
private void onEnableCustomBridge() { private void onEnableCustomBridge() {
mBridgeSettingObfs.setChecked(false);
mBridgeSettingBridgeChina.setChecked(false);
mBridgeSettingCustomPort.setChecked(false);
mBridgeSettingBridgeSnowflake.setChecked(false);
mBridgeSettingObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_text_v6)));
mBridgeSettingBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_text_v6)));
mBridgeSettingBridgeSnowflake.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_text_v6)));
animateColor(mBridgeSettingCustomPort, mBridgeSettingCustomPort.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", 200); animateColor(mBridgeSettingCustomPort, mBridgeSettingCustomPort.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", 200);
mBridgeSettingCustomPort.setHighlightColor(Color.BLACK); mBridgeSettingCustomPort.setHighlightColor(Color.BLACK);
mBridgeSettingCustomPort.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); mBridgeSettingCustomPort.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
@ -99,7 +108,8 @@ class bridgeViewController {
private void initViews(String p_bridge, int p_duration) { private void initViews(String p_bridge, int p_duration) {
resetRadioButtons(p_duration); resetRadioButtons(p_duration);
if (p_bridge.equals(strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)) { switch (p_bridge) {
case strings.BRIDGE_CUSTOM_BRIDGE_OBFS4:
animateColor(mBridgeSettingObfs, mBridgeSettingObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration); animateColor(mBridgeSettingObfs, mBridgeSettingObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration);
mBridgeSettingObfs.setHighlightColor(Color.BLACK); mBridgeSettingObfs.setHighlightColor(Color.BLACK);
mBridgeSettingObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); mBridgeSettingObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
@ -108,7 +118,8 @@ class bridgeViewController {
mBridgeSettingCustomPort.setChecked(false); mBridgeSettingCustomPort.setChecked(false);
mBridgeSettingBridgeSnowflake.setChecked(false); mBridgeSettingBridgeSnowflake.setChecked(false);
mBridgeSettingBridgeCustom.setText(strings.GENERIC_EMPTY_STR); mBridgeSettingBridgeCustom.setText(strings.GENERIC_EMPTY_STR);
} else if (p_bridge.equals(strings.BRIDGE_CUSTOM_BRIDGE_MEEK)) { break;
case strings.BRIDGE_CUSTOM_BRIDGE_MEEK:
animateColor(mBridgeSettingBridgeChina, mBridgeSettingBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration); animateColor(mBridgeSettingBridgeChina, mBridgeSettingBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration);
mBridgeSettingBridgeChina.setHighlightColor(Color.BLACK); mBridgeSettingBridgeChina.setHighlightColor(Color.BLACK);
mBridgeSettingBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); mBridgeSettingBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
@ -117,7 +128,8 @@ class bridgeViewController {
mBridgeSettingBridgeChina.setChecked(true); mBridgeSettingBridgeChina.setChecked(true);
mBridgeSettingCustomPort.setChecked(false); mBridgeSettingCustomPort.setChecked(false);
mBridgeSettingBridgeCustom.setText(strings.GENERIC_EMPTY_STR); mBridgeSettingBridgeCustom.setText(strings.GENERIC_EMPTY_STR);
} else if (p_bridge.equals(strings.BRIDGE_CUSTOM_BRIDGE_SNOWFLAKES)) { break;
case strings.BRIDGE_CUSTOM_BRIDGE_SNOWFLAKES:
animateColor(mBridgeSettingBridgeChina, mBridgeSettingBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration); animateColor(mBridgeSettingBridgeChina, mBridgeSettingBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration);
mBridgeSettingBridgeChina.setHighlightColor(Color.BLACK); mBridgeSettingBridgeChina.setHighlightColor(Color.BLACK);
mBridgeSettingBridgeSnowflake.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint))); mBridgeSettingBridgeSnowflake.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
@ -126,9 +138,12 @@ class bridgeViewController {
mBridgeSettingBridgeChina.setChecked(false); mBridgeSettingBridgeChina.setChecked(false);
mBridgeSettingCustomPort.setChecked(false); mBridgeSettingCustomPort.setChecked(false);
mBridgeSettingBridgeCustom.setText(strings.GENERIC_EMPTY_STR); mBridgeSettingBridgeCustom.setText(strings.GENERIC_EMPTY_STR);
} else { break;
default:
onEnableCustomBridge(); onEnableCustomBridge();
mBridgeSettingBridgeCustom.setText(("(Config) ➔ " + p_bridge.replace("\n", ""))); String mText = ("(Config) ➔ " + p_bridge.replace("\n", ""));
mBridgeSettingBridgeCustom.setText(mText);
break;
} }
} }

View File

@ -1,4 +1,4 @@
package com.hiddenservices.onionservices.appManager.homeManager.homeController; package com.hiddenservices.onionservices.appManager;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
@ -7,11 +7,9 @@ import android.os.Build;
import android.text.Spanned; import android.text.Spanned;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.KeyEvent; import android.view.KeyEvent;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
public class editTextManager extends androidx.appcompat.widget.AppCompatAutoCompleteTextView { public class editTextManager extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
@ -78,7 +76,7 @@ public class editTextManager extends androidx.appcompat.widget.AppCompatAutoComp
public boolean onKeyPreIme(int keyCode, KeyEvent event) { public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mEvent != null) { if (mEvent != null) {
mEvent.invokeObserver(null, enums.etype.ON_KEYBOARD_CLOSE); mEvent.invokeObserver(null, homeEnums.eEdittextCallbacks.ON_KEYBOARD_CLOSE);
} }
} }
return false; return false;

View File

@ -2,11 +2,8 @@ package com.hiddenservices.onionservices.appManager.externalCommandManager;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.view.View; import android.view.View;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController; import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController;
import com.hiddenservices.onionservices.constants.constants; import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
@ -16,9 +13,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.R; import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.pluginManager.pluginController; import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums; import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import org.torproject.android.service.wrapper.orbotLocalConstants; import org.torproject.android.service.wrapper.orbotLocalConstants;
import static com.hiddenservices.onionservices.constants.constants.CONST_EXTERNAL_SHORTCUT_COMMAND_ERASE; import static com.hiddenservices.onionservices.constants.constants.CONST_EXTERNAL_SHORTCUT_COMMAND_ERASE;
import static com.hiddenservices.onionservices.constants.keys.EXTERNAL_SHORTCUT_COMMAND; import static com.hiddenservices.onionservices.constants.keys.EXTERNAL_SHORTCUT_COMMAND;

View File

@ -30,15 +30,6 @@ public class externalURLNavigationContoller extends AppCompatActivity {
com.widget.onionservices.helperMethod.helperMethod.onStartApplication(this, CONST_PACKAGE_NAME); com.widget.onionservices.helperMethod.helperMethod.onStartApplication(this, CONST_PACKAGE_NAME);
status.sExternalWebsite = strings.GENERIC_EMPTY_STR; status.sExternalWebsite = strings.GENERIC_EMPTY_STR;
final Uri[] mData = {externalURLNavigationContoller.this.getIntent().getData()}; final Uri[] mData = {externalURLNavigationContoller.this.getIntent().getData()};
/*if (status.sExternalWebsiteLoading && !status.sSettingIsAppStarted) {
Intent intent = new Intent(this, homeController.class);
intent.addFlags(FLAG_ACTIVITY_NO_ANIMATION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
activityContextManager.getInstance().getHomeController().overridePendingTransition(R.anim.popup_scale_in, R.anim.popup_scale_out);
finish();
return;
}*/
status.sExternalWebsiteLoading = true; status.sExternalWebsiteLoading = true;
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
@ -49,8 +40,6 @@ public class externalURLNavigationContoller extends AppCompatActivity {
myIntent.addFlags(FLAG_ACTIVITY_NO_ANIMATION); myIntent.addFlags(FLAG_ACTIVITY_NO_ANIMATION);
myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
activityContextManager.getInstance().getHomeController().startActivity(myIntent); activityContextManager.getInstance().getHomeController().startActivity(myIntent);
//activityContextManager.getInstance().getHomeController().overridePendingTransition(R.anim.popup_scale_in, R.anim.popup_scale_out);
} else { } else {
if (mData[0] == null) { if (mData[0] == null) {
mData[0] = Uri.parse(constants.CONST_BACKEND_GENESIS_URL); mData[0] = Uri.parse(constants.CONST_BACKEND_GENESIS_URL);

View File

@ -3,11 +3,9 @@ package com.hiddenservices.onionservices.appManager.helpManager;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.KeyEvent; import android.view.KeyEvent;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
public class editViewController extends androidx.appcompat.widget.AppCompatAutoCompleteTextView { public class editViewController extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
@ -38,7 +36,7 @@ public class editViewController extends androidx.appcompat.widget.AppCompatAutoC
public boolean onKeyPreIme(int keyCode, KeyEvent event) { public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mEvent != null) { if (mEvent != null) {
mEvent.invokeObserver(null, enums.etype.ON_KEYBOARD_CLOSE); mEvent.invokeObserver(null, homeEnums.eEdittextCallbacks.ON_KEYBOARD_CLOSE);
} }
} }
return false; return false;

View File

@ -11,13 +11,10 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -25,7 +22,6 @@ public class helpAdapter extends RecyclerView.Adapter<helpAdapter.helpViewHolder
private List<helpDataModel> mModelList = new ArrayList<>(); private List<helpDataModel> mModelList = new ArrayList<>();
private List<helpDataModel> mCompleteModelList = new ArrayList<>(); private List<helpDataModel> mCompleteModelList = new ArrayList<>();
private LinearLayout mPrevRow; private LinearLayout mPrevRow;
private Context mContext;
private int mCurrentPosition = -1; private int mCurrentPosition = -1;
private boolean mIsAnimating = false; private boolean mIsAnimating = false;
@ -35,7 +31,6 @@ public class helpAdapter extends RecyclerView.Adapter<helpAdapter.helpViewHolder
this.mCompleteModelList.addAll(pModelList); this.mCompleteModelList.addAll(pModelList);
this.mModelList.addAll(pModelList); this.mModelList.addAll(pModelList);
} }
this.mContext = context;
} }
private void onSearchFilterInvoked(String pQuery) { private void onSearchFilterInvoked(String pQuery) {

View File

@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator; import androidx.recyclerview.widget.SimpleItemAnimator;
import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.constants.constants; import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.enums; import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
@ -95,7 +96,7 @@ public class helpController extends AppCompatActivity {
mRecycleView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { mRecycleView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
@Override @Override
public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { public boolean onInterceptTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent) {
if (motionEvent.getAction() != MotionEvent.ACTION_UP) { if (motionEvent.getAction() != MotionEvent.ACTION_UP) {
return false; return false;
} }
@ -110,7 +111,7 @@ public class helpController extends AppCompatActivity {
} }
@Override @Override
public void onTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { public void onTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent) {
} }
@Override @Override
@ -160,7 +161,7 @@ public class helpController extends AppCompatActivity {
@Override @Override
public Object invokeObserver(List<Object> data, Object e_type) { public Object invokeObserver(List<Object> data, Object e_type) {
if (e_type.equals(enums.etype.ON_KEYBOARD_CLOSE)) { if (e_type.equals(homeEnums.eEdittextCallbacks.ON_KEYBOARD_CLOSE)) {
mSearchInput.clearFocus(); mSearchInput.clearFocus();
//helperMethod.hideKeyboard(helpController.this); //helperMethod.hideKeyboard(helpController.this);
} }
@ -222,7 +223,7 @@ public class helpController extends AppCompatActivity {
activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK);
} }
finish(); finish();
activityContextManager.getInstance().onClearStack(); activityContextManager.getInstance().onGoHome();
} }
/*Local Overrides*/ /*Local Overrides*/

View File

@ -36,7 +36,6 @@ class helpViewController {
} }
private void initPostUI() { private void initPostUI() {
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);
@ -50,7 +49,6 @@ class helpViewController {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
} }
} }
}
private void onDataLoaded() { private void onDataLoaded() {
mProgressBar.animate().cancel(); mProgressBar.animate().cancel();

View File

@ -22,7 +22,6 @@ import com.hiddenservices.onionservices.dataManager.models.historyRowModel;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.R; import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -33,7 +32,6 @@ import java.util.List;
import static android.content.Context.LAYOUT_INFLATER_SERVICE; import static android.content.Context.LAYOUT_INFLATER_SERVICE;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_LOW_MEMORY_AUTO;
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listViewHolder> { public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listViewHolder> {
@ -149,10 +147,10 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
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("https://" + 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)), historyEnums.eHistoryAdapterCallback.ON_URL_CLEAR);
mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)), enums.etype.url_clear_at); mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)), historyEnums.eHistoryAdapterCallback.ON_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), historyEnums.eHistoryAdapterCallback.IS_EMPTY);
boolean mDateVerify = false; boolean mDateVerify = false;
if (mCurrentList.size() > 0 && mCurrentList.size() < m_counter_inner + 1 && mCurrentList.get(m_counter_inner - 1).getDescription() == null && (mCurrentList.size() > m_counter_inner + 1 && mCurrentList.get(m_counter_inner + 1).getDescription() == null || mCurrentList.size() == m_counter_inner + 1)) { if (mCurrentList.size() > 0 && mCurrentList.size() < m_counter_inner + 1 && 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)) {
@ -265,12 +263,12 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
public void onVerifyLongSelectedURL(boolean pIsComputing) { public void onVerifyLongSelectedURL(boolean pIsComputing) {
if (mLongSelectedIndex.size() > 0) { if (mLongSelectedIndex.size() > 0) {
mEvent.invokeObserver(Collections.singletonList(false), enums.etype.on_verify_selected_url_menu); mEvent.invokeObserver(Collections.singletonList(false), historyEnums.eHistoryAdapterCallback.ON_VERIFY_SELECTED_URL_MENU);
} else { } else {
if (!pIsComputing) { if (!pIsComputing) {
notifyDataSetChanged(); notifyDataSetChanged();
} }
mEvent.invokeObserver(Collections.singletonList(true), enums.etype.on_verify_selected_url_menu); mEvent.invokeObserver(Collections.singletonList(true), historyEnums.eHistoryAdapterCallback.ON_VERIFY_SELECTED_URL_MENU);
} }
} }
@ -343,7 +341,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
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), historyEnums.eHistoryAdapterCallback.ON_URL_TRIGGER);
initializeModelWithDate(true); initializeModelWithDate(true);
return true; return true;
@ -403,14 +401,15 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
if (v.getId() == R.id.pMenuCopy) { if (v.getId() == R.id.pMenuCopy) {
helperMethod.copyURL(pUrl, mListHolderContext); helperMethod.copyURL(pUrl, mListHolderContext);
mPopupWindow.dismiss(); mPopupWindow.dismiss();
helperMethod.showToastMessage("copied to clipboard", mContext);
} else if (v.getId() == R.id.pMenuShare) { } else if (v.getId() == R.id.pMenuShare) {
helperMethod.shareApp((AppCompatActivity) mListHolderContext, pUrl, pTitle); helperMethod.shareApp((AppCompatActivity) mListHolderContext, pUrl, pTitle);
mPopupWindow.dismiss(); mPopupWindow.dismiss();
} else if (v.getId() == R.id.pMenuOpenCurrentTab) { } else if (v.getId() == R.id.pMenuOpenCurrentTab) {
mEvent.invokeObserver(Collections.singletonList(pUrl), enums.etype.url_triggered); mEvent.invokeObserver(Collections.singletonList(pUrl), historyEnums.eHistoryAdapterCallback.ON_URL_TRIGGER);
mPopupWindow.dismiss(); mPopupWindow.dismiss();
} else if (v.getId() == R.id.pMenuOpenNewTab) { } else if (v.getId() == R.id.pMenuOpenNewTab) {
mEvent.invokeObserver(Collections.singletonList(pUrl), enums.etype.url_triggered_new_tab); mEvent.invokeObserver(Collections.singletonList(pUrl), historyEnums.eHistoryAdapterCallback.ON_URL_TRIGGER_NEW_TAB);
mPopupWindow.dismiss(); mPopupWindow.dismiss();
} else if (v.getId() == R.id.pMenuDelete) { } else if (v.getId() == R.id.pMenuDelete) {
onClose(pPosition); onClose(pPosition);
@ -426,9 +425,9 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
} }
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)), historyEnums.eHistoryAdapterCallback.ON_URL_CLEAR);
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)), enums.etype.url_clear_at); mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)), historyEnums.eHistoryAdapterCallback.ON_URL_CLEAR_AT);
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)), enums.etype.is_empty); mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)), historyEnums.eHistoryAdapterCallback.IS_EMPTY);
if (mPassedList.size() <= 0) { if (mPassedList.size() <= 0) {
mCurrentList.clear(); mCurrentList.clear();
@ -510,18 +509,20 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
mDescription.setText(m_description); mDescription.setText(m_description);
} else { } else {
mHeader.setText(model.getHeader()); mHeader.setText(model.getHeader());
mDescription.setText(("https://" + model.getDescription())); String mText = "https://" + model.getDescription();
mDescription.setText(mText);
} }
mWebLogo.setVisibility(View.VISIBLE); mWebLogo.setVisibility(View.VISIBLE);
mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0) + "")); String mText = helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0) + "";
mWebLogo.setText(mText);
String header = model.getHeader(); String header = model.getHeader();
if(status.sLowMemory != enums.MemoryStatus.LOW_MEMORY && status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){ if(status.sLowMemory != enums.MemoryStatus.LOW_MEMORY && status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){
if (model.getDescription().contains("167.86.99.31") || model.getDescription().contains("orion.onion")) { if (model.getDescription().contains("167.86.99.31") || model.getDescription().contains("orion.onion")) {
mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis)); mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis));
} else { } else {
mEvent.invokeObserver(Arrays.asList(mFaviconLogo, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon); mEvent.invokeObserver(Arrays.asList(mFaviconLogo, "https://" + helperMethod.getDomainName(model.getDescription())), historyEnums.eHistoryAdapterCallback.ON_FETCH_FAVICON);
} }
} }
setItemViewOnClickListener(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());
@ -543,7 +544,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
} }
} }
void setFilter(String pFilter) { public void setFilter(String pFilter) {
this.mFilter = pFilter.toLowerCase(); this.mFilter = pFilter.toLowerCase();
} }

View File

@ -80,9 +80,6 @@ public class historyAdapterView {
if (pIsForced) { if (pIsForced) {
speed = 150; speed = 150;
} }
if (pVibrate) {
helperMethod.vibrate(mContext);
}
pLogoImage.setAlpha(0f); pLogoImage.setAlpha(0f);
pLogoImage.setVisibility(View.VISIBLE); pLogoImage.setVisibility(View.VISIBLE);

View File

@ -1,5 +1,6 @@
package com.hiddenservices.onionservices.appManager.historyManager; package com.hiddenservices.onionservices.appManager.historyManager;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.Canvas; import android.graphics.Canvas;
@ -14,23 +15,18 @@ import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.dataManager.models.historyRowModel; import com.hiddenservices.onionservices.dataManager.models.historyRowModel;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.editTextManager; import com.hiddenservices.onionservices.appManager.editTextManager;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController; import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.keys; import com.hiddenservices.onionservices.constants.keys;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings; import com.hiddenservices.onionservices.constants.strings;
@ -42,12 +38,10 @@ import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController; import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums; import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.hiddenservices.onionservices.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import static com.hiddenservices.onionservices.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU; import static com.hiddenservices.onionservices.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU;
import static com.hiddenservices.onionservices.constants.sql.SQL_CLEAR_HISTORY; import static com.hiddenservices.onionservices.constants.sql.SQL_CLEAR_HISTORY;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_CLEAR_HISTORY; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_CLEAR_HISTORY;
@ -59,7 +53,6 @@ public class historyController extends AppCompatActivity {
private homeController mHomeController; private homeController mHomeController;
private activityContextManager mContextManager; private activityContextManager mContextManager;
private historyAdapter mHistoryAdapter; private historyAdapter mHistoryAdapter;
private LinearLayout mHeaderContainer;
private TextView mTitle; private TextView mTitle;
/*Private Views*/ /*Private Views*/
@ -115,11 +108,10 @@ public class historyController extends AppCompatActivity {
mClearButton = findViewById(R.id.pClearButton); mClearButton = findViewById(R.id.pClearButton);
mMenuButton = findViewById(R.id.pMenuButton); mMenuButton = findViewById(R.id.pMenuButton);
mSearchButton = findViewById(R.id.pSearchButton); mSearchButton = findViewById(R.id.pSearchButton);
mHeaderContainer = findViewById(R.id.pHeaderContainer);
mTitle = findViewById(R.id.pTitle); mTitle = findViewById(R.id.pTitle);
activityContextManager.getInstance().onStack(this); activityContextManager.getInstance().onStack(this);
mHistoryViewController = new historyViewController(mEmptyListNotification, mSearchInput, mRecycleView, mClearButton, this, mMenuButton, mSearchButton, mHeaderContainer, mTitle); mHistoryViewController = new historyViewController(mEmptyListNotification, mSearchInput, mRecycleView, mClearButton, this, mMenuButton, mSearchButton, mTitle);
} }
public void initializeList() { public void initializeList() {
@ -134,6 +126,7 @@ public class historyController extends AppCompatActivity {
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mHistoryModel.getList().size(), 0)); mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mHistoryModel.getList().size(), 0));
} }
@SuppressLint("NotifyDataSetChanged")
public void initCustomListeners() { public void initCustomListeners() {
mSearchInput.setEventHandler(new edittextManagerCallback()); mSearchInput.setEventHandler(new edittextManagerCallback());
@ -151,7 +144,7 @@ public class historyController extends AppCompatActivity {
if (totalItemCount > 0 && endHasBeenReached) { if (totalItemCount > 0 && endHasBeenReached) {
mRecycleView.computeVerticalScrollOffset(); mRecycleView.computeVerticalScrollOffset();
onLoadMoreHistory(mRecycleView.computeVerticalScrollOffset() > 0); onLoadMoreHistory();
} }
} }
} }
@ -225,7 +218,7 @@ public class historyController extends AppCompatActivity {
} }
@Override @Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { public int getMovementFlags(@NonNull RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
int position = viewHolder.getAdapterPosition(); int position = viewHolder.getAdapterPosition();
if (mHistoryAdapter.isSwipable(position)) { if (mHistoryAdapter.isSwipable(position)) {
final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
@ -331,7 +324,7 @@ public class historyController extends AppCompatActivity {
public void onOpenMultipleTabs(View view) { public void onOpenMultipleTabs(View view) {
ArrayList<String> m_long_selected_urk = (ArrayList<String>) mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.GET_LONG_SELECTED_URL, null); ArrayList<String> m_long_selected_urk = (ArrayList<String>) mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.GET_LONG_SELECTED_URL, null);
for (int m_counter = 0; m_counter < m_long_selected_urk.size(); m_counter++) { for (int m_counter = 0; m_counter < m_long_selected_urk.size(); m_counter++) {
mHomeController.postNewLinkTabAnimation(m_long_selected_urk.get(m_counter), false); mHomeController.onOpenLinkNewTabLoaded(m_long_selected_urk.get(m_counter));
} }
onBackPressed(null); onBackPressed(null);
mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_CLEAR_LONG_SELECTED_URL, null); mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_CLEAR_LONG_SELECTED_URL, null);
@ -365,7 +358,7 @@ public class historyController extends AppCompatActivity {
dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY, null)); dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY, null));
} }
private void onLoadMoreHistory(boolean pLoadingEnabled) { private void onLoadMoreHistory() {
if (!isUpdatingRecyclerView) { if (!isUpdatingRecyclerView) {
isUpdatingRecyclerView = true; isUpdatingRecyclerView = true;
new Thread() { new Thread() {
@ -377,7 +370,6 @@ public class historyController extends AppCompatActivity {
activityContextManager.getInstance().getHistoryController().runOnUiThread(() -> { activityContextManager.getInstance().getHistoryController().runOnUiThread(() -> {
if (mPrevSize < mHistoryModel.getList().size()) { if (mPrevSize < mHistoryModel.getList().size()) {
mHistoryAdapter.onLoadMore(mHistoryModel.getList()); mHistoryAdapter.onLoadMore(mHistoryModel.getList());
//mHistoryAdapter.notifyItemRangeInserted(mPrevSize, mHistoryModel.getList().size()-1);
} }
}); });
try { try {
@ -397,7 +389,7 @@ public class historyController extends AppCompatActivity {
@Override @Override
public Object invokeObserver(List<Object> data, Object e_type) { public Object invokeObserver(List<Object> data, Object e_type) {
if (e_type.equals(enums.etype.ON_KEYBOARD_CLOSE)) { if (e_type.equals(homeEnums.eEdittextCallbacks.ON_KEYBOARD_CLOSE)) {
onBackPressed(); onBackPressed();
} }
return null; return null;
@ -409,25 +401,23 @@ public class historyController extends AppCompatActivity {
public class adapterCallback implements eventObserver.eventListener { public class adapterCallback implements eventObserver.eventListener {
@Override @Override
public Object invokeObserver(List<Object> data, Object e_type) { public Object invokeObserver(List<Object> data, Object e_type) {
if (e_type.equals(enums.etype.url_triggered)) { if (e_type.equals(historyEnums.eHistoryAdapterCallback.ON_URL_TRIGGER)) {
String url_temp = helperMethod.completeURL(data.get(0).toString()); String url_temp = helperMethod.completeURL(data.get(0).toString());
mHomeController.onLoadURL(url_temp); mHomeController.onLoadURL(url_temp);
finish(); finish();
} else if (e_type.equals(enums.etype.url_triggered_new_tab)) { } else if (e_type.equals(historyEnums.eHistoryAdapterCallback.ON_URL_TRIGGER_NEW_TAB)) {
String url_temp = helperMethod.completeURL(data.get(0).toString()); String url_temp = helperMethod.completeURL(data.get(0).toString());
mHomeController.postNewLinkTabAnimation(url_temp, false); mHomeController.onOpenLinkNewTabLoaded(url_temp);
finish(); finish();
} else if (e_type.equals(enums.etype.fetch_favicon)) { } else if (e_type.equals(historyEnums.eHistoryAdapterCallback.ON_FETCH_FAVICON)) {
mHomeController.onGetFavIcon((ImageView) data.get(0), (String) data.get(1)); mHomeController.onGetFavIcon((ImageView) data.get(0), (String) data.get(1));
} else if (e_type.equals(enums.etype.url_clear)) { } else if (e_type.equals(historyEnums.eHistoryAdapterCallback.ON_URL_CLEAR)) {
mHistoryModel.onManualClear((int) data.get(0)); mHistoryModel.onManualClear((int) data.get(0));
} else if (e_type.equals(enums.etype.url_clear_at)) { } else if (e_type.equals(historyEnums.eHistoryAdapterCallback.ON_URL_CLEAR_AT)) {
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_REMOVE_HISTORY, data); dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_REMOVE_HISTORY, data);
} else if (e_type.equals(enums.etype.is_empty)) { } else if (e_type.equals(historyEnums.eHistoryAdapterCallback.IS_EMPTY)) {
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mHistoryModel.getList().size(), 300)); mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mHistoryModel.getList().size(), 300));
} else if (e_type.equals(enums.etype.remove_from_database)) { } else if (e_type.equals(historyEnums.eHistoryAdapterCallback.ON_VERIFY_SELECTED_URL_MENU)) {
dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_DELETE_FROM_HISTORY, Arrays.asList(data.get(0), strings.HISTORY_TITLE));
} else if (e_type.equals(enums.etype.on_verify_selected_url_menu)) {
mHistoryViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data); mHistoryViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data);
} }
return null; return null;

View File

@ -10,6 +10,10 @@ public class historyEnums {
M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE M_CLEAR_LONG_SELECTED_URL, GET_SELECTED_URL, GET_LONG_SELECTED_URL, GET_LONG_SELECTED_STATUS, ON_CLOSE
} }
public enum eHistoryAdapterCallback {
ON_URL_TRIGGER, ON_URL_TRIGGER_NEW_TAB, ON_FETCH_FAVICON, ON_URL_CLEAR, ON_URL_CLEAR_AT, IS_EMPTY, ON_VERIFY_SELECTED_URL_MENU, M_OPEN_BOOKMARK_SETTING
}
public enum eHistoryViewAdapterCommands { public enum eHistoryViewAdapterCommands {
M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT M_OPEN_MENU, M_CLEAR_LONG_SELECTED_VIEW, M_SELECT_VIEW, M_CLEAR_HIGHLIGHT
} }

View File

@ -4,7 +4,7 @@ import com.hiddenservices.onionservices.dataManager.models.historyRowModel;
import java.util.ArrayList; import java.util.ArrayList;
class historyModel { public class historyModel {
/*Private Variables*/ /*Private Variables*/
private ArrayList<historyRowModel> mModelList = new ArrayList<>(); private ArrayList<historyRowModel> mModelList = new ArrayList<>();
@ -19,11 +19,11 @@ class historyModel {
mModelList.remove(index); mModelList.remove(index);
} }
void onManualClear(int index) { public void onManualClear(int index) {
removeFromMainList(index); removeFromMainList(index);
} }
void clearList() { public void clearList() {
mModelList.clear(); mModelList.clear();
} }

View File

@ -1,5 +1,6 @@
package com.hiddenservices.onionservices.appManager.historyManager; package com.hiddenservices.onionservices.appManager.historyManager;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
@ -16,7 +17,6 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import android.widget.TextView; import android.widget.TextView;
@ -35,7 +35,8 @@ import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
class historyViewController { @SuppressLint("NotifyDataSetChanged")
public class historyViewController {
/*Private Variables*/ /*Private Variables*/
private AppCompatActivity mContext; private AppCompatActivity mContext;
private TextView mEmptyListNotification; private TextView mEmptyListNotification;
@ -53,7 +54,7 @@ class historyViewController {
/*Initializations*/ /*Initializations*/
historyViewController(TextView pEmptyListNotification, EditText pSearchInput, RecyclerView pRecycleView, Button pClearButton, AppCompatActivity pContext, ImageButton pMenuButton, ImageButton pSearchButton, LinearLayout pHeaderContainer, TextView pTitle) { historyViewController(TextView pEmptyListNotification, EditText pSearchInput, RecyclerView pRecycleView, Button pClearButton, AppCompatActivity pContext, ImageButton pMenuButton, ImageButton pSearchButton, TextView pTitle) {
this.mEmptyListNotification = pEmptyListNotification; this.mEmptyListNotification = pEmptyListNotification;
this.mSearchInput = pSearchInput; this.mSearchInput = pSearchInput;
this.mRecycleView = pRecycleView; this.mRecycleView = pRecycleView;
@ -71,7 +72,6 @@ class historyViewController {
mSearchInput.setLongClickable(false); mSearchInput.setLongClickable(false);
mSearchInput.setOnLongClickListener(v -> false); mSearchInput.setOnLongClickListener(v -> false);
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);
@ -85,7 +85,6 @@ class historyViewController {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); 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) {

View File

@ -1,7 +0,0 @@
package com.hiddenservices.onionservices.appManager.homeManager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class FakeLauncherActivity : AppCompatActivity() {
}

View File

@ -1,13 +1,10 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel; package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel;
public class geckoDataModel { public class geckoDataModel {
public boolean mFullScreenStatus = false;
public int mCurrentURL_ID = -1; public int mCurrentURL_ID = -1;
public boolean mFullScreenStatus = false;
public boolean mThemeChanged = false;
public String mCurrentURL = "about:blank"; public String mCurrentURL = "about:blank";
public String mTheme = null;
public String mSessionID; public String mSessionID;
public String mCurrentTitle = "loading"; public String mCurrentTitle = "loading";
} }

View File

@ -1,10 +1,6 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel; package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_HELP_URL_CACHE;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
@ -15,9 +11,9 @@ import androidx.annotation.Nullable;
import androidx.annotation.UiThread; import androidx.annotation.UiThread;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoDownloadManager; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.downloadManager.geckoDownloadManager;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.constants.enums; import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings; import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
@ -38,6 +34,7 @@ public class contentDelegate implements GeckoSession.ContentDelegate {
private geckoSession mGeckoSession; private geckoSession mGeckoSession;
private geckoDownloadManager mDownloadManager; private geckoDownloadManager mDownloadManager;
private boolean mClosed = false;
private int mCrashCount = 0; private int mCrashCount = 0;
/*Initializations*/ /*Initializations*/
@ -63,7 +60,7 @@ public class contentDelegate implements GeckoSession.ContentDelegate {
@Override @Override
public void onFullScreen(@NonNull GeckoSession var1, boolean var2) { public void onFullScreen(@NonNull GeckoSession var1, boolean var2) {
mGeckoDataModel.mFullScreenStatus = var2; mGeckoDataModel.mFullScreenStatus = var2;
mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), enums.etype.ON_FULL_SCREEN); mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_FULL_SCREEN);
} }
@UiThread @UiThread
@ -76,21 +73,21 @@ public class contentDelegate implements GeckoSession.ContentDelegate {
} }
if (var4.type != 0 && var4.srcUri != null) { if (var4.type != 0 && var4.srcUri != null) {
if (var4.linkUri != null) { if (var4.linkUri != null) {
mEvent.invokeObserver(Arrays.asList(var4.linkUri, mGeckoDataModel.mSessionID, var4.srcUri, title, mGeckoDataModel.mTheme, var4.altText, mGeckoSession, mContext.get()), M_LONG_PRESS_WITH_LINK); mEvent.invokeObserver(Arrays.asList(var4.linkUri, mGeckoDataModel.mSessionID, var4.srcUri, title, var4.altText, mGeckoSession, mContext.get()), M_LONG_PRESS_WITH_LINK);
} else { } else {
try { try {
String mTitle = var4.title; String mTitle = var4.title;
if (mTitle == null || mTitle.length() <= 0) { if (mTitle == null || mTitle.length() <= 0) {
mTitle = helperMethod.getDomainName(mGeckoDataModel.mCurrentURL) + "\n" + var4.srcUri; mTitle = helperMethod.getDomainName(mGeckoDataModel.mCurrentURL) + "\n" + var4.srcUri;
} }
mEvent.invokeObserver(Arrays.asList(var4.srcUri, mGeckoDataModel.mSessionID, mTitle, mGeckoDataModel.mTheme, mGeckoSession, mContext.get()), enums.etype.on_long_press); mEvent.invokeObserver(Arrays.asList(var4.srcUri, mGeckoDataModel.mSessionID, mTitle, mGeckoSession, mContext.get()), homeEnums.eGeckoCallback.ON_LONG_PRESS);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
Log.i("", ""); Log.i("", "");
} }
} }
} else if (var4.linkUri != null) { } else if (var4.linkUri != null) {
mEvent.invokeObserver(Arrays.asList(var4.linkUri, mGeckoDataModel.mSessionID, title, mGeckoDataModel.mTheme, mGeckoSession, mContext.get()), M_LONG_PRESS_URL); mEvent.invokeObserver(Arrays.asList(var4.linkUri, mGeckoDataModel.mSessionID, title, mGeckoSession, mContext.get()), M_LONG_PRESS_URL);
} }
} }
@ -104,51 +101,43 @@ public class contentDelegate implements GeckoSession.ContentDelegate {
mDownloadManager.downloadFile(response, mGeckoSession, mContext.get(), mEvent); mDownloadManager.downloadFile(response, mGeckoSession, mContext.get(), mEvent);
} }
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {
mEvent.invokeObserver(Arrays.asList(response, mGeckoDataModel.mSessionID), enums.etype.on_handle_external_intent); mEvent.invokeObserver(Arrays.asList(response, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_HANDLE_EXTERNAL_INTENT);
mGeckoSession.stop(); mGeckoSession.stop();
} }
} }
@UiThread @UiThread
public void onFirstContentfulPaint(@NonNull GeckoSession var1) { public void onFirstContentfulPaint(@NonNull GeckoSession var1) {
if (mGeckoDataModel.mCurrentURL.contains("167.86.99.31") || mGeckoDataModel.mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mGeckoDataModel.mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoDataModel.mCurrentURL.startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoDataModel.mCurrentURL.startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE);
} else {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, true), enums.etype.M_ON_BANNER_UPDATE);
}
if (!mGeckoDataModel.mCurrentURL.equals("about:blank")) { if (!mGeckoDataModel.mCurrentURL.equals("about:blank")) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.ON_FIRST_PAINT); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID), homeEnums.eGeckoCallback.ON_LOAD_REQUEST);
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.ON_LOAD_REQUEST);
} }
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), enums.etype.ON_EXPAND_TOP_BAR); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle), homeEnums.eGeckoCallback.ON_EXPAND_TOP_BAR);
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL,mGeckoDataModel.mSessionID,null, mGeckoDataModel.mCurrentURL_ID, null), homeEnums.eGeckoCallback.M_INDEX_WEBSITE);
} }
@UiThread @UiThread
public void onWebAppManifest(@NonNull GeckoSession var1, @NonNull JSONObject var2) { public void onWebAppManifest(@NonNull GeckoSession var1, @NonNull JSONObject var2) {
try { try {
mGeckoDataModel.mThemeChanged = true; mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL,mGeckoDataModel.mSessionID,mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, var2.getString("theme_color")), homeEnums.eGeckoCallback.M_INDEX_WEBSITE);
mGeckoDataModel.mTheme = var2.getString("theme_color"); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL,mGeckoDataModel.mSessionID,null, mGeckoDataModel.mCurrentURL_ID, var2.getString("theme_color")), homeEnums.eGeckoCallback.M_INDEX_WEBSITE);
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), enums.etype.ON_UPDATE_THEME);
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL,mGeckoDataModel.mSessionID,mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_INDEX_WEBSITE);
} catch (Exception ex) { } catch (Exception ex) {
mGeckoDataModel.mTheme = null; mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle), homeEnums.eGeckoCallback.ON_UPDATE_THEME);
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), enums.etype.ON_UPDATE_THEME); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL,mGeckoDataModel.mSessionID,null, mGeckoDataModel.mCurrentURL_ID, null), homeEnums.eGeckoCallback.M_INDEX_WEBSITE);
ex.printStackTrace(); ex.printStackTrace();
} }
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.ON_UPDATE_TAB_TITLE); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID), homeEnums.eGeckoCallback.ON_UPDATE_TAB_TITLE);
} }
@UiThread @UiThread
public void onCrash(@NonNull GeckoSession session) { public void onCrash(@NonNull GeckoSession session) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), enums.etype.ON_DESTROY_MEDIA); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoSession), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA);
if (!mGeckoSession.isClosed() && status.sSettingIsAppStarted) { if (!mClosed && status.sSettingIsAppStarted) {
if (mEvent == null) { if (mEvent == null) {
return; return;
} }
Object mSessionObject = mEvent.invokeObserver(null, enums.etype.SESSION_ID); Object mSessionObject = mEvent.invokeObserver(null, homeEnums.eGeckoCallback.SESSION_ID);
if (mSessionObject == null || mGeckoDataModel.mSessionID == null) { if (mSessionObject == null || mGeckoDataModel.mSessionID == null) {
return; return;
} }
@ -158,7 +147,7 @@ public class contentDelegate implements GeckoSession.ContentDelegate {
final Handler handler = new Handler(); final Handler handler = new Handler();
handler.postDelayed(() -> { handler.postDelayed(() -> {
try { try {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), enums.etype.M_OPEN_SESSION); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, this), homeEnums.eGeckoCallback.M_OPEN_SESSION);
} catch (Exception ignored) { } catch (Exception ignored) {
} }
}, mCrashCount * 500L); }, mCrashCount * 500L);
@ -170,13 +159,13 @@ public class contentDelegate implements GeckoSession.ContentDelegate {
@UiThread @UiThread
public void onKill(@NonNull GeckoSession session) { public void onKill(@NonNull GeckoSession session) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), enums.etype.ON_DESTROY_MEDIA); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoSession), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA);
if (!mGeckoSession.isClosed() && status.sSettingIsAppStarted) { if (!mClosed && status.sSettingIsAppStarted) {
if (mEvent == null) { if (mEvent == null) {
return; return;
} }
Object mSessionObject = mEvent.invokeObserver(null, enums.etype.SESSION_ID); Object mSessionObject = mEvent.invokeObserver(null, homeEnums.eGeckoCallback.SESSION_ID);
if (mSessionObject == null || mGeckoDataModel.mSessionID == null) { if (mSessionObject == null || mGeckoDataModel.mSessionID == null) {
return; return;
} }
@ -189,7 +178,7 @@ public class contentDelegate implements GeckoSession.ContentDelegate {
handler.postDelayed(() -> { handler.postDelayed(() -> {
if (status.sSettingIsAppStarted && !session.isOpen()) { if (status.sSettingIsAppStarted && !session.isOpen()) {
try { try {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), enums.etype.M_OPEN_SESSION); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, this), homeEnums.eGeckoCallback.M_OPEN_SESSION);
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }
@ -200,7 +189,16 @@ public class contentDelegate implements GeckoSession.ContentDelegate {
} }
} }
/*Local Triggers*/ @UiThread
public void onCloseRequest(@NonNull final GeckoSession session) {
mClosed = true;
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, this), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA);
mGeckoDataModel.mSessionID = "-1";
}
public boolean isClosed() {
return mClosed;
}
public boolean getFullScreenStatus() { public boolean getFullScreenStatus() {
return !mGeckoDataModel.mFullScreenStatus; return !mGeckoDataModel.mFullScreenStatus;

View File

@ -7,7 +7,7 @@ import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses.intentHandler; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses.intentHandler;
import com.hiddenservices.onionservices.constants.enums; import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoSession;
@ -39,12 +39,12 @@ public class historyDelegate implements GeckoSession.HistoryDelegate {
mHistory = var2; mHistory = var2;
if(mHistory !=null){ if(mHistory !=null){
setURL(mHistory.get(mHistory.getCurrentIndex()).getUri()); setURL(mHistory.get(mHistory.getCurrentIndex()).getUri());
mEvent.invokeObserver(Arrays.asList(mHistory, mGeckoDataModel.mSessionID), enums.etype.on_url_load); mEvent.invokeObserver(Arrays.asList(mHistory, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_URL_LOAD);
if(mCurrentIndex != var2.getCurrentIndex()){ if(mCurrentIndex != var2.getCurrentIndex()){
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mHistory.get(mHistory.getCurrentIndex()).getTitle(), mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), enums.etype.ON_UPDATE_SEARCH_BAR); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mHistory.get(mHistory.getCurrentIndex()).getTitle(), mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), homeEnums.eGeckoCallback.ON_UPDATE_SEARCH_BAR);
} }
Object mID = mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mHistory.get(mHistory.getCurrentIndex()).getTitle(), -1, mGeckoDataModel.mTheme, mGeckoSession, false), enums.etype.ON_UPDATE_HISTORY); Object mID = mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mHistory.get(mHistory.getCurrentIndex()).getTitle(), -1, mGeckoDataModel.mTheme, mGeckoSession, false), homeEnums.eGeckoCallback.ON_UPDATE_HISTORY);
if (mID != null) { if (mID != null) {
mGeckoDataModel.mCurrentURL_ID = (int) mID; mGeckoDataModel.mCurrentURL_ID = (int) mID;
} }
@ -60,10 +60,8 @@ public class historyDelegate implements GeckoSession.HistoryDelegate {
} }
this.mGeckoDataModel.mCurrentURL = pURL; this.mGeckoDataModel.mCurrentURL = pURL;
if(pURL.startsWith("tel:")){
intentHandler.actionDial(pURL, mContext); intentHandler.actionDial(pURL, mContext);
} }
}
public boolean isHistoryEmpty(){ public boolean isHistoryEmpty(){
if(mHistory!=null && mHistory.size()>0){ if(mHistory!=null && mHistory.size()>0){

View File

@ -18,6 +18,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat; import androidx.core.app.NotificationManagerCompat;
import com.hiddenservices.onionservices.R; import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.pluginManager.pluginReciever.mediaNotificationReciever; import com.hiddenservices.onionservices.pluginManager.pluginReciever.mediaNotificationReciever;
@ -74,7 +75,7 @@ public class mediaDelegate implements GeckoSession.MediaDelegate {
} }
if (!media_status){ if (!media_status){
PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_play", 0); PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_play", enums.MediaNotificationReciever.PLAY);
contentView.setOnClickPendingIntent(R.id.trigger, pIntent); contentView.setOnClickPendingIntent(R.id.trigger, pIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow_no_tint); contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow_no_tint);
@ -82,7 +83,7 @@ public class mediaDelegate implements GeckoSession.MediaDelegate {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow); contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow);
} }
}else { }else {
PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_pause", 1); PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_pause", enums.MediaNotificationReciever.PAUSE);
contentView.setOnClickPendingIntent(R.id.trigger, pIntent); contentView.setOnClickPendingIntent(R.id.trigger, pIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_pause_no_tint); contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_pause_no_tint);
@ -91,11 +92,11 @@ public class mediaDelegate implements GeckoSession.MediaDelegate {
} }
} }
PendingIntent pIntentPrev = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_next", 2); PendingIntent pIntentPrev = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_next", enums.MediaNotificationReciever.SKIP_FOWWARD);
contentView.setOnClickPendingIntent(R.id.next, pIntentPrev); contentView.setOnClickPendingIntent(R.id.next, pIntentPrev);
if(android.os.Build.VERSION. SDK_INT > Build.VERSION_CODES.N){ if(android.os.Build.VERSION. SDK_INT > Build.VERSION_CODES.N){
PendingIntent pIntentNext = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_back", 3); PendingIntent pIntentNext = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_back", enums.MediaNotificationReciever.SKIP_BACKWARD);
contentView.setOnClickPendingIntent(R.id.back, pIntentNext); contentView.setOnClickPendingIntent(R.id.back, pIntentNext);
} }

View File

@ -0,0 +1,196 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_BADCERT_CACHED;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_BADCERT_CACHED_DARK;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_ERROR_CACHED;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_ERROR_CACHED_DARK;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses.errorHandler;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses.preferencesHandler;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.libs.trueTime.trueTimeEncryption;
import org.mozilla.geckoview.AllowOrDeny;
import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.WebRequestError;
import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.util.Arrays;
public class navigationDelegate implements GeckoSession.NavigationDelegate {
/*Private Variables*/
private WeakReference<AppCompatActivity> mContext;
private eventObserver.eventListener mEvent;
private geckoDataModel mGeckoDataModel;
private geckoSession mGeckoSession;
private boolean mCanGoBack = false;
private boolean mCanGoForward = false;
/*Initializations*/
public navigationDelegate(WeakReference<AppCompatActivity> pContext, eventObserver.eventListener pEvent, geckoDataModel pGeckoDataModel, geckoSession pGeckoSession) {
this.mContext = pContext;
this.mEvent = pEvent;
this.mGeckoDataModel = pGeckoDataModel;
this.mGeckoSession = pGeckoSession;
}
@Override
public void onCanGoBack(@NonNull GeckoSession session, boolean var2) {
mCanGoBack = var2;
}
@Override
public void onCanGoForward(@NonNull GeckoSession session, boolean var2) {
mCanGoForward = var2;
}
private String setGenesisVerificationToken(String pString) {
try {
if (pString.contains("?")) {
pString += "&" + constants.CONST_GENESIS_GMT_TIME_GET_KEY + "=" + trueTimeEncryption.getInstance().getSecretToken() + "&theme=" + status.sTheme;
} else {
pString += "?" + constants.CONST_GENESIS_GMT_TIME_GET_KEY + "=" + trueTimeEncryption.getInstance().getSecretToken() + "&theme=" + status.sTheme;
}
return pString;
} catch (Exception ex) {
return pString;
}
}
public GeckoResult<AllowOrDeny> onLoadRequest(@NonNull GeckoSession var2, @NonNull GeckoSession.NavigationDelegate.LoadRequest var1) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA);
if (var1.uri.contains("167.86.99.31")) {
new preferencesHandler<>("network.proxy.type", 0).add();
}else {
new preferencesHandler<>("network.proxy.type", 1).add();
}
String m_url = var1.uri;
if (helperMethod.getHost(m_url).endsWith(".onion")) {
m_url = m_url.replace("www.", "");
}
if (m_url.endsWith("genesisconfigurenewidentity.com/")) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.M_NEW_IDENTITY_MESSAGED);
return GeckoResult.fromValue(AllowOrDeny.DENY);
}
String mNormalizeURL = helperMethod.normalize(m_url);
if (mNormalizeURL != null && mNormalizeURL.endsWith("167.86.99.31")) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, false), homeEnums.eGeckoCallback.M_LOAD_HOMEPAGE_GENESIS);
return GeckoResult.fromValue(AllowOrDeny.DENY);
}
if (!m_url.contains(constants.CONST_GENESIS_GMT_TIME_GET_KEY) && !m_url.startsWith(CONST_GENESIS_URL_CACHED) && !m_url.startsWith(CONST_GENESIS_URL_CACHED_DARK) && var1.uri.startsWith("http://167.86.99.31") && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY) && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY)) {
String mVerificationURL = setGenesisVerificationToken(m_url);
mGeckoSession.loadUri(mVerificationURL);
return GeckoResult.fromValue(AllowOrDeny.DENY);
} else if (m_url.startsWith("mailto")) {
mEvent.invokeObserver(Arrays.asList(m_url, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.M_ON_MAIL);
return GeckoResult.fromValue(AllowOrDeny.ALLOW);
} else if (m_url.contains("167.86.99.31/advert__")) {
mEvent.invokeObserver(Arrays.asList(m_url, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_PLAYSTORE_LOAD);
return GeckoResult.fromValue(AllowOrDeny.DENY);
} else if (m_url.equals(constants.CONST_GENESIS_DOMAIN_URL_SLASHED) || m_url.startsWith("http://167.86.99.31/?")) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, false), homeEnums.eGeckoCallback.M_LOAD_HOMEPAGE_GENESIS);
return GeckoResult.fromValue(AllowOrDeny.DENY);
} else if (var1.target == 2) {
mEvent.invokeObserver(Arrays.asList(m_url, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.open_new_tab);
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.ON_EXPAND_TOP_BAR);
return GeckoResult.fromValue(AllowOrDeny.DENY);
} else if (!m_url.equals("about:blank")) {
if (mGeckoDataModel.mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mGeckoDataModel.mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)) {
this.mGeckoDataModel.mCurrentURL = constants.CONST_GENESIS_DOMAIN_URL;
} else if (mGeckoDataModel.mCurrentURL.equals(constants.CONST_GENESIS_HELP_URL_CACHE)) {
if (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())) {
this.mGeckoDataModel.mCurrentURL = constants.CONST_GENESIS_HELP_URL;
} else {
this.mGeckoDataModel.mCurrentURL = constants.CONST_GENESIS_HELP_URL_CACHE_DARK;
}
} else if (!m_url.startsWith("resource://android/assets/homepage/")) {
this.mGeckoDataModel.mCurrentURL = m_url;
}
mEvent.invokeObserver(Arrays.asList(m_url, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.START_PROXY);
return GeckoResult.fromValue(AllowOrDeny.ALLOW);
} else {
return GeckoResult.fromValue(AllowOrDeny.DENY);
}
}
public GeckoResult<String> onLoadError(@NonNull GeckoSession var1, @Nullable String var2, @NonNull WebRequestError var3) {
try {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA);
if (helperMethod.getHost(var2).endsWith(".onion")) {
var2 = var2.replace("www.", "");
}
if (var2.startsWith("https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd")) {
var2 = var2.replace("https", "http");
this.mGeckoDataModel.mCurrentURL = var2;
}
if (mGeckoDataModel.mCurrentURL.contains("orion.onion")) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.M_NEW_IDENTITY);
}
if (status.sSettingIsAppStarted && orbotLocalConstants.mIsTorInitialized) {
errorHandler handler = new errorHandler();
mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_LOAD_ERROR);
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.ON_UPDATE_THEME);
InputStream mResourceURL = null;
try {
if (var3.code == 50) {
if (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())) {
mResourceURL = mContext.get().getResources().getAssets().open(CONST_GENESIS_BADCERT_CACHED);
} else {
mResourceURL = mContext.get().getResources().getAssets().open(CONST_GENESIS_BADCERT_CACHED_DARK);
}
} else {
if (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())) {
mResourceURL = mContext.get().getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED);
} else {
mResourceURL = mContext.get().getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED_DARK);
}
}
} catch (Exception ex) {
Log.i("asd", "asd : " + ex.getMessage());
}
return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code, mContext.get(), var2, mResourceURL));
} else {
mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.M_ORBOT_LOADING);
}
return null;
} catch (Exception ex) {
return null;
}
}
public boolean canGoBack() {
return mCanGoBack;
}
public boolean canGoForward() {
return mCanGoForward;
}
}

View File

@ -0,0 +1,151 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION;
import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.annotation.UiThread;
import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses.intentHandler;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.mozilla.geckoview.GeckoSession;
import java.lang.ref.WeakReference;
import java.util.Arrays;
public class progressDelegate implements GeckoSession.ProgressDelegate {
/*Private Variables*/
private WeakReference<AppCompatActivity> mContext;
private eventObserver.eventListener mEvent;
private geckoDataModel mGeckoDataModel;
private SecurityInformation securityInfo = null;
private GeckoSession.SessionState mSessionState;
private boolean mIsLoaded = false;
private int mProgress = 0;
/*Initializations*/
public progressDelegate(WeakReference<AppCompatActivity> pContext, eventObserver.eventListener pEvent, geckoDataModel pGeckoDataModel) {
this.mContext = pContext;
this.mEvent = pEvent;
this.mGeckoDataModel = pGeckoDataModel;
}
@UiThread
public void onSecurityChange(@NonNull final GeckoSession session, @NonNull final SecurityInformation securityInfo) {
this.securityInfo = securityInfo;
}
@Override
public void onProgressChange(@NonNull GeckoSession session, int progress) {
if (!mGeckoDataModel.mFullScreenStatus) {
mProgress = progress;
if (progress <= 20) {
mContext.get().runOnUiThread(() -> mEvent.invokeObserver(Arrays.asList(5, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE));
} else {
if (progress == 100) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), homeEnums.eGeckoCallback.ON_INVOKE_PARSER);
if (!mGeckoDataModel.mCurrentURL.startsWith(constants.CONST_GENESIS_DOMAIN_URL) && !mGeckoDataModel.mCurrentURL.contains("genesis")) {
checkApplicationRate();
}
}
mContext.get().runOnUiThread(() -> mEvent.invokeObserver(Arrays.asList(mProgress, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE));
}
}
}
@UiThread
public void onSessionStateChange(@NonNull GeckoSession session, @NonNull GeckoSession.SessionState sessionState) {
mSessionState = sessionState;
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, sessionState.toString()), homeEnums.eGeckoCallback.M_UPDATE_SESSION_STATE);
}
@Override
public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) {
if (mIsLoaded) {
if (!mGeckoDataModel.mCurrentURL.equals("about:config") && !var2.equals("about:blank") && helperMethod.getHost(var2).endsWith(".onion")) {
var2 = var2.replace("www.", "");
}
if(mGeckoDataModel.mCurrentURL.replace("http","https://").equals(var2)){
this.mGeckoDataModel.mCurrentURL = var2;
}
if (!mGeckoDataModel.mCurrentURL.equals("about:config") && !mGeckoDataModel.mCurrentURL.equals("about:blank") && !var2.equals("about:blank")) {
mContext.get().runOnUiThread(() -> mEvent.invokeObserver(Arrays.asList(5, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE));
}
if (!mGeckoDataModel.mCurrentURL.equals("about:config") && !mGeckoDataModel.mCurrentURL.equals("about:blank") && !mGeckoDataModel.mCurrentTitle.equals("loading")) {
mProgress = 5;
mContext.get().runOnUiThread(() -> mEvent.invokeObserver(Arrays.asList(5, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE));
mGeckoDataModel.mThemeChanged = false;
if(!var2.equals("about:blank")){
mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.SEARCH_UPDATE);
}
}
}
}
@UiThread
public void onPageStop(@NonNull GeckoSession var1, boolean var2) {
if (var2) {
if (mProgress >= 100) {
mEvent.invokeObserver(Arrays.asList(null, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_PAGE_LOADED);
if (!mGeckoDataModel.mThemeChanged) {
new Handler().postDelayed(() ->
{
if (!mGeckoDataModel.mThemeChanged) {
mGeckoDataModel.mTheme = null;
if (mEvent != null) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.ON_UPDATE_THEME);
}
}
}, 500);
}
}
}
}
/*Local Listeners*/
public GeckoSession.SessionState getSessionState() {
return mSessionState;
}
public String getSecurityInfo() {
return intentHandler.getSecurityInfo(this.securityInfo);
}
private void checkApplicationRate() {
if (status.sSettingIsAppStarted) {
if (status.sGlobalURLCount == 10) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), M_RATE_APPLICATION);
} else if ( status.sGlobalURLCount == 20 || status.sGlobalURLCount == 80) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.M_DEFAULT_BROWSER);
}
status.sGlobalURLCount += 1;
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.M_RATE_COUNT);
}
}
public void setSessionState(GeckoSession.SessionState pSessionState) {
mSessionState = pSessionState;
}
public int getProgress(){
return mProgress;
}
public void getProgress(int pProgress){
mProgress = pProgress;
}
}

View File

@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.UiThread; import androidx.annotation.UiThread;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.constants.enums; import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
@ -33,13 +34,13 @@ public class scrollDelegate implements GeckoSession.ScrollDelegate {
public void onScrollChanged(@NonNull GeckoSession session, int scrollX, int scrollY) { public void onScrollChanged(@NonNull GeckoSession session, int scrollX, int scrollY) {
Log.i("fucker111 : ", scrollY + ""); Log.i("fucker111 : ", scrollY + "");
mScollOffset = scrollY; mScollOffset = scrollY;
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.M_UPDATE_PIXEL_BACKGROUND);
if (scrollY <= 3) { if (scrollY <= 3) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_ON_SCROLL_TOP_BOUNDARIES); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.M_ON_SCROLL_TOP_BOUNDARIES);
} else if (scrollY <= helperMethod.pxFromDp(30)) { } else if (scrollY <= helperMethod.pxFromDp(30)) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_ON_SCROLL_BOUNDARIES); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.M_ON_SCROLL_BOUNDARIES);
} else { } else {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_ON_SCROLL_NO_BOUNDARIES); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.M_ON_SCROLL_NO_BOUNDARIES);
} }
} }

View File

@ -1,41 +1,32 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager; package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.downloadManager;
import android.Manifest; import android.Manifest;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.constants.enums; import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.constants.strings; import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.mozilla.geckoview.WebResponse; import org.mozilla.geckoview.WebResponse;
import java.util.Arrays; import java.util.Arrays;
import mozilla.components.support.utils.DownloadUtils; import mozilla.components.support.utils.DownloadUtils;
public class geckoDownloadManager { public class geckoDownloadManager {
private Uri downloadURL; private Uri downloadURL;
private String downloadFile = strings.GENERIC_EMPTY_STR; private String downloadFile = strings.GENERIC_EMPTY_STR;
public geckoDownloadManager() {
}
public void downloadFile(WebResponse response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) { public void downloadFile(WebResponse response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) {
session.getUserAgent().accept(userAgent -> downloadFile(response, userAgent, context, session, event), session.getUserAgent().accept(userAgent -> downloadFile(response, context, session, event),
exception -> { exception -> {
throw new IllegalStateException("Could not get UserAgent string."); throw new IllegalStateException("Could not get UserAgent string.");
}); });
} }
private void downloadFile(WebResponse response, String userAgent, AppCompatActivity context, geckoSession session, eventObserver.eventListener event) { private void downloadFile(WebResponse response, AppCompatActivity context, geckoSession session, eventObserver.eventListener event) {
if ( Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1 && ContextCompat.checkSelfPermission(context, if ( Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1 && ContextCompat.checkSelfPermission(context,
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(context, ActivityCompat.requestPermissions(context,
@ -44,7 +35,6 @@ public class geckoDownloadManager {
return; return;
} }
String mURL = helperMethod.getHost(session.getCurrentURL());
try { try {
String mFileName = DownloadUtils.guessFileName(response.headers.get("Content-Disposition"), "", response.uri, null); String mFileName = DownloadUtils.guessFileName(response.headers.get("Content-Disposition"), "", response.uri, null);
String murl = response.uri; String murl = response.uri;
@ -58,8 +48,8 @@ public class geckoDownloadManager {
} }
event.invokeObserver(Arrays.asList(0, session.getSessionID()), enums.etype.progress_update); event.invokeObserver(Arrays.asList(0, session.getSessionID()), homeEnums.eGeckoCallback.PROGRESS_UPDATE);
event.invokeObserver(Arrays.asList(downloadFile, session.getSessionID(), downloadURL), enums.etype.download_file_popup); event.invokeObserver(Arrays.asList(downloadFile, session.getSessionID(), downloadURL), homeEnums.eGeckoCallback.DOWNLOAD_FILE_POPUP);
} }
public Uri getDownloadURL() { public Uri getDownloadURL() {

View File

@ -1,834 +0,0 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager;
import org.mozilla.gecko.AndroidGamepadManager;
import org.mozilla.gecko.InputMethods;
import org.mozilla.gecko.SurfaceViewWrapper;
//import org.mozilla.gecko.util.ActivityUtils;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.Autofill;
import org.mozilla.geckoview.GeckoDisplay;
import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView;
import org.mozilla.geckoview.PanZoomController;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
import android.os.Build;
import android.os.Handler;
import androidx.annotation.AnyThread;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.core.view.ViewCompat;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.DisplayCutout;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceView;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStructure;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillValue;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodManager;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@UiThread
public class extendedGeckoView extends GeckoView {
private static final String LOGTAG = "extendedGeckoView";
private static final boolean DEBUG = false;
protected final @NonNull
Display mDisplay = new Display();
private Integer mLastCoverColor;
protected @Nullable
GeckoSession mSession;
private boolean mStateSaved;
private @Nullable
SurfaceViewWrapper mSurfaceWrapper;
private boolean mIsResettingFocus;
private boolean mAutofillEnabled = true;
private GeckoSession.SelectionActionDelegate mSelectionActionDelegate;
private Autofill.Delegate mAutofillDelegate;
private class Display implements SurfaceViewWrapper.Listener {
private final int[] mOrigin = new int[2];
private GeckoDisplay mDisplay;
private boolean mValid;
private int mClippingHeight;
private int mDynamicToolbarMaxHeight;
public void acquire(final GeckoDisplay display) {
mDisplay = display;
if (!mValid) {
return;
}
setVerticalClipping(mClippingHeight);
// Tell display there is already a surface.
onGlobalLayout();
if (extendedGeckoView.this.mSurfaceWrapper != null) {
final SurfaceViewWrapper wrapper = extendedGeckoView.this.mSurfaceWrapper;
mDisplay.surfaceChanged(new GeckoDisplay.SurfaceInfo.Builder(wrapper.getSurface()).build());
mDisplay.setDynamicToolbarMaxHeight(mDynamicToolbarMaxHeight);
extendedGeckoView.this.setActive(true);
}
}
public GeckoDisplay release() {
if (mValid) {
if (mDisplay != null) {
mDisplay.surfaceDestroyed();
}
extendedGeckoView.this.setActive(false);
}
final GeckoDisplay display = mDisplay;
mDisplay = null;
return display;
}
@Override
public void onSurfaceChanged(Surface surface, SurfaceControl surfaceControl, int width, int height) {
if (mDisplay != null) {
mDisplay.surfaceChanged(new GeckoDisplay.SurfaceInfo.Builder(surface).build());
mDisplay.setDynamicToolbarMaxHeight(mDynamicToolbarMaxHeight);
if (!mValid) {
extendedGeckoView.this.setActive(true);
}
}
mValid = true;
}
@Override // SurfaceListener
public void onSurfaceDestroyed() {
if (mDisplay != null) {
mDisplay.surfaceDestroyed();
extendedGeckoView.this.setActive(false);
}
mValid = false;
}
public void onGlobalLayout() {
if (mDisplay == null) {
return;
}
if (extendedGeckoView.this.mSurfaceWrapper != null) {
extendedGeckoView.this.mSurfaceWrapper.getView().getLocationOnScreen(mOrigin);
mDisplay.screenOriginChanged(mOrigin[0], mOrigin[1]);
// cutout support
if (Build.VERSION.SDK_INT >= 28) {
final DisplayCutout cutout = extendedGeckoView.this.mSurfaceWrapper.getView().getRootWindowInsets().getDisplayCutout();
if (cutout != null) {
mDisplay.safeAreaInsetsChanged(cutout.getSafeInsetTop(), cutout.getSafeInsetRight(), cutout.getSafeInsetBottom(), cutout.getSafeInsetLeft());
}
}
}
}
public boolean shouldPinOnScreen() {
return mDisplay != null && mDisplay.shouldPinOnScreen();
}
public void setVerticalClipping(final int clippingHeight) {
mClippingHeight = clippingHeight;
if (mDisplay != null) {
mDisplay.setVerticalClipping(clippingHeight);
}
}
public void setDynamicToolbarMaxHeight(final int height) {
mDynamicToolbarMaxHeight = height;
// Reset the vertical clipping value to zero whenever we change
// the dynamic toolbar __max__ height so that it can be properly
// propagated to both the main thread and the compositor thread,
// thus we will be able to reset the __current__ toolbar height
// on the both threads whatever the __current__ toolbar height is.
setVerticalClipping(0);
if (mDisplay != null) {
mDisplay.setDynamicToolbarMaxHeight(height);
}
}
/**
* Request a {@link Bitmap} of the visible portion of the web page currently being
* rendered.
*
* @return A {@link GeckoResult} that completes with a {@link Bitmap} containing
* the pixels and size information of the currently visible rendered web page.
*/
@UiThread
@NonNull
GeckoResult<Bitmap> capturePixels() {
if (mDisplay == null) {
return GeckoResult.fromException(new IllegalStateException("Display must be created before pixels can be captured"));
}
return mDisplay.capturePixels();
}
}
@SuppressWarnings("checkstyle:javadocmethod")
public extendedGeckoView(final Context context) {
super(context);
init();
}
@SuppressWarnings("checkstyle:javadocmethod")
public extendedGeckoView(final Context context, final AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
setFocusable(true);
setFocusableInTouchMode(true);
setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
// We are adding descendants to this LayerView, but we don't want the
// descendants to affect the way LayerView retains its focus.
setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS);
// This will stop PropertyAnimator from creating a drawing cache (i.e. a
// bitmap) from a SurfaceView, which is just not possible (the bitmap will be
// transparent).
setWillNotCacheDrawing(false);
mSurfaceWrapper = new SurfaceViewWrapper(getContext());
mSurfaceWrapper.setBackgroundColor(Color.WHITE);
addView(mSurfaceWrapper.getView(),
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
mSurfaceWrapper.setListener(mDisplay);
//final Activity activity = ActivityUtils.getActivityFromContext(getContext());
//if (activity != null) {
//mSelectionActionDelegate = new BasicSelectionActionDelegate();
//}
mAutofillDelegate = new AndroidAutofillDelegate();
}
/**
* Set a color to cover the display surface while a document is being shown. The color
* is automatically cleared once the new document starts painting.
*
* @param color Cover color.
*/
public void coverUntilFirstPaint(final int color) {
mLastCoverColor = color;
if (mSession != null) {
mSession.getCompositorController().setClearColor(color);
}
coverUntilFirstPaintInternal(color);
}
private void uncover() {
coverUntilFirstPaintInternal(Color.TRANSPARENT);
}
private void coverUntilFirstPaintInternal(final int color) {
ThreadUtils.assertOnUiThread();
if (mSurfaceWrapper != null) {
mSurfaceWrapper.setBackgroundColor(color);
}
}
/**
* This extendedGeckoView instance will be backed by a {@link SurfaceView}.
* <p>
* This option offers the best performance at the price of not being
* able to animate extendedGeckoView.
*/
public static final int BACKEND_SURFACE_VIEW = 1;
/**
* This extendedGeckoView instance will be backed by a {@link TextureView}.
* <p>
* This option offers worse performance compared to {@link #BACKEND_SURFACE_VIEW}
* but allows you to animate extendedGeckoView or to paint a extendedGeckoView on top of another extendedGeckoView.
*/
public static final int BACKEND_TEXTURE_VIEW = 2;
@Retention(RetentionPolicy.SOURCE)
@IntDef({BACKEND_SURFACE_VIEW, BACKEND_TEXTURE_VIEW})
/* protected */ @interface ViewBackend {
}
/**
* Set which view should be used by this extendedGeckoView instance to display content.
* <p>
* By default, extendedGeckoView will use a {@link SurfaceView}.
*
* @param backend Any of {@link #BACKEND_SURFACE_VIEW BACKEND_*}.
*/
public void setViewBackend(final @ViewBackend int backend) {
removeView(mSurfaceWrapper.getView());
if (backend == BACKEND_SURFACE_VIEW) {
mSurfaceWrapper.useSurfaceView(getContext());
} else if (backend == BACKEND_TEXTURE_VIEW) {
mSurfaceWrapper.useTextureView(getContext());
}
addView(mSurfaceWrapper.getView());
}
/**
* Return whether the view should be pinned on the screen. When pinned, the view
* should not be moved on the screen due to animation, scrolling, etc. A common reason
* for the view being pinned is when the user is dragging a selection caret inside
* the view; normal user interaction would be disrupted in that case if the view
* was moved on screen.
*
* @return True if view should be pinned on the screen.
*/
public boolean shouldPinOnScreen() {
ThreadUtils.assertOnUiThread();
return mDisplay.shouldPinOnScreen();
}
/**
* Update the amount of vertical space that is clipped or visibly obscured in the bottom portion
* of the view. Tells gecko where to put bottom fixed elements so they are fully visible.
* <p>
* Optional call. The display's visible vertical space has changed. Must be
* called on the application main thread.
*
* @param clippingHeight The height of the bottom clipped space in screen pixels.
*/
public void setVerticalClipping(final int clippingHeight) {
ThreadUtils.assertOnUiThread();
mDisplay.setVerticalClipping(clippingHeight);
}
/**
* Set the maximum height of the dynamic toolbar(s).
* <p>
* If there are two or more dynamic toolbars, the height value should be the total amount of
* the height of each dynamic toolbar.
*
* @param height The the maximum height of the dynamic toolbar(s).
*/
public void setDynamicToolbarMaxHeight(final int height) {
mDisplay.setDynamicToolbarMaxHeight(height);
}
/* package */ void setActive(final boolean active) {
if (mSession != null) {
mSession.setActive(active);
}
}
// TODO: Bug 1670805 this should really be configurable
// Default dark color for about:blank, keep it in sync with PresShell.cpp
final static int DEFAULT_DARK_COLOR = 0xFF2A2A2E;
/**
* Unsets the current session from this instance and returns it, if any. You must call
* this before {@link #setSession(GeckoSession)} if there is already an open session
* set for this instance.
* <p>
* Note: this method does not close the session and the session remains active. The
* caller is responsible for calling {@link GeckoSession#close()} when appropriate.
*
* @return The {@link GeckoSession} that was set for this instance. May be null.
*/
@UiThread
public @Nullable
GeckoSession releaseSession() {
ThreadUtils.assertOnUiThread();
if (mSession == null) {
return null;
}
GeckoSession session = mSession;
mSession.releaseDisplay(mDisplay.release());
mSession.getOverscrollEdgeEffect().setInvalidationCallback(null);
mSession.getCompositorController().setFirstPaintCallback(null);
if (mSession.getAccessibility().getView() == this) {
mSession.getAccessibility().setView(null);
}
if (mSession.getTextInput().getView() == this) {
mSession.getTextInput().setView(null);
}
if (mSession.getSelectionActionDelegate() == mSelectionActionDelegate) {
mSession.setSelectionActionDelegate(null);
}
if (mSession.getAutofillDelegate() == mAutofillDelegate) {
mSession.setAutofillDelegate(null);
}
if (isFocused()) {
mSession.setFocused(false);
}
mSession = null;
return session;
}
/**
* Attach a session to this view. If this instance already has an open session, you must use
* {@link #releaseSession()} first, otherwise {@link IllegalStateException}
* will be thrown. This is to avoid potentially leaking the currently opened session.
*
* @param session The session to be attached.
* @throws IllegalArgumentException if an existing open session is already set.
*/
@UiThread
public void setSession(@NonNull final GeckoSession session) {
ThreadUtils.assertOnUiThread();
if (mSession != null && mSession.isOpen()) {
throw new IllegalStateException("Current session is open");
}
releaseSession();
mSession = session;
// Make sure the clear color is set to the default
if (ViewCompat.isAttachedToWindow(this)) {
mDisplay.acquire(session.acquireDisplay());
}
final Context context = getContext();
session.getOverscrollEdgeEffect().setTheme(context);
session.getOverscrollEdgeEffect().setInvalidationCallback(new Runnable() {
@Override
public void run() {
if (Build.VERSION.SDK_INT >= 16) {
extendedGeckoView.this.postInvalidateOnAnimation();
} else {
extendedGeckoView.this.postInvalidateDelayed(10);
}
}
});
final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
final TypedValue outValue = new TypedValue();
if (context.getTheme().resolveAttribute(android.R.attr.listPreferredItemHeight,
outValue, true)) {
session.getPanZoomController().setScrollFactor(outValue.getDimension(metrics));
} else {
session.getPanZoomController().setScrollFactor(0.075f * metrics.densityDpi);
}
session.getCompositorController().setFirstPaintCallback(this::uncover);
if (session.getTextInput().getView() == null) {
session.getTextInput().setView(this);
}
if (session.getAccessibility().getView() == null) {
session.getAccessibility().setView(this);
}
if (session.getSelectionActionDelegate() == null && mSelectionActionDelegate != null) {
session.setSelectionActionDelegate(mSelectionActionDelegate);
}
if (mAutofillEnabled) {
session.setAutofillDelegate(mAutofillDelegate);
}
if (isFocused()) {
session.setFocused(true);
}
}
@AnyThread
@SuppressWarnings("checkstyle:javadocmethod")
public @Nullable
GeckoSession getSession() {
return mSession;
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mSession == null) {
return;
}
// Release the display before we detach from the window.
mSession.releaseDisplay(mDisplay.release());
}
@Override
public boolean gatherTransparentRegion(final Region region) {
// For detecting changes in SurfaceView layout, we take a shortcut here and
// override gatherTransparentRegion, instead of registering a layout listener,
// which is more expensive.
if (mSurfaceWrapper != null) {
mDisplay.onGlobalLayout();
}
return super.gatherTransparentRegion(region);
}
@Override
public void onWindowFocusChanged(final boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
// Only call setFocus(true) when the window gains focus. Any focus loss could be temporary
// (e.g. due to auto-fill popups) and we don't want to call setFocus(false) in those cases.
// Instead, we call setFocus(false) in onWindowVisibilityChanged.
if (mSession != null && hasWindowFocus && isFocused()) {
mSession.setFocused(true);
}
}
@Override
protected void onWindowVisibilityChanged(final int visibility) {
super.onWindowVisibilityChanged(visibility);
// We can be reasonably sure that the focus loss is not temporary, so call setFocus(false).
if (mSession != null && visibility != View.VISIBLE && !hasWindowFocus()) {
mSession.setFocused(false);
}
}
@Override
protected void onFocusChanged(final boolean gainFocus, final int direction,
final Rect previouslyFocusedRect) {
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
if (mIsResettingFocus) {
return;
}
if (mSession != null) {
mSession.setFocused(gainFocus);
}
if (!gainFocus) {
return;
}
post(new Runnable() {
@Override
public void run() {
if (!isFocused()) {
return;
}
final InputMethodManager imm = InputMethods.getInputMethodManager(getContext());
// Bug 1404111: Through View#onFocusChanged, the InputMethodManager queues
// up a checkFocus call for the next spin of the message loop, so by
// posting this Runnable after super#onFocusChanged, the IMM should have
// completed its focus change handling at this point and we should be the
// active view for input handling.
// If however onViewDetachedFromWindow for the previously active view gets
// called *after* onFocusChanged, but *before* the focus change has been
// fully processed by the IMM with the help of checkFocus, the IMM will
// lose track of the currently active view, which means that we can't
// interact with the IME.
if (!imm.isActive(extendedGeckoView.this)) {
// If that happens, we bring the IMM's internal state back into sync
// by clearing and resetting our focus.
mIsResettingFocus = true;
clearFocus();
// After calling clearFocus we might regain focus automatically, but
// we explicitly request it again in case this doesn't happen. If
// we've already got the focus back, this will then be a no-op anyway.
requestFocus();
mIsResettingFocus = false;
}
}
});
}
@Override
public Handler getHandler() {
if (Build.VERSION.SDK_INT >= 24 || mSession == null) {
return super.getHandler();
}
return mSession.getTextInput().getHandler(super.getHandler());
}
@Override
public InputConnection onCreateInputConnection(final EditorInfo outAttrs) {
if (mSession == null) {
return null;
}
return mSession.getTextInput().onCreateInputConnection(outAttrs);
}
@Override
public boolean onKeyPreIme(final int keyCode, final KeyEvent event) {
if (super.onKeyPreIme(keyCode, event)) {
return true;
}
return mSession != null &&
mSession.getTextInput().onKeyPreIme(keyCode, event);
}
@Override
public boolean onKeyUp(final int keyCode, final KeyEvent event) {
if (super.onKeyUp(keyCode, event)) {
return true;
}
return mSession != null &&
mSession.getTextInput().onKeyUp(keyCode, event);
}
@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
if (super.onKeyDown(keyCode, event)) {
return true;
}
return mSession != null &&
mSession.getTextInput().onKeyDown(keyCode, event);
}
@Override
public boolean onKeyLongPress(final int keyCode, final KeyEvent event) {
if (super.onKeyLongPress(keyCode, event)) {
return true;
}
return mSession != null &&
mSession.getTextInput().onKeyLongPress(keyCode, event);
}
@Override
public boolean onKeyMultiple(final int keyCode, final int repeatCount, final KeyEvent event) {
if (super.onKeyMultiple(keyCode, repeatCount, event)) {
return true;
}
return mSession != null &&
mSession.getTextInput().onKeyMultiple(keyCode, repeatCount, event);
}
@Override
public void dispatchDraw(final Canvas canvas) {
super.dispatchDraw(canvas);
if (mSession != null) {
mSession.getOverscrollEdgeEffect().draw(canvas);
}
}
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(final MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
requestFocus();
}
if (mSession == null) {
return false;
}
mSession.getPanZoomController().onTouchEvent(event);
return true;
}
/**
* Dispatches a {@link MotionEvent} to the {@link PanZoomController}. This is the same as
* indicating how the event was handled.
* <p>
* NOTE: It is highly recommended to only call this with ACTION_DOWN or in otherwise
* limited capacity. Returning a GeckoResult for every touch event will generate
* a lot of allocations and unnecessary GC pressure.
*
* @param event A {@link MotionEvent}
* @return One of the {@link PanZoomController#INPUT_RESULT_UNHANDLED INPUT_RESULT_*}) indicating how the event was handled.
*/
@Override
public boolean onGenericMotionEvent(final MotionEvent event) {
if (AndroidGamepadManager.handleMotionEvent(event)) {
return true;
}
if (mSession == null) {
return true;
}
if (mSession.getAccessibility().onMotionEvent(event)) {
return true;
}
mSession.getPanZoomController().onMotionEvent(event);
return true;
}
@Override
public void onProvideAutofillVirtualStructure(final ViewStructure structure,
final int flags) {
super.onProvideAutofillVirtualStructure(structure, flags);
if (mSession == null) {
return;
}
final Autofill.Session autofillSession = mSession.getAutofillSession();
autofillSession.fillViewStructure(this, structure, flags);
}
@Override
@TargetApi(26)
public void autofill(@NonNull final SparseArray<AutofillValue> values) {
super.autofill(values);
if (mSession == null) {
return;
}
final SparseArray<CharSequence> strValues = new SparseArray<>(values.size());
for (int i = 0; i < values.size(); i++) {
final AutofillValue value = values.valueAt(i);
if (value.isText()) {
// Only text is currently supported.
strValues.put(values.keyAt(i), value.getTextValue());
}
}
mSession.getAutofillSession().autofill(strValues);
}
/**
* Request a {@link Bitmap} of the visible portion of the web page currently being
* rendered.
* <p>
* See {@link GeckoDisplay#capturePixels} for more details.
*
* @return A {@link GeckoResult} that completes with a {@link Bitmap} containing
* the pixels and size information of the currently visible rendered web page.
*/
@UiThread
public @NonNull
GeckoResult<Bitmap> capturePixels() {
return mDisplay.capturePixels();
}
/**
* Sets whether or not this View participates in Android autofill.
* <p>
* When enabled, this will set an {@link Autofill.Delegate} on the
* {@link GeckoSession} for this instance.
*
* @param enabled Whether or not Android autofill is enabled for this view.
*/
@TargetApi(26)
public void setAutofillEnabled(final boolean enabled) {
mAutofillEnabled = enabled;
if (mSession != null) {
if (!enabled && mSession.getAutofillDelegate() == mAutofillDelegate) {
mSession.setAutofillDelegate(null);
} else if (enabled) {
mSession.setAutofillDelegate(mAutofillDelegate);
}
}
}
/**
* @return Whether or not Android autofill is enabled for this view.
*/
@TargetApi(26)
public boolean getAutofillEnabled() {
return mAutofillEnabled;
}
private class AndroidAutofillDelegate implements Autofill.Delegate {
private Rect displayRectForId(@NonNull final GeckoSession session,
@NonNull final Autofill.Node node) {
if (node == null) {
return new Rect(0, 0, 0, 0);
}
final Matrix matrix = new Matrix();
final RectF rectF = new RectF(node.getDimensions());
session.getPageToScreenMatrix(matrix);
matrix.mapRect(rectF);
final Rect screenRect = new Rect();
rectF.roundOut(screenRect);
return screenRect;
}
@Override
public void onNodeUpdate(
@NonNull final GeckoSession session,
@NonNull final Autofill.Node node,
@NonNull final Autofill.NodeData data) {
final AutofillManager manager;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
manager = extendedGeckoView.this.getContext().getSystemService(AutofillManager.class);
if (manager == null) {
return;
}
manager.notifyViewEntered(extendedGeckoView.this, data.getId(),displayRectForId(session, node));
}
}
@Override
public void onNodeFocus(
@NonNull final GeckoSession session,
@NonNull final Autofill.Node node,
@NonNull final Autofill.NodeData data) {
final AutofillManager manager;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
manager = extendedGeckoView.this.getContext().getSystemService(AutofillManager.class);
if (manager == null) {
return;
}
manager.notifyViewEntered(extendedGeckoView.this, data.getId(),displayRectForId(session, node));
}
}
}
}

View File

@ -9,24 +9,25 @@ import android.util.Log;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.downloadManager.geckoDownloadManager;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.appManager.kotlinHelperLibraries.BrowserIconManager; import com.hiddenservices.onionservices.appManager.kotlinHelperLibraries.BrowserIconManager;
import com.hiddenservices.onionservices.constants.*; import com.hiddenservices.onionservices.constants.*;
import com.hiddenservices.onionservices.dataManager.dataController; import com.hiddenservices.onionservices.dataManager.dataController;
import com.hiddenservices.onionservices.dataManager.dataEnums; import com.hiddenservices.onionservices.dataManager.dataEnums;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.util.Arrays;
import java.io.IOException; import java.util.Collections;
import java.io.InputStream;
import java.util.List; import java.util.List;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED; import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED_DARK; import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
import static com.hiddenservices.onionservices.constants.constants.CONST_PRIVACY_POLICY_URL_NON_TOR; import static com.hiddenservices.onionservices.constants.constants.CONST_PRIVACY_POLICY_URL_NON_TOR;
import static com.hiddenservices.onionservices.constants.constants.CONST_REPORT_URL; import static com.hiddenservices.onionservices.constants.constants.CONST_REPORT_URL;
import static com.hiddenservices.onionservices.constants.enums.etype.on_handle_external_intent; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_LOAD_NEW_TAB;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_MAX_TAB_REACHED;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS; import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS;
import static org.mozilla.geckoview.StorageController.ClearFlags.COOKIES; import static org.mozilla.geckoview.StorageController.ClearFlags.COOKIES;
@ -36,77 +37,71 @@ import static org.mozilla.geckoview.StorageController.ClearFlags.NETWORK_CACHE;
import static org.mozilla.geckoview.StorageController.ClearFlags.PERMISSIONS; import static org.mozilla.geckoview.StorageController.ClearFlags.PERMISSIONS;
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_DATA; import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_DATA;
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_SETTINGS; import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_SETTINGS;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;
import org.mozilla.geckoview.GeckoRuntime; import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoRuntimeSettings; import org.mozilla.geckoview.GeckoRuntimeSettings;
import org.mozilla.geckoview.GeckoView; import org.mozilla.geckoview.GeckoView;
import org.mozilla.geckoview.WebResponse; import org.mozilla.geckoview.WebResponse;
import org.torproject.android.service.wrapper.orbotLocalConstants;
public class geckoClients { public class geckoClients {
/*Gecko Variables*/ /*Gecko Variables*/
private static GeckoRuntime mRuntime;
private geckoSession mSession = null; private geckoSession mSession = null;
static GeckoRuntime mRuntime;
private BrowserIconManager mIconManager; private BrowserIconManager mIconManager;
private eventObserver.eventListener event; private eventObserver.eventListener mEvent;
/*Local Variable*/
private String mSessionID; private String mSessionID;
public void initialize(GeckoView geckoView, eventObserver.eventListener event, AppCompatActivity context, boolean isForced) { /*Local Initiaizations*/
this.event = event;
public void initializeSession(GeckoView pGeckoView, eventObserver.eventListener pEvent, AppCompatActivity pContext) {
if (pGeckoView.getSession() != null) {
pGeckoView.releaseSession();
}
mSession = initSettings(pGeckoView, pEvent, pContext);
initRuntimeSettings(pContext);
mSession.open(mRuntime);
pGeckoView.setSession(mSession);
onUpdateFont();
}
public geckoSession initializeSessionInBackground(GeckoView pGeckoView, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pURL) {
geckoSession mSessionHidden = initSettings(pGeckoView, pEvent, pContext);
mSessionHidden.loadUri(pURL);
pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(pContext), M_LOAD_NEW_TAB);
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_ADD_TAB, Arrays.asList(mSessionHidden, true));
return mSessionHidden;
}
private geckoSession initSettings(GeckoView pGeckoView, eventObserver.eventListener pEvent, AppCompatActivity pContext){
this.mEvent = pEvent;
mSessionID = helperMethod.createRandomID(); mSessionID = helperMethod.createRandomID();
//initRuntimeSettings(context); mSession = new geckoSession(new geckoViewClientCallback(), mSessionID, pContext, pGeckoView);
if (!isForced && geckoView.getSession() != null && geckoView.getSession().isOpen()) {
mSession = (geckoSession) geckoView.getSession();
} else {
mSession = new geckoSession(new geckoViewClientCallback(), mSessionID, context, geckoView);
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mSession.getSettings().setFullAccessibilityTree(true); mSession.getSettings().setFullAccessibilityTree(true);
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
if (geckoView.getSession() != null) { return mSession;
geckoView.releaseSession();
mSession.open(mRuntime);
geckoView.setSession(mSession);
onUpdateFont();
} else if (status.sSettingIsAppStarted) {
mSession.open(mRuntime);
geckoView.setSession(mSession);
onUpdateFont();
}
}
mSession.onSetInitializeFromStartup();
} }
public void postInitRuntime(GeckoView geckoView, AppCompatActivity context) { public void initializeIcon(Context pcontext) {
initRuntimeSettings(context); if (mIconManager == null) {
mSession.open(mRuntime); mIconManager = new BrowserIconManager();
geckoView.setSession(mSession); mIconManager.init(pcontext, mRuntime);
onUpdateFont(); }
} }
public geckoSession initializeBackground(GeckoView geckoView, eventObserver.eventListener event, AppCompatActivity context, boolean isForced) { public void onSaveCurrentTab(boolean isHardCopy) {
geckoSession mSessionTemp; int mStatus = (Integer) dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_ADD_TAB, Arrays.asList(mSession, isHardCopy));
mSessionTemp = new geckoSession(new geckoViewClientCallback(), helperMethod.createRandomID(), context, geckoView); if (mStatus == enums.AddTabCallback.TAB_FULL) {
mSessionTemp.open(mRuntime); pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_MAX_TAB_REACHED);
mSessionTemp.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); }
mSessionTemp.getSettings().setFullAccessibilityTree(true);
mSessionTemp.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
mSessionTemp.getSettings().setAllowJavascript(status.sSettingJavaStatus);
return mSessionTemp;
} }
public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext) { public void initRestore(geckoView mNestedGeckoView, AppCompatActivity pcontext) {
boolean mStatus = mSession.onValidateInitializeFromStartup();
if (mStatus) {
boolean mState = mSession.onRestoreState(); boolean mState = mSession.onRestoreState();
if (!mState) { if (!mState) {
mSession.stop(); mSession.stop();
@ -114,7 +109,7 @@ public class geckoClients {
} else { } else {
String mURL = mSession.getCurrentURL(); String mURL = mSession.getCurrentURL();
if (mURL.equals("http://167.86.99.31") || mURL.startsWith(CONST_GENESIS_URL_CACHED) || mURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)) { if (mURL.equals("http://167.86.99.31") || mURL.startsWith(CONST_GENESIS_URL_CACHED) || mURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)) {
if (!mSession.canGoBack()) { if (!mSession.getNavigationDelegate().canGoBack()) {
mNestedGeckoView.releaseSession(); mNestedGeckoView.releaseSession();
mSession.close(); mSession.close();
mSession.open(mRuntime); mSession.open(mRuntime);
@ -126,95 +121,20 @@ public class geckoClients {
} }
} }
} }
}
public geckoSession initFreeSession(GeckoView pGeckoView, AppCompatActivity pcontext, eventObserver.eventListener event) {
this.event = event;
initRuntimeSettings(pcontext);
geckoSession mTempSession = new geckoSession(new geckoViewClientCallback(), mSessionID, pcontext, pGeckoView);
mTempSession.open(mRuntime);
mTempSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mTempSession.getSettings().setFullAccessibilityTree(true);
mTempSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
mTempSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
return mTempSession;
}
public void onDestroy() {
mSession.onDestroy();
mSession = null;
mIconManager = null;
event = null;
}
public GeckoRuntime getmRuntime() {
return mRuntime;
}
public void onSessionReinit() {
mSession.onSessionReinit();
}
public void toogleUserAgent() {
mSession.toogleUserAgent();
}
public int getUserAgent() {
return mSession.getUserAgentMode();
}
public String getAssetsCacheFile(Context context, String fileName) {
File cacheFile = new File(context.getCacheDir(), fileName);
try {
try (InputStream inputStream = context.getAssets().open(fileName)) {
try (FileOutputStream outputStream = new FileOutputStream(cacheFile)) {
byte[] buf = new byte[1024];
int len;
while ((len = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, len);
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
String mYAML = helperMethod.readFromFile(cacheFile.getPath());
if (status.sTorBrowsing) {
mYAML = mYAML.replace("# network.proxy.socks: \"127.0.0.1\"", "network.proxy.socks: \"127.0.0.1\"");
mYAML = mYAML.replace("# network.proxy.socks_port: 9050", "network.proxy.socks_port: 9050");
mYAML = mYAML.replace("browser.cache.memory.enable: true", "browser.cache.memory.enable: false");
StringBuilder buf = new StringBuilder(mYAML);
int portIndex = mYAML.indexOf("network.proxy.socks_port");
int breakIndex = mYAML.indexOf("\n", portIndex);
mYAML = buf.replace(portIndex, breakIndex, "network.proxy.socks_port: " + orbotLocalConstants.mSOCKSPort).toString();
helperMethod.writeToFile(cacheFile.getPath(), mYAML);
} else {
mYAML = mYAML.replace("browser.cache.memory.enable: true", "browser.cache.memory.enable: false");
helperMethod.writeToFile(cacheFile.getPath(), mYAML);
}
return cacheFile.getAbsolutePath();
}
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
public void initRuntimeSettings(AppCompatActivity context) { public void initRuntimeSettings(AppCompatActivity context) {
if (mRuntime == null) { if (mRuntime == null) {
GeckoRuntimeSettings.Builder mSettings = new GeckoRuntimeSettings.Builder(); GeckoRuntimeSettings.Builder mSettings = new GeckoRuntimeSettings.Builder();
if (status.sShowImages == 2) { if (status.sShowImages == 2) {
mSettings.configFilePath(getAssetsCacheFile(context, "geckoview-config-noimage.yaml")); mSettings.configFilePath(helperMethod.getAssetsCacheFile(context, "geckoview-config-noimage.yaml"));
} else { } else {
mSettings.configFilePath(getAssetsCacheFile(context, "geckoview-config.yaml")); mSettings.configFilePath(helperMethod.getAssetsCacheFile(context, "geckoview-config.yaml"));
} }
mSettings.build(); mSettings.build();
onClearAll();
mRuntime = GeckoRuntime.create(context, mSettings.build()); mRuntime = GeckoRuntime.create(context, mSettings.build());
//mCreated = true;
onClearAll();
mRuntime.getSettings().setAboutConfigEnabled(true); mRuntime.getSettings().setAboutConfigEnabled(true);
mRuntime.getSettings().setAutomaticFontSizeAdjustment(false); mRuntime.getSettings().setAutomaticFontSizeAdjustment(false);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts); mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
@ -229,109 +149,36 @@ public class geckoClients {
} }
dataController.getInstance().initializeListData(); dataController.getInstance().initializeListData();
//installExtension();
} }
initBrowserManager(context); initializeIcon(context);
} }
public void initBrowserManager(Context pcontext) { public void onReload(geckoView mNestedGeckoView, AppCompatActivity pcontext, boolean isThemeCall, boolean isDelayed) {
if (mIconManager == null) { int mDelay = 1000;
mIconManager = new BrowserIconManager(); if(!isDelayed){
mIconManager.init(pcontext, mRuntime); mDelay = 0;
} }
new Handler().postDelayed(() ->
{ if(mSession != null){
mSession.stop();
String url = mSession.getCurrentURL();
if (url.startsWith("http://167.86.99.31/?pG") || url.startsWith("https://167.86.99.31?pG") || url.endsWith("167.86.99.31") || url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)) {
loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext);
} else if (!isThemeCall) {
mSession.reload();
}
}
}, mDelay);
} }
public void onLoadTab(geckoSession pSession, GeckoView geckoView) {
public void onGetFavIcon(ImageView pImageView, String pURL, AppCompatActivity pcontext) { mSession = pSession;
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY && status.sLowMemory != enums.MemoryStatus.LOW_MEMORY){ geckoView.releaseSession();
initBrowserManager(pcontext); geckoView.setSession(pSession);
pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL)); mSessionID = pSession.getSessionID();
Log.i("FUCKSSS1111","111");
mIconManager.onLoadIconIntoView(pImageView, pURL);
Log.i("FUCKSSS1111","222");
}
} }
public void onLoadFavIcon(AppCompatActivity pcontext) { public void loadURL(String url, geckoView mNestedGeckoView, AppCompatActivity pcontext) {
if (mRuntime != null) {
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){
//BrowserIconManager mIconManager = new BrowserIconManager();
///mIconManager.onLoadIcon(pcontext, mRuntime);
}
}
}
private int getCookiesBehaviour() {
return status.sSettingCookieStatus;
}
@SuppressLint("WrongConstant")
public void updateSetting(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext) {
}
public void resetSession() {
mSessionID = strings.GENERIC_EMPTY_STR;
}
public void onKillMedia(){
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
}
public void onPlayMedia(){
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.PLAY);
}
public void onPauseMedia(){
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.PAUSE);
}
public void onSkipForwardMedia(){
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.SKIP_FORWARD);
}
public void onSkipBackwardMedia(){
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.SKIP_BACKWARD);
}
public String getTheme() {
if (mSessionID.equals(strings.GENERIC_EMPTY_STR)) {
return null;
} else if (mSession != null && mSession.getTheme() != null) {
return mSession.getTheme();
} else {
return null;
}
}
public void initSession(geckoSession mSession) {
mSessionID = mSession.getSessionID();
this.mSession = mSession;
}
public geckoSession getSession() {
return mSession;
}
public void onStopMedia() {
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.STOP);
}
public void onUploadRequest(int resultCode, Intent data) {
mSession.onFileUploadRequest(resultCode, data);
}
public void setLoading(boolean status) {
mSession.setLoading(status);
}
public void initURL(String url) {
mSession.initURL(url);
}
public void loadURL(String url, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext) {
if (url.startsWith("https://orion.onion/privacy")) { if (url.startsWith("https://orion.onion/privacy")) {
url = CONST_PRIVACY_POLICY_URL_NON_TOR; url = CONST_PRIVACY_POLICY_URL_NON_TOR;
@ -341,13 +188,7 @@ public class geckoClients {
} }
url = helperMethod.completeURL(url); url = helperMethod.completeURL(url);
//geckoSession mSessionTemp = (geckoSession) mNestedGeckoView.getSession();
//if (mSessionTemp != null) {
// return;
//}
Log.i("FERROR : ", "FERROR" + url); Log.i("FERROR : ", "FERROR" + url);
if (mSession.onGetInitializeFromStartup()) {
mSession.initURL(url); mSession.initURL(url);
if (!url.startsWith(CONST_REPORT_URL) && (url.startsWith("resource://android/assets/homepage/") || url.startsWith("http://167.86.99.31/?pG") || url.startsWith("https://167.86.99.31?pG") || url.endsWith("167.86.99.31") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED))) { if (!url.startsWith(CONST_REPORT_URL) && (url.startsWith("resource://android/assets/homepage/") || url.startsWith("http://167.86.99.31/?pG") || url.startsWith("https://167.86.99.31?pG") || url.endsWith("167.86.99.31") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED))) {
try { try {
@ -386,17 +227,85 @@ public class geckoClients {
mSession.loadUri(url); mSession.loadUri(url);
} }
} }
public void initHomeTheme() {
String mURLFinal;
mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL);
if (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(activityContextManager.getInstance().getHomeController())) {
String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData=" + dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH, null);
mSession.getSettings().setAllowJavascript(true);
mSession.initURL(mURL);
mURLFinal = mURL;
} else {
String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData=" + dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH, null);
mSession.getSettings().setAllowJavascript(true);
mSession.initURL(mURL);
mURLFinal = mURL;
} }
public void onRedrawPixel(AppCompatActivity pcontext) { if (!mSession.getNavigationDelegate().canGoBack()) {
activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession();
mSession.close();
mSession.open(mRuntime);
activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession);
} else {
mSession.goBack();
}
new Handler().postDelayed(() ->
{
if (!mSession.getNavigationDelegate().canGoBack()) {
mSession.close();
activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession();
mSession.open(mRuntime);
activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession);
}
mSession.loadUri(mURLFinal);
}, 10);
}
/*Helper Classes*/
public void toggleUserAgent() {
mSession.toggleUserAgent();
}
public int getUserAgent() {
return mSession.getUserAgentMode();
}
public void onGetFavIcon(ImageView pImageView, String pURL, AppCompatActivity pcontext) {
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY && status.sLowMemory != enums.MemoryStatus.LOW_MEMORY){ if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY && status.sLowMemory != enums.MemoryStatus.LOW_MEMORY){
mSession.onRedrawPixel(); initializeIcon(pcontext);
onLoadFavIcon(pcontext); pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL));
mIconManager.onLoadIconIntoView(pImageView, pURL);
} }
} }
public boolean isLoaded() { private int getCookiesBehaviour() {
return mSession.isLoaded(); return status.sSettingCookieStatus;
}
public void resetSession() {
mSessionID = strings.GENERIC_EMPTY_STR;
}
public void onMediaInvoke(enums.MediaController mController){
mSession.getMediaSessionDelegate().onTrigger(mController);
}
public String getTheme() {
if (mSessionID.equals(strings.GENERIC_EMPTY_STR)) {
return null;
} else if (mSession != null && mSession.getTheme() != null) {
return mSession.getTheme();
} else {
return null;
}
} }
public void onClearAll() { public void onClearAll() {
@ -440,93 +349,83 @@ public class geckoClients {
} }
} }
public void onBackPressed(boolean isFinishAllowed, int mTabSize, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext) { public void onBackPressed(boolean isFinishAllowed, int mTabSize, geckoView mNestedGeckoView, AppCompatActivity pcontext) {
if (mSession.canGoBack()) { if (mSession.getNavigationDelegate().canGoBack()) {
mSession.goBackSession(); mSession.goBackSession();
} else if (isFinishAllowed) { } else if (isFinishAllowed) {
if (mSession.getRemovableFromBackPressed() && mTabSize > 1) { if (mSession.isRemovableFromBackPressed() && mTabSize > 1) {
event.invokeObserver(null, enums.etype.M_CLOSE_TAB_BACK); mEvent.invokeObserver(null, homeEnums.eGeckoCallback.M_CLOSE_TAB_BACK);
} else { } else {
event.invokeObserver(null, enums.etype.back_list_empty); mEvent.invokeObserver(null, homeEnums.eGeckoCallback.BACK_LIST_EMPTY);
} }
} }
} }
public String getSecurityInfo() { public String getSecurityInfo() {
return mSession.getSecurityInfo(); return mSession.getProgressDelegate().getSecurityInfo();
} }
public boolean wasPreviousErrorPage() { public void onUploadRequest(int resultCode, Intent data) {
return mSession.wasPreviousErrorPage(); mSession.getDownloadHandler().onFileUploadRequest(resultCode, data, mSession.getPromptDelegate());
} }
public boolean canGoForward() { public boolean canGoForward() {
return mSession.canGoForward(); return mSession.getNavigationDelegate().canGoForward();
}
public boolean isLoading() {
return mSession.isLoading();
} }
public Uri getUriPermission() { public Uri getUriPermission() {
return mSession.getUriPermission(); return mSession.getDownloadHandler().getUriPermission();
} }
public boolean getFullScreenStatus() { public boolean getFullScreenStatus() {
if(mSession==null){
return false;
}
return mSession.getContentDelegate().getFullScreenStatus(); return mSession.getContentDelegate().getFullScreenStatus();
} }
public void onExitFullScreen() { public void onExitFullScreen() {
mSession.exitScreen(); //mSession.exitScreen();
} }
public void onForwardPressed() { public void onForwardPressed() {
if (mSession.canGoForward()) { if (mSession.getNavigationDelegate().canGoForward()) {
mSession.goForwardSession(); mSession.goForwardSession();
} }
} }
public void onClose() {
onKillMedia();
mSession.onClose();
}
public void setRemovableFromBackPressed(boolean pStatus) { public void setRemovableFromBackPressed(boolean pStatus) {
mSession.setRemovableFromBackPressed(pStatus); mSession.setRemovableFromBackPressed(pStatus);
} }
public void onUpdateFont() {
public void onStop() { float font = (status.sSettingFontSize - 100) / 3 + 100;
mSession.stop(); mRuntime.getSettings().setFontSizeFactor(font / 117);
} }
public void onReload(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext, boolean isThemeCall) { public int getScrollOffset() {
mSession.stop(); return mSession.getmScrollDelegate().getScrollOffset();
String url = mSession.getCurrentURL(); }
if (url.startsWith("http://167.86.99.31/?pG") || url.startsWith("https://167.86.99.31?pG") || url.endsWith("167.86.99.31") || url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)) {
loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); public void manualDownloadWithName(String url, String file, AppCompatActivity context) {
} else if (!isThemeCall) { Uri downloadURL = Uri.parse(url);
mSession.reload(); if (helperMethod.checkPermissions(context)) {
mSession.getDownloadHandler().downloadRequestedFile(downloadURL, file);
} }
} }
public void onReloadDelay(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext, boolean isThemeCall) { public void downloadFile(AppCompatActivity pcontext) {
new Handler().postDelayed(() -> if (helperMethod.checkPermissions(pcontext)) {
{ if(mSession != null){ geckoDownloadManager mDownloadManager = mSession.getContentDelegate().getDownloadManager();
mSession.stop(); mSession.getDownloadHandler().downloadRequestedFile(mDownloadManager);
String url = mSession.getCurrentURL();
if (url.startsWith("http://167.86.99.31/?pG") || url.startsWith("https://167.86.99.31?pG") || url.endsWith("167.86.99.31") || url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)) {
loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext);
} else if (!isThemeCall) {
mSession.reload();
} }
} }
}, 1000);
}
public void onReloadStatic(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext) { public void downloadFile(String mURL, AppCompatActivity pcontext) {
///mSession.stop(); if (helperMethod.checkPermissions(pcontext)) {
loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); geckoDownloadManager mDownloadManager = mSession.getContentDelegate().getDownloadManager();
mSession.getDownloadHandler().downloadRequestedFile(mDownloadManager);
}
} }
public void manual_download(String url, AppCompatActivity context) { public void manual_download(String url, AppCompatActivity context) {
@ -535,112 +434,58 @@ public class geckoClients {
f.getName(); f.getName();
String downloadFile = f.getName(); String downloadFile = f.getName();
/*EXTERNAL STORAGE REQUEST*/
if (helperMethod.checkPermissions(context)) { if (helperMethod.checkPermissions(context)) {
mSession.downloadRequestedFile(downloadURL, downloadFile); mSession.getDownloadHandler().downloadRequestedFile(downloadURL, downloadFile);
} }
} }
public void manualDownloadWithName(String url, String file, AppCompatActivity context) { public void onClose() {
Uri downloadURL = Uri.parse(url); onMediaInvoke(enums.MediaController.DESTROY);
/*EXTERNAL STORAGE REQUEST*/ mSession.onClose();
if (helperMethod.checkPermissions(context)) {
mSession.downloadRequestedFile(downloadURL, file);
}
} }
public void downloadFile(AppCompatActivity pcontext) { /*Private Rrturn*/
if (helperMethod.checkPermissions(pcontext)) {
mSession.downloadRequestedFile(); public GeckoRuntime getmRuntime() {
} return mRuntime;
} }
public void downloadFile(String mURL, AppCompatActivity pcontext) { public geckoSession getSession() {
if (helperMethod.checkPermissions(pcontext)) { return mSession;
mSession.downloadRequestedFile();
}
} }
/*Session Updates*/ /*Session Updates*/
public void onUpdateFont() {
float font = (status.sSettingFontSize - 100) / 3 + 100;
mRuntime.getSettings().setFontSizeFactor(font / 117);
}
public void reinitHomeTheme() {
String mURLFinal;
mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL);
if (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(activityContextManager.getInstance().getHomeController())) {
String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData=" + dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH, null);
mSession.getSettings().setAllowJavascript(true);
mSession.initURL(mURL);
mURLFinal = mURL;
} else {
String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData=" + dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH, null);
mSession.getSettings().setAllowJavascript(true);
mSession.initURL(mURL);
mURLFinal = mURL;
}
if (!mSession.canGoBack()) {
activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession();
mSession.close();
mSession.open(mRuntime);
activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession);
} else {
mSession.goBack();
}
new Handler().postDelayed(() ->
{
if (!mSession.canGoBack()) {
mSession.close();
activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession();
mSession.open(mRuntime);
activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession);
}
mSession.loadUri(mURLFinal);
}, 10);
}
public int getScrollOffset() {
return mSession.getmScrollDelegate().getScrollOffset();
}
public class geckoViewClientCallback implements eventObserver.eventListener { public class geckoViewClientCallback implements eventObserver.eventListener {
@Override @Override
public Object invokeObserver(List<Object> data, Object e_type) { public Object invokeObserver(List<Object> data, Object e_type) {
if (e_type.equals(enums.etype.ON_FULL_SCREEN)) { if (e_type.equals(homeEnums.eGeckoCallback.ON_FULL_SCREEN)) {
mSession.onFullScreenInvoke((boolean)data.get(0)); mSession.onFullScreenInvoke((boolean)data.get(0));
} }
if (e_type.equals(enums.etype.ON_DESTROY_MEDIA)) { if (e_type.equals(homeEnums.eGeckoCallback.ON_DESTROY_MEDIA)) {
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY); mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
} }
if (e_type.equals(enums.etype.M_CHANGE_HOME_THEME)) { if (e_type.equals(homeEnums.eGeckoCallback.M_CHANGE_HOME_THEME)) {
reinitHomeTheme(); initHomeTheme();
} }
else if (mSession != null) { else if (mSession != null) {
if (e_type.equals(enums.etype.SESSION_ID)) { if (e_type.equals(homeEnums.eGeckoCallback.SESSION_ID)) {
return mSession.getSessionID(); return mSession.getSessionID();
} else if (mSessionID != null && mSessionID.equals(data.get(1)) || e_type.equals(enums.etype.ON_INVOKE_PARSER) || e_type.equals(enums.etype.M_RATE_COUNT) || e_type.equals(enums.etype.FINDER_RESULT_CALLBACK) || e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE) || e_type.equals(enums.etype.on_update_favicon) || e_type.equals(enums.etype.ON_UPDATE_HISTORY) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url)) { } else if (mSessionID != null && mSessionID.equals(data.get(1)) || e_type.equals(homeEnums.eGeckoCallback.ON_INVOKE_PARSER) || e_type.equals(homeEnums.eGeckoCallback.M_RATE_COUNT) || e_type.equals(homeEnums.eGeckoCallback.FINDER_RESULT_CALLBACK) || e_type.equals(homeEnums.eGeckoCallback.ON_UPDATE_TAB_TITLE) || e_type.equals(homeEnums.eGeckoCallback.ON_UPDATE_FAVICON) || e_type.equals(homeEnums.eGeckoCallback.ON_UPDATE_HISTORY) || e_type.equals(homeEnums.eGeckoCallback.ON_REQUEST_COMPLETED) || e_type.equals(homeEnums.eGeckoCallback.ON_UPDATE_SUGGESTION) || e_type.equals(homeEnums.eGeckoCallback.ON_UPDATE_SUGGESTION_URL)) {
if (mSession != null && mSession.isClosed()) { if (mSession != null && mSession.getContentDelegate().isClosed()) {
return null; return null;
} }
if (e_type.equals(on_handle_external_intent)) { if (e_type.equals(homeEnums.eGeckoCallback.ON_HANDLE_EXTERNAL_INTENT)) {
try { try {
WebResponse responseInfo = (WebResponse) data.get(0); WebResponse responseInfo = (WebResponse) data.get(0);
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.headers.get("Content-Type")); intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.headers.get("Content-Type"));
activityContextManager.getInstance().getHomeController().startActivity(intent); activityContextManager.getInstance().getHomeController().startActivity(intent);
} catch (Exception ex) { } catch (Exception ex) {
Log.i("ex", "ex");
} }
} else { } else {
return event.invokeObserver(data, e_type); return mEvent.invokeObserver(data, e_type);
} }
} }
} }

View File

@ -1,29 +1,21 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager; package com.hiddenservices.onionservices.appManager.homeManager.geckoManager;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import androidx.core.view.NestedScrollingChildHelper; import androidx.core.view.NestedScrollingChildHelper;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import android.os.Handler; import android.os.Handler;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import org.mozilla.geckoview.GeckoView; import org.mozilla.geckoview.GeckoView;
import java.util.Collections; import java.util.Collections;
import static com.hiddenservices.onionservices.constants.enums.etype.GECKO_SCROLL_DOWN; public class geckoView extends GeckoView {
import static com.hiddenservices.onionservices.constants.enums.etype.GECKO_SCROLL_DOWN_MOVE;
import static com.hiddenservices.onionservices.constants.enums.etype.GECKO_SCROLL_UP_ALWAYS;
import static com.hiddenservices.onionservices.constants.enums.etype.GECKO_SCROLL_UP_MOVE;
import static com.hiddenservices.onionservices.constants.enums.etype.WAS_SCROLL_CHANGED;
public class NestedGeckoView extends GeckoView {
private int mLastY; private int mLastY;
private final int[] mScrollOffset = new int[2]; private final int[] mScrollOffset = new int[2];
private final int[] mScrollConsumed = new int[2]; private final int[] mScrollConsumed = new int[2];
@ -36,7 +28,6 @@ public class NestedGeckoView extends GeckoView {
private boolean mForcedScroll = false; private boolean mForcedScroll = false;
private int mScrollOffsetRoot = -1; private int mScrollOffsetRoot = -1;
private int mBottomOffsetRange = 0; private int mBottomOffsetRange = 0;
private boolean mPauseScroll = false;
public void onSetHomeEvent(eventObserver.eventListener pEvent) { public void onSetHomeEvent(eventObserver.eventListener pEvent) {
mEvent = pEvent; mEvent = pEvent;
@ -47,7 +38,7 @@ public class NestedGeckoView extends GeckoView {
mChildHelper = null; mChildHelper = null;
} }
public NestedGeckoView(Context context, AttributeSet attrs) { public geckoView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mChildHelper = new NestedScrollingChildHelper(this); mChildHelper = new NestedScrollingChildHelper(this);
@ -66,6 +57,7 @@ public class NestedGeckoView extends GeckoView {
super.onOverScrolled(scrollX, scrollY, clampedX, clampedY); super.onOverScrolled(scrollX, scrollY, clampedX, clampedY);
} }
@SuppressLint("ClickableViewAccessibility")
@Override @Override
public boolean onTouchEvent(MotionEvent ev) { public boolean onTouchEvent(MotionEvent ev) {
final MotionEvent event = MotionEvent.obtain(ev); final MotionEvent event = MotionEvent.obtain(ev);
@ -87,7 +79,7 @@ public class NestedGeckoView extends GeckoView {
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE:
boolean mBottomReached = false; boolean mBottomReached = false;
Object mTemp = mEvent.invokeObserver(Collections.singletonList(null), WAS_SCROLL_CHANGED); Object mTemp = mEvent.invokeObserver(Collections.singletonList(null), homeEnums.eGeckoCallback.WAS_SCROLL_CHANGED);
int deltaY = mLastY - eventY; int deltaY = mLastY - eventY;
mSwipeDistance += deltaY; mSwipeDistance += deltaY;
@ -139,17 +131,17 @@ public class NestedGeckoView extends GeckoView {
mScrollable = false; mScrollable = false;
mLastY = eventY; mLastY = eventY;
startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL);
mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_DOWN); mEvent.invokeObserver(Collections.singletonList(null), homeEnums.eGeckoCallback.GECKO_SCROLL_DOWN);
mPressed = true; mPressed = true;
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
if (!mPressed && status.sFullScreenBrowsing && !status.sDisableExpandTemp) { if (!mPressed && status.sFullScreenBrowsing && !status.sDisableExpandTemp) {
if (mSwipeDistance > 75) { if (mSwipeDistance > 75) {
mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_UP_MOVE); mEvent.invokeObserver(Collections.singletonList(null), homeEnums.eGeckoCallback.GECKO_SCROLL_UP_MOVE);
mScrollable = true; mScrollable = true;
} else if (mSwipeDistance < -75) { } else if (mSwipeDistance < -75) {
mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_DOWN_MOVE); mEvent.invokeObserver(Collections.singletonList(null), homeEnums.eGeckoCallback.GECKO_SCROLL_DOWN_MOVE);
mScrollable = true; mScrollable = true;
} }
} }
@ -159,7 +151,7 @@ public class NestedGeckoView extends GeckoView {
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
mPressed = false; mPressed = false;
mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_UP_ALWAYS); mEvent.invokeObserver(Collections.singletonList(null), homeEnums.eGeckoCallback.GECKO_SCROLL_UP_ALWAYS);
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
mPressed = false; mPressed = false;
stopNestedScroll(); stopNestedScroll();
@ -233,7 +225,6 @@ public class NestedGeckoView extends GeckoView {
} }
public void onstopscroll(boolean pScroll) { public void onstopscroll(boolean pScroll) {
mPauseScroll = true;
} }
} }

View File

@ -0,0 +1,176 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.util.Base64;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.content.FileProvider;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel.promptDelegate;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.downloadManager.geckoDownloadManager;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class downloadHandler {
private static String S_CHANNEL_ID = "DOWNLOAD_CHANNEL";
private static String S_CHANNEL_NAME = "ORION DOWNLOADER";
private static String S_CHANNEL_DESCRIPTION = "ORION DOWNLOADER";
private WeakReference<AppCompatActivity> mContext;
private geckoSession mGeckoSession;
private Uri mUriPermission = null;
/*Initializations*/
public downloadHandler(WeakReference<AppCompatActivity> pContext, geckoDataModel pGeckoDataModel, geckoSession pGeckoSession) {
this.mContext = pContext;
this.mGeckoSession = pGeckoSession;
}
public void downloadRequestedFile(geckoDownloadManager mDownloadManager) {
if (mDownloadManager.getDownloadURL() != null && mDownloadManager.getDownloadFile() != null) {
if (!createAndSaveFileFromBase64Url(mDownloadManager.getDownloadURL().toString())) {
pluginController.getInstance().onDownloadInvoke(Arrays.asList(mDownloadManager.getDownloadURL(), mDownloadManager.getDownloadFile()), pluginEnums.eDownloadManager.M_WEB_DOWNLOAD_REQUEST);
}
}
}
public void downloadRequestedFile(Uri downloadURL, String downloadFile) {
if (downloadURL != null && downloadFile != null) {
if (!createAndSaveFileFromBase64Url(downloadURL.toString())) {
pluginController.getInstance().onDownloadInvoke(Arrays.asList(downloadURL, downloadFile), pluginEnums.eDownloadManager.M_WEB_DOWNLOAD_REQUEST);
}
}
}
public void onFileUploadRequest(int resultCode, Intent data, promptDelegate mPromptDelegate) {
Objects.requireNonNull(mPromptDelegate).onFileCallbackResult(resultCode, data);
}
private boolean createAndSaveFileFromBase64Url(String url) {
try {
if (!url.startsWith("data") && !url.startsWith("blob")) {
return false;
}
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
String filetype;
String filename;
if (url.startsWith("blob")) {
mGeckoSession.loadUri((String) pluginController.getInstance().onDownloadInvoke(Collections.singletonList(url), pluginEnums.eDownloadManager.M_BLOB_DOWNLOAD_REQUEST));
return true;
}
filetype = url.substring(url.indexOf("/") + 1, url.indexOf(";"));
filename = System.currentTimeMillis() + "." + filetype;
File file = new File(path, filename);
try {
if (!path.exists())
path.mkdirs();
if (!file.exists())
file.createNewFile();
String base64EncodedString = url.substring(url.indexOf(",") + 1);
byte[] decodedBytes = Base64.decode(base64EncodedString, Base64.DEFAULT);
OutputStream os = new FileOutputStream(file);
os.write(decodedBytes);
os.close();
//Tell the media scanner about the new file so that it is immediately available to the user.
MediaScannerConnection.scanFile(mContext.get().getApplicationContext(),
new String[]{file.toString()}, null,
(path1, uri) ->
{
});
String mimetype = url.substring(url.indexOf(":") + 1, url.indexOf("/"));
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
Uri uri_temp = FileProvider.getUriForFile(mContext.get().getApplicationContext(), mContext.get().getString(R.string.GENERAL_FILE_PROVIDER_AUTHORITY), file);
intent.setDataAndType(uri_temp, (mimetype + "/*"));
List<ResolveInfo> resInfoList = mContext.get().getApplicationContext().getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo resolveInfo : resInfoList) {
String packageName = resolveInfo.activityInfo.packageName;
mUriPermission = uri_temp;
mContext.get().getApplicationContext().grantUriPermission(packageName, uri_temp, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
PendingIntent pIntent = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
pIntent = PendingIntent.getActivity(mContext.get().getApplicationContext(), 0, intent, PendingIntent.FLAG_IMMUTABLE);
}
String channel_id = createNotificationChannel(mContext.get().getApplicationContext());
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext.get().getApplicationContext(), channel_id)
.setSmallIcon(R.drawable.ic_download)
.setContentTitle(filename)
.setContentIntent(pIntent);
notificationBuilder.setAutoCancel(true);
int notificationId = 85851;
NotificationManager notificationManager = (NotificationManager) mContext.get().getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationId, notificationBuilder.build());
} catch (Exception e) {
e.printStackTrace();
}
return true;
} catch (Exception ex) {
ex.printStackTrace();
}
return true;
}
private static String createNotificationChannel(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
String channelId = S_CHANNEL_ID;
CharSequence channelName = S_CHANNEL_NAME;
String channelDescription = S_CHANNEL_DESCRIPTION;
int channelImportance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, channelImportance);
notificationChannel.setDescription(channelDescription);
notificationChannel.enableVibration(true);
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
assert notificationManager != null;
notificationManager.createNotificationChannel(notificationChannel);
return channelId;
} else {
return null;
}
}
public Uri getUriPermission() {
return mUriPermission;
}
}

View File

@ -3,12 +3,52 @@ package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.hel
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.mozilla.geckoview.GeckoSession;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.List;
public class intentHandler { public class intentHandler {
public static void actionDial(String pIntentHander, WeakReference<AppCompatActivity> mContext) { public static void actionDial(String pIntentHander, WeakReference<AppCompatActivity> mContext) {
if(pIntentHander.startsWith("tel:")){
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(pIntentHander)); Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(pIntentHander));
mContext.get().startActivity(intent); mContext.get().startActivity(intent);
} }
} }
public static String getSecurityInfo(GeckoSession.ProgressDelegate.SecurityInformation securityInfo) {
if (securityInfo != null && securityInfo.certificate != null) {
String mAlternativeNames = strings.GENERIC_EMPTY_STR;
try {
for (List name : securityInfo.certificate.getSubjectAlternativeNames()) {
mAlternativeNames = mAlternativeNames + name.get(1) + "<br>";
}
} catch (Exception ignored) {
}
return "<br><b>Website</b><br>" + securityInfo.host + "<br><br>" +
"<b>Serial Number</b><br>" + securityInfo.certificate.getSerialNumber() + "<br><br>" +
"<b>Algorithm Name</b><br>" + securityInfo.certificate.getSigAlgName() + "<br><br>" +
"<b>Issued On</b><br>" + securityInfo.certificate.getNotBefore() + "<br><br>" +
"<b>Expires On</b><br>" + securityInfo.certificate.getNotAfter() + "<br><br>" +
"<b>Organization (O)</b><br>" + securityInfo.certificate.getSubjectDN().getName() + "<br><br>" +
"<b>Common Name (CN)</b><br>" + securityInfo.certificate.getIssuerDN().getName() + "<br><br>" +
"<b>Subject Alternative Names</b><br>" + mAlternativeNames;
} else {
if(status.sTorBrowsing){
return "Tor Secured Connection";
}else {
return "Connection Not Secured";
}
}
}
}

View File

@ -4,12 +4,12 @@ import androidx.annotation.NonNull;
import org.mozilla.gecko.EventDispatcher; import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.util.GeckoBundle; import org.mozilla.gecko.util.GeckoBundle;
public class preferences<T> { public class preferencesHandler<T> {
public final String name; public final String name;
public final T defaultValue; public final T defaultValue;
private T mValue; private T mValue;
public preferences(@NonNull final String name, final T defaultValue) { public preferencesHandler(@NonNull final String name, final T defaultValue) {
this.name = name; this.name = name;
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
mValue = defaultValue; mValue = defaultValue;

View File

@ -0,0 +1,54 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.eventObserver;
import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession;
import java.util.Arrays;
public class searchHandler {
GeckoResult<GeckoSession.FinderResult> mFinder = null;
private eventObserver.eventListener mEvent;
private geckoSession mGeckoSession;
/*Initializations*/
public searchHandler(eventObserver.eventListener pEvent, geckoSession pGeckoSession) {
this.mEvent = pEvent;
this.mGeckoSession = pGeckoSession;
}
public void findInPage(String pQuery, int pDirection) {
mFinder = null;
mFinder = mGeckoSession.getFinder().find(pQuery, pDirection);
new Thread() {
public void run() {
int mCounter = 0;
while (mFinder == null) {
try {
mCounter += 1;
sleep(100);
if (mCounter > 100) {
return;
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
try {
GeckoSession.FinderResult mResult = mFinder.poll(1000);
mEvent.invokeObserver(Arrays.asList(mResult.total, mResult.current), homeEnums.eGeckoCallback.FINDER_RESULT_CALLBACK);
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
}.start();
}
}

View File

@ -1,13 +1,10 @@
package com.hiddenservices.onionservices.appManager.homeManager.hintManager; package com.hiddenservices.onionservices.appManager.homeManager.hintManager;
import static com.hiddenservices.onionservices.constants.constants.CONST_PRIVACY_POLICY_URL_NON_TOR; import static com.hiddenservices.onionservices.constants.constants.CONST_PRIVACY_POLICY_URL_NON_TOR;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
@ -16,12 +13,12 @@ import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView; import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeEnums;
import com.hiddenservices.onionservices.appManager.tabManager.tabEnums; import com.hiddenservices.onionservices.appManager.tabManager.tabEnums;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.dataManager.models.historyRowModel; import com.hiddenservices.onionservices.dataManager.models.historyRowModel;
@ -30,27 +27,17 @@ import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.R; import com.hiddenservices.onionservices.R;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import static java.lang.Thread.sleep;
import org.xmlpull.v1.XmlPullParserException;
public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder> { public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder> {
/*Private Variables*/ /*Private Variables*/
private ArrayList<historyRowModel> mHintList; private ArrayList<historyRowModel> mHintList;
private AppCompatActivity mContext; private AppCompatActivity mContext;
private eventObserver.eventListener mEvent; private eventObserver.eventListener mEvent;
//private Map<Integer, Drawable> mPastWebIcon = new HashMap<>();
//private Map<Integer, String> mPastIconFlicker = new HashMap<>();
public hintAdapter(ArrayList<historyRowModel> pHintList, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pSearch) { public hintAdapter(ArrayList<historyRowModel> pHintList, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pSearch) {
this.mHintList = new ArrayList(); this.mHintList = new ArrayList();
@ -64,6 +51,7 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
this.mEvent = pEvent; this.mEvent = pEvent;
} }
@SuppressLint("NotifyDataSetChanged")
public void onUpdateAdapter(ArrayList<historyRowModel> pHintList, String pSearch) { public void onUpdateAdapter(ArrayList<historyRowModel> pHintList, String pSearch) {
mHintList = pHintList; mHintList = pHintList;
if (mHintList.size() == 1 && mHintList.get(0).getHeader().equals("about:blank")) { if (mHintList.size() == 1 && mHintList.get(0).getHeader().equals("about:blank")) {
@ -73,12 +61,6 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
notifyDataSetChanged(); notifyDataSetChanged();
} }
public void onClearAdapter() {
//mPastWebIcon.remove(0);
//mPastWebIcon.remove(1);
//mPastWebIcon.remove(2);
}
/*Initializations*/ /*Initializations*/
@NonNull @NonNull
@ -98,8 +80,6 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
return mHintList.size(); return mHintList.size();
} }
/*Listeners*/
/*View Holder Extensions*/ /*View Holder Extensions*/
class listViewHolder extends RecyclerView.ViewHolder implements View.OnTouchListener { class listViewHolder extends RecyclerView.ViewHolder implements View.OnTouchListener {
TextView mHeader; TextView mHeader;
@ -130,10 +110,6 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
pHintWebIconImage.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v6))); pHintWebIconImage.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v6)));
//if (mPastWebIcon.containsKey(getLayoutPosition())) {
//pHintWebIconImage.setImageDrawable(mPastWebIcon.get(getLayoutPosition()));
//pHintWebIconImage.setImageTintList(null);
//} else {
pHintWebIconImage.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v8))); pHintWebIconImage.setImageTintList(ColorStateList.valueOf(mContext.getResources().getColor(R.color.c_text_v8)));
Drawable mDrawable; Drawable mDrawable;
@ -146,8 +122,6 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
} catch (Exception ignored) { } catch (Exception ignored) {
} }
//}
String mURLLink; String mURLLink;
if (model.getDescription().equals(strings.GENERIC_EMPTY_STR)) { if (model.getDescription().equals(strings.GENERIC_EMPTY_STR)) {
mURLLink = model.getHeader(); mURLLink = model.getHeader();
@ -179,8 +153,6 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
} }
mURL.setText(m_url); mURL.setText(m_url);
//Drawable mDrawable = null;
//Resources res = itemView.getContext().getResources();
try { try {
if (model.getDescription().equals(strings.GENERIC_EMPTY_STR) && !model.getHeader().contains(".")) { if (model.getDescription().equals(strings.GENERIC_EMPTY_STR) && !model.getHeader().contains(".")) {
mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_search)); mDrawable = Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_search));
@ -191,9 +163,7 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
mMoveURL.setOnTouchListener(listViewHolder.this); mMoveURL.setOnTouchListener(listViewHolder.this);
} }
//if (model.getDescription().contains("."))
mHindTypeIcon.setImageDrawable(mDrawable); mHindTypeIcon.setImageDrawable(mDrawable);
//}
} catch (Exception ignored) { } catch (Exception ignored) {
} }
@ -202,19 +172,14 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
if (mURLLink.contains("167.86.99.31") || mURLLink.contains("orion.onion")) { if (mURLLink.contains("167.86.99.31") || mURLLink.contains("orion.onion")) {
pHintWebIconImage.setImageTintList(null); pHintWebIconImage.setImageTintList(null);
pHintWebIconImage.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis)); pHintWebIconImage.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis));
//mPastWebIcon.put(getLayoutPosition(), pHintWebIconImage.getDrawable());
} else { } else {
String mURLPast = mURLLink;
//mPastIconFlicker.put(getLayoutPosition(), mURLPast);
mHindTypeIconTemp.setImageDrawable(null); mHindTypeIconTemp.setImageDrawable(null);
mEvent.invokeObserver(Arrays.asList(mHindTypeIconTemp, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon); mEvent.invokeObserver(Arrays.asList(mHindTypeIconTemp, "https://" + helperMethod.getDomainName(model.getDescription())), homeEnums.eHintCallback.ON_FETCH_FAVICON);
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY && status.sLowMemory != enums.MemoryStatus.LOW_MEMORY){ if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY && status.sLowMemory != enums.MemoryStatus.LOW_MEMORY){
if (mHindTypeIconTemp.getDrawable() != null) { if (mHindTypeIconTemp.getDrawable() != null) {
pHintWebIconImage.setImageTintList(null); pHintWebIconImage.setImageTintList(null);
pHintWebIconImage.setImageDrawable(mHindTypeIconTemp.getDrawable()); pHintWebIconImage.setImageDrawable(mHindTypeIconTemp.getDrawable());
//mPastWebIcon.put(getLayoutPosition(), pHintWebIconImage.getDrawable());
} }
} }
} }
@ -227,8 +192,6 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
if (event.getAction() == MotionEvent.ACTION_MOVE) { if (event.getAction() == MotionEvent.ACTION_MOVE) {
helperMethod.hideKeyboard(mContext); helperMethod.hideKeyboard(mContext);
} }
} else if (v.getId() == mMoveURL.getId()) {
mEvent.invokeObserver(Collections.singletonList(mMoveURL.getTag()), enums.etype.M_COPY_URL);
} }
return false; return false;
} }

View File

@ -0,0 +1,21 @@
package com.hiddenservices.onionservices.appManager.homeManager.homeController;
/*Settings Manager*/
public class homeEnums {
public enum eHomeViewCallback {
M_HOME_PAGE, M_INITIALIZE_TAB_LINK_OPEN, OPEN_NEW_TAB_INSTANT, ON_LOAD_TAB_ON_RESUME, ON_LOAD_ADVERT, on_url_load, M_WELCOME_MESSAGE, M_SPLASH_DISABLE, M_GET_CURRENT_URL, M_ON_BANNER_UPDATE, on_full_screen_ads, M_INITIALIZE_TAB_LINK, M_HOME_BUTTON_PRESSED, M_INITIALIZE_TAB_SINGLE, ON_UPDATE_THEME, M_UPDATE_THEME, OPEN_DOWNLOAD_FOLDER, ON_OPEN_TAB_VIEW, ON_NEW_TAB_ANIMATION, M_UPDATE_PIXEL_BACKGROUND, M_CACHE_UPDATE_TAB, OPEN_NEW_TAB, M_RESET_SUGGESTION, M_NEW_LINK_IN_NEW_TAB_LOAD, M_NEW_LINK_IN_NEW_TAB, M_NEW_LINK_ANIMATION, M_ADVERT_LOADED, M_CLOSE_TAB_BACK, M_INIT_TOR, M_GET_SSL_STATUS, M_INIT_TAB_COUNT_FORCED, PROGRESS_UPDATE, ON_INIT_ADS, M_PRELOAD_URL
}
public enum eGeckoCallback {
ON_FETCH_FAVICON, M_RELOAD,open_new_tab, M_DEFAULT_BROWSER, M_RATE_COUNT, M_INDEX_WEBSITE, ON_DESTROY_MEDIA, ON_HANDLE_EXTERNAL_INTENT, SESSION_ID, ON_LOAD_REQUEST, M_NEW_IDENTITY_MESSAGED, ON_UPDATE_SUGGESTION, M_NEW_IDENTITY, M_ORBOT_LOADING, M_UPDATE_PIXEL_BACKGROUND, M_OPEN_SESSION, M_ON_MAIL, FINDER_RESULT_CALLBACK, M_UPDATE_SESSION_STATE, ON_UPDATE_TAB_TITLE, ON_PLAYSTORE_LOAD, ON_CLOSE_SESSION, ON_LONG_PRESS, ON_UPDATE_FAVICON, ON_FULL_SCREEN, DOWNLOAD_FILE_POPUP, SEARCH_UPDATE, ON_LOAD_ERROR, ON_PAGE_LOADED, ON_UPDATE_HISTORY, START_PROXY, ON_UPDATE_THEME, M_CLOSE_TAB, BACK_LIST_EMPTY, ON_URL_LOAD, ON_SESSION_REINIT, ON_INVOKE_PARSER, ON_FIRST_PAINT, ON_UPDATE_SEARCH_BAR, PROGRESS_UPDATE_FORCED, M_LOAD_HOMEPAGE_GENESIS, PROGRESS_UPDATE, M_ON_BANNER_UPDATE, ON_EXPAND_TOP_BAR, M_ON_SCROLL_NO_BOUNDARIES, M_ON_SCROLL_TOP_BOUNDARIES, M_ON_SCROLL_BOUNDARIES, M_CLOSE_TAB_BACK, M_CHANGE_HOME_THEME, ON_UPDATE_SUGGESTION_URL, ON_REQUEST_COMPLETED, GECKO_SCROLL_DOWN, GECKO_SCROLL_UP_MOVE, WAS_SCROLL_CHANGED, GECKO_SCROLL_DOWN_MOVE, GECKO_SCROLL_UP_ALWAYS
}
public enum eHintCallback {
ON_FETCH_FAVICON
}
public enum eEdittextCallbacks {
ON_KEYBOARD_CLOSE
}
}

View File

@ -9,13 +9,13 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import java.net.URL; import java.net.URL;
class homeModel { public class homeModel {
String getSearchEngine() { public String getSearchEngine() {
return status.sSettingDefaultSearchEngine; return status.sSettingDefaultSearchEngine;
} }
String urlComplete(String pURL, String pSearchEngine) { public String urlComplete(String pURL, String pSearchEngine) {
if (pURL.startsWith(CONST_PRIVACY_POLICY_URL_NON_TOR)) { if (pURL.startsWith(CONST_PRIVACY_POLICY_URL_NON_TOR)) {
return CONST_PRIVACY_POLICY_URL_NON_TOR; return CONST_PRIVACY_POLICY_URL_NON_TOR;
} }

View File

@ -31,7 +31,6 @@ import android.view.WindowManager;
import android.view.animation.AccelerateInterpolator; import android.view.animation.AccelerateInterpolator;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
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.appcompat.app.AppCompatDelegate;
@ -42,9 +41,8 @@ import androidx.core.graphics.ColorUtils;
import androidx.core.widget.NestedScrollView; import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.FragmentContainerView; import androidx.fragment.app.FragmentContainerView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.applovin.mediation.ads.MaxAdView;
import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.editTextManager;
import com.hiddenservices.onionservices.constants.*; import com.hiddenservices.onionservices.constants.*;
import com.hiddenservices.onionservices.dataManager.dataController; import com.hiddenservices.onionservices.dataManager.dataController;
import com.hiddenservices.onionservices.dataManager.dataEnums; import com.hiddenservices.onionservices.dataManager.dataEnums;
@ -53,25 +51,23 @@ import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
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 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.Locale;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import static android.content.Context.LAYOUT_INFLATER_SERVICE; import static android.content.Context.LAYOUT_INFLATER_SERVICE;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_DOMAIN_URL; import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_DOMAIN_URL;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED; import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED_DARK; import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
import static com.hiddenservices.onionservices.constants.constants.CONST_PRIVACY_POLICY_URL_NON_TOR; import static com.hiddenservices.onionservices.constants.constants.CONST_PRIVACY_POLICY_URL_NON_TOR;
import static com.hiddenservices.onionservices.constants.status.sSettingLanguage;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP;
import static java.lang.System.gc;
import static java.lang.Thread.sleep; import static java.lang.Thread.sleep;
class homeViewController { public class homeViewController {
/*ViewControllers*/ /*ViewControllers*/
private AppCompatActivity mContext; private AppCompatActivity mContext;
private eventObserver.eventListener mEvent; private eventObserver.eventListener mEvent;
@ -96,10 +92,8 @@ class homeViewController {
private View mSearchEngineBar; private View mSearchEngineBar;
private EditText mFindText; private EditText mFindText;
private TextView mFindCount; private TextView mFindCount;
private ConstraintLayout mTopLayout;
private ImageButton mVoiceInput; private ImageButton mVoiceInput;
private ImageButton mMenu; private ImageButton mMenu;
private ImageView mBlocker;
private ImageView mBlockerFullSceen; private ImageView mBlockerFullSceen;
private TextView mCopyright; private TextView mCopyright;
private ImageButton mOrbotLogManager; private ImageButton mOrbotLogManager;
@ -112,7 +106,6 @@ class homeViewController {
private ImageView mSearchLock; private ImageView mSearchLock;
private ImageView mTopBarHider; private ImageView mTopBarHider;
private ImageView mNewTabBlocker; private ImageView mNewTabBlocker;
private CoordinatorLayout mCoordinatorLayout;
private ImageView mImageDivider; private ImageView mImageDivider;
private ImageButton mPanicButton; private ImageButton mPanicButton;
private ImageButton mSupportButton; private ImageButton mSupportButton;
@ -128,7 +121,7 @@ class homeViewController {
private boolean mIsTopBarExpanded = true; private boolean mIsTopBarExpanded = true;
private NestedScrollView.MarginLayoutParams mDefaultMargin = null; private NestedScrollView.MarginLayoutParams mDefaultMargin = null;
void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, View banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, Button connect_no_tor_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo, ImageButton pPanicButtonLandscape, ImageView pTorDisabled, ImageButton pSupportButton) { public void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, View banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, Button connect_no_tor_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo, ImageButton pPanicButtonLandscape, ImageView pTorDisabled, ImageButton pSupportButton) {
this.mContext = context; this.mContext = context;
this.mProgressBar = progressBar; this.mProgressBar = progressBar;
this.mSearchbar = searchbar; this.mSearchbar = searchbar;
@ -147,10 +140,8 @@ class homeViewController {
this.mFindBar = pFindBar; this.mFindBar = pFindBar;
this.mFindText = pFindText; this.mFindText = pFindText;
this.mFindCount = pFindCount; this.mFindCount = pFindCount;
this.mTopLayout = pTopLayout;
this.mVoiceInput = pVoiceInput; this.mVoiceInput = pVoiceInput;
this.mMenu = pMenu; this.mMenu = pMenu;
this.mBlocker = pBlocker;
this.mBlockerFullSceen = pBlockerFullSceen; this.mBlockerFullSceen = pBlockerFullSceen;
this.mSearchEngineBar = mSearchEngineBar; this.mSearchEngineBar = mSearchEngineBar;
this.mCopyright = pCopyright; this.mCopyright = pCopyright;
@ -165,7 +156,6 @@ class homeViewController {
this.mSearchLock = pSearchLock; this.mSearchLock = pSearchLock;
this.mTopBarHider = pTopBarHider; this.mTopBarHider = pTopBarHider;
this.mNewTabBlocker = pNewTabBlocker; this.mNewTabBlocker = pNewTabBlocker;
this.mCoordinatorLayout = mCoordinatorLayout;
this.mImageDivider = pImageDivider; this.mImageDivider = pImageDivider;
this.mPanicButton = pPanicButton; this.mPanicButton = pPanicButton;
this.mGenesisLogo = pGenesisLogo; this.mGenesisLogo = pGenesisLogo;
@ -186,12 +176,12 @@ class homeViewController {
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
public void initializeViews() { public void initializeViews() {
mSearchbar.setTag(R.id.msearchbarProcessing, false); this.mSearchbar.setTag(R.id.msearchbarProcessing, false);
mNestedScroll.setNestedScrollingEnabled(true); this.mNestedScroll.setNestedScrollingEnabled(true);
this.mBlockerFullSceen.setVisibility(View.GONE); this.mBlockerFullSceen.setVisibility(View.GONE);
mSearchBarMovementMethod = mSearchbar.getMovementMethod(); this.mSearchBarMovementMethod = mSearchbar.getMovementMethod();
mSearchbar.setMovementMethod(null); this.mSearchbar.setMovementMethod(null);
mTopBarContainer.getLayoutTransition().setDuration(200); this.mTopBarContainer.getLayoutTransition().setDuration(200);
final Handler handler = new Handler(); final Handler handler = new Handler();
handler.postDelayed(() -> mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER), 1500); handler.postDelayed(() -> mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER), 1500);
@ -266,7 +256,7 @@ class homeViewController {
layoutParams.setMargins(0, helperMethod.pxFromDp(60), 0, 0); layoutParams.setMargins(0, helperMethod.pxFromDp(60), 0, 0);
mGeckoView.setPadding(0, 0, 0, 0); mGeckoView.setPadding(0, 0, 0, 0);
} else { } else {
Object mAdvertLoaded = mEvent.invokeObserver(null, enums.etype.M_ADVERT_LOADED); Object mAdvertLoaded = mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_ADVERT_LOADED);
if (mAdvertLoaded != null && (boolean) mAdvertLoaded) { if (mAdvertLoaded != null && (boolean) mAdvertLoaded) {
int[] location = new int[2]; int[] location = new int[2];
mTopBar.getLocationOnScreen(location); mTopBar.getLocationOnScreen(location);
@ -281,10 +271,23 @@ class homeViewController {
mGeckoView.setPadding(0, 0, 0, 0); mGeckoView.setPadding(0, 0, 0, 0);
} }
} }
mSearchEngineBar.setLayoutParams(layoutParams);
String mText = getLocaleStringResource(new Locale(sSettingLanguage), R.string.GENERAL_SEARCH_ENGINE, mContext);
((TextView)mSearchEngineBar.findViewById(R.id.pSearchEngineHintInvoke)).setText(mText);
} }
} }
public static String getLocaleStringResource(Locale requestedLocale, int resourceId, Context context) {
String result;
Configuration config = new Configuration(context.getResources().getConfiguration());
config.setLocale(requestedLocale);
result = context.createConfigurationContext(config).getText(resourceId).toString();
return result;
}
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
public void initTopBarPadding() { public void initTopBarPadding() {
if (isFullScreen) { if (isFullScreen) {
@ -337,13 +340,13 @@ class homeViewController {
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
mTopBarHider.animate().alpha(0).setDuration(250).setStartDelay(0).withEndAction(() -> mTopBarHider.setVisibility(View.GONE)); mTopBarHider.animate().alpha(0).setDuration(250).setStartDelay(0).withEndAction(() -> mTopBarHider.setVisibility(View.GONE));
mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_UPDATE_THEME);
}, 250); }, 250);
mTabFragment.animate().cancel(); mTabFragment.animate().cancel();
mTabFragment.animate().setDuration(100).alpha(0f).withEndAction(() -> { mTabFragment.animate().setDuration(100).alpha(0f).withEndAction(() -> {
mTabFragment.setVisibility(View.GONE); mTabFragment.setVisibility(View.GONE);
mEvent.invokeObserver(null, enums.etype.M_UPDATE_PIXEL_BACKGROUND); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_UPDATE_PIXEL_BACKGROUND);
}); });
} }
} }
@ -387,7 +390,7 @@ class homeViewController {
} }
if(!mSearchbar.isFocused() && (mProgressBar.getProgress() == 0 || mProgressBar.getProgress() == 100)){ if(!mSearchbar.isFocused() && (mProgressBar.getProgress() == 0 || mProgressBar.getProgress() == 100)){
boolean ssl = (boolean)mEvent.invokeObserver(null, enums.etype.M_GET_SSL_STATUS); boolean ssl = (boolean)mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_GET_SSL_STATUS);
if(ssl || status.sTorBrowsing){ if(ssl || status.sTorBrowsing){
mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_lock_tint)); mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_lock_tint));
}else { }else {
@ -479,7 +482,7 @@ class homeViewController {
} }
} }
void initTab(int count, boolean pForced, enums.etype pEvent, List<Object> pData) { void initTab(int count, boolean pForced, homeEnums.eHomeViewCallback pEvent, List<Object> pData) {
if (!pForced) { if (!pForced) {
ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mNewTab, ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mNewTab,
PropertyValuesHolder.ofFloat("scale" + "X", 1, 0.70f, 1), PropertyValuesHolder.ofFloat("scale" + "X", 1, 0.70f, 1),
@ -587,8 +590,8 @@ class homeViewController {
mSupportButton.setVisibility(View.GONE); mSupportButton.setVisibility(View.GONE);
mPanicButtonLandscape.setVisibility(View.GONE); mPanicButtonLandscape.setVisibility(View.GONE);
mEvent.invokeObserver(null, enums.etype.M_CACHE_UPDATE_TAB); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_CACHE_UPDATE_TAB);
mEvent.invokeObserver(null, enums.etype.M_SPLASH_DISABLE); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_SPLASH_DISABLE);
} }
public void initSplashLoading() { public void initSplashLoading() {
@ -683,7 +686,7 @@ class homeViewController {
}); });
} else { } else {
mContext.runOnUiThread(() -> { mContext.runOnUiThread(() -> {
mEvent.invokeObserver(null, enums.etype.ON_LOAD_TAB_ON_RESUME); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.ON_LOAD_TAB_ON_RESUME);
}); });
} }
mContext.runOnUiThread(() -> { mContext.runOnUiThread(() -> {
@ -692,7 +695,7 @@ class homeViewController {
orbotLocalConstants.mIsTorInitialized = true; orbotLocalConstants.mIsTorInitialized = true;
mContext.runOnUiThread(() -> { mContext.runOnUiThread(() -> {
mEvent.invokeObserver(null, enums.etype.ON_LOAD_ADVERT); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.ON_LOAD_ADVERT);
}); });
return null; return null;
@ -749,7 +752,7 @@ class homeViewController {
mIsAnimating = true; mIsAnimating = true;
initStatusBarColor(false); initStatusBarColor(false);
mEvent.invokeObserver(null, enums.etype.M_WELCOME_MESSAGE); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_WELCOME_MESSAGE);
mOrbotLogManager.setClickable(false); mOrbotLogManager.setClickable(false);
status.sSettingIsAppRestarting = true; status.sSettingIsAppRestarting = true;
} }
@ -872,7 +875,7 @@ class homeViewController {
helperMethod.hideKeyboard(mContext); helperMethod.hideKeyboard(mContext);
popupWindow.setHeight(height); popupWindow.setHeight(height);
} }
if (status.sSettingLanguageRegion.equals("Ur") || status.sSettingLanguage.equals("default") && status.mSystemLocale.getLanguage().equals("ur")) { if (status.sSettingLanguageRegion.equals("Ur") || sSettingLanguage.equals("default") && status.mSystemLocale.getLanguage().equals("ur")) {
popupWindow.showAtLocation(parent, Gravity.TOP | Gravity.START, 0, 0); popupWindow.showAtLocation(parent, Gravity.TOP | Gravity.START, 0, 0);
} else { } else {
popupWindow.showAtLocation(parent, Gravity.TOP | Gravity.END, 0, 0); popupWindow.showAtLocation(parent, Gravity.TOP | Gravity.END, 0, 0);
@ -920,7 +923,7 @@ class homeViewController {
if (isLandscape) { if (isLandscape) {
layoutParams.setMargins(mScrollView.getLeft(), helperMethod.pxFromDp(7), mScrollView.getRight(), helperMethod.pxFromDp(10)); layoutParams.setMargins(mScrollView.getLeft(), helperMethod.pxFromDp(7), mScrollView.getRight(), helperMethod.pxFromDp(10));
} else { } else {
Object mAdvertLoaded = mEvent.invokeObserver(null, enums.etype.M_ADVERT_LOADED); Object mAdvertLoaded = mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_ADVERT_LOADED);
if (mAdvertLoaded != null && (boolean) mAdvertLoaded) { if (mAdvertLoaded != null && (boolean) mAdvertLoaded) {
layoutParams.setMargins(mScrollView.getLeft(), mBannerAds.getHeight(), mScrollView.getRight(), helperMethod.pxFromDp(30)); layoutParams.setMargins(mScrollView.getLeft(), mBannerAds.getHeight(), mScrollView.getRight(), helperMethod.pxFromDp(30));
} else { } else {
@ -972,7 +975,7 @@ class homeViewController {
} }
} }
void downloadNotification(String message, enums.etype e_type) { void downloadNotification(String message, homeEnums.eHomeViewCallback e_type) {
if (popupWindow != null) { if (popupWindow != null) {
popupWindow.dismiss(); popupWindow.dismiss();
@ -1005,7 +1008,7 @@ class homeViewController {
Button btn = popupView.findViewById(R.id.notification_event); Button btn = popupView.findViewById(R.id.notification_event);
btn.setOnClickListener(v -> btn.setOnClickListener(v ->
{ {
mEvent.invokeObserver(Collections.singletonList(status.sSettingDefaultSearchEngine), enums.etype.progress_update); mEvent.invokeObserver(Collections.singletonList(status.sSettingDefaultSearchEngine), homeEnums.eHomeViewCallback.PROGRESS_UPDATE);
popupWindow.dismiss(); popupWindow.dismiss();
}); });
@ -1045,7 +1048,7 @@ class homeViewController {
void updateBannerAdvertStatus(boolean status, boolean pIsAdvertLoaded) { void updateBannerAdvertStatus(boolean status, boolean pIsAdvertLoaded) {
if (!isFullScreen) { if (!isFullScreen) {
Object mCurrentURL = mEvent.invokeObserver(null, enums.etype.M_GET_CURRENT_URL); Object mCurrentURL = mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_GET_CURRENT_URL);
if (status && pIsAdvertLoaded) { if (status && pIsAdvertLoaded) {
if (mBannerAds.getAlpha() == 0) { if (mBannerAds.getAlpha() == 0) {
mBannerAds.animate().cancel(); mBannerAds.animate().cancel();
@ -1070,7 +1073,7 @@ class homeViewController {
if (isLandscape) { if (isLandscape) {
mBannerAds.setVisibility(View.GONE); mBannerAds.setVisibility(View.GONE);
} else { } else {
mEvent.invokeObserver(null, enums.etype.M_ON_BANNER_UPDATE); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_ON_BANNER_UPDATE);
} }
onFullScreen(false); onFullScreen(false);
} }
@ -1123,6 +1126,7 @@ class homeViewController {
} }
public void onUpdateStatusBarTheme(String pTheme, boolean mForced) { public void onUpdateStatusBarTheme(String pTheme, boolean mForced) {
if (mSplashScreen.getAlpha() <= 0 && (status.sTheme != enums.Theme.THEME_DARK && mTabFragment.getAlpha() <= 0 || mForced)) { if (mSplashScreen.getAlpha() <= 0 && (status.sTheme != enums.Theme.THEME_DARK && mTabFragment.getAlpha() <= 0 || mForced)) {
if (status.sDefaultNightMode && status.sTheme == enums.Theme.THEME_DEFAULT) { if (status.sDefaultNightMode && status.sTheme == enums.Theme.THEME_DEFAULT) {
return; return;
@ -1286,19 +1290,19 @@ class homeViewController {
if (mSearchEngineBar.getAlpha() == 0 || mSearchEngineBar.getVisibility() == View.GONE && mSplashScreen.getAlpha() <= 0) { if (mSearchEngineBar.getAlpha() == 0 || mSearchEngineBar.getVisibility() == View.GONE && mSplashScreen.getAlpha() <= 0) {
onUpdateStatusBarTheme(null, false); onUpdateStatusBarTheme(null, false);
mSearchEngineBar.animate().cancel(); mSearchEngineBar.animate().cancel();
mSearchEngineBar.setAlpha(1f); mSearchEngineBar.setAlpha(0.6f);
mSearchEngineBar.animate().setDuration(delay).alpha(1); mSearchEngineBar.animate().setDuration(100).alpha(1);
mSearchEngineBar.setVisibility(View.VISIBLE); mSearchEngineBar.setVisibility(View.VISIBLE);
} }
} else { } else {
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_UPDATE_THEME);
mSearchEngineBar.animate().setDuration(delay).setStartDelay(0).alpha(0).withEndAction(() -> { mSearchEngineBar.animate().setDuration(delay).setStartDelay(0).alpha(0).withEndAction(() -> {
mSearchEngineBar.animate().cancel(); mSearchEngineBar.animate().cancel();
mSearchEngineBar.setAlpha(0f); mSearchEngineBar.setAlpha(0f);
mSearchEngineBar.setVisibility(View.GONE); mSearchEngineBar.setVisibility(View.GONE);
mEvent.invokeObserver(null, enums.etype.M_RESET_SUGGESTION); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_RESET_SUGGESTION);
}); });
}, 0); }, 0);
} }
@ -1448,7 +1452,7 @@ class homeViewController {
progressAnimator.start(); progressAnimator.start();
} }
public void onNewTabAnimation(List<Object> data, Object e_type) { public void onNewTabAnimation(List<Object> data, Object e_type, int pDelay) {
if (mNewTabBlocker.getAlpha() != 0) { if (mNewTabBlocker.getAlpha() != 0) {
return; return;
@ -1457,7 +1461,7 @@ class homeViewController {
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
onResetTabAnimation(); onResetTabAnimation();
}, 500); }, pDelay);
mGeckoView.setPivotX(0); mGeckoView.setPivotX(0);
mGeckoView.setPivotY(0); mGeckoView.setPivotY(0);
@ -1616,7 +1620,7 @@ class homeViewController {
mDefaultColor = mContext.getWindow().getNavigationBarColor(); mDefaultColor = mContext.getWindow().getNavigationBarColor();
mContext.getWindow().setNavigationBarColor(Color.BLACK); mContext.getWindow().setNavigationBarColor(Color.BLACK);
mEvent.invokeObserver(Collections.singletonList(true), enums.etype.on_full_screen_ads); mEvent.invokeObserver(Collections.singletonList(true), homeEnums.eHomeViewCallback.on_full_screen_ads);
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
@ -1666,7 +1670,7 @@ class homeViewController {
params.setMargins(0, 0, 0, -helperMethod.pxFromDp(120)); params.setMargins(0, 0, 0, -helperMethod.pxFromDp(120));
} else { } else {
if (mBannerAds.getHeight() > 0 && mBannerAds.getVisibility() == View.VISIBLE) { if (mBannerAds.getHeight() > 0 && mBannerAds.getVisibility() == View.VISIBLE) {
Object mAdvertLoaded = mEvent.invokeObserver(null, enums.etype.M_ADVERT_LOADED); Object mAdvertLoaded = mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_ADVERT_LOADED);
if (mAdvertLoaded != null && (boolean) mAdvertLoaded) { if (mAdvertLoaded != null && (boolean) mAdvertLoaded) {
params.setMargins(0, 0, 0, -helperMethod.pxFromDp(170)); params.setMargins(0, 0, 0, -helperMethod.pxFromDp(170));
} else { } else {
@ -1702,7 +1706,7 @@ class homeViewController {
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
mContext.getWindow().setNavigationBarColor(mDefaultColor); mContext.getWindow().setNavigationBarColor(mDefaultColor);
Object mAdvertLoaded = mEvent.invokeObserver(null, enums.etype.M_ADVERT_LOADED); Object mAdvertLoaded = mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_ADVERT_LOADED);
if (mBannerAds.getHeight() > 0 && mAdvertLoaded != null && (boolean) mAdvertLoaded) { if (mBannerAds.getHeight() > 0 && mAdvertLoaded != null && (boolean) mAdvertLoaded) {
mBannerAds.setVisibility(View.VISIBLE); mBannerAds.setVisibility(View.VISIBLE);
} }
@ -1713,8 +1717,8 @@ class homeViewController {
mProgressBar.setVisibility(View.VISIBLE); mProgressBar.setVisibility(View.VISIBLE);
mTopBar.setVisibility(View.VISIBLE); mTopBar.setVisibility(View.VISIBLE);
mEvent.invokeObserver(Collections.singletonList(!isLandscape), enums.etype.on_init_ads); mEvent.invokeObserver(Collections.singletonList(!isLandscape), homeEnums.eHomeViewCallback.ON_INIT_ADS);
mEvent.invokeObserver(Collections.singletonList(isLandscape), enums.etype.on_full_screen_ads); mEvent.invokeObserver(Collections.singletonList(isLandscape), homeEnums.eHomeViewCallback.on_full_screen_ads);
status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING, false)); status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING, false));
@ -1743,9 +1747,8 @@ class homeViewController {
} }
public void onFullScreen(boolean pForced) { public void onFullScreen(boolean pForced) {
Object mAdvertLoaded = mEvent.invokeObserver(null, enums.etype.M_ADVERT_LOADED); Object mAdvertLoaded = mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_ADVERT_LOADED);
Object mCurrentURL = mEvent.invokeObserver(null, enums.etype.M_GET_CURRENT_URL); Object mCurrentURL = mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_GET_CURRENT_URL);
Object wasErrorPage = mEvent.invokeObserver(null, enums.etype.M_IS_ERROR_PAGE);
if (mProgressBar.getProgress() > 0 && mProgressBar.getProgress() < 100 && !pForced) { if (mProgressBar.getProgress() > 0 && mProgressBar.getProgress() < 100 && !pForced) {
mWebviewContainer.setPadding(0, 0, 0, 0); mWebviewContainer.setPadding(0, 0, 0, 0);
@ -1770,9 +1773,6 @@ class homeViewController {
if (mAdvertLoaded != null && (boolean) mAdvertLoaded) { if (mAdvertLoaded != null && (boolean) mAdvertLoaded) {
if (mCurrentURL != null) { if (mCurrentURL != null) {
String mURL = (String) mCurrentURL; String mURL = (String) mCurrentURL;
if ((wasErrorPage != null && (boolean) wasErrorPage)) {
mWebviewContainer.setPadding(0, 0, 0, helperMethod.pxFromDp(60 + 60));
} else {
int orientation = mContext.getResources().getConfiguration().orientation; int orientation = mContext.getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) { if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
mWebviewContainer.setPadding(0, 0, 0, helperMethod.pxFromDp(60 + 60)); mWebviewContainer.setPadding(0, 0, 0, helperMethod.pxFromDp(60 + 60));
@ -1780,7 +1780,6 @@ class homeViewController {
mWebviewContainer.setPadding(0, 0, 0, helperMethod.pxFromDp(60) + helperMethod.pxFromDp(50) + mTopBar.getHeight()); mWebviewContainer.setPadding(0, 0, 0, helperMethod.pxFromDp(60) + helperMethod.pxFromDp(50) + mTopBar.getHeight());
} }
} }
}
} else { } else {
mWebviewContainer.setPadding(0, 0, 0, helperMethod.pxFromDp(60 + 60)); mWebviewContainer.setPadding(0, 0, 0, helperMethod.pxFromDp(60 + 60));
} }
@ -1812,16 +1811,16 @@ class homeViewController {
@Override @Override
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
if (msg.what == messages.MESSAGE_ON_URL_LOAD) { if (msg.what == messages.MESSAGE_ON_URL_LOAD) {
if (mEvent.invokeObserver(null, enums.etype.M_HOME_PAGE) == null) { if (mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_HOME_PAGE) == null) {
mEvent.invokeObserver(null, enums.etype.M_PRELOAD_URL); mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_PRELOAD_URL);
if (status.sSettingRedirectStatus.equals(strings.GENERIC_EMPTY_STR)) { if (status.sSettingRedirectStatus.equals(strings.GENERIC_EMPTY_STR)) {
mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingDefaultSearchEngine)), enums.etype.on_url_load); mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingDefaultSearchEngine)), homeEnums.eHomeViewCallback.on_url_load);
} else { } else {
mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingRedirectStatus)), enums.etype.on_url_load); mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingRedirectStatus)), homeEnums.eHomeViewCallback.on_url_load);
} }
} }
if (!status.sExternalWebsite.equals(strings.GENERIC_EMPTY_STR)) { if (!status.sExternalWebsite.equals(strings.GENERIC_EMPTY_STR)) {
mEvent.invokeObserver(Collections.singletonList(status.sExternalWebsite), enums.etype.open_new_tab_instant); mEvent.invokeObserver(Collections.singletonList(status.sExternalWebsite), homeEnums.eHomeViewCallback.OPEN_NEW_TAB_INSTANT);
} }
status.sSettingIsAppStarted = true; status.sSettingIsAppStarted = true;

View File

@ -1,25 +1,21 @@
package com.hiddenservices.onionservices.appManager.languageManager; package com.hiddenservices.onionservices.appManager.languageManager;
import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
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 androidx.recyclerview.widget.SimpleItemAnimator; import androidx.recyclerview.widget.SimpleItemAnimator;
import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.helpManager.helpController; import com.hiddenservices.onionservices.appManager.helpManager.helpController;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController;
import com.hiddenservices.onionservices.constants.constants; import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.keys; import com.hiddenservices.onionservices.constants.keys;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.dataManager.dataController; import com.hiddenservices.onionservices.dataManager.dataController;
@ -30,22 +26,17 @@ import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController; import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums; import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.hiddenservices.onionservices.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import static com.hiddenservices.onionservices.appManager.languageManager.languageEnums.eLanguageModel.M_ACTIVE_LANGUAGE; import static com.hiddenservices.onionservices.appManager.languageManager.languageEnums.eLanguageModel.M_ACTIVE_LANGUAGE;
import static com.hiddenservices.onionservices.constants.constants.CONST_LANGUAGE_DEFAULT_LANG; import static com.hiddenservices.onionservices.constants.constants.CONST_LANGUAGE_DEFAULT_LANG;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eLangManager.M_SUPPORTED_SYSTEM_LANGUAGE_INFO; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eLangManager.M_SUPPORTED_SYSTEM_LANGUAGE_INFO;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_LANGUAGE_SUPPORT_FAILURE;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_LOW_MEMORY;
import org.torproject.android.service.wrapper.orbotLocalConstants;
@SuppressLint("NotifyDataSetChanged")
public class languageController extends AppCompatActivity { public class languageController extends AppCompatActivity {
/*Private Variables*/ /*Private Variables*/
@ -141,10 +132,6 @@ public class languageController extends AppCompatActivity {
/*Helper Methods*/ /*Helper Methods*/
private boolean changeLanguage(String pLanguageCode, String pLanguageRegion) { private boolean changeLanguage(String pLanguageCode, String pLanguageRegion) {
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){
pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_LOW_MEMORY);
return false;
}
boolean mDefaultLanguageNotSupported = false; boolean mDefaultLanguageNotSupported = false;
if (pLanguageCode.equals(CONST_LANGUAGE_DEFAULT_LANG)) { if (pLanguageCode.equals(CONST_LANGUAGE_DEFAULT_LANG)) {
Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; Locale mSystemLocale = Resources.getSystem().getConfiguration().locale;

View File

@ -30,7 +30,7 @@ class languageModel {
mSupportedLanaguage.add(new languageDataModel("韓国語", "Korean", "ko", "Kr")); mSupportedLanaguage.add(new languageDataModel("韓国語", "Korean", "ko", "Kr"));
mSupportedLanaguage.add(new languageDataModel("Português", "Portuguese (Portugal)", "pt", "Pt")); mSupportedLanaguage.add(new languageDataModel("Português", "Portuguese (Portugal)", "pt", "Pt"));
mSupportedLanaguage.add(new languageDataModel("Română", "Romanian", "ro", "Ro")); mSupportedLanaguage.add(new languageDataModel("Română", "Romanian", "ro", "Ro"));
mSupportedLanaguage.add(new languageDataModel("Urdu (اردو)", "Urdu", "ur", "Ur")); // mSupportedLanaguage.add(new languageDataModel("Urdu (اردو)", "Urdu", "ur", "Ur"));
mSupportedLanaguage.add(new languageDataModel("русский", "Russian", "ru", "Ru")); mSupportedLanaguage.add(new languageDataModel("русский", "Russian", "ru", "Ru"));
mSupportedLanaguage.add(new languageDataModel("ไทย", "Thai", "th", "Th")); mSupportedLanaguage.add(new languageDataModel("ไทย", "Thai", "th", "Th"));
mSupportedLanaguage.add(new languageDataModel("Türk", "Turkish", "tr", "Tr")); mSupportedLanaguage.add(new languageDataModel("Türk", "Turkish", "tr", "Tr"));

View File

@ -33,7 +33,6 @@ class languageViewController {
} }
private void initPostUI() { private void initPostUI() {
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);
@ -47,7 +46,6 @@ class languageViewController {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
} }
} }
}
private void initBlocker(boolean pStatus) { private void initBlocker(boolean pStatus) {
if (pStatus) { if (pStatus) {

View File

@ -66,7 +66,7 @@ public class orbotLogAdapter extends RecyclerView.Adapter<orbotLogAdapter.listVi
mOrbotRowDescription = itemView.findViewById(R.id.pOrbotRowDescription); mOrbotRowDescription = itemView.findViewById(R.id.pOrbotRowDescription);
mOrbotRowContainer = itemView.findViewById(R.id.pOrbotRowContainer); mOrbotRowContainer = itemView.findViewById(R.id.pOrbotRowContainer);
String mLog = (this.getLayoutPosition() + ". " + model.getLog()); String mLog = (this.getLayoutPosition()+1 + ". " + model.getLog());
mOrbotRowHeader.setText(mLog); mOrbotRowHeader.setText(mLog);
mOrbotRowDescription.setText(model.getDate()); mOrbotRowDescription.setText(model.getDate());
mOrbotRowContainer.setOnClickListener(this); mOrbotRowContainer.setOnClickListener(this);

View File

@ -2,22 +2,16 @@ package com.hiddenservices.onionservices.appManager.orbotLogManager;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.constants.constants; import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.torproject.android.service.wrapper.logRowModel; import org.torproject.android.service.wrapper.logRowModel;
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.List; import java.util.List;
import static com.hiddenservices.onionservices.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_FLOATING_BUTTON; import static com.hiddenservices.onionservices.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_FLOATING_BUTTON;
import static com.hiddenservices.onionservices.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_LOGS; import static com.hiddenservices.onionservices.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_LOGS;
import static com.hiddenservices.onionservices.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_RECYCLE_VIEW; import static com.hiddenservices.onionservices.appManager.orbotLogManager.orbotLogEnums.eOrbotLogModelCallbackCommands.M_UPDATE_RECYCLE_VIEW;

View File

@ -1,17 +1,11 @@
package com.hiddenservices.onionservices.appManager; package com.hiddenservices.onionservices.appManager;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static com.hiddenservices.onionservices.constants.keys.EXTERNAL_SHORTCUT_COMMAND_NAVIGATE;
import android.content.Intent; import android.content.Intent;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController; import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController;
import com.hiddenservices.onionservices.constants.constants; import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.torproject.android.service.wrapper.orbotExternalCommands; import org.torproject.android.service.wrapper.orbotExternalCommands;
@ -40,5 +34,4 @@ public class orbotRequestManager extends AppCompatActivity{
} }
} }
} }
} }

View File

@ -47,7 +47,6 @@ class settingAccessibilityViewController {
} }
private void initPostUI() { private void initPostUI() {
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);
@ -61,7 +60,6 @@ class settingAccessibilityViewController {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
} }
} }
}
private void initViews() { private void initViews() {
if (status.sSettingEnableZoom) { if (status.sSettingEnableZoom) {
@ -83,7 +81,8 @@ class settingAccessibilityViewController {
mSeekBarSample.setTextSize((int) ((12 * percentage) / 100)); mSeekBarSample.setTextSize((int) ((12 * percentage) / 100));
} }
mScalePercentage.setText(((int) percentage + constants.CONST_PERCENTAGE_SIGN)); String mText = (int) percentage + constants.CONST_PERCENTAGE_SIGN;
mScalePercentage.setText(mText);
mSeekBar.setAlpha(1f); mSeekBar.setAlpha(1f);
mScalePercentage.setAlpha(1f); mScalePercentage.setAlpha(1f);
mSeekBarSample.setAlpha(1f); mSeekBarSample.setAlpha(1f);

View File

@ -1,13 +0,0 @@
package com.hiddenservices.onionservices.appManager.settingManager.advertSetttings.advertResources;
public class advert_constants {
public static boolean S_INSENSITIVE_CATEGORIES = false;
public static boolean S_APP_REDIRECTION = false;
public static boolean S_SEARCH_RESULTS = false;
public static boolean S_SENSOR_ADVERTISEMENT = false;
public static boolean S_NON_TRACKABLE_ADVERTISEMENT = false;
public static boolean S_VIDEO_ADVERTISEMENT = false;
public static boolean S_AUTHORIZED_ADVERTISERS = false;
public static boolean S_ERROR_REPORTING = false;
public static boolean S_NATIVE_ADVERTISERS = false;
}

View File

@ -1,156 +0,0 @@
package com.hiddenservices.onionservices.appManager.settingManager.advertSetttings;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.helpManager.helpController;
import com.hiddenservices.onionservices.appManager.settingManager.advertSetttings.advertResources.advert_constants;
import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class advertSettingController extends AppCompatActivity {
/* UI Variables */
/* Private Variables */
private advertSettingModel mAdvertSettingModel;
private advertSettingViewController mAdvertSettingViewController;
private ArrayList<com.google.android.material.switchmaterial.SwitchMaterial> mSwitchButton = new ArrayList<>();
/* Initializations */
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
activityContextManager.getInstance().onStack(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_advert_view);
initializeViews();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
if (newConfig.uiMode != getResources().getConfiguration().uiMode) {
activityContextManager.getInstance().onResetTheme();
activityThemeManager.getInstance().onConfigurationChanged(this);
}
}
private void initializeViews() {
mSwitchButton.add(findViewById(R.id.pAdOptionSwitch1));
mSwitchButton.add(findViewById(R.id.pAdOptionSwitch2));
mSwitchButton.add(findViewById(R.id.pAdOptionSwitch3));
mSwitchButton.add(findViewById(R.id.pAdOptionSwitch4));
mSwitchButton.add(findViewById(R.id.pAdOptionSwitch5));
mSwitchButton.add(findViewById(R.id.pAdOptionSwitch6));
mSwitchButton.add(findViewById(R.id.pAdOptionSwitch7));
mSwitchButton.add(findViewById(R.id.pAdOptionSwitch8));
mSwitchButton.add(findViewById(R.id.pAdOptionSwitch9));
mAdvertSettingViewController = new advertSettingViewController(this, new settingLogViewCallback(), mSwitchButton);
mAdvertSettingModel = new advertSettingModel(new settingLogModelCallback());
}
/*View Callbacks*/
private class settingLogViewCallback implements eventObserver.eventListener {
@Override
public Object invokeObserver(List<Object> pData, Object pCommands) {
return null;
}
}
/*Model Callbacks*/
private class settingLogModelCallback implements eventObserver.eventListener {
@Override
public Object invokeObserver(List<Object> pData, Object pCommands) {
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume() {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onBackPressed() {
onClose(null);
}
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
/*UI Redirection*/
public void onClose(View view) {
finish();
}
public void onTriggerUI(View view) {
if (view.getId() == R.id.pAdOption1) {
mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(0));
advert_constants.S_INSENSITIVE_CATEGORIES = mSwitchButton.get(0).isChecked();
} else if (view.getId() == R.id.pAdOption2) {
mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(1));
advert_constants.S_APP_REDIRECTION = mSwitchButton.get(1).isChecked();
} else if (view.getId() == R.id.pAdOption3) {
mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(2));
advert_constants.S_SEARCH_RESULTS = mSwitchButton.get(2).isChecked();
} else if (view.getId() == R.id.pAdOption4) {
mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(3));
advert_constants.S_SENSOR_ADVERTISEMENT = mSwitchButton.get(3).isChecked();
} else if (view.getId() == R.id.pAdOption5) {
mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(4));
advert_constants.S_NON_TRACKABLE_ADVERTISEMENT = mSwitchButton.get(4).isChecked();
} else if (view.getId() == R.id.pAdOption6) {
mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(5));
advert_constants.S_VIDEO_ADVERTISEMENT = mSwitchButton.get(5).isChecked();
} else if (view.getId() == R.id.pAdOption7) {
mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(6));
advert_constants.S_AUTHORIZED_ADVERTISERS = mSwitchButton.get(6).isChecked();
} else if (view.getId() == R.id.pAdOption8) {
mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(7));
advert_constants.S_ERROR_REPORTING = mSwitchButton.get(7).isChecked();
} else if (view.getId() == R.id.pAdOption9) {
mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(8));
advert_constants.S_NATIVE_ADVERTISERS = mSwitchButton.get(8).isChecked();
}
}
public void onOpenInfo(View view) {
helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this, true);
}
}

View File

@ -1,14 +0,0 @@
package com.hiddenservices.onionservices.appManager.settingManager.advertSetttings;
class advertSettingEnums {
/* Log Model */
public enum eAdvertSettingModel {
}
/* Log View Controller */
public enum eAdvertSettingViewController {
M_TOGGLE_SWITCH
}
}

View File

@ -1,24 +0,0 @@
package com.hiddenservices.onionservices.appManager.settingManager.advertSetttings;
import com.hiddenservices.onionservices.eventObserver;
import java.util.List;
class advertSettingModel {
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
advertSettingModel(eventObserver.eventListener mEvent) {
this.mEvent = mEvent;
}
/*Helper Methods*/
public Object onTrigger(advertSettingEnums.eAdvertSettingModel pCommands, List<Object> pData) {
return null;
}
}

View File

@ -1,82 +0,0 @@
package com.hiddenservices.onionservices.appManager.settingManager.advertSetttings;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.switchmaterial.SwitchMaterial;
import com.hiddenservices.onionservices.appManager.settingManager.advertSetttings.advertResources.advert_constants;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.sharedUIMethod;
import java.util.ArrayList;
import java.util.List;
class advertSettingViewController {
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private ArrayList<SwitchMaterial> mSwitchButton;
/*Initializations*/
advertSettingViewController(advertSettingController pContext, eventObserver.eventListener pEvent, ArrayList<com.google.android.material.switchmaterial.SwitchMaterial> pSwitchButton) {
this.mEvent = pEvent;
this.mContext = pContext;
this.mSwitchButton = pSwitchButton;
initPostUI();
initViews();
}
private void initViews() {
if (advert_constants.S_INSENSITIVE_CATEGORIES) {
mSwitchButton.get(0).toggle();
}
if (advert_constants.S_APP_REDIRECTION) {
mSwitchButton.get(1).toggle();
}
if (advert_constants.S_SEARCH_RESULTS) {
mSwitchButton.get(2).toggle();
}
if (advert_constants.S_SENSOR_ADVERTISEMENT) {
mSwitchButton.get(3).toggle();
}
if (advert_constants.S_NON_TRACKABLE_ADVERTISEMENT) {
mSwitchButton.get(4).toggle();
}
if (advert_constants.S_VIDEO_ADVERTISEMENT) {
mSwitchButton.get(5).toggle();
}
if (advert_constants.S_AUTHORIZED_ADVERTISERS) {
mSwitchButton.get(6).toggle();
}
if (advert_constants.S_ERROR_REPORTING) {
mSwitchButton.get(7).toggle();
}
if (advert_constants.S_NATIVE_ADVERTISERS) {
mSwitchButton.get(8).toggle();
}
}
/*Helper Methods*/
private void initPostUI() {
sharedUIMethod.updateStatusBar(mContext);
}
private void onToggleSwitch(int m_id) {
mSwitchButton.get(m_id).toggle();
}
/*Triggers*/
public Object onTrigger(advertSettingEnums.eAdvertSettingViewController pCommands, List<Object> pData) {
if (pCommands.equals(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH)) {
onToggleSwitch((int) pData.get(0));
}
return null;
}
public Object onTrigger(advertSettingEnums.eAdvertSettingViewController pCommands) {
return onTrigger(pCommands, null);
}
}

View File

@ -35,7 +35,6 @@ class settingClearViewController {
} }
private void initPostUI() { private void initPostUI() {
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);
@ -49,7 +48,6 @@ class settingClearViewController {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
} }
} }
}
private void onClearCheckbox(int pIndex, boolean pStatus) { private void onClearCheckbox(int pIndex, boolean pStatus) {
mCheckBoxList.get(pIndex).setChecked(pStatus); mCheckBoxList.get(pIndex).setChecked(pStatus);

View File

@ -67,23 +67,6 @@ public class settingGeneralController extends AppCompatActivity {
viewsInitializations(); viewsInitializations();
} }
private void onInitTheme() {
if (status.mThemeApplying) {
if (status.sTheme == enums.Theme.THEME_DARK) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
} else if (status.sTheme == enums.Theme.THEME_LIGHT) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
} else {
if (!status.sDefaultNightMode) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
} else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
}
}
}
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
@ -233,7 +216,7 @@ public class settingGeneralController extends AppCompatActivity {
} }
public void onSelectTheme(View view) { public void onSelectTheme(View view) {
if(status.sLowMemory != enums.MemoryStatus.STABLE){ if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){
pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_LOW_MEMORY); pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_LOW_MEMORY);
return; return;
} }

View File

@ -55,7 +55,6 @@ class settingGeneralViewController {
private void initPostUI() { private void initPostUI() {
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);
@ -69,7 +68,6 @@ class settingGeneralViewController {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
} }
} }
}
private void initViews() { private void initViews() {
resetThemeSelection(); resetThemeSelection();

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