Bug Fixes

Bug Fixes
master
Abdul Mannan Saeed 2023-02-09 12:55:22 +05:00
parent 617083f48f
commit faac9cd676
105 changed files with 2873 additions and 2983 deletions

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\msman\.android\avd\Nexus_6P_API_33.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-02-07T21:45:12.561778Z" />
</component>
</project>

View File

@ -1,3 +1,3 @@
#Sat Feb 04 14:33:30 PKT 2023 #Thu Feb 09 03:08:42 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=2027486056 json=-1378969876

View File

@ -1,5 +1,5 @@
# #
#Sat Feb 04 14:33:30 PKT 2023 #Thu Feb 09 03:08:42 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.3
set_multidex=true set_multidex=true

View File

@ -3,15 +3,14 @@ import com.android.build.OutputFile
plugins { plugins {
id "com.jetbrains.python.envs" version "0.0.26" id "com.jetbrains.python.envs" version "0.0.26"
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: 'variables.gradle' apply from: 'variables.gradle'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'applovin-quality-service' apply plugin: 'applovin-quality-service'
applovin {
apiKey "pCPe4EeU2ZQVwQPeHLgseRqHBX1V5pvo9Piuu4J809dRhadEgukXa1A8po_UeXu5hmPOTaP1v4QPaMKIEOhh50"
}
applovin {
apiKey project.ext.applovin_key
}
android { android {
@ -30,7 +29,7 @@ android {
} }
} }
kotlinOptions { kotlinOptions {
jvmTarget = "1.8" jvmTarget = project.ext.jvmTarget
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
@ -76,7 +75,7 @@ android {
orionRelease.root = project.ext.releaseRoot orionRelease.root = project.ext.releaseRoot
} }
namespace 'com.example.myapplication' namespace project.ext.application_id
} }
dependencies { dependencies {
@ -105,7 +104,7 @@ dependencies {
/* Ads Manager */ /* Ads Manager */
implementation 'com.applovin:applovin-sdk:11.7.0' implementation 'com.applovin:applovin-sdk:11.7.0'
implementation 'com.facebook.android:audience-network-sdk:6.10.0' implementation 'com.facebook.android:audience-network-sdk:6.12.0'
implementation 'com.applovin.mediation:facebook-adapter:6.12.0.1' implementation 'com.applovin.mediation:facebook-adapter:6.12.0.1'
/* Orbot Service */ /* Orbot Service */

View File

@ -1,3 +1 @@
#Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public.
#Wed May 01 00:42:45 PKT 2019
apiSecret=042501af0b2390b9f064ff9a0823e52a2dd04b2280c9b675925cebbb9620ecbf

View File

@ -1,35 +1,32 @@
-keep,includedescriptorclasses class net.sqlcipher.** { *; } -keep,includedescriptorclasses class net.sqlcipher.** { *; }
-keep,includedescriptorclasses interface net.sqlcipher.** { *; } -keep,includedescriptorclasses interface net.sqlcipher.** { *; }
-keep class org.mozilla.** {*;}
-keep class com.flurry.** { *; }
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-keepattributes Signature
-keepattributes Annotation
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); }
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-dontwarn javax.annotation.** -dontwarn javax.annotation.**
-dontwarn org.codehaus.mojo.animal_sniffer.* -dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn okhttp3.* -dontwarn okhttp3.*
-dontwarn org.chromium.net.* -dontwarn org.chromium.net.*
-keep class org.mozilla.** {*;}
-keep class com.flurry.** { *; }
-dontwarn com.flurry.** -dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-dontobfuscate
# https://stackoverflow.com/questions/9651703/using-proguard-with-android-without-obfuscation
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keep class org.orbotproject.android.service.vpn.Tun2Socks {
void logTun2Socks(java.lang.String, java.lang.String, java.lang.String);
}
-keepattributes Signature
-keepattributes Annotation
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.** -dontwarn okhttp3.**
-dontwarn okio.** -dontwarn okio.**
-dontobfuscate
-dontoptimize -dontoptimize
-dontpreverify -dontpreverify
# -dontwarn okhttp3.internal.platform.ConscryptPlatform
# -dontwarn org.conscrypt.ConscryptHostnameVerifier
# -keep class org.orbotproject.android.service.vpn.Tun2Socks {
# void logTun2Socks(java.lang.String, java.lang.String, java.lang.String);
# }

View File

@ -4,7 +4,7 @@ import static com.hiddenservices.onionservices.constants.constants.CONST_PACKAGE
import android.content.Context; import android.content.Context;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkHome.bookmarkController; import com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkHome.bookmarkController;
import com.hiddenservices.onionservices.appManager.bridgeManager.bridgeController; import com.hiddenservices.onionservices.appManager.bridgeManager.bridgeController;
import com.hiddenservices.onionservices.appManager.historyManager.historyController; import com.hiddenservices.onionservices.appManager.historyManager.historyController;

View File

@ -8,7 +8,7 @@ import android.webkit.WebChromeClient;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import java.util.Collections; import java.util.Collections;

View File

@ -6,7 +6,7 @@ import android.widget.ProgressBar;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.example.myapplication.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;

View File

@ -15,11 +15,12 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.constants.enums; import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings; import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.dataManager.models.bookmarkRowModel; import com.hiddenservices.onionservices.dataManager.models.bookmarkRowModel;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -446,10 +447,12 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mDescription.setText("https://" + mDescription.getText().toString()); mDescription.setText("https://" + mDescription.getText().toString());
} }
if (model.getDescription().contains("167.86.99.31") || model.getDescription().contains("orion.onion")) { if(status.sLowMemory != enums.MemoryStatus.LOW_MEMORY && status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){
mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis)); if (model.getDescription().contains("167.86.99.31") || model.getDescription().contains("orion.onion")) {
} else { mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis));
mEvent.invokeObserver(Arrays.asList(mFaviconLogo, "http://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon); } else {
mEvent.invokeObserver(Arrays.asList(mFaviconLogo, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon);
}
} }
mRowMenu.setOnClickListener(this::onClick); mRowMenu.setOnClickListener(this::onClick);

View File

@ -12,7 +12,7 @@ import androidx.appcompat.app.AppCompatActivity;
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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;

View File

@ -43,7 +43,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -30,7 +30,7 @@ import androidx.recyclerview.widget.RecyclerView;
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.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;

View File

@ -20,7 +20,7 @@ import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.sharedUIMethod; import com.hiddenservices.onionservices.helperManager.sharedUIMethod;
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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;

View File

@ -8,7 +8,7 @@ import androidx.appcompat.app.AppCompatActivity;
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.helperManager.sharedUIMethod; import com.hiddenservices.onionservices.helperManager.sharedUIMethod;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;

View File

@ -25,7 +25,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;

View File

@ -17,7 +17,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.strings; import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.helperManager.sharedUIMethod; import com.hiddenservices.onionservices.helperManager.sharedUIMethod;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;

View File

@ -13,7 +13,7 @@ import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings; import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.dataManager.dataController; import com.hiddenservices.onionservices.dataManager.dataController;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.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;

View File

@ -10,7 +10,7 @@ import android.os.Handler;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.advertManager.advertController; import com.hiddenservices.onionservices.appManager.advertManager.advertController;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController; import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController;

View File

@ -16,7 +16,7 @@ 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -25,7 +25,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;

View File

@ -14,7 +14,7 @@ import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;

View File

@ -21,7 +21,7 @@ import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.dataManager.models.historyRowModel; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.pluginManager.pluginController; import com.hiddenservices.onionservices.pluginManager.pluginController;
import java.util.ArrayList; import java.util.ArrayList;
@ -517,7 +517,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0) + "")); mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0) + ""));
String header = model.getHeader(); String header = model.getHeader();
if(status.sLowMemory == enums.MemoryStatus.STABLE){ 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 {

View File

@ -12,7 +12,7 @@ import androidx.appcompat.app.AppCompatActivity;
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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;

View File

@ -41,7 +41,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -30,7 +30,7 @@ import androidx.recyclerview.widget.RecyclerView;
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.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;

View File

@ -1,56 +0,0 @@
# Contents of /data/local/tmp/com.yourcompany.yourapp-geckoview-config.yaml
env:
MOZ_LOG: nsHttp:5
prefs:
network.proxy.type: 1
# network.proxy.socks: "127.0.0.1"
# network.proxy.socks_port: 9050
network.proxy.socks_version: 5
network.proxy.socks_remote_dns: true
permissions.default.image: 1
browser.display.show_image_placeholders: true
browser.cache.disk.enable: false
browser.cache.memory.enable: true
browser.cache.disk.capacity: 0
privacy.resistFingerprinting: true
privacy.donottrackheader.enabled: false
privacy.donottrackheader.value: 1
network.http.sendRefererHeader: 0
security.checkloaduri: false
security.mixed_content.block_active_content: false
security.mixed_content.block_display_content: false
media.peerconnection.enabled: false //webrtc disabled
browser.cache.disk_cache_ssl: true
signon.formlessCapture.enabled: true
signon.storeWhenAutocompleteOff: true
dom.event.contextmenu.enabled: true
layout.css.visited_links_enabled: true
security.ssl3.ecdhe_rsa_aes_128_sha: true
security.ssl3.ecdhe_ecdsa_aes_128_sha: true
security.ssl3.dhe_rsa_aes_128_sha: true
security.ssl3.rsa_des_ede3_sha: true
security.ssl3.dhe_rsa_aes_256_sha: true
browser.safebrowsing.blockedURIs.enabled: false
media.gmp-provider.enabled: false
browser.send_pings.require_same_host: false
webgl.disabled: false
pdfjs.enableWebGL: false
browser.safebrowsing.malware.enabled: false
security.csp.experimentalEnabled: false
network.http.referer.spoofSource: false
security.OCSP.require: false
security.ssl.require_safe_negotiation: false
privacy.clearOnShutdown.cache: true
privacy.clearOnShutdown.downloads: true
privacy.clearOnShutdown.formdata: true
privacy.clearOnShutdown.history: true
privacy.clearOnShutdown.offlineApps: true
privacy.clearOnShutdown.passwords: true
privacy.clearOnShutdown.sessions: true
privacy.clearOnShutdown.siteSettings: true

View File

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

View File

@ -0,0 +1,57 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.view.autofill.AutofillManager;
import androidx.annotation.NonNull;
import org.mozilla.geckoview.Autofill;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView;
public class autofillDelegate implements Autofill.Delegate {
private GeckoView mGeckoView;
public autofillDelegate(GeckoView pGeckoView){
mGeckoView = pGeckoView;
}
private Rect displayRectForId(@NonNull final GeckoSession session, @NonNull final Autofill.Node node) {
final Matrix matrix = new Matrix();
final RectF rectF = new RectF(node.getDimensions());
session.getPageToScreenMatrix(matrix);
matrix.mapRect(rectF);
final Rect screenRect = new Rect();
rectF.roundOut(screenRect);
return screenRect;
}
@Override
public void 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 = mGeckoView.getContext().getSystemService(AutofillManager.class);
if (manager == null) {
return;
}
manager.notifyViewEntered(mGeckoView, 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 = mGeckoView.getContext().getSystemService(AutofillManager.class);
if (manager == null) {
return;
}
manager.notifyViewEntered(mGeckoView, data.getId(),displayRectForId(session, node));
}
}
}

View File

@ -0,0 +1,218 @@
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_WITH_LINK;
import android.content.ActivityNotFoundException;
import android.os.Handler;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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.geckoDownloadManager;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.json.JSONObject;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.WebResponse;
import java.lang.ref.WeakReference;
import java.util.Arrays;
public class contentDelegate implements GeckoSession.ContentDelegate {
/*Private Variables*/
private WeakReference<AppCompatActivity> mContext;
private eventObserver.eventListener mEvent;
private geckoDataModel mGeckoDataModel;
private geckoSession mGeckoSession;
private geckoDownloadManager mDownloadManager;
private int mCrashCount = 0;
/*Initializations*/
public contentDelegate(WeakReference<AppCompatActivity> pContext, eventObserver.eventListener pEvent, geckoDataModel pGeckoDataModel, geckoSession pGeckoSession) {
this.mContext = pContext;
this.mEvent = pEvent;
this.mGeckoDataModel = pGeckoDataModel;
this.mGeckoSession = pGeckoSession;
mDownloadManager = new geckoDownloadManager();
}
/*Local Listeners*/
@UiThread
public void onTitleChange(@NonNull GeckoSession var1, @Nullable String var2) {
if (var2 != null && !var2.equals(strings.GENERIC_EMPTY_STR) && var2.length() > 2 && !var2.equals("about:blank")) {
mGeckoDataModel.mCurrentTitle = var2;
}
}
@Override
public void onFullScreen(@NonNull GeckoSession var1, boolean var2) {
mGeckoDataModel.mFullScreenStatus = var2;
mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), enums.etype.ON_FULL_SCREEN);
}
@UiThread
@Override
public void onContextMenu(@NonNull GeckoSession var1, int var2, int var3, @NonNull GeckoSession.ContentDelegate.ContextElement var4) {
String title = strings.GENERIC_EMPTY_STR;
if (var4.title != null) {
title = var4.title;
}
if (var4.type != 0 && var4.srcUri != 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);
} else {
try {
String mTitle = var4.title;
if (mTitle == null || mTitle.length() <= 0) {
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);
} catch (Exception ex) {
ex.printStackTrace();
Log.i("", "");
}
}
} else if (var4.linkUri != null) {
mEvent.invokeObserver(Arrays.asList(var4.linkUri, mGeckoDataModel.mSessionID, title, mGeckoDataModel.mTheme, mGeckoSession, mContext.get()), M_LONG_PRESS_URL);
}
}
@UiThread
@Override
public void onExternalResponse(@NonNull GeckoSession session, @NonNull WebResponse response) {
try {
if (response.headers.containsKey("Content-Disposition")) {
mDownloadManager.downloadFile(response, mGeckoSession, mContext.get(), mEvent);
} else if (response.headers.containsKey("Content-Type")) {
mDownloadManager.downloadFile(response, mGeckoSession, mContext.get(), mEvent);
}
} catch (ActivityNotFoundException e) {
mEvent.invokeObserver(Arrays.asList(response, mGeckoDataModel.mSessionID), enums.etype.on_handle_external_intent);
mGeckoSession.stop();
}
}
@UiThread
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")) {
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, 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);
}
@UiThread
public void onWebAppManifest(@NonNull GeckoSession var1, @NonNull JSONObject var2) {
try {
mGeckoDataModel.mThemeChanged = true;
mGeckoDataModel.mTheme = var2.getString("theme_color");
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) {
mGeckoDataModel.mTheme = null;
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), enums.etype.ON_UPDATE_THEME);
ex.printStackTrace();
}
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.ON_UPDATE_TAB_TITLE);
}
@UiThread
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);
if (!mGeckoSession.isClosed() && status.sSettingIsAppStarted) {
if (mEvent == null) {
return;
}
Object mSessionObject = mEvent.invokeObserver(null, enums.etype.SESSION_ID);
if (mSessionObject == null || mGeckoDataModel.mSessionID == null) {
return;
}
String mSessionID = (String) mSessionObject;
if (mSessionID.equals(mGeckoDataModel.mSessionID)) {
if (mCrashCount <= 5) {
final Handler handler = new Handler();
handler.postDelayed(() -> {
try {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), enums.etype.M_OPEN_SESSION);
} catch (Exception ignored) {
}
}, mCrashCount * 500L);
}
mCrashCount += 1;
}
}
}
@UiThread
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);
if (!mGeckoSession.isClosed() && status.sSettingIsAppStarted) {
if (mEvent == null) {
return;
}
Object mSessionObject = mEvent.invokeObserver(null, enums.etype.SESSION_ID);
if (mSessionObject == null || mGeckoDataModel.mSessionID == null) {
return;
}
String mSessionID = (String) mSessionObject;
if (mSessionID.equals(mGeckoDataModel.mSessionID)) {
if (mCrashCount <= 5) {
final Handler handler = new Handler();
handler.postDelayed(() -> {
if (status.sSettingIsAppStarted && !session.isOpen()) {
try {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), enums.etype.M_OPEN_SESSION);
} catch (Exception ignored) {
}
}
}, mCrashCount * 500L);
}
mCrashCount += 1;
}
}
}
/*Local Triggers*/
public boolean getFullScreenStatus() {
return !mGeckoDataModel.mFullScreenStatus;
}
public void resetCrash() {
mCrashCount = 0;
}
public geckoDownloadManager getDownloadManager(){
return this.mDownloadManager;
}
}

