diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 977f3a88..279d02fa 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -6,6 +6,10 @@ + + @@ -21,6 +25,7 @@ + diff --git a/app/google-services.json b/app/google-services.json index 9fa43cf3..71935c15 100755 --- a/app/google-services.json +++ b/app/google-services.json @@ -10,7 +10,7 @@ "client_info": { "mobilesdk_app_id": "1:1026582312920:android:056aacc3b6f0c3b3f164ad", "android_client_info": { - "package_name": "com.darkweb.genesissearchengine.dev" + "package_name": "com.darkweb.genesissearchengine.production" } }, "oauth_client": [ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 24ba4b5a..39df419c 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,7 +45,7 @@ android:name="com.darkweb.genesissearchengine.appManager.proxyStatusManager.proxyStatusController" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" /> - - @@ -194,27 +194,27 @@ android:value="be76c64dae2519d4ab8daaed88298da14c7c294f" /> - - - + android:value="ca-app-pub-9340927969469822~8113004486" /> + + + - + @@ -224,7 +224,7 @@ activityContextManager.getInstance().getHomeController().onStartApplication(null), 3000); + } + + helperMethod.onDelayHandler(activityContextManager.getInstance().getHomeController(), 800, () -> { + + /* Start Required Activity */ + + Intent intent = new Intent(this.getIntent()); + intent.setClassName(this.getApplicationContext(), homeController.class.getName()); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); + + this.startActivity(intent); + overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); + + return null; + }); + } + + public void panicExitInvoked() { + dataController.getInstance().clearData(this); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalURLNavigationContoller.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalURLNavigationContoller.java index 17796412..fb50d5c0 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalURLNavigationContoller.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.externalNavigationManager; +package com.darkweb.genesissearchengine.appManager.externalCommandManager; import android.content.Intent; import android.net.Uri; @@ -8,14 +8,16 @@ import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.example.myapplication.R; + import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; -public class externalNavigationController extends AppCompatActivity { +public class externalURLNavigationContoller extends AppCompatActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Uri data = externalNavigationController.this.getIntent().getData(); + Uri data = externalURLNavigationContoller.this.getIntent().getData(); if(data == null || status.sSettingIsAppStarted){ /* Close Activity */ @@ -26,7 +28,7 @@ public class externalNavigationController extends AppCompatActivity { /* Create Request Handler */ if(status.sSettingIsAppStarted && data!=null){ - helperMethod.onDelayHandler(this, 3000, () -> { + helperMethod.onDelayHandler(this, 250, () -> { activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString())); activityContextManager.getInstance().getHomeController().onClearSelectionTab(); return null; @@ -36,6 +38,7 @@ public class externalNavigationController extends AppCompatActivity { Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class); bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(bringToForegroundIntent); + overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); } else if(status.sSettingIsAppRunning){ @@ -58,13 +61,11 @@ public class externalNavigationController extends AppCompatActivity { status.sExternalWebsite = data.toString(); } - this.startActivity(intent); - this.overridePendingTransition(0, 0); - /* Bring Application To Front */ Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); startActivity(launchIntent); + overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); /* Close Activity */ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalShortcuts.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalShortcuts.java deleted file mode 100644 index be006bf2..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalShortcuts.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.darkweb.genesissearchengine.appManager.externalNavigationManager; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.os.Handler; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.sql; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.databaseManager.databaseController; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; -import org.mozilla.geckoview.ContentBlocking; -import org.torproject.android.service.wrapper.orbotLocalConstants; -import java.util.Arrays; - -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; - -public class externalShortcuts extends AppCompatActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - status.sSettingIsAppStarted = false; - orbotLocalConstants.mIsTorInitialized = false; - boolean mConnect = false; - - if (getIntent() != null && getIntent().getStringExtra("shortcut") != null) { - String bundleString = getIntent().getStringExtra("shortcut"); - switch (bundleString) { - case "erase": - setContentView(R.layout.popup_data_cleared_shortcut); - panicExitInvoked(); - new Handler().postDelayed(this::finish, 3000); - return; - case "erase_and_open": - panicExitInvoked(); - mConnect = true; - break; - case "Restart": - break; - } - } - - setContentView(R.layout.empty_view); - - if(mConnect){ - new Handler().postDelayed(() -> activityContextManager.getInstance().getHomeController().onStartApplication(null), 2000); - } - - new Handler().postDelayed(() -> - { - /* Start Required Activity */ - - Intent intent = new Intent(this.getIntent()); - intent.setClassName(this.getApplicationContext(), homeController.class.getName()); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); - - this.startActivity(intent); - overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); - - }, 800); - } - - - @Override - protected void onNewIntent(Intent intent) - { - super.onNewIntent(intent); - Uri data = intent.getData(); - if(data!=null){ - activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString()); - Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.darkweb.genesissearchengine"); - startActivity(launchIntent); - overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); - } - } - - public void panicExitInvoked() { - status.sSettingIsAppStarted = false; - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE, strings.SETTING_DEFAULT_LANGUAGE)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, constants.CONST_BACKEND_GENESIS_URL)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); - - databaseController.getInstance().initialize(this); - databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null); - databaseController.getInstance().execSQL(sql.SQL_CLEAR_BOOKMARK,null); - databaseController.getInstance().execSQL(sql.SQL_CLEAR_TAB,null); - status.initStatus(activityContextManager.getInstance().getHomeController()); - - } -} \ No newline at end of file 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 00c58369..bbfd4c97 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,7 +22,7 @@ import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -63,9 +63,10 @@ public class helpController extends AppCompatActivity { @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } super.onConfigurationChanged(newConfig); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java index 664b1b16..d5380939 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java @@ -18,6 +18,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; 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 5417d530..77313025 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 @@ -24,19 +24,18 @@ import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.databaseManager.databaseController; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.sql; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -45,6 +44,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import static com.darkweb.genesissearchengine.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU; +import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_CLEAR_HISTORY; public class historyController extends AppCompatActivity @@ -88,9 +88,10 @@ public class historyController extends AppCompatActivity public void onConfigurationChanged(@NonNull Configuration newConfig) { pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); super.onConfigurationChanged(newConfig); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } @@ -360,7 +361,7 @@ public class historyController extends AppCompatActivity mHistoryModel.clearList(); mHistoryAdapter.invokeFilter(true ); mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLEAR_LIST, null); - databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null); + dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null)); } private void onLoadMoreHistory(boolean pLoadingEnabled) { @@ -431,7 +432,7 @@ public class historyController extends AppCompatActivity mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mHistoryModel.getList().size(),300)); } else if(e_type.equals(enums.etype.remove_from_database)){ - databaseController.getInstance().deleteFromList((int)data.get(0),strings.HISTORY_TITLE); + dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_DELETE_FROM_HISTORY, Arrays.asList(data.get(0),strings.HISTORY_TITLE)); } else if(e_type.equals(enums.etype.on_verify_selected_url_menu)){ mHistoryViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyModel.java index 6b32f15e..88c95aa6 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyModel.java @@ -1,5 +1,7 @@ package com.darkweb.genesissearchengine.appManager.historyManager; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; + import java.util.ArrayList; class historyModel diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/pageErrorHandler.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/errorHandler.java similarity index 79% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/pageErrorHandler.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/errorHandler.java index 9e90a9c5..405ef5f7 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/pageErrorHandler.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/errorHandler.java @@ -10,19 +10,16 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -public class pageErrorHandler +public class errorHandler { private AppCompatActivity mContext; private String mErrorTemplate; - public String loadErrorPage(final int category, final int error, AppCompatActivity mContext, String url, InputStream mResourceURL) { + public String createErrorPage(final int category, final int error,AppCompatActivity mContext,String url, InputStream mResourceURL) { this.mContext = mContext; - - try { - if (mErrorTemplate == null) { - StringBuilder builder = new StringBuilder(); - InputStream stream = mResourceURL; - BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); + if (mErrorTemplate == null) { + StringBuilder builder = new StringBuilder(); + try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { String line; while ((line = reader.readLine()) != null) { @@ -31,46 +28,23 @@ public class pageErrorHandler } mErrorTemplate = builder.toString(); + } catch (IOException e) { + return null; } - String title = helperMethod.getHost(url); + } + String title = helperMethod.getHost(url); - if(url==null){ - url = "Hidden Error"; - } - if(title==null){ - title = "Hidden Error"; - } - - String replaceUrl = errorToString(error).replace("$URL",url); - String errorPage = createErrorPage("CODE : " + categoryToString(category) + "
TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL); - errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category)); - return errorPage; - }catch (Exception ex){ - return strings.GENERIC_EMPTY_STR; + if(url==null){ + url = "Hidden Error"; + } + if(title==null){ + title = "Hidden Error"; } - } - - private String createErrorPage(final String error, String url, InputStream mResourceURL) throws IOException { - if(error==null){ - return strings.GENERIC_EMPTY_STR; - } - - StringBuilder builder = new StringBuilder(); - InputStream stream = mResourceURL; - BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); - - String line; - while ((line = reader.readLine()) != null) { - builder.append(line); - builder.append("\n"); - } - - mErrorTemplate = builder.toString(); - - String replaceUrl = mErrorTemplate.replace("$URL",url); - - return replaceUrl; + String replaceUrl = errorToString(error).replace("$URL",url); + String errorPage = createErrorPage("CODE : " + categoryToString(category) + "
TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL); + errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category)); + return errorPage; } private String translateMessage(String message,String error){ @@ -165,5 +139,29 @@ public class pageErrorHandler return "UNKNOWN"; } } + private String createErrorPage(final String error,String url, InputStream mResourceURL) { + if(error==null){ + return strings.GENERIC_EMPTY_STR; + } + + if (mErrorTemplate == null) { + StringBuilder builder = new StringBuilder(); + try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { + + String line; + while ((line = reader.readLine()) != null) { + builder.append(line); + builder.append("\n"); + } + + mErrorTemplate = builder.toString(); + } catch (IOException e) { + return null; + } + } + String replaceUrl = mErrorTemplate.replace("$URL",url); + + return replaceUrl; + } } 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 a68edae5..e088a4c7 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 @@ -34,11 +34,11 @@ import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.helperManager.internalFileDownloadManager; -import com.darkweb.genesissearchengine.helperManager.downloadFileService; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.trueTime; +import com.darkweb.genesissearchengine.libs.trueTime.trueTime; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; import org.json.JSONObject; import org.mozilla.gecko.util.ThreadUtils; @@ -58,6 +58,7 @@ import java.lang.ref.WeakReference; import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.Arrays; +import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Objects; @@ -201,7 +202,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele if(!url.equals("about:blank") && !url.equals("about:config")) { mProgress = 5; - event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update); + onProgressStart(); } m_current_url_id = -1; } @@ -290,8 +291,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele isPageLoading = true; if(!var2.equals("about:blank") && !mCurrentTitle.equals("loading")){ mProgress = 5; - event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update); - //mTheme = null; + mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update)); mThemeChanged = false; } } @@ -327,15 +327,20 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele if(!mFullScreen){ mProgress = progress; - if(progress==100){ - if(!mIsProgressBarChanging){ - mIsProgressBarChanging = true; - mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); - } - }else { + if(progress<=20) { mIsProgressBarChanging = false; - mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); + mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update)); + }else { + if(progress==100){ + if(!mIsProgressBarChanging){ + mIsProgressBarChanging = true; + mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); + } + }else { + mIsProgressBarChanging = false; + mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); + } } } @@ -344,6 +349,12 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele } } + public void onProgressStart(){ + if(!getCurrentURL().equals("about:blank") && !getCurrentURL().contains("genesishiddentechnologies.com") && !wasPreviousErrorPage() && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ + mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update)); + } + } + public void onRedrawPixel(){ event.invokeObserver(Arrays.asList("",mSessionID,mCurrentTitle, m_current_url_id, mTheme, false), dataEnums.eTabCommands.M_UPDATE_PIXEL); } @@ -491,9 +502,12 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele checkApplicationRate(); /* Its Absence causes delay on first launch*/ + + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + if(!mCurrentURL.contains("genesishiddentechnologies.com")){ mProgress = 5; - event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced); + onProgressStart(); } return GeckoResult.fromValue(AllowOrDeny.ALLOW); @@ -528,7 +542,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele public GeckoResult onLoadError(@NonNull GeckoSession var1, @Nullable String var2, WebRequestError var3) { if(status.sSettingIsAppStarted){ - pageErrorHandler handler = new pageErrorHandler(); + errorHandler handler = new errorHandler(); mProgress = 0; mPreviousErrorPage = true; event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error); @@ -545,7 +559,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele } - return GeckoResult.fromValue("data:text/html," + handler.loadErrorPage(var3.category, var3.code,mContext.get(),var2, mResourceURL)); + return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code,mContext.get(),var2, mResourceURL)); } return null; } @@ -718,7 +732,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele { if(mDownloadManager.getDownloadURL()!=null && mDownloadManager.getDownloadFile()!=null){ if(!createAndSaveFileFromBase64Url(mDownloadManager.getDownloadURL().toString())){ - mContext.get().startService(downloadFileService.getDownloadService(mContext.get().getApplicationContext(), mDownloadManager.getDownloadURL()+"__"+mDownloadManager.getDownloadFile(), Environment.DIRECTORY_DOWNLOADS)); + pluginController.getInstance().onDownloadInvoke(Arrays.asList(mDownloadManager.getDownloadURL()+"__"+mDownloadManager.getDownloadFile(), Environment.DIRECTORY_DOWNLOADS), pluginEnums.eDownloadManager.M_START_SERVICE); } } } @@ -727,7 +741,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele { if(downloadURL!=null && downloadFile!=null){ if(!createAndSaveFileFromBase64Url(downloadURL.toString())){ - mContext.get().startService(downloadFileService.getDownloadService(mContext.get().getApplicationContext(), downloadURL + "__" + downloadFile, Environment.DIRECTORY_DOWNLOADS)); + pluginController.getInstance().onDownloadInvoke(Arrays.asList(downloadURL + "__" + downloadFile, Environment.DIRECTORY_DOWNLOADS), pluginEnums.eDownloadManager.M_START_SERVICE); } } } @@ -775,7 +789,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele String filename; if(url.startsWith("blob")){ - loadUri(internalFileDownloadManager.getBase64StringFromBlobUrl(url)); + loadUri((String) pluginController.getInstance().onDownloadInvoke(Collections.singletonList(url), pluginEnums.eDownloadManager.M_DOWNLOAD_BLOB)); return true; } 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 1fc0ec6a..bcebc3b0 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 @@ -18,7 +18,7 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.strings; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java index 9eec3d2e..f689cd7e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintModel.java @@ -1,9 +1,5 @@ package com.darkweb.genesissearchengine.appManager.homeManager.hintManager; -import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; - -import java.util.ArrayList; - public class hintModel { /*Private Variables*/ 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 cc3246ae..25dbed0c 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 @@ -23,7 +23,6 @@ import android.speech.RecognizerIntent; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; -import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.view.Window; @@ -44,10 +43,8 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; -import com.darkweb.genesissearchengine.constants.sql; -import com.darkweb.genesissearchengine.databaseManager.databaseController; import com.darkweb.genesissearchengine.appManager.historyManager.historyController; -import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.*; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; @@ -57,8 +54,8 @@ import com.darkweb.genesissearchengine.appManager.languageManager.languageContro import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController; import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; -import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingHomeController; -import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; +import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeController; +import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.keys; @@ -66,16 +63,14 @@ import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.helperManager.KeyboardUtils; -import com.darkweb.genesissearchengine.helperManager.clearAllRecentServices; -import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter; +import com.darkweb.genesissearchengine.libs.views.KeyboardUtils; +import com.darkweb.genesissearchengine.appManager.activityStateManager; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; -import com.darkweb.genesissearchengine.helperManager.trueTime; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; +import com.darkweb.genesissearchengine.libs.trueTime.trueTime; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; -import com.darkweb.genesissearchengine.widget.progressBar.AnimatedProgressBar; import com.example.myapplication.R; import com.google.android.gms.ads.AdView; import org.mozilla.geckoview.ContentBlocking; @@ -105,6 +100,7 @@ import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE; import static com.darkweb.genesissearchengine.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB; import static com.darkweb.genesissearchengine.constants.enums.etype.open_new_tab; +import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; import static java.lang.Character.isLetter; @@ -116,7 +112,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba private homeViewController mHomeViewController; private homeModel mHomeModel; private geckoClients mGeckoClient = null; - private GestureDetector mSwipeDirectionDetector; /*View Webviews*/ private NestedGeckoView mGeckoView = null; @@ -124,7 +119,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba private ConstraintLayout mWebViewContainer; /*View Objects*/ - private AnimatedProgressBar mProgressBar; + private ProgressBar mProgressBar; private ConstraintLayout mSplashScreen; private editTextManager mSearchbar; private ImageView mLoadingIcon; @@ -191,7 +186,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().preInitialize(this); dataController.getInstance().initialize(this); status.initStatus(this); - databaseController.getInstance().initialize(this); + dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_INIT, Collections.singletonList(this)); trueTime.getInstance().initTime(); super.onCreate(savedInstanceState); @@ -462,16 +457,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); } - @Override - public boolean dispatchTouchEvent(MotionEvent event) { - if(inSignatureArea(event)){ - try{ - //mSwipeDirectionDetector.onTouchEvent(event); - }catch (Exception ignored){ } - } - return super.dispatchTouchEvent(event); - } - public boolean inSignatureArea(MotionEvent ev) { float mEventY = ev.getY(); return mEventY>mTopBar.getY()+mTopBar.getHeight() && mEventY(base); - Context mContext = theme.getInstance().initTheme(base); + Context mContext = activityThemeManager.getInstance().initTheme(base); activityContextManager.getInstance().setApplicationContext(mContext.getApplicationContext()); super.attachBaseContext(LocaleHelper.onAttach(mContext, Prefs.getDefaultLocale())); } @@ -761,7 +746,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba @SuppressLint("ClickableViewAccessibility") private void initializeLocalEventHandlers() { - startService(new Intent(getBaseContext(), clearAllRecentServices.class)); + startService(new Intent(getBaseContext(), activityStateManager.class)); registerReceiver(downloadStatus,new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); @@ -790,8 +775,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(mFindText.getText().length()==0 && mGeckoClient!=null){ mGeckoClient.getSession().getFinder().clear(); mHomeViewController.onUpdateFindBarCount(0,0); - }else { - assert mGeckoClient != null; + }else if(mGeckoClient!=null){ mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_MATCH_CASE & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); } @@ -950,22 +934,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } }); - mSwipeDirectionDetector=new GestureDetector(this,new SimpleGestureFilter(){ - - @Override - public boolean onSwipe(Direction direction) { - if(mSplashScreen.getAlpha()>=1 && mSplashScreen.getVisibility()==View.VISIBLE){ - if (direction==Direction.left){ - helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this, true); - } - else if (direction==Direction.right){ - helperMethod.openActivity(orbotController.class, constants.CONST_LIST_HISTORY, homeController.this, true); - } - } - return true; - } - }); - KeyboardUtils.addKeyboardToggleListener(this, isVisible -> isKeyboardOpened = isVisible); mNestedScroll.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { @@ -1385,12 +1353,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGeckoClient.onExitFullScreen(); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); - pluginController.getInstance().onNotificationInvoke(Collections.singletonList(1296000000) , pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION); + pluginController.getInstance().onNotificationInvoke(Collections.singletonList(172800000) , pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION); mSearchBarWasBackButtonPressed = false; if(status.sSettingIsAppStarted){ status.sUIInteracted = true; } mHomeViewController.onUpdateFindBar(false); + mHomeViewController.onClearSelections(isKeyboardOpened); + mTopBarContainer.getLayoutTransition().setDuration(0); } @Override @@ -1885,7 +1855,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); - databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null); + dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null)); dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); activityContextManager.getInstance().getHomeController().onClearCache(); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); @@ -2009,11 +1979,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba final Handler handler = new Handler(); Runnable runnable = () -> { if(!status.sUIInteracted){ - mHomeViewController.closeMenu(); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); - mSearchbar.clearFocus(); - pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_WELCOME); - status.sUIInteracted = true; + if(mHomeViewController!=null){ + mHomeViewController.closeMenu(); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); + mSearchbar.clearFocus(); + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_WELCOME); + status.sUIInteracted = true; + } } }; handler.postDelayed(runnable, 2500); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java index 9383c82f..aa6308e3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java @@ -40,6 +40,4 @@ class homeModel return mURL; } } - - } 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 1ef06a7c..03ddfd6c 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 @@ -41,10 +41,9 @@ import androidx.recyclerview.widget.RecyclerView; import com.darkweb.genesissearchengine.constants.*; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.helperManager.colorAnimationReciever; +import com.darkweb.genesissearchengine.libs.views.ColorAnimator; import com.darkweb.genesissearchengine.eventObserver; 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.google.android.material.appbar.AppBarLayout; @@ -69,7 +68,7 @@ class homeViewController /*ViewControllers*/ private com.google.android.material.appbar.AppBarLayout mAppBar; private ConstraintLayout mWebviewContainer; - private AnimatedProgressBar mProgressBar; + private ProgressBar mProgressBar; private editTextManager mSearchbar; private ConstraintLayout mSplashScreen; private TextView mLoadingText; @@ -117,7 +116,7 @@ class homeViewController private Runnable mTabDialogRunnable = null; private boolean mIsTopBarExpanded = true; - void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, AnimatedProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, View pPopupLoadNewTab, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo,ImageButton pPanicButtonLandscape){ + void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, View pPopupLoadNewTab, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo,ImageButton pPanicButtonLandscape){ this.mContext = context; this.mProgressBar = progressBar; this.mSearchbar = searchbar; @@ -211,6 +210,7 @@ class homeViewController mGenesisLogo.setLayoutParams(newLayoutParams); } }); + } @SuppressLint("WrongConstant") @@ -409,7 +409,9 @@ class homeViewController } catch (Exception ex) { ex.printStackTrace(); } - mVoiceInput.setVisibility(View.VISIBLE); + if(status.sSettingIsAppStarted){ + mVoiceInput.setVisibility(View.VISIBLE); + } mVoiceInput.setClickable(true); mVoiceInput.setFocusable(true); }, 0); @@ -489,7 +491,7 @@ class homeViewController public void initStatusBarColor(boolean mInstant) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - colorAnimationReciever oneToTwo = new colorAnimationReciever(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2)); + ColorAnimator oneToTwo = new ColorAnimator(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2)); int mDelay = 1350; if(status.mThemeApplying || mInstant){ @@ -931,19 +933,16 @@ class homeViewController if(!mSearchbar.hasFocus() || pClearText || pBypassFocus){ if(mSearchEngineBar.getVisibility() == View.GONE || pBypassFocus){ int delay = 0; - handlerLocalUrl = url; + handlerLocalUrl = url; if(searchBarUpdateHandler.hasMessages(100)){ - return; + searchBarUpdateHandler.removeMessages(100); } searchBarUpdateHandler.sendEmptyMessage(100); - searchBarUpdateHandler.postDelayed(() -> - { - searchBarUpdateHandler.removeMessages(100); - triggerUpdateSearchBar(handlerLocalUrl,showProtocol, pClearText); - mSearchbar.setTag(R.id.msearchbarProcessing,false); - }, delay); + searchBarUpdateHandler.removeMessages(100); + triggerUpdateSearchBar(handlerLocalUrl,showProtocol, pClearText); + mSearchbar.setTag(R.id.msearchbarProcessing,false); } } } @@ -1214,6 +1213,10 @@ class homeViewController } void onProgressBarUpdate(int value, boolean mForced){ + + if(progressAnimator!=null){ + progressAnimator.cancel(); + } if(mSearchbar.getText().toString().equals("genesis.onion") && !mForced || (boolean)mSearchbar.getTag(R.id.msearchbarProcessing)){ mProgressBar.setProgress(0); mProgressBar.setVisibility(View.GONE); @@ -1225,18 +1228,26 @@ class homeViewController if(value != mProgressBar.getProgress()){ if(value<=5 && value>0){ - mProgressBar.setProgress(5); + setProgressAnimate(5,70); }else { - mProgressBar.setProgress(value); + setProgressAnimate(value,200); } if(value >= 100 || value<=0){ - mProgressBar.animate().alpha(0).withEndAction(() -> mProgressBar.setProgress(0)); + mProgressBar.animate().alpha(0).setStartDelay(200).withEndAction(() -> mProgressBar.setProgress(0)); }else { mProgressBar.setAlpha(1); } } } + ObjectAnimator progressAnimator = null; + private void setProgressAnimate(int pValue, int pSpeed) + { + progressAnimator = ObjectAnimator.ofInt(mProgressBar, "progress", pValue); + progressAnimator.setDuration(pSpeed); + progressAnimator.start(); + } + public void onNewTabAnimation(List data, Object e_type){ mGeckoView.setPivotX(0); mGeckoView.setPivotY(0); 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 78431d89..c16b44e2 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 @@ -21,7 +21,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -66,9 +66,10 @@ public class languageController extends AppCompatActivity { public void onConfigurationChanged(@NonNull Configuration newConfig) { pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); super.onConfigurationChanged(newConfig); + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java index 1ee10d90..aa8d0ab1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java @@ -71,7 +71,7 @@ public class orbotLogAdapter extends RecyclerView.Adapter { if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { if(!orbotLogStatus.sUIInteracted && ((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1)){ if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ + mNestedScrollView.stopNestedScroll(); onScrollBottom(); + mNestedScrollView.stopNestedScroll(); + orbotLogStatus.sScrollPosition = -1; } }else { + mNestedScrollView.stopNestedScroll(); mNestedScrollView.scrollTo(0,0); + mNestedScrollView.smoothScrollTo(0,0); + mNestedScrollView.stopNestedScroll(); + orbotLogStatus.sScrollPosition = 0; } - orbotLogStatus.sScrollPosition = -1; } return null; @@ -104,7 +112,6 @@ public class orbotLogController extends AppCompatActivity { super.onConfigurationChanged(newConfig); } - private void initializeViews() { mLogRecycleView = findViewById(R.id.pLogRecycleView); mLogs = findViewById(R.id.pLogs); @@ -126,7 +133,7 @@ public class orbotLogController extends AppCompatActivity { layoutManager.setReverseLayout(true); mLogRecycleView.setAdapter(adapter); - Objects.requireNonNull(mLogRecycleView.getItemAnimator()).setAddDuration(250); + Objects.requireNonNull(mLogRecycleView.getItemAnimator()).setAddDuration(350); mLogRecycleView.setNestedScrollingEnabled(false); mLogRecycleView.setLayoutManager(new LinearLayoutManager(orbotLogController.this)); @@ -151,38 +158,36 @@ public class orbotLogController extends AppCompatActivity { @SuppressLint("NewApi") @SuppressWarnings("deprecation") @Override public void onGlobalLayout() { - if(orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sUIInteracted){ + + if(orbotLogStatus.sOrientation==-1){ + orbotLogStatus.sOrientation = getResources().getConfiguration().orientation; + } + + if(orbotLogStatus.sOrientation != getResources().getConfiguration().orientation && orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sScrollPosition!=0){ + mNestedScrollView.stopNestedScroll(); + orbotLogStatus.sScrollPosition = 0; mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition); - }else if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ - onScrollBottom(); + orbotLogStatus.sOrientation = getResources().getConfiguration().orientation; + }else { + if(orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sUIInteracted){ + mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition); + }else if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ + onScrollBottom(); + } } if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { - mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> orbotLogStatus.sScrollPosition = scrollY); + mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { + orbotLogStatus.sScrollPosition = scrollY; + }); } + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + orbotLogStatus.sOrientation = getResources().getConfiguration().orientation; } }); - mNestedScrollView.setOnTouchListener((v, event) -> { - if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ - orbotLogStatus.sUIInteracted = true; - } - - if(event.getAction() == MotionEvent.ACTION_UP){ - mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); - } - - if(event.getAction() == MotionEvent.ACTION_UP){ - mIsRecycleviewInteracting = false; - }else if(event.getAction() == MotionEvent.ACTION_DOWN){ - mIsRecycleviewInteracting = true; - } - - return false; - }); - mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { @@ -193,21 +198,50 @@ public class orbotLogController extends AppCompatActivity { } }); - mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> { - if (mNestedScrollView.getScrollY() == 0) - { - mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); - } - else if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) { - mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + mLogRecycleView.setOnTouchListener((v, event) -> onTouch(event)); + mNestedScrollView.setOnTouchListener((v, event) -> onTouch(event)); + + mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) { + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + } + } + }); + + mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> { + + if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) { + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); if(!mIsRecycleviewInteracting){ orbotLogStatus.sUIInteracted = false; } } + if(mNestedScrollView.getScrollY() == 0){ + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + } }); } + public boolean onTouch(MotionEvent event){ + if(event.getAction() == MotionEvent.ACTION_UP){ + mIsRecycleviewInteracting = false; + + if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ + orbotLogStatus.sUIInteracted = true; + } + }else if(event.getAction() == MotionEvent.ACTION_DOWN){ + mIsRecycleviewInteracting = true; + } + + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + + return false; + } + private void logToString(){ if((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1){ for(int mCounter=0;mCounter<(int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);mCounter++){ @@ -243,6 +277,7 @@ public class orbotLogController extends AppCompatActivity { if(!orbotLogStatus.sUIInteracted){ helperMethod.onDelayHandler(orbotLogController.this, 150, () -> { + Log.i("SUPFUCK4", orbotLogStatus.sUIInteracted + ""); if(!orbotLogStatus.sUIInteracted){ onScrollBottomAnimated(null); } @@ -271,6 +306,7 @@ public class orbotLogController extends AppCompatActivity { public void onScrollBottomAnimated(View view) { mNestedScrollView.fullScroll(View.FOCUS_DOWN); orbotLogStatus.sUIInteracted = false; + Log.i("SUPFUCK5", orbotLogStatus.sUIInteracted + ""); if(view!=null){ mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java index e1565b7a..0071cef8 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogStatus.java @@ -4,5 +4,5 @@ public class orbotLogStatus { public static boolean sUIInteracted = false; public static int sScrollPosition = -1; - + public static int sOrientation = -1; } 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 577c6469..83861260 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 @@ -3,7 +3,6 @@ package com.darkweb.genesissearchengine.appManager.orbotManager; import android.content.res.Configuration; import android.os.Bundle; import android.util.Log; -import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.widget.LinearLayout; @@ -18,10 +17,9 @@ import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; -import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -39,7 +37,6 @@ public class orbotController extends AppCompatActivity { private SwitchMaterial mBridgeSwitch; private SwitchMaterial mVpnSwitch; private LinearLayout mCustomizableBridgeMenu; - private GestureDetector mSwipeDirectionDetector; /* INITIALIZATIONS */ @@ -65,7 +62,7 @@ public class orbotController extends AppCompatActivity { if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } super.onConfigurationChanged(newConfig); @@ -88,16 +85,6 @@ public class orbotController extends AppCompatActivity { /* LISTENERS */ private void onInitListener(){ - mSwipeDirectionDetector=new GestureDetector(this,new SimpleGestureFilter(){ - - @Override - public boolean onSwipe(Direction direction) { - if (direction==Direction.left){ - onClose(null); - } - return true; - } - }); } public class orbotModelCallback implements eventObserver.eventListener{ @@ -162,16 +149,6 @@ public class orbotController extends AppCompatActivity { onClose(null); } - @Override - public boolean dispatchTouchEvent(MotionEvent event) { - if(inSignatureArea(event)){ - try{ - mSwipeDirectionDetector.onTouchEvent(event); - }catch (Exception ignored){ } - } - return super.dispatchTouchEvent(event); - } - public boolean inSignatureArea(MotionEvent ev) { float mEventY = ev.getY(); float mEventX = ev.getX(); 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 f34a2142..6264b1ff 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,7 +14,7 @@ import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -52,7 +52,7 @@ public class proxyStatusController extends AppCompatActivity { super.onConfigurationChanged(newConfig); if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } 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 db408a43..e41ff6f1 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 @@ -18,7 +18,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -63,7 +63,7 @@ public class settingAccessibilityController extends AppCompatActivity { super.onConfigurationChanged(newConfig); if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } 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 6577e5c5..4f6c1606 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,7 +16,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -58,7 +58,7 @@ public class settingAdvanceController extends AppCompatActivity { super.onConfigurationChanged(newConfig); if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } 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 34531699..bfc8453c 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 @@ -11,19 +11,17 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.databaseManager.databaseController; import com.darkweb.genesissearchengine.appManager.helpManager.helpController; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.sql; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -34,6 +32,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; + +import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_BOOKMARK; +import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_DATA_CLEARED; import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; @@ -60,7 +61,7 @@ public class settingClearController extends AppCompatActivity { super.onConfigurationChanged(newConfig); if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } @@ -113,13 +114,13 @@ public class settingClearController extends AppCompatActivity { if(mCheckBoxList.get(1).isChecked()){ mCheckBoxList.get(1).setChecked(false); mCheckBoxList.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); - databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null); + dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null)); dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); } if(mCheckBoxList.get(2).isChecked()){ mCheckBoxList.get(2).setChecked(false); mCheckBoxList.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); - databaseController.getInstance().execSQL(sql.SQL_CLEAR_BOOKMARK,null); + dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_BOOKMARK,null)); dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,null); } if(mCheckBoxList.get(3).isChecked()){ 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 59c83518..8442a1ba 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 @@ -19,7 +19,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -66,7 +66,7 @@ public class settingGeneralController extends AppCompatActivity { if(!mIsThemeChanging){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } 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 3db27616..bc240850 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 @@ -14,7 +14,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -55,7 +55,7 @@ public class settingLogController extends AppCompatActivity { if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } 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 740c24d1..14d7899d 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,7 +15,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -48,7 +48,7 @@ public class settingNotificationController extends AppCompatActivity { super.onConfigurationChanged(newConfig); if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } 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 5c10670e..a7a5d126 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,7 +17,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -55,7 +55,7 @@ public class settingPrivacyController extends AppCompatActivity { super.onConfigurationChanged(newConfig); if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } 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 ab202af3..bf59f71c 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,7 +16,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -50,7 +50,7 @@ public class settingSearchController extends AppCompatActivity { super.onConfigurationChanged(newConfig); if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } 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/settingHomeManager/settingHomeController.java similarity index 97% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeController.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java index b906539b..dd2b4e0d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage; +package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; import android.content.Intent; import android.content.res.Configuration; @@ -27,7 +27,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -69,9 +69,8 @@ public class settingHomeController extends AppCompatActivity @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + if(activityThemeManager.getInstance().onInitTheme(this)){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); } super.onConfigurationChanged(newConfig); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeEnums.java similarity index 90% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeEnums.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeEnums.java index 7f66888f..faaf6c2e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeEnums.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage; +package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; public class settingHomeEnums { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeModel.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeModel.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeModel.java index e31acbb4..0932178b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeModel.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage; +package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; import com.darkweb.genesissearchengine.eventObserver; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeViewController.java similarity index 98% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeViewController.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeViewController.java index 106506e9..19ab64b7 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomePage/settingHomeViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeViewController.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage; +package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; import android.os.Build; import android.view.View; 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 7f8e36b1..69ca768d 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,7 +16,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.darkweb.genesissearchengine.helperManager.theme; +import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -50,7 +50,7 @@ public class settingTrackingController extends AppCompatActivity { super.onConfigurationChanged(newConfig); if(newConfig.uiMode != getResources().getConfiguration().uiMode){ activityContextManager.getInstance().onResetTheme(); - theme.getInstance().onConfigurationChanged(this); + activityThemeManager.getInstance().onConfigurationChanged(this); } } 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 d0d3e320..9706f016 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 @@ -24,7 +24,8 @@ import androidx.recyclerview.widget.RecyclerView; import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.TopCropImageView; +import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; +import com.darkweb.genesissearchengine.libs.views.ThumbnailCrop; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; @@ -288,7 +289,7 @@ public class tabAdapter extends RecyclerView.Adapter TextView mDate; ImageView mLoadSession; ImageButton mRemoveRow; - TopCropImageView mWebThumbnail; + ThumbnailCrop mWebThumbnail; FrameLayout mSelectedView; FrameLayout mItemSelectionMenu; Button mItemSelectionMenuButton; 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 5fdd731f..be883c53 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 @@ -32,6 +32,7 @@ import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java index 8d649635..0224b4a8 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java @@ -2,10 +2,10 @@ package com.darkweb.genesissearchengine.appManager.tabManager; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; class tabModel diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java index 5d0060e3..c3f0de37 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java @@ -10,11 +10,12 @@ public class constants public static final String CONST_SOFTWARE_URL = "https://genesishiddentechnologies.com/search?q=softwares+tools&p_num=1&s_type=all&p_num=1&s_type=all"; public static final String CONST_SOFTWARE_FINANCE = "https://genesishiddentechnologies.com/search?q=finance&p_num=1&s_type=all&p_num=1&s_type=all"; public static final String CONST_COMMUNITIES = "https://genesishiddentechnologies.com/search?q=news&p_num=1&s_type=all&p_num=1&s_type=all"; - public static final String CONST_PLAYSTORE_URL = "http://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine"; + public static final String CONST_PLAYSTORE_URL = "http://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine.production"; public static final String CONST_PRIVACY_POLICY_URL = "https://genesishiddentechnologies.com/privacy"; public static final String CONST_REPORT_URL = "https://genesishiddentechnologies.com/reportus?url="; public static final String CONST_SITEMAP = "https://genesishiddentechnologies.com/create"; - public static final String CONST_PACKAGE_NAME = "com.darkweb.genesissearchengine.dev"; + public static final String CONST_PACKAGE_NAME = "com.darkweb.genesissearchengine.production"; + public static final String CONST_WIDGET_NAME = "com.darkweb.genesissearchengine.widget"; /*DRIVE URL DEV*/ @@ -47,7 +48,7 @@ public class constants public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com?q=$s&ia=web"; public static final String CONST_BACKEND_BING_URL = "https://bing.com/search?q=$s"; public static final String CONST_BACKEND_WIKI_URL = "https://en.wikipedia.org/wiki/$s"; - public static final String CONST_LOG_DUCKDUCK = "https://duckduckgo.com/?q=tor "; + public static final String CONST_LOG_DUCKDUCK = "https://duckduckgo.com/?q=tor"; /*PROXY CONSTANTS*/ 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 f5e3a1c5..61dd78da 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -41,4 +41,9 @@ public class enums public static final int VERTICAL = 1; } + public static class WidgetCommands { + public static final String OPEN_APPLICATION = "mOpenApplication"; + public static final String OPEN_VOICE = "mOpenVoice"; + } + } \ No newline at end of file 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 f2c55962..386f8855 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bookmarkDataModel.java @@ -1,24 +1,33 @@ package com.darkweb.genesissearchengine.dataManager; -import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel; -import com.darkweb.genesissearchengine.databaseManager.databaseController; +import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.eventObserver; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class bookmarkDataModel { + /* Local Variables */ + + private eventObserver.eventListener mExternalEvents; private ArrayList mBookmarks; - public bookmarkDataModel(){ + /* Initializations */ + + public bookmarkDataModel(eventObserver.eventListener pExternalEvents){ mBookmarks = new ArrayList<>(); + mExternalEvents = pExternalEvents; } void initializebookmark(ArrayList pBookmark){ mBookmarks = pBookmark; } + /* Helper Methods */ + private ArrayList getBookmark() { return mBookmarks; } @@ -32,7 +41,7 @@ public class bookmarkDataModel { int autoval = 0; if(mBookmarks.size()> constants.CONST_MAX_BOOKMARK_SIZE) { - databaseController.getInstance().execSQL("delete from bookmark where id="+ mBookmarks.get(mBookmarks.size()-1).getID(),null); + mExternalEvents.invokeObserver(Arrays.asList("delete from bookmark where id="+ mBookmarks.get(mBookmarks.size()-1).getID(),null), dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL); } if(mBookmarks.size()>0) @@ -50,7 +59,7 @@ public class bookmarkDataModel { params[1] = pURL; if(!pTitle.equals("loading")){ - databaseController.getInstance().execSQL("REPLACE INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params); + mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params), dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL); } mBookmarks.add(0,new bookmarkRowModel(pTitle, pURL,autoval)); } @@ -65,9 +74,12 @@ public class bookmarkDataModel { mBookmarks.remove(mCounter); } } - databaseController.getInstance().execSQL("delete from bookmark where id="+ pID,null); + + mExternalEvents.invokeObserver(Arrays.asList("delete from bookmark where id="+ pID,null), dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL); } + /* External Triggers */ + public Object onTrigger(dataEnums.eBookmarkCommands p_commands, List pData){ if(p_commands == dataEnums.eBookmarkCommands.M_GET_BOOKMARK){ return getBookmark(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bridgesDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bridgesDataModel.java index 943f9cba..5d55728e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bridgesDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/bridgesDataModel.java @@ -9,24 +9,25 @@ import com.android.volley.toolbox.Volley; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; - import java.util.Arrays; import java.util.List; - -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_BRIDGE_WEBSITES; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_BRIDGE_WEBSITES_DEV; -import static com.darkweb.genesissearchengine.constants.constants.CONST_SERVER; -import static com.darkweb.genesissearchengine.constants.constants.CONST_SERVER_DEV; +import static com.darkweb.genesissearchengine.constants.constants.*; public class bridgesDataModel { - private String mBridges = "null"; + /* Local Variables */ + + private String mBridges; private boolean mLoading = false; + /* Initializations */ + public bridgesDataModel(){ mBridges = status.sBridgesDefault; } + /* Helper Methods */ + private void onLoad(Context pContext){ if(!mLoading){ mLoading = true; @@ -66,6 +67,8 @@ public class bridgesDataModel { return strings.GENERIC_EMPTY_SPACE; } + /* External Triggers */ + public Object onTrigger(dataEnums.eBridgeWebsiteCommands p_commands, List pData){ if(p_commands == dataEnums.eBridgeWebsiteCommands.M_LOAD){ onLoad((Context) pData.get(0)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java index 6deaa79f..f42ab4e8 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java @@ -2,14 +2,24 @@ package com.darkweb.genesissearchengine.dataManager; import androidx.appcompat.app.AppCompatActivity; import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.databaseManager.databaseController; +import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; +import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import org.mozilla.geckoview.ContentBlocking; + +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import static com.darkweb.genesissearchengine.constants.sql.*; import static com.darkweb.genesissearchengine.constants.status.mThemeApplying; +import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; public class dataController { @@ -24,6 +34,7 @@ public class dataController private helpDataModel mHelpDataModel; private referenceWebsiteDataModel mReferenceWebsiteDataModel; private bridgesDataModel mBridgeWebsiteDataModel; + private sqlCipherDataModel mSqlCipherDataModel; /*Private Declarations*/ @@ -36,36 +47,44 @@ public class dataController /*Initializations*/ public void initialize(AppCompatActivity pAppContext){ - mHistoryModel = new historyDataModel(); - mTabModel = new tabDataModel(); + mHistoryModel = new historyDataModel(new invokeHistoryCallbacks()); + mTabModel = new tabDataModel(new invokeTabCallbacks()); mPreferenceModel = new preferenceDataModel(pAppContext); mImageDataModel = new imageDataModel(); - mBookmarkDataModel = new bookmarkDataModel(); + mBookmarkDataModel = new bookmarkDataModel(new invokeBookmarkCallbacks()); mSuggestionDataModel = new suggestionDataModel(pAppContext); mHelpDataModel = new helpDataModel(); mReferenceWebsiteDataModel = new referenceWebsiteDataModel(); mBridgeWebsiteDataModel = new bridgesDataModel(); + mSqlCipherDataModel = new sqlCipherDataModel(); } public void initializeListData(){ mReferenceWebsiteDataModel.onTrigger(dataEnums.eReferenceWebsiteCommands.M_LOAD,Collections.singletonList(activityContextManager.getInstance().getHomeController())); mBridgeWebsiteDataModel.onTrigger(dataEnums.eBridgeWebsiteCommands.M_LOAD,Collections.singletonList(activityContextManager.getInstance().getHomeController())); - mBookmarkDataModel.initializebookmark(databaseController.getInstance().selectBookmark()); + + ArrayList mBookmarks = (ArrayList)invokeSQLCipher(dataEnums.eSqlCipherCommands.M_SELECT_BOOKMARK, null); + mBookmarkDataModel.initializebookmark(mBookmarks); if(!status.sClearOnExit) { - mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY, Arrays.asList(databaseController.getInstance().selectHistory(0,constants.CONST_FETCHABLE_LIST_SIZE), databaseController.getInstance().getLargestHistoryID(),databaseController.getInstance().getLargestHistoryID())); + ArrayList mHistory = (ArrayList)invokeSQLCipher(dataEnums.eSqlCipherCommands.M_SELECT_HISTORY, Arrays.asList(0,constants.CONST_FETCHABLE_LIST_SIZE)); + int mHistoryID = (int)invokeSQLCipher(dataEnums.eSqlCipherCommands.M_HISTORY_ID, null); + + mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY, Arrays.asList(mHistory, mHistoryID, mHistoryID)); } else { - databaseController.getInstance().execSQL("delete from history where 1",null); + invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList("delete from history where 1",null)); } if(status.sRestoreTabs || mThemeApplying){ - mTabModel.initializeTab(databaseController.getInstance().selectTabs()); + ArrayList mTabs = (ArrayList)invokeSQLCipher(dataEnums.eSqlCipherCommands.M_SELECT_TABS, null); + mTabModel.initializeTab(mTabs); activityContextManager.getInstance().getHomeController().initTabCountForced(); }else{ invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); } } - /*Recieving History*/ + /*Trigger History*/ + public Object invokeHistory(dataEnums.eHistoryCommands pCommands, List pData){ if(pCommands == dataEnums.eHistoryCommands.M_ADD_HISTORY){ @@ -74,21 +93,40 @@ public class dataController if(pCommands.equals(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY)){ int m_history_size = (int) mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_HISTORY_SIZE,null) - 1; - return mHistoryModel.onTrigger(pCommands, Collections.singletonList(databaseController.getInstance().selectHistory(m_history_size+1,constants.CONST_FETCHABLE_LIST_SIZE))); + + ArrayList mHistory = (ArrayList)invokeSQLCipher(dataEnums.eSqlCipherCommands.M_SELECT_HISTORY, Arrays.asList(m_history_size+1,constants.CONST_FETCHABLE_LIST_SIZE)); + return mHistoryModel.onTrigger(pCommands, mHistory); }else { return mHistoryModel.onTrigger(pCommands, pData); } } + private class invokeHistoryCallbacks implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + if(e_type.equals(dataEnums.eHistoryCallbackCommands.M_EXEC_SQL)){ + invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, data); + } + return null; + } + } + + /*Trigger Suggestions*/ + public Object invokeSuggestions(dataEnums.eSuggestionCommands pCommands, List pData){ return mSuggestionDataModel.onTrigger(pCommands, Arrays.asList(pData.get(0), mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_GET_HISTORY, null), mBookmarkDataModel.onTrigger(dataEnums.eBookmarkCommands.M_GET_BOOKMARK, null))); } + /*Trigger Reference Websites*/ + public Object invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands pCommands, List pData){ return mReferenceWebsiteDataModel.onTrigger(pCommands, null); } - /*Recieving Preferences*/ + /*Trigger Preferences*/ + public Object invokePrefs(dataEnums.ePreferencesCommands pCommands, List pData){ if(mPreferenceModel==null){ return null; @@ -96,22 +134,106 @@ public class dataController return mPreferenceModel.onTrigger(pCommands, pData); } - /*Recieving Help*/ + /*Trigger Help*/ + public Object invokeHelp(dataEnums.eHelpCommands pCommands, List pData){ return mHelpDataModel.onTrigger(pCommands, pData); } - /*Recieving History*/ + /*Trigger Bookmarks*/ + public Object invokeBookmark(dataEnums.eBookmarkCommands pCommands, List pData){ return mBookmarkDataModel.onTrigger(pCommands, pData); } + private class invokeBookmarkCallbacks implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + if(e_type.equals(dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL)){ + invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, data); + } + return null; + } + } + + /*Trigger Tabs*/ + public Object invokeTab(dataEnums.eTabCommands pCommands, List pData){ return mTabModel.onTrigger(pCommands, pData); } + private class invokeTabCallbacks implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List data, Object e_type) + { + if(e_type.equals(dataEnums.eTabCallbackCommands.M_EXEC_SQL)){ + invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, data); + } + return null; + } + } + + /*Trigger Image Cache*/ + public Object invokeImage(dataEnums.eImageCommands pCommands, List pData){ return mImageDataModel.onTrigger(pCommands, pData); } + + /*Trigger SQL Cipher Database*/ + + public Object invokeSQLCipher(dataEnums.eSqlCipherCommands pCommands, List pData){ + return mSqlCipherDataModel.onTrigger(pCommands, pData); + } + + /*Helper Methods*/ + + public void clearData(AppCompatActivity mContext){ + dataController.getInstance().initialize(mContext); + status.sSettingIsAppStarted = false; + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE, strings.SETTING_DEFAULT_LANGUAGE)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, constants.CONST_BACKEND_GENESIS_URL)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); + + invokeSQLCipher(dataEnums.eSqlCipherCommands.M_INIT, Collections.singletonList(mContext)); + invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null)); + invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_BOOKMARK,null)); + invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_TAB,null)); + + status.initStatus(mContext); + } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java index 6c8b629b..0b06fee6 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java @@ -2,11 +2,16 @@ package com.darkweb.genesissearchengine.dataManager; public class dataEnums { - /*Settings Manager*/ + /* Triggers */ + public enum eHistoryCommands { M_GET_HISTORY, M_ADD_HISTORY, M_REMOVE_HISTORY, M_CLEAR_HISTORY,M_LOAD_MORE_HISTORY ,M_INITIALIZE_HISTORY, M_HISTORY_SIZE } + public enum eSqlCipherCommands { + M_INIT, M_EXEC_SQL, M_SELECT_BOOKMARK, M_SELECT_HISTORY, M_SELECT_TABS, M_HISTORY_ID, M_DELETE_FROM_HISTORY + } + public enum eBookmarkCommands { M_ADD_BOOKMARK, M_GET_BOOKMARK, M_DELETE_BOOKMARK, M_CLEAR_BOOKMARK; } @@ -39,4 +44,17 @@ public class dataEnums M_GET_HELP, M_SET_HELP } + /* Callbacks */ + + public enum eHistoryCallbackCommands { + M_EXEC_SQL + } + + public enum eTabCallbackCommands { + M_EXEC_SQL + } + + public enum eBookmarkCallbackCommands { + M_EXEC_SQL + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/helpDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/helpDataModel.java index d11adacd..caa85560 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/helpDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/helpDataModel.java @@ -7,12 +7,18 @@ import java.util.List; @SuppressLint("CommitPrefEdits") class helpDataModel { + /* Local Variables */ + private ArrayList mHelpListModel; + /* Initializations */ + helpDataModel(){ mHelpListModel = new ArrayList<>(); } + /* Helper Methods */ + ArrayList getHelpModel(){ return mHelpListModel; } @@ -22,10 +28,8 @@ class helpDataModel mHelpListModel.addAll(pHelpListModel); } - /*List Tabs*/ + /* External Triggers */ - - /*List Suggestion*/ public Object onTrigger(dataEnums.eHelpCommands pCommands, List pData){ if(pCommands.equals(dataEnums.eHelpCommands.M_GET_HELP)){ return getHelpModel(); 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 04fe2dae..60fc2af4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/historyDataModel.java @@ -1,12 +1,13 @@ package com.darkweb.genesissearchengine.dataManager; -import com.darkweb.genesissearchengine.databaseManager.databaseController; -import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.HashMap; import java.util.List; @@ -15,16 +16,24 @@ import java.util.Map; public class historyDataModel { + /* Local Variables */ + + private eventObserver.eventListener mExternalEvents; + private int mMaxHistoryId = 0; private int mHistorySize = 0; private ArrayList mHistory; private Map mHistoryCache; - public historyDataModel(){ + public historyDataModel(eventObserver.eventListener pExternalEvents){ mHistory = new ArrayList<>(); mHistoryCache = new HashMap<>(); + + mExternalEvents = pExternalEvents; } + /* Initializations */ + void initializeHistory(ArrayList history, int pMaxHistoryId, int pHistorySize){ mMaxHistoryId = pMaxHistoryId; mHistorySize = pHistorySize; @@ -44,6 +53,8 @@ public class historyDataModel { } } + /* Helper Methods */ + private ArrayList getHistory() { return mHistory; } @@ -68,7 +79,7 @@ public class historyDataModel { cal.setTime(mHistory.get(m_count).getDate()); if (dayOfYear == cal.get(Calendar.DAY_OF_YEAR)) { - databaseController.getInstance().execSQL("DELETE FROM history WHERE id = " + mHistory.get(m_count).getID(), null); + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id = " + mHistory.get(m_count).getID(), null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); mHistoryCache.remove(mHistory.get(m_count).getID()); mHistory.remove(m_count); m_count = m_count-1; @@ -97,12 +108,12 @@ public class historyDataModel { params[0] = pUrl; params[1] = pHeader; String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); - databaseController.getInstance().execSQL("UPDATE history SET date = '" + m_date + "' , url = ? , title = ? WHERE id="+pID,params); + mExternalEvents.invokeObserver(Arrays.asList("UPDATE history SET date = '" + m_date + "' , url = ? , title = ? WHERE id="+pID,params), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); return pID; }else { if(mHistorySize > constants.CONST_MAX_LIST_DATA_SIZE) { - databaseController.getInstance().execSQL("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.CONST_MAX_LIST_DATA_SIZE /2)+")",null); + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.CONST_MAX_LIST_DATA_SIZE /2)+")",null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); } if(pHeader.equals("loading")){ @@ -119,7 +130,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("REPLACE INTO history(id,date,url,title) VALUES("+ mMaxHistoryId +",'" + m_date + "',?,?);",params); + mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO history(id,date,url,title) VALUES("+ mMaxHistoryId +",'" + m_date + "',?,?);",params), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); } mHistory.add(0,new historyRowModel(pHeader,pUrl, mMaxHistoryId)); @@ -129,13 +140,12 @@ public class historyDataModel { } } private void removeHistory(int pID){ - databaseController.getInstance().execSQL("DELETE FROM history WHERE id = "+pID,null); - databaseController.getInstance().selectHistory(0,constants.CONST_FETCHABLE_LIST_SIZE); + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id = "+pID,null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); mHistoryCache.remove(pID); mHistorySize -= 1; } private void clearHistory(){ - databaseController.getInstance().execSQL("DELETE FROM history WHERE 1 ",null); + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE 1 ",null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL); mHistory.clear(); mHistoryCache.clear(); } @@ -148,6 +158,8 @@ public class historyDataModel { return pHistory.size() > 0; } + /* External Triggers */ + public Object onTrigger(dataEnums.eHistoryCommands pCommands, List pData){ if(pCommands == dataEnums.eHistoryCommands.M_GET_HISTORY){ return getHistory(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java index fb6ae06c..7f05493e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/imageDataModel.java @@ -4,7 +4,7 @@ import android.annotation.SuppressLint; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.dataManager.models.imageManagerModel; +import com.darkweb.genesissearchengine.dataManager.models.imageRowModel; import com.darkweb.genesissearchengine.helperManager.helperMethod; import java.io.IOException; import java.io.InputStream; @@ -15,17 +15,22 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.darkweb.genesissearchengine.constants.constants.CONST_PROXY_SOCKS; -import static com.darkweb.genesissearchengine.constants.enums.ImageQueueStatus.M_IMAGE_LOADED_SUCCESSFULLY; -import static com.darkweb.genesissearchengine.constants.enums.ImageQueueStatus.M_IMAGE_LOADING_FAILED; + +import static com.darkweb.genesissearchengine.constants.constants.*; +import static com.darkweb.genesissearchengine.constants.enums.ImageQueueStatus.*; @SuppressLint("CommitPrefEdits") class imageDataModel { - private Map mImageCache; + + /* Local Variables */ + + private Map mImageCache; private Map mParsedQueues; private ArrayList mRequestQueue; + /* Initializations */ + public imageDataModel(){ mImageCache = new HashMap<>(); mParsedQueues = new HashMap<>(); @@ -34,6 +39,7 @@ class imageDataModel mBackgroundThread(); } + /* Helper Methods */ private void onRequestImage(String mURL){ String mCraftedURL = helperMethod.completeURL(helperMethod.getDomainName(mURL))+"/favicon.ico"; @@ -61,10 +67,10 @@ class imageDataModel mParsedQueues.put(mRequestQueue.get(0), enums.ImageQueueStatus.M_IMAGE_LOADING); Bitmap mBitmap = getBitmapFromURL(mRequestQueue.get(0)); if(mBitmap==null){ - mParsedQueues.put(mRequestQueue.get(0), enums.ImageQueueStatus.M_IMAGE_LOADING_FAILED); + mParsedQueues.put(mRequestQueue.get(0), M_IMAGE_LOADING_FAILED); }else { mParsedQueues.put(mRequestQueue.get(0), M_IMAGE_LOADED_SUCCESSFULLY); - mImageCache.put(mRequestQueue.get(0), new imageManagerModel(helperMethod.createRandomID(), "",mRequestQueue.get(0),mBitmap)); + mImageCache.put(mRequestQueue.get(0), new imageRowModel(helperMethod.createRandomID(), "",mRequestQueue.get(0),mBitmap)); } mRequestQueue.remove(0); } @@ -93,7 +99,8 @@ class imageDataModel } } - /*List Suggestion*/ + /* External Triggers */ + public Object onTrigger(dataEnums.eImageCommands pCommands, List pData){ if(pCommands.equals(dataEnums.eImageCommands.M_REQUEST_IMAGE_URL)){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/bookmarkRowModel.java old mode 100755 new mode 100644 similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkRowModel.java rename to app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/bookmarkRowModel.java index bd945b77..0aacd020 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/bookmarkRowModel.java @@ -1,61 +1,61 @@ -package com.darkweb.genesissearchengine.appManager.bookmarkManager; - -import android.widget.ImageView; -import java.util.Calendar; -import java.util.Date; - -public class bookmarkRowModel -{ - /*Private Variables*/ - - private int m_id; - private String m_header; - private String m_description; - private Date m_date; - private ImageView m_logo; - - /*Initializations*/ - - public bookmarkRowModel(String p_header, String p_description,int p_id) { - this.m_id = p_id; - this.m_header = p_header; - this.m_description = p_description; - m_date = Calendar.getInstance().getTime(); - } - - /*Variable Setters*/ - - public void setHeader(String p_header){ - this.m_header = p_header; - } - public void setURL(String p_url){ - this.m_description = p_url; - } - public void setLogo(ImageView p_logo){ - this.m_logo = p_logo; - } - public void setDate(Date p_date) { - m_date = p_date; - } - - /*Variable Getters*/ - - public String getHeader() { - return m_header; - } - public String getDescription() { - if(m_description!=null && m_description.equals("genesishiddentechnologies.com")){ - return "genesis.onion"; - } - return m_description; - } - public int getID() { - return m_id; - } - public ImageView getLogo() { - return m_logo; - } - public Date getDate() { - return m_date; - } -} +package com.darkweb.genesissearchengine.dataManager.models; + +import android.widget.ImageView; +import java.util.Calendar; +import java.util.Date; + +public class bookmarkRowModel +{ + /*Private Variables*/ + + private int m_id; + private String m_header; + private String m_description; + private Date m_date; + private ImageView m_logo; + + /*Initializations*/ + + public bookmarkRowModel(String p_header, String p_description,int p_id) { + this.m_id = p_id; + this.m_header = p_header; + this.m_description = p_description; + m_date = Calendar.getInstance().getTime(); + } + + /*Variable Setters*/ + + public void setHeader(String p_header){ + this.m_header = p_header; + } + public void setURL(String p_url){ + this.m_description = p_url; + } + public void setLogo(ImageView p_logo){ + this.m_logo = p_logo; + } + public void setDate(Date p_date) { + m_date = p_date; + } + + /*Variable Getters*/ + + public String getHeader() { + return m_header; + } + public String getDescription() { + if(m_description!=null && m_description.equals("genesishiddentechnologies.com")){ + return "genesis.onion"; + } + return m_description; + } + public int getID() { + return m_id; + } + public ImageView getLogo() { + return m_logo; + } + public Date getDate() { + return m_date; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/historyRowModel.java old mode 100755 new mode 100644 similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyRowModel.java rename to app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/historyRowModel.java index 7642e748..21ff4213 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/historyRowModel.java @@ -1,65 +1,64 @@ -package com.darkweb.genesissearchengine.appManager.historyManager; - -import android.os.Handler; -import android.widget.ImageView; -import java.util.Calendar; -import java.util.Date; - -public class historyRowModel -{ - /*Private Variables*/ - - private int mID; - private String mHeader; - private String mDescription; - private Date mDate; - private ImageView mLogo; - - /*Initializations*/ - - public historyRowModel(String pHeader, String pDescription,int pID) { - this.mID = pID; - this.mHeader = pHeader; - this.mDescription = pDescription; - mDate = Calendar.getInstance().getTime(); - } - - /*Variable Setters*/ - - public void setHeader(String pHeader){ - this.mHeader = pHeader; - } - public void setURL(String pURL){ - this.mDescription = pURL; - } - public void setLogo(ImageView pLogo){ - this.mLogo = pLogo; - } - public void setDate(Date pDate) { - mDate = pDate; - } - - /*Variable Getters*/ - - public String getHeader() { - return mHeader; - } - public String getDescription() { - if(mDescription!=null && mDescription.equals("genesishiddentechnologies.com")){ - return "genesis.onion"; - } - return mDescription; - } - public String getDescriptionParsed() { - return mDescription.substring(8); - } - public int getID() { - return mID; - } - public ImageView getLogo() { - return mLogo; - } - public Date getDate() { - return mDate; - } -} +package com.darkweb.genesissearchengine.dataManager.models; + +import android.widget.ImageView; +import java.util.Calendar; +import java.util.Date; + +public class historyRowModel +{ + /*Private Variables*/ + + private int mID; + private String mHeader; + private String mDescription; + private Date mDate; + private ImageView mLogo; + + /*Initializations*/ + + public historyRowModel(String pHeader, String pDescription,int pID) { + this.mID = pID; + this.mHeader = pHeader; + this.mDescription = pDescription; + mDate = Calendar.getInstance().getTime(); + } + + /*Variable Setters*/ + + public void setHeader(String pHeader){ + this.mHeader = pHeader; + } + public void setURL(String pURL){ + this.mDescription = pURL; + } + public void setLogo(ImageView pLogo){ + this.mLogo = pLogo; + } + public void setDate(Date pDate) { + mDate = pDate; + } + + /*Variable Getters*/ + + public String getHeader() { + return mHeader; + } + public String getDescription() { + if(mDescription!=null && mDescription.equals("genesishiddentechnologies.com")){ + return "genesis.onion"; + } + return mDescription; + } + public String getDescriptionParsed() { + return mDescription.substring(8); + } + public int getID() { + return mID; + } + public ImageView getLogo() { + return mLogo; + } + public Date getDate() { + return mDate; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageManagerModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageRowModel.java similarity index 75% rename from app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageManagerModel.java rename to app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageRowModel.java index a804557a..6c0e8dab 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageManagerModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/imageRowModel.java @@ -1,9 +1,8 @@ package com.darkweb.genesissearchengine.dataManager.models; import android.graphics.Bitmap; -import java.util.Date; -public class imageManagerModel +public class imageRowModel { /*Private Variables*/ @@ -13,7 +12,7 @@ public class imageManagerModel private Bitmap mImage; /*Initializations*/ - public imageManagerModel(String pID, String pCreationDate, String pURL, Bitmap pImage){ + public imageRowModel(String pID, String pCreationDate, String pURL, Bitmap pImage){ mID = pID; mCreationDate = pCreationDate; mURL = pURL; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java old mode 100755 new mode 100644 similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java rename to app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java index 6ebbb080..3e8a3232 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/models/tabRowModel.java @@ -1,79 +1,79 @@ -package com.darkweb.genesissearchengine.appManager.tabManager; - -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; - -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperManager.helperMethod; - -import org.mozilla.geckoview.GeckoSession; - -public class tabRowModel -{ - /*Private Variables*/ - - private geckoSession mSession; - private String mId; - private Bitmap mBitmap = null; - private String mDate; - - /*Initializations*/ - - public tabRowModel(geckoSession mSession) { - this.mSession = mSession; - this.mId = mSession.getSessionID(); - this.mDate = helperMethod.getCurrentDate(); - } - - public tabRowModel(String pID, String pDate, byte[] pBlob) { - this.mId = pID; - this.mDate = pDate; - if(pBlob!=null){ - mBitmap = BitmapFactory.decodeByteArray(pBlob,0,pBlob.length); - } - } - - /*Helper Method*/ - - public geckoSession getSession() - { - return mSession; - } - - public void setSession(geckoSession pSession, String pURL, String pTitle, String pTheme, GeckoSession.SessionState pSessionState) - { - mSession = pSession; - mSession.setTitle(pTitle); - mSession.setURL(pURL); - mSession.setTheme(pTheme); - - if(pSessionState != null){ - mSession.mSessionState = pSessionState; - mSession.restoreState(pSessionState); - } - - if(!status.sSettingIsAppStarted){ - if(pTitle.equals("$TITLE") || pTitle.startsWith("http://loading") || pTitle.startsWith("loading") || pURL.equals("$TITLE") || pURL.startsWith("http://loading") || pURL.startsWith("loading")){ - mSession.setTitle("about:blank"); - mSession.setURL("about:blank"); - } - } - } - - public String getmId() { - return mId; - } - - public void setmBitmap(Bitmap pBitmap) { - mBitmap = null; - mBitmap = pBitmap; - } - public Bitmap getBitmap() { - return mBitmap; - } - - public String getDate(){ - return mDate; - } -} +package com.darkweb.genesissearchengine.dataManager.models; + +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; + +import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + +import org.mozilla.geckoview.GeckoSession; + +public class tabRowModel +{ + /*Private Variables*/ + + private geckoSession mSession; + private String mId; + private Bitmap mBitmap = null; + private String mDate; + + /*Initializations*/ + + public tabRowModel(geckoSession mSession) { + this.mSession = mSession; + this.mId = mSession.getSessionID(); + this.mDate = helperMethod.getCurrentDate(); + } + + public tabRowModel(String pID, String pDate, byte[] pBlob) { + this.mId = pID; + this.mDate = pDate; + if(pBlob!=null){ + mBitmap = BitmapFactory.decodeByteArray(pBlob,0,pBlob.length); + } + } + + /*Helper Method*/ + + public geckoSession getSession() + { + return mSession; + } + + public void setSession(geckoSession pSession, String pURL, String pTitle, String pTheme, GeckoSession.SessionState pSessionState) + { + mSession = pSession; + mSession.setTitle(pTitle); + mSession.setURL(pURL); + mSession.setTheme(pTheme); + + if(pSessionState != null){ + mSession.mSessionState = pSessionState; + mSession.restoreState(pSessionState); + } + + if(!status.sSettingIsAppStarted){ + if(pTitle.equals("$TITLE") || pTitle.startsWith("http://loading") || pTitle.startsWith("loading") || pURL.equals("$TITLE") || pURL.startsWith("http://loading") || pURL.startsWith("loading")){ + mSession.setTitle("about:blank"); + mSession.setURL("about:blank"); + } + } + } + + public String getmId() { + return mId; + } + + public void setmBitmap(Bitmap pBitmap) { + mBitmap = null; + mBitmap = pBitmap; + } + public Bitmap getBitmap() { + return mBitmap; + } + + public String getDate(){ + return mDate; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java index 1b8315b1..97157554 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preferenceDataModel.java @@ -1,22 +1,29 @@ package com.darkweb.genesissearchengine.dataManager; +import android.annotation.SuppressLint; import android.content.SharedPreferences; import android.preference.PreferenceManager; - import androidx.appcompat.app.AppCompatActivity; import java.util.List; public class preferenceDataModel { + /* Local Variables */ + private SharedPreferences mPrefs; private SharedPreferences.Editor mEdit; + /* Initializations */ + + @SuppressLint("CommitPrefEdits") public preferenceDataModel(AppCompatActivity pAppContext){ mPrefs = PreferenceManager.getDefaultSharedPreferences(pAppContext); mEdit = mPrefs.edit(); } + /* Helper Methods */ + void clearPrefs(){ mEdit.clear(); mEdit.apply(); @@ -51,6 +58,8 @@ public class preferenceDataModel { return mPrefs.getInt(pValueKey, pValueDefault); } + /* External Triggers */ + public Object onTrigger(dataEnums.ePreferencesCommands pCommands, List pData){ if(pCommands == dataEnums.ePreferencesCommands.M_GET_BOOL){ return getBool((String)pData.get(0), (boolean)pData.get(1)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java index 364e8320..06e69827 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/referenceWebsiteDataModel.java @@ -8,23 +8,25 @@ import com.android.volley.toolbox.Volley; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; - import java.util.Arrays; import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_REFERENCE_WEBSITES; -import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_REFERENCE_WEBSITES_DEV; -import static com.darkweb.genesissearchengine.constants.constants.CONST_SERVER; -import static com.darkweb.genesissearchengine.constants.constants.CONST_SERVER_DEV; +import static com.darkweb.genesissearchengine.constants.constants.*; public class referenceWebsiteDataModel { - private String mReferenceWebsiteData = "null"; + /* Local Variables */ + + private String mReferenceWebsiteData; private boolean mLoading = false; + /* Initializations */ + public referenceWebsiteDataModel(){ mReferenceWebsiteData = status.sReferenceWebsites; } + /* Helper Methods */ + private void onLoad(Context pContext){ if(!mLoading){ mLoading = true; @@ -64,6 +66,8 @@ public class referenceWebsiteDataModel { return strings.GENERIC_EMPTY_SPACE; } + /* External Triggers */ + public Object onTrigger(dataEnums.eReferenceWebsiteCommands p_commands, List pData){ if(p_commands == dataEnums.eReferenceWebsiteCommands.M_LOAD){ onLoad((Context) pData.get(0)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java similarity index 74% rename from app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java rename to app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java index d1aed0c9..b863be0e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java @@ -1,13 +1,12 @@ -package com.darkweb.genesissearchengine.databaseManager; +package com.darkweb.genesissearchengine.dataManager; -import android.content.ContentValues; import android.database.Cursor; import androidx.appcompat.app.AppCompatActivity; import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel; -import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; +import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; +import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; import com.darkweb.genesissearchengine.constants.constants; import net.sqlcipher.database.SQLiteDatabaseHook; import net.sqlcipher.database.SQLiteDatabase; @@ -17,28 +16,23 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; +import java.util.List; import java.util.Locale; import java.util.Objects; import static com.darkweb.genesissearchengine.constants.constants.CONST_DATABASE_NAME; -public class databaseController +public class sqlCipherDataModel { /*Private Variables*/ - private static final databaseController sOurInstance = new databaseController(); private static SQLiteDatabase sDatabaseInstance; - public static databaseController getInstance() - { - return sOurInstance; - } - /*Initializations*/ - public void prepareDatabaseEnvironment(AppCompatActivity app_context) { + private void prepareDatabaseEnvironment(AppCompatActivity app_context) { File databaseFile = app_context.getDatabasePath(CONST_DATABASE_NAME + "_SECURE"); if (!databaseFile.exists()) { @@ -46,7 +40,7 @@ public class databaseController } } - public void initialize(AppCompatActivity app_context) + private void initialize(AppCompatActivity app_context) { try { @@ -68,7 +62,7 @@ public class databaseController /*Helper Methods*/ - public SQLiteDatabaseHook wrapHook(final SQLiteDatabaseHook hook) { + private SQLiteDatabaseHook wrapHook(final SQLiteDatabaseHook hook) { if (hook == null) { return keyHook; @@ -100,7 +94,7 @@ public class databaseController } }; - public void execSQL(String query,String[] params) + private void execSQL(String query,String[] params) { if(params==null) { @@ -112,15 +106,7 @@ public class databaseController } } - public void execTab(String query, ContentValues params,String pID) - { - if(params!=null) - { - sDatabaseInstance.update(query, params, "mid = ?", new String[]{pID}); - } - } - - public ArrayList selectHistory(int pStartIndex,int pEndIndex){ + private ArrayList selectHistory(int pStartIndex,int pEndIndex){ ArrayList tempmodel = new ArrayList<>(); Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM history ORDER BY date DESC LIMIT " + pEndIndex + " OFFSET "+pStartIndex, null); @@ -145,7 +131,7 @@ public class databaseController return tempmodel; } - public ArrayList selectTabs(){ + private ArrayList selectTabs(){ ArrayList mTempListModel = new ArrayList<>(); Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM tab ORDER BY date ASC", null); @@ -175,7 +161,7 @@ public class databaseController return mTempListModel; } - public int getLargestHistoryID(){ + private int getLargestHistoryID(){ int id = 0; Cursor c = sDatabaseInstance.rawQuery("SELECT max(id) FROM history", null); @@ -193,7 +179,7 @@ public class databaseController return id; } - public ArrayList selectBookmark(){ + private ArrayList selectBookmark(){ ArrayList tempmodel = new ArrayList<>(); Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM bookmark ORDER BY id DESC ", null); @@ -207,8 +193,36 @@ public class databaseController return tempmodel; } - public void deleteFromList(int index,String table) { - databaseController.getInstance().execSQL("delete from "+table+" where id="+index,null); + private void deleteFromList(int index,String table) { + execSQL("delete from "+table+" where id="+index,null); + } + + /* External Triggers */ + + public Object onTrigger(dataEnums.eSqlCipherCommands pCommands, List pData){ + if(pCommands == dataEnums.eSqlCipherCommands.M_INIT){ + initialize((AppCompatActivity)pData.get(0)); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_EXEC_SQL){ + execSQL((String)pData.get(0), (String[])pData.get(1)); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_BOOKMARK){ + return selectBookmark(); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_HISTORY){ + return selectHistory((int)pData.get(0), (int)pData.get(1)); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_TABS){ + return selectTabs(); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_HISTORY_ID){ + return getLargestHistoryID(); + } + else if(pCommands == dataEnums.eSqlCipherCommands.M_DELETE_FROM_HISTORY){ + deleteFromList((int)pData.get(0), (String)pData.get(1)); + } + + return null; } } 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 efc40f3e..57b92986 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java @@ -4,15 +4,13 @@ import android.content.Context; import android.view.textservice.SentenceSuggestionsInfo; import android.view.textservice.SpellCheckerSession; import android.view.textservice.SuggestionsInfo; -import android.view.textservice.TextServicesManager; -import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel; -import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; + +import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel; +import com.darkweb.genesissearchengine.dataManager.models.historyRowModel; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import org.mozilla.gecko.util.StringUtils; - import java.util.ArrayList; import java.util.List; @@ -20,8 +18,6 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess /*Private Variables*/ - private SpellCheckerSession mSpellCheckerSession; - private TextServicesManager mTextServicesManager; private ArrayList mHintListLocalCache; private ArrayList mCurrentList = new ArrayList<>(); @@ -29,16 +25,12 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess /*Initializations*/ public suggestionDataModel(Context mContext){ - mTextServicesManager = (TextServicesManager) mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE); - mSpellCheckerSession = mTextServicesManager.newSpellCheckerSession(null, null, this, true); mHintListLocalCache = initSuggestions(); } /*Helper Methods*/ - - - private ArrayList getDefaultSuggestionsOnStart(String pQuery, int mSize, ArrayList mDuplicationHandler, boolean pDefaultHostChaned){ + private ArrayList getDefaultSuggestionsOnStart(String pQuery){ if(pQuery.equals(strings.GENERIC_EMPTY_STR) || pQuery.trim().isEmpty()) { pQuery = "hidden web"; @@ -123,7 +115,6 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess } mCurrentList = new ArrayList<>(); - mCurrentList.clear(); String mQueryOriginal = pQuery; pQuery = pQuery.replace("+","%").replace(" ","+"); ArrayList mHistory = pHistory; @@ -354,7 +345,7 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess } else if(pCommands == dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION) { - return getDefaultSuggestionsOnStart((String) pData.get(0),0, null, false); + return getDefaultSuggestionsOnStart((String) pData.get(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 bb818db2..78f50018 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java @@ -4,28 +4,20 @@ import android.annotation.SuppressLint; import android.content.ContentValues; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.os.Handler; -import android.os.Message; import android.util.Log; import android.widget.ImageView; -import androidx.annotation.NonNull; import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.databaseManager.databaseController; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; -import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; +import com.darkweb.genesissearchengine.dataManager.models.tabRowModel; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.helperManager.helperMethod; - +import com.darkweb.genesissearchengine.eventObserver; import org.mozilla.geckoview.GeckoResult; -import org.mozilla.geckoview.GeckoSession; -import org.mozilla.geckoview.GeckoView; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.sql.PreparedStatement; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.List; import java.util.Locale; @@ -33,17 +25,28 @@ import java.util.Locale; @SuppressLint("CommitPrefEdits") class tabDataModel { - private ArrayList mTabs = new ArrayList<>(); - ArrayList getTab(){ - return mTabs; + + /* Local Variables */ + + private eventObserver.eventListener mExternalEvents; + + /* Initializations */ + + public tabDataModel(eventObserver.eventListener pExternalEvents){ + mExternalEvents = pExternalEvents; } - /*List Tabs*/ - + private ArrayList mTabs = new ArrayList<>(); void initializeTab(ArrayList pTabMdel){ mTabs.addAll(pTabMdel); } + /* Helper Methods */ + + ArrayList getTab(){ + return mTabs; + } + geckoSession getHomePage(){ if(mTabs.size()>0){ return mTabs.get(0).getSession(); @@ -76,7 +79,7 @@ class tabDataModel return enums.AddTabCallback.TAB_ADDED; } - databaseController.getInstance().execSQL("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabModel.getmId() +"','" + m_date + "',?,?,?);",params); + mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabModel.getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); } return enums.AddTabCallback.TAB_ADDED; } @@ -95,7 +98,7 @@ class tabDataModel mTabs.remove(0); } - databaseController.getInstance().execSQL("DELETE FROM tab WHERE 1",null); + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM tab WHERE 1",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); } @@ -115,7 +118,8 @@ class tabDataModel break; } } - databaseController.getInstance().execSQL("DELETE FROM tab WHERE mid='" + mID + "'",null); + + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM tab WHERE mid='" + mID + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); }else { for(int counter = 0; counter< mTabs.size(); counter++){ if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID())) @@ -126,7 +130,7 @@ class tabDataModel break; } } - databaseController.getInstance().execSQL("DELETE FROM tab WHERE mid='" + pID + "'",null); + mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM tab WHERE mid='" + pID + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); } } @@ -137,7 +141,8 @@ class tabDataModel 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); + + mExternalEvents.invokeObserver(Arrays.asList("UPDATE tab SET date = '" + m_date + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); mTabs.add(0,mTabs.remove(counter)); break; } @@ -154,7 +159,7 @@ class tabDataModel if(mTabs.get(counter).getSession().getSessionID().equals(mSessionID)) { - databaseController.getInstance().execSQL("UPDATE tab SET session = '" + mSessionState + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null); + mExternalEvents.invokeObserver(Arrays.asList("UPDATE tab SET session = '" + mSessionState + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL); mTabs.add(0,mTabs.remove(counter)); break; } @@ -184,7 +189,7 @@ class tabDataModel return false; } - databaseController.getInstance().execSQL("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabs.get(counter).getmId() +"','" + m_date + "',?,?,?);",params); + mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabs.get(counter).getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); return true; } } @@ -220,39 +225,8 @@ class tabDataModel } } - @SuppressLint("HandlerLeak") - static Handler handler = new Handler() - { - @Override - public void dispatchMessage(@NonNull Message msg) { - super.dispatchMessage(msg); - } - - @NonNull - @Override - public String getMessageName(@NonNull Message message) { - return super.getMessageName(message); - } - - @Override - public boolean sendMessageAtTime(@NonNull Message msg, long uptimeMillis) { - return super.sendMessageAtTime(msg, uptimeMillis); - } - - @Override - public String toString() { - return super.toString(); - } - - @Override - public void handleMessage(Message msg) - { - Log.i("FUCK","FUCK"); - } - }; - // int isLoading = 0; - public void updatePixels(String pSessionID, GeckoResult pBitmapManager, ImageView pImageView, GeckoView pGeckoView, boolean pOpenTabView){ + public void updatePixels(String pSessionID, GeckoResult pBitmapManager, ImageView pImageView, boolean pOpenTabView){ new Thread(){ public void run(){ @@ -260,7 +234,6 @@ class tabDataModel for(int counter = 0; counter< mTabs.size(); counter++) { int finalCounter = counter; if (mTabs.get(counter).getSession().getSessionID().equals(pSessionID)) { - GeckoResult mResult = pBitmapManager.withHandler(handler); Bitmap mBitmap = pBitmapManager.poll(0); ByteArrayOutputStream out = new ByteArrayOutputStream(); @@ -274,15 +247,13 @@ class tabDataModel mTabs.get(finalCounter).setmBitmap(decoded); if(pImageView!=null){ - activityContextManager.getInstance().getHomeController().runOnUiThread(() -> { - pImageView.setImageBitmap(mBitmap); - }); + activityContextManager.getInstance().getHomeController().runOnUiThread(() -> pImageView.setImageBitmap(mBitmap)); } byte[] mThumbnail = out.toByteArray(); ContentValues mContentValues = new ContentValues(); mContentValues.put("mThumbnail", mThumbnail); - databaseController.getInstance().execTab("tab",mContentValues, mTabs.get(finalCounter).getmId()); + mExternalEvents.invokeObserver(Arrays.asList("tab",mContentValues, mTabs.get(finalCounter).getmId()), dataEnums.eTabCallbackCommands.M_EXEC_SQL); } } } @@ -360,7 +331,7 @@ class tabDataModel return getSuggestions((String) pData.get(0)); } else if(pCommands == dataEnums.eTabCommands.M_UPDATE_PIXEL){ - updatePixels((String)pData.get(0), (GeckoResult)pData.get(1), (ImageView) pData.get(2), (GeckoView) pData.get(3), (Boolean) pData.get(4)); + updatePixels((String)pData.get(0), (GeckoResult)pData.get(1), (ImageView) pData.get(2), (Boolean) pData.get(4)); } else if(pCommands == dataEnums.eTabCommands.M_HOME_PAGE){ return getHomePage(); @@ -368,5 +339,4 @@ class tabDataModel return null; } - } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/ProxySelector.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/ProxySelector.java deleted file mode 100644 index 0ebfafb6..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/ProxySelector.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.darkweb.genesissearchengine.helperManager; - -import android.text.TextUtils; - -import androidx.annotation.Nullable; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.URI; -import java.net.URLConnection; -import java.util.List; - -public class ProxySelector { - - public static URLConnection openConnectionWithProxy(final URI uri) throws IOException { - - return uri.toURL().openConnection(ProxySettings.getProxy()); - } - - public ProxySelector() { - } - - public Proxy select(String scheme, String host) { - int port = -1; - Proxy proxy = null; - String nonProxyHostsKey = null; - boolean httpProxyOkay = true; - if ("http".equalsIgnoreCase(scheme)) { - port = 80; - nonProxyHostsKey = "http.nonProxyHosts"; - proxy = lookupProxy("http.proxyHost", "http.proxyPort", Proxy.Type.HTTP, port); - } else if ("https".equalsIgnoreCase(scheme)) { - port = 443; - nonProxyHostsKey = "https.nonProxyHosts"; // RI doesn't support this - proxy = lookupProxy("https.proxyHost", "https.proxyPort", Proxy.Type.HTTP, port); - } else if ("ftp".equalsIgnoreCase(scheme)) { - port = 80; // not 21 as you might guess - nonProxyHostsKey = "ftp.nonProxyHosts"; - proxy = lookupProxy("ftp.proxyHost", "ftp.proxyPort", Proxy.Type.HTTP, port); - } else if ("socket".equalsIgnoreCase(scheme)) { - httpProxyOkay = false; - } else { - return Proxy.NO_PROXY; - } - - if (nonProxyHostsKey != null - && isNonProxyHost(host, System.getProperty(nonProxyHostsKey))) { - return Proxy.NO_PROXY; - } - - if (proxy != null) { - return proxy; - } - - if (httpProxyOkay) { - proxy = lookupProxy("proxyHost", "proxyPort", Proxy.Type.HTTP, port); - if (proxy != null) { - return proxy; - } - } - - proxy = lookupProxy("socksProxyHost", "socksProxyPort", Proxy.Type.SOCKS, 1080); - if (proxy != null) { - return proxy; - } - - return Proxy.NO_PROXY; - } - - /** - * Returns the proxy identified by the {@code hostKey} system property, or - * null. - */ - @Nullable - private Proxy lookupProxy(String hostKey, String portKey, Proxy.Type type, int defaultPort) { - final String host = System.getProperty(hostKey); - if (TextUtils.isEmpty(host)) { - return null; - } - - final int port = getSystemPropertyInt(portKey, defaultPort); - if (port == -1) { - // Port can be -1. See bug 1270529. - return null; - } - - return new Proxy(type, InetSocketAddress.createUnresolved(host, port)); - } - - private int getSystemPropertyInt(String key, int defaultValue) { - String string = System.getProperty(key); - if (string != null) { - try { - return Integer.parseInt(string); - } catch (NumberFormatException ignored) { - } - } - return defaultValue; - } - - /** - * Returns true if the {@code nonProxyHosts} system property pattern exists - * and matches {@code host}. - */ - private boolean isNonProxyHost(String host, String nonProxyHosts) { - if (host == null || nonProxyHosts == null) { - return false; - } - - // construct pattern - StringBuilder patternBuilder = new StringBuilder(); - for (int i = 0; i < nonProxyHosts.length(); i++) { - char c = nonProxyHosts.charAt(i); - switch (c) { - case '.': - patternBuilder.append("\\."); - break; - case '*': - patternBuilder.append(".*"); - break; - default: - patternBuilder.append(c); - } - } - // check whether the host is the nonProxyHosts. - String pattern = patternBuilder.toString(); - return host.matches(pattern); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/ProxySettings.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/ProxySettings.java deleted file mode 100644 index abbfdee7..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/ProxySettings.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.darkweb.genesissearchengine.helperManager; - -import java.net.InetSocketAddress; -import java.net.Proxy; - -import ch.boye.httpclientandroidlib.HttpHost; - -public class ProxySettings { - private static final String TOR_PROXY_ADDRESS = "127.0.0.1"; - private static final int TOR_PROXY_PORT = 8118; - - public static Proxy getProxy() { - // TODO make configurable - return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(TOR_PROXY_ADDRESS, TOR_PROXY_PORT)); - } - - public static HttpHost getProxyHost() { - // TODO make configurable - return new HttpHost(TOR_PROXY_ADDRESS, TOR_PROXY_PORT); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/SimpleGestureFilter.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/SimpleGestureFilter.java deleted file mode 100644 index 4b73520f..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/SimpleGestureFilter.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.darkweb.genesissearchengine.helperManager; - -import android.view.GestureDetector.SimpleOnGestureListener; -import android.view.MotionEvent; - -public class SimpleGestureFilter extends SimpleOnGestureListener{ - - @Override - public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { - - float x1 = e1.getX(); - float y1 = e1.getY(); - - float x2 = e2.getX(); - float y2 = e2.getY(); - - Direction direction = getDirection(x1,y1,x2,y2); - return onSwipe(direction); - } - - public boolean onSwipe(Direction direction){ - return false; - } - - /** - * Given two points in the plane p1=(x1, x2) and p2=(y1, y1), this method - * returns the direction that an arrow pointing from p1 to p2 would have. - * @param x1 the x position of the first point - * @param y1 the y position of the first point - * @param x2 the x position of the second point - * @param y2 the y position of the second point - * @return the direction - */ - public Direction getDirection(float x1, float y1, float x2, float y2){ - double angle = getAngle(x1, y1, x2, y2); - return Direction.get(angle); - } - - /** - * - * Finds the angle between two points in the plane (x1,y1) and (x2, y2) - * The angle is measured with 0/360 being the X-axis to the right, angles - * increase counter clockwise. - * - * @param x1 the x position of the first point - * @param y1 the y position of the first point - * @param x2 the x position of the second point - * @param y2 the y position of the second point - * @return the angle between two points - */ - public double getAngle(float x1, float y1, float x2, float y2) { - - double rad = Math.atan2(y1-y2,x2-x1) + Math.PI; - return (rad*180/Math.PI + 180)%360; - } - - - public enum Direction{ - up, - down, - left, - right; - - /** - * Returns a direction given an angle. - * Directions are defined as follows: - * - * Up: [45, 135] - * Right: [0,45] and [315, 360] - * Down: [225, 315] - * Left: [135, 225] - * - * @param angle an angle from 0 to 360 - e - * @return the direction of an angle - */ - public static Direction get(double angle){ - if(inRange(angle, 45, 135)){ - return Direction.up; - } - else if(inRange(angle, 0,45) || inRange(angle, 315, 360)){ - return Direction.right; - } - else if(inRange(angle, 225, 315)){ - return Direction.down; - } - else{ - return Direction.left; - } - - } - - /** - * @param angle an angle - * @param init the initial bound - * @param end the final bound - * @return returns true if the given angle is in the interval [init, end). - */ - private static boolean inRange(double angle, float init, float end){ - return (angle >= init) && (angle < end); - } - } -} \ No newline at end of file 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 88e777b1..8ea3aaf3 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java @@ -700,7 +700,7 @@ public class helperMethod if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){ try { - Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.provider.dev", url); + Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", url); Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url.toString())); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); @@ -711,7 +711,7 @@ public class helperMethod } } else{ try { - Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.provider.dev", url); + Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", url); Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url.toString())); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/userEngagementNotification.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/userEngagementNotification.java deleted file mode 100644 index 4fe222dd..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/userEngagementNotification.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.darkweb.genesissearchengine.helperManager; - -import android.app.Notification ; -import android.app.NotificationChannel ; -import android.app.NotificationManager ; -import android.app.PendingIntent; -import android.content.BroadcastReceiver ; -import android.content.Context ; -import android.content.Intent ; -import android.content.pm.PackageManager; -import android.graphics.Color; -import android.os.Build; -import androidx.core.app.NotificationCompat; - -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.example.myapplication.R; - -import java.util.Random; - -public class userEngagementNotification extends BroadcastReceiver { - - - public void onReceive (Context context , Intent intent) { - final int NOTIFY_ID = status.mNotificationID; - String pTitle = strings.NOTIFICATION_TITLE; - String pBody = strings.NOTIFICATION_BODY[new Random().nextInt(strings.NOTIFICATION_BODY.length)]; - - // There are hardcoding only for show it's just strings - String name = "NOTIFICATION:INDENTIFIER:1001"; - String id = "NOTIFICATION:INDENTIFIER:1001"; // The user-visible name of the channel. - String description = "NOTIFICATION:INDENTIFIER:1001"; // The user-visible description of the channel. - - - NotificationCompat.Builder builder; - NotificationManager mNotifManager = (NotificationManager)context.getSystemService(Context. NOTIFICATION_SERVICE ) ; - - if (mNotifManager == null) { - mNotifManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); - } - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - int importance = NotificationManager.IMPORTANCE_HIGH; - NotificationChannel mChannel = mNotifManager.getNotificationChannel(id); - if (mChannel == null) { - mChannel = new NotificationChannel(id, name, importance); - mChannel.setDescription(description); - mChannel.enableVibration(true); - mChannel.setLightColor(Color.GREEN); - mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); - mNotifManager.createNotificationChannel(mChannel); - } - builder = new NotificationCompat.Builder(context, id); - - PackageManager pm = context.getPackageManager(); - Intent mIntent = activityContextManager.getInstance().getHomeController().getIntent(); - PendingIntent pendIntent = PendingIntent.getActivity(activityContextManager.getInstance().getCurrentActivity(), 0, mIntent, PendingIntent.FLAG_ONE_SHOT); - - builder.setContentTitle(pTitle) // required - .setSmallIcon(R.drawable.notification_logo) // required - .setContentText(pBody) // required - .setDefaults(Notification.DEFAULT_ALL) - .setAutoCancel(true) - .setCategory(Notification.CATEGORY_SERVICE) - .setContentIntent(pendIntent) - .setTicker(pTitle) - .setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); - } else { - - builder = new NotificationCompat.Builder(context); - PackageManager pm = context.getPackageManager(); - Intent mIntent = activityContextManager.getInstance().getHomeController().getIntent(); - PendingIntent pendIntent = PendingIntent.getActivity(activityContextManager.getInstance().getCurrentActivity(), 0, mIntent, PendingIntent. FLAG_ONE_SHOT); - - builder.setContentTitle(pTitle) // required - .setSmallIcon(R.drawable.notification_logo) // required - .setContentText(pBody) // required - .setDefaults(Notification.DEFAULT_ALL) - .setAutoCancel(true) - .setContentIntent(pendIntent) - .setCategory(Notification.CATEGORY_SERVICE) - .setTicker(pTitle) - .setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}) - .setPriority(Notification.PRIORITY_HIGH); - } - - Notification notification = builder.build(); - mNotifManager.notify(NOTIFY_ID, notification); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/clientauth/ClientAuthContentProvider.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/clientauth/ClientAuthContentProvider.java similarity index 97% rename from app/src/main/java/com/darkweb/genesissearchengine/clientauth/ClientAuthContentProvider.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/clientauth/ClientAuthContentProvider.java index 67af8eb4..a5b8fb76 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/clientauth/ClientAuthContentProvider.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/clientauth/ClientAuthContentProvider.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.clientauth; +package com.darkweb.genesissearchengine.libs.clientauth; import android.content.ContentProvider; import android.content.ContentUris; @@ -19,7 +19,7 @@ public class ClientAuthContentProvider extends ContentProvider { V3ClientAuth.HASH, V3ClientAuth.ENABLED, }; - private static final String AUTH = "com.darkweb.genesissearchengine.clientauth.ClientAuthContentProvider"; + private static final String AUTH = "com.darkweb.genesissearchengine.libs.clientauth.ClientAuthContentProvider"; public static final Uri CONTENT_URI = Uri.parse("content://" + AUTH + "/v3auth"); private static final int V3AUTHS = 1, V3AUTH_ID = 2; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/clientauth/ClientAuthDatabase.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/clientauth/ClientAuthDatabase.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/clientauth/ClientAuthDatabase.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/clientauth/ClientAuthDatabase.java index 4dfda1a8..305f926d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/clientauth/ClientAuthDatabase.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/clientauth/ClientAuthDatabase.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.clientauth; +package com.darkweb.genesissearchengine.libs.clientauth; import android.content.Context; import android.database.sqlite.SQLiteDatabase; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/NetCipher.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/NetCipher.java similarity index 98% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/NetCipher.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/NetCipher.java index dbc37985..97897187 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/NetCipher.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/NetCipher.java @@ -15,15 +15,15 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher; +package com.darkweb.genesissearchengine.libs.netcipher; import android.net.Uri; import android.os.Build; import android.text.TextUtils; import android.util.Log; -import com.darkweb.genesissearchengine.netcipher.client.TlsOnlySocketFactory; -import com.darkweb.genesissearchengine.netcipher.proxy.OrbotHelper; +import com.darkweb.genesissearchengine.libs.netcipher.client.TlsOnlySocketFactory; +import com.darkweb.genesissearchengine.libs.netcipher.proxy.OrbotHelper; import java.io.IOException; import java.net.HttpURLConnection; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/SocksAwareClientConnOperator.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareClientConnOperator.java similarity index 99% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/SocksAwareClientConnOperator.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareClientConnOperator.java index c6e17dd9..f97fc47f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/SocksAwareClientConnOperator.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareClientConnOperator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.client; +package com.darkweb.genesissearchengine.libs.netcipher.client; import android.util.Log; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/SocksAwareProxyRoutePlanner.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareProxyRoutePlanner.java similarity index 97% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/SocksAwareProxyRoutePlanner.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareProxyRoutePlanner.java index 561bc80d..eee2f216 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/SocksAwareProxyRoutePlanner.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/SocksAwareProxyRoutePlanner.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.client; +package com.darkweb.genesissearchengine.libs.netcipher.client; import ch.boye.httpclientandroidlib.HttpException; import ch.boye.httpclientandroidlib.HttpHost; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongBuilder.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilder.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongBuilder.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilder.java index 9f5aee0e..260ae966 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongBuilder.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilder.java @@ -14,16 +14,13 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.client; +package com.darkweb.genesissearchengine.libs.netcipher.client; import android.content.Intent; import java.io.IOException; import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; + import javax.net.ssl.TrustManager; public interface StrongBuilder { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongBuilderBase.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilderBase.java similarity index 98% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongBuilderBase.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilderBase.java index 66d15fb5..955336f4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongBuilderBase.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongBuilderBase.java @@ -16,12 +16,12 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.client; +package com.darkweb.genesissearchengine.libs.netcipher.client; import android.content.Context; import android.content.Intent; -import com.darkweb.genesissearchengine.netcipher.proxy.OrbotHelper; +import com.darkweb.genesissearchengine.libs.netcipher.proxy.OrbotHelper; import org.json.JSONObject; import java.net.InetSocketAddress; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongConnectionBuilder.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConnectionBuilder.java similarity index 98% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongConnectionBuilder.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConnectionBuilder.java index 673b7661..868c46cc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongConnectionBuilder.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConnectionBuilder.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.client; +package com.darkweb.genesissearchengine.libs.netcipher.client; import android.content.Context; import android.content.Intent; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongConstants.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConstants.java similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongConstants.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConstants.java index 94a62a15..76c3f601 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongConstants.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongConstants.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.client; +package com.darkweb.genesissearchengine.libs.netcipher.client; public class StrongConstants { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongHttpsClient.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongHttpsClient.java similarity index 98% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongHttpsClient.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongHttpsClient.java index d5ffe3b5..a5b3e8ec 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongHttpsClient.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongHttpsClient.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.client; +package com.darkweb.genesissearchengine.libs.netcipher.client; import android.content.Context; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongSSLSocketFactory.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongSSLSocketFactory.java similarity index 98% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongSSLSocketFactory.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongSSLSocketFactory.java index 28e533af..c782b29b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/StrongSSLSocketFactory.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/StrongSSLSocketFactory.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.client; +package com.darkweb.genesissearchengine.libs.netcipher.client; import android.content.Context; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/TlsOnlySocketFactory.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/TlsOnlySocketFactory.java similarity index 99% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/TlsOnlySocketFactory.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/TlsOnlySocketFactory.java index b7c190a5..384cf85a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/client/TlsOnlySocketFactory.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/client/TlsOnlySocketFactory.java @@ -17,7 +17,7 @@ * From https://stackoverflow.com/a/29946540 */ -package com.darkweb.genesissearchengine.netcipher.client; +package com.darkweb.genesissearchengine.libs.netcipher.client; import android.net.SSLCertificateSocketFactory; import android.os.Build; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/OrbotHelper.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/OrbotHelper.java similarity index 99% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/OrbotHelper.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/OrbotHelper.java index d5a39fd2..6a191375 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/OrbotHelper.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/OrbotHelper.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.proxy; +package com.darkweb.genesissearchengine.libs.netcipher.proxy; import android.app.Activity; import android.content.BroadcastReceiver; @@ -34,7 +34,6 @@ import android.util.Log; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/ProxyHelper.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxyHelper.java similarity index 97% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/ProxyHelper.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxyHelper.java index 3fb018bb..c8a0a594 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/ProxyHelper.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxyHelper.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.proxy; +package com.darkweb.genesissearchengine.libs.netcipher.proxy; import android.content.Context; import android.content.Intent; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/ProxySelector.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxySelector.java similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/ProxySelector.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxySelector.java index 633aeb60..a0e15ef5 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/ProxySelector.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/ProxySelector.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.proxy; +package com.darkweb.genesissearchengine.libs.netcipher.proxy; import java.io.IOException; import java.net.InetSocketAddress; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/PsiphonHelper.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/PsiphonHelper.java similarity index 98% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/PsiphonHelper.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/PsiphonHelper.java index a94f7a47..8bbf26de 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/PsiphonHelper.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/PsiphonHelper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.proxy; +package com.darkweb.genesissearchengine.libs.netcipher.proxy; import java.net.ConnectException; import java.net.InetSocketAddress; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/SetFromMap.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SetFromMap.java similarity index 97% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/SetFromMap.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SetFromMap.java index 809824c4..b24caf2f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/SetFromMap.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SetFromMap.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.proxy; +package com.darkweb.genesissearchengine.libs.netcipher.proxy; import java.io.IOException; import java.io.ObjectInputStream; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/SignatureUtils.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SignatureUtils.java similarity index 99% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/SignatureUtils.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SignatureUtils.java index 9d5f624c..e282e77d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/SignatureUtils.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/SignatureUtils.java @@ -12,7 +12,7 @@ limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.proxy; +package com.darkweb.genesissearchengine.libs.netcipher.proxy; import android.content.ComponentName; import android.content.Context; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/StatusCallback.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/StatusCallback.java similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/StatusCallback.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/StatusCallback.java index 6fc1a14a..8540b1cc 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/StatusCallback.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/StatusCallback.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.proxy; +package com.darkweb.genesissearchengine.libs.netcipher.proxy; import android.content.Intent; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/TorServiceUtils.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/TorServiceUtils.java similarity index 99% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/TorServiceUtils.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/TorServiceUtils.java index da86c6f9..f8ee2d6c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/proxy/TorServiceUtils.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/proxy/TorServiceUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.proxy; +package com.darkweb.genesissearchengine.libs.netcipher.proxy; import android.content.Context; import android.util.Log; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/web/WebkitProxy.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/web/WebkitProxy.java similarity index 99% rename from app/src/main/java/com/darkweb/genesissearchengine/netcipher/web/WebkitProxy.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/web/WebkitProxy.java index d45ca73f..6f2da811 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/netcipher/web/WebkitProxy.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/netcipher/web/WebkitProxy.java @@ -16,7 +16,7 @@ * limitations under the License. */ -package com.darkweb.genesissearchengine.netcipher.web; +package com.darkweb.genesissearchengine.libs.netcipher.web; import java.io.IOException; import java.io.PrintWriter; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/trueTime.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/trueTime/trueTime.java similarity index 61% rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/trueTime.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/trueTime/trueTime.java index c745c677..4d060f72 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/trueTime.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/trueTime/trueTime.java @@ -1,15 +1,8 @@ -package com.darkweb.genesissearchengine.helperManager; - - -import android.widget.Toast; +package com.darkweb.genesissearchengine.libs.trueTime; import com.darkweb.genesissearchengine.constants.strings; import com.instacart.library.truetime.TrueTime; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.Date; -import java.util.Locale; -import java.util.TimeZone; public class trueTime { @@ -36,15 +29,7 @@ public class trueTime { } public String getLTZ(){ - Date deviceTime = new Date(); - return System.currentTimeMillis()+strings.GENERIC_EMPTY_STR; } - private String _formatDate(Date date, String pattern, TimeZone timeZone) { - DateFormat format = new SimpleDateFormat(pattern, Locale.ENGLISH); - format.setTimeZone(timeZone); - return format.format(date); - } - } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/colorAnimationReciever.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ColorAnimator.java similarity index 85% rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/colorAnimationReciever.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/views/ColorAnimator.java index da63f39f..5fabfe2c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/colorAnimationReciever.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ColorAnimator.java @@ -1,15 +1,15 @@ -package com.darkweb.genesissearchengine.helperManager; +package com.darkweb.genesissearchengine.libs.views; import android.graphics.Color; -public class colorAnimationReciever +public class ColorAnimator { private final int mStartColor, mEndColor; private final float[] mStartHSV, mEndHSV; private float[] mMove = new float[3]; - public colorAnimationReciever(int start, int end) { + public ColorAnimator(int start, int end) { mStartColor = start; mEndColor = end; mStartHSV = toHSV(start); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/KeyboardUtils.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/KeyboardUtils.java old mode 100755 new mode 100644 similarity index 95% rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/KeyboardUtils.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/views/KeyboardUtils.java index c7a8fff6..1d9370a6 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/KeyboardUtils.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/KeyboardUtils.java @@ -1,101 +1,101 @@ -package com.darkweb.genesissearchengine.helperManager; - -import android.app.Activity; -import android.graphics.Rect; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; -import android.content.Context; -import android.view.inputmethod.InputMethodManager; -import java.util.HashMap; -import java.util.Objects; - -public class KeyboardUtils implements ViewTreeObserver.OnGlobalLayoutListener -{ - private SoftKeyboardToggleListener mCallback; - private View mRootView; - - private final static int sMagicNumber = 200; - private static HashMap sListenerMap = new HashMap<>(); - - private Boolean mPrevValue = null; - private float mScreenDensity; - - public interface SoftKeyboardToggleListener - { - void onToggleSoftKeyboard(boolean isVisible); - } - - @Override - public void onGlobalLayout() - { - Rect r = new Rect(); - mRootView.getWindowVisibleDisplayFrame(r); - - int heightDiff = mRootView.getRootView().getHeight() - (r.bottom - r.top); - float dp = heightDiff/ mScreenDensity; - boolean isVisible = dp > sMagicNumber; - - if (mCallback != null && (mPrevValue == null || isVisible != mPrevValue)) { - mPrevValue = isVisible; - mCallback.onToggleSoftKeyboard(isVisible); - } - } - - public static void addKeyboardToggleListener(Activity act, SoftKeyboardToggleListener listener) - { - removeKeyboardToggleListener(listener); - sListenerMap.put(listener, new KeyboardUtils(act, listener)); - } - - public static void removeKeyboardToggleListener(SoftKeyboardToggleListener listener) - { - if(sListenerMap.containsKey(listener)) - { - KeyboardUtils k = sListenerMap.get(listener); - assert k != null; - k.removeListener(); - sListenerMap.remove(listener); - } - } - - public static void removeAllKeyboardToggleListeners() - { - for(SoftKeyboardToggleListener l : sListenerMap.keySet()){ - Objects.requireNonNull(sListenerMap.get(l)).removeListener(); - } - - sListenerMap.clear(); - } - - public static void toggleKeyboardVisibility(Context context) - { - InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); - if(inputMethodManager != null){ - inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); - } - } - - public static void forceCloseKeyboard(View activeView) - { - InputMethodManager inputMethodManager = (InputMethodManager) activeView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - if(inputMethodManager != null){ - inputMethodManager.hideSoftInputFromWindow(activeView.getWindowToken(), 0); - } - } - - private void removeListener() - { - mCallback = null; - mRootView.getViewTreeObserver().removeOnGlobalLayoutListener(this); - } - - private KeyboardUtils(Activity act, SoftKeyboardToggleListener listener) - { - mCallback = listener; - mRootView = ((ViewGroup) act.findViewById(android.R.id.content)).getChildAt(0); - mRootView.getViewTreeObserver().addOnGlobalLayoutListener(this); - mScreenDensity = act.getResources().getDisplayMetrics().density; - } - +package com.darkweb.genesissearchengine.libs.views; + +import android.app.Activity; +import android.graphics.Rect; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.content.Context; +import android.view.inputmethod.InputMethodManager; +import java.util.HashMap; +import java.util.Objects; + +public class KeyboardUtils implements ViewTreeObserver.OnGlobalLayoutListener +{ + private SoftKeyboardToggleListener mCallback; + private View mRootView; + + private final static int sMagicNumber = 200; + private static HashMap sListenerMap = new HashMap<>(); + + private Boolean mPrevValue = null; + private float mScreenDensity; + + public interface SoftKeyboardToggleListener + { + void onToggleSoftKeyboard(boolean isVisible); + } + + @Override + public void onGlobalLayout() + { + Rect r = new Rect(); + mRootView.getWindowVisibleDisplayFrame(r); + + int heightDiff = mRootView.getRootView().getHeight() - (r.bottom - r.top); + float dp = heightDiff/ mScreenDensity; + boolean isVisible = dp > sMagicNumber; + + if (mCallback != null && (mPrevValue == null || isVisible != mPrevValue)) { + mPrevValue = isVisible; + mCallback.onToggleSoftKeyboard(isVisible); + } + } + + public static void addKeyboardToggleListener(Activity act, SoftKeyboardToggleListener listener) + { + removeKeyboardToggleListener(listener); + sListenerMap.put(listener, new KeyboardUtils(act, listener)); + } + + public static void removeKeyboardToggleListener(SoftKeyboardToggleListener listener) + { + if(sListenerMap.containsKey(listener)) + { + KeyboardUtils k = sListenerMap.get(listener); + assert k != null; + k.removeListener(); + sListenerMap.remove(listener); + } + } + + public static void removeAllKeyboardToggleListeners() + { + for(SoftKeyboardToggleListener l : sListenerMap.keySet()){ + Objects.requireNonNull(sListenerMap.get(l)).removeListener(); + } + + sListenerMap.clear(); + } + + public static void toggleKeyboardVisibility(Context context) + { + InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); + if(inputMethodManager != null){ + inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } + } + + public static void forceCloseKeyboard(View activeView) + { + InputMethodManager inputMethodManager = (InputMethodManager) activeView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + if(inputMethodManager != null){ + inputMethodManager.hideSoftInputFromWindow(activeView.getWindowToken(), 0); + } + } + + private void removeListener() + { + mCallback = null; + mRootView.getViewTreeObserver().removeOnGlobalLayoutListener(this); + } + + private KeyboardUtils(Activity act, SoftKeyboardToggleListener listener) + { + mCallback = listener; + mRootView = ((ViewGroup) act.findViewById(android.R.id.content)).getChildAt(0); + mRootView.getViewTreeObserver().addOnGlobalLayoutListener(this); + mScreenDensity = act.getResources().getDisplayMetrics().density; + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/TopCropImageView.java b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ThumbnailCrop.java similarity index 79% rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/TopCropImageView.java rename to app/src/main/java/com/darkweb/genesissearchengine/libs/views/ThumbnailCrop.java index 94b17d74..4b9a9cf9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/TopCropImageView.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/libs/views/ThumbnailCrop.java @@ -1,28 +1,23 @@ -package com.darkweb.genesissearchengine.helperManager; +package com.darkweb.genesissearchengine.libs.views; -import android.annotation.TargetApi; import android.content.Context; import android.graphics.Matrix; import android.graphics.drawable.Drawable; -import android.os.Build; import android.util.AttributeSet; -/** - * Created by chris on 7/27/16. - */ -public class TopCropImageView extends androidx.appcompat.widget.AppCompatImageView { +public class ThumbnailCrop extends androidx.appcompat.widget.AppCompatImageView { - public TopCropImageView(Context context) { + public ThumbnailCrop(Context context) { super(context); init(); } - public TopCropImageView(Context context, AttributeSet attrs) { + public ThumbnailCrop(Context context, AttributeSet attrs) { super(context, attrs); init(); } - public TopCropImageView(Context context, AttributeSet attrs, int defStyleAttr) { + public ThumbnailCrop(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/adManager.java old mode 100755 new mode 100644 similarity index 78% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adManager.java rename to app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/adManager.java index c16813c3..0f4affe3 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/adManager.java @@ -1,94 +1,103 @@ -package com.darkweb.genesissearchengine.pluginManager; - -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.eventObserver; -import com.google.android.gms.ads.*; -import java.lang.ref.WeakReference; -import java.util.List; - -class adManager -{ - - /*Private Variables */ - - private eventObserver.eventListener mEvent; - private WeakReference mBannerAds; - private boolean mPaidStatus = false; - - private boolean bannerAdsLoading = false; - private boolean bannerAdsLoaded = false; - - /*Initializations*/ - - adManager(eventObserver.eventListener pEvent, AdView pBannerAds, boolean pPaidStatus) { - this.mEvent = pEvent; - this.mPaidStatus = pPaidStatus; - this.mBannerAds = new WeakReference(pBannerAds); - } - - private void initializeBannerAds(){ - if(!mPaidStatus){ - AdRequest request = new AdRequest.Builder().build(); - mBannerAds.get().loadAd(request); - admobListeners(); - } - } - - /*Local Helper Methods*/ - - private void loadAds(AppCompatActivity pAppContext){ - if(!mPaidStatus) - { - if (!bannerAdsLoading) - { - bannerAdsLoading = true; - MobileAds.initialize(pAppContext.getApplicationContext(), initializationStatus -> { }); - - initializeBannerAds(); - } - } - } - - private boolean isAdvertLoaded(){ - return bannerAdsLoaded; - } - - /*Local Listeners*/ - - private void admobListeners(){ - if(!mPaidStatus){ - mBannerAds.get().setAdListener(new AdListener() { - @Override - public void onAdLoaded() { - bannerAdsLoaded = true; - } - - @Override - public void onAdOpened() { - } - - @Override - public void onAdClicked() { - } - - @Override - public void onAdClosed() { - } - }); - } - } - - /*External Triggers*/ - - Object onTrigger(List pData, pluginEnums.eAdManager pEventType) { - if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) - { - loadAds((AppCompatActivity)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) - { - return isAdvertLoaded(); - } - return null; - } -} +package com.darkweb.genesissearchengine.pluginManager.adPluginManager; + +import android.util.Log; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.google.android.gms.ads.*; +import java.lang.ref.WeakReference; +import java.util.List; + +public class adManager +{ + + /*Private Variables */ + + private eventObserver.eventListener mEvent; + private WeakReference mBannerAds; + private boolean mPaidStatus; + + private boolean bannerAdsLoading = false; + private boolean bannerAdsLoaded = false; + + /*Initializations*/ + + public adManager(eventObserver.eventListener pEvent, AdView pBannerAds, boolean pPaidStatus) { + this.mEvent = pEvent; + this.mPaidStatus = pPaidStatus; + this.mBannerAds = new WeakReference(pBannerAds); + } + + private void initializeBannerAds(){ + if(!mPaidStatus){ + AdRequest request = new AdRequest.Builder().build(); + mBannerAds.get().loadAd(request); + admobListeners(); + } + } + + /*Local Helper Methods*/ + + private void loadAds(AppCompatActivity pAppContext){ + if(!mPaidStatus) + { + if (!bannerAdsLoading) + { + bannerAdsLoading = true; + MobileAds.initialize(pAppContext.getApplicationContext(), initializationStatus -> { }); + + initializeBannerAds(); + } + } + } + + private boolean isAdvertLoaded(){ + return bannerAdsLoaded; + } + + /*Local Listeners*/ + + private void admobListeners(){ + if(!mPaidStatus){ + mBannerAds.get().setAdListener(new AdListener() { + @Override + public void onAdLoaded() { + bannerAdsLoaded = true; + } + + @Override + public void onAdOpened() { + } + + @Override + public void onAdClicked() { + } + + @Override + public void onAdClosed() { + } + + @Override + public void onAdFailedToLoad(@NonNull LoadAdError var1) { + Log.i("sadsa",""); + } + + }); + } + } + + /*External Triggers*/ + + public Object onTrigger(List pData, pluginEnums.eAdManager pEventType) { + if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) + { + loadAds((AppCompatActivity)pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) + { + return isAdvertLoaded(); + } + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java old mode 100755 new mode 100644 similarity index 74% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticManager.java rename to app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java index 002153e7..0bd36f23 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java @@ -1,47 +1,48 @@ -package com.darkweb.genesissearchengine.pluginManager; - -import androidx.appcompat.app.AppCompatActivity; - -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.eventObserver; -import com.flurry.android.FlurryAgent; -import java.lang.ref.WeakReference; -import java.util.List; - -class analyticManager -{ - /*Private Variables*/ - - private WeakReference mAppContext; - - /*Initializations*/ - - analyticManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ - this.mAppContext = pAppContext; - initialize(); - } - - private void initialize() - { - if(status.sDeveloperBuild){ - new FlurryAgent.Builder() .withLogEnabled(true) .build(mAppContext.get().getApplicationContext(), "4C4K4T5ND9RJKT4H47GQ"); - }else { - new FlurryAgent.Builder() .withLogEnabled(true) .build(mAppContext.get().getApplicationContext(), "5RQYRV23928K6DXH8VWV"); - } - } - - /*External Triggers*/ - - private void logEvent(String pValue) - { - if(FlurryAgent.isSessionActive()){ - FlurryAgent.logEvent(pValue); - } - } - - void onTrigger(List pData, pluginEnums.eAnalyticManager pEventType) { - if(pEventType.equals(pluginEnums.eAnalyticManager.M_LOG_EVENT)) - { - } - } -} +package com.darkweb.genesissearchengine.pluginManager.analyticPluginManager; + +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.flurry.android.FlurryAgent; +import java.lang.ref.WeakReference; +import java.util.List; + +public class analyticManager +{ + /*Private Variables*/ + + private WeakReference mAppContext; + + /*Initializations*/ + + public analyticManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ + this.mAppContext = pAppContext; + initialize(); + } + + private void initialize() + { + if(status.sDeveloperBuild){ + new FlurryAgent.Builder() .withLogEnabled(true) .build(mAppContext.get().getApplicationContext(), "4C4K4T5ND9RJKT4H47GQ"); + }else { + new FlurryAgent.Builder() .withLogEnabled(true) .build(mAppContext.get().getApplicationContext(), "5RQYRV23928K6DXH8VWV"); + } + } + + /*External Triggers*/ + + private void logEvent(String pValue) + { + if(FlurryAgent.isSessionActive()){ + FlurryAgent.logEvent(pValue); + } + } + + public void onTrigger(List pData, pluginEnums.eAnalyticManager pEventType) { + if(pEventType.equals(pluginEnums.eAnalyticManager.M_LOG_EVENT)) + { + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadManager.java deleted file mode 100644 index 0ef0e03b..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadManager.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.darkweb.genesissearchengine.pluginManager; - -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.helperManager.localFileDownloader; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import java.lang.ref.WeakReference; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -class downloadManager -{ - /*Private Variables*/ - - private WeakReference mAppContext; - private Map mDownloads = new HashMap<>(); - private eventObserver.eventListener mEvent; - - /*Initializations*/ - - downloadManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ - this.mAppContext = pAppContext; - this.mEvent = pEvent; - - initialize(); - } - - private void initialize() - { - } - - private void startDownload(String pPath,String pFile) { - int mID = helperMethod.createNotificationID(); - localFileDownloader mFileDownloader = (localFileDownloader)new localFileDownloader(mAppContext.get().getApplicationContext(),pPath, pFile, mID, mEvent).execute(pPath); - mDownloads.put(mID,mFileDownloader); - } - - private void cancelDownload(int pID) { - Objects.requireNonNull(mDownloads.get(pID)).onCancel(); - } - - private void onTriggerDownload(int pID) { - Objects.requireNonNull(mDownloads.get(pID)).onTrigger(); - } - - /*External Triggers*/ - - Object onTrigger(List pData, pluginEnums.eDownloadManager pEventType) { - if(pEventType.equals(pluginEnums.eDownloadManager.M_DOWNLOAD_FILE)) - { - startDownload((String) pData.get(0),(String)pData.get(1)); - } - else if(pEventType.equals(pluginEnums.eDownloadManager.M_CANCEL)) - { - cancelDownload((int) pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eDownloadManager.M_TRIGGER)) - { - onTriggerDownload((int) pData.get(0)); - } - - return null; - } -} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/internalFileDownloadManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/blobDownloader.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/internalFileDownloadManager.java rename to app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/blobDownloader.java index b8c5d813..045cce80 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/internalFileDownloadManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/blobDownloader.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.helperManager; +package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; import android.app.NotificationManager; import android.content.Context; @@ -6,21 +6,19 @@ import android.os.Environment; import android.os.Handler; import android.util.Base64; import android.webkit.JavascriptInterface; - import androidx.core.app.NotificationCompat; - import com.example.myapplication.R; - import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.text.DateFormat; import java.util.Date; -public class internalFileDownloadManager { +public class blobDownloader { + private Context context; private NotificationManager nm; - public internalFileDownloadManager(Context context) { + public blobDownloader(Context context) { this.context = context; } @@ -49,6 +47,7 @@ public class internalFileDownloadManager { } return "javascript: console.log('It is not a Blob URL');"; } + private void convertBase64StringToPdfAndStoreIt(String base64PDf) throws IOException { final int notificationId = 1; String currentDateTime = DateFormat.getDateTimeInstance().format(new Date()); @@ -72,11 +71,7 @@ public class internalFileDownloadManager { nm.notify(notificationId, b.build()); Handler h = new Handler(); long delayInMilliseconds = 5000; - h.postDelayed(new Runnable() { - public void run() { - nm.cancel(notificationId); - } - }, delayInMilliseconds); + h.postDelayed(() -> nm.cancel(notificationId), delayInMilliseconds); } } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadManager.java new file mode 100644 index 00000000..a10cad63 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadManager.java @@ -0,0 +1,89 @@ +package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; + +import android.os.Environment; + +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.darkweb.genesissearchengine.pluginManager.pluginReciever.downloadNotificationReciever; + +import java.lang.ref.WeakReference; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +public class downloadManager +{ + /* Private Variables */ + + private WeakReference mAppContext; + private Map mDownloads = new HashMap<>(); + private eventObserver.eventListener mEvent; + + /* Initializations */ + + public downloadManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ + this.mAppContext = pAppContext; + this.mEvent = pEvent; + + initialize(); + } + + private void initialize() + { + } + + private void startDownload(String pPath,String pFile) { + int mID = helperMethod.createNotificationID(); + downloadReciever mFileDownloader = (downloadReciever)new downloadReciever(mAppContext.get().getApplicationContext(),pPath, pFile, mID, mEvent, downloadNotificationReciever.class).execute(pPath); + mDownloads.put(mID,mFileDownloader); + } + + private void cancelDownload(int pID) { + Objects.requireNonNull(mDownloads.get(pID)).onCancel(); + } + + private void onTriggerDownload(int pID) { + if(mDownloads!=null && mDownloads.get(pID)!=null){ + mDownloads.get(pID).onTrigger(); + } + } + + private void onStartSercvice(String mURL, String mPath){ + mAppContext.get().startService(downloadService.getDownloadService(mAppContext.get().getApplicationContext(), mURL + "__" + mPath, Environment.DIRECTORY_DOWNLOADS)); + } + + private String downloadBlob(String pURL){ + return blobDownloader.getBase64StringFromBlobUrl(pURL); + } + + /* External Triggers */ + + public Object onTrigger(List pData, pluginEnums.eDownloadManager pEventType) { + if(pEventType.equals(pluginEnums.eDownloadManager.M_DOWNLOAD_FILE)) + { + startDownload((String) pData.get(0),(String)pData.get(1)); + } + else if(pEventType.equals(pluginEnums.eDownloadManager.M_CANCEL)) + { + cancelDownload((int) pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eDownloadManager.M_TRIGGER)) + { + onTriggerDownload((int) pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eDownloadManager.M_START_SERVICE)) + { + onStartSercvice((String) pData.get(0), (String) pData.get(1)); + } + else if(pEventType.equals(pluginEnums.eDownloadManager.M_DOWNLOAD_BLOB)) + { + return downloadBlob((String) pData.get(0)); + } + + return null; + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java similarity index 91% rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java rename to app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java index 8df395e2..d89865d0 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.helperManager; +package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; import android.annotation.SuppressLint; import android.app.DownloadManager; @@ -24,7 +24,8 @@ import androidx.core.content.FileProvider; import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.netcipher.client.StrongHttpsClient; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.libs.netcipher.client.StrongHttpsClient; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; @@ -39,6 +40,7 @@ import java.net.InetSocketAddress; import java.net.Proxy; import java.net.URI; import java.net.URL; +import java.net.URLConnection; import java.text.DecimalFormat; import java.util.Arrays; import java.util.Collections; @@ -50,7 +52,7 @@ import static com.darkweb.genesissearchengine.constants.enums.etype.M_DOWNLOAD_F import static java.lang.Thread.sleep; -public class localFileDownloader extends AsyncTask { +public class downloadReciever extends AsyncTask { @SuppressLint("StaticFieldLeak") private Context context; @@ -61,21 +63,21 @@ public class localFileDownloader extends AsyncTask { private Boolean mIsCanceled = false; private String PROXY_ADDRESS = "localhost"; - private int PROXY_PORT = 9050; private int mID; private String mFileName; - private float mTotalByte; private float mDownloadByte; private String mURL; private eventObserver.eventListener mEvent; + private Class mBroadcastReciever; - public localFileDownloader(Context pContext, String pURL, String pFileName, int pID, eventObserver.eventListener pEvent) { + public downloadReciever(Context pContext, String pURL, String pFileName, int pID, eventObserver.eventListener pEvent, Class pBroadcastReciever) { this.context = pContext; this.mFileName = pFileName; this.mURL = pURL; this.mID = pID; this.mEvent = pEvent; + this.mBroadcastReciever = pBroadcastReciever; StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); @@ -87,7 +89,7 @@ public class localFileDownloader extends AsyncTask { protected void onPreExecute() { super.onPreExecute(); - Intent snoozeIntent = new Intent(context, downloadNotification.class); + Intent snoozeIntent = new Intent(context, mBroadcastReciever); snoozeIntent.setAction("Download_Cancelled"); snoozeIntent.putExtra("N_ID", mID); snoozeIntent.putExtra("N_COMMAND", 0); @@ -152,7 +154,9 @@ public class localFileDownloader extends AsyncTask { proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved(PROXY_ADDRESS, 9050)); conection = (HttpURLConnection) url.openConnection(proxy); }else { - conection = (HttpURLConnection) ProxySelector.openConnectionWithProxy(new URI(f_url[0]));; + Proxy mProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8118)); + URLConnection mURLConnection = new URI(f_url[0]).toURL().openConnection(mProxy); + conection = (HttpURLConnection) mURLConnection; } conection.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"); @@ -168,7 +172,6 @@ public class localFileDownloader extends AsyncTask { long total = 0; - mTotalByte = lenghtOfFile; while ((count = mStream.read(data)) != -1) { total += count; int cur = (int) ((total * 100) / lenghtOfFile); @@ -219,7 +222,7 @@ public class localFileDownloader extends AsyncTask { HttpGet httpget = new HttpGet(urlEncoded); HttpResponse response = httpclient.execute(httpget); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(response.getStatusLine()).append("\n\n"); InputStream mStream = response.getEntity().getContent(); @@ -231,7 +234,6 @@ public class localFileDownloader extends AsyncTask { long total = 0; float lenghtOfFile = response.getEntity().getContentLength(); - mTotalByte = lenghtOfFile; int read; while ((read = mStream.read(data)) != -1) { total += read; @@ -285,13 +287,13 @@ public class localFileDownloader extends AsyncTask { @Override protected void onPostExecute(String file_url) { - Intent snoozeIntentPost = new Intent(context, downloadNotification.class); + Intent snoozeIntentPost = new Intent(context, mBroadcastReciever); snoozeIntentPost.setAction("Download_Open"); snoozeIntentPost.putExtra("N_ID", mID); snoozeIntentPost.putExtra("N_COMMAND", 1); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, mID, snoozeIntentPost, PendingIntent.FLAG_UPDATE_CURRENT); - Intent snoozeIntentPost1 = new Intent(context, downloadNotification.class); + Intent snoozeIntentPost1 = new Intent(context, mBroadcastReciever); snoozeIntentPost1.setAction("Download_Cancelled"); snoozeIntentPost1.putExtra("N_ID", mID); snoozeIntentPost1.putExtra("N_COMMAND", 2); @@ -316,7 +318,7 @@ public class localFileDownloader extends AsyncTask { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.provider.dev", mFile); + Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", mFile); ContentValues contentValues = new ContentValues(); contentValues.put(MediaStore.Downloads.TITLE, mFileName); @@ -329,7 +331,7 @@ public class localFileDownloader extends AsyncTask { ContentResolver database = context.getContentResolver(); database.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues); } else { - Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.provider.dev", mFile); + Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", mFile); String mime = helperMethod.getMimeType(uri.toString(), context); if(mime!=null){ dm.addCompletedDownload(mFileName, mURL, false, mime, mFile.getAbsolutePath(), mFile.length(), false); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/downloadFileService.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadService.java old mode 100755 new mode 100644 similarity index 74% rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/downloadFileService.java rename to app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadService.java index 6dda8dc5..1f975379 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/downloadFileService.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadService.java @@ -1,46 +1,42 @@ -package com.darkweb.genesissearchengine.helperManager; - -import android.annotation.SuppressLint; -import android.app.IntentService; -import android.content.Context; -import android.content.Intent; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.darkweb.genesissearchengine.pluginManager.pluginController; -import com.darkweb.genesissearchengine.pluginManager.pluginEnums; - -import java.util.Arrays; -import java.util.Collections; - -import static com.darkweb.genesissearchengine.constants.constants.CONST_PROXY_SOCKS; -import static java.lang.Thread.sleep; - -public class downloadFileService extends IntentService -{ - private static final String DOWNLOAD_PATH = "com.spartons.androiddownloadmanager_DownloadSongService_Download_path"; - private static final String DESTINATION_PATH = "com.spartons.androiddownloadmanager_DownloadSongService_Destination_path"; - - public downloadFileService() { - super("DownloadSongService"); - } - @SuppressLint("StaticFieldLeak") - static Context context; - - public static Intent getDownloadService(final @NonNull Context callingClassContext, final @NonNull String downloadPath, final @NonNull String destinationPath) { - downloadFileService.context = callingClassContext; - return new Intent(callingClassContext, downloadFileService.class) - .putExtra(DOWNLOAD_PATH, downloadPath) - .putExtra(DESTINATION_PATH, destinationPath); - } - @Override - protected void onHandleIntent(@Nullable Intent intent) { - String downloadPath = intent.getStringExtra(DOWNLOAD_PATH); - startDownload(downloadPath); - } - private void startDownload(String downloadPath) { - String []fn = (downloadPath+"__"+"as").split("__"); - pluginController.getInstance().onDownloadInvoke(Arrays.asList(fn[0],fn[1]), pluginEnums.eDownloadManager.M_DOWNLOAD_FILE); - } +package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager; + +import android.annotation.SuppressLint; +import android.app.IntentService; +import android.content.Context; +import android.content.Intent; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; + +import java.util.Arrays; + +public class downloadService extends IntentService +{ + private static final String DOWNLOAD_PATH = "com.spartons.androiddownloadmanager_DownloadSongService_Download_path"; + private static final String DESTINATION_PATH = "com.spartons.androiddownloadmanager_DownloadSongService_Destination_path"; + + public downloadService() { + super("DownloadSongService"); + } + @SuppressLint("StaticFieldLeak") + static Context context; + + public static Intent getDownloadService(final @NonNull Context callingClassContext, final @NonNull String downloadPath, final @NonNull String destinationPath) { + downloadService.context = callingClassContext; + return new Intent(callingClassContext, downloadService.class) + .putExtra(DOWNLOAD_PATH, downloadPath) + .putExtra(DESTINATION_PATH, destinationPath); + } + @Override + protected void onHandleIntent(@Nullable Intent intent) { + String downloadPath = intent.getStringExtra(DOWNLOAD_PATH); + startDownload(downloadPath); + } + private void startDownload(String downloadPath) { + String []fn = (downloadPath+"__"+"as").split("__"); + pluginController.getInstance().onDownloadInvoke(Arrays.asList(fn[0],fn[1]), pluginEnums.eDownloadManager.M_DOWNLOAD_FILE); + } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langManager.java rename to app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java index 7625b4e4..ccc75f8c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.pluginManager; +package com.darkweb.genesissearchengine.pluginManager.langPluginManager; import android.content.res.Configuration; import android.content.res.Resources; @@ -6,10 +6,12 @@ import android.os.Build; import androidx.appcompat.app.AppCompatActivity; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; + import java.util.List; import java.util.Locale; -class langManager { +public class langManager { /*Private Variables*/ @@ -19,7 +21,7 @@ class langManager { /*Initializations*/ - langManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, Locale pLanguage, Locale pSystemLocale) { + public langManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, Locale pLanguage, Locale pSystemLocale) { this.mEvent = pEvent; this.mLanguage = pLanguage; this.mSystemLocale = pSystemLocale; @@ -104,7 +106,7 @@ class langManager { /*External Triggers*/ - Object onTrigger(List pData, pluginEnums.eLangManager pEventType) { + public Object onTrigger(List pData, pluginEnums.eLangManager pEventType) { if(pEventType.equals(pluginEnums.eLangManager.M_ACTIVITY_CREATED)) { onCreate((AppCompatActivity) pData.get(0)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java old mode 100755 new mode 100644 similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java rename to app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java index 2b7338e9..241ccb29 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java @@ -1,714 +1,715 @@ -package com.darkweb.genesissearchengine.pluginManager; - -import android.app.Dialog; -import android.content.Intent; -import android.content.res.Resources; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.InsetDrawable; -import android.net.Uri; -import android.os.Handler; -import android.view.Gravity; -import android.view.Window; -import android.view.WindowManager; -import android.widget.EditText; -import android.widget.RatingBar; -import android.widget.TextView; -import androidx.appcompat.app.AppCompatActivity; -import androidx.constraintlayout.widget.ConstraintLayout; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.helperMethod; -import com.example.myapplication.R; -import com.google.android.material.switchmaterial.SwitchMaterial; -import org.mozilla.geckoview.ContentBlocking; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import static com.darkweb.genesissearchengine.constants.constants.*; -import static com.darkweb.genesissearchengine.constants.strings.MESSAGE_PLAYSTORE_NOT_FOUND; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; -import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.*; - -class messageManager -{ - /*Private Variables*/ - - private List mData; - private AppCompatActivity mContext; - private eventObserver.eventListener mEvent; - private Dialog mDialog = null; - - /*Initializations*/ - - private void onClearReference(){ - mContext = null; - mData = null; - } - - private void initializeDialog(int pLayout, int pGravity){ - try { - if(mDialog !=null && mDialog.isShowing()){ - mDialog.dismiss(); - } - - mDialog = new Dialog(mContext); - mDialog.getWindow().setGravity(pGravity); - mDialog.getWindow().getAttributes().windowAnimations = R.style.dialiog_animation; - - Drawable myDrawable; - Resources res = mContext.getResources(); - try { - myDrawable = Drawable.createFromXml(res, res.getXml(R.xml.hox_rounded_corner)); - mDialog.getWindow().setBackgroundDrawable(myDrawable); - } catch (Exception ignored) { - } - - mDialog.setCancelable(true); - mDialog.setContentView(pLayout); - - ColorDrawable back = new ColorDrawable(Color.TRANSPARENT); - InsetDrawable inset = new InsetDrawable(back, helperMethod.pxFromDp(15),0,helperMethod.pxFromDp(15),0); - mDialog.getWindow().setBackgroundDrawable(inset); - mDialog.getWindow().setLayout(helperMethod.pxFromDp(350), -1); - mDialog.getWindow().setLayout(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT); - mDialog.show(); - }catch (Exception ignored){} - } - - messageManager(eventObserver.eventListener event) - { - this.mEvent = event; - } - - /*Helper Methods*/ - private void welcomeMessage() - { - initializeDialog(R.layout.popup_welcome, Gravity.CENTER); - mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_BLACK_MARKET_URL), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_LEAKED_DOCUMENT_URL), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_NEWS_URL), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_SOFTWARE_URL), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption5).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_SOFTWARE_FINANCE), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption6).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(constants.CONST_COMMUNITIES), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pDontShowAgain).setOnClickListener(v -> { - mEvent.invokeObserver(null, M_CANCEL_WELCOME); - mDialog.dismiss(); - }); - - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void languageSupportFailure() - { - initializeDialog(R.layout.popup_language_support, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pLanguage)).setText((mData.get(0).toString())); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void rateFailure() - { - initializeDialog(R.layout.popup_rate_failure, Gravity.CENTER); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - final Handler handler = new Handler(); - Runnable runnable = () -> { - try{ - helperMethod.sendIssueEmail(mContext); - } - catch (Exception ex) - { - onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); - onClearReference(); - } - }; - handler.postDelayed(runnable, 1000); - }); - } - - private void reportedSuccessfully() - { - initializeDialog(R.layout.popup_reported_successfully, Gravity.BOTTOM); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void newIdentityCreated() - { - final Handler handler = new Handler(); - Runnable runnable = () -> mDialog.dismiss(); - - initializeDialog(R.layout.popup_new_circuit, Gravity.BOTTOM); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - - mDialog.setOnDismissListener(dialog -> { - handler.removeCallbacks(runnable); - onClearReference(); - }); - - handler.postDelayed(runnable, 1500); - } - - private void mDownloadFailure() - { - mContext.runOnUiThread(() -> { - final Handler handler = new Handler(); - Runnable runnable = () -> mDialog.dismiss(); - - initializeDialog(R.layout.popup_download_failure, Gravity.BOTTOM); - ((TextView)mDialog.findViewById(R.id.pDescription)).setText(("Request denied Error " + mData.get(0))); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - - mDialog.setOnDismissListener(dialog -> { - handler.removeCallbacks(runnable); - onClearReference(); - }); - - handler.postDelayed(runnable, 20000); - - }); - } - - private void popupBlocked() - { - final Handler handler = new Handler(); - Runnable runnable = () -> mDialog.dismiss(); - - initializeDialog(R.layout.popup_block_popup, Gravity.BOTTOM); - mDialog.findViewById(R.id.pOpenPrivacy).setOnClickListener(v -> { - mEvent.invokeObserver(null, M_OPEN_PRIVACY); - mDialog.dismiss(); - handler.removeCallbacks(runnable); - }); - - mDialog.setOnDismissListener(dialog -> { - handler.removeCallbacks(runnable); - onClearReference(); - }); - - handler.postDelayed(runnable, 1500); - } - - private void maxTabReached() - { - final Handler handler = new Handler(); - Runnable runnable = () -> mDialog.dismiss(); - - initializeDialog(R.layout.popup_max_tab, Gravity.BOTTOM); - mDialog.getWindow().setDimAmount(0); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> { - mDialog.dismiss(); - handler.removeCallbacks(runnable); - }); - - mDialog.setOnDismissListener(dialog -> { - handler.removeCallbacks(runnable); - onClearReference(); - }); - - handler.postDelayed(runnable, 1500); - - } - - private void notSupportMessage() - { - initializeDialog(R.layout.popup_not_supported, Gravity.BOTTOM); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void onPanic(){ - initializeDialog(R.layout.popup_panic, Gravity.BOTTOM); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - mEvent.invokeObserver(null, M_PANIC_RESET); - }); - } - - private void dataClearedSuccessfully() - { - initializeDialog(R.layout.popup_data_cleared, Gravity.BOTTOM); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - - private void openSecureConnectionPopup() - { - initializeDialog(R.layout.secure_connection_popup, Gravity.TOP); - Window window = mDialog.getWindow(); - window.setLayout(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT); - - ColorDrawable back = new ColorDrawable(Color.TRANSPARENT); - InsetDrawable inset = new InsetDrawable(back, 0,0,0,0); - mDialog.getWindow().setBackgroundDrawable(inset); - mDialog.setCancelable(true); - mDialog.setCanceledOnTouchOutside(true); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mEvent.invokeObserver(null, M_SECURE_CONNECTION)); - - if((boolean) mData.get(1)){ - ((SwitchMaterial) mDialog.findViewById(R.id.pJSStatus)).setChecked(true); - }else { - ((SwitchMaterial) mDialog.findViewById(R.id.pJSStatus)).setChecked(false); - } - if((boolean) mData.get(2)){ - ((SwitchMaterial) mDialog.findViewById(R.id.pDTStatus)).setChecked(true); - }else { - ((SwitchMaterial) mDialog.findViewById(R.id.pDTStatus)).setChecked(false); - } - if((int) mData.get(3) != ContentBlocking.AntiTracking.NONE){ - ((SwitchMaterial) mDialog.findViewById(R.id.pTPStatus)).setChecked(true); - }else { - ((SwitchMaterial) mDialog.findViewById(R.id.pTPStatus)).setChecked(false); - } - - ((TextView) mDialog.findViewById(R.id.pHeaderSubpart)).setText(helperMethod.getDomainName(mData.get(0).toString())); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void bookmark() - { - initializeDialog(R.layout.popup_create_bookmark, Gravity.CENTER); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); - - mDialog.setOnShowListener(dialog -> mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)); - mDialog.setOnDismissListener(dialog -> { - final Handler handler = new Handler(); - Runnable runnable = () -> { - helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); - dialog.dismiss(); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - onClearReference(); - }; - handler.postDelayed(runnable, 50); - }); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> { - mDialog.dismiss(); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); - }); - - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - helperMethod.hideKeyboard(mContext); - mEvent.invokeObserver(Collections.singletonList(mData.get(0).toString().replace("genesis.onion","genesishiddentechnologies.com")+"split"+((EditText) mDialog.findViewById(R.id.pBridgeInput)).getText().toString()), M_BOOKMARK); - }); - } - - private void onUpdateBridges() - { - initializeDialog(R.layout.popup_update_bridges, Gravity.CENTER); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); - if(!status.sBridgeCustomBridge.equals("meek") && !status.sBridgeCustomBridge.equals("obfs4")){ - ((EditText)mDialog.findViewById(R.id.pBridgeInput)).setText(status.sBridgeCustomBridge); - ((EditText)mDialog.findViewById(R.id.pBridgeType)).setText(status.sBridgeCustomType); - } - - mDialog.setOnShowListener(dialog -> mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)); - mDialog.setOnDismissListener(dialog -> { - final Handler handler = new Handler(); - Runnable runnable = () -> { - helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); - dialog.dismiss(); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - onClearReference(); - }; - handler.postDelayed(runnable, 50); - }); - mDialog.findViewById(R.id.pBridgeRequest).setOnClickListener(v -> { - final Handler handler = new Handler(); - Runnable runnable = () -> { - try{ - helperMethod.sendBridgeEmail(mContext); - } - catch (Exception ex){ - onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); - } - }; - handler.postDelayed(runnable, 200); - }); - - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); - helperMethod.hideKeyboard(mContext); - mEvent.invokeObserver(Arrays.asList(((EditText)mDialog.findViewById(R.id.pBridgeInput)).getText().toString(), ((EditText)mDialog.findViewById(R.id.pBridgeType)).getText().toString()), M_SET_BRIDGES); - }); - } - - private void clearHistory() - { - initializeDialog(R.layout.popup_clear_history, Gravity.CENTER); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - mEvent.invokeObserver(null, M_CLEAR_HISTORY); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void clearBookmark() - { - initializeDialog(R.layout.popup_clear_bookmark, Gravity.CENTER); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - mEvent.invokeObserver(null, M_CLEAR_BOOKMARK); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void reportURL() - { - initializeDialog(R.layout.popup_report_url, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pHeader)).setText(mData.get(0).toString()); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - final Handler handler = new Handler(); - Runnable runnable = () -> onTrigger(Arrays.asList(strings.GENERIC_EMPTY_STR, mContext),M_RATE_SUCCESS); - handler.postDelayed(runnable, 1000); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void downloadSingle() - { - initializeDialog(R.layout.popup_download_url, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pDescription)).setText(mData.get(0).toString()); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - ArrayList tempData = new ArrayList<>(); - if(mData!=null){ - tempData.addAll(mData); - } - mDialog.dismiss(); - final Handler handler = new Handler(); - Runnable runnable = () -> mEvent.invokeObserver(tempData, M_DOWNLOAD_SINGLE); - handler.postDelayed(runnable, 1000); - onClearReference(); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void rateApp() - { - initializeDialog(R.layout.popup_rate_us, Gravity.CENTER); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - RatingBar mRatingBar = mDialog.findViewById(R.id.pRating); - if(mRatingBar.getRating()>=3){ - mEvent.invokeObserver(null, M_APP_RATED); - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(CONST_PLAYSTORE_URL)); - try { - mContext.startActivity(intent); - } catch (Exception ignored) { - helperMethod.showToastMessage(MESSAGE_PLAYSTORE_NOT_FOUND, mContext); - } - - mDialog.dismiss(); - }else if(mRatingBar.getRating()>0) { - mEvent.invokeObserver(null, M_APP_RATED); - final Handler handler = new Handler(); - handler.postDelayed(() -> onTrigger(Arrays.asList(strings.GENERIC_EMPTY_STR, mContext),M_RATE_FAILURE), 1000); - mDialog.dismiss(); - } - }); - } - - private void downloadFileLongPress() - { - String title = mData.get(2).toString(); - - if(title.length()>0){ - title = title + " | "; - } - - initializeDialog(R.layout.popup_file_longpress, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pDescription)).setText((title + mData.get(0).toString())); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_DOWNLOAD_FILE_MANUAL); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_NEW_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK); - mDialog.dismiss(); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void openURLLongPress() - { - String title = mData.get(2).toString(); - - initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pDescription)).setText((title + mData.get(0))); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_NEW_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK); - mDialog.dismiss(); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void popupDownloadFull(){ - String url = mData.get(0).toString(); - String file = mData.get(2).toString(); - String title = mData.get(3).toString(); - - String data_local = mContext.getString(R.string.ALERT_LONG_URL_MESSAGE); - - if(!url.equals(strings.GENERIC_EMPTY_STR)){ - data_local = title + url; - } - else if(!file.equals(strings.GENERIC_EMPTY_STR)){ - data_local = file; - } - String mTitle = title; - if(mTitle.length()<=1){ - mTitle = mData.get(0).toString(); - } - - initializeDialog(R.layout.popup_download_full, Gravity.CENTER); - ((TextView) mDialog.findViewById(R.id.pHeader)).setText(mTitle); - ((TextView) mDialog.findViewById(R.id.pDescription)).setText((data_local)); - mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(url), M_OPEN_LINK_NEW_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(url), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(url), M_COPY_LINK); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(file), M_OPEN_LINK_NEW_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption5).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(file), M_OPEN_LINK_CURRENT_TAB); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption6).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(file), M_COPY_LINK); - mDialog.dismiss(); - }); - mDialog.findViewById(R.id.pOption7).setOnClickListener(v -> { - mEvent.invokeObserver(Collections.singletonList(file), M_DOWNLOAD_FILE_MANUAL); - mDialog.dismiss(); - }); - mDialog.setOnDismissListener(dialog -> onClearReference()); - } - - private void sendBridgeMail() - { - initializeDialog(R.layout.popup_bridge_mail, Gravity.CENTER); - mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); - mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { - mDialog.dismiss(); - final Handler handler = new Handler(); - Runnable runnable = () -> { - try{ - helperMethod.sendBridgeEmail(mContext); - } - catch (Exception ex){ - onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); - } - }; - handler.postDelayed(runnable, 1000); - }); - } - - void onReset(){ - if(mDialog !=null){ - mDialog.dismiss(); - } - } - - /*External Triggers*/ - - void onTrigger(List pData, pluginEnums.eMessageManager pEventType) - { - if(!pEventType.equals(M_RATE_FAILURE) && !pEventType.equals(M_RATE_SUCCESS) && !pEventType.equals(M_NOT_SUPPORTED)){ - onClearReference(); - } - if(pEventType.equals(pluginEnums.eMessageManager.M_RESET)){ - onReset(); - } - else { - this.mContext = (AppCompatActivity) pData.get(pData.size()-1); - this.mData = pData; - - switch (pEventType) { - case M_WELCOME: - /*VERIFIED*/ - welcomeMessage(); - break; - - case M_RATE_FAILURE: - /*VERIFIED*/ - rateFailure(); - break; - - case M_LANGUAGE_SUPPORT_FAILURE: - /*VERIFIED*/ - languageSupportFailure(); - break; - - case M_RATE_SUCCESS: - /*VERIFIED*/ - reportedSuccessfully(); - break; - - case M_BOOKMARK: - /*VERIFIED*/ - bookmark(); - break; - - case M_CLEAR_HISTORY: - /*VERIFIED*/ - clearHistory(); - break; - - case M_CLEAR_BOOKMARK: - /*VERIFIED*/ - clearBookmark(); - break; - - case M_REPORT_URL: - /*VERIFIED*/ - reportURL(); - break; - - case M_RATE_APP: - /*VERIFIED*/ - rateApp(); - break; - - case M_DOWNLOAD_FILE : - /*VERIFIED*/ - //downloadFileLongPress(); - break; - - case M_LONG_PRESS_DOWNLOAD : - /*VERIFIED*/ - downloadFileLongPress(); - break; - - case M_LONG_PRESS_URL: - /*VERIFIED*/ - openURLLongPress(); - break; - - case M_LONG_PRESS_WITH_LINK: - /*VERIFIED*/ - popupDownloadFull(); - break; - - case M_BRIDGE_MAIL: - /*VERIFIED*/ - sendBridgeMail(); - break; - - case M_NOT_SUPPORTED: - /*VERIFIED*/ - notSupportMessage(); - break; - - case M_PANIC_RESET: - /*VERIFIED*/ - onPanic(); - break; - - case M_DATA_CLEARED: - /*VERIFIED*/ - dataClearedSuccessfully(); - break; - - case M_SECURE_CONNECTION: - /*VERIFIED*/ - openSecureConnectionPopup(); - break; - - case M_DOWNLOAD_SINGLE: - /*VERIFIED*/ - downloadSingle(); - break; - - case M_UPDATE_BRIDGES: - /*VERIFIED*/ - onUpdateBridges(); - break; - - case M_NEW_IDENTITY: - /*VERIFIED*/ - newIdentityCreated(); - break; - - case M_DOWNLOAD_FAILURE: - /*VERIFIED*/ - mDownloadFailure(); - break; - - case M_POPUP_BLOCKED: - /*VERIFIED*/ - popupBlocked(); - break; - - case M_MAX_TAB_REACHED: - /*VERIFIED*/ - maxTabReached(); - break; - } - } - } -} +package com.darkweb.genesissearchengine.pluginManager.messagePluginManager; + +import android.app.Dialog; +import android.content.Intent; +import android.content.res.Resources; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.InsetDrawable; +import android.net.Uri; +import android.os.Handler; +import android.view.Gravity; +import android.view.Window; +import android.view.WindowManager; +import android.widget.EditText; +import android.widget.RatingBar; +import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.constraintlayout.widget.ConstraintLayout; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import com.example.myapplication.R; +import com.google.android.material.switchmaterial.SwitchMaterial; +import org.mozilla.geckoview.ContentBlocking; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import static com.darkweb.genesissearchengine.constants.constants.*; +import static com.darkweb.genesissearchengine.constants.strings.MESSAGE_PLAYSTORE_NOT_FOUND; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.*; + +public class messageManager +{ + /*Private Variables*/ + + private List mData; + private AppCompatActivity mContext; + private eventObserver.eventListener mEvent; + private Dialog mDialog = null; + + /*Initializations*/ + + private void onClearReference(){ + mContext = null; + mData = null; + } + + private void initializeDialog(int pLayout, int pGravity){ + try { + if(mDialog !=null && mDialog.isShowing()){ + mDialog.dismiss(); + } + + mDialog = new Dialog(mContext); + mDialog.getWindow().setGravity(pGravity); + mDialog.getWindow().getAttributes().windowAnimations = R.style.dialiog_animation; + + Drawable myDrawable; + Resources res = mContext.getResources(); + try { + myDrawable = Drawable.createFromXml(res, res.getXml(R.xml.hox_rounded_corner)); + mDialog.getWindow().setBackgroundDrawable(myDrawable); + } catch (Exception ignored) { + } + + mDialog.setCancelable(true); + mDialog.setContentView(pLayout); + + ColorDrawable back = new ColorDrawable(Color.TRANSPARENT); + InsetDrawable inset = new InsetDrawable(back, helperMethod.pxFromDp(15),0,helperMethod.pxFromDp(15),0); + mDialog.getWindow().setBackgroundDrawable(inset); + mDialog.getWindow().setLayout(helperMethod.pxFromDp(350), -1); + mDialog.getWindow().setLayout(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT); + mDialog.show(); + }catch (Exception ignored){} + } + + public messageManager(eventObserver.eventListener event) + { + this.mEvent = event; + } + + /*Helper Methods*/ + private void welcomeMessage() + { + initializeDialog(R.layout.popup_welcome, Gravity.CENTER); + mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_BLACK_MARKET_URL), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_LEAKED_DOCUMENT_URL), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_NEWS_URL), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_SOFTWARE_URL), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption5).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_SOFTWARE_FINANCE), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption6).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(constants.CONST_COMMUNITIES), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pDontShowAgain).setOnClickListener(v -> { + mEvent.invokeObserver(null, M_CANCEL_WELCOME); + mDialog.dismiss(); + }); + + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void languageSupportFailure() + { + initializeDialog(R.layout.popup_language_support, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pLanguage)).setText((mData.get(0).toString())); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void rateFailure() + { + initializeDialog(R.layout.popup_rate_failure, Gravity.CENTER); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + final Handler handler = new Handler(); + Runnable runnable = () -> { + try{ + helperMethod.sendIssueEmail(mContext); + } + catch (Exception ex) + { + onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); + onClearReference(); + } + }; + handler.postDelayed(runnable, 1000); + }); + } + + private void reportedSuccessfully() + { + initializeDialog(R.layout.popup_reported_successfully, Gravity.BOTTOM); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void newIdentityCreated() + { + final Handler handler = new Handler(); + Runnable runnable = () -> mDialog.dismiss(); + + initializeDialog(R.layout.popup_new_circuit, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + + mDialog.setOnDismissListener(dialog -> { + handler.removeCallbacks(runnable); + onClearReference(); + }); + + handler.postDelayed(runnable, 1500); + } + + private void mDownloadFailure() + { + mContext.runOnUiThread(() -> { + final Handler handler = new Handler(); + Runnable runnable = () -> mDialog.dismiss(); + + initializeDialog(R.layout.popup_download_failure, Gravity.BOTTOM); + ((TextView)mDialog.findViewById(R.id.pDescription)).setText(("Request denied Error " + mData.get(0))); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + + mDialog.setOnDismissListener(dialog -> { + handler.removeCallbacks(runnable); + onClearReference(); + }); + + handler.postDelayed(runnable, 20000); + + }); + } + + private void popupBlocked() + { + final Handler handler = new Handler(); + Runnable runnable = () -> mDialog.dismiss(); + + initializeDialog(R.layout.popup_block_popup, Gravity.BOTTOM); + mDialog.findViewById(R.id.pOpenPrivacy).setOnClickListener(v -> { + mEvent.invokeObserver(null, M_OPEN_PRIVACY); + mDialog.dismiss(); + handler.removeCallbacks(runnable); + }); + + mDialog.setOnDismissListener(dialog -> { + handler.removeCallbacks(runnable); + onClearReference(); + }); + + handler.postDelayed(runnable, 1500); + } + + private void maxTabReached() + { + final Handler handler = new Handler(); + Runnable runnable = () -> mDialog.dismiss(); + + initializeDialog(R.layout.popup_max_tab, Gravity.BOTTOM); + mDialog.getWindow().setDimAmount(0); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> { + mDialog.dismiss(); + handler.removeCallbacks(runnable); + }); + + mDialog.setOnDismissListener(dialog -> { + handler.removeCallbacks(runnable); + onClearReference(); + }); + + handler.postDelayed(runnable, 1500); + + } + + private void notSupportMessage() + { + initializeDialog(R.layout.popup_not_supported, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void onPanic(){ + initializeDialog(R.layout.popup_panic, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + mEvent.invokeObserver(null, M_PANIC_RESET); + }); + } + + private void dataClearedSuccessfully() + { + initializeDialog(R.layout.popup_data_cleared, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + + private void openSecureConnectionPopup() + { + initializeDialog(R.layout.secure_connection_popup, Gravity.TOP); + Window window = mDialog.getWindow(); + window.setLayout(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT); + + ColorDrawable back = new ColorDrawable(Color.TRANSPARENT); + InsetDrawable inset = new InsetDrawable(back, 0,0,0,0); + mDialog.getWindow().setBackgroundDrawable(inset); + mDialog.setCancelable(true); + mDialog.setCanceledOnTouchOutside(true); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mEvent.invokeObserver(null, M_SECURE_CONNECTION)); + + if((boolean) mData.get(1)){ + ((SwitchMaterial) mDialog.findViewById(R.id.pJSStatus)).setChecked(true); + }else { + ((SwitchMaterial) mDialog.findViewById(R.id.pJSStatus)).setChecked(false); + } + if((boolean) mData.get(2)){ + ((SwitchMaterial) mDialog.findViewById(R.id.pDTStatus)).setChecked(true); + }else { + ((SwitchMaterial) mDialog.findViewById(R.id.pDTStatus)).setChecked(false); + } + if((int) mData.get(3) != ContentBlocking.AntiTracking.NONE){ + ((SwitchMaterial) mDialog.findViewById(R.id.pTPStatus)).setChecked(true); + }else { + ((SwitchMaterial) mDialog.findViewById(R.id.pTPStatus)).setChecked(false); + } + + ((TextView) mDialog.findViewById(R.id.pHeaderSubpart)).setText(helperMethod.getDomainName(mData.get(0).toString())); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void bookmark() + { + initializeDialog(R.layout.popup_create_bookmark, Gravity.CENTER); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); + + mDialog.setOnShowListener(dialog -> mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)); + mDialog.setOnDismissListener(dialog -> { + final Handler handler = new Handler(); + Runnable runnable = () -> { + helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); + dialog.dismiss(); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + onClearReference(); + }; + handler.postDelayed(runnable, 50); + }); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> { + mDialog.dismiss(); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); + }); + + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + helperMethod.hideKeyboard(mContext); + mEvent.invokeObserver(Collections.singletonList(mData.get(0).toString().replace("genesis.onion","genesishiddentechnologies.com")+"split"+((EditText) mDialog.findViewById(R.id.pBridgeInput)).getText().toString()), M_BOOKMARK); + }); + } + + private void onUpdateBridges() + { + initializeDialog(R.layout.popup_update_bridges, Gravity.CENTER); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); + if(!status.sBridgeCustomBridge.equals("meek") && !status.sBridgeCustomBridge.equals("obfs4")){ + ((EditText)mDialog.findViewById(R.id.pBridgeInput)).setText(status.sBridgeCustomBridge); + ((EditText)mDialog.findViewById(R.id.pBridgeType)).setText(status.sBridgeCustomType); + } + + mDialog.setOnShowListener(dialog -> mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)); + mDialog.setOnDismissListener(dialog -> { + final Handler handler = new Handler(); + Runnable runnable = () -> { + helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); + dialog.dismiss(); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + onClearReference(); + }; + handler.postDelayed(runnable, 50); + }); + mDialog.findViewById(R.id.pBridgeRequest).setOnClickListener(v -> { + final Handler handler = new Handler(); + Runnable runnable = () -> { + try{ + helperMethod.sendBridgeEmail(mContext); + } + catch (Exception ex){ + onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); + } + }; + handler.postDelayed(runnable, 200); + }); + + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + helperMethod.hideKeyboard(mContext); + mEvent.invokeObserver(Arrays.asList(((EditText)mDialog.findViewById(R.id.pBridgeInput)).getText().toString(), ((EditText)mDialog.findViewById(R.id.pBridgeType)).getText().toString()), M_SET_BRIDGES); + }); + } + + private void clearHistory() + { + initializeDialog(R.layout.popup_clear_history, Gravity.CENTER); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + mEvent.invokeObserver(null, M_CLEAR_HISTORY); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void clearBookmark() + { + initializeDialog(R.layout.popup_clear_bookmark, Gravity.CENTER); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + mEvent.invokeObserver(null, M_CLEAR_BOOKMARK); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void reportURL() + { + initializeDialog(R.layout.popup_report_url, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pHeader)).setText(mData.get(0).toString()); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + final Handler handler = new Handler(); + Runnable runnable = () -> onTrigger(Arrays.asList(strings.GENERIC_EMPTY_STR, mContext),M_RATE_SUCCESS); + handler.postDelayed(runnable, 1000); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void downloadSingle() + { + initializeDialog(R.layout.popup_download_url, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pDescription)).setText(mData.get(0).toString()); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + ArrayList tempData = new ArrayList<>(); + if(mData!=null){ + tempData.addAll(mData); + } + mDialog.dismiss(); + final Handler handler = new Handler(); + Runnable runnable = () -> mEvent.invokeObserver(tempData, M_DOWNLOAD_SINGLE); + handler.postDelayed(runnable, 1000); + onClearReference(); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void rateApp() + { + initializeDialog(R.layout.popup_rate_us, Gravity.CENTER); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + RatingBar mRatingBar = mDialog.findViewById(R.id.pRating); + if(mRatingBar.getRating()>=3){ + mEvent.invokeObserver(null, M_APP_RATED); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(CONST_PLAYSTORE_URL)); + try { + mContext.startActivity(intent); + } catch (Exception ignored) { + helperMethod.showToastMessage(MESSAGE_PLAYSTORE_NOT_FOUND, mContext); + } + + mDialog.dismiss(); + }else if(mRatingBar.getRating()>0) { + mEvent.invokeObserver(null, M_APP_RATED); + final Handler handler = new Handler(); + handler.postDelayed(() -> onTrigger(Arrays.asList(strings.GENERIC_EMPTY_STR, mContext),M_RATE_FAILURE), 1000); + mDialog.dismiss(); + } + }); + } + + private void downloadFileLongPress() + { + String title = mData.get(2).toString(); + + if(title.length()>0){ + title = title + " | "; + } + + initializeDialog(R.layout.popup_file_longpress, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pDescription)).setText((title + mData.get(0).toString())); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_DOWNLOAD_FILE_MANUAL); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_NEW_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK); + mDialog.dismiss(); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void openURLLongPress() + { + String title = mData.get(2).toString(); + + initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pDescription)).setText((title + mData.get(0))); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_NEW_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK); + mDialog.dismiss(); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void popupDownloadFull(){ + String url = mData.get(0).toString(); + String file = mData.get(2).toString(); + String title = mData.get(3).toString(); + + String data_local = mContext.getString(R.string.ALERT_LONG_URL_MESSAGE); + + if(!url.equals(strings.GENERIC_EMPTY_STR)){ + data_local = title + url; + } + else if(!file.equals(strings.GENERIC_EMPTY_STR)){ + data_local = file; + } + String mTitle = title; + if(mTitle.length()<=1){ + mTitle = mData.get(0).toString(); + } + + initializeDialog(R.layout.popup_download_full, Gravity.CENTER); + ((TextView) mDialog.findViewById(R.id.pHeader)).setText(mTitle); + ((TextView) mDialog.findViewById(R.id.pDescription)).setText((data_local)); + mDialog.findViewById(R.id.pOption1).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(url), M_OPEN_LINK_NEW_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption2).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(url), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption3).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(url), M_COPY_LINK); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption4).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(file), M_OPEN_LINK_NEW_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption5).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(file), M_OPEN_LINK_CURRENT_TAB); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption6).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(file), M_COPY_LINK); + mDialog.dismiss(); + }); + mDialog.findViewById(R.id.pOption7).setOnClickListener(v -> { + mEvent.invokeObserver(Collections.singletonList(file), M_DOWNLOAD_FILE_MANUAL); + mDialog.dismiss(); + }); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } + + private void sendBridgeMail() + { + initializeDialog(R.layout.popup_bridge_mail, Gravity.CENTER); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + mDialog.dismiss(); + final Handler handler = new Handler(); + Runnable runnable = () -> { + try{ + helperMethod.sendBridgeEmail(mContext); + } + catch (Exception ex){ + onTrigger(Arrays.asList(mContext, mContext.getString(R.string.ALERT_NOT_SUPPORTED_MESSAGE)),M_NOT_SUPPORTED); + } + }; + handler.postDelayed(runnable, 1000); + }); + } + + void onReset(){ + if(mDialog !=null){ + mDialog.dismiss(); + } + } + + /*External Triggers*/ + + public void onTrigger(List pData, pluginEnums.eMessageManager pEventType) + { + if(!pEventType.equals(M_RATE_FAILURE) && !pEventType.equals(M_RATE_SUCCESS) && !pEventType.equals(M_NOT_SUPPORTED)){ + onClearReference(); + } + if(pEventType.equals(pluginEnums.eMessageManager.M_RESET)){ + onReset(); + } + else { + this.mContext = (AppCompatActivity) pData.get(pData.size()-1); + this.mData = pData; + + switch (pEventType) { + case M_WELCOME: + /*VERIFIED*/ + welcomeMessage(); + break; + + case M_RATE_FAILURE: + /*VERIFIED*/ + rateFailure(); + break; + + case M_LANGUAGE_SUPPORT_FAILURE: + /*VERIFIED*/ + languageSupportFailure(); + break; + + case M_RATE_SUCCESS: + /*VERIFIED*/ + reportedSuccessfully(); + break; + + case M_BOOKMARK: + /*VERIFIED*/ + bookmark(); + break; + + case M_CLEAR_HISTORY: + /*VERIFIED*/ + clearHistory(); + break; + + case M_CLEAR_BOOKMARK: + /*VERIFIED*/ + clearBookmark(); + break; + + case M_REPORT_URL: + /*VERIFIED*/ + reportURL(); + break; + + case M_RATE_APP: + /*VERIFIED*/ + rateApp(); + break; + + case M_DOWNLOAD_FILE : + /*VERIFIED*/ + //downloadFileLongPress(); + break; + + case M_LONG_PRESS_DOWNLOAD : + /*VERIFIED*/ + downloadFileLongPress(); + break; + + case M_LONG_PRESS_URL: + /*VERIFIED*/ + openURLLongPress(); + break; + + case M_LONG_PRESS_WITH_LINK: + /*VERIFIED*/ + popupDownloadFull(); + break; + + case M_BRIDGE_MAIL: + /*VERIFIED*/ + sendBridgeMail(); + break; + + case M_NOT_SUPPORTED: + /*VERIFIED*/ + notSupportMessage(); + break; + + case M_PANIC_RESET: + /*VERIFIED*/ + onPanic(); + break; + + case M_DATA_CLEARED: + /*VERIFIED*/ + dataClearedSuccessfully(); + break; + + case M_SECURE_CONNECTION: + /*VERIFIED*/ + openSecureConnectionPopup(); + break; + + case M_DOWNLOAD_SINGLE: + /*VERIFIED*/ + downloadSingle(); + break; + + case M_UPDATE_BRIDGES: + /*VERIFIED*/ + onUpdateBridges(); + break; + + case M_NEW_IDENTITY: + /*VERIFIED*/ + newIdentityCreated(); + break; + + case M_DOWNLOAD_FAILURE: + /*VERIFIED*/ + mDownloadFailure(); + break; + + case M_POPUP_BLOCKED: + /*VERIFIED*/ + popupBlocked(); + break; + + case M_MAX_TAB_REACHED: + /*VERIFIED*/ + maxTabReached(); + break; + } + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java new file mode 100644 index 00000000..579df878 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java @@ -0,0 +1,92 @@ +package com.darkweb.genesissearchengine.pluginManager.notificationPluginManager; + +import android.app.Notification ; +import android.app.NotificationChannel ; +import android.app.NotificationManager ; +import android.app.PendingIntent; +import android.content.BroadcastReceiver ; +import android.content.Context ; +import android.content.Intent ; +import android.graphics.Color; +import android.os.Build; +import android.util.Log; + +import androidx.core.app.NotificationCompat; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; +import com.example.myapplication.R; + +import java.util.Random; + +public class localEngagementManager extends BroadcastReceiver { + + + public void onReceive (Context context , Intent intent) { + try{ + final int NOTIFY_ID = status.mNotificationID; + String pTitle = strings.NOTIFICATION_TITLE; + String pBody = strings.NOTIFICATION_BODY[new Random().nextInt(strings.NOTIFICATION_BODY.length)]; + + String name = "NOTIFICATION:INDENTIFIER:1001"; + String id = "NOTIFICATION:INDENTIFIER:1001"; + String description = "NOTIFICATION:INDENTIFIER:1001"; + + + NotificationCompat.Builder builder; + NotificationManager mNotifManager = (NotificationManager)context.getSystemService(Context. NOTIFICATION_SERVICE ) ; + + if (mNotifManager == null) { + mNotifManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + int importance = NotificationManager.IMPORTANCE_HIGH; + NotificationChannel mChannel = mNotifManager.getNotificationChannel(id); + if (mChannel == null) { + mChannel = new NotificationChannel(id, name, importance); + mChannel.setDescription(description); + mChannel.enableVibration(true); + mChannel.setLightColor(Color.GREEN); + mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); + mNotifManager.createNotificationChannel(mChannel); + } + builder = new NotificationCompat.Builder(context, id); + + Intent mIntent = activityContextManager.getInstance().getHomeController().getIntent(); + PendingIntent pendIntent = PendingIntent.getActivity(activityContextManager.getInstance().getCurrentActivity(), 0, mIntent, PendingIntent.FLAG_ONE_SHOT); + + builder.setContentTitle(pTitle) // required + .setSmallIcon(R.mipmap.ic_stat_tor_logo) // required + .setContentText(pBody) // required + .setDefaults(Notification.DEFAULT_ALL) + .setAutoCancel(true) + .setCategory(Notification.CATEGORY_SERVICE) + .setContentIntent(pendIntent) + .setTicker(pTitle) + .setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); + } else { + + builder = new NotificationCompat.Builder(context); + Intent mIntent = activityContextManager.getInstance().getHomeController().getIntent(); + PendingIntent pendIntent = PendingIntent.getActivity(activityContextManager.getInstance().getCurrentActivity(), 0, mIntent, PendingIntent. FLAG_ONE_SHOT); + + builder.setContentTitle(pTitle) // required + .setSmallIcon(R.mipmap.ic_stat_tor_logo) // required + .setContentText(pBody) // required + .setDefaults(Notification.DEFAULT_ALL) + .setAutoCancel(true) + .setContentIntent(pendIntent) + .setCategory(Notification.CATEGORY_SERVICE) + .setTicker(pTitle) + .setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}) + .setPriority(Notification.PRIORITY_HIGH); + } + + Notification notification = builder.build(); + mNotifManager.notify(NOTIFY_ID, notification); + }catch (Exception ex){ + Log.i("",""); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notifictionManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java similarity index 86% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notifictionManager.java rename to app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java index 893e835e..45a9121e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notifictionManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.pluginManager; +package com.darkweb.genesissearchengine.pluginManager.notificationPluginManager; import android.app.AlarmManager; import android.app.Notification; @@ -12,13 +12,13 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.eventObserver; -import com.darkweb.genesissearchengine.helperManager.userEngagementNotification; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; import java.lang.ref.WeakReference; import java.util.List; import static com.darkweb.genesissearchengine.constants.constants.*; -class notifictionManager +public class notifictionManager { /*Private Variables*/ @@ -26,7 +26,7 @@ class notifictionManager /*Initializations*/ - notifictionManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ + public notifictionManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ this.mAppContext = pAppContext; onNotificationClear(); } @@ -41,7 +41,7 @@ class notifictionManager } private void onSchedule(Notification pNotification , int pDelay){ - Intent notificationIntent = new Intent( mAppContext.get().getApplicationContext(), userEngagementNotification.class) ; + Intent notificationIntent = new Intent( mAppContext.get().getApplicationContext(), localEngagementManager.class) ; notificationIntent.putExtra(CONST_NOTIFICATION_ID_NAME, CONST_NOTIFICATION_ID_VALUE) ; notificationIntent.putExtra(CONST_NOTIFICATION_ID_NAME, pNotification) ; PendingIntent pendingIntent = PendingIntent. getBroadcast ( mAppContext.get().getApplicationContext(), CONST_NOTIFICATION_REQUEST_CODE, notificationIntent , PendingIntent. FLAG_UPDATE_CURRENT ) ; @@ -63,7 +63,7 @@ class notifictionManager /*External Triggers*/ - Object onTrigger(List pData, pluginEnums.eNotificationManager pEventType) { + public Object onTrigger(List pData, pluginEnums.eNotificationManager pEventType) { if(pEventType.equals(pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION)) { onCreateUserEngagementNotification((int)pData.get(0)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java old mode 100755 new mode 100644 similarity index 96% rename from app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java rename to app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java index 0e74a8de..8cff22a8 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java @@ -1,280 +1,281 @@ -package com.darkweb.genesissearchengine.pluginManager; - -import android.content.Intent; -import android.os.Build; -import androidx.appcompat.app.AppCompatActivity; -import org.mozilla.gecko.PrefsHelper; -import org.torproject.android.proxy.OrbotService; -import org.torproject.android.proxy.util.Prefs; -import org.torproject.android.service.wrapper.orbotLocalConstants; - -import java.lang.ref.WeakReference; -import java.util.List; -import com.darkweb.genesissearchengine.constants.*; -import com.darkweb.genesissearchengine.eventObserver; - -import static org.torproject.android.proxy.TorServiceConstants.ACTION_START; - -// https://github.com/guardianproject/orbot/blob/8fca5f8ecddb4da9565ac3fd8936e4f28acdd352/BUILD.md -class orbotManager -{ - - /*Private Variables*/ - - private WeakReference mAppContext; - private boolean mLogsStarted = false; - - /*Initialization*/ - - private static orbotManager sOurInstance = new orbotManager(); - public static orbotManager getInstance() - { - return sOurInstance; - } - - public void initialize(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, int pNotificationStatus){ - this.mAppContext = new WeakReference(pAppContext); - - onInitNotificationStatus(pNotificationStatus); - } - - public void onRemoveInstances(){ - this.mAppContext = null; - } - - private void onStartOrbot(){ - orbotLocalConstants.mBridges = status.sBridgeCustomBridge; - orbotLocalConstants.mIsManualBridge = status.sBridgeGatewayManual; - orbotLocalConstants.mManualBridgeType = status.sBridgeCustomType; - Prefs.putBridgesEnabled(status.sBridgeStatus); - Intent mServiceIntent = new Intent(mAppContext.get().getApplicationContext(), OrbotService.class); - mServiceIntent.setAction(ACTION_START); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - mAppContext.get().stopService(mServiceIntent); - mAppContext.get().startForegroundService(mServiceIntent); - } - else - { - mAppContext.get().startService(mServiceIntent); - } - - initializeProxy(); - } - - /*Helper Methods*/ - - private int onGetNotificationStatus(){ - return orbotLocalConstants.mNotificationStatus; - } - private void onInitNotificationStatus(int status){ - orbotLocalConstants.mNotificationStatus = status; - } - private void onEnableTorNotification(){ - OrbotService.getServiceObject().enableNotification(); - } - private void onDisableTorNotification(){ - OrbotService.getServiceObject().disableNotification(); - } - private void onEnableTorNotificationNoBandwidth(){ - OrbotService service = OrbotService.getServiceObject(); - if(service!=null){ - OrbotService.getServiceObject().enableTorNotificationNoBandwidth(); - } - } - - private void onUpdateBridges(boolean p_status){ - Prefs.putBridgesEnabled(p_status); - } - private void onUpdateVPN(boolean p_status){ - Prefs.putUseVpn(p_status); - } - - /*Proxy Manager*/ - - private void onSetProxy(String url){ - /* if(url.contains("genesishiddentechnologies.com")){ - PrefsHelper.setPref(keys.PROXY_TYPE, 0); - PrefsHelper.setPref(keys.PROXY_SOCKS,null); - PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, null); - PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,null); - PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,null); - } - else { - PrefsHelper.setPref(keys.PROXY_TYPE, 1); - PrefsHelper.setPref(keys.PROXY_SOCKS,constants.CONST_PROXY_SOCKS); - PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050); - PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); - PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); - } */ - - PrefsHelper.setPref(keys.PROXY_TYPE, 1); - PrefsHelper.setPref(keys.PROXY_SOCKS,constants.CONST_PROXY_SOCKS); - PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050); - PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); - PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); - } - - private void initializeProxy() - { - PrefsHelper.setPref(keys.PROXY_TYPE, 0); - PrefsHelper.setPref(keys.PROXY_SOCKS,null); - PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, null); - PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,null); - PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,null); - - PrefsHelper.setPref(keys.PROXY_TYPE, 1); - PrefsHelper.setPref(keys.PROXY_SOCKS,constants.CONST_PROXY_SOCKS); - PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050); - PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); - PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); - - PrefsHelper.setPref(keys.PROXY_CACHE,constants.CONST_PROXY_CACHE); - PrefsHelper.setPref(keys.PROXY_MEMORY,constants.CONST_PROXY_MEMORY); - PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_ENABLED,constants.CONST_PROXY_DO_NOT_TRACK_HEADER_ENABLED); - PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_VALUE,constants.CONST_PROXY_DO_NOT_TRACK_HEADER_VALUE); - - PrefsHelper.setPref("browser.cache.disk.enable",true); - PrefsHelper.setPref("browser.cache.memory.enable",true); - PrefsHelper.setPref("browser.cache.disk.capacity",1000); - - onUpdatePrivacyPreferences(); - } - - private void onUpdatePrivacyPreferences() - { - PrefsHelper.setPref(keys.PROXY_IMAGE, status.sShowImages); - PrefsHelper.setPref("browser.display.show_image_placeholders",true); - PrefsHelper.setPref("browser.cache.disk.enable",false); - PrefsHelper.setPref("browser.cache.memory.enable",true); - PrefsHelper.setPref("browser.cache.disk.capacity",0); - PrefsHelper.setPref("privacy.resistFingerprinting",true); - PrefsHelper.setPref("privacy.clearOnShutdown.cache",status.sClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.downloads",status.sClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.formdata",status.sClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.history",status.sClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",status.sClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.passwords",status.sClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.sessions",status.sClearOnExit); - PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",status.sClearOnExit); - PrefsHelper.setPref("privacy.donottrackheader.enabled",false); - PrefsHelper.setPref("privacy.donottrackheader.value",1); - PrefsHelper.setPref("network.http.sendRefererHeader", 0); - PrefsHelper.setPref("security.OCSP.require", true); - PrefsHelper.setPref("security.checkloaduri",true); - PrefsHelper.setPref("security.mixed_content.block_display_content", true); - PrefsHelper.setPref("media.peerconnection.enabled",false); //webrtc disabled - } - - /*Log Manager*/ - - private String getLogs() - { - String logs = orbotLocalConstants.mTorLogsStatus; - - if(orbotLocalConstants.mTorLogsStatus.equals("No internet connection")){ - return "Warning | " + orbotLocalConstants.mTorLogsStatus; - } - - if(!logs.contains("Bootstrapped") && !mLogsStarted){ - logs = "Initializing Bootstrap"; - mLogsStarted = true; - } - - if(!logs.equals(strings.GENERIC_EMPTY_STR)) - { - String Logs = logs; - Logs="Installing | " + Logs.replace("FAILED","Securing"); - return Logs; - } - return "Loading Please Wait"; - } - - private boolean isOrbotRunning(){ - return orbotLocalConstants.mIsTorInitialized; - } - - private void newCircuit(){ - OrbotService.getServiceObject().newIdentity(); - } - - private String getOrbotStatus(){ - return OrbotService.getServiceObject().getProxyStatus(); - } - - private void onDestroy(){ - if(!status.mThemeApplying) { - OrbotService.getServiceObject().onDestroy(); - } - } - - /*External Triggers*/ - - Object onTrigger(List pData, pluginEnums.eOrbotManager pEventType) { - if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_NOTIFICATION_STATUS)) - { - return onGetNotificationStatus(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION)) - { - onEnableTorNotification(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION)) - { - onDisableTorNotification(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION_NO_BANDWIDTH)) - { - onEnableTorNotificationNoBandwidth(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_LOGS)) - { - return getLogs(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_PRIVACY)) - { - onUpdatePrivacyPreferences(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_START_ORBOT)) - { - onStartOrbot(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_IS_ORBOT_RUNNING)) - { - isOrbotRunning(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS)) - { - return getOrbotStatus(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_VPN)) - { - onUpdateVPN((boolean)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_BRIDGES)) - { - onUpdateBridges((boolean)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_SET_PROXY)) - { - onSetProxy((String)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_SHOW_NOTIFICATION_STATUS)) - { - onInitNotificationStatus((int)pData.get(0)); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_ORBOT_RUNNING)) - { - return isOrbotRunning(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_NEW_CIRCUIT)) - { - newCircuit(); - } - else if(pEventType.equals(pluginEnums.eOrbotManager.M_DESTROY)) - { - onDestroy(); - } - return null; - } - -} +package com.darkweb.genesissearchengine.pluginManager.orbotPluginManager; + +import android.content.Intent; +import android.os.Build; +import androidx.appcompat.app.AppCompatActivity; +import org.mozilla.gecko.PrefsHelper; +import org.torproject.android.proxy.OrbotService; +import org.torproject.android.proxy.util.Prefs; +import org.torproject.android.service.wrapper.orbotLocalConstants; + +import java.lang.ref.WeakReference; +import java.util.List; +import com.darkweb.genesissearchengine.constants.*; +import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; + +import static org.torproject.android.proxy.TorServiceConstants.ACTION_START; + +// https://github.com/guardianproject/orbot/blob/8fca5f8ecddb4da9565ac3fd8936e4f28acdd352/BUILD.md +public class orbotManager +{ + + /*Private Variables*/ + + private WeakReference mAppContext; + private boolean mLogsStarted = false; + + /*Initialization*/ + + private static orbotManager sOurInstance = new orbotManager(); + public static orbotManager getInstance() + { + return sOurInstance; + } + + public void initialize(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, int pNotificationStatus){ + this.mAppContext = new WeakReference(pAppContext); + + onInitNotificationStatus(pNotificationStatus); + } + + public void onRemoveInstances(){ + this.mAppContext = null; + } + + private void onStartOrbot(){ + orbotLocalConstants.mBridges = status.sBridgeCustomBridge; + orbotLocalConstants.mIsManualBridge = status.sBridgeGatewayManual; + orbotLocalConstants.mManualBridgeType = status.sBridgeCustomType; + Prefs.putBridgesEnabled(status.sBridgeStatus); + Intent mServiceIntent = new Intent(mAppContext.get().getApplicationContext(), OrbotService.class); + mServiceIntent.setAction(ACTION_START); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + mAppContext.get().stopService(mServiceIntent); + mAppContext.get().startForegroundService(mServiceIntent); + } + else + { + mAppContext.get().startService(mServiceIntent); + } + + initializeProxy(); + } + + /*Helper Methods*/ + + private int onGetNotificationStatus(){ + return orbotLocalConstants.mNotificationStatus; + } + private void onInitNotificationStatus(int status){ + orbotLocalConstants.mNotificationStatus = status; + } + private void onEnableTorNotification(){ + OrbotService.getServiceObject().enableNotification(); + } + private void onDisableTorNotification(){ + OrbotService.getServiceObject().disableNotification(); + } + private void onEnableTorNotificationNoBandwidth(){ + OrbotService service = OrbotService.getServiceObject(); + if(service!=null){ + OrbotService.getServiceObject().enableTorNotificationNoBandwidth(); + } + } + + private void onUpdateBridges(boolean p_status){ + Prefs.putBridgesEnabled(p_status); + } + private void onUpdateVPN(boolean p_status){ + Prefs.putUseVpn(p_status); + } + + /*Proxy Manager*/ + + private void onSetProxy(String url){ + /* if(url.contains("genesishiddentechnologies.com")){ + PrefsHelper.setPref(keys.PROXY_TYPE, 0); + PrefsHelper.setPref(keys.PROXY_SOCKS,null); + PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, null); + PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,null); + PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,null); + } + else { + PrefsHelper.setPref(keys.PROXY_TYPE, 1); + PrefsHelper.setPref(keys.PROXY_SOCKS,constants.CONST_PROXY_SOCKS); + PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050); + PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); + PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); + } */ + + PrefsHelper.setPref(keys.PROXY_TYPE, 1); + PrefsHelper.setPref(keys.PROXY_SOCKS,constants.CONST_PROXY_SOCKS); + PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050); + PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); + PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); + } + + private void initializeProxy() + { + PrefsHelper.setPref(keys.PROXY_TYPE, 0); + PrefsHelper.setPref(keys.PROXY_SOCKS,null); + PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, null); + PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,null); + PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,null); + + PrefsHelper.setPref(keys.PROXY_TYPE, 1); + PrefsHelper.setPref(keys.PROXY_SOCKS,constants.CONST_PROXY_SOCKS); + PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, 9050); + PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); + PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); + + PrefsHelper.setPref(keys.PROXY_CACHE,constants.CONST_PROXY_CACHE); + PrefsHelper.setPref(keys.PROXY_MEMORY,constants.CONST_PROXY_MEMORY); + PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_ENABLED,constants.CONST_PROXY_DO_NOT_TRACK_HEADER_ENABLED); + PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_VALUE,constants.CONST_PROXY_DO_NOT_TRACK_HEADER_VALUE); + + PrefsHelper.setPref("browser.cache.disk.enable",true); + PrefsHelper.setPref("browser.cache.memory.enable",true); + PrefsHelper.setPref("browser.cache.disk.capacity",1000); + + onUpdatePrivacyPreferences(); + } + + private void onUpdatePrivacyPreferences() + { + PrefsHelper.setPref(keys.PROXY_IMAGE, status.sShowImages); + PrefsHelper.setPref("browser.display.show_image_placeholders",true); + PrefsHelper.setPref("browser.cache.disk.enable",false); + PrefsHelper.setPref("browser.cache.memory.enable",true); + PrefsHelper.setPref("browser.cache.disk.capacity",0); + PrefsHelper.setPref("privacy.resistFingerprinting",true); + PrefsHelper.setPref("privacy.clearOnShutdown.cache",status.sClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.downloads",status.sClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.formdata",status.sClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.history",status.sClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",status.sClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.passwords",status.sClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.sessions",status.sClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",status.sClearOnExit); + PrefsHelper.setPref("privacy.donottrackheader.enabled",false); + PrefsHelper.setPref("privacy.donottrackheader.value",1); + PrefsHelper.setPref("network.http.sendRefererHeader", 0); + PrefsHelper.setPref("security.OCSP.require", true); + PrefsHelper.setPref("security.checkloaduri",true); + PrefsHelper.setPref("security.mixed_content.block_display_content", true); + PrefsHelper.setPref("media.peerconnection.enabled",false); //webrtc disabled + } + + /*Log Manager*/ + + private String getLogs() + { + String logs = orbotLocalConstants.mTorLogsStatus; + + if(orbotLocalConstants.mTorLogsStatus.equals("No internet connection")){ + return "Warning | " + orbotLocalConstants.mTorLogsStatus; + } + + if(!logs.contains("Bootstrapped") && !mLogsStarted){ + logs = "Initializing Bootstrap"; + mLogsStarted = true; + } + + if(!logs.equals(strings.GENERIC_EMPTY_STR)) + { + String Logs = logs; + Logs="Installing | " + Logs.replace("FAILED","Securing"); + return Logs; + } + return "Loading Please Wait"; + } + + private boolean isOrbotRunning(){ + return orbotLocalConstants.mIsTorInitialized; + } + + private void newCircuit(){ + OrbotService.getServiceObject().newIdentity(); + } + + private String getOrbotStatus(){ + return OrbotService.getServiceObject().getProxyStatus(); + } + + private void onDestroy(){ + if(!status.mThemeApplying) { + OrbotService.getServiceObject().onDestroy(); + } + } + + /*External Triggers*/ + + public Object onTrigger(List pData, pluginEnums.eOrbotManager pEventType) { + if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_NOTIFICATION_STATUS)) + { + return onGetNotificationStatus(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION)) + { + onEnableTorNotification(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION)) + { + onDisableTorNotification(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION_NO_BANDWIDTH)) + { + onEnableTorNotificationNoBandwidth(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_LOGS)) + { + return getLogs(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_PRIVACY)) + { + onUpdatePrivacyPreferences(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_START_ORBOT)) + { + onStartOrbot(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_IS_ORBOT_RUNNING)) + { + isOrbotRunning(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_GET_ORBOT_STATUS)) + { + return getOrbotStatus(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_VPN)) + { + onUpdateVPN((boolean)pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_BRIDGES)) + { + onUpdateBridges((boolean)pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_SET_PROXY)) + { + onSetProxy((String)pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_SHOW_NOTIFICATION_STATUS)) + { + onInitNotificationStatus((int)pData.get(0)); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_ORBOT_RUNNING)) + { + return isOrbotRunning(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_NEW_CIRCUIT)) + { + newCircuit(); + } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_DESTROY)) + { + onDestroy(); + } + return null; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java index f719b6ae..9d4401c2 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java @@ -14,11 +14,20 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.adPluginManager.adManager; +import com.darkweb.genesissearchengine.pluginManager.analyticPluginManager.analyticManager; +import com.darkweb.genesissearchengine.pluginManager.downloadPluginManager.downloadManager; +import com.darkweb.genesissearchengine.pluginManager.langPluginManager.langManager; +import com.darkweb.genesissearchengine.pluginManager.messagePluginManager.messageManager; +import com.darkweb.genesissearchengine.pluginManager.notificationPluginManager.notifictionManager; +import com.darkweb.genesissearchengine.pluginManager.orbotPluginManager.orbotManager; + import java.lang.ref.WeakReference; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; + import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eAdManagerCallbacks.M_SHOW_LOADED_ADS; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.*; @@ -28,7 +37,7 @@ public class pluginController /*Plugin Instance*/ private adManager mAdManager; - private com.darkweb.genesissearchengine.pluginManager.analyticManager mAnalyticsManager; + private com.darkweb.genesissearchengine.pluginManager.analyticPluginManager.analyticManager mAnalyticsManager; private messageManager mMessageManager; private notifictionManager mNotificationManager; private activityContextManager mContextManager; @@ -70,7 +79,7 @@ public class pluginController mNotificationManager = new notifictionManager(mHomeController,new notificationCallback()); mAdManager = new adManager(new admobCallback(), ((homeController)mHomeController.get()).getBannerAd(), status.sPaidStatus); - mAnalyticsManager = new com.darkweb.genesissearchengine.pluginManager.analyticManager(mHomeController,new analyticManager()); + mAnalyticsManager = new analyticManager(mHomeController,new analyticCallback()); mMessageManager = new messageManager(new messageCallback()); mOrbotManager = orbotManager.getInstance(); mDownloadManager = new downloadManager(mHomeController,new downloadCallback()); @@ -109,7 +118,7 @@ public class pluginController /*Analytics Manager*/ - private class analyticManager implements eventObserver.eventListener{ + private class analyticCallback implements eventObserver.eventListener{ @Override public Object invokeObserver(List data, Object event_type) { return null; } } @@ -205,10 +214,7 @@ public class pluginController ((homeController)mHomeController.get()).onLoadURL(pData.get(0).toString()); } else if(pEventType.equals(M_PANIC_RESET)){ - new Handler().postDelayed(() -> - { - activityContextManager.getInstance().getHomeController().panicExitInvoked(); - }, 300); + new Handler().postDelayed(() -> activityContextManager.getInstance().getHomeController().panicExitInvoked(), 300); } else if(pEventType.equals(M_DOWNLOAD_SINGLE)){ if(pData.size()<3){ 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 8fcf4518..7b4428f6 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java @@ -36,7 +36,7 @@ public class pluginEnums /*Download Manager*/ public enum eDownloadManager{ - M_DOWNLOAD_FILE, M_CANCEL, M_TRIGGER + M_DOWNLOAD_FILE, M_CANCEL, M_TRIGGER, M_START_SERVICE, M_DOWNLOAD_BLOB } /*Notification Manager*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/downloadNotification.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java similarity index 85% rename from app/src/main/java/com/darkweb/genesissearchengine/helperManager/downloadNotification.java rename to app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java index 8c250570..47d02bcf 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/downloadNotification.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.helperManager; +package com.darkweb.genesissearchengine.pluginManager.pluginReciever; import android.content.BroadcastReceiver; import android.content.Context; @@ -7,7 +7,7 @@ import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import java.util.Collections; -public class downloadNotification extends BroadcastReceiver { +public class downloadNotificationReciever extends BroadcastReceiver { public void onReceive (Context context , Intent intent) { int mCommand = intent.getExtras().getInt("N_COMMAND"); if(mCommand==1){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/widget/progressBar/AnimatedProgressBar.java b/app/src/main/java/com/darkweb/genesissearchengine/widget/progressBar/AnimatedProgressBar.java deleted file mode 100644 index 70668aaf..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/widget/progressBar/AnimatedProgressBar.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.darkweb.genesissearchengine.widget.progressBar; - -import android.animation.ValueAnimator; -import android.animation.ValueAnimator.AnimatorUpdateListener; -import android.content.Context; -import android.util.AttributeSet; -import android.view.animation.Interpolator; -import android.view.animation.LinearInterpolator; -import android.widget.ProgressBar; - -public class AnimatedProgressBar extends ProgressBar { - - private static final Interpolator DEFAULT_INTERPOLATER = new LinearInterpolator(); - - private ValueAnimator animator; - private boolean animate = true; - - public AnimatedProgressBar(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - public AnimatedProgressBar(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public AnimatedProgressBar(Context context) { - super(context); - } - - public boolean isAnimate() { - return animate; - } - - public void setAnimate(boolean animate) { - this.animate = animate; - } - - @Override - public synchronized void setProgress(int progress) { - if (animator != null){ - animator.cancel(); - } - if (animator == null) { - animator = ValueAnimator.ofInt(getProgress(), progress); - animator.setInterpolator(DEFAULT_INTERPOLATER); - animator.setDuration(100); - animator.addUpdateListener(animation -> AnimatedProgressBar.super.setProgress((Integer) animation.getAnimatedValue())); - } else{ - animator.setIntValues(getProgress(), progress); - } - animator.start(); - - } - - @Override - public synchronized void setSecondaryProgress(int secondaryProgress) { - /*if (!animate) { - super.setSecondaryProgress(secondaryProgress); - return; - } - if (animatorSecondary != null) - animatorSecondary.cancel(); - if (animatorSecondary == null) { - animatorSecondary = ValueAnimator.ofInt(getProgress(), secondaryProgress); - animatorSecondary.setInterpolator(DEFAULT_INTERPOLATER); - animatorSecondary.addUpdateListener(new AnimatorUpdateListener() { - - @Override - public void onAnimationUpdate(ValueAnimator animation) { - AnimatedProgressBar.super.setSecondaryProgress((Integer) animation - .getAnimatedValue()); - } - }); - } else - animatorSecondary.setIntValues(getProgress(), secondaryProgress); - animatorSecondary.start();*/ - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - //if (animator != null) - //animator.cancel(); - //if (animatorSecondary != null) - //animatorSecondary.cancel(); - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/widget/progressBar/DrawableWrapper.java b/app/src/main/java/com/darkweb/genesissearchengine/widget/progressBar/DrawableWrapper.java deleted file mode 100644 index 767bcf25..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/widget/progressBar/DrawableWrapper.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.darkweb.genesissearchengine.widget.progressBar; - -import android.content.res.Resources; -import android.graphics.Canvas; -import android.graphics.ColorFilter; -import android.graphics.PorterDuff; -import android.graphics.Rect; -import android.graphics.Region; -import android.graphics.drawable.Drawable; -import androidx.annotation.IntRange; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.util.AttributeSet; - -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import java.io.IOException; - -/** - * DrawableWrapper was added since API Level 23. But in v7 support library, it has annotation - * "@RestrictTo(LIBRARY_GROUP)". Hence we should not extends it, so we create this wrapper for now. - * Once we start to support API 23, or v7-support-library allows us to extends its DrawableWrapper, - * then this file can be removed. - */ - -public class DrawableWrapper extends Drawable { - - private final Drawable mWrapped; - - public DrawableWrapper(@NonNull Drawable drawable) { - mWrapped = drawable; - } - - public Drawable getWrappedDrawable() { - return mWrapped; - } - - @Override - public void draw(@NonNull Canvas canvas) { - mWrapped.draw(canvas); - } - - @Override - public int getChangingConfigurations() { - return mWrapped.getChangingConfigurations(); - } - - @Override - public Drawable.ConstantState getConstantState() { - return mWrapped.getConstantState(); - } - - @Override - public Drawable getCurrent() { - return mWrapped.getCurrent(); - } - - @Override - public int getIntrinsicHeight() { - return mWrapped.getIntrinsicHeight(); - } - - @Override - public int getIntrinsicWidth() { - return mWrapped.getIntrinsicWidth(); - } - - @Override - public int getMinimumHeight() { - return mWrapped.getMinimumHeight(); - } - - @Override - public int getMinimumWidth() { - return mWrapped.getMinimumWidth(); - } - - @Override - public int getOpacity() { - return mWrapped.getOpacity(); - } - - @Override - public boolean getPadding(Rect padding) { - return mWrapped.getPadding(padding); - } - - @Override - public int[] getState() { - return mWrapped.getState(); - } - - @Override - public Region getTransparentRegion() { - return mWrapped.getTransparentRegion(); - } - - @Override - public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs) - throws XmlPullParserException, IOException { - mWrapped.inflate(r, parser, attrs); - } - - @Override - public boolean isStateful() { - return mWrapped.isStateful(); - } - - @Override - public void jumpToCurrentState() { - mWrapped.jumpToCurrentState(); - } - - @Override - public Drawable mutate() { - return mWrapped.mutate(); - } - - @Override - public void setAlpha(@IntRange(from = 0, to = 255) int i) { - mWrapped.setAlpha(i); - } - - @Override - public void scheduleSelf(Runnable what, long when) { - mWrapped.scheduleSelf(what, when); - } - - @Override - public void setChangingConfigurations(int configs) { - mWrapped.setChangingConfigurations(configs); - } - - @Override - public void setColorFilter(@Nullable ColorFilter colorFilter) { - mWrapped.setColorFilter(colorFilter); - } - - @Override - public void setColorFilter(int color, PorterDuff.Mode mode) { - mWrapped.setColorFilter(color, mode); - } - - @Override - public void setFilterBitmap(boolean filter) { - mWrapped.setFilterBitmap(filter); - } - - @Override - public boolean setVisible(boolean visible, boolean restart) { - return mWrapped.setVisible(visible, restart); - } - - @Override - public void unscheduleSelf(Runnable what) { - mWrapped.unscheduleSelf(what); - } - - @Override - protected void onBoundsChange(Rect bounds) { - mWrapped.setBounds(bounds); - } - - @Override - protected boolean onLevelChange(int level) { - return mWrapped.setLevel(level); - } - - @Override - protected boolean onStateChange(int[] state) { - return mWrapped.setState(state); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/widget/progressBar/ShiftDrawable.java b/app/src/main/java/com/darkweb/genesissearchengine/widget/progressBar/ShiftDrawable.java deleted file mode 100644 index a24486ca..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/widget/progressBar/ShiftDrawable.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.darkweb.genesissearchengine.widget.progressBar; - -import android.animation.Animator; -import android.animation.ValueAnimator; -import android.graphics.Canvas; -import android.graphics.Path; -import android.graphics.Rect; -import android.graphics.drawable.Drawable; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import android.view.animation.Interpolator; -import android.view.animation.LinearInterpolator; - -public class ShiftDrawable extends DrawableWrapper { - - private final ValueAnimator mAnimator = ValueAnimator.ofFloat(0f, 1f); - private final Rect mVisibleRect = new Rect(); - private Path mPath; - - // align to ScaleDrawable implementation - private static final int MAX_LEVEL = 10000; - - private static final int DEFAULT_DURATION = 1000; - - public ShiftDrawable(@NonNull Drawable d) { - this(d, DEFAULT_DURATION); - } - - public ShiftDrawable(@NonNull Drawable d, int duration) { - this(d, duration, new LinearInterpolator()); - } - - public ShiftDrawable(@NonNull Drawable d, int duration, @Nullable Interpolator interpolator) { - super(d); - mAnimator.setDuration(duration); - mAnimator.setRepeatCount(ValueAnimator.INFINITE); - mAnimator.setInterpolator((interpolator == null) ? new LinearInterpolator() : interpolator); - mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - if (isVisible()) { - invalidateSelf(); - } - } - }); - mAnimator.start(); - } - - public Animator getAnimator() { - return mAnimator; - } - - @Override - public boolean setVisible(boolean visible, boolean restart) { - final boolean result = super.setVisible(visible, restart); - if (isVisible()) { - mAnimator.start(); - } else { - mAnimator.end(); - } - return result; - } - - @Override - protected void onBoundsChange(Rect bounds) { - super.onBoundsChange(bounds); - updateBounds(); - } - - @Override - protected boolean onLevelChange(int level) { - final boolean result = super.onLevelChange(level); - updateBounds(); - return result; - } - - @Override - public void draw(Canvas canvas) { - final Drawable d = getWrappedDrawable(); - final float fraction = mAnimator.getAnimatedFraction(); - final int width = mVisibleRect.width(); - final int offset = (int) (width * fraction); - final int stack = canvas.save(); - - canvas.clipPath(mPath); - - // shift from right to left. - // draw left-half part - canvas.save(); - canvas.translate(-offset, 0); - d.draw(canvas); - canvas.restore(); - - // draw right-half part - canvas.save(); - canvas.translate(width - offset, 0); - d.draw(canvas); - canvas.restore(); - - canvas.restoreToCount(stack); - } - - private void updateBounds() { - final Rect b = getBounds(); - final int width = (int) ((float) b.width() * getLevel() / MAX_LEVEL); - final float radius = b.height() / 2f; - mVisibleRect.set(b.left, b.top, b.left + width, b.height()); - - // draw round to head of progressbar. I know it looks stupid, don't blame me now. - mPath = new Path(); - mPath.addRect(b.left, b.top, b.left + width - radius, b.height(), Path.Direction.CCW); - mPath.addCircle(b.left + width - radius, radius, radius, Path.Direction.CCW); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/widget/search/searchWidgetManager.java b/app/src/main/java/com/widget/search/searchWidgetManager.java index 3bbef96a..535e8269 100644 --- a/app/src/main/java/com/widget/search/searchWidgetManager.java +++ b/app/src/main/java/com/widget/search/searchWidgetManager.java @@ -3,28 +3,29 @@ package com.widget.search; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; -import android.appwidget.AppWidgetProviderInfo; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.os.Bundle; -import android.util.Log; import android.widget.RemoteViews; - -import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.constants.strings; -import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; +import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; +import static com.darkweb.genesissearchengine.constants.constants.CONST_WIDGET_NAME; + public class searchWidgetManager extends AppWidgetProvider { - private static final String SHARED_PREF_FILE = "com.example.android.appwidgetsample"; + /* Local Variables */ + + private static final String SHARED_PREF_FILE = CONST_WIDGET_NAME; private static final String COUNT_KEY = "count"; private static int mCurrentWidth = -1; + /* Navigator Initializations */ + private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { SharedPreferences prefs = context.getSharedPreferences(SHARED_PREF_FILE, 0); @@ -59,58 +60,73 @@ public class searchWidgetManager extends AppWidgetProvider { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); - if(action.equals("mOpenApplication")){ - status.sWidgetResponse = enums.WidgetResponse.SEARCHBAR; - Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage("com.darkweb.genesissearchengine"); - launchIntent.putExtra("mOpenApplication",true); - context.startActivity(launchIntent); - } - else if(action.equals("mOpenVoice")){ - status.sWidgetResponse = enums.WidgetResponse.VOICE; - Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage("com.darkweb.genesissearchengine"); - launchIntent.putExtra("mOpenApplication",true); - context.startActivity(launchIntent); - } - else if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)) { - Bundle extras = intent.getExtras(); - if (extras != null) { - int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); - if (appWidgetIds != null && appWidgetIds.length > 0) { - this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); + switch (action) { + case enums.WidgetCommands.OPEN_APPLICATION: { + status.sWidgetResponse = enums.WidgetResponse.SEARCHBAR; + Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); + launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true); + context.startActivity(launchIntent); + break; + } + case enums.WidgetCommands.OPEN_VOICE: { + status.sWidgetResponse = enums.WidgetResponse.VOICE; + Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); + launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true); + context.startActivity(launchIntent); + break; + } + case AppWidgetManager.ACTION_APPWIDGET_UPDATE: { + Bundle extras = intent.getExtras(); + if (extras != null) { + int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); + if (appWidgetIds != null && appWidgetIds.length > 0) { + this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); + } } + break; } - } else if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) { - Bundle extras = intent.getExtras(); - if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) { - final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); - this.onDeleted(context, new int[] { appWidgetId }); - } - } else if (AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED.equals(action)) { - Bundle extras = intent.getExtras(); - if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID) - && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) { - int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); - Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS); - this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context), - appWidgetId, widgetExtras); - } - } else if (AppWidgetManager.ACTION_APPWIDGET_ENABLED.equals(action)) { - this.onEnabled(context); - } else if (AppWidgetManager.ACTION_APPWIDGET_DISABLED.equals(action)) { - this.onDisabled(context); - } else if (AppWidgetManager.ACTION_APPWIDGET_RESTORED.equals(action)) { - Bundle extras = intent.getExtras(); - if (extras != null) { - int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS); - int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); - if (oldIds != null && oldIds.length > 0) { - this.onRestored(context, oldIds, newIds); - this.onUpdate(context, AppWidgetManager.getInstance(context), newIds); + case AppWidgetManager.ACTION_APPWIDGET_DELETED: { + Bundle extras = intent.getExtras(); + if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) { + final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); + this.onDeleted(context, new int[]{appWidgetId}); } + break; + } + case AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED: { + Bundle extras = intent.getExtras(); + if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID) + && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) { + int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); + Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS); + this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context), + appWidgetId, widgetExtras); + } + break; + } + case AppWidgetManager.ACTION_APPWIDGET_ENABLED: + this.onEnabled(context); + break; + case AppWidgetManager.ACTION_APPWIDGET_DISABLED: + this.onDisabled(context); + break; + case AppWidgetManager.ACTION_APPWIDGET_RESTORED: { + Bundle extras = intent.getExtras(); + if (extras != null) { + int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS); + int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); + if (oldIds != null && oldIds.length > 0) { + this.onRestored(context, oldIds, newIds); + this.onUpdate(context, AppWidgetManager.getInstance(context), newIds); + } + } + break; } } } + /* Local Overrides */ + @Override public void onAppWidgetOptionsChanged (Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle widgetInfo) { int width = widgetInfo.getInt (AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH); @@ -120,10 +136,6 @@ public class searchWidgetManager extends AppWidgetProvider { onUpdate(context, appWidgetManager, appWidgetIds); } - private int getColsNum (int size) { - return (int) Math.floor ((size - 30) / 70); - } - @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int appWidgetId : appWidgetIds) { @@ -141,4 +153,11 @@ public class searchWidgetManager extends AppWidgetProvider { } } } + + /* Helper Methods */ + + private int getColsNum (int size) { + return (int) Math.floor ((size - 30) / 70); + } + } \ No newline at end of file diff --git a/app/src/main/res/anim/fade_in.xml b/app/src/main/res/anim/fade_in.xml index d03635be..96d611aa 100755 --- a/app/src/main/res/anim/fade_in.xml +++ b/app/src/main/res/anim/fade_in.xml @@ -2,7 +2,7 @@ android:startOffset="250"> \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml-v25/shortcuts.xml b/app/src/main/res/custom-xml/generic/xml-v25/shortcuts.xml new file mode 100644 index 00000000..ae716280 --- /dev/null +++ b/app/src/main/res/custom-xml/generic/xml-v25/shortcuts.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml b/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml index 0a96d2fc..f20cc028 100644 --- a/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml +++ b/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml @@ -3,8 +3,9 @@ - + + diff --git a/app/src/main/res/custom-xml/generic/xml/shortcuts.xml b/app/src/main/res/custom-xml/generic/xml/shortcuts.xml index 2dce1ea5..082e2006 100644 --- a/app/src/main/res/custom-xml/generic/xml/shortcuts.xml +++ b/app/src/main/res/custom-xml/generic/xml/shortcuts.xml @@ -1,43 +1,5 @@ - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/home/xml/hx_progressbar_gradient.xml b/app/src/main/res/custom-xml/home/xml/hx_progressbar_gradient.xml new file mode 100644 index 00000000..ac825a80 --- /dev/null +++ b/app/src/main/res/custom-xml/home/xml/hx_progressbar_gradient.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_add.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_add.xml index eb232541..4ad9445a 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_baseline_add.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_add.xml @@ -3,7 +3,7 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" - android:tint="?attr/colorControlNormal"> + android:tint="#3C5C7E"> diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_bin.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_bin.xml new file mode 100644 index 00000000..83b80924 --- /dev/null +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_bin.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_cross_shortcut.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_cross_shortcut.xml new file mode 100644 index 00000000..3c195901 --- /dev/null +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_cross_shortcut.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_remove.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_remove.xml new file mode 100644 index 00000000..b0347cd5 --- /dev/null +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_remove.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layouts/alert/layout/popup_data_cleared_shortcut.xml b/app/src/main/res/layouts/alert/layout/popup_data_cleared_shortcut.xml index 43ef7bdb..985b51f0 100644 --- a/app/src/main/res/layouts/alert/layout/popup_data_cleared_shortcut.xml +++ b/app/src/main/res/layouts/alert/layout/popup_data_cleared_shortcut.xml @@ -11,7 +11,6 @@ android:layout_height="wrap_content" android:layout_marginStart="15dp" android:layout_marginEnd="15dp" - android:layout_marginBottom="15dp" app:cardCornerRadius="5.5dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" @@ -67,7 +66,7 @@ - + + - + \ No newline at end of file diff --git a/app/src/main/res/layouts/history/xml/ic_baseline_shortcut_cross_back.xml b/app/src/main/res/layouts/history/xml/ic_baseline_shortcut_cross_back.xml index d398a0b8..d417b31a 100644 --- a/app/src/main/res/layouts/history/xml/ic_baseline_shortcut_cross_back.xml +++ b/app/src/main/res/layouts/history/xml/ic_baseline_shortcut_cross_back.xml @@ -3,10 +3,11 @@ - + + - + \ No newline at end of file diff --git a/app/src/main/res/layouts/home/layout/home_view.xml b/app/src/main/res/layouts/home/layout/home_view.xml index 8ce4d433..996ad0f7 100644 --- a/app/src/main/res/layouts/home/layout/home_view.xml +++ b/app/src/main/res/layouts/home/layout/home_view.xml @@ -197,7 +197,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - --> + app:layout_constraintTop_toBottomOf="@+id/pTopbar" /> - + @@ -266,7 +266,7 @@ - + android:translationZ="1dp"/> + tools:context="com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeController"> diff --git a/app/src/main/res/layouts/tab/layout/tab_grid_view.xml b/app/src/main/res/layouts/tab/layout/tab_grid_view.xml index bbe52aa6..6f357134 100644 --- a/app/src/main/res/layouts/tab/layout/tab_grid_view.xml +++ b/app/src/main/res/layouts/tab/layout/tab_grid_view.xml @@ -73,7 +73,7 @@ app:cardElevation="0dp" app:contentPadding="0dp"> - - digital freedom reload you are facing the one of the following problem. webpage or website might not be working. your internet connection might be poor. you might be using a proxy. website might be blocked by firewall - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Israel Strikes Again diff --git a/app/src/main/res/mipmap-mdpi/ic_stat_tor_logo.png b/app/src/main/res/mipmap-mdpi/ic_stat_tor_logo.png new file mode 100644 index 00000000..84149132 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_stat_tor_logo.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_stat_tor_logo.png b/app/src/main/res/mipmap-xhdpi/ic_stat_tor_logo.png new file mode 100644 index 00000000..08161fcc Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_stat_tor_logo.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_stat_tor_logo.png b/app/src/main/res/mipmap-xxhdpi/ic_stat_tor_logo.png new file mode 100644 index 00000000..0edd077b Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_stat_tor_logo.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_stat_tor_logo.png b/app/src/main/res/mipmap-xxxhdpi/ic_stat_tor_logo.png new file mode 100644 index 00000000..ae5e1ad5 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_stat_tor_logo.png differ diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index ff01f6f8..7bb3b419 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -14,7 +14,7 @@ llibertat digital recarregar us trobeu amb el problema següent. pot ser que la pàgina web o el lloc web no funcionin. és possible que la vostra connexió a Internet sigui deficient. és possible que utilitzeu un servidor intermediari. el tallafoc podria bloquejar el lloc web - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC, Israel torna a atacar diff --git a/app/src/main/res/values-ch/strings.xml b/app/src/main/res/values-ch/strings.xml index 4f6e5bdf..1e8182f0 100644 --- a/app/src/main/res/values-ch/strings.xml +++ b/app/src/main/res/values-ch/strings.xml @@ -14,7 +14,7 @@ digitální svoboda Znovu načíst čelíte jednomu z následujících problémů. webová stránka nebo web nemusí fungovat. vaše připojení k internetu může být špatné. možná používáte proxy. web může být blokován bránou firewall - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Izrael znovu udeří diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 8685d5b9..80e08853 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -14,7 +14,7 @@ digitale Freiheit neu laden Sie stehen vor einem der folgenden Probleme. Webseite oder Website funktioniert möglicherweise nicht. Ihre Internetverbindung ist möglicherweise schlecht. Möglicherweise verwenden Sie einen Proxy. Die Website wird möglicherweise von der Firewall blockiert - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Israel schlägt erneut zu diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 177fc150..af206086 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -14,7 +14,7 @@ ψηφιακή ελευθερία φορτώνω πάλι αντιμετωπίζετε ένα από τα ακόλουθα προβλήματα. η ιστοσελίδα ή ο ιστότοπος ενδέχεται να μην λειτουργούν. η σύνδεσή σας στο Διαδίκτυο μπορεί να είναι κακή. μπορεί να χρησιμοποιείτε διακομιστή μεσολάβησης. Ο ιστότοπος ενδέχεται να αποκλειστεί από το τείχος προστασίας - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Το Ισραήλ χτυπά ξανά diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4b804b8a..b56c8223 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -14,7 +14,7 @@ liberté numérique recharger vous êtes confronté à l\'un des problèmes suivants. la page Web ou le site Web peut ne pas fonctionner. votre connexion Internet est peut-être mauvaise. vous utilisez peut-être un proxy. le site Web peut être bloqué par le pare-feu - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Israël frappe à nouveau diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 332a8005..22ab8857 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -14,7 +14,7 @@ digitális szabadság újratöltés a következő probléma egyikével áll szemben. előfordulhat, hogy egy weboldal vagy webhely nem működik. gyenge lehet az internetkapcsolat. lehet, hogy proxyt használ. előfordulhat, hogy a webhelyet tűzfal blokkolja - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Izrael újra sztrájkol diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 000813ea..0edd0b54 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -14,7 +14,7 @@ libertà digitale ricaricare stai affrontando uno dei seguenti problemi. la pagina web o il sito web potrebbero non funzionare. la tua connessione Internet potrebbe essere scarsa. potresti utilizzare un proxy. il sito Web potrebbe essere bloccato dal firewall - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Israele colpisce ancora diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index ff6aff15..156df435 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -14,7 +14,7 @@ デジタルの自由 リロード 次のいずれかの問題が発生しています。ウェブページまたはウェブサイトが機能していない可能性があります。インターネット接続が悪い可能性があります。プロキシを使用している可能性があります。ウェブサイトがファイアウォールによってブロックされている可能性があります - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC |イスラエルが再びストライキ diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 9bb3d0f3..446521ef 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -14,7 +14,7 @@ 디지털 자유 재 장전 다음 문제 중 하나에 직면하고 있습니다. 웹 페이지 또는 웹 사이트가 작동하지 않을 수 있습니다. 인터넷 연결 상태가 좋지 않을 수 있습니다. 프록시를 사용하고있을 수 있습니다. 웹 사이트가 방화벽에 의해 차단 될 수 있음 - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | 이스라엘이 다시 공격하다 diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index c29afbb8..232c7545 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -1,4 +1,7 @@ + + /* Customs Colors */ + #1c1b21 #60ffffff #091a2a @@ -67,11 +70,9 @@ #00b300 #a6a6a6 #28282a - #ffffff #242B64 #3c3946 - #f65555 #b3b3b3 #ffffff @@ -83,53 +84,4 @@ #90000000 #d9d9d9 - #0066FF - #fdfeff - #4d88ff - #0A1727 - #eef1f7 - #eef1f7 - #3385ff - #b3d1ff - #615c70 - #212d45 - #212d45 - #55212d45 - - #99bbff - #ccdcff - #000000 - #212f45 - #4d4d4d - #333333 - #666666 - #E6FFFFFF - #00000000 - #88000000 - #99000000 - #999999 - #b3b3b3 - #bfbfbf - #d9d9d9 - #e3e3e3 - #f2f2f2 - #3b3946 - #e6e6e6 - #f8f8f8 - #f2f2f2 - #ffffff - - #910808 - #f76e6e - #33cc33 - #00802b - #212d45 - #1c1b21 - #CC212d45 - #ffc107 - #00d9ff - #00a4fd - #00b3b3 - - diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index af92d477..23f1f32d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -14,7 +14,7 @@ digital freedom recarregar você está enfrentando um dos seguintes problemas. página da Web ou site pode não estar funcionando. sua conexão com a internet pode estar ruim. você pode estar usando um proxy. site pode estar bloqueado por firewall - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Israel ataca novamente diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 3bb75160..72e02630 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -14,7 +14,7 @@ libertatea digitală reîncărcați vă confruntați cu una dintre următoarele probleme. este posibil ca pagina web sau site-ul web să nu funcționeze. conexiunea la internet ar putea fi slabă. s-ar putea să utilizați un proxy. site-ul web ar putea fi blocat de firewall - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Israelul lovește din nou diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index fe37a2f5..a76c0528 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -14,7 +14,7 @@ цифровая свобода перезагрузить вы столкнулись с одной из следующих проблем. веб-страница или веб-сайт могут не работать. ваше интернет-соединение может быть плохим. вы можете использовать прокси. веб-сайт может быть заблокирован брандмауэром - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Израиль снова наносит удар diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 4a9e7adb..6678398b 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -14,7 +14,7 @@ เสรีภาพดิจิทัล โหลดใหม่ คุณกำลังประสบปัญหาอย่างใดอย่างหนึ่งต่อไปนี้ หน้าเว็บหรือเว็บไซต์อาจไม่ทำงาน การเชื่อมต่ออินเทอร์เน็ตของคุณอาจไม่ดี คุณอาจใช้พร็อกซี เว็บไซต์อาจถูกปิดกั้นโดยไฟร์วอลล์ - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | อิสราเอลนัดหยุดงานอีกครั้ง diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 683376cb..3750df7f 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -14,7 +14,7 @@ dijital özgürlük Tekrar yükle aşağıdaki problemlerden biriyle karşı karşıyasınız. web sayfası veya web sitesi çalışmıyor olabilir. İnternet bağlantınız zayıf olabilir. bir proxy kullanıyor olabilirsiniz. web sitesi güvenlik duvarı tarafından engelleniyor olabilir - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | İsrail Yeniden Grevde diff --git a/app/src/main/res/values-ur/strings.xml b/app/src/main/res/values-ur/strings.xml index 7b246fce..307de8b2 100644 --- a/app/src/main/res/values-ur/strings.xml +++ b/app/src/main/res/values-ur/strings.xml @@ -14,7 +14,7 @@ ڈیجیٹل آزادی دوبارہ لوڈ کریں آپ کو مندرجہ ذیل میں سے ایک مسئلہ درپیش ہے۔ ہوسکتا ہے کہ ویب صفحہ یا ویب سائٹ کام نہیں کررہی ہے۔ ہوسکتا ہے کہ آپ کا انٹرنیٹ کنیکشن خراب ہو۔ آپ شاید ایک پراکسی استعمال کر رہے ہوں گے۔ ہوسکتا ہے کہ ویب سائٹ فائر وال کے ذریعے مسدود کردی جائے - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider بی بی سی | اسرائیل نے ایک بار پھر حملہ کیا diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index f18b277a..061e4ab0 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -14,7 +14,7 @@ tự do kỹ thuật số tải lại bạn đang phải đối mặt với một trong những vấn đề sau. trang web hoặc trang web có thể không hoạt động. kết nối internet của bạn có thể kém. bạn có thể đang sử dụng proxy. trang web có thể bị tường lửa chặn - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Israel lại tấn công diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index d73bb36b..5227c2ed 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -14,7 +14,7 @@ 数字自由 重装 您正面临以下问题之一。网页或网站可能无法正常工作。您的互联网连接可能不佳。您可能正在使用代理。网站可能被防火墙阻止 - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider 英国广播公司|以色列再次罢工 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 958ac8fa..9aafed2e 100755 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,5 +1,8 @@ + + /* Customs Colors */ + #ffffff #601c1b21 #999999 @@ -72,18 +75,18 @@ #00b300 #00b300 #e3e3e3 - #05e6e6e6 #10e6e6e6 #15e6e6e6 #20e6e6e6 #25e6e6e6 - #212d45 #ffffff #7591bd #e6e6e6 + /* Shared Colors */ + #0066FF #fdfeff #4d88ff @@ -97,7 +100,6 @@ #ffffff #ffffff #ffffff - #99bbff #ccdcff #000000 @@ -122,7 +124,6 @@ #f2f2f2 #ffffff #00000000 - #910808 #f32323 #33cc33 @@ -137,4 +138,5 @@ #00a4fd #5A7585 #00b3b3 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b1517969..bd3885a1 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,7 +14,7 @@ Online Freedom Reload These might be the problems you are facing \n\n• Webpage or Website might be down \n• Your Internet connection might be poor \n• You might be using a proxy \n• Website might be blocked by firewall - com.darkweb.genesissearchengine.provider.dev + com.darkweb.genesissearchengine.production.provider BBC | Israel Strikes Again Search the web ... diff --git a/app/variables.gradle b/app/variables.gradle index c9b37b87..7ee99cc3 100755 --- a/app/variables.gradle +++ b/app/variables.gradle @@ -1,6 +1,6 @@ /* Version */ project.ext.vname = 'Build | Dark-Origin 1.0' -project.ext.vcode = 35 +project.ext.vcode = 40 project.ext.buildType = 'release' /* dimension */ @@ -33,7 +33,7 @@ project.ext.min_sdk_version = 21 project.ext.target_sdk_version = 30 project.ext.build_tool_version = '30.0.3' project.ext.ndk_version = '21.4.7075529' -project.ext.application_id = "com.darkweb.genesissearchengine.dev" +project.ext.application_id = "com.darkweb.genesissearchengine.production" project.ext.debugSymbolLevel = 'FULL' /* Splits */ diff --git a/build.gradle b/build.gradle index 76b07c30..0a41953d 100755 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.0' + classpath 'com.android.tools.build:gradle:4.2.1' classpath 'com.google.gms:google-services:4.3.5' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0" } diff --git a/progress.txt b/progress.txt index aa29bdb5..bc5455ea 100644 --- a/progress.txt +++ b/progress.txt @@ -6,10 +6,12 @@ settingLogEnums settingLogModel settingLogViewController -/* In Progress */ orbotLogAdapter orbotLogController orbotLogEnums orbotLogModel orbotLogStatus orbotLogViewController + +/* In Progress */ +external Navigation