diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index c29a085e..5e39aaa4 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -22,7 +22,7 @@
-
+
diff --git a/app/build.gradle b/app/build.gradle
index d46f3ae3..e3ad6901 100755
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -132,7 +132,7 @@ dependencies {
/* Orbot Service */
- implementation project(path: ':orbotservice')
+ implementation project(path: ':orbotservicemanager')
/* Helper Libraries */
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 6dce34a4..a0afe01b 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
@@ -4,11 +4,12 @@ import android.content.Context;
import androidx.core.view.NestedScrollingChildHelper;
import androidx.core.view.ViewCompat;
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 org.mozilla.geckoview.GeckoView;
+import org.mozilla.geckoview.PanZoomController;
+
import java.util.Collections;
import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_CHANGED;
@@ -19,7 +20,7 @@ public class NestedGeckoView extends GeckoView {
private int mNestedOffsetY;
private NestedScrollingChildHelper mChildHelper;
private eventObserver.eventListener mEvent;
-
+ private int mInputResult = PanZoomController.INPUT_RESULT_UNHANDLED;
public void onSetHomeEvent(eventObserver.eventListener pEvent){
mEvent = pEvent;
@@ -30,79 +31,85 @@ public class NestedGeckoView extends GeckoView {
mChildHelper = null;
}
- public NestedGeckoView(Context context, AttributeSet attrs) {
- super(context.getApplicationContext(), attrs);
+ public NestedGeckoView(final Context context) {
+ this(context, null);
+ }
+ public NestedGeckoView(final Context context, final AttributeSet attrs) {
+ super(context, attrs);
mChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
- final MotionEvent event = MotionEvent.obtain(ev);
- final int action = ev.getActionMasked();
+ boolean eventHandled = false;
+ final MotionEvent event = MotionEvent.obtain(ev);
+ final int action = event.getActionMasked();
if (action == MotionEvent.ACTION_DOWN) {
mNestedOffsetY = 0;
}
-
final int eventY = (int) event.getY();
event.offsetLocation(0, mNestedOffsetY);
switch (action) {
case MotionEvent.ACTION_MOVE:
- // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
final boolean allowScroll = status.sFullScreenBrowsing;
int deltaY = mLastY - eventY;
if (allowScroll && dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) {
deltaY -= mScrollConsumed[1];
+ mLastY = eventY - mScrollOffset[1];
event.offsetLocation(0, -mScrollOffset[1]);
mNestedOffsetY += mScrollOffset[1];
}
-
- mLastY = eventY - mScrollOffset[1];
+ eventHandled = super.onTouchEvent(event);
+ mEvent.invokeObserver(Collections.singletonList(deltaY), GECKO_SCROLL_CHANGED);
if (allowScroll && dispatchNestedScroll(0, mScrollOffset[1], 0, deltaY, mScrollOffset)) {
- mLastY -= mScrollOffset[1];
event.offsetLocation(0, mScrollOffset[1]);
mNestedOffsetY += mScrollOffset[1];
+ mLastY -= mScrollOffset[1];
}
-
- if(status.sFullScreenBrowsing){
- Log.i("wow1", eventY + "");
- mEvent.invokeObserver(Collections.singletonList(deltaY), GECKO_SCROLL_CHANGED);
- }
-
break;
case MotionEvent.ACTION_DOWN:
+ eventHandled = super.onTouchEvent(event);
mLastY = eventY;
+
startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL);
- // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
break;
case MotionEvent.ACTION_UP:
- // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
case MotionEvent.ACTION_CANCEL:
- // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
+ eventHandled = super.onTouchEvent(event);
stopNestedScroll();
break;
default:
- // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED);
+ // We don't care about other touch events
}
- // Execute event handler from parent class in all cases
- boolean eventHandled = super.onTouchEvent(event);
-
- // Recycle previously obtained event
- event.recycle();
-
return eventHandled;
}
+ private boolean callSuperOnTouchEvent(MotionEvent event) {
+ return super.onTouchEvent(event);
+ }
+
+ private void updateInputResult(MotionEvent event) {
+ super.onTouchEventForResult(event).accept(inputResult -> {
+ mInputResult = inputResult;
+ startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL);
+ });
+ }
+
+ public int getInputResult() {
+ return mInputResult;
+ }
+
@Override
public void setNestedScrollingEnabled(boolean enabled) {
mChildHelper.setNestedScrollingEnabled(enabled);
@@ -129,7 +136,11 @@ public class NestedGeckoView extends GeckoView {
}
@Override
- public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) {
+ public boolean dispatchNestedScroll(int dxConsumed,
+ int dyConsumed,
+ int dxUnconsumed,
+ int dyUnconsumed,
+ int[] offsetInWindow) {
return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow);
}
@@ -142,4 +153,9 @@ public class NestedGeckoView extends GeckoView {
public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) {
return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed);
}
+
+ @Override
+ public boolean dispatchNestedPreFling(float velocityX, float velocityY) {
+ return mChildHelper.dispatchNestedPreFling(velocityX, velocityY);
+ }
}
\ No newline at end of file
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 299dcb6a..bfdea361 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
@@ -281,12 +281,12 @@ public class geckoClients
mRuntime.getStorageController().clearData(COOKIES);
}
- public void onBackPressed(boolean isFinishAllowed){
+ public void onBackPressed(boolean isFinishAllowed, int mTabSize){
if(mSession.canGoBack()){
mSession.goBackSession();
}
else if(isFinishAllowed){
- if(mSession.getRemovableFromBackPressed()){
+ if(mSession.getRemovableFromBackPressed() && mTabSize>1){
event.invokeObserver(null, enums.etype.M_CLOSE_TAB);
}else {
event.invokeObserver(null, enums.etype.back_list_empty);
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 67754ebe..01850313 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
@@ -114,6 +114,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
private boolean mIsProgressBarChanging = false;
private Handler mFindHandler;
private boolean mClosed = false;
+ private SessionState mSessionState;
geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){
@@ -369,6 +370,10 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
mHistoryList = var2;
}
+ @UiThread
+ public void onSessionStateChange(@NonNull GeckoSession session, @NonNull SessionState sessionState) {
+ mSessionState = sessionState;
+ }
/*Navigation Delegate*/
public void onLocationChange(@NonNull GeckoSession var1, @Nullable String var2) {
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 78dcbc66..f9a4abd8 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
@@ -1,6 +1,7 @@
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;
@@ -46,9 +47,6 @@ public class hintAdapter extends RecyclerView.Adapter mHintList;
private AppCompatActivity mContext;
private eventObserver.eventListener mEvent;
- private Map mWebIcon = new HashMap<>();
- private ArrayList mKeys = new ArrayList<>();
- private Map mHandlers = new HashMap<>();
private Map mPastWebIcon = new HashMap<>();
private Map mPastIconFlicker = new HashMap<>();
@@ -70,9 +68,10 @@ public class hintAdapter extends RecyclerView.Adapter new Handler().postDelayed(() ->
+ {
+ if(mHindTypeIconTemp.getDrawable() != null){
+ if(mURLPast.equals(mPastIconFlicker.get(getLayoutPosition()))){
+ mHintWebIcon.setImageTintList(null);
+ mHintWebIcon.setImageDrawable(mHindTypeIconTemp.getDrawable());
+ mPastWebIcon.put(getLayoutPosition(),mHintWebIcon.getDrawable());
}
- if(mCounter>6){
- break;
+ if(getLayoutPosition() == 1){
+ Log.i("FUSSSS1111","FUSSSS4444");
}
}
+ }, 200));
- mContext.runOnUiThread(() -> {
- mWebIcon.put(mURLLink,mHindTypeIconTemp.getDrawable());
- mKeys.add(mURLLink);
-
- if(mKeys.size()>5){
- mWebIcon.remove(mKeys.get(0));
- mKeys.remove(0);
- }
-
- if(mHindTypeIconTemp.getDrawable() != null){
- if(mHandlers.containsKey(getLayoutPosition())){
- mHandlers.get(getLayoutPosition()).removeCallbacksAndMessages(null);
- if(getLayoutPosition()==1){
- Log.i("SUPERFUCK1","SUPERFUCK1");
- }
- }else {
- mHandlers.put(getLayoutPosition(), new Handler());
- }
-
- if(mURLPast.equals(mPastIconFlicker.get(getLayoutPosition()))){
- Runnable mRunnable = () -> {
- mHintWebIcon.setColorFilter(null);
- mHintWebIcon.clearColorFilter();
- mHintWebIcon.setImageTintList(null);
- mHintWebIcon.setClipToOutline(true);
- mHintWebIcon.setImageDrawable(mHindTypeIconTemp.getDrawable());
- mPastWebIcon.put(getLayoutPosition(),mHindTypeIconTemp.getDrawable());
-
- if(getLayoutPosition() == 1){
- Log.i("FUSSSS1111","FUSSSS1111");
- }
-
- };
- mHandlers.get(getLayoutPosition()).postDelayed(mRunnable, 200);
- }
-
- }else {
- if(mURLPast.equals(mPastIconFlicker.get(getLayoutPosition()))){
- Resources res = itemView.getContext().getResources();
- try {
- Log.i("FUSSSS1111","FUSSSS2222");
- mHintWebIcon.setImageDrawable(Drawable.createFromXml(res, res.getXml(R.xml.ic_baseline_browser)));
- } catch (Exception ignored) {
- }
- }
- }
-
- });
-
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
- }.start();
- }
+ }
+ }.start();
}
}
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 3b1dcf07..f2ce97d1 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
@@ -814,10 +814,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba
int[] location = new int[2];
mTopLayout.getLocationOnScreen(location);
int y = location[1];
- if(y<=-12){
- mAppBar.setExpanded(false,true);
- }else {
- mAppBar.setExpanded(true,true);
+ if(status.sFullScreenBrowsing){
+ if(y<=-helperMethod.pxFromDp(6)){
+ mAppBar.setExpanded(false,true);
+ }else {
+ mAppBar.setExpanded(true,true);
+ }
}
}
@@ -869,7 +871,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mEdittextChanged.removeCallbacks(postToServerRunnable);
mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mText));
- mEdittextChanged.postDelayed(postToServerRunnable, 350);
+ mEdittextChanged.postDelayed(postToServerRunnable, 150);
return;
}
if(mSuggestions.size()>0){
@@ -882,7 +884,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mSearchBarLoading = true;
mEdittextChanged.postDelayed(postToServerRunnable, 0);
}else{
- mEdittextChanged.postDelayed(postToServerRunnable, 350);
+ mEdittextChanged.postDelayed(postToServerRunnable, 150);
}
}
}
@@ -975,7 +977,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
final Handler handler = new Handler();
handler.postDelayed(() -> {
mSearchBarLoading = false;
- }, 350);
+ }, 150);
};
public void onSearchBarInvoked(View view){
@@ -1086,7 +1088,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
public void postNewLinkTabAnimationInBackgroundTrigger(String url){
- initTabCount(M_NEW_LINK_IN_NEW_TAB, Collections.singletonList(url));
+ String mExtention = helperMethod.getMimeType(url, this);
+ if(mExtention == null || mExtention.equals("text/html") || mExtention.equals("application/vnd.ms-htmlhelp") || mExtention.equals("application/vnd.sun.xml.writer") || mExtention.equals("application/vnd.sun.xml.writer.global") || mExtention.equals("application/vnd.sun.xml.writer.template") || mExtention.equals("application/xhtml+xml")){
+ initTabCount(M_NEW_LINK_IN_NEW_TAB, Collections.singletonList(url));
+ }else {
+ postNewLinkTabAnimation(url, true);
+ }
}
public void postNewLinkTabAnimationInBackground(String url){
@@ -1185,6 +1192,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(!status.mThemeApplying){
runOnUiThread(() -> {
mHomeViewController.onShowTabContainer();
+ pluginController.getInstance().onMessageManagerInvoke(null, M_RESET);
activityContextManager.getInstance().getTabController().onInitInvoked();
});
}
@@ -1207,7 +1215,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
initLocalLanguage();
helperMethod.hideKeyboard(this);
- mHomeViewController.onOpenMenu(view,mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() ==View.INVISIBLE),mGeckoClient.getUserAgent());
+ mHomeViewController.onOpenMenu(view,mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() ==View.INVISIBLE),mGeckoClient.getUserAgent(), mGeckoClient.getSession().getCurrentURL());
view.setClickable(false);
new Handler().postDelayed(() ->
@@ -1259,7 +1267,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onClearSelections(true);
}
else if(!mSearchBarWasBackButtonPressed){
- mGeckoClient.onBackPressed(true);
+ int mTabSize = (int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null);
+ mGeckoClient.onBackPressed(true, mTabSize);
}
}
@@ -1325,6 +1334,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
mHomeViewController.onClearSelections(true);
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true);
+ mHomeViewController.initTopBarPadding();
}
@Override
@@ -1635,6 +1645,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
onNewTab(isKeyboardOpened, true);
}
}
+ else if (menuId == R.id.menuItem25) {
+ pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(mGeckoClient.getSession().getCurrentURL(), this), M_DOWNLOAD_SINGLE);
+ }
else {
mSearchbar.clearFocus();
if (menuId == R.id.menu12) {
@@ -1646,6 +1659,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
helperMethod.hideKeyboard(this);
mGeckoClient.onRedrawPixel(homeController.this);
mHomeViewController.onShowTabContainer();
+ pluginController.getInstance().onMessageManagerInvoke(null, M_RESET);
Log.i("I AM FUCKED,","I AM FUCKED : 1");
activityContextManager.getInstance().getTabController().onInit();
}
@@ -2061,7 +2075,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, true));
}
}
- }, 400);
+ }, 100);
};
mScrollHandler.postDelayed(mScrollRunnable, 450);
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 640de0af..40ca805d 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
@@ -8,6 +8,7 @@ import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.ActivityInfo;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
@@ -220,6 +221,16 @@ class homeViewController
int paddingDp = 110;
if(isFullScreen){
paddingDp = 60;
+ }else {
+ if(mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
+ paddingDp = 0;
+ }else {
+ mGeckoView.setPadding(0,0,0,0);
+ View child = mAppBar.getChildAt(0);
+ AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams();
+ params.setScrollFlags(0);
+ return;
+ }
}
float density = mContext.getResources().getDisplayMetrics().density;
int paddingPixel = (int)(paddingDp * density);
@@ -282,7 +293,7 @@ class homeViewController
}
public void onShowTabContainer(){
-
+ onHideLoadTabDialog();
if(mTabFragment.getAlpha()==0 || mTabFragment.getAlpha()==1){
onUpdateStatusBarTheme(null, false);
@@ -294,6 +305,7 @@ class homeViewController
}
public void onHideTabContainer(){
+ onHideLoadTabDialog();
if(mTabFragment.getAlpha()>0 || mTabFragment.getVisibility()!=View.GONE){
Log.i("SUPERFUCK4","SUPERFUCK");
mNewTab.setPressed(false);
@@ -683,7 +695,7 @@ class homeViewController
/*-------------------------------------------------------Helper Methods-------------------------------------------------------*/
- void onOpenMenu(View view, boolean canGoForward, boolean isLoading, int userAgent){
+ void onOpenMenu(View view, boolean canGoForward, boolean isLoading, int userAgent, String mURL){
if(popupWindow!=null){
popupWindow.dismiss();
@@ -720,17 +732,28 @@ class homeViewController
ImageButton back = popupView.findViewById(R.id.menu22);
ImageButton close = popupView.findViewById(R.id.menu20);
+ ImageButton mRefresh = popupView.findViewById(R.id.menu21);
+ ImageButton mDownload = popupView.findViewById(R.id.menuItem25);
CheckBox desktop = popupView.findViewById(R.id.menu27);
LinearLayout newTab = popupView.findViewById(R.id.menu11);
desktop.setChecked(userAgent==USER_AGENT_MODE_DESKTOP);
+ String mExtention = helperMethod.getMimeType(mURL, mContext);
+ if(mExtention == null || mExtention.equals("text/html") || mExtention.equals("application/vnd.ms-htmlhelp") || mExtention.equals("application/vnd.sun.xml.writer") || mExtention.equals("application/vnd.sun.xml.writer.global") || mExtention.equals("application/vnd.sun.xml.writer.template") || mExtention.equals("application/xhtml+xml")){
+ mDownload.setEnabled(false);
+ mDownload.setColorFilter(Color.argb(255, 191, 191, 191));
+ }
+
if(!canGoForward){
back.setEnabled(false);
back.setColorFilter(Color.argb(255, 191, 191, 191));
}
if(!isLoading){
- close.setEnabled(false);
- close.setColorFilter(Color.argb(255, 191, 191, 191));
+ close.setVisibility(View.GONE);
+ mRefresh.setVisibility(View.VISIBLE);
+ }else {
+ close.setVisibility(View.VISIBLE);
+ mRefresh.setVisibility(View.GONE);
}
newTab.setClickable(false);
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java
index 0e088e5f..d594db02 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java
@@ -5,7 +5,7 @@ public class enums
/*Settings Manager*/
public enum etype{
on_update_favicon,ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW,ON_NEW_TAB_ANIMATION, ON_LOAD_REQUEST,GECKO_SCROLL_CHANGED,ON_UPDATE_SEARCH_BAR,M_ON_MAIL,SESSION_ID,M_UPDATE_PIXEL_BACKGROUND,M_CACHE_UPDATE_TAB,
- on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,
+ on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,M_DOWNLOAD_FAILURE,
welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT_FORCED,M_SPLASH_DISABLE,M_NEW_LINK_IN_NEW_TAB,M_RESET_SUGGESTION,
url_triggered, url_triggered_new_tab,url_clear,fetch_favicon,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB,
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_INITIALIZE_TAB_SINGLE, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_FIRST_PAINT, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error,download_file_popup,on_init_ads,search_update, open_new_tab,open_new_tab_instant
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java
index 9e6a76c9..48a32942 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java
@@ -293,6 +293,19 @@ public class helperMethod
return bitmap;
}
+ public static String getMimeType(Context context, Uri uri) {
+ String extension;
+
+ if (uri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) {
+ final MimeTypeMap mime = MimeTypeMap.getSingleton();
+ extension = mime.getExtensionFromMimeType(context.getContentResolver().getType(uri));
+ } else {
+ extension = MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(new File(uri.getPath())).toString());
+ }
+
+ return extension;
+ }
+
public static void hideKeyboard(AppCompatActivity context) {
View view = context.findViewById(android.R.id.content);
if (view != null)
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java
index f278bb09..999567a1 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java
@@ -37,12 +37,14 @@ import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.text.DecimalFormat;
+import java.util.Collections;
import ch.boye.httpclientandroidlib.HttpHost;
import ch.boye.httpclientandroidlib.HttpResponse;
import ch.boye.httpclientandroidlib.client.methods.HttpGet;
import ch.boye.httpclientandroidlib.conn.params.ConnRoutePNames;
+import static com.darkweb.genesissearchengine.constants.enums.etype.M_DOWNLOAD_FAILURE;
import static java.lang.Thread.sleep;
@@ -64,12 +66,14 @@ public class localFileDownloader extends AsyncTask {
private float mTotalByte;
private float mDownloadByte;
private String mURL;
+ private eventObserver.eventListener mEvent;
- public localFileDownloader(Context pContext, String pURL, String pFileName, int pID) {
+ public localFileDownloader(Context pContext, String pURL, String pFileName, int pID, eventObserver.eventListener pEvent) {
this.context = pContext;
this.mFileName = pFileName;
this.mURL = pURL;
this.mID = pID;
+ this.mEvent = pEvent;
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
@@ -193,6 +197,7 @@ public class localFileDownloader extends AsyncTask {
} catch (Exception ex) {
Log.i("FIZZAHFUCK", ex.getMessage());
if(mRequestCode>300){
+ mEvent.invokeObserver(Collections.singletonList(mRequestCode), M_DOWNLOAD_FAILURE);
//Toast.makeText(context,"Request Forbidden Error Code : ",mRequestCode).show();
}
onCancel();
@@ -256,7 +261,7 @@ public class localFileDownloader extends AsyncTask {
mStream.close();
}catch (Exception ex){
if(mRequestCode>300){
- //Toast.makeText(context,"Request Forbidden Error Code : ",mRequestCode).show();
+ mEvent.invokeObserver(Collections.singletonList(mRequestCode), M_DOWNLOAD_FAILURE);
}
onCancel();
}
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadManager.java
index a9fc9b82..24fa1924 100644
--- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadManager.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadManager.java
@@ -16,11 +16,14 @@ class downloadManager
private WeakReference mAppContext;
private Map mDownloads = new HashMap<>();
+ private eventObserver.eventListener mEvent;
/*Initializations*/
downloadManager(WeakReference pAppContext, eventObserver.eventListener pEvent){
this.mAppContext = pAppContext;
+ this.mEvent = pEvent;
+
initialize();
}
@@ -30,7 +33,7 @@ class downloadManager
private void startDownload(String pPath,String pFile) {
int mID = helperMethod.createNotificationID();
- localFileDownloader mFileDownloader = (localFileDownloader)new localFileDownloader(mAppContext.get().getApplicationContext(),pPath, pFile, mID).execute(pPath);
+ localFileDownloader mFileDownloader = (localFileDownloader)new localFileDownloader(mAppContext.get().getApplicationContext(),pPath, pFile, mID, mEvent).execute(pPath);
mDownloads.put(mID,mFileDownloader);
}
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java
index aadac78b..b44459c7 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java
@@ -174,6 +174,26 @@ class messageManager
handler.postDelayed(runnable, 1500);
}
+ private void mDownloadFailure()
+ {
+ mContext.runOnUiThread(() -> {
+ final Handler handler = new Handler();
+ Runnable runnable = () -> mDialog.dismiss();
+
+ initializeDialog(R.layout.popup_download_failure, Gravity.BOTTOM);
+ ((TextView)mDialog.findViewById(R.id.pDescription)).setText(("Request denied Error " + mData.get(0)));
+ mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss());
+
+ mDialog.setOnDismissListener(dialog -> {
+ handler.removeCallbacks(runnable);
+ onClearReference();
+ });
+
+ handler.postDelayed(runnable, 20000);
+
+ });
+ }
+
private void popupBlocked()
{
final Handler handler = new Handler();
@@ -440,14 +460,14 @@ class messageManager
mDialog.dismiss();
});
mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> {
- mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_CURRENT_TAB);
- mDialog.dismiss();
- });
- mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_NEW_TAB);
mDialog.dismiss();
});
mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> {
+ mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_CURRENT_TAB);
+ mDialog.dismiss();
+ });
+ mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> {
mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK);
mDialog.dismiss();
});
@@ -672,6 +692,11 @@ class messageManager
newIdentityCreated();
break;
+ case M_DOWNLOAD_FAILURE:
+ /*VERIFIED*/
+ mDownloadFailure();
+ break;
+
case M_POPUP_BLOCKED:
/*VERIFIED*/
popupBlocked();
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java
index 927a2625..f396a4e7 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java
@@ -138,8 +138,12 @@ public class pluginController
/*Download Manager*/
private class downloadCallback implements eventObserver.eventListener{
@Override
- public Object invokeObserver(List