View File

@ -0,0 +1,76 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
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.geckoSession;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses.intentHandler;
import com.hiddenservices.onionservices.constants.enums;
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 historyDelegate implements GeckoSession.HistoryDelegate {
/*Private Variables*/
private WeakReference<AppCompatActivity> mContext;
private GeckoSession.HistoryDelegate.HistoryList mHistory = null;
private eventObserver.eventListener mEvent;
private geckoDataModel mGeckoDataModel;
private geckoSession mGeckoSession;
private int mCurrentIndex = 0;
/*Initializations*/
public historyDelegate(WeakReference<AppCompatActivity> pContext, eventObserver.eventListener pEvent, geckoDataModel pGeckoDataModel, geckoSession pGeckoSession) {
this.mContext = pContext;
this.mEvent = pEvent;
this.mGeckoDataModel = pGeckoDataModel;
this.mGeckoSession = pGeckoSession;
}
@UiThread
public void onHistoryStateChange(@NonNull GeckoSession var1, @NonNull GeckoSession.HistoryDelegate.HistoryList var2) {
mHistory = var2;
if(mHistory !=null){
setURL(mHistory.get(mHistory.getCurrentIndex()).getUri());
mEvent.invokeObserver(Arrays.asList(mHistory, mGeckoDataModel.mSessionID), enums.etype.on_url_load);
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);
}
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);
if (mID != null) {
mGeckoDataModel.mCurrentURL_ID = (int) mID;
}
}
mCurrentIndex = var2.getCurrentIndex();
}
/*Local Triggers*/
public void setURL(String pURL) {
if (helperMethod.getHost(pURL).endsWith(".onion")) {
pURL = pURL.replace("www.", "");
}
this.mGeckoDataModel.mCurrentURL = pURL;
if(pURL.startsWith("tel:")){
intentHandler.actionDial(pURL, mContext);
}
}
public boolean isHistoryEmpty(){
if(mHistory!=null && mHistory.size()>0){
return false;
}else {
return true;
}
}
}

View File

@ -1,126 +1,136 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager; package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import static android.content.Context.NOTIFICATION_SERVICE; import static android.content.Context.NOTIFICATION_SERVICE;
import android.app.Activity;
import android.app.Notification; import android.annotation.SuppressLint;
import android.app.NotificationChannel; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationChannel;
import android.app.PendingIntent; import android.app.NotificationManager;
import android.content.Context; import android.app.PendingIntent;
import android.content.Intent; import android.content.Context;
import android.graphics.Bitmap; import android.content.Intent;
import android.os.Build; import android.graphics.Bitmap;
import android.widget.RemoteViews; import android.os.Build;
import androidx.core.app.NotificationCompat; import android.widget.RemoteViews;
import androidx.core.app.NotificationManagerCompat;
import com.example.myapplication.R; import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.constants.status; import androidx.core.app.NotificationCompat;
import com.hiddenservices.onionservices.helperManager.helperMethod; import androidx.core.app.NotificationManagerCompat;
import com.hiddenservices.onionservices.pluginManager.pluginReciever.mediaNotificationReciever; import com.hiddenservices.onionservices.R;
import org.mozilla.geckoview.GeckoSession; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.helperManager.helperMethod;
public class mediaDelegate implements GeckoSession.MediaDelegate { import com.hiddenservices.onionservices.pluginManager.pluginReciever.mediaNotificationReciever;
private Context mContext; import org.mozilla.geckoview.GeckoSession;
public mediaDelegate(Activity activity, Context pContext) { import java.lang.ref.WeakReference;
mContext = pContext;
} public class mediaDelegate implements GeckoSession.MediaDelegate {
public void onHideDefaultNotification(){ /*Private Variables*/
NotificationManagerCompat.from(mContext).cancel(1030);
} private WeakReference<AppCompatActivity> mContext;
private static int S_NOTIFICATION_ID = 1030;
public void showNotification(Context context, String title, String url, Bitmap mediaImage, boolean not_status) { private static String S_NOTIFICATION_CHANNEL_ID = "1030";
NotificationManager mNotificationManager = (NotificationManager) mContext.getSystemService( NOTIFICATION_SERVICE ) ; private static String S_NOTIFICATION_CHANNEL_NAME = "MEDIA_NOTIFICATION";
if(title.length()<=0 || !status.sBackgroundMusic){
return; /*Initializations*/
}
RemoteViews contentView; public mediaDelegate(WeakReference<AppCompatActivity> pContext) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) { mContext = pContext;
contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_no_background ) ; }
}else if (android.os.Build.VERSION. SDK_INT > Build.VERSION_CODES.N_MR1){
contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_layout ) ; public void onHideDefaultNotification(){
}else { NotificationManagerCompat.from(mContext.get()).cancel(S_NOTIFICATION_ID);
contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_layout_small ) ; }
}
/*Triggers*/
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S ) {
contentView.setInt(R.id.layout,"setBackgroundResource", R.color.c_tab_background); @SuppressLint("InlinedApi")
} public void showNotification(Context context, String title, String url, Bitmap mediaImage, boolean media_status) {
contentView.setTextViewText(R.id.header, title); NotificationManager mNotificationManager = (NotificationManager) mContext.get().getSystemService( NOTIFICATION_SERVICE ) ;
contentView.setTextViewText(R.id.body, "☍ " + url); if(title.length()<=0 || !status.sBackgroundMusic){
return;
try { }
contentView.setImageViewBitmap(R.id.logo, mediaImage); RemoteViews contentView;
} catch (Throwable e) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
e.printStackTrace(); contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_no_background ) ;
} }else if (android.os.Build.VERSION. SDK_INT > Build.VERSION_CODES.N_MR1){
contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_layout ) ;
if (not_status){ }else {
PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, 1030, "media_play", 0); contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_layout_small ) ;
contentView.setOnClickPendingIntent(R.id.trigger, pIntent); }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow_no_tint); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S ) {
}else { contentView.setInt(R.id.layout,"setBackgroundResource", R.color.c_tab_background);
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow); }
} contentView.setTextViewText(R.id.header, title);
}else { contentView.setTextViewText(R.id.body, "☍ " + url);
PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, 1030, "media_pause", 1);
contentView.setOnClickPendingIntent(R.id.trigger, pIntent); try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) { contentView.setImageViewBitmap(R.id.logo, mediaImage);
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_pause_no_tint); } catch (Throwable e) {
}else { e.printStackTrace();
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_pause); }
}
} if (!media_status){
PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_play", 0);
PendingIntent pIntentPrev = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, 1030, "media_next", 2); contentView.setOnClickPendingIntent(R.id.trigger, pIntent);
contentView.setOnClickPendingIntent(R.id.next, pIntentPrev); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow_no_tint);
if(android.os.Build.VERSION. SDK_INT > Build.VERSION_CODES.N){ }else {
PendingIntent pIntentNext = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, 1030, "media_back", 3); contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow);
contentView.setOnClickPendingIntent(R.id.back, pIntentNext); }
} }else {
PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_pause", 1);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext, "1030" ) ; contentView.setOnClickPendingIntent(R.id.trigger, pIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
mBuilder.setPriority(Notification.PRIORITY_LOW); contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_pause_no_tint);
mBuilder.setAutoCancel(true); }else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){ contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_pause);
mBuilder.setCustomBigContentView(contentView); }
mBuilder.setStyle(new NotificationCompat.DecoratedCustomViewStyle()); }
}else {
mBuilder.setContent(contentView); PendingIntent pIntentPrev = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_next", 2);
} contentView.setOnClickPendingIntent(R.id.next, pIntentPrev);
mBuilder.setSmallIcon(R.drawable.ic_baseline_media) ; if(android.os.Build.VERSION. SDK_INT > Build.VERSION_CODES.N){
mBuilder.setAutoCancel( true ) ; PendingIntent pIntentNext = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_back", 3);
if (android.os.Build.VERSION. SDK_INT >= android.os.Build.VERSION_CODES. O ) { contentView.setOnClickPendingIntent(R.id.back, pIntentNext);
int importance = NotificationManager.IMPORTANCE_LOW ; }
NotificationChannel notificationChannel = new NotificationChannel( "1030" , "NOTIFICATION_CHANNEL_NAME" , importance) ;
notificationChannel.setSound(null, null); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext.get(), S_NOTIFICATION_CHANNEL_ID ) ;
mBuilder.setChannelId("1030") ;
assert mNotificationManager != null; mBuilder.setPriority(Notification.PRIORITY_LOW);
mNotificationManager.createNotificationChannel(notificationChannel) ; mBuilder.setAutoCancel(true);
} if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
Notification notification = mBuilder.build(); mBuilder.setCustomBigContentView(contentView);
mBuilder.setStyle(new NotificationCompat.DecoratedCustomViewStyle());
mBuilder.setContentIntent(PendingIntent.getActivity(context, 1030, new Intent(context, mediaDelegate.class), PendingIntent.FLAG_IMMUTABLE)); }else {
PendingIntent dummyIntent = null; mBuilder.setContent(contentView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { }
PendingIntent.getActivity(context, 1030, new Intent(), PendingIntent.FLAG_IMMUTABLE);
}else { mBuilder.setSmallIcon(R.drawable.ic_baseline_media) ;
PendingIntent.getActivity(context, 1030, new Intent(), 0); mBuilder.setAutoCancel( true ) ;
} if (android.os.Build.VERSION. SDK_INT >= android.os.Build.VERSION_CODES. O ) {
notification.fullScreenIntent = dummyIntent; int importance = NotificationManager.IMPORTANCE_LOW ;
NotificationChannel notificationChannel = new NotificationChannel( S_NOTIFICATION_CHANNEL_ID , S_NOTIFICATION_CHANNEL_NAME , importance) ;
if(!not_status){ notificationChannel.setSound(null, null);
notification.flags |= Notification.FLAG_NO_CLEAR; mBuilder.setChannelId(S_NOTIFICATION_CHANNEL_ID) ;
} assert mNotificationManager != null;
mNotificationManager.createNotificationChannel(notificationChannel) ;
notification.defaults = 0; }
mNotificationManager.notify(1030 , notification) ; Notification notification = mBuilder.build();
} mBuilder.setContentIntent(PendingIntent.getActivity(context, S_NOTIFICATION_ID, new Intent(context, mediaDelegate.class), PendingIntent.FLAG_IMMUTABLE));
notification.fullScreenIntent = null;
if(media_status){
notification.flags |= Notification.FLAG_NO_CLEAR;
}
notification.defaults = 0;
mNotificationManager.notify(S_NOTIFICATION_ID , notification) ;
}
} }

View File

@ -0,0 +1,124 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import static com.hiddenservices.onionservices.constants.strings.GENERIC_EMPTY_STR;
import android.graphics.Bitmap;
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.constants.enums;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.MediaSession;
import java.lang.ref.WeakReference;
public class mediaSessionDelegate implements MediaSession.Delegate{
/*Private Variables*/
private MediaSession mMediaSession = null;
private mediaDelegate mMediaDelegate;
private WeakReference<AppCompatActivity> mContext;
private geckoDataModel mGeckoDataModel;
private Bitmap mMediaImage;
private String mMediaTitle = GENERIC_EMPTY_STR;
/*Initializations*/
public mediaSessionDelegate(WeakReference<AppCompatActivity> pContext, geckoDataModel pGeckoDataModel, mediaDelegate pMediaDelegate){
this.mContext = pContext;
this.mMediaDelegate = pMediaDelegate;
this.mGeckoDataModel = pGeckoDataModel;
}
/*Local Listeners*/
@Override
public void onActivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onActivated(session, mediaSession);
mMediaSession = mediaSession;
}
@Override
public void onDeactivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onPause(session, mediaSession);
mMediaDelegate.onHideDefaultNotification();
}
@Override
public void onMetadata(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, @NonNull MediaSession.Metadata meta) {
try {
mMediaTitle = meta.title;
mMediaImage = meta.artwork.getBitmap(250).poll(2500);
mMediaDelegate.showNotification(mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, true);
} catch (Throwable e) {
e.printStackTrace();
}
MediaSession.Delegate.super.onMetadata(session, mediaSession, meta);
}
@Override
public void onFeatures(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, long features) {
MediaSession.Delegate.super.onFeatures(session, mediaSession, features);
}
@Override
public void onPlay(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onPlay(session, mediaSession);
mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, true);
}
@Override
public void onPause(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onPause(session, mediaSession);
mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, false);
}
@Override
public void onStop(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onStop(session, mediaSession);
mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, false);
}
@Override
public void onPositionState(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, @NonNull MediaSession.PositionState state) {
MediaSession.Delegate.super.onPositionState(session, mediaSession, state);
}
@Override
public void onFullscreen(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, boolean enabled, @Nullable @org.jetbrains.annotations.Nullable MediaSession.ElementMetadata meta) {
MediaSession.Delegate.super.onFullscreen(session, mediaSession, enabled, meta);
}
/*Triggers*/
public void onTrigger(enums.MediaController pCommands){
if(mMediaSession!=null){
if(pCommands.equals(enums.MediaController.PLAY)){
mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, true);
mMediaSession.play();
}
else if(pCommands.equals(enums.MediaController.PAUSE)){
mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, false);
mMediaSession.pause();
}
else if(pCommands.equals(enums.MediaController.STOP)){
mMediaSession.stop();
}
else if(pCommands.equals(enums.MediaController.DESTROY)){
mMediaSession.stop();
mMediaDelegate.onHideDefaultNotification();
}
else if(pCommands.equals(enums.MediaController.SKIP_BACKWARD)){
mMediaSession.previousTrack();
}
else if(pCommands.equals(enums.MediaController.SKIP_FORWARD)){
mMediaSession.nextTrack();
}
}
}
}

