From ea74b226c2f9b8ad35f23a47150ff9b92f9be4f1 Mon Sep 17 00:00:00 2001 From: msmannan00 Date: Tue, 23 Mar 2021 16:52:22 +0500 Subject: [PATCH] Bug Fixes Bug Fixes --- app/build.gradle | 8 +- .../main/assets/Homepage/homepage-dark.html | 5 +- app/src/main/assets/Homepage/homepage.html | 5 +- .../Homepage/style/cs-homepage-dark.css | 6 + .../assets/Homepage/style/cs-homepage.css | 6 + .../bridgeManager/bridgeController.java | 3 + .../helpManager/helpController.java | 3 + .../historyManager/historyController.java | 3 + .../geckoManager/geckoClients.java | 16 ++- .../geckoManager/geckoDownloadManager.java | 21 ++- .../geckoManager/geckoSession.java | 64 +++++++-- .../homeManager/hintManager/hintAdapter.java | 92 +++++++------ .../homeController/homeController.java | 92 ++++++++++--- .../homeController/homeViewController.java | 112 +++++++++++----- .../languageManager/languageController.java | 5 +- .../orbotLogManager/orbotLogController.java | 3 + .../orbotManager/orbotController.java | 3 + .../proxyStatusController.java | 3 + .../settingAccessibilityController.java | 3 + .../settingAdvanceController.java | 3 + .../clearManager/settingClearController.java | 3 + .../settingGeneralController.java | 3 + .../logManager/settingLogController.java | 3 + .../settingNotificationController.java | 3 + .../settingPrivacyController.java | 3 + .../settingSearchController.java | 3 + .../settingHomeController.java | 3 + .../settingTrackingController.java | 3 + .../appManager/tabManager/tabAdapter.java | 16 ++- .../appManager/tabManager/tabController.java | 51 +++++--- .../tabManager/tabViewController.java | 37 ++++-- .../genesissearchengine/constants/enums.java | 2 +- .../genesissearchengine/constants/status.java | 2 +- .../dataManager/bookmarkDataModel.java | 2 +- .../dataManager/historyDataModel.java | 2 +- .../dataManager/suggestionDataModel.java | 48 +++---- .../dataManager/tabDataModel.java | 17 ++- .../helperManager/helperMethod.java | 2 + .../helperManager/localFileDownloader.java | 10 +- .../pluginManager/messageManager.java | 18 +++ .../pluginManager/orbotManager.java | 8 ++ .../pluginManager/pluginEnums.java | 4 +- .../generic/xml/gx_ripple_light.xml | 2 +- .../images/xml/ic_baseline_circuit.xml | 10 ++ .../images/xml/ic_baseline_perm_identity.xml | 10 ++ .../alert/layout/popup_load_new_tab.xml | 4 +- .../alert/layout/popup_new_circuit.xml | 72 +++++++++++ .../layout/popup_reported_successfully.xml | 3 +- .../res/layouts/alert/layout/popup_undo.xml | 4 +- .../main/res/layouts/history/values/ids.xml | 5 + .../res/layouts/home/layout/hint_view.xml | 6 +- .../res/layouts/home/layout/home_view.xml | 3 +- .../layouts/home/layout/popup_side_menu.xml | 35 +++++ .../setting/layout/setting_advance_view.xml | 25 ++-- .../setting/layout/setting_general_view.xml | 24 ++-- .../setting/layout/setting_privacy_view.xml | 20 ++- .../setting/layout/setting_search_view.xml | 10 +- .../setting/layout/setting_tracking_view.xml | 19 ++- app/src/main/res/values-night/colors.xml | 1 + app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/strings.xml | 2 + app/variables.gradle | 8 +- build.gradle | 4 +- orbotservice/build.gradle | 14 +- .../android/service/OrbotService.java | 122 ++++-------------- 65 files changed, 747 insertions(+), 356 deletions(-) create mode 100644 app/src/main/res/custom-xml/images/xml/ic_baseline_circuit.xml create mode 100644 app/src/main/res/custom-xml/images/xml/ic_baseline_perm_identity.xml create mode 100644 app/src/main/res/layouts/alert/layout/popup_new_circuit.xml create mode 100644 app/src/main/res/layouts/history/values/ids.xml diff --git a/app/build.gradle b/app/build.gradle index 56a66eeb..91384f77 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -130,6 +130,7 @@ dependencies { // Android Support Repository dependencies + androidTestImplementation 'junit:junit:4.13.2' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.preference:preference:1.1.1' @@ -183,7 +184,6 @@ dependencies { /*Helper Libraries*/ implementation 'com.chauthai.overscroll:overscroll-bouncy:0.1.1' - androidTestImplementation 'junit:junit:4.13.2' implementation 'jp.wasabeef:recyclerview-animators:2.2.7' implementation 'com.android.support:design:28.0.0' implementation "org.mozilla.components:browser-icons:9.0.0" @@ -194,10 +194,12 @@ dependencies { /*Image Cache Libraries*/ + implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' implementation 'com.github.intelligo-systems:slight:1.1.3' - implementation "org.mozilla.components:concept-fetch:70.0.5" - implementation "org.mozilla.components:concept-base:70.0.9" + implementation "org.mozilla.components:concept-fetch:73.0.9" + implementation "org.mozilla.components:concept-base:73.0.9" implementation 'com.coolerfall:android-http-download-manager:1.6.3' + implementation "org.mozilla.components:support-utils:73.0.9" } diff --git a/app/src/main/assets/Homepage/homepage-dark.html b/app/src/main/assets/Homepage/homepage-dark.html index 77c85bec..2e7c34a6 100644 --- a/app/src/main/assets/Homepage/homepage-dark.html +++ b/app/src/main/assets/Homepage/homepage-dark.html @@ -45,8 +45,9 @@
- - + + +
diff --git a/app/src/main/assets/Homepage/homepage.html b/app/src/main/assets/Homepage/homepage.html index 4a8c0746..587a703f 100644 --- a/app/src/main/assets/Homepage/homepage.html +++ b/app/src/main/assets/Homepage/homepage.html @@ -45,8 +45,9 @@
- - + + +
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 4fd1a717..c113c014 100644 --- a/app/src/main/assets/Homepage/style/cs-homepage-dark.css +++ b/app/src/main/assets/Homepage/style/cs-homepage-dark.css @@ -218,6 +218,12 @@ font-size: 14px; } +@media only screen and (max-width: 943px) { + #hi_search__search-button { + visibility: hidden; + } +} + @media only screen and (max-width: 943px) { #hi_search_button { font-size: 13px; diff --git a/app/src/main/assets/Homepage/style/cs-homepage.css b/app/src/main/assets/Homepage/style/cs-homepage.css index 845c7af6..de14b372 100644 --- a/app/src/main/assets/Homepage/style/cs-homepage.css +++ b/app/src/main/assets/Homepage/style/cs-homepage.css @@ -29,6 +29,12 @@ } } +@media only screen and (max-width: 943px) { + #hi_search__search-button { + visibility: hidden; + } +} + .hi_logo_text{ max-width: 450px; width: 90%; 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 f1548912..64042d1f 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 @@ -21,6 +21,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -62,6 +63,8 @@ public class bridgeController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } public void initializeAppModel() 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 26dc7c6a..a01d8c42 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 @@ -22,6 +22,7 @@ import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -63,6 +64,8 @@ public class helpController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } private void initializeAppModel() 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 eb9a4a73..af2cb8b3 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 @@ -36,6 +36,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -87,6 +88,8 @@ public class historyController extends AppCompatActivity public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } public void initializeListModel(){ 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 902e9e2c..7ea0a862 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 @@ -29,6 +29,7 @@ import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.GeckoRuntime; import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoView; +import org.mozilla.geckoview.WebResponse; public class geckoClients { @@ -143,6 +144,7 @@ public class geckoClients return status.sSettingCookieStatus; } + @SuppressLint("WrongConstant") public void updateSetting(){ mRuntime.getSettings().setRemoteDebuggingEnabled(false); mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts); @@ -256,6 +258,10 @@ public class geckoClients } } + public boolean wasPreviousErrorPage(){ + return mSession.wasPreviousErrorPage(); + } + public boolean canGoForward(){ return mSession.canGoForward(); } @@ -342,10 +348,12 @@ public class geckoClients { if (e_type.equals(on_handle_external_intent)) { - GeckoSession.WebResponseInfo responseInfo = (GeckoSession.WebResponseInfo)data.get(0); - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.contentType); - context.startActivity(intent); + try { + WebResponse responseInfo = (WebResponse)data.get(0); + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.headers.get("Content-Type")); + context.startActivity(intent); + }catch (Exception ignored){} } else { return event.invokeObserver(data, e_type); 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 dac645eb..c0e639b5 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 @@ -3,6 +3,8 @@ package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; import android.Manifest; import android.content.pm.PackageManager; import android.net.Uri; +import android.util.Log; + import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; @@ -10,8 +12,12 @@ import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.helperManager.eventObserver; import org.mozilla.geckoview.GeckoSession; +import org.mozilla.geckoview.WebResponse; + import java.util.Arrays; +import mozilla.components.support.utils.DownloadUtils; + class geckoDownloadManager { private Uri downloadURL; @@ -21,7 +27,7 @@ class geckoDownloadManager } - void downloadFile(GeckoSession.WebResponseInfo response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) { + void downloadFile(WebResponse response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) { session .getUserAgent() .accept(userAgent -> downloadFile(response, userAgent,context,session,event), @@ -30,7 +36,7 @@ class geckoDownloadManager }); } - private void downloadFile(GeckoSession.WebResponseInfo response, String userAgent, AppCompatActivity context, geckoSession session, eventObserver.eventListener event) { + private void downloadFile(WebResponse response, String userAgent, AppCompatActivity context, geckoSession session, eventObserver.eventListener event) { if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(context, @@ -39,9 +45,14 @@ class geckoDownloadManager return; } - - downloadURL = Uri.parse(response.uri); - downloadFile = response.filename != null ? response.filename : downloadURL.getLastPathSegment(); + try{ + String mFileName = DownloadUtils.guessFileName(response.headers.get("Content-Disposition"),"",response.uri,null); + downloadURL = Uri.parse(response.uri); + downloadFile = mFileName; + }catch (Exception ex){ + ex.printStackTrace(); + Log.i("sadsad",ex.getMessage()); + } event.invokeObserver(Arrays.asList(0,session.getSessionID()), enums.etype.progress_update); event.invokeObserver(Arrays.asList(downloadFile.toString(),session.getSessionID(),downloadURL.toString()), enums.etype.download_file_popup); 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 e3f22d72..85140bfc 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 @@ -21,6 +21,7 @@ import android.util.Base64; import android.util.Log; import android.view.autofill.AutofillManager; import android.view.autofill.AutofillValue; +import android.view.inputmethod.InputMethodManager; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -48,8 +49,11 @@ import org.mozilla.geckoview.Autofill; import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoView; +import org.mozilla.geckoview.SessionFinder; import org.mozilla.geckoview.SlowScriptResponse; import org.mozilla.geckoview.WebRequestError; +import org.mozilla.geckoview.WebResponse; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -61,6 +65,8 @@ import java.util.Objects; import javax.crypto.spec.SecretKeySpec; +import mozilla.components.support.utils.DownloadUtils; + 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; @@ -97,6 +103,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele private boolean mIsLoaded = false; private boolean isFirstPaintExecuted = false; private boolean mIsProgressBarChanging = false; + private Handler mFindHandler; geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){ @@ -145,6 +152,13 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele }else { event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.ON_FIRST_PAINT); } + + mFindHandler = new Handler(); + mFindHandler.postDelayed(() -> + { + mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); + }, 1500); + } void initURL(String url){ @@ -356,9 +370,9 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.on_playstore_load); return GeckoResult.fromValue(AllowOrDeny.DENY); } - else if(var1.uri.equals(constants.CONST_GENESIS_DOMAIN_URL_SLASHED)){ + else if(var1.uri.equals(constants.CONST_GENESIS_DOMAIN_URL_SLASHED) || var1.uri.startsWith("https://boogle.store/?")){ initURL(constants.CONST_GENESIS_DOMAIN_URL); - loadUri("resource://android/assets/Homepage/homepage.html"); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_LOAD_HOMEPAGE_GENESIS); return GeckoResult.fromValue(AllowOrDeny.DENY); } else if(var1.uri.equals("about:blank") && mIsLoaded){ @@ -389,7 +403,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_EXPAND_TOP_BAR); /* Its Absence causes delay on first launch*/ - if(mCurrentURL.contains("boogle.store")){ + if(!mCurrentURL.contains("boogle.store")){ mProgress = 5; event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced); } @@ -425,15 +439,25 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele /*Content Delegate*/ @UiThread @Override - public void onExternalResponse(@NonNull GeckoSession session, @NonNull GeckoSession.WebResponseInfo response) { + public void onExternalResponse(@NonNull GeckoSession session, @NonNull WebResponse response) { try { - event.invokeObserver(Arrays.asList(response,mSessionID), enums.etype.on_handle_external_intent); + if(response.headers.containsKey("Content-Disposition")){ + mDownloadManager.downloadFile(response,this,mContext,event); + }else if(response.headers.containsKey("Content-Type")){ + event.invokeObserver(Arrays.asList(response,mSessionID), enums.etype.on_handle_external_intent); + stop(); + } } catch (ActivityNotFoundException e) { - mDownloadManager.downloadFile(response,this,mContext,event); + event.invokeObserver(Arrays.asList(response,mSessionID), enums.etype.on_handle_external_intent); stop(); } } + @UiThread + public void onExternalResponse(@NonNull GeckoSession session, @NonNull GeckoSession.WebResponseInfo response){ + + } + @UiThread public void onFirstContentfulPaint(@NonNull GeckoSession var1) { isFirstPaintExecuted = true; @@ -713,6 +737,10 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele return mCanGoBack; } + boolean wasPreviousErrorPage(){ + return mPreviousErrorPage; + } + boolean canGoForward(){ return mCanGoForward; } @@ -737,19 +765,35 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele event.invokeObserver(Arrays.asList(null,mSessionID), enums.etype.on_close_sesson); } + GeckoResult mFinder = null; public void findInPage(String pQuery, int pDirection){ + mFinder = null; + mFinder = getFinder().find(pQuery, pDirection); new Thread(){ public void run(){ - try { - FinderResult mFinder = getFinder().find(pQuery, pDirection).poll(600); - if(mFinder!=null){ - event.invokeObserver(Arrays.asList(mFinder.total, mFinder.current), enums.etype.FINDER_RESULT_CALLBACK); + + int mCounter=0; + while (mFinder==null){ + try { + mCounter+=1; + sleep(100); + if(mCounter>10){ + return; + } + } catch (InterruptedException e) { + e.printStackTrace(); } + } + + try { + FinderResult mResult = mFinder.poll(); + event.invokeObserver(Arrays.asList(mResult.total, mResult.current), enums.etype.FINDER_RESULT_CALLBACK); } catch (Throwable throwable) { throwable.printStackTrace(); } } }.start(); + } void goBackSession(){ 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 2b4041cc..b58beb08 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 @@ -24,7 +24,9 @@ import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class hintAdapter extends RecyclerView.Adapter { @@ -33,7 +35,7 @@ public class hintAdapter extends RecyclerView.Adapter mHintList; private AppCompatActivity mContext; private eventObserver.eventListener mEvent; - private ImageView[] mWebIcon = new ImageView[15]; + private Map mWebIcon = new HashMap<>(); public hintAdapter(ArrayList pHintList, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pSearch) { this.mHintList = new ArrayList(); @@ -52,6 +54,10 @@ public class hintAdapter extends RecyclerView.Adapter6){ - break; + if(mWebIcon.containsKey(mURLLink)){ + mHintWebIcon.setImageDrawable(mWebIcon.get(mURLLink)); + } + + if(!mWebIcon.containsKey(mURLLink)){ + new Thread(){ + public void run(){ + try { + mHindTypeIconTemp.setImageDrawable(null); + mEvent.invokeObserver(Arrays.asList(mHindTypeIconTemp, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon); + while (true){ + int mCounter=0; + if(mHindTypeIconTemp.isAttachedToWindow() || mHindTypeIconTemp.getDrawable()==null){ + sleep(10); + mCounter+=1; + }else { + Log.i("BREAK",""); + break; + } + if(mCounter>6){ + break; + } } + + mContext.runOnUiThread(() -> { + mHintWebIcon.setColorFilter(null); + mHintWebIcon.clearColorFilter(); + mHintWebIcon.setImageTintList(null); + mHintWebIcon.setClipToOutline(true); + mHintWebIcon.setImageDrawable(mHindTypeIconTemp.getDrawable()); + mWebIcon.put(mURLLink,mHindTypeIconTemp.getDrawable()); + }); + + } catch (InterruptedException e) { + e.printStackTrace(); } - mContext.runOnUiThread(() -> { - mHintWebIcon.setColorFilter(null); - mHintWebIcon.clearColorFilter(); - mHintWebIcon.setImageTintList(null); - mHintWebIcon.setClipToOutline(true); - mHintWebIcon.setImageDrawable(mHindTypeIconTemp.getDrawable()); - }); - } catch (InterruptedException e) { - e.printStackTrace(); } - } - }.start(); + }.start(); + } } @SuppressLint("ClickableViewAccessibility") 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 d760810e..f9c3703c 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 @@ -18,6 +18,7 @@ import android.graphics.Color; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.os.Debug; import android.os.Handler; import android.preference.PreferenceManager; import android.speech.RecognizerIntent; @@ -267,12 +268,29 @@ public class homeController extends AppCompatActivity implements ComponentCallba initSuggestionView(new ArrayList<>(), strings.GENERIC_EMPTY_STR); } + public void onLoadTabFromTabController(){ + Object mTempModel = dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + if(mTempModel!=null){ + tabRowModel model = (tabRowModel)mTempModel; + + mGeckoView.releaseSession(); + mGeckoClient.initSession(model.getSession()); + mGeckoView.setSession(model.getSession()); + mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(), false, false, false); + + if(model.getSession().getCurrentURL().contains("boogle.store") || mGeckoClient.wasPreviousErrorPage() || model.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || model.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || model.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || model.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + }else { + mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); + } + } + } + public void onLoadTabOnResume(){ Object mTempModel = dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); if(mTempModel!=null){ tabRowModel model = (tabRowModel)mTempModel; if(!status.mThemeApplying){ - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP1:",(String)model.getSession().getCurrentURL()); mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(), false, false, false); } onLoadTab(model.getSession(),false,true); @@ -283,7 +301,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } initTabCount(); if(!status.mThemeApplying){ - org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP2:",(String)mGeckoClient.getSession().getCurrentURL()); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false); } status.mThemeApplying = false; @@ -302,13 +319,18 @@ public class homeController extends AppCompatActivity implements ComponentCallba @SuppressLint("ClickableViewAccessibility") private void initSuggestionView(ArrayList pList, String pSearch){ - LinearLayoutManager layoutManager = new LinearLayoutManager(this); hintAdapter mAdapter = new hintAdapter(pList,new hintViewCallback(), this, pSearch); - layoutManager.setReverseLayout(true); mHintListView.setAdapter(mAdapter); mHintListView.setLayoutManager(new LinearLayoutManager(this)); + mHintListView.setHasFixedSize(true); + mHintListView.setItemViewCacheSize(10); + mHintListView.setItemViewCacheSize(10); + mHintListView.setDrawingCacheEnabled(true); + mHintListView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); + Objects.requireNonNull(mHintListView.getItemAnimator()).setChangeDuration(0); + Objects.requireNonNull(mHintListView.getItemAnimator()).setAddDuration(0); findViewById(R.id.pSuggestionScroll).setOnTouchListener((v, event) -> { if (MotionEvent.ACTION_DOWN == event.getAction()) { @@ -509,7 +531,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed, boolean pExpandAppBar){ - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false)); if(!isSessionClosed){ dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession)); @@ -533,20 +554,22 @@ public class homeController extends AppCompatActivity implements ComponentCallba 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(),true); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),false); + mRenderedBitmap = mGeckoView.capturePixels(); if(pExpandAppBar){ mHomeViewController.expandTopBar(); } - if(mGeckoClient.getSession().getCurrentURL().contains("boogle.store") || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + if(mGeckoClient.getSession().getCurrentURL().contains("boogle.store") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); }else { mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); } mHomeViewController.onProgressBarUpdate(mGeckoClient.getSession().getProgress(),true); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false)); } /*-------------------------------------------------------USER EVENTS-------------------------------------------------------*/ @@ -640,13 +663,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba @Override public void onTextChanged(CharSequence s, int start,int before, int count) { - if(mSearchbar.isFocused()){ + if(!mSearchbar.isFocused()){ if(mFindText.getText().length()==0 && mGeckoClient!=null){ mGeckoClient.getSession().getFinder().clear(); mHomeViewController.onUpdateFindBarCount(0,0); }else { assert mGeckoClient != null; mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_MATCH_CASE & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); + } } } @@ -766,6 +790,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba isSuggestionChanged = false; if(mHintListView!=null && mHintListView.getAdapter()!=null && mHintListView.getAdapter().getItemCount()>0){ mHomeViewController.onUpdateSearchEngineBar(false, 150); + ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); } mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); if(!mGeckoClient.isLoading()){ @@ -874,8 +899,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"); mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(),false,false,true); + Log.i("FUCK::2","URL"); onLoadTab(model.getSession(), false,true); + Log.i("FUCK::3","url"); } } @@ -928,7 +956,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false)); mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,true); mHomeViewController.progressBarReset(); - mHomeViewController.onUpdateSearchBar(url,false,true, false); mGeckoClient.initURL(url); mGeckoClient.loadURL(url); onSaveCurrentTab(mGeckoClient.getSession(),false); @@ -937,6 +964,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mAppBar.setTag(R.id.expandableBar,true); initTabCount(); + mHomeViewController.onUpdateSearchBar(url,false,true, false); } public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){ @@ -974,7 +1002,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba runOnUiThread(() -> { activityContextManager.getInstance().getTabController().onInit(); mHomeViewController.onShowTabContainer(); - overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); + // overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); }); } } @@ -1001,6 +1029,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onDisableTabViewController(){ + onResume(); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true); mHomeViewController.onHideTabContainer(); activityContextManager.getInstance().getTabController().onExitAndClearBackup(); @@ -1011,7 +1040,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void onBackPressed(){ if(mTabFragment.getVisibility()==View.VISIBLE){ onResume(); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), false); mHomeViewController.onHideTabContainer(); activityContextManager.getInstance().getTabController().onPostExit(); activityContextManager.getInstance().getTabController().onBackPressed(); @@ -1024,10 +1053,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if(mSearchEngineBar.getVisibility() == View.VISIBLE){ mHomeViewController.onUpdateSearchEngineBar(false, 150); + ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); } else if(!mGeckoClient.getFullScreenStatus()){ mGeckoClient.onExitFullScreen(); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), false); } else { mGeckoClient.onBackPressed(true); @@ -1102,7 +1132,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } if(mTabFragment.getVisibility()==View.VISIBLE){ onResume(); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), false); mHomeViewController.onHideTabContainer(); activityContextManager.getInstance().getTabController().onPostExit(); activityContextManager.getInstance().getTabController().onBackPressed(); @@ -1110,7 +1140,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } mGeckoClient.onExitFullScreen(); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), false); pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); pluginController.getInstance().onNotificationInvoke(Collections.singletonList(1296000000) /* Every 15 Days */ , pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION); } @@ -1163,6 +1193,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba 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(); + } } } } @@ -1171,6 +1206,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba 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 OnClearSuggestion(View view){ mSearchbar.clearFocus(); } @@ -1308,7 +1351,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onFindNext(View view){ - mFindCount.setText("0/0"); mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_MATCH_CASE & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); } @@ -1319,7 +1361,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onFindPrev(View view){ - mFindCount.setText("0/0"); mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_BACKWARDS & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); } @@ -1371,13 +1412,18 @@ public class homeController extends AppCompatActivity implements ComponentCallba { activityContextManager.getInstance().getTabController().onInit(); mHomeViewController.onShowTabContainer(); - overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); + // overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); } else if (menuId == R.id.pMenuOpenNewTab) { helperMethod.hideKeyboard(this); helperMethod.openActivity(bookmarkController.class,constants.CONST_LIST_BOOKMARK, homeController.this,true); } + else if (menuId == R.id.menu28) + { + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_NEW_CIRCUIT); + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_NEW_IDENTITY); + } else if (menuId == R.id.pMenuOpenCurrentTab) { helperMethod.hideKeyboard(this); @@ -1488,6 +1534,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba { onOpenDownloadFolder(null); } + else if(e_type.equals(enums.etype.M_UPDATE_THEME)) + { + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), false); + } else if(e_type.equals(enums.etype.ON_UPDATE_THEME)){ mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),false); } @@ -1591,6 +1641,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(!isSuggestionSearchOpened){ if(mHintListView!=null && mHintListView.getAdapter()!=null && mHintListView.getAdapter().getItemCount()>0){ mHomeViewController.onUpdateSearchEngineBar(false, 150); + ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); } mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); if(!mGeckoClient.isLoading()){ @@ -1635,6 +1686,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba else if(e_type.equals(enums.etype.progress_update)){ mHomeViewController.onProgressBarUpdate((int)data.get(0), false); } + else if(e_type.equals(enums.etype.M_LOAD_HOMEPAGE_GENESIS)){ + onLoadURL(helperMethod.getDomainName(constants.CONST_BACKEND_GENESIS_URL)); + } else if(e_type.equals(enums.etype.progress_update_forced)){ Log.i("SUPPPP7:",(String)data.get(2)); mHomeViewController.onUpdateSearchBar((String) data.get(2), false, true, false); @@ -1701,7 +1755,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba else if(e_type.equals(enums.etype.on_full_screen)){ boolean status = (Boolean)data.get(0); mHomeViewController.onFullScreenUpdate(status); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),true); + 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))); @@ -1716,7 +1770,7 @@ 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)){ - postNewLinkTabAnimationInBackgroundTrigger(dataToStr(data.get(0))); + postNewLinkTabAnimation(dataToStr(data.get(0))); } 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 25a0e6c1..50e80f60 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 @@ -19,6 +19,7 @@ import android.os.Build; import android.os.Handler; import android.os.Message; import android.text.method.MovementMethod; +import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -47,6 +48,10 @@ import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.widget.progressBar.AnimatedProgressBar; import com.example.myapplication.R; import com.google.android.gms.ads.AdView; +import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; +import com.nostra13.universalimageloader.core.ImageLoader; +import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; +import com.nostra13.universalimageloader.core.assist.QueueProcessingType; import org.mozilla.geckoview.GeckoView; import org.torproject.android.service.wrapper.orbotLocalConstants; import java.util.ArrayList; @@ -75,7 +80,6 @@ class homeViewController private AnimatedProgressBar mProgressBar; private editTextManager mSearchbar; private ConstraintLayout mSplashScreen; - private ImageView mLoading; private TextView mLoadingText; private AdView mBannerAds = null; private Handler mUpdateUIHandler = null; @@ -116,7 +120,6 @@ class homeViewController this.mProgressBar = progressBar; this.mSearchbar = searchbar; this.mSplashScreen = splashScreen; - this.mLoading = loading; this.mLoadingText = loadingText; this.mWebviewContainer = webviewContainer; this.mBannerAds = banner_ads; @@ -156,6 +159,7 @@ class homeViewController } public void initializeViews(){ + mSearchbar.setTag(R.id.msearchbarProcessing,false); mNestedScroll.setNestedScrollingEnabled(true); this.mBlockerFullSceen.setVisibility(View.GONE); mSearchBarMovementMethod = mSearchbar.getMovementMethod(); @@ -219,28 +223,41 @@ class homeViewController public void onShowTabContainer(){ if(mTabFragment.getAlpha()==0 || mTabFragment.getAlpha()==1){ + + mTabFragment.setAlpha(0); + mTabFragment.setTranslationY(0); mTabFragment.setVisibility(View.VISIBLE); mTabFragment.setTranslationY(-1 * helperMethod.pxFromDp(15)); - mTabFragment.animate() - .setDuration(250) - .translationY(0) - .alpha(1f); + + new Handler().postDelayed(() -> + { + mTabFragment.setLayerType(View.LAYER_TYPE_HARDWARE, null); + mTabFragment.animate().withLayer() + .setDuration(250) + .translationY(0) + .alpha(1f) + .withEndAction( + () -> mTabFragment.setLayerType(View.LAYER_TYPE_NONE, null) + ).start(); + + }, 10); } } public void onHideTabContainer(){ if(mTabFragment.getAlpha()==1){ mTabFragment.animate() - .setDuration(250) + .setDuration(150) .alpha(0f).withEndAction(() -> mTabFragment.setVisibility(View.GONE)); mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), enums.etype.M_INIT_TAB_COUNT); + mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME); } } public int getSearchLogo(){ switch (status.sSettingSearchStatus) { case constants.CONST_BACKEND_GENESIS_URL: - return R.drawable.ic_genesis_vector; + return R.drawable.genesis; case constants.CONST_BACKEND_GOOGLE_URL: return R.drawable.google; case constants.CONST_BACKEND_DUCK_DUCK_GO_URL: @@ -252,6 +269,17 @@ class homeViewController } } + public static void initImageLoader(Context context) { + ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context); + config.threadPriority(Thread.NORM_PRIORITY - 2); + config.denyCacheImageMultipleSizesInMemory(); + config.diskCacheFileNameGenerator(new Md5FileNameGenerator()); + config.diskCacheSize(50 * 1024 * 1024); // 50 MiB + config.tasksProcessingOrder(QueueProcessingType.LIFO); + config.writeDebugLogs(); // Remove for release app + ImageLoader.getInstance().init(config.build()); + } + @SuppressLint("UseCompatLoadingForDrawables") public void onUpdateSearchIcon(int mStatus){ try { @@ -259,11 +287,16 @@ class homeViewController mSearchLock.setColorFilter(null); mSearchLock.clearColorFilter(); mSearchLock.setImageTintList(null); + mSearchLock.setImageDrawable(mContext.getResources().getDrawable(getSearchLogo())); } else if(mStatus==1){ - mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_lock_tint)); - mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_lock)); + if(!(boolean)mSearchLock.getTag(R.id.themed)){ + mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_lock_tint)); + mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_lock)); + }else { + mSearchLock.setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_lock)); + } } else if(mStatus==2){ mSearchLock.setColorFilter(ContextCompat.getColor(mContext, R.color.c_icon_tint)); @@ -335,16 +368,15 @@ class homeViewController mNewTab.animate().withLayer() .rotationX(60) .alpha(0.4f) - .setDuration(80) + .setDuration(120) .withEndAction( new Runnable() { @Override public void run() { - // second quarter turn mNewTab.setRotationX(-60); mNewTab.animate().withLayer() .rotationX(0) .alpha(1) - .setDuration(100) + .setDuration(150) .start(); } } @@ -365,20 +397,18 @@ class homeViewController mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); } } - - //mContext.getWindow().getDecorView().setSystemUiVisibility(status.sTheme); } public void initStatusBarColor(boolean mInstant) { animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2)); - int mDelay = 450; + int mDelay = 500; if(status.mThemeApplying || mInstant){ mDelay = 0; } ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f); - animator.setDuration(350).setStartDelay(mDelay); + animator.setDuration(300).setStartDelay(mDelay); animator.addUpdateListener(animation -> { float v = (float) animation.getAnimatedValue(); @@ -466,6 +496,8 @@ class homeViewController mIsAnimating = false; mSearchbar.setEnabled(false); helperMethod.hideKeyboard(mContext); + mSearchLock.setTag(R.id.themed,false); + mAppBar.setTag(R.id.expandableBar,true); mSearchbar.setEnabled(false); @@ -697,6 +729,9 @@ class homeViewController } } + public void performDummyClick(){ + } + void updateBannerAdvertStatus(boolean status, boolean pIsAdvertLoaded){ if(status && pIsAdvertLoaded){ if(mBannerAds.getAlpha()==0){ @@ -720,11 +755,19 @@ class homeViewController void onUpdateSearchBar(String url,boolean showProtocol, boolean pClearText, boolean pBypassFocus){ if(url.startsWith(CONST_GENESIS_URL_CACHED) || url.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ + mSearchbar.setTag(R.id.msearchbarProcessing,true); url = CONST_GENESIS_DOMAIN_URL; } else if(url.startsWith(CONST_GENESIS_HELP_URL_CACHE) || url.startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mSearchbar.setTag(R.id.msearchbarProcessing,true); url = CONST_GENESIS_HELP_URL; } + else if(url.contains("genesis") || url.contains("boogle")){ + mSearchbar.setTag(R.id.msearchbarProcessing,true); + }else { + mSearchbar.setTag(R.id.msearchbarProcessing,false); + } + Log.i("FUCK::5",url); if(!mSearchbar.hasFocus() || pClearText || pBypassFocus){ int delay = 0; handlerLocalUrl = url; @@ -738,7 +781,7 @@ class homeViewController { searchBarUpdateHandler.removeMessages(100); triggerUpdateSearchBar(handlerLocalUrl,showProtocol, pClearText); - + mSearchbar.setTag(R.id.msearchbarProcessing,false); }, delay); } } @@ -746,7 +789,7 @@ class homeViewController public void onUpdateFindBarCount(int index, int total) { if(total==0){ - mFindCount.setText(strings.GENERIC_EMPTY_STR); + mFindCount.setText("0/0"); }else { mFindCount.setText((total + "/" + index)); } @@ -754,7 +797,7 @@ class homeViewController public void onUpdateStatusBarTheme(String pTheme, boolean mForced) { - if(mSplashScreen.getAlpha()<=0 && (status.sTheme != enums.Theme.THEME_DARK && status.sDefaultNightMode)){ + if(mSplashScreen.getAlpha()<=0 && (status.sTheme != enums.Theme.THEME_DARK && !status.sDefaultNightMode) && mTabFragment.getAlpha()<=0 || mForced){ int mColor = -1; try{ mColor = Color.parseColor(pTheme); @@ -771,7 +814,6 @@ class homeViewController GradientDrawable mGradientDrawable = new GradientDrawable(); mGradientDrawable.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.90f), Color.BLACK, 0.2f)); mGradientDrawable.setCornerRadius(helperMethod.pxFromDp(7)); - mSearchbar.setBackground(mGradientDrawable); GradientDrawable gradientDrawable1 = new GradientDrawable(); gradientDrawable1.setColor(ColorUtils.blendARGB(helperMethod.invertedShadeColor(mColor,0.90f), Color.BLACK, 0.2f)); @@ -795,6 +837,10 @@ class homeViewController mMenu.setColorFilter(helperMethod.invertedGrayColor(mColor)); mVoiceInput.setColorFilter(helperMethod.invertedGrayColor(mColor)); mVoiceInput.setBackground(mGradientDrawable); + mSearchLock.setColorFilter(helperMethod.invertedGrayColor(mColor)); + mSearchLock.setTag(R.id.themed,true); + gradientDrawable1.setCornerRadius(helperMethod.pxFromDp(7)); + mSearchbar.setBackground(gradientDrawable1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mContext.getWindow().setStatusBarColor(Color.parseColor(pTheme)); @@ -810,6 +856,7 @@ class homeViewController } } else{ + mSearchLock.setTag(R.id.themed,false); mTopBar.setBackground(ContextCompat.getDrawable(mContext, R.color.c_background)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { @@ -834,12 +881,13 @@ class homeViewController 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)); + onUpdateSearchIcon(1); if(status.sTheme != enums.Theme.THEME_DARK && !status.sDefaultNightMode){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + }else { View decorView = mContext.getWindow().getDecorView(); decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - }else { - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); } } } @@ -852,14 +900,20 @@ class homeViewController mFindBar.setVisibility(View.VISIBLE); mFindBar.setAlpha(1); mFindText.requestFocus(); - InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); - imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT,0); + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT,0); + }, 300); }else { mFindText.clearFocus(); - mFindCount.setText(strings.GENERIC_EMPTY_STR); helperMethod.hideKeyboard(mContext); - mFindBar.animate().alpha(0).withEndAction(() -> mFindBar.setVisibility(View.GONE)); - mFindText.setText(strings.GENERIC_EMPTY_STR); + mFindBar.animate().alpha(0).withEndAction(() -> { + mFindCount.setText(strings.GENERIC_EMPTY_STR); + mFindText.setText(strings.GENERIC_EMPTY_STR); + mFindBar.setVisibility(View.GONE); + }); } } @@ -948,7 +1002,7 @@ class homeViewController } void onProgressBarUpdate(int value, boolean mForced){ - if(mSearchbar.getText().toString().equals("genesis.onion") && !mForced){ + if(mSearchbar.getText().toString().equals("genesis.onion") && !mForced || (boolean)mSearchbar.getTag(R.id.msearchbarProcessing)){ mProgressBar.setProgress(0); mProgressBar.setVisibility(View.GONE); return; 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 e4d1043b..bba02736 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 @@ -22,6 +22,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -66,6 +67,8 @@ public class languageController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } private void initializeAppModel() @@ -163,7 +166,7 @@ public class languageController extends AppCompatActivity { } status.mThemeApplying = true; - //activityContextManager.getInstance().getHomeController().recreate(); + activityContextManager.getInstance().getHomeController().recreate(); return true; } 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 88469807..c84b571f 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 @@ -21,6 +21,7 @@ import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -67,6 +68,8 @@ public class orbotLogController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } public void viewsInitializations() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java index 2f7320a9..dfcd35b4 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java @@ -23,6 +23,7 @@ import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -60,6 +61,8 @@ public class orbotController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } public void viewsInitializations() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java index 8ebda47a..908584ca 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/proxyStatusManager/proxyStatusController.java @@ -14,6 +14,7 @@ import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -49,6 +50,8 @@ public class proxyStatusController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } public void viewsInitializations() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java index d3390abc..db103546 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java @@ -17,6 +17,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -59,6 +60,8 @@ public class settingAccessibilityController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } private void viewsInitializations() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java index 2cf63de6..68c21fd9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/advanceManager/settingAdvanceController.java @@ -16,6 +16,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -53,6 +54,8 @@ public class settingAdvanceController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } public void viewsInitializations() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java index 6c3438f6..b60a7f56 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java @@ -22,6 +22,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -57,6 +58,8 @@ public class settingClearController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } public void viewsInitializations() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java index f75c11d9..5380a8ed 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/generalManager/settingGeneralController.java @@ -20,6 +20,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -59,6 +60,8 @@ public class settingGeneralController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } private void viewsInitializations() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java index f8a45e90..5f293ef0 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/logManager/settingLogController.java @@ -16,6 +16,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -46,6 +47,8 @@ public class settingLogController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } private void viewsInitializations() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java index f001e024..f0b29103 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/notificationManager/settingNotificationController.java @@ -15,6 +15,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -45,6 +46,8 @@ public class settingNotificationController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } private void viewsInitializations() { 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 d75c3859..ad897a18 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 @@ -17,6 +17,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -51,6 +52,8 @@ public class settingPrivacyController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } private void viewsInitializations() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java index cc2cd7b5..e9558ae6 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/searchEngineManager/settingSearchController.java @@ -16,6 +16,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -47,6 +48,8 @@ public class settingSearchController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } private void viewsInitializations() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeController.java index 3c26b5be..d209d0c5 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeController.java @@ -26,6 +26,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -65,6 +66,8 @@ public class settingHomeController extends AppCompatActivity public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } private void viewsInitializations() diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java index e7da531a..6a8dbe62 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/trackingManager/settingTrackingController.java @@ -16,6 +16,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -47,6 +48,8 @@ public class settingTrackingController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + + theme.getInstance().onConfigurationChanged(this); } private void viewsInitializations() { 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 efc5e6a8..44574943 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 @@ -4,6 +4,7 @@ import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Handler; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -45,6 +46,7 @@ public class tabAdapter extends RecyclerView.Adapter tabAdapter(ArrayList pModelList, eventObserver.eventListener event) { + this.mModelList.clear(); this.mModelList.addAll(pModelList); mModelList.add(new tabRowModel(null, null,null)); this.mEvent = event; @@ -178,9 +180,11 @@ public class tabAdapter extends RecyclerView.Adapter } private void onTriggerURL(tabRowModel model){ - mEvent.invokeObserver(Arrays.asList(model.getSession(), false), tabEnums.eTabAdapterCallback.ON_LOAD_TAB); - mEvent.invokeObserver(null, tabEnums.eTabAdapterCallback.ON_BACK_PRESSED); - mEvent.invokeObserver(null, tabEnums.eTabAdapterCallback.ON_INIT_TAB_COUNT); + if(model.getSession()!=null){ + mEvent.invokeObserver(Arrays.asList(model.getSession(), false), tabEnums.eTabAdapterCallback.ON_LOAD_TAB); + mEvent.invokeObserver(null, tabEnums.eTabAdapterCallback.ON_BACK_PRESSED); + mEvent.invokeObserver(null, tabEnums.eTabAdapterCallback.ON_INIT_TAB_COUNT); + } } private int getSelectionSize(){ @@ -238,6 +242,8 @@ public class tabAdapter extends RecyclerView.Adapter mItemSelectionMenuReference = itemView.findViewById(R.id.pRowContainer); mBorder = itemView.findViewById(R.id.pBorder); + itemView.setClickable(true); + if(model.getmId()==null){ mItemSelectionMenu.setVisibility(View.VISIBLE); mItemSelectionMenuButton.setOnClickListener(this); @@ -294,7 +300,6 @@ public class tabAdapter extends RecyclerView.Adapter mLoadSession.setOnClickListener(this); } - mItemSelectionMenuReference.animate().cancel(); if(this.getLayoutPosition()==mModelList.size()-1){ if(mSelectedList.size()>0){ itemView.setVisibility(View.GONE); @@ -306,6 +311,9 @@ public class tabAdapter extends RecyclerView.Adapter mItemSelectionMenuButton.animate().setDuration(250).alpha(1); } }else { + if(model.getmId()!=null){ + mItemSelectionMenuReference.animate().cancel(); + } itemView.setVisibility(View.VISIBLE); mLongPressMenuEnabled = false; mItemSelectionMenuButton.animate().setDuration(250).alpha(1); 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 0f77ec64..d74ac73f 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 @@ -1,6 +1,8 @@ package com.darkweb.genesissearchengine.appManager.tabManager; import android.annotation.SuppressLint; +import android.content.Context; +import android.content.pm.ActivityInfo; import android.graphics.Canvas; import android.os.Bundle; import android.os.Handler; @@ -8,6 +10,7 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; @@ -110,6 +113,7 @@ public class tabController extends Fragment return false; }); } + public void initializeList(){ LinearLayoutManager layoutManager = new LinearLayoutManager(this.getContext()); tabAdapter adapter = new tabAdapter(mListModel.getList(),new adapterCallback()); @@ -203,6 +207,7 @@ public class tabController extends Fragment mRecycleView.animate().setDuration(350).alpha(0); } initTabCount(400); + activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.INIT_FIRST_ROW, null); } @@ -213,17 +218,18 @@ public class tabController extends Fragment mRecycleView.animate().setDuration(350).alpha(0).withEndAction(() -> { mTabAdapter.notifyDataSetChanged(); }); + activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); return false; }else{ mTabAdapter.notifyItemRangeChanged(pIndex, mTabAdapter.getItemCount() - pIndex); + activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); return true; } } public void initTabCount(int pDelay) { - mtabViewController.onTrigger(tabEnums.eTabViewCommands.INIT_TAB_COUNT, Collections.singletonList(mListModel.getList().size())); - + //mtabViewController.onTrigger(tabEnums.eTabViewCommands.INIT_TAB_COUNT, Collections.singletonList(mListModel.getList().size())); final Handler handler = new Handler(); handler.postDelayed(() -> { @@ -250,20 +256,28 @@ public class tabController extends Fragment } public void onRestoreTab(View view){ - mPopupUndo.findViewById(R.id.pBlockerUndo).setVisibility(View.VISIBLE); - mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG, null); - - if(mRecycleView.getAlpha()==0){ - initializeList(); - mRecycleView.animate().cancel(); - mRecycleView.setVisibility(View.VISIBLE); - mRecycleView.animate().setDuration(350).alpha(1); - } ArrayList mBackup = (ArrayList)mListModel.onTrigger(tabEnums.eModelCallback.M_LOAD_BACKUP,null); - mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.REINIT_DATA, Collections.singletonList(mBackup)); - mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_RETAIN_DATABASE,null); - initTabCount(400); + ViewGroup.LayoutParams params = mRecycleView.getLayoutParams(); + params.height = helperMethod.pxFromDp((mTabAdapter.getItemCount()+mBackup.size()) * 90); + mRecycleView.setLayoutParams(params); + + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + mPopupUndo.findViewById(R.id.pBlockerUndo).setVisibility(View.VISIBLE); + mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG, null); + + if(mRecycleView.getAlpha()==0){ + initializeList(); + mRecycleView.animate().cancel(); + mRecycleView.setVisibility(View.VISIBLE); + mRecycleView.animate().setDuration(350).alpha(1); + } + + mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.REINIT_DATA, Collections.singletonList(mBackup)); + mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_RETAIN_DATABASE,null); + }, 100); } public void onShowUndoDialog(){ @@ -291,7 +305,9 @@ public class tabController extends Fragment /*UI Triggers*/ public void onPostExit() { - mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_EXIT, null); + if(mtabViewController!=null){ + mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_EXIT, null); + } } public void openTabMenu(View view) { @@ -311,6 +327,7 @@ public class tabController extends Fragment mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_SHOW_SELECTION_MENU, Arrays.asList(false,0)); mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_SELECTION, null); + activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); } public void onClearSelection(View view) { @@ -354,7 +371,7 @@ public class tabController extends Fragment @Override public void onStop() { - onBackPressed(); + // onBackPressed(); super.onStop(); } @@ -362,7 +379,7 @@ public class tabController extends Fragment public void onPause() { status.sSettingIsAppPaused = true; - onBackPressed(); + // onBackPressed(); super.onPause(); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java index 691a5770..a1a4ae3e 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java @@ -43,7 +43,7 @@ class tabViewController private ImageView mRemoveSelection; private ImageButton mMenuButton; private ImageButton mClearSelection; - private View mToastLayoutRoot; + private View mUndoLayout; private TextView mSelectionCount; private ImageView mBlocker; private RecyclerView mRecycleView; @@ -61,7 +61,7 @@ class tabViewController this.mRemoveSelection = pRemoveSelection; this.mMenuButton = pMenuButton; this.mClearSelection = pClearSelection; - this.mToastLayoutRoot = pToastLayoutRoot; + this.mUndoLayout = pToastLayoutRoot; this.mSelectionCount = pSelectionCount; this.mBlocker = pBlocker; this.mRecycleView = pRecycleView; @@ -166,26 +166,37 @@ class tabViewController } private void onShowUndoDialog(int pTabCount) { - mToastLayoutRoot.findViewById(R.id.pBlockerUndo).setVisibility(View.GONE); - mToastLayoutRoot.animate().cancel(); - mToastLayoutRoot.setVisibility(View.VISIBLE); - mToastLayoutRoot.setAlpha(0); - mToastLayoutRoot.animate().alpha(1); + mUndoLayout.findViewById(R.id.pBlockerUndo).setVisibility(View.GONE); + mUndoLayout.animate().cancel(); + mUndoLayout.setVisibility(View.VISIBLE); + + mUndoLayout.animate().cancel(); + mUndoLayout.setTranslationY(60); + mUndoLayout.setAlpha(0); + + mUndoLayout.animate().withLayer() + .translationY(0) + .alpha(1f) + .setDuration(220).start(); + initTabCount(pTabCount); mDelayHandler.removeCallbacksAndMessages(null); - mDelayHandler.postDelayed(() -> mToastLayoutRoot.animate().alpha(0).withEndAction(() -> mToastLayoutRoot.setVisibility(View.GONE)), 3000); + mDelayHandler.postDelayed(() -> { + mUndoLayout.animate().cancel(); + mUndoLayout.animate().alpha(0).withEndAction(() -> mUndoLayout.setVisibility(View.GONE)); + }, 3000); } private void onHideUndoDialog() { - mToastLayoutRoot.animate().cancel(); - mToastLayoutRoot.animate().alpha(0).withEndAction(() -> mToastLayoutRoot.setVisibility(View.GONE)); + mUndoLayout.animate().cancel(); + mUndoLayout.animate().alpha(0).withEndAction(() -> mUndoLayout.setVisibility(View.GONE)); } private void onHideUndoDialogInit() { - mToastLayoutRoot.animate().cancel(); - mToastLayoutRoot.setAlpha(0); - mToastLayoutRoot.setVisibility(View.GONE); + mUndoLayout.animate().cancel(); + mUndoLayout.setAlpha(0); + mUndoLayout.setVisibility(View.GONE); } 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 fad2c6dc..ae42b867 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -6,7 +6,7 @@ public class enums public enum etype{ 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_ON_BANNER_UPDATE,M_INIT_TAB_COUNT, + 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, 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/status.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java index 5cd19980..657d35b5 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -80,7 +80,7 @@ public class status status.sSettingIsWelcomeEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); status.sSettingIsAppRated = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); status.sVPNStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); - status.sBridgeStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,true)); + status.sBridgeStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); status.sSettingFontAdjustable = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); status.sSettingFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FIRST_INSTALLED,true)); status.sSettingEnableZoom = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java index db84e3ec..5fc5801e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java @@ -50,7 +50,7 @@ public class bookmarkDataModel { params[1] = pURL; if(!pTitle.equals("loading")){ - databaseController.getInstance().execSQL("INSERT INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params); + databaseController.getInstance().execSQL("REPLACE INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params); } mBookmarks.add(0,new bookmarkRowModel(pTitle, pURL,autoval)); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java index 12182411..871bcc96 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java @@ -119,7 +119,7 @@ public class historyDataModel { String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); if(!pHeader.equals("loading")){ - databaseController.getInstance().execSQL("INSERT INTO history(id,date,url,title) VALUES("+ mMaxHistoryId +",'" + m_date + "',?,?);",params); + databaseController.getInstance().execSQL("REPLACE INTO history(id,date,url,title) VALUES("+ mMaxHistoryId +",'" + m_date + "',?,?);",params); } mHistory.add(0,new historyRowModel(pHeader,pUrl, mMaxHistoryId)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java index 76f0cd33..0891569d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java @@ -37,7 +37,7 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess /*Helper Methods*/ - private ArrayList getDefaultSuggestions(String pQuery){ + private ArrayList getDefaultSuggestions(String pQuery, int mSize){ for(int count = 0; count<= mHintListLocalCache.size()-1 && mHintListLocalCache.size()<500; count++){ if(mHintListLocalCache.get(count).getHeader().toLowerCase().contains(pQuery)){ mCurrentList.add(new historyRowModel(mHintListLocalCache.get(count).getHeader(),mHintListLocalCache.get(count).getDescription(),-1)); @@ -48,6 +48,9 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess mCurrentList.add(new historyRowModel(mHintListLocalCache.get(count).getHeader(),mHintListLocalCache.get(count).getDescription(),-1)); } } + if(mCurrentList.size() + mSize > 6){ + break; + } } return mCurrentList; @@ -57,6 +60,7 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess mCurrentList = new ArrayList<>(); mCurrentList.clear(); + String mQueryOriginal = pQuery; pQuery = pQuery.replace("+","%").replace(" ","+"); ArrayList mHistory = pHistory; ArrayList mBookmarks = pBookmarks; @@ -82,14 +86,14 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess mCurrentList.add(mTempModel); } } - if(mCurrentList.size()>8){ + if(mCurrentList.size()>6){ break; } } } } - if(status.sSettingSearchHistory && mCurrentList.size()>8) { + if(status.sSettingSearchHistory && mCurrentList.size()>4) { for (int count = 0; count <= mBookmarks.size() - 1 && mBookmarks.size() < 500; count++) { if(!mDuplicationHandler.contains(mBookmarks.get(count).getDescription())){ if (mBookmarks.get(count).getHeader().toLowerCase().contains(pQuery)) { @@ -99,34 +103,32 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess mDuplicationHandler.add(mBookmarks.get(count).getDescription()); mCurrentList.add(mCurrentList.size() - 1, new historyRowModel(mBookmarks.get(count).getHeader(), mBookmarks.get(count).getDescription(), -1)); } - if(mCurrentList.size()>8){ + if(mCurrentList.size()>6){ break; } } } } - if(mCurrentList.size()<8) { - getDefaultSuggestions(pQuery); + if(mCurrentList.size()<6) { + getDefaultSuggestions(pQuery, mCurrentList.size()); } - if(mCurrentList.size()<8){ - String mQueryOriginal = pQuery; + if(mCurrentList.size()<3){ - if(!pQuery.equals(strings.GENERIC_EMPTY_STR) && !pQuery.equals("about:blank") && !pQuery.contains("?") && !pQuery.contains("/") && !pQuery.contains(" ") && !pQuery.contains(" ") && !pQuery.contains("\n")){ - if(mCurrentList.size()<3){ - int sepPos = pQuery.indexOf("."); - if (sepPos == -1) { - mCurrentList.add( 0,new historyRowModel(mQueryOriginal+".com", strings.GENERIC_EMPTY_STR,-1)); - mCurrentList.add( 0,new historyRowModel(mQueryOriginal+".onion", strings.GENERIC_EMPTY_STR,-1)); - }else - { - if(!pQuery.equals(pQuery.substring(0,sepPos)+".com")){ - mCurrentList.add( 0,new historyRowModel(pQuery.substring(0,sepPos)+".com", strings.GENERIC_EMPTY_STR,-1)); - } - if(!pQuery.equals(pQuery.substring(0,sepPos)+".onion")){ - mCurrentList.add( 0,new historyRowModel(pQuery.substring(0,sepPos)+".onion", strings.GENERIC_EMPTY_STR,-1)); - } + if(!mQueryOriginal.equals(strings.GENERIC_EMPTY_STR) && !mQueryOriginal.equals("about:blank") && !mQueryOriginal.contains("?") && !mQueryOriginal.contains("/") && !mQueryOriginal.contains(" ") && !mQueryOriginal.contains(" ") && !mQueryOriginal.contains("\n")){ + mCurrentList.size(); + int sepPos = pQuery.indexOf("."); + if (sepPos == -1) { + mCurrentList.add( 0,new historyRowModel(mQueryOriginal+".com", strings.GENERIC_EMPTY_STR,-1)); + mCurrentList.add( 0,new historyRowModel(mQueryOriginal+".onion", strings.GENERIC_EMPTY_STR,-1)); + }else + { + if(!pQuery.equals(pQuery.substring(0,sepPos)+".com")){ + mCurrentList.add( 0,new historyRowModel(pQuery.substring(0,sepPos)+".com", strings.GENERIC_EMPTY_STR,-1)); + } + if(!pQuery.equals(pQuery.substring(0,sepPos)+".onion")){ + mCurrentList.add( 0,new historyRowModel(pQuery.substring(0,sepPos)+".onion", strings.GENERIC_EMPTY_STR,-1)); } } } @@ -257,7 +259,7 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess } else if(pCommands == dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION) { - return getDefaultSuggestions((String) pData.get(0)); + return getDefaultSuggestions((String) pData.get(0),0); } return null; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java index 9e8c08a9..f419995a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java @@ -121,15 +121,18 @@ class tabDataModel } void moveTabToTop(geckoSession mSession) { - for(int counter = 0; counter< mTabs.size(); counter++){ - if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID())) - { - String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); - databaseController.getInstance().execSQL("UPDATE tab SET date = '" + m_date + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null); - mTabs.add(0,mTabs.remove(counter)); - break; + try{ + if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID())) + { + String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); + databaseController.getInstance().execSQL("UPDATE tab SET date = '" + m_date + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null); + mTabs.add(0,mTabs.remove(counter)); + break; + } + }catch (Exception ex){ + Log.i(ex.getMessage(), ex.getMessage()); } } } 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 7db5c2b1..4d6d0a4e 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java @@ -665,6 +665,8 @@ public class helperMethod return mDrawable; } + + public static String getCurrentTime(){ Calendar now = Calendar.getInstance(); int year = now.get(Calendar.YEAR); 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 53a2f89f..787ac2db 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java @@ -76,6 +76,9 @@ public class localFileDownloader extends AsyncTask { mNotifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); build = new NotificationCompat.Builder(context); + if(mFileName.length()>30){ + mFileName = "..." + mFileName.substring(mFileName.length()-30); + } build.setContentTitle(mFileName) .setContentText("starting...") .setChannelId(mID + "") @@ -150,12 +153,7 @@ public class localFileDownloader extends AsyncTask { mStream.close(); } catch (Exception ex) { - build.setContentText("error occured while downloading file"); - build.setAutoCancel(true); - build.setOngoing(false); - build.setPriority(Notification.PRIORITY_LOW); - build.setSmallIcon(android.R.drawable.stat_sys_download); - mNotifyManager.notify(mID, build.build()); + onCancel(); } return null; 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 bd9eea01..33359966 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java @@ -148,6 +148,19 @@ class messageManager mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mDialog.dismiss()); } + private void newIdentityCreated() + { + initializeDialog(R.layout.popup_new_circuit, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + + final Handler handler = new Handler(); + Runnable runnable = () -> { + mDialog.dismiss(); + }; + handler.postDelayed(runnable, 1500); + + } + private void notSupportMessage() { initializeDialog(R.layout.popup_not_supported, Gravity.BOTTOM); @@ -566,6 +579,11 @@ class messageManager /*VERIFIED*/ onUpdateBridges(); break; + + case M_NEW_IDENTITY: + /*VERIFIED*/ + newIdentityCreated(); + break; } } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java index 1a854d92..bc69180b 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java @@ -180,6 +180,10 @@ class orbotManager return orbotLocalConstants.mIsTorInitialized; } + private void newCircuit(){ + OrbotService.getServiceObject().newIdentity(); + } + private String getOrbotStatus(){ return OrbotService.getServiceObject().getProxyStatus(); } @@ -243,6 +247,10 @@ class orbotManager { return isOrbotRunning(); } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_NEW_CIRCUIT)) + { + newCircuit(); + } return null; } 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 91cf996f..1c25c26e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java @@ -28,7 +28,7 @@ public class pluginEnums /*Message Manager*/ public enum eMessageManager{ - M_RESET, M_DATA_CLEARED, M_SECURE_CONNECTION,M_DOWNLOAD_SINGLE, M_UPDATE_BRIDGES, 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_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 @@ -46,6 +46,6 @@ public class pluginEnums /*Orbot Manager*/ public enum eOrbotManager{ - M_GET_NOTIFICATION_STATUS, M_ENABLE_NOTIFICATION, M_DISABLE_NOTIFICATION, M_DISABLE_NOTIFICATION_NO_BANDWIDTH, M_GET_LOGS, M_UPDATE_PRIVACY,M_START_ORBOT,M_IS_ORBOT_RUNNING, M_GET_ORBOT_STATUS, M_UPDATE_BRIDGES, M_UPDATE_VPN, M_SET_PROXY, M_SHOW_NOTIFICATION_STATUS, M_ORBOT_RUNNING + M_GET_NOTIFICATION_STATUS, M_NEW_CIRCUIT,M_ENABLE_NOTIFICATION, M_DISABLE_NOTIFICATION, M_DISABLE_NOTIFICATION_NO_BANDWIDTH, M_GET_LOGS, M_UPDATE_PRIVACY,M_START_ORBOT,M_IS_ORBOT_RUNNING, M_GET_ORBOT_STATUS, M_UPDATE_BRIDGES, M_UPDATE_VPN, M_SET_PROXY, M_SHOW_NOTIFICATION_STATUS, M_ORBOT_RUNNING } } \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_ripple_light.xml b/app/src/main/res/custom-xml/generic/xml/gx_ripple_light.xml index b03dd827..84ed06e8 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_ripple_light.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_ripple_light.xml @@ -1,5 +1,5 @@ + android:color="@color/c_ripple_light"> diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_circuit.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_circuit.xml new file mode 100644 index 00000000..0288ad17 --- /dev/null +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_circuit.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_perm_identity.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_perm_identity.xml new file mode 100644 index 00000000..0c04292c --- /dev/null +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_perm_identity.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layouts/alert/layout/popup_load_new_tab.xml b/app/src/main/res/layouts/alert/layout/popup_load_new_tab.xml index 61e97ceb..3bda52c4 100644 --- a/app/src/main/res/layouts/alert/layout/popup_load_new_tab.xml +++ b/app/src/main/res/layouts/alert/layout/popup_load_new_tab.xml @@ -39,7 +39,7 @@ tools:ignore="SmallSp" />