From fc79df39a92fe9f4144485f7a14beb403c51a6c7 Mon Sep 17 00:00:00 2001 From: msmannan00 Date: Thu, 25 Mar 2021 02:13:45 +0500 Subject: [PATCH] Bug Fixes Bug Fixes --- .../main/assets/Homepage/homepage-dark.html | 2 +- app/src/main/assets/Homepage/homepage.html | 2 +- .../Homepage/style/cs-homepage-dark.css | 2 +- .../bookmarkManager/bookmarkController.java | 27 ++- .../historyManager/historyController.java | 29 ++- .../geckoManager/geckoClients.java | 19 +- .../geckoManager/geckoSession.java | 31 ++- .../homeController/homeController.java | 223 +++++++++--------- .../homeController/homeViewController.java | 60 +++-- .../settingPrivacyController.java | 10 +- .../privacyManager/settingPrivacyEnums.java | 4 +- .../privacyManager/settingPrivacyModel.java | 7 + .../settingPrivacyViewController.java | 10 +- .../appManager/tabManager/tabAdapter.java | 3 +- .../appManager/tabManager/tabController.java | 8 +- .../genesissearchengine/constants/enums.java | 2 +- .../genesissearchengine/constants/keys.java | 1 + .../genesissearchengine/constants/status.java | 2 + .../pluginManager/messageManager.java | 27 +++ .../pluginManager/pluginController.java | 8 +- .../pluginManager/pluginEnums.java | 4 +- .../alert/layout/popup_block_popup.xml | 74 ++++++ .../alert/layout/popup_download_full.xml | 1 + .../alert/layout/popup_download_url.xml | 1 + .../alert/layout/popup_file_longpress.xml | 1 + .../alert/layout/popup_url_longpress.xml | 1 + .../setting/layout/setting_privacy_view.xml | 66 ++++++ app/src/main/res/values/strings.xml | 5 +- 28 files changed, 459 insertions(+), 171 deletions(-) create mode 100644 app/src/main/res/layouts/alert/layout/popup_block_popup.xml diff --git a/app/src/main/assets/Homepage/homepage-dark.html b/app/src/main/assets/Homepage/homepage-dark.html index 2e7c34a6..5b7f1c9a 100644 --- a/app/src/main/assets/Homepage/homepage-dark.html +++ b/app/src/main/assets/Homepage/homepage-dark.html @@ -40,7 +40,7 @@
- Genesis Search + Genesis Search diff --git a/app/src/main/assets/Homepage/homepage.html b/app/src/main/assets/Homepage/homepage.html index 587a703f..0e05ef53 100644 --- a/app/src/main/assets/Homepage/homepage.html +++ b/app/src/main/assets/Homepage/homepage.html @@ -40,7 +40,7 @@ - Genesis Search + diff --git a/app/src/main/assets/Homepage/style/cs-homepage-dark.css b/app/src/main/assets/Homepage/style/cs-homepage-dark.css index c113c014..ebfe7cc3 100644 --- a/app/src/main/assets/Homepage/style/cs-homepage-dark.css +++ b/app/src/main/assets/Homepage/style/cs-homepage-dark.css @@ -35,7 +35,7 @@ .hi_logo_text{ max-width: 450px; - width: 65%; + width: 90%; height: auto; display: block; margin-top: -20px; 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 499752a4..796c5fc2 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 @@ -26,6 +26,7 @@ import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; +import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.sql; @@ -177,6 +178,30 @@ public class bookmarkController extends AppCompatActivity mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.ON_CLOSE,Collections.singletonList(position)); } + @Override + public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { + boolean mStatus = (boolean) mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_STATUS, null); + if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) { + if(mStatus){ + return 0; + } + else { + final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; + final int swipeFlags = 0; + return makeMovementFlags(swipeFlags, dragFlags); + } + } else { + if(mStatus){ + return 0; + } + else { + final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; + final int swipeFlags = 0; + return makeMovementFlags(swipeFlags, dragFlags); + } + } + } + @Override public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { Canvas mCanvas = (Canvas) mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.ON_GENERATE_SWIPABLE_BACKGROUND, Arrays.asList(c, viewHolder, dX, actionState)); @@ -263,7 +288,7 @@ public class bookmarkController extends AppCompatActivity public void onOpenMultipleTabs(View view) { ArrayList m_long_selected_urk = (ArrayList) mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_URL, null); for(int m_counter=0;m_counter m_long_selected_urk = (ArrayList) mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.GET_LONG_SELECTED_URL, null); for(int m_counter=0;m_counter pList, String pSearch){ hintAdapter mAdapter = new hintAdapter(pList,new hintViewCallback(), this, pSearch); @@ -370,10 +355,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } } - public void onRedrawXML(){ - setContentView(R.layout.home_view); - } - public void initializeAppModel() { mHomeViewController = new homeViewController(); @@ -468,12 +449,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void initializeGeckoView(boolean isForced, boolean pDatabaseSavable){ mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,isForced); onSaveCurrentTab(mGeckoClient.getSession(),pDatabaseSavable); - mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null)); + mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null), false); } public void initTab(boolean isKeyboardOpened){ postNewTabAnimation(isKeyboardOpened, false); - mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null)); + mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null), false); } @Override @@ -497,7 +478,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba try{ mRenderedBitmap = mGeckoView.capturePixels(); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, pImageView, mGeckoView, pLoadTabView)); - }catch (Exception ignored){} + }catch (Exception ex){ + ex.printStackTrace(); + if(pLoadTabView){ + onOpenTabReady(); + } + } } @@ -526,7 +512,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void onLoadURL(String url){ mAppBar.animate().cancel(); mHomeViewController.onClearSelections(true); - mGeckoView.getSession().stop(); + Objects.requireNonNull(mGeckoView.getSession()).stop(); mGeckoClient.loadURL(url.replace("genesis.onion","boogle.store")); } @@ -536,12 +522,17 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession)); } + mGeckoClient.getmRuntime(); mGeckoClient.initSession(mTempSession); mGeckoView.releaseSession(); mGeckoView.setSession(mTempSession); + if(!mTempSession.isOpen()){ + mTempSession.open(mGeckoClient.getmRuntime()); + onLoadURL(mTempSession.getCurrentURL()); + } + mHomeViewController.onClearSelections(false); - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP3:",(String)mTempSession.getCurrentURL()); mHomeViewController.onUpdateSearchBar(mTempSession.getCurrentURL(),false,true, false); if(mTempSession.getProgress()>0 && mTempSession.getProgress()<100){ mHomeViewController.onProgressBarUpdate(mTempSession.getProgress(), false); @@ -552,11 +543,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGeckoClient.onValidateInitializeFromStartup(); mGeckoClient.onSessionReinit(); mHomeViewController.onUpdateStatusBarTheme(mTempSession.getTheme(), false); - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP4:",(String)mGeckoClient.getSession().getCurrentURL()); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),false); - mRenderedBitmap = mGeckoView.capturePixels(); + try{ + mRenderedBitmap = mGeckoView.capturePixels(); + }catch (Exception ignored){} if(pExpandAppBar){ mHomeViewController.expandTopBar(); @@ -570,6 +562,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onProgressBarUpdate(mGeckoClient.getSession().getProgress(),true); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false)); + + mGeckoView.invalidate(); + mGeckoView.refreshDrawableState(); + mGeckoView.requestFocus(); } /*-------------------------------------------------------USER EVENTS-------------------------------------------------------*/ @@ -681,15 +677,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE) { onSearchBarInvoked(v); - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP5:",(String)mGeckoClient.getSession().getCurrentURL()); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true,true, false); mHomeViewController.onClearSelections(true); mGeckoClient.setLoading(true); final Handler handler = new Handler(); - handler.postDelayed(() -> - { - mHomeViewController.onClearSelections(false); - }, 500); + handler.postDelayed(() -> mHomeViewController.onClearSelections(false), 500); } return true; }); @@ -717,10 +709,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } final Handler handler = new Handler(); - handler.postDelayed(() -> - { - getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - }, 300); + handler.postDelayed(() -> getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE), 300); }else { getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); @@ -794,7 +783,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); if(!mGeckoClient.isLoading()){ - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP8:",(String)mGeckoClient.getSession().getCurrentURL()); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false); } helperMethod.hideKeyboard(homeController.this); @@ -845,7 +833,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(validated_url!=null){ url = validated_url; } - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP9:",(String)url); mHomeViewController.onUpdateSearchBar(url,false,true, false); onLoadURL(url); } @@ -861,22 +848,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba } onLoadURL(pURL); - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP14:",(String)pURL); mHomeViewController.onUpdateSearchBar(pURL,false,true, false); } public void onSuggestionMove(View view){ String val = view.getTag().toString(); - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP11:",(String)val); mHomeViewController.onUpdateSearchBar(val,false,false, true); } - public void applyTheme(){ - status.mCurrentReloadURL = mSearchbar.getText().toString(); - onResume(); - recreate(); - } - public void onHomeButton(View view){ onLoadURL(helperMethod.getDomainName(mHomeModel.getSearchEngine())); mHomeViewController.onUpdateLogo(); @@ -899,11 +878,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onHideLoadTabDialog(); tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_RECENT_TAB, null); if(model!=null && !mGeckoClient.getSession().getSessionID().equals(model.getSession().getSessionID())){ - Log.i("FUCK::1","URL"); + Log.i("FUCK::1",model.getSession().getCurrentURL()); mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(),false,false,true); - Log.i("FUCK::2","URL"); + Log.i("FUCK::2",model.getSession().getCurrentURL()); onLoadTab(model.getSession(), false,true); - Log.i("FUCK::3","url"); + Log.i("FUCK::3",model.getSession().getCurrentURL()); } } @@ -922,12 +901,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void postNewTabAnimation(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){ initializeGeckoView(true, true); if(status.sOpenURLInNewTab){ + if(mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ + mGeckoView.getSession().open(mGeckoClient.getmRuntime()); + } + onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus)); - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP12:",(String)helperMethod.getDomainName(status.sSettingSearchStatus)); mHomeViewController. onUpdateSearchBar(helperMethod.getDomainName(status.sSettingSearchStatus),false,true, false); }else { onLoadURL("about:blank"); - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP13:",(String)strings.HOME_BLANK_PAGE); mHomeViewController. onUpdateSearchBar(strings.HOME_BLANK_PAGE,false,true, false); mHomeViewController.onNewTab(); } @@ -936,13 +917,16 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), false); } - public void postNewLinkTabAnimation(String url){ + public void postNewLinkTabAnimation(String url,boolean isRemovable){ dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false)); initializeGeckoView(true, true); mHomeViewController.progressBarReset(); - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP15:",(String)url); mHomeViewController.onUpdateSearchBar(url,false,true, false); mGeckoClient.loadURL(url); + + if(isRemovable){ + mGeckoClient.setRemovableFromBackPressed(true); + } } public void postNewLinkTabAnimationInBackgroundTrigger(String url){ @@ -958,13 +942,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.progressBarReset(); mGeckoClient.initURL(url); mGeckoClient.loadURL(url); + mGeckoClient.getSession().setURL(url); onSaveCurrentTab(mGeckoClient.getSession(),false); onLoadTab(mSession,false,false); mAppBar.setTag(R.id.expandableBar,true); initTabCount(); - mHomeViewController.onUpdateSearchBar(url,false,true, false); + mHomeViewController.onUpdateSearchBar(mSession.getCurrentURL(),false,true, false); } public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){ @@ -973,9 +958,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba }catch (Exception ignored){} final Handler handler = new Handler(); - handler.postDelayed(() -> { - mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), M_INITIALIZE_TAB_SINGLE); - }, 100); + handler.postDelayed(() -> mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), M_INITIALIZE_TAB_SINGLE), 100); } public void onNewTabBackground(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){ @@ -1029,7 +1012,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onDisableTabViewController(){ - onResume(); + onResumeDump(); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true); mHomeViewController.onHideTabContainer(); activityContextManager.getInstance().getTabController().onExitAndClearBackup(); @@ -1039,7 +1022,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba @Override public void onBackPressed(){ if(mTabFragment.getVisibility()==View.VISIBLE){ - onResume(); + onResumeDump(); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), false); mHomeViewController.onHideTabContainer(); activityContextManager.getInstance().getTabController().onPostExit(); @@ -1120,6 +1103,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(mSplashScreen.getAlpha()>0){ mHomeViewController.initSplashOrientation(); } + if(mSearchEngineBar.getVisibility() == View.VISIBLE){ + mHomeViewController.onClearSelections(true); + } pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); } @@ -1131,7 +1117,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba helperMethod.hideKeyboard(this); } if(mTabFragment.getVisibility()==View.VISIBLE){ - onResume(); + onResumeDump(); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), false); mHomeViewController.onHideTabContainer(); activityContextManager.getInstance().getTabController().onPostExit(); @@ -1162,18 +1148,20 @@ public class homeController extends AppCompatActivity implements ComponentCallba mSearchbar.selectAll(); mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); } - if(status.sSettingIsAppStarted && mAppRestarted){ - onUpdateStatusBarTheme(); - activityContextManager.getInstance().onClearStack(); + + if(mGeckoView!=null){ tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); - if(model==null || !mGeckoClient.getSession().getSessionID().equals(model.getSession().getSessionID())){ - if(model==null){ - onInitDefaultTab(); - }else { - onLoadTab(model.getSession(), false,true); + if(model!=null){ + if(mGeckoView!=null && mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ + onReDrawGeckoview(); + onLoadURL(model.getSession().getCurrentURL()); + }else if(mGeckoView != null){ + mGeckoView.requestFocus(); + mGeckoView.setSession(model.getSession()); } } } + if(mAppBar!=null){ mHomeViewController.expandTopBar(); @@ -1183,39 +1171,52 @@ public class homeController extends AppCompatActivity implements ComponentCallba mAppRestarted = true; pluginController.getInstance().onNotificationInvoke(null, pluginEnums.eNotificationManager.M_CLEAR_NOTIFICATION ); - if(mGeckoView!=null){ - tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); - if(model!=null){ - if(!mGeckoView.getSession().isOpen()){ - onReDrawGeckoview(); - onLoadURL(model.getSession().getCurrentURL()); - }else { - mGeckoView.releaseSession(); - mGeckoView.requestFocus(); - mGeckoView.setSession(model.getSession()); - - /*If error page at background session tab it will not load unless click | Issue with actual firefox app too*/ - if(mGeckoClient.wasPreviousErrorPage()){ - mHomeViewController.performDummyClick(); - } - } - } - } - initWidget(); super.onResume(); } - public void onLoadTabOnClear(){ - tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); - if(model==null){ - onNewIntent(getIntent()); - onOpenLinkNewTab(helperMethod.getDomainName(mHomeModel.getSearchEngine())); + public void onResumeDump() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + if (mGeckoClient.getSession()!=null && mGeckoClient!=null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mGeckoClient.getUriPermission()!=null) { + this.revokeUriPermission(mGeckoClient.getUriPermission(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); + } + if(isSuggestionSearchOpened){ + tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + if(model==null){ + onOpenLinkNewTab(status.sSettingSearchStatus); + } + isSuggestionChanged = true; + isFocusChanging = false; + isSuggestionSearchOpened = false; + mSearchbar.requestFocus(); + mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor())); + mSearchbar.selectAll(); + mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); } - } - public void OnClearSuggestion(View view){ - mSearchbar.clearFocus(); + if(status.sSettingIsAppStarted && mAppRestarted) { + onUpdateStatusBarTheme(); + activityContextManager.getInstance().onClearStack(); + + tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + if(model==null){ + initializeGeckoView(false,false); + onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus)); + } + } + + if(mAppBar!=null){ + mHomeViewController.expandTopBar(); + + mAppBar.refreshDrawableState(); + mAppBar.invalidate(); + } + mAppRestarted = true; + pluginController.getInstance().onNotificationInvoke(null, pluginEnums.eNotificationManager.M_CLEAR_NOTIFICATION ); + initTabCountForced(); + initWidget(); } @Override @@ -1229,10 +1230,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGeckoClient.setLoading(true); onSearchBarInvoked(mSearchbar); final Handler handler = new Handler(); - handler.postDelayed(() -> - { - mGeckoView.clearFocus(); - }, 500); + handler.postDelayed(() -> mGeckoView.clearFocus(), 500); } } else if(requestCode==1){ @@ -1334,7 +1332,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void initTabCount(){ - mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null)); + mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null), false); + } + + public void initTabCountForced(){ + mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null), true); } /*-------------------------------------------------------CALLBACKS-------------------------------------------------------*/ @@ -1346,7 +1348,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onClearSearchBar(View view){ - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP16:",(String)strings.GENERIC_EMPTY_STR); mHomeViewController.onUpdateSearchBar(strings.GENERIC_EMPTY_STR, false, true, false); } @@ -1545,7 +1546,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba postNewTabAnimation((boolean)data.get(0),(boolean)data.get(1)); } else if(e_type.equals(M_INITIALIZE_TAB_LINK)){ - postNewLinkTabAnimation((String)data.get(0)); + postNewLinkTabAnimation((String)data.get(0),false); } else if(e_type.equals(enums.etype.on_init_ads)) { @@ -1554,10 +1555,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba else if(e_type.equals(enums.etype.M_WELCOME_MESSAGE)){ if(status.sSettingIsWelcomeEnabled){ final Handler handler = new Handler(); - Runnable runnable = () -> - { - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_WELCOME); - }; + Runnable runnable = () -> pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_WELCOME); handler.postDelayed(runnable, 1300); } } @@ -1571,13 +1569,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba status.sSettingRedirectStatus = strings.GENERIC_EMPTY_STR; }else { if(status.mThemeApplying){ - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP17:",(String)data.get(0)); mHomeViewController.onUpdateSearchBar(data.get(0).toString(),false, false, false); mHomeViewController.splashScreenDisableInstant(); onLoadTabOnResume(); } onLoadURL(data.get(0).toString()); - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP18:",(String)data.get(0)); mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true, false); } } @@ -1645,7 +1641,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); if(!mGeckoClient.isLoading()){ - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP19:",(String)mGeckoClient.getSession().getCurrentURL()); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false); } helperMethod.hideKeyboard(homeController.this); @@ -1695,7 +1690,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onProgressBarUpdate((int)data.get(0), true); } else if(e_type.equals(enums.etype.ON_UPDATE_SEARCH_BAR)){ - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP11:",(String)data.get(0)); mHomeViewController.onUpdateSearchBar((String)data.get(0), false, false, false); } else if(e_type.equals(enums.etype.ON_FIRST_PAINT)){ @@ -1710,6 +1704,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba else if(e_type.equals(enums.etype.back_list_empty)){ helperMethod.onMinimizeApp(homeController.this); } + else if(e_type.equals(enums.etype.M_CLOSE_TAB)){ + onCloseCurrentTab(mGeckoClient.getSession()); + } else if(e_type.equals(enums.etype.M_ADMOB_BANNER_RECHECK)){ if(data.get(2).toString().startsWith(CONST_GENESIS_URL_CACHED) || data.get(2).toString().startsWith(CONST_GENESIS_URL_CACHED_DARK) || helperMethod.getHost(data.get(2).toString()).contains("boogle.store") || data.get(2).toString().startsWith(CONST_GENESIS_HELP_URL_CACHE) || data.get(2).toString().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ mHomeViewController.updateBannerAdvertStatus(false,true); @@ -1758,7 +1755,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),false); } else if(e_type.equals(enums.etype.on_update_favicon)){ - dataController.getInstance().invokeImage(dataEnums.eImageCommands.M_REQUEST_IMAGE_URL,Collections.singletonList((String)data.get(0))); + dataController.getInstance().invokeImage(dataEnums.eImageCommands.M_REQUEST_IMAGE_URL,Collections.singletonList(data.get(0))); } else if(e_type.equals(M_LONG_PRESS_WITH_LINK)){ pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_WITH_LINK); @@ -1770,7 +1767,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_URL); } else if(e_type.equals(enums.etype.open_new_tab)){ - postNewLinkTabAnimation(dataToStr(data.get(0))); + if(status.sSettingPopupStatus){ + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_POPUP_BLOCKED); + }else { + postNewLinkTabAnimation(dataToStr(data.get(0)), true); + } } else if(e_type.equals(enums.etype.on_close_sesson)){ if(!onCloseCurrentTab(mGeckoClient.getSession())){ 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 50e80f60..deeb627d 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 @@ -224,6 +224,7 @@ class homeViewController public void onShowTabContainer(){ if(mTabFragment.getAlpha()==0 || mTabFragment.getAlpha()==1){ + onUpdateStatusBarTheme(null, false); mTabFragment.setAlpha(0); mTabFragment.setTranslationY(0); mTabFragment.setVisibility(View.VISIBLE); @@ -246,6 +247,8 @@ class homeViewController public void onHideTabContainer(){ if(mTabFragment.getAlpha()==1){ + + mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME); mTabFragment.animate() .setDuration(150) .alpha(0f).withEndAction(() -> mTabFragment.setVisibility(View.GONE)); @@ -363,26 +366,29 @@ class homeViewController } } - void initTab(int count){ - mNewTab.animate().cancel(); - mNewTab.animate().withLayer() - .rotationX(60) - .alpha(0.4f) - .setDuration(120) - .withEndAction( - new Runnable() { - @Override public void run() { - mNewTab.setRotationX(-60); - mNewTab.animate().withLayer() - .rotationX(0) - .alpha(1) - .setDuration(150) - .start(); + void initTab(int count, boolean pForced){ + if(!pForced){ + mNewTab.animate().cancel(); + mNewTab.animate().withLayer() + .rotationX(60) + .alpha(0.4f) + .setDuration(120) + .withEndAction( + new Runnable() { + @Override public void run() { + mNewTab.setRotationX(-60); + mNewTab.animate().withLayer() + .rotationX(0) + .alpha(1) + .setDuration(150) + .start(); + } } - } - ).start(); + ).start(); + } mNewTab.setText((count+strings.GENERIC_EMPTY_STR)); + } public void recreateStatusBar(){ @@ -805,7 +811,7 @@ class homeViewController mColor = -1; } - if(pTheme!=null && status.sToolbarTheme && mColor!=-1 && helperMethod.getColorDensity(mColor)<0.80){ + if(!mSearchbar.isFocused() && pTheme!=null && status.sToolbarTheme && mColor!=-1 && helperMethod.getColorDensity(mColor)<0.80){ mTopBar.setBackgroundColor(mColor); mSearchbar.setTextColor(helperMethod.invertedGrayColor(mColor)); mSearchbar.setHintTextColor(helperMethod.invertedGrayColor(mColor)); @@ -841,6 +847,7 @@ class homeViewController mSearchLock.setTag(R.id.themed,true); gradientDrawable1.setCornerRadius(helperMethod.pxFromDp(7)); mSearchbar.setBackground(gradientDrawable1); + mSearchbar.setHintTextColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.10f), Color.BLACK, 0.2f)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mContext.getWindow().setStatusBarColor(Color.parseColor(pTheme)); @@ -865,22 +872,29 @@ class homeViewController mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); } + GradientDrawable gradientDrawable1 = new GradientDrawable(); + gradientDrawable1.setColor(ContextCompat.getColor(mContext, R.color.c_edittext_background)); + gradientDrawable1.setCornerRadius(helperMethod.pxFromDp(7)); + gradientDrawable1.setStroke(helperMethod.pxFromDp(2), ContextCompat.getColor(mContext, R.color.c_edittext_background)); + mSearchbar.setBackground(gradientDrawable1); + Drawable drawable; Resources res = mContext.getResources(); try { drawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_generic_tab_button)); mNewTab.setBackground(drawable); - drawable = Drawable.createFromXml(res, res.getXml(R.xml.gx_generic_input)); - mSearchbar.setBackground(drawable); - mVoiceInput.setBackground(drawable); - } catch (Exception ignored) { + Drawable drawableTemp = Drawable.createFromXml(res, res.getXml(R.xml.gx_generic_input)); + mVoiceInput.setBackground(drawableTemp); + } catch (Exception ex) { + ex.printStackTrace(); } mNewTab.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1)); mMenu.setColorFilter(ContextCompat.getColor(mContext, R.color.c_navigation_tint)); mVoiceInput.setColorFilter(ContextCompat.getColor(mContext, R.color.c_navigation_tint)); mSearchbar.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1)); + mSearchbar.setHintTextColor(ContextCompat.getColor(mContext, R.color.c_text_v2)); onUpdateSearchIcon(1); if(status.sTheme != enums.Theme.THEME_DARK && !status.sDefaultNightMode){ @@ -925,12 +939,14 @@ class homeViewController mSearchEngineBar.setAlpha(0f); mSearchEngineBar.animate().setDuration(delay).alpha(1); mSearchEngineBar.setVisibility(View.VISIBLE); + onUpdateStatusBarTheme(null, false); } }else { mSearchEngineBar.animate().setDuration(delay).alpha(0).withEndAction(() -> { mSearchEngineBar.animate().cancel(); mSearchEngineBar.setAlpha(0f); mSearchEngineBar.setVisibility(View.GONE); + mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME); }); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java index ad897a18..b46596c5 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyController.java @@ -33,6 +33,7 @@ public class settingPrivacyController extends AppCompatActivity { private settingPrivacyModel mSettingPrivacyModel; private settingPrivacyViewController mSettingPrivacyViewController; private SwitchMaterial mJavaScript; + private SwitchMaterial mPopup; private SwitchMaterial mDoNotTrack; private SwitchMaterial mClearDataOnExit; private ArrayList mCookie = new ArrayList<>(); @@ -60,13 +61,14 @@ public class settingPrivacyController extends AppCompatActivity { mJavaScript = findViewById(R.id.pJavascript); mDoNotTrack = findViewById(R.id.pDoNotTrack); mClearDataOnExit = findViewById(R.id.pClearDataOnExit); + mPopup = findViewById(R.id.pPopup); mCookie.add(findViewById(R.id.pCookieRadioOption1)); mCookie.add(findViewById(R.id.pCookieRadioOption2)); mCookie.add(findViewById(R.id.pCookieRadioOption3)); mCookie.add(findViewById(R.id.pCookieRadioOption4)); activityContextManager.getInstance().onStack(this); - mSettingPrivacyViewController = new settingPrivacyViewController(this, new settingPrivacyController.settingAccessibilityViewCallback(), mJavaScript, mDoNotTrack, mClearDataOnExit, mCookie); + mSettingPrivacyViewController = new settingPrivacyViewController(this, new settingPrivacyController.settingAccessibilityViewCallback(), mJavaScript, mDoNotTrack, mClearDataOnExit, mCookie, mPopup); mSettingPrivacyModel = new settingPrivacyModel(new settingPrivacyController.settingAccessibilityModelCallback()); } @@ -133,6 +135,12 @@ public class settingPrivacyController extends AppCompatActivity { dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,status.sSettingJavaStatus)); } + public void onPopup(View view){ + mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_POPUP, Collections.singletonList(!status.sSettingPopupStatus)); + mPopup.toggle(); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,status.sSettingPopupStatus)); + } + public void onDoNotTrack(View view){ mSettingChanged = true; mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_DONOT_TRACK, Collections.singletonList(!status.sStatusDoNotTrack)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java index 7ecfb18f..41975f12 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyEnums.java @@ -2,9 +2,9 @@ package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager class settingPrivacyEnums { - /*History Manager*/ + /*Privacy Manager*/ public enum ePrivacyModel { - M_SET_JAVASCRIPT, M_SET_DONOT_TRACK, M_SET_TRACKING_PROTECTION, M_SET_COOKIES, M_SET_CLEAR_PRIVATE_DATA + M_SET_JAVASCRIPT, M_SET_POPUP, M_SET_DONOT_TRACK, M_SET_COOKIES, M_SET_CLEAR_PRIVATE_DATA } public enum ePrivacyViewController { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java index b195e537..79378ec3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyModel.java @@ -35,6 +35,10 @@ class settingPrivacyModel status.sStatusDoNotTrack = pStatus; } + private void onPopup(boolean pStatus){ + status.sSettingPopupStatus = pStatus; + } + private void onCookies(View pView){ if(pView.getId() == R.id.pCookieOption1){ status.sSettingCookieStatus = ACCEPT_ALL; @@ -61,6 +65,9 @@ class settingPrivacyModel else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_DONOT_TRACK)){ onDoNotTrack((boolean)pData.get(0)); } + else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_POPUP)){ + onPopup((boolean)pData.get(0)); + } else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_COOKIES)){ onCookies((View) pData.get(0)); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java index f56f16ac..d5db07fa 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/privacyManager/settingPrivacyViewController.java @@ -30,10 +30,11 @@ class settingPrivacyViewController private SwitchMaterial mDoNotTrack; private SwitchMaterial mClearDataOnExit; private ArrayList mCookie; + private SwitchMaterial mPopup; /*Initializations*/ - settingPrivacyViewController(settingPrivacyController pContext, eventObserver.eventListener pEvent, SwitchMaterial pJavaScript, SwitchMaterial pDoNotTrack, SwitchMaterial pClearDataOnExit, ArrayList pCookie) + settingPrivacyViewController(settingPrivacyController pContext, eventObserver.eventListener pEvent, SwitchMaterial pJavaScript, SwitchMaterial pDoNotTrack, SwitchMaterial pClearDataOnExit, ArrayList pCookie, SwitchMaterial pPopup) { this.mEvent = pEvent; this.mContext = pContext; @@ -41,6 +42,7 @@ class settingPrivacyViewController this.mClearDataOnExit = pClearDataOnExit; this.mCookie = pCookie; this.mDoNotTrack = pDoNotTrack; + this.mPopup = pPopup; initViews(); initPostUI(); @@ -70,6 +72,12 @@ class settingPrivacyViewController this.mJavaScript.setChecked(false); } + if(status.sSettingPopupStatus){ + this.mPopup.setChecked(true); + }else{ + this.mPopup.setChecked(false); + } + if(status.sClearOnExit){ this.mClearDataOnExit.setChecked(true); }else{ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java index 44574943..de4eb707 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java @@ -243,6 +243,7 @@ public class tabAdapter extends RecyclerView.Adapter mBorder = itemView.findViewById(R.id.pBorder); itemView.setClickable(true); + mRemoveRow.setEnabled(true); if(model.getmId()==null){ mItemSelectionMenu.setVisibility(View.VISIBLE); @@ -352,8 +353,6 @@ public class tabAdapter extends RecyclerView.Adapter } }else if(v.getId() == R.id.pRemoveRow){ v.setEnabled(false); - v.setFocusableInTouchMode(false); - v.setClickable(false); onRemoveRowCross(this.getLayoutPosition()); } else if(v.getId() == R.id.pItemSelectionMenuButton){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java index d74ac73f..f071c25f 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java @@ -145,8 +145,9 @@ public class tabController extends Fragment @Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { + boolean mStatus = (boolean) mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.M_SELECTION_MENU_SHOWING, null); if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) { - if((Integer) viewHolder.itemView.getTag() >= mListModel.getList().size()){ + if((Integer) viewHolder.itemView.getTag() >= mListModel.getList().size() || mStatus){ return 0; } else { @@ -155,7 +156,7 @@ public class tabController extends Fragment return makeMovementFlags(swipeFlags, dragFlags); } } else { - if((Integer) viewHolder.itemView.getTag() >= mListModel.getList().size()){ + if((Integer) viewHolder.itemView.getTag() >= mListModel.getList().size() || mStatus){ return 0; } else { @@ -229,7 +230,6 @@ public class tabController extends Fragment public void initTabCount(int pDelay) { - //mtabViewController.onTrigger(tabEnums.eTabViewCommands.INIT_TAB_COUNT, Collections.singletonList(mListModel.getList().size())); final Handler handler = new Handler(); handler.postDelayed(() -> { @@ -239,7 +239,7 @@ public class tabController extends Fragment mRecycleView.setLayoutParams(params); } }, pDelay); - + activityContextManager.getInstance().getHomeController().initTabCountForced(); } public void onClose(){ 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 ae42b867..083fd78a 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -7,7 +7,7 @@ public class enums on_update_favicon,ON_UPDATE_TAB_TITLE, ON_LOAD_REQUEST,GECKO_SCROLL_CHANGED,ON_UPDATE_SEARCH_BAR,M_ON_MAIL, on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK, welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT, - url_triggered, url_triggered_new_tab,url_clear,fetch_favicon, fetch_thumbnail,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE, + url_triggered, url_triggered_new_tab,url_clear,fetch_favicon, fetch_thumbnail,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_UPDATE_TITLE_BAR,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 } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java index 2ea9c5c5..dd2aa2b4 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java @@ -29,6 +29,7 @@ public class keys public static final String SETTING_SEARCH_ENGINE = "SEARCH_ENGINE"; public static final String SETTING_FIRST_INSTALLED = "FIRST_INSTALLED"; public static final String SETTING_JAVA_SCRIPT = "JAVA_SCRIPT"; + public static final String SETTING_POPUP = "POPUP"; public static final String SETTING_HISTORY_CLEAR = "HISTORY_CLEAR"; public static final String SETTING_GATEWAY = "pref_bridges_enabled_auto"; public static final String SETTING_GATEWAY_MANUAL = "pref_bridges_enabled_manual"; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java index 657d35b5..07bdde3d 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -30,6 +30,7 @@ public class status public static boolean sSettingSearchHistory = false; public static boolean sSearchSuggestionStatus = false; public static boolean sSettingJavaStatus = true; + public static boolean sSettingPopupStatus = false; public static boolean sClearOnExit = true; public static boolean sSettingIsAppPaused = false; public static boolean sSettingIsWelcomeEnabled = true; @@ -74,6 +75,7 @@ public class status status.sSettingSearchHistory = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); status.sSearchSuggestionStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); status.sSettingJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true)); + status.sSettingPopupStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); status.sClearOnExit = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true)); status.sBridgeGatewayAuto = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true)); status.sBridgeGatewayManual = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); 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 33359966..82c22bf7 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java @@ -1,6 +1,7 @@ package com.darkweb.genesissearchengine.pluginManager; import android.app.Dialog; +import android.content.DialogInterface; import android.content.Intent; import android.content.res.Resources; import android.graphics.Color; @@ -9,6 +10,7 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.InsetDrawable; import android.net.Uri; import android.os.Handler; +import android.util.Log; import android.view.Gravity; import android.view.Window; import android.view.WindowManager; @@ -161,6 +163,26 @@ class messageManager } + private void popupBlocked() + { + final Handler handler = new Handler(); + Runnable runnable = () -> { + mDialog.dismiss(); + }; + + initializeDialog(R.layout.popup_block_popup, Gravity.BOTTOM); + mDialog.findViewById(R.id.pOpenPrivacy).setOnClickListener(v -> { + mEvent.invokeObserver(null, M_OPEN_PRIVACY); + mDialog.dismiss(); + handler.removeCallbacks(runnable); + }); + + mDialog.setOnDismissListener(dialog -> handler.removeCallbacks(runnable)); + + handler.postDelayed(runnable, 1500); + + } + private void notSupportMessage() { initializeDialog(R.layout.popup_not_supported, Gravity.BOTTOM); @@ -584,6 +606,11 @@ class messageManager /*VERIFIED*/ newIdentityCreated(); break; + + case M_POPUP_BLOCKED: + /*VERIFIED*/ + popupBlocked(); + break; } } } 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 19c485ac..30e7ea00 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java @@ -208,12 +208,8 @@ public class pluginController mMessageManager.onTrigger(Arrays.asList(mHomeController, Collections.singletonList(pData.get(0).toString())),M_START_ORBOT); } } - else if(pEventType.equals(M_CLEAR_HISTORY)){ - dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); - mContextManager.getHistoryController().onclearData(); - mHomeController.onClearSession(); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); - mHomeController.initTab(true); + else if(pEventType.equals(M_OPEN_PRIVACY)){ + helperMethod.openActivity(settingPrivacyController.class, constants.CONST_LIST_HISTORY, mHomeController,true); } else if(pEventType.equals(M_CLEAR_BOOKMARK)){ dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,pData); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java index 1c25c26e..aa1e59dc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java @@ -28,10 +28,10 @@ public class pluginEnums /*Message Manager*/ public enum eMessageManager{ - M_RESET, M_DATA_CLEARED, M_SECURE_CONNECTION,M_DOWNLOAD_SINGLE, M_UPDATE_BRIDGES, M_NEW_IDENTITY, M_NOT_SUPPORTED, M_BRIDGE_MAIL, M_LONG_PRESS_WITH_LINK, M_LONG_PRESS_URL, M_LONG_PRESS_DOWNLOAD, M_START_ORBOT, M_DOWNLOAD_FILE, M_RATE_APP, M_REPORT_URL, M_CLEAR_BOOKMARK, M_CLEAR_HISTORY, M_BOOKMARK, M_RATE_SUCCESS, M_RATE_FAILURE, M_LANGUAGE_SUPPORT_FAILURE, M_WELCOME + M_RESET, M_DATA_CLEARED, M_SECURE_CONNECTION, M_POPUP_BLOCKED,M_DOWNLOAD_SINGLE, M_UPDATE_BRIDGES, M_NEW_IDENTITY, M_NOT_SUPPORTED, M_BRIDGE_MAIL, M_LONG_PRESS_WITH_LINK, M_LONG_PRESS_URL, M_LONG_PRESS_DOWNLOAD, M_START_ORBOT, M_DOWNLOAD_FILE, M_RATE_APP, M_REPORT_URL, M_CLEAR_BOOKMARK, M_CLEAR_HISTORY, M_BOOKMARK, M_RATE_SUCCESS, M_RATE_FAILURE, M_LANGUAGE_SUPPORT_FAILURE, M_WELCOME } public enum eMessageManagerCallbacks{ - M_CANCEL_WELCOME, M_APP_RATED, M_DOWNLOAD_FILE_MANUAL, M_OPEN_LINK_CURRENT_TAB, M_COPY_LINK, M_REQUEST_BRIDGES, M_SET_BRIDGES, M_OPEN_LINK_NEW_TAB, M_CLEAR_TAB, M_RATE_APPLICATION + M_CANCEL_WELCOME, M_APP_RATED, M_DOWNLOAD_FILE_MANUAL, M_OPEN_LINK_CURRENT_TAB, M_COPY_LINK, M_REQUEST_BRIDGES, M_SET_BRIDGES, M_OPEN_LINK_NEW_TAB, M_CLEAR_TAB, M_RATE_APPLICATION, M_OPEN_PRIVACY } /*Download Manager*/ diff --git a/app/src/main/res/layouts/alert/layout/popup_block_popup.xml b/app/src/main/res/layouts/alert/layout/popup_block_popup.xml new file mode 100644 index 00000000..40effb9f --- /dev/null +++ b/app/src/main/res/layouts/alert/layout/popup_block_popup.xml @@ -0,0 +1,74 @@ + + + + + + + +