View File

@ -0,0 +1,51 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.UiThread;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.mozilla.geckoview.GeckoSession;
import java.util.Arrays;
public class scrollDelegate implements GeckoSession.ScrollDelegate {
/*Private Variables*/
private eventObserver.eventListener mEvent;
private geckoDataModel mGeckoDataModel;
private int mScollOffset = 0;
/*Initializations*/
public scrollDelegate(eventObserver.eventListener pEvent, geckoDataModel pGeckoDataModel) {
this.mEvent = pEvent;
this.mGeckoDataModel = pGeckoDataModel;
}
/*Scroll Delegate*/
@UiThread
public void onScrollChanged(@NonNull GeckoSession session, int scrollX, int scrollY) {
Log.i("fucker111 : ", scrollY + "");
mScollOffset = scrollY;
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND);
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);
} 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);
} else {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_ON_SCROLL_NO_BOUNDARIES);
}
}
public int getScrollOffset() {
return mScollOffset;
}
}

View File

@ -1,473 +1,478 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager; package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.RectF; import android.graphics.RectF;
import android.os.Build; import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.UiThread; import androidx.annotation.RequiresApi;
import androidx.annotation.UiThread;
import android.util.Log;
import android.view.ActionMode; import android.util.Log;
import android.view.Menu; import android.view.ActionMode;
import android.view.MenuItem; import android.view.Menu;
import android.view.View; import android.view.MenuItem;
import android.view.View;
import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.activityContextManager;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.GeckoSession; import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.GeckoSession;
/**
* Class that implements a basic SelectionActionDelegate. This class is used by GeckoView by /**
* default if the consumer does not explicitly set a SelectionActionDelegate. * Class that implements a basic SelectionActionDelegate. This class is used by GeckoView by
* <p> * default if the consumer does not explicitly set a SelectionActionDelegate.
* To provide custom actions, extend this class and override the following methods, * <p>
* <p> * To provide custom actions, extend this class and override the following methods,
* 1) Override {@link #getAllActions} to include custom action IDs in the returned array. This * <p>
* array must include all actions, available or not, and must not change over the class lifetime. * 1) Override {@link #getAllActions} to include custom action IDs in the returned array. This
* <p> * array must include all actions, available or not, and must not change over the class lifetime.
* 2) Override {@link #isActionAvailable} to return whether a custom action is currently available. * <p>
* <p> * 2) Override {@link #isActionAvailable} to return whether a custom action is currently available.
* 3) Override {@link #prepareAction} to set custom title and/or icon for a custom action. * <p>
* <p> * 3) Override {@link #prepareAction} to set custom title and/or icon for a custom action.
* 4) Override {@link #performAction} to perform a custom action when used. * <p>
*/ * 4) Override {@link #performAction} to perform a custom action when used.
@UiThread */
public class selectionActionDelegate implements ActionMode.Callback, @UiThread
GeckoSession.SelectionActionDelegate { public class selectionDelegate implements ActionMode.Callback,
private static final String LOGTAG = "BasicSelectionAction"; GeckoSession.SelectionActionDelegate {
private static final String LOGTAG = "BasicSelectionAction";
protected static final String ACTION_PROCESS_TEXT = Intent.ACTION_PROCESS_TEXT;
protected static final String ACTION_PROCESS_TEXT = "android.intent.action.PROCESS_TEXT";
private static final String[] FLOATING_TOOLBAR_ACTIONS = new String[]{
ACTION_CUT, ACTION_COPY, ACTION_PASTE, ACTION_SELECT_ALL, "SEARCH" private static final String[] FLOATING_TOOLBAR_ACTIONS = new String[]{
}; ACTION_CUT, ACTION_COPY, ACTION_PASTE, ACTION_SELECT_ALL, "SEARCH"
private static final String[] FIXED_TOOLBAR_ACTIONS = new String[]{ };
ACTION_SELECT_ALL, ACTION_CUT, ACTION_COPY, ACTION_PASTE, "SEARCH" private static final String[] FIXED_TOOLBAR_ACTIONS = new String[]{
}; ACTION_SELECT_ALL, ACTION_CUT, ACTION_COPY, ACTION_PASTE, "SEARCH"
};
protected final @NonNull
Activity mActivity; protected final @NonNull
protected final boolean mUseFloatingToolbar; Activity mActivity;
protected final @NonNull protected final boolean mUseFloatingToolbar;
Matrix mTempMatrix = new Matrix(); protected final @NonNull
protected final @NonNull Matrix mTempMatrix = new Matrix();
RectF mTempRect = new RectF(); protected final @NonNull
private boolean mFullScreen = false; RectF mTempRect = new RectF();
private boolean mFullScreen = false;
private boolean mExternalActionsEnabled;
private boolean mExternalActionsEnabled;
protected @Nullable
ActionMode mActionMode; protected @Nullable
protected @Nullable ActionMode mActionMode;
GeckoSession mSession; protected @Nullable
protected @Nullable GeckoSession mSession;
Selection mSelection; protected @Nullable
protected boolean mRepopulatedMenu; Selection mSelection;
protected boolean mRepopulatedMenu;
public void setFullScreen(boolean pFullScreen) {
mFullScreen = pFullScreen; public void setFullScreen(boolean pFullScreen) {
} mFullScreen = pFullScreen;
}
@TargetApi(Build.VERSION_CODES.M)
private class Callback2Wrapper extends ActionMode.Callback2 { @TargetApi(Build.VERSION_CODES.M)
@Override private class Callback2Wrapper extends ActionMode.Callback2 {
public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) { @Override
return selectionActionDelegate.this.onCreateActionMode(actionMode, menu); public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) {
} return selectionDelegate.this.onCreateActionMode(actionMode, menu);
}
@Override
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) { @Override
return selectionActionDelegate.this.onPrepareActionMode(actionMode, menu); public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
} return selectionDelegate.this.onPrepareActionMode(actionMode, menu);
}
@Override
public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) { @Override
return selectionActionDelegate.this.onActionItemClicked(actionMode, menuItem); public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) {
} return selectionDelegate.this.onActionItemClicked(actionMode, menuItem);
}
@Override
public void onDestroyActionMode(final ActionMode actionMode) { @Override
selectionActionDelegate.this.onDestroyActionMode(actionMode); public void onDestroyActionMode(final ActionMode actionMode) {
} selectionDelegate.this.onDestroyActionMode(actionMode);
}
@Override
public void onGetContentRect(final ActionMode mode, final View view, final Rect outRect) { @Override
super.onGetContentRect(mode, view, outRect); public void onGetContentRect(final ActionMode mode, final View view, final Rect outRect) {
selectionActionDelegate.this.onGetContentRect(mode, view, outRect); super.onGetContentRect(mode, view, outRect);
} selectionDelegate.this.onGetContentRect(mode, view, outRect);
} }
}
@SuppressWarnings("checkstyle:javadocmethod")
public selectionActionDelegate(final @NonNull Activity activity) { @SuppressWarnings("checkstyle:javadocmethod")
this(activity, Build.VERSION.SDK_INT >= 23); public selectionDelegate(final @NonNull Activity activity) {
} this(activity, Build.VERSION.SDK_INT >= 23);
}
@SuppressWarnings("checkstyle:javadocmethod")
public selectionActionDelegate(final @NonNull Activity activity, @SuppressWarnings("checkstyle:javadocmethod")
final boolean useFloatingToolbar) { public selectionDelegate(final @NonNull Activity activity,
mActivity = activity; final boolean useFloatingToolbar) {
mUseFloatingToolbar = useFloatingToolbar; mActivity = activity;
mExternalActionsEnabled = true; mUseFloatingToolbar = useFloatingToolbar;
} mExternalActionsEnabled = true;
}
/**
* Set whether to include text actions from other apps in the floating toolbar. /**
* * Set whether to include text actions from other apps in the floating toolbar.
* @param enable True if external actions should be enabled. *
*/ * @param enable True if external actions should be enabled.
public void enableExternalActions(final boolean enable) { */
ThreadUtils.assertOnUiThread(); public void enableExternalActions(final boolean enable) {
mExternalActionsEnabled = enable; ThreadUtils.assertOnUiThread();
mExternalActionsEnabled = enable;
if (mActionMode != null) {
mActionMode.invalidate(); if (mActionMode != null) {
} mActionMode.invalidate();
} }
}
/**
* Get whether text actions from other apps are enabled. /**
* * Get whether text actions from other apps are enabled.
* @return True if external actions are enabled. *
*/ * @return True if external actions are enabled.
public boolean areExternalActionsEnabled() { */
return mExternalActionsEnabled; public boolean areExternalActionsEnabled() {
} return mExternalActionsEnabled;
}
/**
* Return list of all actions in proper order, regardless of their availability at present. /**
* Override to add to or remove from the default set. * Return list of all actions in proper order, regardless of their availability at present.
* * Override to add to or remove from the default set.
* @return Array of action IDs in proper order. *
*/ * @return Array of action IDs in proper order.
protected @NonNull */
String[] getAllActions() { protected @NonNull
return mUseFloatingToolbar ? FLOATING_TOOLBAR_ACTIONS String[] getAllActions() {
: FIXED_TOOLBAR_ACTIONS; return mUseFloatingToolbar ? FLOATING_TOOLBAR_ACTIONS
} : FIXED_TOOLBAR_ACTIONS;
}
/**
* Return whether an action is presently available. Override to indicate /**
* availability for custom actions. * Return whether an action is presently available. Override to indicate
* * availability for custom actions.
* @param id Action ID. *
* @return True if the action is presently available. * @param id Action ID.
*/ * @return True if the action is presently available.
protected boolean isActionAvailable(final @NonNull String id) { */
if (mSelection == null || mSelection.text.length() < 1 || mSelection.text.getBytes().length >= 500000) { protected boolean isActionAvailable(final @NonNull String id) {
return false; if (mSelection == null || mSelection.text.length() < 1 || mSelection.text.getBytes().length >= 500000) {
} return false;
}
if (mExternalActionsEnabled && !mSelection.text.isEmpty() &&
ACTION_PROCESS_TEXT.equals(id)) { if (mExternalActionsEnabled && !mSelection.text.isEmpty() &&
final PackageManager pm = mActivity.getPackageManager(); ACTION_PROCESS_TEXT.equals(id)) {
return pm.resolveActivity(getProcessTextIntent(), PackageManager.MATCH_DEFAULT_ONLY) != null; final PackageManager pm = mActivity.getPackageManager();
} if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (id.equals("SEARCH") && !mSelection.text.isEmpty() && mExternalActionsEnabled) { return pm.resolveActivity(getProcessTextIntent(), PackageManager.MATCH_DEFAULT_ONLY) != null;
return true; }
} }
if (id.equals("SEARCH") && !mSelection.text.isEmpty() && mExternalActionsEnabled) {
return mSelection.isActionAvailable(id); return true;
} }
/** return mSelection.isActionAvailable(id);
* Provides access to whether there are text selection actions available. Override to indicate }
* availability for custom actions.
* /**
* @return True if there are text selection actions available. * Provides access to whether there are text selection actions available. Override to indicate
*/ * availability for custom actions.
public boolean isActionAvailable() { *
if (mSelection == null) { * @return True if there are text selection actions available.
return false; */
} public boolean isActionAvailable() {
if (mSelection == null) {
return isActionAvailable(ACTION_PROCESS_TEXT) || return false;
!mSelection.availableActions.isEmpty(); }
}
return isActionAvailable(ACTION_PROCESS_TEXT) ||
/** !mSelection.availableActions.isEmpty();
* Prepare a menu item corresponding to a certain action. Override to prepare }
* menu item for custom action.
* /**
* @param id Action ID. * Prepare a menu item corresponding to a certain action. Override to prepare
* @param item New menu item to prepare. * menu item for custom action.
*/ *
protected void prepareAction(final @NonNull String id, final @NonNull MenuItem item) { * @param id Action ID.
* @param item New menu item to prepare.
if (mFullScreen) { */
return; protected void prepareAction(final @NonNull String id, final @NonNull MenuItem item) {
}
switch (id) { if (mFullScreen) {
case ACTION_CUT: return;
item.setTitle(android.R.string.cut); }
break; switch (id) {
case ACTION_COPY: case ACTION_CUT:
item.setTitle(android.R.string.copy); item.setTitle(android.R.string.cut);
break; break;
case "SEARCH": case ACTION_COPY:
item.setTitle("Search"); item.setTitle(android.R.string.copy);
break; break;
case ACTION_PASTE: case "SEARCH":
item.setTitle(android.R.string.paste); item.setTitle("Search");
break; break;
case ACTION_SELECT_ALL: case ACTION_PASTE:
item.setTitle(android.R.string.selectAll); item.setTitle(android.R.string.paste);
break; break;
case ACTION_PROCESS_TEXT: case ACTION_SELECT_ALL:
throw new IllegalStateException("Unexpected action"); item.setTitle(android.R.string.selectAll);
} break;
} case ACTION_PROCESS_TEXT:
throw new IllegalStateException("Unexpected action");
/** }
* Perform the specified action. Override to perform custom actions. }
*
* @param id Action ID. /**
* @param item Nenu item for the action. * Perform the specified action. Override to perform custom actions.
* @return True if the action was performed. *
*/ * @param id Action ID.
protected boolean performAction(final @NonNull String id, final @NonNull MenuItem item) { * @param item Nenu item for the action.
if (ACTION_PROCESS_TEXT.equals(id)) { * @return True if the action was performed.
try { */
mActivity.startActivity(item.getIntent()); protected boolean performAction(final @NonNull String id, final @NonNull MenuItem item) {
} catch (final ActivityNotFoundException e) { if (ACTION_PROCESS_TEXT.equals(id)) {
Log.e(LOGTAG, "Cannot perform action", e); try {
return false; mActivity.startActivity(item.getIntent());
} } catch (final ActivityNotFoundException e) {
return true; Log.e(LOGTAG, "Cannot perform action", e);
} return false;
}
if (mSelection == null) { return true;
return false; }
}
if (id.equals("SEARCH")) { if (mSelection == null) {
if (activityContextManager.getInstance() != null && activityContextManager.getInstance().getHomeController() != null) { return false;
activityContextManager.getInstance().getHomeController().onSearchString(mSelection.text); }
} if (id.equals("SEARCH")) {
clearSelection(); if (activityContextManager.getInstance() != null && activityContextManager.getInstance().getHomeController() != null) {
mActionMode.finish(); activityContextManager.getInstance().getHomeController().onSearchString(mSelection.text);
return false; }
} clearSelection();
mSelection.execute(id); mActionMode.finish();
return false;
if (ACTION_COPY.equals(id)) { }
if (mUseFloatingToolbar) { mSelection.execute(id);
clearSelection();
} else { if (ACTION_COPY.equals(id)) {
mActionMode.finish(); if (mUseFloatingToolbar) {
} clearSelection();
} } else {
return true; mActionMode.finish();
} }
}
/** return true;
* Get the current selection object. This object should not be stored as it does not update }
* when the selection becomes invalid. Stale actions are ignored.
* /**
* @return The {@link GeckoSession.SelectionActionDelegate.Selection} attached to the current * Get the current selection object. This object should not be stored as it does not update
* action menu. <code>null</code> if no action menu is active. * when the selection becomes invalid. Stale actions are ignored.
*/ *
public @Nullable * @return The {@link GeckoSession.SelectionActionDelegate.Selection} attached to the current
Selection getSelection() { * action menu. <code>null</code> if no action menu is active.
return mSelection; */
} public @Nullable
Selection getSelection() {
/** return mSelection;
* Clear the current selection, if possible. }
*/
public void clearSelection() { /**
if (mSelection == null) { * Clear the current selection, if possible.
return; */
} public void clearSelection() {
if (mSelection == null) {
if (isActionAvailable(ACTION_COLLAPSE_TO_END)) { return;
mSelection.collapseToEnd(); }
} else if (isActionAvailable(ACTION_UNSELECT)) {
mSelection.unselect(); if (isActionAvailable(ACTION_COLLAPSE_TO_END)) {
} else { mSelection.collapseToEnd();
mSelection.hide(); } else if (isActionAvailable(ACTION_UNSELECT)) {
} mSelection.unselect();
} } else {
mSelection.hide();
private Intent getProcessTextIntent() { }
final Intent intent = new Intent(Intent.ACTION_PROCESS_TEXT); }
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setType("text/plain"); @RequiresApi(api = Build.VERSION_CODES.M)
intent.putExtra(Intent.EXTRA_PROCESS_TEXT, mSelection.text); private Intent getProcessTextIntent() {
// TODO: implement ability to replace text in Gecko for editable selection (bug 1453137). final Intent intent = new Intent(Intent.ACTION_PROCESS_TEXT);
intent.putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true); intent.addCategory(Intent.CATEGORY_DEFAULT);
return intent; intent.setType("text/plain");
} intent.putExtra(Intent.EXTRA_PROCESS_TEXT, mSelection.text);
intent.putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true);
@Override return intent;
public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) { }
ThreadUtils.assertOnUiThread();
final String[] allActions = getAllActions(); @Override
for (final String actionId : allActions) { public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) {
if (isActionAvailable(actionId)) { ThreadUtils.assertOnUiThread();
if (!mUseFloatingToolbar && ( final String[] allActions = getAllActions();
Build.VERSION.SDK_INT == 22 || Build.VERSION.SDK_INT == 23)) { for (final String actionId : allActions) {
// Android bug where onPrepareActionMode is not called initially. if (isActionAvailable(actionId)) {
onPrepareActionMode(actionMode, menu); if (!mUseFloatingToolbar && (
} Build.VERSION.SDK_INT == 22 || Build.VERSION.SDK_INT == 23)) {
return true; // Android bug where onPrepareActionMode is not called initially.
} onPrepareActionMode(actionMode, menu);
} }
return false; return true;
} }
}
@Override return false;
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) { }
ThreadUtils.assertOnUiThread();
final String[] allActions = getAllActions(); @Override
boolean changed = false; public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
ThreadUtils.assertOnUiThread();
// Whether we are repopulating an existing menu. final String[] allActions = getAllActions();
mRepopulatedMenu = menu.size() != 0; boolean changed = false;
// For each action, see if it's available at present, and if necessary, // Whether we are repopulating an existing menu.
// add to or remove from menu. mRepopulatedMenu = menu.size() != 0;
for (int i = 0; i < allActions.length; i++) {
final String actionId = allActions[i]; // For each action, see if it's available at present, and if necessary,
final int menuId = i + Menu.FIRST; // add to or remove from menu.
for (int i = 0; i < allActions.length; i++) {
if (ACTION_PROCESS_TEXT.equals(actionId)) { final String actionId = allActions[i];
if (mExternalActionsEnabled && !mSelection.text.isEmpty()) { final int menuId = i + Menu.FIRST;
menu.addIntentOptions(menuId, menuId, menuId,
mActivity.getComponentName(), if (ACTION_PROCESS_TEXT.equals(actionId)) {
/* specifiec */ null, getProcessTextIntent(), if (mExternalActionsEnabled && !mSelection.text.isEmpty()) {
/* flags */ 0, /* items */ null); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
changed = true; menu.addIntentOptions(menuId, menuId, menuId,
} else if (menu.findItem(menuId) != null) { mActivity.getComponentName(),
menu.removeGroup(menuId); /* specifiec */ null, getProcessTextIntent(),
changed = true; /* flags */ 0, /* items */ null);
} }
continue; changed = true;
} } else if (menu.findItem(menuId) != null) {
menu.removeGroup(menuId);
if (isActionAvailable(actionId)) { changed = true;
if (menu.findItem(menuId) == null) { }
prepareAction(actionId, menu.add(/* group */ Menu.NONE, menuId, continue;
menuId, /* title */ "")); }
changed = true;
} if (isActionAvailable(actionId)) {
} else if (menu.findItem(menuId) != null) { if (menu.findItem(menuId) == null) {
menu.removeItem(menuId); prepareAction(actionId, menu.add(/* group */ Menu.NONE, menuId,
changed = true; menuId, /* title */ ""));
} changed = true;
} }
return changed; } else if (menu.findItem(menuId) != null) {
} menu.removeItem(menuId);
changed = true;
@Override }
public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) { }
ThreadUtils.assertOnUiThread(); return changed;
MenuItem realMenuItem = null; }
if (mRepopulatedMenu) {
// When we repopulate an existing menu, Android can sometimes give us an old, @Override
// deleted MenuItem. Find the current MenuItem that corresponds to the old one. public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) {
final Menu menu = actionMode.getMenu(); ThreadUtils.assertOnUiThread();
final int size = menu.size(); MenuItem realMenuItem = null;
for (int i = 0; i < size; i++) { if (mRepopulatedMenu) {
final MenuItem item = menu.getItem(i); // When we repopulate an existing menu, Android can sometimes give us an old,
if (item == menuItem || (item.getItemId() == menuItem.getItemId() && // deleted MenuItem. Find the current MenuItem that corresponds to the old one.
item.getTitle().equals(menuItem.getTitle()))) { final Menu menu = actionMode.getMenu();
realMenuItem = item; final int size = menu.size();
break; for (int i = 0; i < size; i++) {
} final MenuItem item = menu.getItem(i);
} if (item == menuItem || (item.getItemId() == menuItem.getItemId() &&
} else { item.getTitle().equals(menuItem.getTitle()))) {
realMenuItem = menuItem; realMenuItem = item;
} break;
}
if (realMenuItem == null) { }
return false; } else {
} realMenuItem = menuItem;
final String[] allActions = getAllActions(); }
return performAction(allActions[realMenuItem.getItemId() - Menu.FIRST], realMenuItem);
} if (realMenuItem == null) {
return false;
@Override }
public void onDestroyActionMode(final ActionMode actionMode) { final String[] allActions = getAllActions();
ThreadUtils.assertOnUiThread(); return performAction(allActions[realMenuItem.getItemId() - Menu.FIRST], realMenuItem);
if (!mUseFloatingToolbar) { }
clearSelection();
} @Override
mSession = null; public void onDestroyActionMode(final ActionMode actionMode) {
mSelection = null; ThreadUtils.assertOnUiThread();
mActionMode = null; if (!mUseFloatingToolbar) {
} clearSelection();
}
@SuppressWarnings("checkstyle:javadocmethod") mSession = null;
public void onGetContentRect(final @Nullable ActionMode mode, final @Nullable View view, mSelection = null;
final @NonNull Rect outRect) { mActionMode = null;
ThreadUtils.assertOnUiThread(); }
if (mSelection == null || mSelection.clientRect == null) {
return; @SuppressWarnings("checkstyle:javadocmethod")
} public void onGetContentRect(final @Nullable ActionMode mode, final @Nullable View view,
mSession.getClientToScreenMatrix(mTempMatrix); final @NonNull Rect outRect) {
mTempMatrix.mapRect(mTempRect, mSelection.clientRect); ThreadUtils.assertOnUiThread();
mTempRect.roundOut(outRect); if (mSelection == null || mSelection.clientRect == null) {
} return;
}
@TargetApi(Build.VERSION_CODES.M) mSession.getClientToScreenMatrix(mTempMatrix);
@Override mTempMatrix.mapRect(mTempRect, mSelection.clientRect);
public void onShowActionRequest(final GeckoSession session, final Selection selection) { mTempRect.roundOut(outRect);
ThreadUtils.assertOnUiThread(); }
mSession = session;
mSelection = selection; @TargetApi(Build.VERSION_CODES.M)
@Override
public void onShowActionRequest(@NonNull final GeckoSession session, @NonNull final Selection selection) {
try { ThreadUtils.assertOnUiThread();
if (mActionMode != null) { mSession = session;
if (isActionAvailable()) { mSelection = selection;
mActionMode.invalidate();
} else {
mActionMode.finish(); try {
} if (mActionMode != null) {
return; if (isActionAvailable()) {
} mActionMode.invalidate();
if (mUseFloatingToolbar) { } else {
String strManufacturer = android.os.Build.MANUFACTURER; mActionMode.finish();
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1 || (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1 && (strManufacturer.toLowerCase().contains("samsung") || android.os.Build.MODEL.toLowerCase().contains("samsung") || Build.PRODUCT.toLowerCase().contains("samsung")))) { }
mActionMode = mActivity.startActionMode(this); return;
} else { }
mActionMode = mActivity.startActionMode(new Callback2Wrapper(), ActionMode.TYPE_FLOATING); if (mUseFloatingToolbar) {
} String strManufacturer = android.os.Build.MANUFACTURER;
} else { if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1 || (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1 && (strManufacturer.toLowerCase().contains("samsung") || android.os.Build.MODEL.toLowerCase().contains("samsung") || Build.PRODUCT.toLowerCase().contains("samsung")))) {
mActionMode = mActivity.startActionMode(this); mActionMode = mActivity.startActionMode(this);
} } else {
} catch (Exception ignored) { mActionMode = mActivity.startActionMode(new Callback2Wrapper(), ActionMode.TYPE_FLOATING);
} }
} } else {
mActionMode = mActivity.startActionMode(this);
@Override }
public void onHideAction(final GeckoSession session, final int reason) { } catch (Exception ignored) {
ThreadUtils.assertOnUiThread(); }
if (mActionMode == null) { }
return;
} @Override
public void onHideAction(@NonNull final GeckoSession session, final int reason) {
switch (reason) { ThreadUtils.assertOnUiThread();
case HIDE_REASON_ACTIVE_SCROLL: if (mActionMode == null) {
case HIDE_REASON_ACTIVE_SELECTION: return;
case HIDE_REASON_INVISIBLE_SELECTION: }
if (mUseFloatingToolbar) {
// Hide the floating toolbar when scrolling/selecting. switch (reason) {
mActionMode.finish(); case HIDE_REASON_ACTIVE_SCROLL:
} case HIDE_REASON_ACTIVE_SELECTION:
break; case HIDE_REASON_INVISIBLE_SELECTION:
if (mUseFloatingToolbar) {
case HIDE_REASON_NO_SELECTION: // Hide the floating toolbar when scrolling/selecting.
mActionMode.finish(); mActionMode.finish();
break; }
} break;
}
case HIDE_REASON_NO_SELECTION:
mActionMode.finish();
break;
}
}
} }

