diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 58a47a26..977f3a88 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -6,6 +6,7 @@
+
diff --git a/app/build.gradle b/app/build.gradle
index 325e44f8..61a02756 100755
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,11 +1,11 @@
+import com.android.build.OutputFile
+
apply from: 'variables.gradle'
apply plugin: 'com.android.application'
apply plugin: 'maven-publish'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
-import com.android.build.OutputFile
-
android {
compileSdkVersion project.ext.compile_sdk_version
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6cccb61d..bc9f8b8d 100755
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -209,7 +209,7 @@
android:exported="false"
android:stopWithTask="true" />
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java
index 5d22d867..5685f97e 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java
@@ -3,7 +3,6 @@ package com.darkweb.genesissearchengine.appManager.bookmarkManager;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -16,15 +15,12 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java
index 53f8ffb5..3029ece3 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java
@@ -23,7 +23,6 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
-import com.darkweb.genesissearchengine.appManager.historyManager.historyEnums;
import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
@@ -34,7 +33,7 @@ import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java
index 6b158831..e0d5bd32 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java
@@ -19,7 +19,7 @@ import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java
index 6fd5a868..df63b337 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeModel.java
@@ -3,17 +3,14 @@ package com.darkweb.genesissearchengine.appManager.bridgeManager;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.constants;
-import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
-import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.strings.BRIDGE_CUSTOM_BRIDGE_MEEK;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java
index a040039a..fe00e02e 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/editViewController.java
@@ -6,7 +6,7 @@ import android.view.KeyEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.darkweb.genesissearchengine.constants.enums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
public class editViewController extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpController.java
index 6340e945..00c58369 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpController.java
@@ -20,7 +20,7 @@ import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java
index 1e2f0ae1..d795064f 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpModel.java
@@ -5,11 +5,10 @@ import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
-import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpViewController.java
index acfd3a01..da42b04f 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpViewController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/helpManager/helpViewController.java
@@ -5,7 +5,6 @@ import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
-import android.widget.LinearLayout;
import android.widget.ProgressBar;
import androidx.appcompat.app.AppCompatActivity;
@@ -14,9 +13,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
-import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums;
-import com.darkweb.genesissearchengine.constants.status;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import java.util.List;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java
index 24c5dc11..664b1b16 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java
@@ -3,8 +3,6 @@ package com.darkweb.genesissearchengine.appManager.historyManager;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
@@ -20,12 +18,10 @@ import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java
index 01ce7c5d..5417d530 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java
@@ -34,7 +34,7 @@ import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java
index 75146e2d..217e4e54 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java
@@ -7,7 +7,7 @@ import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import com.darkweb.genesissearchengine.constants.status;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import org.mozilla.geckoview.GeckoView;
import java.util.Collections;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java
index 020916a8..e0c60410 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java
@@ -12,7 +12,7 @@ import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.BrowserI
import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.io.File;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java
index c0e639b5..bfb4cdbb 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoDownloadManager.java
@@ -10,8 +10,8 @@ import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
-import org.mozilla.geckoview.GeckoSession;
+import com.darkweb.genesissearchengine.eventObserver;
+
import org.mozilla.geckoview.WebResponse;
import java.util.Arrays;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java
index bb6b0f4d..1b315175 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoPromptView.java
@@ -32,23 +32,14 @@ import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.TimePicker;
-
import androidx.annotation.Nullable;
-import androidx.annotation.UiThread;
import androidx.appcompat.app.AppCompatActivity;
-import com.darkweb.genesissearchengine.helperManager.PathUtil;
-import com.darkweb.genesissearchengine.helperManager.helperMethod;
-import com.example.myapplication.R;
-
-import java.lang.ref.WeakReference;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
-
-import org.jetbrains.annotations.NotNull;
import org.mozilla.geckoview.AllowOrDeny;
import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java
index 38516be1..a68edae5 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java
@@ -29,18 +29,14 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.content.FileProvider;
-import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
-import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
-import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.darkweb.genesissearchengine.helperManager.JavaScriptInterface;
+import com.darkweb.genesissearchengine.helperManager.internalFileDownloadManager;
import com.darkweb.genesissearchengine.helperManager.downloadFileService;
-import com.darkweb.genesissearchengine.helperManager.errorHandler;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.trueTime;
import com.example.myapplication.R;
@@ -56,6 +52,7 @@ import org.mozilla.geckoview.WebRequestError;
import org.mozilla.geckoview.WebResponse;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.InputStream;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.net.URLEncoder;
@@ -65,6 +62,9 @@ import java.util.Date;
import java.util.List;
import java.util.Objects;
import javax.crypto.spec.SecretKeySpec;
+
+import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED;
+import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED_DARK;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED;
@@ -528,12 +528,24 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
public GeckoResult onLoadError(@NonNull GeckoSession var1, @Nullable String var2, WebRequestError var3) {
if(status.sSettingIsAppStarted){
- errorHandler handler = new errorHandler();
+ pageErrorHandler handler = new pageErrorHandler();
mProgress = 0;
mPreviousErrorPage = true;
event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error);
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME);
- return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code,mContext.get(),var2));
+
+ InputStream mResourceURL = null;
+ try {
+ if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())){
+ mResourceURL = mContext.get().getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED);
+ }else {
+ mResourceURL = mContext.get().getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED_DARK);
+ }
+ }catch (Exception ignored){
+
+ }
+
+ return GeckoResult.fromValue("data:text/html," + handler.loadErrorPage(var3.category, var3.code,mContext.get(),var2, mResourceURL));
}
return null;
}
@@ -763,7 +775,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
String filename;
if(url.startsWith("blob")){
- loadUri(JavaScriptInterface.getBase64StringFromBlobUrl(url));
+ loadUri(internalFileDownloadManager.getBase64StringFromBlobUrl(url));
return true;
}
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/errorHandler.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/pageErrorHandler.java
old mode 100755
new mode 100644
similarity index 59%
rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/errorHandler.java
rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/pageErrorHandler.java
index b4f5d39e..9e90a9c5
--- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/errorHandler.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/pageErrorHandler.java
@@ -1,226 +1,169 @@
-package com.darkweb.genesissearchengine.helperManager;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import com.darkweb.genesissearchengine.constants.constants;
-import com.darkweb.genesissearchengine.constants.enums;
-import com.darkweb.genesissearchengine.constants.status;
-import com.darkweb.genesissearchengine.constants.strings;
-import com.darkweb.genesissearchengine.dataManager.dataController;
-import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.example.myapplication.R;
-
-import org.mozilla.geckoview.WebRequestError;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED;
-import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED_DARK;
-
-public class errorHandler
-{
- private AppCompatActivity mContext;
- private String mErrorTemplate;
- public String createErrorPage(final int category, final int error,AppCompatActivity mContext,String url) {
- this.mContext = mContext;
- if (mErrorTemplate == null) {
- InputStream stream = null;
- BufferedReader reader = null;
- StringBuilder builder = new StringBuilder();
- try {
- if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext)){
- stream = mContext.getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED);
- }else {
- stream = mContext.getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED_DARK);
- }
-
- reader = new BufferedReader(new InputStreamReader(stream));
-
- String line;
- while ((line = reader.readLine()) != null) {
- builder.append(line);
- builder.append("\n");
- }
-
- mErrorTemplate = builder.toString();
- } catch (IOException e) {
- return null;
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- }
- }
-
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException ignored) {
- }
- }
- }
- }
- String title = helperMethod.getHost(url);
-
- if(url==null){
- url = "Hidden Error";
- }
- if(title==null){
- title = "Hidden Error";
- }
-
- String replaceUrl = errorToString(error).replace("$URL",url);
- // String replaceUrl = errorToString(error).replace("$URL",url);
- // if(replaceUrl==null){
- // replaceUrl = "Hidden Error";
- // }
-
- String errorPage = createErrorPage("CODE : " + categoryToString(category) + "
TYPE : " + replaceUrl.replace("$TITLE",title),url);
- errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category));
- return errorPage;
- }
-
- private String translateMessage(String message,String error){
- 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_M3",mContext.getString(R.string.ERROR_M3));
- 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_M6",mContext.getString(R.string.ERROR_M6));
- message = message.replace("$ERROR", error);
-
- return message;
- }
-
- private String errorToString(final int error) {
- switch (error) {
- case WebRequestError.ERROR_UNKNOWN:
- return "ERROR_UNKNOWN" ;
- case WebRequestError.ERROR_SECURITY_SSL:
- return "ERROR_SECURITY_SSL";
- case WebRequestError.ERROR_SECURITY_BAD_CERT:
- return "ERROR_SECURITY_BAD_CERT";
- case WebRequestError.ERROR_NET_RESET:
- return "ERROR_NET_RESET";
- case WebRequestError.ERROR_NET_INTERRUPT:
- return "ERROR_NET_INTERRUPT";
- case WebRequestError.ERROR_NET_TIMEOUT:
- return "ERROR_NET_TIMEOUT";
- case WebRequestError.ERROR_CONNECTION_REFUSED:
- return "ERROR_CONNECTION_REFUSED";
- case WebRequestError.ERROR_UNKNOWN_PROTOCOL:
- return "ERROR_UNKNOWN_PROTOCOL";
- case WebRequestError.ERROR_UNKNOWN_HOST:
- return "ERROR_UNKNOWN_HOST";
- case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE:
- return "ERROR_UNKNOWN_SOCKET_TYPE";
- case WebRequestError.ERROR_UNKNOWN_PROXY_HOST:
- return "ERROR_UNKNOWN_PROXY_HOST";
- case WebRequestError.ERROR_MALFORMED_URI:
- return "ERROR_MALFORMED_URI";
- case WebRequestError.ERROR_REDIRECT_LOOP:
- return "ERROR_REDIRECT_LOOP";
- case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI:
- return "ERROR_SAFEBROWSING_PHISHING_URI";
- case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI:
- return "ERROR_SAFEBROWSING_MALWARE_URI";
- case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI:
- return "ERROR_SAFEBROWSING_UNWANTED_URI";
- case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI:
- return "ERROR_SAFEBROWSING_HARMFUL_URI";
- case WebRequestError.ERROR_CONTENT_CRASHED:
- return "ERROR_CONTENT_CRASHED";
- case WebRequestError.ERROR_OFFLINE:
- return "ERROR_OFFLINE";
- case WebRequestError.ERROR_PORT_BLOCKED:
- return "ERROR_PORT_BLOCKED";
- case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED:
- return "ERROR_PROXY_CONNECTION_REFUSED";
- case WebRequestError.ERROR_FILE_NOT_FOUND:
- return "ERROR_FILE_NOT_FOUND";
- case WebRequestError.ERROR_FILE_ACCESS_DENIED:
- return "ERROR_FILE_ACCESS_DENIED";
- case WebRequestError.ERROR_INVALID_CONTENT_ENCODING:
- return "ERROR_INVALID_CONTENT_ENCODING";
- case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE:
- return "ERROR_UNSAFE_CONTENT_TYPE";
- case WebRequestError.ERROR_CORRUPTED_CONTENT:
- return "ERROR_CORRUPTED_CONTENT";
- default:
- return "UNKNOWN";
- }
- }
- private String categoryToString(final int category)
- {
- switch (category)
- {
- case WebRequestError.ERROR_CATEGORY_UNKNOWN:
- return "ERROR_CATEGORY_UNKNOWN";
- case WebRequestError.ERROR_CATEGORY_SECURITY:
- return "ERROR_CATEGORY_SECURITY";
- case WebRequestError.ERROR_CATEGORY_NETWORK:
- return "ERROR_CATEGORY_NETWORK";
- case WebRequestError.ERROR_CATEGORY_CONTENT:
- return "ERROR_CATEGORY_CONTENT";
- case WebRequestError.ERROR_CATEGORY_URI:
- return "ERROR_CATEGORY_URI";
- case WebRequestError.ERROR_CATEGORY_PROXY:
- return "ERROR_CATEGORY_PROXY";
- case WebRequestError.ERROR_CATEGORY_SAFEBROWSING:
- return "ERROR_CATEGORY_SAFEBROWSING";
- default:
- return "UNKNOWN";
- }
- }
- private String createErrorPage(final String error,String url) {
- if(error==null){
- return strings.GENERIC_EMPTY_STR;
- }
-
- if (mErrorTemplate == null) {
- InputStream stream = null;
- BufferedReader reader = null;
- StringBuilder builder = new StringBuilder();
- try {
- if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext)){
- stream = mContext.getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED);
- }else {
- stream = mContext.getResources().getAssets().open(CONST_GENESIS_ERROR_CACHED_DARK);
- }
- reader = new BufferedReader(new InputStreamReader(stream));
-
- String line;
- while ((line = reader.readLine()) != null) {
- builder.append(line);
- builder.append("\n");
- }
-
- mErrorTemplate = builder.toString();
- } catch (IOException e) {
- return null;
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- }
- }
-
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- }
- }
- }
- }
- String replaceUrl = mErrorTemplate.replace("$URL",url);
-
- return replaceUrl;
- }
-
-}
+package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager;
+
+import androidx.appcompat.app.AppCompatActivity;
+import com.darkweb.genesissearchengine.constants.strings;
+import com.darkweb.genesissearchengine.helperManager.helperMethod;
+import com.example.myapplication.R;
+import org.mozilla.geckoview.WebRequestError;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class pageErrorHandler
+{
+ private AppCompatActivity mContext;
+ private String mErrorTemplate;
+
+ public String loadErrorPage(final int category, final int error, AppCompatActivity mContext, String url, InputStream mResourceURL) {
+ this.mContext = mContext;
+
+ try {
+ if (mErrorTemplate == null) {
+ StringBuilder builder = new StringBuilder();
+ InputStream stream = mResourceURL;
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
+
+ String line;
+ while ((line = reader.readLine()) != null) {
+ builder.append(line);
+ builder.append("\n");
+ }
+
+ mErrorTemplate = builder.toString();
+ }
+ String title = helperMethod.getHost(url);
+
+ if(url==null){
+ url = "Hidden Error";
+ }
+ if(title==null){
+ title = "Hidden Error";
+ }
+
+ String replaceUrl = errorToString(error).replace("$URL",url);
+ String errorPage = createErrorPage("CODE : " + categoryToString(category) + "
TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL);
+ errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category));
+ return errorPage;
+ }catch (Exception ex){
+ return strings.GENERIC_EMPTY_STR;
+ }
+
+ }
+
+ private String createErrorPage(final String error, String url, InputStream mResourceURL) throws IOException {
+ if(error==null){
+ return strings.GENERIC_EMPTY_STR;
+ }
+
+ StringBuilder builder = new StringBuilder();
+ InputStream stream = mResourceURL;
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
+
+ String line;
+ while ((line = reader.readLine()) != null) {
+ builder.append(line);
+ builder.append("\n");
+ }
+
+ mErrorTemplate = builder.toString();
+
+ String replaceUrl = mErrorTemplate.replace("$URL",url);
+
+ return replaceUrl;
+ }
+
+ private String translateMessage(String message,String error){
+ 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_M3",mContext.getString(R.string.ERROR_M3));
+ 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_M6",mContext.getString(R.string.ERROR_M6));
+ message = message.replace("$ERROR", error);
+
+ return message;
+ }
+
+ private String errorToString(final int error) {
+ switch (error) {
+ case WebRequestError.ERROR_UNKNOWN:
+ return "ERROR_UNKNOWN" ;
+ case WebRequestError.ERROR_SECURITY_SSL:
+ return "ERROR_SECURITY_SSL";
+ case WebRequestError.ERROR_SECURITY_BAD_CERT:
+ return "ERROR_SECURITY_BAD_CERT";
+ case WebRequestError.ERROR_NET_RESET:
+ return "ERROR_NET_RESET";
+ case WebRequestError.ERROR_NET_INTERRUPT:
+ return "ERROR_NET_INTERRUPT";
+ case WebRequestError.ERROR_NET_TIMEOUT:
+ return "ERROR_NET_TIMEOUT";
+ case WebRequestError.ERROR_CONNECTION_REFUSED:
+ return "ERROR_CONNECTION_REFUSED";
+ case WebRequestError.ERROR_UNKNOWN_PROTOCOL:
+ return "ERROR_UNKNOWN_PROTOCOL";
+ case WebRequestError.ERROR_UNKNOWN_HOST:
+ return "ERROR_UNKNOWN_HOST";
+ case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE:
+ return "ERROR_UNKNOWN_SOCKET_TYPE";
+ case WebRequestError.ERROR_UNKNOWN_PROXY_HOST:
+ return "ERROR_UNKNOWN_PROXY_HOST";
+ case WebRequestError.ERROR_MALFORMED_URI:
+ return "ERROR_MALFORMED_URI";
+ case WebRequestError.ERROR_REDIRECT_LOOP:
+ return "ERROR_REDIRECT_LOOP";
+ case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI:
+ return "ERROR_SAFEBROWSING_PHISHING_URI";
+ case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI:
+ return "ERROR_SAFEBROWSING_MALWARE_URI";
+ case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI:
+ return "ERROR_SAFEBROWSING_UNWANTED_URI";
+ case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI:
+ return "ERROR_SAFEBROWSING_HARMFUL_URI";
+ case WebRequestError.ERROR_CONTENT_CRASHED:
+ return "ERROR_CONTENT_CRASHED";
+ case WebRequestError.ERROR_OFFLINE:
+ return "ERROR_OFFLINE";
+ case WebRequestError.ERROR_PORT_BLOCKED:
+ return "ERROR_PORT_BLOCKED";
+ case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED:
+ return "ERROR_PROXY_CONNECTION_REFUSED";
+ case WebRequestError.ERROR_FILE_NOT_FOUND:
+ return "ERROR_FILE_NOT_FOUND";
+ case WebRequestError.ERROR_FILE_ACCESS_DENIED:
+ return "ERROR_FILE_ACCESS_DENIED";
+ case WebRequestError.ERROR_INVALID_CONTENT_ENCODING:
+ return "ERROR_INVALID_CONTENT_ENCODING";
+ case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE:
+ return "ERROR_UNSAFE_CONTENT_TYPE";
+ case WebRequestError.ERROR_CORRUPTED_CONTENT:
+ return "ERROR_CORRUPTED_CONTENT";
+ default:
+ return "UNKNOWN";
+ }
+ }
+ private String categoryToString(final int category)
+ {
+ switch (category)
+ {
+ case WebRequestError.ERROR_CATEGORY_UNKNOWN:
+ return "ERROR_CATEGORY_UNKNOWN";
+ case WebRequestError.ERROR_CATEGORY_SECURITY:
+ return "ERROR_CATEGORY_SECURITY";
+ case WebRequestError.ERROR_CATEGORY_NETWORK:
+ return "ERROR_CATEGORY_NETWORK";
+ case WebRequestError.ERROR_CATEGORY_CONTENT:
+ return "ERROR_CATEGORY_CONTENT";
+ case WebRequestError.ERROR_CATEGORY_URI:
+ return "ERROR_CATEGORY_URI";
+ case WebRequestError.ERROR_CATEGORY_PROXY:
+ return "ERROR_CATEGORY_PROXY";
+ case WebRequestError.ERROR_CATEGORY_SAFEBROWSING:
+ return "ERROR_CATEGORY_SAFEBROWSING";
+ default:
+ return "UNKNOWN";
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java
index 9d156fdf..1fc0ec6a 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java
@@ -3,8 +3,6 @@ package com.darkweb.genesissearchengine.appManager.homeManager.hintManager;
import android.annotation.SuppressLint;
import android.content.res.ColorStateList;
import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
@@ -19,21 +17,15 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
-import androidx.room.Ignore;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums;
import com.darkweb.genesissearchengine.constants.enums;
-import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
-import com.darkweb.genesissearchengine.dataManager.dataController;
-import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java
index 7cce7dba..e9c1d25e 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/editTextManager.java
@@ -8,7 +8,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.darkweb.genesissearchengine.constants.enums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
public class editTextManager extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java
index 8990efd3..cc3246ae 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java
@@ -29,7 +29,6 @@ import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputMethodManager;
import android.webkit.URLUtil;
import android.widget.*;
import androidx.annotation.NonNull;
@@ -68,9 +67,9 @@ import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.KeyboardUtils;
-import com.darkweb.genesissearchengine.helperManager.OnClearFromRecentService;
+import com.darkweb.genesissearchengine.helperManager.clearAllRecentServices;
import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme;
import com.darkweb.genesissearchengine.helperManager.trueTime;
@@ -480,6 +479,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void initPreFixes() {
try {
+ if(!status.mThemeApplying){
+ orbotLocalConstants.mTorLogsStatus = strings.GENERIC_EMPTY_STR;
+ }
+
Class clazz = Class.forName("java.lang.Daemons$FinalizerWatchdogDaemon");
Method method = Objects.requireNonNull(clazz.getSuperclass()).getDeclaredMethod("stop");
@@ -758,7 +761,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
@SuppressLint("ClickableViewAccessibility")
private void initializeLocalEventHandlers() {
- startService(new Intent(getBaseContext(), OnClearFromRecentService.class));
+ startService(new Intent(getBaseContext(), clearAllRecentServices.class));
registerReceiver(downloadStatus,new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java
index d324ea7a..1ef06a7c 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java
@@ -17,7 +17,6 @@ import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Build;
-import android.os.Debug;
import android.os.Handler;
import android.os.Message;
import android.text.method.MovementMethod;
@@ -42,8 +41,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.darkweb.genesissearchengine.helperManager.animatedColor;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.helperManager.colorAnimationReciever;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.widget.progressBar.AnimatedProgressBar;
import com.example.myapplication.R;
@@ -57,9 +56,6 @@ import java.util.List;
import java.util.concurrent.Callable;
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_DOMAIN_URL;
-import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL;
-import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE;
-import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP;
@@ -493,7 +489,7 @@ class homeViewController
public void initStatusBarColor(boolean mInstant) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2));
+ colorAnimationReciever oneToTwo = new colorAnimationReciever(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2));
int mDelay = 1350;
if(status.mThemeApplying || mInstant){
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java
index 8e313763..427c5650 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java
@@ -1,19 +1,11 @@
package com.darkweb.genesissearchengine.appManager.landingManager;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
import android.os.Build;
-import android.view.View;
import android.view.Window;
import android.view.WindowManager;
-import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
-import com.darkweb.genesissearchengine.helperManager.animatedColor;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
class landingViewController
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java
index a627b8c1..d41980fa 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageAdapter.java
@@ -14,7 +14,7 @@ import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.status;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java
index 41cb03b7..78431d89 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageController.java
@@ -14,13 +14,12 @@ import androidx.recyclerview.widget.SimpleItemAnimator;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
-import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageViewController.java
index e5ef11da..e8c5f190 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageViewController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/languageManager/languageViewController.java
@@ -4,15 +4,13 @@ import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
-import android.widget.Button;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
-import java.util.ArrayList;
import java.util.List;
class languageViewController
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java
index bca37541..28897e4c 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java
@@ -10,10 +10,10 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
-
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.constants.constants;
+import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import org.torproject.android.service.wrapper.logRowModel;
import java.util.ArrayList;
@@ -26,9 +26,9 @@ public class orbotLogAdapter extends RecyclerView.Adapter mModelList;
private eventObserver.eventListener mEvent;
- orbotLogAdapter(ArrayList model_list, eventObserver.eventListener event) {
- this.mModelList = model_list;
- this.mEvent = event;
+ orbotLogAdapter(ArrayList pModelList, eventObserver.eventListener pEvent) {
+ this.mModelList = pModelList;
+ this.mEvent = pEvent;
}
@NonNull @Override
@@ -71,12 +71,13 @@ public class orbotLogAdapter extends RecyclerView.Adapter pData){
return null;
}
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java
index 15354764..4160b22e 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java
@@ -1,23 +1,25 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
+import android.annotation.SuppressLint;
import android.content.res.Configuration;
+import android.os.Build;
import android.os.Bundle;
-import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewTreeObserver;
import android.widget.TextView;
-
import androidx.annotation.NonNull;
+import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView;
+import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
-import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter;
-import com.darkweb.genesissearchengine.helperManager.eventObserver;
+import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
@@ -27,38 +29,46 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.util.Collections;
import java.util.List;
+import java.util.Objects;
+
+import static com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogEnums.eOrbotLogViewCommands.M_SCROLL_THEME_UPDATE;
public class orbotLogController extends AppCompatActivity {
/* PRIVATE VARIABLES */
- private orbotLogModel mOrbotModel;
- private orbotLogViewController mOrbotViewController;
- private RecyclerView mRecycleView;
- private orbotLogAdapter mOrbotAdapter;
- private NestedScrollView mMainScroll;
- private FloatingActionButton mFloatingScroller;
- private TextView mLogs;
+ private orbotLogModel mOrbotModel;
+ private orbotLogViewController mOrbotLogViewController;
+ private orbotLogAdapter mOrbotAdapter;
private boolean mActivityClosed = false;
private int mLogCounter = 0;
- private GestureDetector mSwipeDirectionDetector;
- private boolean mIsLayoutChanging = false;
+ private boolean mIsRecycleviewInteracting = false;
+
+ /* UI VARIABLES */
+
+ private TextView mLogs;
+ private RecyclerView mLogRecycleView;
+ private NestedScrollView mNestedScrollView;
+ private FloatingActionButton mFloatingScroller;
/* INITIALIZATIONS */
+ @RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse);
+ activityContextManager.getInstance().setOrbotLogController(this);
+ activityContextManager.getInstance().onStack(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.orbot_log_view);
- viewsInitializations();
- onUpdateLogs();
+ initializeViews();
initializeLogs();
- onInitListener();
+ initListener();
+ updateLogs();
}
@Override
@@ -72,22 +82,19 @@ public class orbotLogController extends AppCompatActivity {
super.onConfigurationChanged(newConfig);
}
- public void viewsInitializations() {
- mRecycleView = findViewById(R.id.pLogRecycleView);
+ public void initializeViews() {
+ mLogRecycleView = findViewById(R.id.pLogRecycleView);
mLogs = findViewById(R.id.pLogs);
- mMainScroll = findViewById(R.id.mMainScroll);
+ mNestedScrollView = findViewById(R.id.pNestedScrollView);
mFloatingScroller = findViewById(R.id.pFloatingScroller);
- activityContextManager.getInstance().setOrbotLogController(this);
- activityContextManager.getInstance().onStack(this);
- mOrbotViewController = new orbotLogViewController(this, mLogs, mRecycleView);
+ mOrbotLogViewController = new orbotLogViewController(this, new orbotLogViewCallback() , mLogs, mLogRecycleView, mNestedScrollView, mFloatingScroller);
mOrbotModel = new orbotLogModel();
-
}
public void initializeLogs(){
mLogCounter = 0;
- if(status.sLogListView){
+ if(status.sLogThemeStyleAdvanced){
mLogCounter = orbotLocalConstants.mTorLogsHistory.size();
mOrbotModel.setList(orbotLocalConstants.mTorLogsHistory);
LinearLayoutManager layoutManager = new LinearLayoutManager(orbotLogController.this);
@@ -95,105 +102,116 @@ public class orbotLogController extends AppCompatActivity {
mOrbotAdapter = adapter;
layoutManager.setReverseLayout(true);
+ mLogRecycleView.setAdapter(adapter);
+ Objects.requireNonNull(mLogRecycleView.getItemAnimator()).setAddDuration(250);
+
+ mLogRecycleView.setNestedScrollingEnabled(false);
+ mLogRecycleView.setLayoutManager(new LinearLayoutManager(orbotLogController.this));
- mRecycleView.setNestedScrollingEnabled(false);
- mRecycleView.setLayoutManager(new LinearLayoutManager(orbotLogController.this));
mOrbotAdapter.notifyDataSetChanged();
+
}else {
logToString();
}
- mOrbotViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS, null);
- mRecycleView.smoothScrollToPosition(mOrbotModel.getList().size());
+ mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS, Collections.singletonList(status.sLogThemeStyleAdvanced));
+ mLogRecycleView.smoothScrollToPosition(mOrbotModel.getList().size());
+ }
+
+
+ /* LISTENERS */
+
+ @SuppressLint("ClickableViewAccessibility")
+ private void initListener(){
+
+ mLogRecycleView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+ @SuppressLint("NewApi") @SuppressWarnings("deprecation")
+ @Override
+ public void onGlobalLayout() {
+ if(orbotLogStatus.sScrollPosition!=-1){
+ mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition);
+ }else if(mNestedScrollView.canScrollVertically(1)){
+ onScrollBottom(null);
+ }
+
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
+ mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
+ orbotLogStatus.sScrollPosition = scrollY;
+ });
+ }
+ mOrbotLogViewController.onTrigger(M_SCROLL_THEME_UPDATE);
+ mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+ }
+ });
+
+ mNestedScrollView.setOnTouchListener((v, event) -> {
+ if(mNestedScrollView.canScrollVertically(1)){
+ orbotLogStatus.sUIInteracted = true;
+ }
+
+ if(event.getAction() == MotionEvent.ACTION_UP){
+ mOrbotLogViewController.onTrigger(M_SCROLL_THEME_UPDATE);
+ }
+
+ if(event.getAction() == MotionEvent.ACTION_UP){
+ mIsRecycleviewInteracting = false;
+ }else if(event.getAction() == MotionEvent.ACTION_DOWN){
+ mIsRecycleviewInteracting = true;
+ }
+
+ return false;
+ });
+
+ mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> {
+ if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) {
+ mOrbotLogViewController.onTrigger(M_SCROLL_THEME_UPDATE);
+
+ if(!mIsRecycleviewInteracting){
+ orbotLogStatus.sUIInteracted = false;
+ }
+ }
+ });
}
public void logToString(){
for(int mCounter=0;mCounter mIsLayoutChanging = false);
-
- mMainScroll.getViewTreeObserver().addOnScrollChangedListener(() -> {
- if(status.sLogListView){
- if(mMainScroll.canScrollVertically(1)){
- if(mFloatingScroller.getAlpha()==0){
- mFloatingScroller.setVisibility(View.VISIBLE);
- mFloatingScroller.animate().cancel();
- mFloatingScroller.animate().alpha(1);
- }
- }else {
- mFloatingScroller.animate().cancel();
- mFloatingScroller.animate().alpha(0).withEndAction(() -> mFloatingScroller.setVisibility(View.GONE));
- }
- }
- });
-
- mSwipeDirectionDetector=new GestureDetector(this,new SimpleGestureFilter(){
-
- @Override
- public boolean onSwipe(Direction direction) {
- if (direction==Direction.right){
- finish();
- overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out);
- }
- return true;
- }
- });
- }
-
- public void onUpdateLogs(){
-
+ public void updateLogs(){
new Thread(){
public void run(){
- while (true){
+ while (!mActivityClosed){
try {
- if(mActivityClosed){
- break;
- }
- boolean mLayoutChangeTemp = mIsLayoutChanging;
- if(mIsLayoutChanging){
- if(status.sLogListView){
- sleep(1000);
- }else {
- sleep(50);
- }
- continue;
+ if(status.sLogThemeStyleAdvanced){
+ sleep(800);
}else {
- if(status.sLogListView){
- sleep(500);
- }else {
- sleep(50);
- }
- if(mLayoutChangeTemp != mIsLayoutChanging){
- continue;
- }
+ sleep(100);
}
+
if(orbotLocalConstants.mTorLogsHistory.size()>0){
- mIsLayoutChanging = true;
runOnUiThread(() -> {
if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){
mOrbotModel.getList().add(orbotLocalConstants.mTorLogsHistory.get(mLogCounter));
- if(!status.sLogListView){
- mOrbotViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(orbotLocalConstants.mTorLogsHistory.get(mLogCounter).getLog()));
- mIsLayoutChanging = false;
- onScrollBottom(null);
+ if(!status.sLogThemeStyleAdvanced){
+ mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(orbotLocalConstants.mTorLogsHistory.get(mLogCounter).getLog()));
}else {
if(mOrbotAdapter!=null){
mOrbotAdapter.notifyItemInserted(mOrbotModel.getList().size()-1);
}
}
- }else {
- mIsLayoutChanging = false;
+ mLogCounter+=1;
+ }
+ });
+ }
+ sleep(100);
+ if(!orbotLogStatus.sUIInteracted){
+ runOnUiThread(() -> {
+ if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter) {
+ onScrollBottom(null);
}
- mLogCounter+=1;
});
- sleep(500);
}
} catch (InterruptedException e) {
e.printStackTrace();
@@ -203,8 +221,11 @@ public class orbotLogController extends AppCompatActivity {
}.start();
}
+ /* View Callback */
+
public void onScrollBottom(View view) {
- mMainScroll.fullScroll(View.FOCUS_DOWN);
+ mNestedScrollView.fullScroll(View.FOCUS_DOWN);
+ orbotLogStatus.sUIInteracted = false;
}
public void onOpenInfo(View view) {
@@ -218,12 +239,15 @@ public class orbotLogController extends AppCompatActivity {
mActivityClosed = true;
}
- @Override
- protected void onDestroy() {
- super.onDestroy();
- activityContextManager.getInstance().onRemoveStack(this);
- activityContextManager.getInstance().setOrbotLogController(null);
- mActivityClosed = true;
+ /* View Callback */
+
+ private class orbotLogViewCallback implements eventObserver.eventListener{
+
+ @Override
+ public Object invokeObserver(List