View File

@ -7,13 +7,8 @@ import android.net.Uri;
import android.os.Handler; import android.os.Handler;
import android.util.Log; import android.util.Log;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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.homeController.homeController;
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;
@ -25,14 +20,12 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Arrays;
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.M_INDEX_WEBSITE;
import static com.hiddenservices.onionservices.constants.enums.etype.on_handle_external_intent; import static com.hiddenservices.onionservices.constants.enums.etype.on_handle_external_intent;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS; import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS;
@ -44,15 +37,10 @@ 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.json.JSONObject;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;
import org.mozilla.geckoview.GeckoResult;
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.WebExtension;
import org.mozilla.geckoview.WebResponse; import org.mozilla.geckoview.WebResponse;
import org.torproject.android.service.wrapper.orbotLocalConstants; import org.torproject.android.service.wrapper.orbotLocalConstants;
@ -211,126 +199,6 @@ public class geckoClients {
return cacheFile.getAbsolutePath(); return cacheFile.getAbsolutePath();
} }
/*
@SuppressLint("WrongThread")
public void installExtension() {
mRuntime.getWebExtensionController()
.ensureBuiltIn("resource://android/assets/parser/", "messaging@example.com")
.accept(
extension -> {
Log.i("MessageDelegate", "Extension installed: " + extension);
extension.setMessageDelegate(mMessagingDelegate, "browser");
},
e -> {
Log.e("MessageDelegate", "Error registering WebExtension", e);
}
);
mRuntime.getWebExtensionController()
.ensureBuiltIn("resource://android/assets/adblock/", "messaging@example.com")
.accept(
extension -> {
Log.i("MessageDelegate", "Extension installed: " + extension);
extension.setMessageDelegate(mMessagingDelegate, "browser");
},
e -> {
Log.e("MessageDelegate", "Error registering WebExtension", e);
}
);
}
private final WebExtension.MessageDelegate mMessagingDelegate = new WebExtension.MessageDelegate() {
@Override
public void onConnect(@NonNull WebExtension.Port port) {
Log.e("MessageDelegate", "onConnect");
mPort = port;
mPort.setDelegate(mPortDelegate);
}
@Override
public GeckoResult<Object> onMessage(final @NonNull String nativeApp, final @NonNull Object message, final @NonNull WebExtension.MessageSender sender) {
Log.e("MessageDelegate", "onConnect");
return null;
}
};
private final WebExtension.PortDelegate mPortDelegate = new WebExtension.PortDelegate() {
@Override
public void onPortMessage(final @NonNull Object message, final @NonNull WebExtension.Port port) {
if(mSession!=null){
if (message != null && mSession.getProgress() == 100 && !mSession.mCloseRequested && mSession.isFirstPaintExecuted && !mSession.mOnBackPressed) {
//event.invokeObserver(Arrays.asList(message, mSession.getCurrentURL()), M_INDEX_WEBSITE);
}
mSession.mOnBackPressed = false;
}
}
@Override
public void onDisconnect(final @NonNull WebExtension.Port port) {
Log.e("MessageDelegate:", "onDisconnect");
if (port == mPort) {
mPort = null;
}
}
};
private WebExtension.Port mPort;
public void onExtentionClicked() {
try {
if (mPort == null) {
return;
}
long id = System.currentTimeMillis();
Log.e("evalJavascript:id:", id + "");
JSONObject jsonObject = new JSONObject();
jsonObject.put("action", "evalJavascript");
jsonObject.put("data", "evalJavascript");
jsonObject.put("id", id);
Log.e("evalJavascript:", jsonObject.toString());
mPort.postMessage(jsonObject);
} catch (Exception e) {
e.printStackTrace();
}
}
static boolean mCreated = false;*/
/* package *//* class Pref<T> {
public final String name;
public final T defaultValue;
private T mValue;
private boolean mIsSet;
public Pref(@NonNull final String name, final T defaultValue) {
this.name = name;
this.defaultValue = defaultValue;
mValue = defaultValue;
}
public void add() {
final GeckoBundle prefs = new GeckoBundle(1);
prefs.putInt(this.name, (Integer)this.defaultValue);
EventDispatcher.getInstance().dispatch("GeckoView:SetDefaultPrefs", prefs);
addToBundle(prefs);
}
private void addToBundle(final GeckoBundle bundle) {
final T value = mIsSet ? mValue : defaultValue;
if (value instanceof String) {
bundle.putString(name, (String) value);
} else if (value instanceof Integer) {
bundle.putInt(name, (Integer) value);
} else if (value instanceof Boolean) {
bundle.putBoolean(name, (Boolean) value);
} else {
throw new UnsupportedOperationException("Unhandled pref type for " + name);
}
}
}*/
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
public void initRuntimeSettings(AppCompatActivity context) { public void initRuntimeSettings(AppCompatActivity context) {
@ -375,7 +243,7 @@ public class geckoClients {
public void onGetFavIcon(ImageView pImageView, String pURL, AppCompatActivity pcontext) { public void onGetFavIcon(ImageView pImageView, String pURL, AppCompatActivity pcontext) {
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){ if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY && status.sLowMemory != enums.MemoryStatus.LOW_MEMORY){
initBrowserManager(pcontext); initBrowserManager(pcontext);
pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL)); pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL));
Log.i("FUCKSSS1111","111"); Log.i("FUCKSSS1111","111");
@ -407,22 +275,22 @@ public class geckoClients {
} }
public void onKillMedia(){ public void onKillMedia(){
mSession.onKillMedia(); mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
} }
public void onPlayMedia(){ public void onPlayMedia(){
mSession.onPlayMedia(); mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.PLAY);
} }
public void onPauseMedia(){ public void onPauseMedia(){
mSession.onPauseMedia(); mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.PAUSE);
} }
public void onSkipForwardMedia(){ public void onSkipForwardMedia(){
mSession.onSkipForwardMedia(); mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.SKIP_FORWARD);
} }
public void onSkipBackwardMedia(){ public void onSkipBackwardMedia(){
mSession.onSkipBackwardMedia(); mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.SKIP_BACKWARD);
} }
@ -446,7 +314,7 @@ public class geckoClients {
} }
public void onStopMedia() { public void onStopMedia() {
mSession.onStopMedia(); mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.STOP);
} }
public void onUploadRequest(int resultCode, Intent data) { public void onUploadRequest(int resultCode, Intent data) {
@ -521,7 +389,7 @@ public class geckoClients {
} }
public void onRedrawPixel(AppCompatActivity pcontext) { public void onRedrawPixel(AppCompatActivity pcontext) {
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){ if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY && status.sLowMemory != enums.MemoryStatus.LOW_MEMORY){
mSession.onRedrawPixel(); mSession.onRedrawPixel();
onLoadFavIcon(pcontext); onLoadFavIcon(pcontext);
} }
@ -605,7 +473,7 @@ public class geckoClients {
} }
public boolean getFullScreenStatus() { public boolean getFullScreenStatus() {
return mSession.getFullScreenStatus(); return mSession.getContentDelegate().getFullScreenStatus();
} }
public void onExitFullScreen() { public void onExitFullScreen() {
@ -740,18 +608,25 @@ public class geckoClients {
} }
public int getScrollOffset() { public int getScrollOffset() {
return mSession.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)) {
mSession.onFullScreenInvoke((boolean)data.get(0));
}
if (e_type.equals(enums.etype.ON_DESTROY_MEDIA)) {
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
}
if (e_type.equals(enums.etype.M_CHANGE_HOME_THEME)) { if (e_type.equals(enums.etype.M_CHANGE_HOME_THEME)) {
reinitHomeTheme(); reinitHomeTheme();
} else if (mSession != null) { }
else if (mSession != null) {
if (e_type.equals(enums.etype.SESSION_ID)) { if (e_type.equals(enums.etype.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(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)) {
if (mSession != null && mSession.isClosed()) { if (mSession != null && mSession.isClosed()) {
return null; return null;
} }

View File

@ -20,15 +20,15 @@ import java.util.Arrays;
import mozilla.components.support.utils.DownloadUtils; import mozilla.components.support.utils.DownloadUtils;
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;
geckoDownloadManager() { public geckoDownloadManager() {
} }
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, userAgent, context, session, event),
exception -> { exception -> {
throw new IllegalStateException("Could not get UserAgent string."); throw new IllegalStateException("Could not get UserAgent string.");
@ -62,11 +62,11 @@ class geckoDownloadManager {
event.invokeObserver(Arrays.asList(downloadFile, session.getSessionID(), downloadURL), enums.etype.download_file_popup); event.invokeObserver(Arrays.asList(downloadFile, session.getSessionID(), downloadURL), enums.etype.download_file_popup);
} }
Uri getDownloadURL() { public Uri getDownloadURL() {
return downloadURL; return downloadURL;
} }
String getDownloadFile() { public String getDownloadFile() {
return downloadFile; return downloadFile;
} }

View File

@ -1,179 +1,179 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager; package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
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.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import org.mozilla.geckoview.WebRequestError; import org.mozilla.geckoview.WebRequestError;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
public class errorHandler { public class errorHandler {
private AppCompatActivity mContext; private AppCompatActivity mContext;
private String mErrorTemplate; private String mErrorTemplate;
public String createErrorPage(final int category, final int error, AppCompatActivity mContext, String url, InputStream mResourceURL) { public String createErrorPage(final int category, final int error, AppCompatActivity mContext, String url, InputStream mResourceURL) {
this.mContext = mContext; this.mContext = mContext;
if (mErrorTemplate == null) { if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
try { try {
InputStream stream = mResourceURL; InputStream stream = mResourceURL;
BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
builder.append(line); builder.append(line);
builder.append("\n"); builder.append("\n");
} }
mErrorTemplate = builder.toString(); mErrorTemplate = builder.toString();
} catch (Exception ex) { } catch (Exception ex) {
return null; return null;
} }
} }
String title = helperMethod.getHost(url); String title = helperMethod.getHost(url);
if (url == null) { if (url == null) {
url = "Hidden Error"; url = "Hidden Error";
} }
if (title == null) { if (title == null) {
title = "Hidden Error"; title = "Hidden Error";
} }
String replaceUrl = errorToString(error).replace("$URL", url); String replaceUrl = errorToString(error).replace("$URL", url);
String errorPage = createErrorPage("CODE : " + categoryToString(category) + " <br>TYPE : " + replaceUrl.replace("$TITLE", title), url, mResourceURL); String errorPage = createErrorPage("CODE : " + categoryToString(category) + " <br>TYPE : " + replaceUrl.replace("$TITLE", title), url, mResourceURL);
errorPage = translateMessage(errorPage, "CODE : " + categoryToString(category)); errorPage = translateMessage(errorPage, "CODE : " + categoryToString(category));
return errorPage; return errorPage;
} }
private String translateMessage(String message, String error) { private String translateMessage(String message, String error) {
message = message.replace("$ERROR_M1", mContext.getString(R.string.ERROR_M1)); message = message.replace("$ERROR_M1", mContext.getString(R.string.ERROR_M1));
message = message.replace("$ERROR_M2", mContext.getString(R.string.ERROR_M2)); message = message.replace("$ERROR_M2", mContext.getString(R.string.ERROR_M2));
message = message.replace("$ERROR_M3", mContext.getString(R.string.ERROR_M3)); message = message.replace("$ERROR_M3", mContext.getString(R.string.ERROR_M3));
message = message.replace("$ERROR_M4", mContext.getString(R.string.ERROR_M4)); message = message.replace("$ERROR_M4", mContext.getString(R.string.ERROR_M4));
message = message.replace("$ERROR_M5", mContext.getString(R.string.ERROR_M5)); message = message.replace("$ERROR_M5", mContext.getString(R.string.ERROR_M5));
message = message.replace("$ERROR_M6", mContext.getString(R.string.ERROR_M6)); message = message.replace("$ERROR_M6", mContext.getString(R.string.ERROR_M6));
if (status.sTorBrowsing) { if (status.sTorBrowsing) {
message = message.replace("$ERROR_M7", "block"); message = message.replace("$ERROR_M7", "block");
} else { } else {
message = message.replace("$ERROR_M7", "none"); message = message.replace("$ERROR_M7", "none");
} }
message = message.replace("$ERROR", error); message = message.replace("$ERROR", error);
return message; return message;
} }
private String errorToString(final int error) { private String errorToString(final int error) {
switch (error) { switch (error) {
case WebRequestError.ERROR_UNKNOWN: case WebRequestError.ERROR_UNKNOWN:
return "ERROR_UNKNOWN | The network request tried to use an unknown socket type"; return "ERROR_UNKNOWN | The network request tried to use an unknown socket type";
case WebRequestError.ERROR_SECURITY_SSL: case WebRequestError.ERROR_SECURITY_SSL:
return "ERROR_SECURITY_SSL | SSL negotiation problems has occured"; return "ERROR_SECURITY_SSL | SSL negotiation problems has occured";
case WebRequestError.ERROR_SECURITY_BAD_CERT: case WebRequestError.ERROR_SECURITY_BAD_CERT:
return "ERROR_SECURITY_BAD_CERT | SSL certificate validation error has occured"; return "ERROR_SECURITY_BAD_CERT | SSL certificate validation error has occured";
case WebRequestError.ERROR_NET_RESET: case WebRequestError.ERROR_NET_RESET:
return "ERROR_NET_RESET | The connection was reset"; return "ERROR_NET_RESET | The connection was reset";
case WebRequestError.ERROR_NET_INTERRUPT: case WebRequestError.ERROR_NET_INTERRUPT:
return "ERROR_NET_INTERRUPT | The network connection was interrupted"; return "ERROR_NET_INTERRUPT | The network connection was interrupted";
case WebRequestError.ERROR_NET_TIMEOUT: case WebRequestError.ERROR_NET_TIMEOUT:
return "ERROR_NET_TIMEOUT | The network request timed out"; return "ERROR_NET_TIMEOUT | The network request timed out";
case WebRequestError.ERROR_CONNECTION_REFUSED: case WebRequestError.ERROR_CONNECTION_REFUSED:
return "ERROR_CONNECTION_REFUSED | The network request was refused by the server"; return "ERROR_CONNECTION_REFUSED | The network request was refused by the server";
case WebRequestError.ERROR_UNKNOWN_PROTOCOL: case WebRequestError.ERROR_UNKNOWN_PROTOCOL:
return "ERROR_UNKNOWN_PROTOCOL | An unknown protocol was specified"; return "ERROR_UNKNOWN_PROTOCOL | An unknown protocol was specified";
case WebRequestError.ERROR_UNKNOWN_HOST: case WebRequestError.ERROR_UNKNOWN_HOST:
return "ERROR_UNKNOWN_HOST | The host could not be resolved"; return "ERROR_UNKNOWN_HOST | The host could not be resolved";
case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE: case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE:
return "ERROR_UNKNOWN_SOCKET_TYPE | The network request tried to use an unknown socket type"; return "ERROR_UNKNOWN_SOCKET_TYPE | The network request tried to use an unknown socket type";
case WebRequestError.ERROR_UNKNOWN_PROXY_HOST: case WebRequestError.ERROR_UNKNOWN_PROXY_HOST:
return "ERROR_UNKNOWN_PROXY_HOST | The host name of the proxy server could not be resolved"; return "ERROR_UNKNOWN_PROXY_HOST | The host name of the proxy server could not be resolved";
case WebRequestError.ERROR_MALFORMED_URI: case WebRequestError.ERROR_MALFORMED_URI:
return "ERROR_MALFORMED_URI | An invalid URL was specified"; return "ERROR_MALFORMED_URI | An invalid URL was specified";
case WebRequestError.ERROR_REDIRECT_LOOP: case WebRequestError.ERROR_REDIRECT_LOOP:
return "ERROR_REDIRECT_LOOP | A redirect loop was detected"; return "ERROR_REDIRECT_LOOP | A redirect loop was detected";
case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI: case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI:
return "ERROR_SAFEBROWSING_PHISHING_URI | The requested URI was present in the \"phishing\" blocklist"; return "ERROR_SAFEBROWSING_PHISHING_URI | The requested URI was present in the \"phishing\" blocklist";
case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI: case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI:
return "ERROR_SAFEBROWSING_MALWARE_URI | The requested URI was present in the \"malware\" blocklist"; return "ERROR_SAFEBROWSING_MALWARE_URI | The requested URI was present in the \"malware\" blocklist";
case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI: case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI:
return "ERROR_SAFEBROWSING_UNWANTED_URI | The requested URI was present in the \"unwanted\" blocklist"; return "ERROR_SAFEBROWSING_UNWANTED_URI | The requested URI was present in the \"unwanted\" blocklist";
case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI: case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI:
return "ERROR_SAFEBROWSING_HARMFUL_URI | The requested URI was present in the \"harmful\" blocklist"; return "ERROR_SAFEBROWSING_HARMFUL_URI | The requested URI was present in the \"harmful\" blocklist";
case WebRequestError.ERROR_CONTENT_CRASHED: case WebRequestError.ERROR_CONTENT_CRASHED:
return "ERROR_CONTENT_CRASHED | The content process crashed"; return "ERROR_CONTENT_CRASHED | The content process crashed";
case WebRequestError.ERROR_OFFLINE: case WebRequestError.ERROR_OFFLINE:
return "ERROR_OFFLINE | This device does not have a network connection"; return "ERROR_OFFLINE | This device does not have a network connection";
case WebRequestError.ERROR_PORT_BLOCKED: case WebRequestError.ERROR_PORT_BLOCKED:
return "ERROR_PORT_BLOCKED | The request tried to use a port that is blocked by either the OS or Gecko"; return "ERROR_PORT_BLOCKED | The request tried to use a port that is blocked by either the OS or Gecko";
case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED: case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED:
return "ERROR_PROXY_CONNECTION_REFUSED | The proxy server refused the connection"; return "ERROR_PROXY_CONNECTION_REFUSED | The proxy server refused the connection";
case WebRequestError.ERROR_FILE_NOT_FOUND: case WebRequestError.ERROR_FILE_NOT_FOUND:
return "ERROR_FILE_NOT_FOUND | A file was not found"; return "ERROR_FILE_NOT_FOUND | A file was not found";
case WebRequestError.ERROR_FILE_ACCESS_DENIED: case WebRequestError.ERROR_FILE_ACCESS_DENIED:
return "ERROR_FILE_ACCESS_DENIED | The OS blocked access to a file"; return "ERROR_FILE_ACCESS_DENIED | The OS blocked access to a file";
case WebRequestError.ERROR_INVALID_CONTENT_ENCODING: case WebRequestError.ERROR_INVALID_CONTENT_ENCODING:
return "ERROR_INVALID_CONTENT_ENCODING | The content has an invalid encoding"; return "ERROR_INVALID_CONTENT_ENCODING | The content has an invalid encoding";
case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE: case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE:
return "ERROR_UNSAFE_CONTENT_TYPE | A content type was returned which was deemed unsafe"; return "ERROR_UNSAFE_CONTENT_TYPE | A content type was returned which was deemed unsafe";
case WebRequestError.ERROR_CORRUPTED_CONTENT: case WebRequestError.ERROR_CORRUPTED_CONTENT:
return "ERROR_CORRUPTED_CONTENT | The content returned was corrupted"; return "ERROR_CORRUPTED_CONTENT | The content returned was corrupted";
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
} }
private String categoryToString(final int category) { private String categoryToString(final int category) {
switch (category) { switch (category) {
case WebRequestError.ERROR_CATEGORY_UNKNOWN: case WebRequestError.ERROR_CATEGORY_UNKNOWN:
return "ERROR_CATEGORY_UNKNOWN | " + "Unknown error occured from the server side"; return "ERROR_CATEGORY_UNKNOWN | " + "Unknown error occured from the server side";
case WebRequestError.ERROR_CATEGORY_SECURITY: case WebRequestError.ERROR_CATEGORY_SECURITY:
return "ERROR_CATEGORY_SECURITY | SSL certificate validation error has occured"; return "ERROR_CATEGORY_SECURITY | SSL certificate validation error has occured";
case WebRequestError.ERROR_CATEGORY_NETWORK: case WebRequestError.ERROR_CATEGORY_NETWORK:
return "ERROR_CATEGORY_NETWORK | A network related problem has occured"; return "ERROR_CATEGORY_NETWORK | A network related problem has occured";
case WebRequestError.ERROR_CATEGORY_CONTENT: case WebRequestError.ERROR_CATEGORY_CONTENT:
return "ERROR_CATEGORY_CONTENT | Invalid or corrupt webpage"; return "ERROR_CATEGORY_CONTENT | Invalid or corrupt webpage";
case WebRequestError.ERROR_CATEGORY_URI: case WebRequestError.ERROR_CATEGORY_URI:
return "ERROR_CATEGORY_URI"; return "ERROR_CATEGORY_URI";
case WebRequestError.ERROR_CATEGORY_PROXY: case WebRequestError.ERROR_CATEGORY_PROXY:
return "ERROR_CATEGORY_PROXY"; return "ERROR_CATEGORY_PROXY";
case WebRequestError.ERROR_CATEGORY_SAFEBROWSING: case WebRequestError.ERROR_CATEGORY_SAFEBROWSING:
return "ERROR_CATEGORY_SAFEBROWSING"; return "ERROR_CATEGORY_SAFEBROWSING";
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
} }
private String createErrorPage(final String error, String url, InputStream mResourceURL) { private String createErrorPage(final String error, String url, InputStream mResourceURL) {
if (error == null) { if (error == null) {
return strings.GENERIC_EMPTY_STR; return strings.GENERIC_EMPTY_STR;
} }
if (mErrorTemplate == null) { if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
builder.append(line); builder.append(line);
builder.append("\n"); builder.append("\n");
} }
mErrorTemplate = builder.toString(); mErrorTemplate = builder.toString();
} catch (IOException e) { } catch (IOException e) {
return null; return null;
} }
} }
String replaceUrl = mErrorTemplate.replace("$URL", url); String replaceUrl = mErrorTemplate.replace("$URL", url);
return replaceUrl; return replaceUrl;
} }
} }

View File

@ -0,0 +1,14 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses;
import android.content.Intent;
import android.net.Uri;
import androidx.appcompat.app.AppCompatActivity;
import java.lang.ref.WeakReference;
public class intentHandler {
public static void actionDial(String pIntentHander, WeakReference<AppCompatActivity> mContext) {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(pIntentHander));
mContext.get().startActivity(intent);
}
}

View File

@ -0,0 +1,37 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses;
import androidx.annotation.NonNull;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.util.GeckoBundle;
public class preferences<T> {
public final String name;
public final T defaultValue;
private T mValue;
public preferences(@NonNull final String name, final T defaultValue) {
this.name = name;
this.defaultValue = defaultValue;
mValue = defaultValue;
}
public void add() {
final GeckoBundle prefs = new GeckoBundle(1);
prefs.putInt(this.name, (Integer)this.defaultValue);
EventDispatcher.getInstance().dispatch("GeckoView:SetDefaultPrefs", prefs);
addToBundle(prefs);
}
private void addToBundle(final GeckoBundle bundle) {
final T value = mValue;
if (value instanceof String) {
bundle.putString(name, (String) value);
} else if (value instanceof Integer) {
bundle.putInt(name, (Integer) value);
} else if (value instanceof Boolean) {
bundle.putBoolean(name, (Boolean) value);
} else {
throw new UnsupportedOperationException("Unhandled pref type for " + name);
}
}
}

View File

@ -29,7 +29,7 @@ import com.hiddenservices.onionservices.constants.enums;
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 com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -210,7 +210,7 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
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())), enums.etype.fetch_favicon);
if(status.sLowMemory == enums.MemoryStatus.STABLE){ 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());

View File

@ -89,7 +89,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.pluginManager.pluginReciever.defaultNotificationReciever; import com.hiddenservices.onionservices.pluginManager.pluginReciever.defaultNotificationReciever;
import com.widget.onionservices.widgetManager.widgetController; import com.widget.onionservices.widgetManager.widgetController;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;
@ -164,6 +164,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private View mBannerAds = null; private View mBannerAds = null;
private ImageButton mGatewaySplash; private ImageButton mGatewaySplash;
private ImageButton mPanicButton; private ImageButton mPanicButton;
private ImageButton mSupportButton;
private ImageButton mPanicButtonLandscape; private ImageButton mPanicButtonLandscape;
private LinearLayout mTopBar; private LinearLayout mTopBar;
private ImageView mBackSplash; private ImageView mBackSplash;
@ -243,7 +244,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.home_view); setContentView(R.layout.home_view);
onMemoryCalculate();
initPreFixes(); initPreFixes();
activityContextManager.getInstance().setHomeController(this); activityContextManager.getInstance().setHomeController(this);
pluginController.getInstance().initializeAllServices(this); pluginController.getInstance().initializeAllServices(this);
@ -262,6 +262,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba
initPreFixes(); initPreFixes();
initBundle(); initBundle();
initTor(); initTor();
onMemoryCalculate();
pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_INIT_ADS);
mHomeViewController.updateBannerAdvertStatus(true, (boolean) pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); mHomeViewController.updateBannerAdvertStatus(true, (boolean) pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED));
} }
@ -583,6 +585,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mCoordinatorLayout = findViewById(R.id.pCoordinatorLayout); mCoordinatorLayout = findViewById(R.id.pCoordinatorLayout);
mImageDivider = findViewById(R.id.pImageDivider); mImageDivider = findViewById(R.id.pImageDivider);
mPanicButton = findViewById(R.id.pPanicButton); mPanicButton = findViewById(R.id.pPanicButton);
mSupportButton = findViewById(R.id.pSupportButton);
mPanicButtonLandscape = findViewById(R.id.pPanicButtonLandscape); mPanicButtonLandscape = findViewById(R.id.pPanicButtonLandscape);
mGenesisLogo = findViewById(R.id.pGenesisLogo); mGenesisLogo = findViewById(R.id.pGenesisLogo);
mPopoupFindCopy = findViewById(R.id.pPopoupFindCopy); mPopoupFindCopy = findViewById(R.id.pPopoupFindCopy);
@ -594,7 +597,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoView.setAutofillEnabled(true); mGeckoView.setAutofillEnabled(true);
mGeckoClient = new geckoClients(); mGeckoClient = new geckoClients();
mHomeViewController.initialization(new homeViewCallback(), this, mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mConnectNoTorButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mTopBarHider, mNewTabBlocker, mCoordinatorLayout, mImageDivider, mPanicButton, mGenesisLogo, mPanicButtonLandscape, mTorDisabled); mHomeViewController.initialization(new homeViewCallback(), this, mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mConnectNoTorButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mTopBarHider, mNewTabBlocker, mCoordinatorLayout, mImageDivider, mPanicButton, mGenesisLogo, mPanicButtonLandscape, mTorDisabled, mSupportButton);
mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback()); mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback());
mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this, false); mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this, false);
mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this); mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this);
@ -772,8 +775,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
mGeckoClient.loadURL(url.replace("orion.onion", "167.86.99.31"), mGeckoView, homeController.this); mGeckoClient.loadURL(url.replace("orion.onion", "167.86.99.31"), mGeckoView, homeController.this);
if(!mHomeViewController.isOrientationLandscapce()){ if(!mHomeViewController.isOrientationLandscapce() && status.sSettingIsAppRunning){
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER); new Handler().postDelayed(() ->
{
if(status.sSettingIsAppStarted) {
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER);
}
}, 3000);
} }
} }
@ -783,7 +791,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed, boolean pExpandAppBar, boolean pForced, boolean pGeneratePixel) { public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed, boolean pExpandAppBar, boolean pForced, boolean pGeneratePixel) {
mGeckoClient.getSession().onKillMedia(); mGeckoClient.getSession().getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
if (!isSessionClosed) { if (!isSessionClosed) {
dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession)); dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession));
} }
@ -1103,7 +1111,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
NotificationManagerCompat.from(this).cancel(1025); NotificationManagerCompat.from(this).cancel(1025);
if(mGeckoClient.getSession() !=null){ if(mGeckoClient.getSession() !=null){
mGeckoClient.getSession().onDestroyMedia(); mGeckoClient.getSession().getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
onHideDefaultNotification(); onHideDefaultNotification();
} }
if (!status.sSettingIsAppStarted) { if (!status.sSettingIsAppStarted) {
@ -1563,7 +1571,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
geckoSession mNewSession = mGeckoClient.initializeBackground(mGeckoView, new geckoViewCallback(), this, true); geckoSession mNewSession = mGeckoClient.initializeBackground(mGeckoView, new geckoViewCallback(), this, true);
onSaveCurrentTab(mNewSession, false); onSaveCurrentTab(mNewSession, false);
mNewSession.setURL(url); mNewSession.getHistoryDelegate().setURL(url);
mHomeViewController.progressBarReset(); mHomeViewController.progressBarReset();
initTabCountForced(); initTabCountForced();
mNewSession.loadUri(url); mNewSession.loadUri(url);
@ -1574,7 +1582,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened) { public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened) {
mGeckoClient.getSession().onKillMedia(); mGeckoClient.getSession().getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
try { try {
if(status.sLowMemory != enums.MemoryStatus.STABLE){ if(status.sLowMemory != enums.MemoryStatus.STABLE){
mRenderedBitmap = mGeckoView.capturePixels(); mRenderedBitmap = mGeckoView.capturePixels();
@ -1735,7 +1743,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter();
} else if (!mGeckoClient.getFullScreenStatus()) { } else if (!mGeckoClient.getFullScreenStatus()) {
mGeckoClient.onExitFullScreen(); mGeckoClient.onExitFullScreen();
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER); if(status.sSettingIsAppStarted){
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER);
}
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false);
mHomeViewController.updateBannerAdvertStatus(false, (boolean) pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); mHomeViewController.updateBannerAdvertStatus(false, (boolean) pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED));
} else if (mSearchbar.isFocused() || isKeyboardOpened) { } else if (mSearchbar.isFocused() || isKeyboardOpened) {
@ -1789,7 +1799,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.removeBanner(); mHomeViewController.removeBanner();
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
if(mGeckoClient.getFullScreenStatus()){ if(mGeckoClient.getFullScreenStatus()){
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER); if(status.sSettingIsAppStarted){
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER);
}
}else { }else {
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER); pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER);
} }
@ -1837,7 +1849,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(!mGeckoClient.getFullScreenStatus()){ if(!mGeckoClient.getFullScreenStatus()){
mGeckoClient.onExitFullScreen(); mGeckoClient.onExitFullScreen();
} }
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER); if(status.sSettingIsAppStarted){
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER);
}
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false);
pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); pluginController.getInstance().onMessageManagerInvoke(null, M_RESET);
pluginController.getInstance().onNotificationInvoke(Collections.singletonList(172800000), pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION); pluginController.getInstance().onNotificationInvoke(Collections.singletonList(172800000), pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION);
@ -1852,7 +1866,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, true); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, true);
if (mGeckoClient.getSession() != null && mGeckoClient != null) { if (mGeckoClient.getSession() != null && mGeckoClient != null) {
mGeckoClient.onStopMedia(); mGeckoClient.onPauseMedia();
} }
} }
@ -2710,7 +2724,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if((boolean)data.get(0)){ if((boolean)data.get(0)){
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER); pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER);
}else { }else {
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER); if(status.sSettingIsAppStarted){
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER);
}
} }
} else if (e_type.equals(enums.etype.M_ON_BANNER_UPDATE)) { } else if (e_type.equals(enums.etype.M_ON_BANNER_UPDATE)) {
Object mStatus = pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED); Object mStatus = pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED);
@ -2986,7 +3002,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false);
} else if (e_type.equals(enums.etype.start_proxy)) { } else if (e_type.equals(enums.etype.start_proxy)) {
pluginController.getInstance().onOrbotInvoke(data, pluginEnums.eOrbotManager.M_SET_PROXY); pluginController.getInstance().onOrbotInvoke(data, pluginEnums.eOrbotManager.M_SET_PROXY);
} else if (e_type.equals(enums.etype.on_update_history)) { } else if (e_type.equals(enums.etype.ON_UPDATE_HISTORY)) {
return dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_ADD_HISTORY, data); return dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_ADD_HISTORY, data);
} else if (e_type.equals(enums.etype.on_page_loaded)) { } else if (e_type.equals(enums.etype.on_page_loaded)) {
onInvokePixelGenerator(); onInvokePixelGenerator();
@ -3014,10 +3030,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mData.addAll(data); mData.addAll(data);
mData.add(homeController.this); mData.add(homeController.this);
pluginController.getInstance().onMessageManagerInvoke(mData, M_DOWNLOAD_SINGLE); pluginController.getInstance().onMessageManagerInvoke(mData, M_DOWNLOAD_SINGLE);
} else if (e_type.equals(enums.etype.on_full_screen)) { } else if (e_type.equals(enums.etype.ON_FULL_SCREEN)) {
boolean status = (Boolean) data.get(0); boolean status = (Boolean) data.get(0);
if(!status){ if(!status){
mGeckoClient.onStopMedia(); mGeckoClient.onPauseMedia();
} }
mHomeViewController.onFullScreenUpdate(status); mHomeViewController.onFullScreenUpdate(status);
mHomeViewController.onUpdateSearchEngineBar(false, 0); mHomeViewController.onUpdateSearchEngineBar(false, 0);

View File

@ -51,7 +51,7 @@ import com.hiddenservices.onionservices.dataManager.dataEnums;
import com.hiddenservices.onionservices.libs.views.ColorAnimator; import com.hiddenservices.onionservices.libs.views.ColorAnimator;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.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;
@ -115,6 +115,7 @@ class homeViewController {
private CoordinatorLayout mCoordinatorLayout; private CoordinatorLayout mCoordinatorLayout;
private ImageView mImageDivider; private ImageView mImageDivider;
private ImageButton mPanicButton; private ImageButton mPanicButton;
private ImageButton mSupportButton;
private ImageButton mPanicButtonLandscape; private ImageButton mPanicButtonLandscape;
private ImageView mGenesisLogo; private ImageView mGenesisLogo;
private ImageView mTorDisabled; private ImageView mTorDisabled;
@ -127,7 +128,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) { 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;
@ -171,6 +172,7 @@ class homeViewController {
this.mPanicButtonLandscape = pPanicButtonLandscape; this.mPanicButtonLandscape = pPanicButtonLandscape;
this.mLogHandler = new LogHandler(); this.mLogHandler = new LogHandler();
this.mTorDisabled = pTorDisabled; this.mTorDisabled = pTorDisabled;
this.mSupportButton = pSupportButton;
initSplashScreen(); initSplashScreen();
createUpdateUiHandler(); createUpdateUiHandler();
@ -530,7 +532,7 @@ class homeViewController {
public void initStatusBarColor(boolean mInstant) { public void initStatusBarColor(boolean mInstant) {
int mDelay = 1500; int mDelay = 1500;
if (!status.sTorBrowsing || status.mThemeApplying || mInstant || status.sSettingIsAppStarted) { if (status.mThemeApplying || mInstant || status.sSettingIsAppStarted) {
mDelay = 0; mDelay = 0;
} }
@ -566,7 +568,7 @@ class homeViewController {
}); });
animator.start(); animator.start();
} else { } else {
mSplashScreen.animate().alpha(0).setDuration(200).setStartDelay(mDelay).withEndAction(() -> onPostScreenDisable()); mSplashScreen.animate().alpha(0).setDuration(200).setStartDelay(2000).withEndAction(() -> onPostScreenDisable());
} }
} }
@ -582,6 +584,7 @@ class homeViewController {
mConnectButton.setVisibility(View.GONE); mConnectButton.setVisibility(View.GONE);
mConnectNoTorButton.setVisibility(View.GONE); mConnectNoTorButton.setVisibility(View.GONE);
mPanicButton.setVisibility(View.GONE); mPanicButton.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, enums.etype.M_CACHE_UPDATE_TAB);
@ -1386,24 +1389,12 @@ class homeViewController {
mProgressBar.setAlpha(1); mProgressBar.setAlpha(1);
mProgressBar.animate().cancel(); mProgressBar.animate().cancel();
mProgressBar.animate().alpha(0); mProgressBar.animate().alpha(0);
value = 100;
mProgressBar.animate().alpha(0).withEndAction(() -> mProgressBar.setProgress(0)); mProgressBar.animate().alpha(0).withEndAction(() -> mProgressBar.setProgress(0));
return; return;
} }
if (value == 100) { if (value == 100) {
changeRefreshMenu(); changeRefreshMenu();
new Handler().postDelayed(() ->
{
if(mProgressBar.getProgress()==100){
progressAnimator.cancel();
mProgressBar.setAlpha(1);
mProgressBar.animate().cancel();
mProgressBar.animate().alpha(0).withEndAction(() -> mProgressBar.setProgress(0));
}
onResetTabAnimation();
}, 2000);
} }
mProgressBar = activityContextManager.getInstance().getHomeController().mProgressBar; mProgressBar = activityContextManager.getInstance().getHomeController().mProgressBar;

View File

@ -17,7 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -29,7 +29,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -11,7 +11,7 @@ import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;

View File

@ -15,7 +15,7 @@ import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.tabManager.tabEnums; import com.hiddenservices.onionservices.appManager.tabManager.tabEnums;
import com.hiddenservices.onionservices.constants.constants; import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import org.torproject.android.service.wrapper.logRowModel; import org.torproject.android.service.wrapper.logRowModel;

View File

@ -27,7 +27,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.torproject.android.service.wrapper.logRowModel; import org.torproject.android.service.wrapper.logRowModel;

View File

@ -18,7 +18,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays; import java.util.Arrays;

View File

@ -22,7 +22,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays; import java.util.Arrays;

View File

@ -14,7 +14,7 @@ import androidx.core.content.ContextCompat;
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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List; import java.util.List;

View File

@ -22,7 +22,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -4,7 +4,7 @@ import android.view.View;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;

View File

@ -13,7 +13,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -16,7 +16,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;

View File

@ -25,7 +25,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;

View File

@ -12,7 +12,7 @@ import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -29,7 +29,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays; import java.util.Arrays;

View File

@ -16,7 +16,7 @@ import com.hiddenservices.onionservices.constants.enums;
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 com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Collections; import java.util.Collections;

View File

@ -19,7 +19,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays; import java.util.Arrays;

View File

@ -19,7 +19,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays; import java.util.Arrays;

View File

@ -11,7 +11,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
class settingNotificationViewController { class settingNotificationViewController {

View File

@ -21,7 +21,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -4,7 +4,7 @@ import android.view.View;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;

View File

@ -13,7 +13,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -17,7 +17,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays; import java.util.Arrays;

View File

@ -11,7 +11,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;

View File

@ -23,7 +23,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -18,7 +18,7 @@ import androidx.core.content.ContextCompat;
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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import com.hiddenservices.onionservices.pluginManager.pluginController; import com.hiddenservices.onionservices.pluginManager.pluginController;

View File

@ -33,7 +33,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;

View File

@ -14,7 +14,7 @@ import com.hiddenservices.onionservices.appManager.activityContextManager;
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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import java.util.List; import java.util.List;

View File

@ -20,7 +20,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -4,7 +4,7 @@ import android.view.View;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;

View File

@ -13,7 +13,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;

View File

@ -29,7 +29,7 @@ import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.dataManager.models.tabRowModel; import com.hiddenservices.onionservices.dataManager.models.tabRowModel;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -39,7 +39,7 @@ import com.hiddenservices.onionservices.dataManager.models.tabRowModel;
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 com.hiddenservices.onionservices.pluginManager.pluginController;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -27,7 +27,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.constants.enums; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;

View File

@ -3,11 +3,11 @@ package com.hiddenservices.onionservices.constants;
public class enums { public class enums {
/*Settings Manager*/ /*Settings Manager*/
public enum etype { public enum etype {
M_CHANGE_HOME_THEME, M_IS_ERROR_PAGE, on_update_favicon, M_RELOAD, ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW, ON_NEW_TAB_ANIMATION, M_UPDATE_SESSION_STATE, ON_LOAD_REQUEST, GECKO_SCROLL_UP, GECKO_SCROLL_UP_ALWAYS, GECKO_SCROLL_DOWN, WAS_SCROLL_CHANGED, GECKO_SCROLL_DOWN_MOVE, GECKO_SCROLL_UP_MOVE, GECKO_SCROLL_DOWN_CALLER, ON_UPDATE_SEARCH_BAR, M_ON_MAIL, SESSION_ID, M_UPDATE_PIXEL_BACKGROUND, M_ON_SCROLL_BOUNDARIES, M_ON_SCROLL_TOP_BOUNDARIES, M_ON_SCROLL_NO_BOUNDARIES, M_ON_STOP_SCROLL, M_INIT_PADDING, M_RATE_COUNT, M_CACHE_UPDATE_TAB, M_DEFAULT_BROWSER, M_CHANGE_HOME_THEME, M_IS_ERROR_PAGE, on_update_favicon, M_RELOAD, ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW, ON_NEW_TAB_ANIMATION, M_UPDATE_SESSION_STATE, ON_LOAD_REQUEST, GECKO_SCROLL_UP, GECKO_SCROLL_UP_ALWAYS, GECKO_SCROLL_DOWN, WAS_SCROLL_CHANGED, GECKO_SCROLL_DOWN_MOVE, GECKO_SCROLL_UP_MOVE, GECKO_SCROLL_DOWN_CALLER, ON_UPDATE_SEARCH_BAR, ON_DESTROY_MEDIA, M_ON_MAIL, SESSION_ID, M_UPDATE_PIXEL_BACKGROUND, M_ON_SCROLL_BOUNDARIES, M_ON_SCROLL_TOP_BOUNDARIES, M_ON_SCROLL_NO_BOUNDARIES, M_ON_STOP_SCROLL, M_INIT_PADDING, M_RATE_COUNT, M_CACHE_UPDATE_TAB, M_DEFAULT_BROWSER,
on_verify_selected_url_menu, FINDER_RESULT_CALLBACK, M_ADMOB_BANNER_RECHECK, M_OPEN_SESSION, M_DOWNLOAD_FAILURE, M_ADVERT_LOADED, on_verify_selected_url_menu, FINDER_RESULT_CALLBACK, M_ADMOB_BANNER_RECHECK, M_OPEN_SESSION, M_DOWNLOAD_FAILURE, M_ADVERT_LOADED,
welcome, reload, download_folder, M_UPDATE_THEME, M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS, M_INIT_TAB_COUNT_FORCED, M_GET_SSL_STATUS, M_SPLASH_DISABLE, M_NEW_LINK_IN_NEW_TAB, M_NEW_LINK_IN_NEW_TAB_LOAD, M_RESET_SUGGESTION, welcome, reload, download_folder, M_UPDATE_THEME, M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS, M_INIT_TAB_COUNT_FORCED, M_GET_SSL_STATUS, M_SPLASH_DISABLE, M_NEW_LINK_IN_NEW_TAB, M_NEW_LINK_IN_NEW_TAB_LOAD, M_RESET_SUGGESTION,
url_triggered, url_triggered_new_tab, url_clear, fetch_favicon, M_OPEN_BOOKMARK_SETTING, M_COPY_URL, url_clear_at, remove_from_database, is_empty, M_HOME_PAGE, M_PRELOAD_URL, ON_KEYBOARD_CLOSE, M_CLOSE_TAB, M_CLOSE_TAB_BACK, url_triggered, url_triggered_new_tab, url_clear, fetch_favicon, M_OPEN_BOOKMARK_SETTING, M_COPY_URL, url_clear_at, remove_from_database, is_empty, M_HOME_PAGE, M_PRELOAD_URL, ON_KEYBOARD_CLOSE, M_CLOSE_TAB, M_CLOSE_TAB_BACK,
on_close_sesson, on_long_press, on_full_screen, on_handle_external_intent, on_update_suggestion_url, progress_update, progress_update_forced, ON_EXPAND_TOP_BAR, recheck_orbot, on_url_load, on_playstore_load, back_list_empty, start_proxy, ON_UPDATE_THEME, M_NEW_IDENTITY, M_INDEX_WEBSITE, M_INIT_RUNTIME_SETTINGS, M_INIT_TOR, M_NEW_IDENTITY_MESSAGED, M_INITIALIZE_TAB_SINGLE, M_HOME_BUTTON_PRESSED, M_INITIALIZE_TAB_LINK, on_request_completed, on_update_history, on_update_suggestion, M_WELCOME_MESSAGE, ON_FIRST_PAINT, ON_INVOKE_PARSER, ON_LOAD_TAB_ON_RESUME, ON_LOAD_ADVERT, ON_SESSION_REINIT, on_page_loaded, on_load_error, M_ORBOT_LOADING, download_file_popup, on_init_ads, on_full_screen_ads, M_GET_CURRENT_URL, search_update, open_new_tab, open_new_tab_instant on_close_sesson, on_long_press, ON_FULL_SCREEN, on_handle_external_intent, on_update_suggestion_url, progress_update, progress_update_forced, ON_EXPAND_TOP_BAR, recheck_orbot, on_url_load, on_playstore_load, back_list_empty, start_proxy, ON_UPDATE_THEME, M_NEW_IDENTITY, M_INDEX_WEBSITE, M_INIT_RUNTIME_SETTINGS, M_INIT_TOR, M_NEW_IDENTITY_MESSAGED, M_INITIALIZE_TAB_SINGLE, M_HOME_BUTTON_PRESSED, M_INITIALIZE_TAB_LINK, on_request_completed, ON_UPDATE_HISTORY, on_update_suggestion, M_WELCOME_MESSAGE, ON_FIRST_PAINT, ON_INVOKE_PARSER, ON_LOAD_TAB_ON_RESUME, ON_LOAD_ADVERT, ON_SESSION_REINIT, on_page_loaded, on_load_error, M_ORBOT_LOADING, download_file_popup, on_init_ads, on_full_screen_ads, M_GET_CURRENT_URL, search_update, open_new_tab, open_new_tab_instant
} }
/*General Enums*/ /*General Enums*/
@ -25,6 +25,10 @@ public class enums {
public static final int CRITICAL_MEMORY = 3; public static final int CRITICAL_MEMORY = 3;
} }
public enum MediaController {
DESTROY, PLAY, PAUSE, SKIP_FORWARD, SKIP_BACKWARD, STOP;
}
public static class AddTabCallback { public static class AddTabCallback {
public static final int TAB_ADDED = 0; public static final int TAB_ADDED = 0;
public static final int TAB_FULL = 1; public static final int TAB_FULL = 1;
@ -42,12 +46,6 @@ public class enums {
public static final int SEARCHBAR = 2; public static final int SEARCHBAR = 2;
} }
public static class ImageQueueStatus {
public static final int M_IMAGE_LOADING = 0;
public static final int M_IMAGE_LOADED_SUCCESSFULLY = 1;
public static final int M_IMAGE_LOADING_FAILED = 2;
}
public static class ScrollDirection { public static class ScrollDirection {
public static final int HORIZONTAL = 0; public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1; public static final int VERTICAL = 1;
@ -58,11 +56,5 @@ public class enums {
public static final String OPEN_VOICE = "mOpenVoice"; public static final String OPEN_VOICE = "mOpenVoice";
} }
public static class LandingPageTypes {
public static final int M_LANDING_WELCOME = 0;
public static final int M_LANDING_INTRO = 1;
public static final int M_LANDING_START = 2;
}
} }

View File

@ -31,9 +31,10 @@ public class bookmarkDataModel {
void initializebookmark(ArrayList<bookmarkRowModel> pBookmark) { void initializebookmark(ArrayList<bookmarkRowModel> pBookmark) {
mBookmarks = pBookmark; mBookmarks = pBookmark;
for (int mCounter = 0; mCounter < pBookmark.size(); mCounter++) { for (int mCounter = pBookmark.size()-1; mCounter >= 0; mCounter--) {
if (mAvailableBookmark.containsKey(pBookmark.get(mCounter).getDescription())) { if (mAvailableBookmark.containsKey(pBookmark.get(mCounter).getDescription())) {
deleteBookmark(pBookmark.get(mCounter).getID()); deleteBookmark(pBookmark.get(mCounter).getID());
mCounter++;
} else { } else {
mAvailableBookmark.put(pBookmark.get(mCounter).getDescription(), pBookmark.get(mCounter).getID()); mAvailableBookmark.put(pBookmark.get(mCounter).getDescription(), pBookmark.get(mCounter).getID());
} }

View File

@ -52,7 +52,7 @@ public class tabRowModel {
public void setSession(geckoSession pSession, String pURL, String pTitle, String pTheme, GeckoSession.SessionState pSessionState) { public void setSession(geckoSession pSession, String pURL, String pTitle, String pTheme, GeckoSession.SessionState pSessionState) {
mSession = pSession; mSession = pSession;
mSession.setTitle(pTitle); mSession.setTitle(pTitle);
mSession.setURL(pURL); mSession.getHistoryDelegate().setURL(pURL);
mSession.setTheme(pTheme); mSession.setTheme(pTheme);
if (pSessionState != null) { if (pSessionState != null) {
@ -63,7 +63,7 @@ public class tabRowModel {
if (!status.sSettingIsAppStarted) { if (!status.sSettingIsAppStarted) {
if (pTitle.equals("$TITLE") || pTitle.startsWith("http://loading") || pTitle.startsWith("loading") || pURL.equals("$TITLE") || pURL.startsWith("http://loading") || pURL.startsWith("loading")) { if (pTitle.equals("$TITLE") || pTitle.startsWith("http://loading") || pTitle.startsWith("loading") || pURL.equals("$TITLE") || pURL.startsWith("http://loading") || pURL.startsWith("loading")) {
mSession.setTitle("about:blank"); mSession.setTitle("about:blank");
mSession.setURL("about:blank"); mSession.getHistoryDelegate().setURL("about:blank");
} }
} }
} }

View File

@ -56,7 +56,7 @@ import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import androidx.core.graphics.ColorUtils; import androidx.core.graphics.ColorUtils;
import com.example.myapplication.BuildConfig; import com.hiddenservices.onionservices.BuildConfig;
import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.appManager.kotlinHelperLibraries.defaultBrowser; import com.hiddenservices.onionservices.appManager.kotlinHelperLibraries.defaultBrowser;
@ -66,7 +66,7 @@ import com.hiddenservices.onionservices.constants.keys;
import com.hiddenservices.onionservices.constants.strings; import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.libs.trueTime.trueTimeEncryption; import com.hiddenservices.onionservices.libs.trueTime.trueTimeEncryption;
import com.hiddenservices.onionservices.pluginManager.pluginController; import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
@ -387,9 +387,9 @@ public class helperMethod {
ss.setSpan(new ForegroundColorSpan(Color.GRAY), 5, 8, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(new ForegroundColorSpan(Color.GRAY), 5, 8, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
if(pTheme != enums.Theme.THEME_DARK){ if(pTheme != enums.Theme.THEME_DARK){
ss.setSpan(new ForegroundColorSpan(Color.BLACK), getHost(url).length()+7, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(new ForegroundColorSpan(Color.BLACK), getHost(url).length()+8, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}else { }else {
ss.setSpan(new ForegroundColorSpan(Color.WHITE), getHost(url).length()+7, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(new ForegroundColorSpan(Color.WHITE), getHost(url).length()+8, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} }
return ss; return ss;
}else { }else {

View File

@ -15,7 +15,7 @@ import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.activityThemeManager; 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.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.Collections; import java.util.Collections;

View File

@ -19,7 +19,7 @@ package com.hiddenservices.onionservices.libs.netcipher.client;
import android.content.Context; import android.content.Context;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

View File

@ -22,32 +22,32 @@ public class appLovinManager {
public appLovinManager(eventObserver.eventListener pEvent, View pBannerAds, AppCompatActivity pContext) { public appLovinManager(eventObserver.eventListener pEvent, View pBannerAds, AppCompatActivity pContext) {
this.mEvent = pEvent; this.mEvent = pEvent;
this.mContext = pContext; this.mContext = pContext;
onInitializeAdvertisement(pContext);
} }
private void onInitializeAdvertisement(AppCompatActivity pContext) { private void onInitializeAdvertisement() {
AppLovinSdk.getInstance(pContext).getSettings().setVerboseLogging(true); if(!mLowMemoryReached){
AppLovinSdk.getInstance(pContext).setMediationProvider("max"); AppLovinSdk.getInstance(mContext).getSettings().setVerboseLogging(true);
AppLovinSdk.initializeSdk(pContext, configuration -> { AppLovinSdk.getInstance(mContext).setMediationProvider("max");
if(!mLowMemoryReached){ AppLovinSdk.initializeSdk(mContext, configuration -> {
this.mSupportManager = new applovinSupportManager(pContext); if(!mLowMemoryReached){
this.mBannerManager = new applovinBannerManager(pContext, mEvent); this.mSupportManager = new applovinSupportManager(mContext);
} this.mBannerManager = new applovinBannerManager(mContext, mEvent);
}); }
});
}
} }
/*Local Helper Methods*/ /*Local Helper Methods*/
private void onShowInterstitial() { private void onShowInterstitial() {
if(AppLovinSdk.getInstance(mContext).isInitialized()){ if(AppLovinSdk.getInstance(mContext).isInitialized() && this.mSupportManager!=null){
this.mSupportManager.onShow(); this.mSupportManager.onShow();
} }
} }
private void onToggleBannerShow(boolean pStatus) { private void onToggleBannerShow(boolean pStatus) {
if(AppLovinSdk.getInstance(mContext).isInitialized()){ if(AppLovinSdk.getInstance(mContext).isInitialized() && this.mBannerManager!=null){
this.mBannerManager.onShow(pStatus); this.mBannerManager.onShowToggle(pStatus);
} }
} }
@ -55,7 +55,9 @@ public class appLovinManager {
private void onDestroy() { private void onDestroy() {
mLowMemoryReached = true; mLowMemoryReached = true;
mBannerManager.onDestroy(); if(mBannerManager!=null){
mBannerManager.onDestroy();
}
} }
/*External Triggers*/ /*External Triggers*/
@ -71,6 +73,8 @@ public class appLovinManager {
onToggleBannerShow(false); onToggleBannerShow(false);
} else if (pEventType.equals(pluginEnums.eAdManager.M_SHOW_INTERSTITIAL)) { } else if (pEventType.equals(pluginEnums.eAdManager.M_SHOW_INTERSTITIAL)) {
onShowInterstitial(); onShowInterstitial();
} else if (pEventType.equals(pluginEnums.eAdManager.M_INIT_ADS)) {
onInitializeAdvertisement();
} }
return null; return null;
} }

View File

@ -20,7 +20,7 @@ public class applovinBannerManager implements MaxAdViewAdListener{
private static final String S_UNIT_ID = "642ec6302c7cecd2"; private static final String S_UNIT_ID = "642ec6302c7cecd2";
private MaxAdView mBanner; private MaxAdView mBanner;
eventObserver.eventListener mEvent; private eventObserver.eventListener mEvent;
/* Initializations */ /* Initializations */
@ -46,7 +46,7 @@ public class applovinBannerManager implements MaxAdViewAdListener{
/* Helper Methods */ /* Helper Methods */
public void onShow(boolean pStatus) { public void onShowToggle(boolean pStatus) {
if(mBanner!=null){ if(mBanner!=null){
if(pStatus){ if(pStatus){
mBanner.startAutoRefresh(); mBanner.startAutoRefresh();

View File

@ -9,7 +9,7 @@ import android.webkit.JavascriptInterface;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;

View File

@ -26,7 +26,7 @@ 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 com.hiddenservices.onionservices.libs.netcipher.client.StrongHttpsClient; import com.hiddenservices.onionservices.libs.netcipher.client.StrongHttpsClient;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import org.torproject.android.service.wrapper.orbotLocalConstants; import org.torproject.android.service.wrapper.orbotLocalConstants;

View File

@ -31,7 +31,7 @@ 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.pluginManager.pluginEnums; import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;
import java.util.Arrays; import java.util.Arrays;

View File

@ -15,7 +15,7 @@ import androidx.core.app.NotificationCompat;
import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.constants.strings; import com.hiddenservices.onionservices.constants.strings;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.Random; import java.util.Random;

View File

@ -14,7 +14,7 @@ import androidx.core.app.NotificationCompat;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.pluginManager.pluginEnums; import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.List; import java.util.List;

View File

@ -4,7 +4,7 @@ public class pluginEnums {
/*Advert Manager*/ /*Advert Manager*/
public enum eAdManager { public enum eAdManager {
M_IS_ADVERT_LOADED, M_LOW_MEMORY_DESTROY, M_HIDE_BANNER, M_SHOW_BANNER, M_SHOW_INTERSTITIAL M_IS_ADVERT_LOADED, M_LOW_MEMORY_DESTROY, M_HIDE_BANNER, M_SHOW_BANNER, M_SHOW_INTERSTITIAL, M_INIT_ADS
} }
public enum eAdManagerCallbacks { public enum eAdManagerCallbacks {

View File

@ -10,7 +10,7 @@ import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import com.widget.onionservices.helperMethod.helperMethod; import com.widget.onionservices.helperMethod.helperMethod;
import java.util.Arrays; import java.util.Arrays;

View File

@ -6,7 +6,7 @@ import android.view.View;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R; import com.hiddenservices.onionservices.R;
import java.util.List; import java.util.List;

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="1dp"
android:color="@color/c_ripple_v2" />
<solid android:color="#00FFFFFF" />
<padding android:left="10dp"
android:right="10dp"
android:top="10dp"
android:bottom="10dp" />
</shape>
</item>
</layer-list>

View File

@ -156,7 +156,7 @@
android:layout_marginTop="0dp" android:layout_marginTop="0dp"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:layout_weight="17" android:layout_weight="17"
android:background="@xml/gx_ripple_blue" android:background="@xml/bx_border_recycleview"
android:textAllCaps="false" android:textAllCaps="false"
android:paddingStart="20dp" android:paddingStart="20dp"
android:stateListAnimator="@null" android:stateListAnimator="@null"
@ -179,6 +179,7 @@
android:id="@+id/pRecycleView" android:id="@+id/pRecycleView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="100dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -180,6 +180,7 @@
android:id="@+id/pRecycleView" android:id="@+id/pRecycleView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="100dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -70,6 +70,7 @@
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:clickable="false" android:clickable="false"
android:ellipsize="end" android:ellipsize="end"
android:textAlignment="viewStart"
android:maxLines="1" android:maxLines="1"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingEnd="0dp" android:paddingEnd="0dp"

View File

@ -473,7 +473,7 @@
android:background="@xml/hox_rounded_corner_splash_right" android:background="@xml/hox_rounded_corner_splash_right"
android:contentDescription="@string/GENERAL_TODO" android:contentDescription="@string/GENERAL_TODO"
android:onClick="onSupportSplash" android:onClick="onSupportSplash"
app:tint="@color/c_setting_icon_tint" app:tint="#425e8a"
android:padding="6dp" android:padding="6dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@xml/ic_baseline_support" android:src="@xml/ic_baseline_support"

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