From ad6da782b3c50299ee3d2d8f9cae8609ce020895 Mon Sep 17 00:00:00 2001 From: msmannan00 Date: Mon, 24 May 2021 20:06:43 +0500 Subject: [PATCH] Bug Fixes Bug Fixes --- .../bookmarkViewController.java | 2 +- .../bridgeManager/bridgeController.java | 5 +- .../bridgeManager/bridgeViewController.java | 24 +- .../externalShortcutController.java | 2 +- .../historyManager/historyViewController.java | 4 +- .../geckoManager/geckoSession.java | 6 +- .../geckoManager/selectionActionDelegate.java | 447 ++++++++++++++++++ .../homeController/homeController.java | 64 ++- .../homeController/homeViewController.java | 25 +- .../languageManager/languageController.java | 4 +- .../orbotLogManager/orbotLogAdapter.java | 2 +- .../orbotLogManager/orbotLogController.java | 4 +- .../orbotLogManager/orbotLogModel.java | 2 +- .../orbotManager/orbotController.java | 4 +- .../orbotManager/orbotViewController.java | 23 +- .../settingAdvanceController.java | 8 +- .../clearManager/settingClearController.java | 4 + .../settingHomeController.java | 2 +- .../constants/constants.java | 7 + .../genesissearchengine/constants/status.java | 3 +- .../dataManager/dataController.java | 6 + .../genesissearchengine/eventObserver.java | 2 - .../helperManager/helperMethod.java | 21 +- .../adPluginManager/adManager.java | 2 - .../analyticManager.java | 10 +- .../downloadReciever.java | 2 +- .../langPluginManager/langManager.java | 48 +- .../messagePluginManager/messageManager.java | 54 ++- .../localEngagementManager.java | 6 +- .../notifictionManager.java | 2 +- .../orbotPluginManager/orbotManager.java | 75 ++- .../pluginManager/pluginController.java | 20 +- .../pluginManager/pluginEnums.java | 6 +- .../downloadNotificationReciever.java | 8 +- app/src/main/res/anim/popup_scale_in.xml | 21 + app/src/main/res/anim/popup_scale_out.xml | 21 + .../custom-xml/generic/xml-v25/shortcuts.xml | 6 +- .../hox_rounded_corner_bridge_settings.xml | 14 + .../images/xml/ic_baseline_repair.xml | 6 + .../alert/layout/application_crash.xml | 97 ++++ .../alert/layout/popup_update_bridges.xml | 57 ++- .../bridge/layout/bridge_settings_view.xml | 17 +- .../res/layouts/home/layout/home_view.xml | 4 +- .../layouts/language/layout/language_view.xml | 11 +- .../orbot/layout/orbot_settings_view.xml | 16 +- .../orbotLog/layout/orbot_log_view.xml | 14 +- .../res/layouts/setting/layout/setting.xml | 9 +- .../layout/setting_accessibility_view.xml | 9 +- .../setting/layout/setting_advance_view.xml | 11 +- .../setting/layout/setting_clear_view.xml | 9 +- .../setting/layout/setting_general_view.xml | 9 +- .../setting/layout/setting_log_view.xml | 9 +- .../layout/setting_notification_view.xml | 9 +- .../setting/layout/setting_privacy_view.xml | 9 +- .../setting/layout/setting_search_view.xml | 10 +- .../setting/layout/setting_tracking_view.xml | 10 +- app/src/main/res/values-night/colors.xml | 1 + app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/strings.xml | 7 +- app/variables.gradle | 2 +- .../android/proxy/OrbotService.java | 29 +- .../android/proxy/StartTorReceiver.java | 2 +- .../android/proxy/TorEventHandler.java | 2 +- .../torproject/android/proxy/util/Prefs.java | 2 +- .../wrapper/LocaleHelper.java | 2 +- .../wrapper/localHelperMethod.java | 3 +- .../wrapper/logRowModel.java | 2 +- .../wrapper/orbotLocalConstants.java | 2 +- 68 files changed, 1002 insertions(+), 336 deletions(-) create mode 100644 app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java create mode 100644 app/src/main/res/anim/popup_scale_in.xml create mode 100644 app/src/main/res/anim/popup_scale_out.xml create mode 100644 app/src/main/res/custom-xml/home/xml/hox_rounded_corner_bridge_settings.xml create mode 100644 app/src/main/res/custom-xml/images/xml/ic_baseline_repair.xml create mode 100644 app/src/main/res/layouts/alert/layout/application_crash.xml rename orbotmanager/src/main/java/org/torproject/android/{service => proxy}/wrapper/LocaleHelper.java (98%) rename orbotmanager/src/main/java/org/torproject/android/{service => proxy}/wrapper/localHelperMethod.java (90%) rename orbotmanager/src/main/java/org/torproject/android/{service => proxy}/wrapper/logRowModel.java (92%) rename orbotmanager/src/main/java/org/torproject/android/{service => proxy}/wrapper/orbotLocalConstants.java (93%) diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java index a1c451c0..3d58e907 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java @@ -278,7 +278,7 @@ class bookmarkViewController } private void onLongPressMenu(View pView) { - mPopupWindow = helperMethod.onCreateMenu(pView, R.layout.history_bookmark_menu); + mPopupWindow = helperMethod.onCreateMenu(pView, R.layout.history_bookmark_menu, status.sSettingLanguageRegion); } private void onDrawSwipableBackground(Canvas pCanvas, RecyclerView.ViewHolder pViewHolder, float pDX, int pActionState) { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java index 9704df78..a9f5d7e9 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java @@ -62,9 +62,8 @@ public class bridgeController 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(); - activityThemeManager.getInstance().onConfigurationChanged(this); } super.onConfigurationChanged(newConfig); @@ -135,7 +134,7 @@ public class bridgeController extends AppCompatActivity { public void onUpdateBridges(String pBridge, String pType) { if(pBridge.length()>5){ mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_CUSTOM_BRIDGE, Arrays.asList(pBridge, pType)); - mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250, status.sBridgeCustomType)); + mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250)); }else { if(status.sBridgeCustomBridge.equals("meek")){ mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_MEEK_BRIDGE, null); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeViewController.java index 335888f7..93cadf01 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeViewController.java @@ -18,9 +18,9 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; -import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; import com.example.myapplication.R; import java.util.List; @@ -51,21 +51,7 @@ class bridgeViewController } private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } + sharedUIMethod.updateStatusBar(mContext); } private void animateColor(TextView p_view, int p_from, int p_to, String p_command, int p_duration){ @@ -107,7 +93,7 @@ class bridgeViewController mCustomBridgeBlocker.setVisibility(View.GONE); } - private void initViews(String p_bridge, int p_duration, String pType){ + private void initViews(String p_bridge, int p_duration){ resetRadioButtons(p_duration); if(p_bridge.equals(strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)){ animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration); @@ -127,13 +113,13 @@ class bridgeViewController mCustomPort.setText(strings.GENERIC_EMPTY_STR); }else { onEnableCustomBridge(); - mCustomPort.setText(("(Type) " + pType + " ➔ " + "(Config) "+p_bridge.replace("\n",""))); + mCustomPort.setText(("(Config) ➔ "+p_bridge.replace("\n",""))); } } public void onTrigger(bridgeEnums.eBridgeViewCommands p_commands, List p_data){ if(p_commands == bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS){ - initViews((String) p_data.get(0), (int)p_data.get(1), (String) p_data.get(2)); + initViews((String) p_data.get(0), (int)p_data.get(1)); } if(p_commands == bridgeEnums.eBridgeViewCommands.M_ENABLE_CUSTOM_BRIDGE){ onEnableCustomBridge(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java index a7e232e1..7e96748c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalCommandManager/externalShortcutController.java @@ -11,7 +11,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.torproject.android.proxy.wrapper.orbotLocalConstants; public class externalShortcutController extends AppCompatActivity { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java index 25cec772..1ae76ff8 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java @@ -28,6 +28,8 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.RecyclerView; + +import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; @@ -268,7 +270,7 @@ class historyViewController } private void onLongPressMenu(View pView) { - mPopupWindow = helperMethod.onCreateMenu(pView, R.layout.history_bookmark_menu); + mPopupWindow = helperMethod.onCreateMenu(pView, R.layout.history_bookmark_menu, status.sSettingLanguageRegion); } private void onDrawSwipableBackground(Canvas pCanvas, RecyclerView.ViewHolder pViewHolder, float pDX, int pActionState) { 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 e088a4c7..00328867 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 @@ -77,7 +77,8 @@ import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessage import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; -public class geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSession.ScrollDelegate,GeckoSession.PermissionDelegate,GeckoSession.ProgressDelegate, GeckoSession.HistoryDelegate,GeckoSession.NavigationDelegate,GeckoSession.ContentDelegate +public class +geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSession.ScrollDelegate,GeckoSession.PermissionDelegate,GeckoSession.ProgressDelegate, GeckoSession.HistoryDelegate,GeckoSession.NavigationDelegate,GeckoSession.ContentDelegate { private eventObserver.eventListener event; @@ -128,6 +129,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele setScrollDelegate(this); mDownloadManager = new geckoDownloadManager(); setPromptDelegate(new geckoPromptView(mContext)); + setSelectionActionDelegate(new selectionActionDelegate(mContext, true)); } public void onDestroy(){ @@ -408,12 +410,10 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele if(var2.equals("https://genesishiddentechnologies.com") || var2.startsWith(CONST_GENESIS_URL_CACHED) || var2.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ if(var2.startsWith(CONST_GENESIS_URL_CACHED_DARK) && (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get()))){ isPageLoading = false; - //stop(); event.invokeObserver(null, enums.etype.M_CHANGE_HOME_THEME); } else if(var2.startsWith(CONST_GENESIS_URL_CACHED) && (status.sTheme != enums.Theme.THEME_LIGHT && !helperMethod.isDayMode(mContext.get()))){ isPageLoading = false; - //stop(); event.invokeObserver(null, enums.etype.M_CHANGE_HOME_THEME); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java new file mode 100644 index 00000000..6f0b85cb --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/selectionActionDelegate.java @@ -0,0 +1,447 @@ +package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.content.ActivityNotFoundException; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.graphics.Matrix; +import android.graphics.Rect; +import android.graphics.RectF; +import android.os.Build; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.UiThread; +import android.util.Log; +import android.view.ActionMode; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; + +import com.darkweb.genesissearchengine.appManager.activityContextManager; + +import org.mozilla.gecko.util.ThreadUtils; +import org.mozilla.geckoview.GeckoSession; + +/** + * Class that implements a basic SelectionActionDelegate. This class is used by GeckoView by + * default if the consumer does not explicitly set a SelectionActionDelegate. + * + * To provide custom actions, extend this class and override the following methods, + * + * 1) Override {@link #getAllActions} to include custom action IDs in the returned array. This + * array must include all actions, available or not, and must not change over the class lifetime. + * + * 2) Override {@link #isActionAvailable} to return whether a custom action is currently available. + * + * 3) Override {@link #prepareAction} to set custom title and/or icon for a custom action. + * + * 4) Override {@link #performAction} to perform a custom action when used. + */ +@UiThread +public class selectionActionDelegate implements ActionMode.Callback, + GeckoSession.SelectionActionDelegate { + private static final String LOGTAG = "BasicSelectionAction"; + + protected static final String ACTION_PROCESS_TEXT = Intent.ACTION_PROCESS_TEXT; + + private static final String[] FLOATING_TOOLBAR_ACTIONS = new String[] { + ACTION_CUT, ACTION_COPY, ACTION_PASTE, ACTION_SELECT_ALL, ACTION_PROCESS_TEXT, "SEARCH" + }; + private static final String[] FIXED_TOOLBAR_ACTIONS = new String[] { + ACTION_SELECT_ALL, ACTION_CUT, ACTION_COPY, ACTION_PASTE,"SEARCH" + }; + + protected final @NonNull Activity mActivity; + protected final boolean mUseFloatingToolbar; + protected final @NonNull Matrix mTempMatrix = new Matrix(); + protected final @NonNull RectF mTempRect = new RectF(); + + private boolean mExternalActionsEnabled; + + protected @Nullable ActionMode mActionMode; + protected @Nullable GeckoSession mSession; + protected @Nullable Selection mSelection; + protected boolean mRepopulatedMenu; + + @TargetApi(Build.VERSION_CODES.M) + private class Callback2Wrapper extends ActionMode.Callback2 { + @Override + public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) { + return selectionActionDelegate.this.onCreateActionMode(actionMode, menu); + } + + @Override + public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) { + return selectionActionDelegate.this.onPrepareActionMode(actionMode, menu); + } + + @Override + public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) { + return selectionActionDelegate.this.onActionItemClicked(actionMode, menuItem); + } + + @Override + public void onDestroyActionMode(final ActionMode actionMode) { + selectionActionDelegate.this.onDestroyActionMode(actionMode); + } + + @Override + public void onGetContentRect(final ActionMode mode, final View view, final Rect outRect) { + super.onGetContentRect(mode, view, outRect); + selectionActionDelegate.this.onGetContentRect(mode, view, outRect); + } + } + + @SuppressWarnings("checkstyle:javadocmethod") + public selectionActionDelegate(final @NonNull Activity activity) { + this(activity, Build.VERSION.SDK_INT >= 23); + } + + @SuppressWarnings("checkstyle:javadocmethod") + public selectionActionDelegate(final @NonNull Activity activity, + final boolean useFloatingToolbar) { + mActivity = activity; + mUseFloatingToolbar = useFloatingToolbar; + mExternalActionsEnabled = true; + } + + /** + * Set whether to include text actions from other apps in the floating toolbar. + * + * @param enable True if external actions should be enabled. + */ + public void enableExternalActions(final boolean enable) { + ThreadUtils.assertOnUiThread(); + mExternalActionsEnabled = enable; + + if (mActionMode != null) { + mActionMode.invalidate(); + } + } + + /** + * Get whether text actions from other apps are enabled. + * + * @return True if external actions are enabled. + */ + public boolean areExternalActionsEnabled() { + return mExternalActionsEnabled; + } + + /** + * Return list of all actions in proper order, regardless of their availability at present. + * Override to add to or remove from the default set. + * + * @return Array of action IDs in proper order. + */ + protected @NonNull String[] getAllActions() { + return mUseFloatingToolbar ? FLOATING_TOOLBAR_ACTIONS + : FIXED_TOOLBAR_ACTIONS; + } + + /** + * Return whether an action is presently available. Override to indicate + * availability for custom actions. + * + * @param id Action ID. + * @return True if the action is presently available. + */ + protected boolean isActionAvailable(final @NonNull String id) { + if (mSelection == null) { + return false; + } + + if (mExternalActionsEnabled && !mSelection.text.isEmpty() && + ACTION_PROCESS_TEXT.equals(id)) { + final PackageManager pm = mActivity.getPackageManager(); + return pm.resolveActivity(getProcessTextIntent(), + PackageManager.MATCH_DEFAULT_ONLY) != null; + } + if(id.equals("SEARCH")){ + return true; + } + + return mSelection.isActionAvailable(id); + } + + /** + * Provides access to whether there are text selection actions available. Override to indicate + * availability for custom actions. + * + * @return True if there are text selection actions available. + */ + public boolean isActionAvailable() { + if (mSelection == null) { + return false; + } + + return isActionAvailable(ACTION_PROCESS_TEXT) || + !mSelection.availableActions.isEmpty(); + } + + /** + * Prepare a menu item corresponding to a certain action. Override to prepare + * menu item for custom action. + * + * @param id Action ID. + * @param item New menu item to prepare. + */ + protected void prepareAction(final @NonNull String id, final @NonNull MenuItem item) { + + switch (id) { + case ACTION_CUT: + item.setTitle(android.R.string.cut); + break; + case ACTION_COPY: + item.setTitle(android.R.string.copy); + break; + case "SEARCH": + item.setTitle("Search"); + break; + case ACTION_PASTE: + item.setTitle(android.R.string.paste); + break; + case ACTION_SELECT_ALL: + item.setTitle(android.R.string.selectAll); + break; + case ACTION_PROCESS_TEXT: + throw new IllegalStateException("Unexpected action"); + } + } + + /** + * Perform the specified action. Override to perform custom actions. + * + * @param id Action ID. + * @param item Nenu item for the action. + * @return True if the action was performed. + */ + protected boolean performAction(final @NonNull String id, final @NonNull MenuItem item) { + if (ACTION_PROCESS_TEXT.equals(id)) { + try { + mActivity.startActivity(item.getIntent()); + } catch (final ActivityNotFoundException e) { + Log.e(LOGTAG, "Cannot perform action", e); + return false; + } + return true; + } + + if (mSelection == null) { + return false; + } + if (id.equals("SEARCH")) { + activityContextManager.getInstance().getHomeController().onSearchString(mSelection.text); + mActionMode.finish(); + return false; + } + mSelection.execute(id); + + // Android behavior is to clear selection on copy. + if (ACTION_COPY.equals(id)) { + if (mUseFloatingToolbar) { + clearSelection(); + } else { + mActionMode.finish(); + } + } + return true; + } + + /** + * Get the current selection object. This object should not be stored as it does not update + * when the selection becomes invalid. Stale actions are ignored. + * + * @return The {@link GeckoSession.SelectionActionDelegate.Selection} attached to the current + * action menu. null if no action menu is active. + */ + public @Nullable Selection getSelection() { + return mSelection; + } + + /** + * Clear the current selection, if possible. + */ + public void clearSelection() { + if (mSelection == null) { + return; + } + + if (isActionAvailable(ACTION_COLLAPSE_TO_END)) { + mSelection.collapseToEnd(); + } else if (isActionAvailable(ACTION_UNSELECT)) { + mSelection.unselect(); + } else { + mSelection.hide(); + } + } + + private Intent getProcessTextIntent() { + final Intent intent = new Intent(Intent.ACTION_PROCESS_TEXT); + intent.addCategory(Intent.CATEGORY_DEFAULT); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_PROCESS_TEXT, mSelection.text); + // TODO: implement ability to replace text in Gecko for editable selection (bug 1453137). + intent.putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true); + return intent; + } + + @Override + public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) { + ThreadUtils.assertOnUiThread(); + final String[] allActions = getAllActions(); + for (final String actionId : allActions) { + if (isActionAvailable(actionId)) { + if (!mUseFloatingToolbar && ( + Build.VERSION.SDK_INT == 22 || Build.VERSION.SDK_INT == 23)) { + // Android bug where onPrepareActionMode is not called initially. + onPrepareActionMode(actionMode, menu); + } + return true; + } + } + return false; + } + + @Override + public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) { + ThreadUtils.assertOnUiThread(); + final String[] allActions = getAllActions(); + boolean changed = false; + + // Whether we are repopulating an existing menu. + mRepopulatedMenu = menu.size() != 0; + + // For each action, see if it's available at present, and if necessary, + // add to or remove from menu. + for (int i = 0; i < allActions.length; i++) { + final String actionId = allActions[i]; + final int menuId = i + Menu.FIRST; + + if (ACTION_PROCESS_TEXT.equals(actionId)) { + if (mExternalActionsEnabled && !mSelection.text.isEmpty()) { + menu.addIntentOptions(menuId, menuId, menuId, + mActivity.getComponentName(), + /* specifiec */ null, getProcessTextIntent(), + /* flags */ 0, /* items */ null); + changed = true; + } else if (menu.findItem(menuId) != null) { + menu.removeGroup(menuId); + changed = true; + } + continue; + } + + if (isActionAvailable(actionId)) { + if (menu.findItem(menuId) == null) { + prepareAction(actionId, menu.add(/* group */ Menu.NONE, menuId, + menuId, /* title */ "")); + changed = true; + } + } else if (menu.findItem(menuId) != null) { + menu.removeItem(menuId); + changed = true; + } + } + return changed; + } + + @Override + public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) { + ThreadUtils.assertOnUiThread(); + MenuItem realMenuItem = null; + if (mRepopulatedMenu) { + // When we repopulate an existing menu, Android can sometimes give us an old, + // deleted MenuItem. Find the current MenuItem that corresponds to the old one. + final Menu menu = actionMode.getMenu(); + final int size = menu.size(); + for (int i = 0; i < size; i++) { + final MenuItem item = menu.getItem(i); + if (item == menuItem || (item.getItemId() == menuItem.getItemId() && + item.getTitle().equals(menuItem.getTitle()))) { + realMenuItem = item; + break; + } + } + } else { + realMenuItem = menuItem; + } + + if (realMenuItem == null) { + return false; + } + final String[] allActions = getAllActions(); + return performAction(allActions[realMenuItem.getItemId() - Menu.FIRST], realMenuItem); + } + + @Override + public void onDestroyActionMode(final ActionMode actionMode) { + ThreadUtils.assertOnUiThread(); + if (!mUseFloatingToolbar) { + clearSelection(); + } + mSession = null; + mSelection = null; + mActionMode = null; + } + + @SuppressWarnings("checkstyle:javadocmethod") + public void onGetContentRect(final @Nullable ActionMode mode, final @Nullable View view, + final @NonNull Rect outRect) { + ThreadUtils.assertOnUiThread(); + if (mSelection == null || mSelection.clientRect == null) { + return; + } + mSession.getClientToScreenMatrix(mTempMatrix); + mTempMatrix.mapRect(mTempRect, mSelection.clientRect); + mTempRect.roundOut(outRect); + } + + @TargetApi(Build.VERSION_CODES.M) + @Override + public void onShowActionRequest(final GeckoSession session, final Selection selection) { + ThreadUtils.assertOnUiThread(); + mSession = session; + mSelection = selection; + + if (mActionMode != null) { + if (isActionAvailable()) { + mActionMode.invalidate(); + } else { + mActionMode.finish(); + } + return; + } + + if (mUseFloatingToolbar) { + mActionMode = mActivity.startActionMode(new Callback2Wrapper(), + ActionMode.TYPE_FLOATING); + } else { + mActionMode = mActivity.startActionMode(this); + } + } + + @Override + public void onHideAction(final GeckoSession session, final int reason) { + ThreadUtils.assertOnUiThread(); + if (mActionMode == null) { + return; + } + + switch (reason) { + case HIDE_REASON_ACTIVE_SCROLL: + case HIDE_REASON_ACTIVE_SELECTION: + case HIDE_REASON_INVISIBLE_SELECTION: + if (mUseFloatingToolbar) { + // Hide the floating toolbar when scrolling/selecting. + mActionMode.finish(); + } + break; + + case HIDE_REASON_NO_SELECTION: + mActionMode.finish(); + break; + } + } +} \ No newline at end of file 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 25dbed0c..fd143e07 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 @@ -1,7 +1,7 @@ package com.darkweb.genesissearchengine.appManager.homeManager.homeController; import android.annotation.SuppressLint; -import android.app.Activity; +import android.app.ActivityOptions; import android.app.DownloadManager; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; @@ -78,8 +78,10 @@ import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoSession; import org.torproject.android.proxy.OrbotService; import org.torproject.android.proxy.util.Prefs; -import org.torproject.android.service.wrapper.LocaleHelper; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.torproject.android.proxy.wrapper.LocaleHelper; +import org.torproject.android.proxy.wrapper.orbotLocalConstants; + +import java.io.StringWriter; import java.lang.ref.WeakReference; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -91,6 +93,7 @@ import java.util.Locale; import java.util.Objects; import java.util.concurrent.Callable; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; +import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; @@ -192,6 +195,19 @@ public class homeController extends AppCompatActivity implements ComponentCallba super.onCreate(savedInstanceState); setContentView(R.layout.home_view); + Thread.setDefaultUncaughtExceptionHandler((t, e) -> { + status.sSettingIsAppStarted = false; + finishAndRemoveTask(); + + Intent intent = new Intent(this, homeController.class); + intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION); + intent.putExtra("crash",true); + this.startActivity(intent); + this.finish(); + + Runtime.getRuntime().exit(0); + }); + initPreFixes(); activityContextManager.getInstance().setHomeController(this); pluginController.getInstance().initializeAllServices(this); @@ -279,6 +295,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba initSuggestionView(new ArrayList<>(), strings.GENERIC_EMPTY_STR); } + public void onLoadTabFromTabController(){ Object mTempModel = dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); @@ -323,8 +340,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(), false, false, false); } onLoadTab(model.getSession(),false,true); - //onLoadURL(model.getSession().getCurrentURL()); - //mGeckoClient.onReload(mGeckoView, this); }else { onNewIntent(getIntent()); onOpenLinkNewTab(helperMethod.getDomainName(mHomeModel.getSearchEngine())); @@ -366,7 +381,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } private void initLocalLanguage() { - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this),pluginEnums.eLangManager.M_SET_LANGUAGE); + pluginController.getInstance().onLanguageInvoke(Arrays.asList(this, status.sSettingLanguage, status.sSettingLanguageRegion, status.mThemeApplying),pluginEnums.eLangManager.M_SET_LANGUAGE); } @Override @@ -464,6 +479,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void initPreFixes() { try { + if(getIntent().getBooleanExtra("crash", false)){ + new Handler().postDelayed(() -> + { + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_APPLICATION_CRASH); + }, 2000); + } + if(!status.mThemeApplying){ orbotLocalConstants.mTorLogsStatus = strings.GENERIC_EMPTY_STR; } @@ -547,6 +569,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false); } + public void onLoadURL(String url){ if(mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ mGeckoView.getSession().open(mGeckoClient.getmRuntime()); @@ -698,7 +721,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba super.onDestroy(); return; } - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DESTROY); + pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.mThemeApplying), pluginEnums.eOrbotManager.M_DESTROY); mBackSplash.setImageDrawable(null); mBackSplash.setBackground(null); @@ -965,6 +988,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba onLoadURL(url); } + public void onSearchString(String pString){ + String validated_url = mHomeModel.urlComplete(pString, mHomeModel.getSearchEngine()); + pString = validated_url; + + mHomeViewController.onUpdateSearchBar(pString,false,true, false); + onLoadURL(pString); + } + public void onSuggestionInvoked(View view){ String mVal = ((TextView)view.findViewById(R.id.pURL)).getText().toString(); if(mVal.equals(strings.GENERIC_EMPTY_STR)){ @@ -1382,7 +1413,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba isFocusChanging = false; isSuggestionSearchOpened = false; mSearchbar.requestFocus(); - mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor())); + mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor(), status.sTheme)); mSearchbar.selectAll(); mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); } @@ -1451,7 +1482,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba isFocusChanging = false; isSuggestionSearchOpened = false; mSearchbar.requestFocus(); - mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor())); + mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor(), status.sTheme)); mSearchbar.selectAll(); mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); } @@ -1536,7 +1567,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onStartApplication(View view){ - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_START_ORBOT); + pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sBridgeCustomBridge, status.sBridgeGatewayManual, status.sBridgeCustomType, status.sBridgeStatus, status.sShowImages, status.sClearOnExit, (String)dataController.getInstance().invokeBridges(dataEnums.eBridgeWebsiteCommands.M_FETCH, null)), pluginEnums.eOrbotManager.M_START_ORBOT); onInvokeProxyLoading(); mHomeViewController.initHomePage(); } @@ -1709,7 +1740,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if (menuId == R.id.pMenuQuit) { - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DESTROY); + pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.mThemeApplying), pluginEnums.eOrbotManager.M_DESTROY); new Handler().postDelayed(() -> { @@ -1852,6 +1883,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba 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)); + 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_GATEWAY_MANUAL,false)); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); @@ -1869,15 +1902,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_DATA_CLEARED); activityContextManager.getInstance().getHomeController().onClearSettings(); - status.sSettingIsAppStarted = false; finishAndRemoveTask(); Intent intent = new Intent(this, homeController.class); - intent.addFlags(FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION); this.startActivity(intent); - overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); - ((Activity) this).finish(); + overridePendingTransition(R.anim.popup_scale_in, R.anim.popup_scale_out); + this.finish(); Runtime.getRuntime().exit(0); @@ -2214,7 +2246,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } } else if(e_type.equals(enums.etype.on_load_error)){ - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(homeController.this), pluginEnums.eLangManager.M_SET_LANGUAGE); + pluginController.getInstance().onLanguageInvoke(Arrays.asList(homeController.this, status.sSettingLanguage, status.sSettingLanguageRegion, status.mThemeApplying), pluginEnums.eLangManager.M_SET_LANGUAGE); initLocalLanguage(); mHomeViewController.onPageFinished(); mGeckoClient.onRedrawPixel(homeController.this); 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 03ddfd6c..89b56c10 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 @@ -48,7 +48,7 @@ import com.example.myapplication.R; import com.google.android.gms.ads.AdView; import com.google.android.material.appbar.AppBarLayout; import org.mozilla.geckoview.GeckoView; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.torproject.android.proxy.wrapper.orbotLocalConstants; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -493,7 +493,7 @@ class homeViewController if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { ColorAnimator oneToTwo = new ColorAnimator(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2)); - int mDelay = 1350; + int mDelay = 500; if(status.mThemeApplying || mInstant){ mDelay = 0; } @@ -503,8 +503,8 @@ class homeViewController animator.addUpdateListener(animation -> { float v = (float) animation.getAnimatedValue(); - mContext.getWindow().setStatusBarColor(oneToTwo.with(v)); - mContext.getWindow().setStatusBarColor(oneToTwo.with(v)); + mSplashScreen.setAlpha(1-v); + mContext.getWindow().setStatusBarColor(oneToTwo.with(v*1f)); mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); }); animator.addListener(new AnimatorListenerAdapter() { @@ -526,7 +526,6 @@ class homeViewController } } }); - animator.start(); }else { mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); @@ -651,8 +650,12 @@ class homeViewController onClearSelections(false); mGeckoView.requestFocus(); mProgressBarIndeterminate.animate().cancel(); - mProgressBarIndeterminate.animate().setStartDelay(750).setDuration(250).alpha(0).withEndAction(() -> { - mSplashScreen.animate().setDuration(250).setStartDelay(300).alpha(0).withEndAction(() -> { + mProgressBarIndeterminate.animate().setStartDelay(350).setDuration(250).alpha(0).withEndAction(() -> { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + initStatusBarColor(false); + } + + mSplashScreen.animate().setDuration(0).setStartDelay(1000).alpha(0).withEndAction(() -> { mProgressBarIndeterminate.setVisibility(View.GONE); mSplashScreen.setClickable(false); mSplashScreen.setFocusable(false); @@ -671,9 +674,6 @@ class homeViewController }); mEvent.invokeObserver(null, enums.etype.M_WELCOME_MESSAGE); mOrbotLogManager.setClickable(false); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - initStatusBarColor(false); - } status.sSettingIsAppRestarting = true; } } @@ -1161,7 +1161,7 @@ class homeViewController if(url.length()<=300){ url = removeEndingSlash(url); - mSearchbar.setText(helperMethod.urlDesigner(url, mContext, mSearchbar.getCurrentTextColor())); + mSearchbar.setText(helperMethod.urlDesigner(url, mContext, mSearchbar.getCurrentTextColor(), status.sTheme)); mSearchbar.selectAll(); if(isTextSelected){ @@ -1224,6 +1224,7 @@ class homeViewController } mProgressBar.setVisibility(View.VISIBLE); + mProgressBar.setAlpha(1); mProgressBar.animate().cancel(); if(value != mProgressBar.getProgress()){ @@ -1234,8 +1235,6 @@ class homeViewController } if(value >= 100 || value<=0){ mProgressBar.animate().alpha(0).setStartDelay(200).withEndAction(() -> mProgressBar.setProgress(0)); - }else { - mProgressBar.setAlpha(1); } } } 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 c16b44e2..b3cd666f 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 @@ -154,7 +154,7 @@ public class languageController extends AppCompatActivity { getIntent().putExtra("activity_restarted",((LinearLayoutManager) Objects.requireNonNull(mRecycleView.getLayoutManager())).findFirstCompletelyVisibleItemPosition()); helperMethod.restartActivity(getIntent(), this); overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); - pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_SET_LANGUAGE); + pluginController.getInstance().onLanguageInvoke(Arrays.asList(this, status.sSettingLanguage, status.sSettingLanguageRegion, status.sTheme), pluginEnums.eLangManager.M_SET_LANGUAGE); if(activityContextManager.getInstance().getSettingController()!=null && !activityContextManager.getInstance().getSettingController().isDestroyed()){ activityContextManager.getInstance().getSettingController().onRedrawXML(); @@ -209,7 +209,7 @@ public class languageController extends AppCompatActivity { mLanguageViewController.onTrigger(languageEnums.eLanguagevViewController.M_UPDATE_BLOCKER, Collections.singletonList(true)); } else if(e_type.equals(languageEnums.eLanguageAdapterCallback.M_SYSTEM_LANGUAGE_SUPPORT_INFO)){ - return pluginController.getInstance().onLanguageInvoke(null, M_SUPPORTED_SYSTEM_LANGUAGE_INFO); + return pluginController.getInstance().onLanguageInvoke(Collections.singletonList(status.sSettingLanguage), M_SUPPORTED_SYSTEM_LANGUAGE_INFO); } return null; } 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 aa8d0ab1..c5540c6e 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 @@ -15,7 +15,7 @@ import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.eventObserver; import com.example.myapplication.R; -import org.torproject.android.service.wrapper.logRowModel; +import org.torproject.android.proxy.wrapper.logRowModel; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java index 9185a9bf..71bc473f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java @@ -28,8 +28,8 @@ import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.floatingactionbutton.FloatingActionButton; -import org.torproject.android.service.wrapper.logRowModel; -import org.torproject.android.service.wrapper.orbotLocalConstants; +import org.torproject.android.proxy.wrapper.logRowModel; +import org.torproject.android.proxy.wrapper.orbotLocalConstants; import java.util.ArrayList; import java.util.Collections; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java index bf9b10a3..26533e2b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java @@ -2,7 +2,7 @@ package com.darkweb.genesissearchengine.appManager.orbotLogManager; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import org.torproject.android.service.wrapper.logRowModel; +import org.torproject.android.proxy.wrapper.logRowModel; import java.util.ArrayList; import java.util.List; 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 83861260..af4f3e76 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 @@ -60,9 +60,8 @@ public class orbotController extends AppCompatActivity { 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(); - activityThemeManager.getInstance().onConfigurationChanged(this); } super.onConfigurationChanged(newConfig); @@ -152,7 +151,6 @@ public class orbotController extends AppCompatActivity { public boolean inSignatureArea(MotionEvent ev) { float mEventY = ev.getY(); float mEventX = ev.getX(); - Log.i("FUCKSSSS", helperMethod.getScreenWidth(this)-ev.getX() + "----" + ev.getX()); return mEventY>helperMethod.pxFromDp(500) || mEventX>helperMethod.getScreenWidth(this)-helperMethod.pxFromDp(80); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java index f2fb033e..bc5cc3b2 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java @@ -1,14 +1,9 @@ package com.darkweb.genesissearchengine.appManager.orbotManager; -import android.os.Build; import android.view.View; -import android.view.Window; -import android.view.WindowManager; import android.widget.LinearLayout; import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.ContextCompat; -import com.example.myapplication.R; +import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; import com.google.android.material.switchmaterial.SwitchMaterial; import java.util.List; @@ -34,21 +29,7 @@ class orbotViewController } private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } - } + sharedUIMethod.updateStatusBar(mContext); } private void bridgeSettingsStatus(boolean pStatus){ 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 4f6c1606..5f1f43d9 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 @@ -128,12 +128,8 @@ public class settingAdvanceController extends AppCompatActivity { @Override public void onBackPressed() { - if(mIsChanged){ - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_UPDATE_PRIVACY); - activityContextManager.getInstance().getHomeController().initRuntimeSettings(); - } + onClose(null); activityContextManager.getInstance().onRemoveStack(this); - finish(); } /*UI Redirection*/ @@ -146,7 +142,7 @@ public class settingAdvanceController extends AppCompatActivity { public void onClose(View view){ if(mIsChanged){ - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_UPDATE_PRIVACY); + pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sShowImages, status.sClearOnExit), pluginEnums.eOrbotManager.M_UPDATE_PRIVACY); activityContextManager.getInstance().getHomeController().initRuntimeSettings(); } finish(); 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 bfc8453c..869b147d 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,6 +11,7 @@ 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.appManager.bridgeManager.bridgeEnums; import com.darkweb.genesissearchengine.appManager.helpManager.helpController; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.enums; @@ -216,6 +217,9 @@ public class settingClearController extends AppCompatActivity { 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)); + 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_GATEWAY_MANUAL,false)); + if(mIsThemeChangable) { status.mThemeApplying = true; onBackPressed(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java index dd2b4e0d..52de6583 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/settingHomeManager/settingHomeController.java @@ -69,7 +69,7 @@ public class settingHomeController extends AppCompatActivity @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); - if(activityThemeManager.getInstance().onInitTheme(this)){ + if(activityThemeManager.getInstance().onInitTheme(this) && !status.mThemeApplying){ activityContextManager.getInstance().onResetTheme(); } 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 c3f0de37..472fca56 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java @@ -83,11 +83,17 @@ public class constants public static final String CONST_NOTIFICATION_TITLE = "Genesis Browser"; public static final int CONST_NOTIFICATION_ID_VALUE = 1; public static final int CONST_NOTIFICATION_REQUEST_CODE = 0; + public static final int mUserEngagementNotificationID = 1001; /*Language CONSTANTS*/ public static final String CONST_LANGUAGE_DEFAULT_LANG = "default"; + /*DOWNLOAD CONSTANTS*/ + + public static final String CONST_DOWNLOAD_COMMAND = "N_COMMAND"; + public static final String CONST_DOWNLOAD_INTENT_KEY = "N_ID"; + /*Helper CONSTANTS*/ public static final String CONST_HELP_MODEL_HEADER = "mHeader"; @@ -95,6 +101,7 @@ public class constants public static final String CONST_HELP_MODEL_ICON = "mIcon"; /*ENCRYPTION KEY*/ + public static final String CONST_ENCRYPTION_KEY = "Zr4u7x!A%D*F-JaNdRgUkXp2s5v8y/B?"; public static final String CONST_ENCRYPTION_KEY_DATABASE = "Zr4u7x!!A%D*F-JaNdsS@@gUbbp^^5v8y/B?"; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java index a9c0acff..9704d3df 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -17,8 +17,7 @@ public class status /*App Status*/ public static boolean sPaidStatus = false; - public static boolean sDeveloperBuild = true; - public static int mNotificationID = 1001; + public static boolean sDeveloperBuild = false; /*Settings Status*/ public static Locale mSystemLocale = null; 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 f42ab4e8..b395891d 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java @@ -125,6 +125,12 @@ public class dataController return mReferenceWebsiteDataModel.onTrigger(pCommands, null); } + /*Trigger Bridges*/ + + public Object invokeBridges(dataEnums.eBridgeWebsiteCommands pCommands, List pData){ + return mBridgeWebsiteDataModel.onTrigger(pCommands, null); + } + /*Trigger Preferences*/ public Object invokePrefs(dataEnums.ePreferencesCommands pCommands, List pData){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java b/app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java index cf3b8175..30f2b572 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/eventObserver.java @@ -1,7 +1,5 @@ package com.darkweb.genesissearchengine; -import com.darkweb.genesissearchengine.constants.enums; - import java.util.List; public class eventObserver 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 8ea3aaf3..6ed5a7c1 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java @@ -4,12 +4,10 @@ import android.Manifest; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.annotation.SuppressLint; -import android.app.ActivityManager; import android.app.DownloadManager; import android.content.ActivityNotFoundException; import android.content.ClipData; import android.content.ClipboardManager; -import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -25,7 +23,6 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.TransitionDrawable; import android.net.Uri; import android.os.Build; -import android.os.Environment; import android.os.Handler; import android.os.Vibrator; import android.text.SpannableString; @@ -36,10 +33,8 @@ import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewAnimationUtils; -import android.view.ViewGroup; import android.view.WindowManager; import android.view.animation.Animation; -import android.view.animation.AnimationUtils; import android.view.animation.RotateAnimation; import android.view.inputmethod.InputMethodManager; import android.webkit.MimeTypeMap; @@ -53,16 +48,10 @@ import androidx.core.app.ShareCompat; import androidx.core.content.ContextCompat; import androidx.core.content.FileProvider; import androidx.core.graphics.ColorUtils; - -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.FakeLauncherActivity; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; import com.example.myapplication.R; - import org.xmlpull.v1.XmlPullParserException; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -77,7 +66,6 @@ import java.net.URLConnection; import java.security.Key; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Base64; import java.util.Calendar; import java.util.Date; import java.util.List; @@ -86,7 +74,6 @@ import java.util.UUID; import java.util.concurrent.Callable; import java.util.regex.Matcher; import java.util.regex.Pattern; - import javax.crypto.Cipher; import javax.net.ssl.HttpsURLConnection; import static android.content.Context.LAYOUT_INFLATER_SERVICE; @@ -216,10 +203,10 @@ public class helperMethod return size.x; } - public static SpannableString urlDesigner(String url, Context pContext, int pDefColor){ + public static SpannableString urlDesigner(String url, Context pContext, int pDefColor, int pTheme){ int mColor = 0; - if(status.sTheme == enums.Theme.THEME_DARK){ + if(pTheme == enums.Theme.THEME_DARK){ mColor = Color.argb(255, 0, 204, 71); }else { mColor = Color.argb(255, 0, 153, 54); @@ -790,7 +777,7 @@ public class helperMethod return month + "/" + year + " | " + hour + ":" + minute + ":" + second; } - public static PopupWindow onCreateMenu(View p_view, int p_layout) { + public static PopupWindow onCreateMenu(View p_view, int p_layout, String pSettingLanguageRegion) { PopupWindow popupWindow; LayoutInflater layoutInflater @@ -809,7 +796,7 @@ public class helperMethod popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); popupWindow.setAnimationStyle(R.style.popup_window_animation); - if(status.sSettingLanguageRegion.equals("Ur")){ + if(pSettingLanguageRegion.equals("Ur")){ popupWindow.showAtLocation(p_view, Gravity.TOP|Gravity.START,0,0); }else { popupWindow.showAtLocation(p_view, Gravity.TOP|Gravity.END,0,0); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/adManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/adManager.java index 0f4affe3..a8d002bf 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/adManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adPluginManager/adManager.java @@ -80,9 +80,7 @@ public class adManager @Override public void onAdFailedToLoad(@NonNull LoadAdError var1) { - Log.i("sadsa",""); } - }); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java index 0bd36f23..1426af1d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticPluginManager/analyticManager.java @@ -1,8 +1,6 @@ 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; @@ -14,17 +12,20 @@ public class analyticManager /*Private Variables*/ private WeakReference mAppContext; + private boolean mIsDeveloperBuild; /*Initializations*/ - public analyticManager(WeakReference pAppContext, eventObserver.eventListener pEvent){ + public analyticManager(WeakReference pAppContext, eventObserver.eventListener pEvent, boolean pIsDeveloperBuild){ this.mAppContext = pAppContext; + this.mIsDeveloperBuild = pIsDeveloperBuild; + initialize(); } private void initialize() { - if(status.sDeveloperBuild){ + if(mIsDeveloperBuild){ new FlurryAgent.Builder() .withLogEnabled(true) .build(mAppContext.get().getApplicationContext(), "4C4K4T5ND9RJKT4H47GQ"); }else { new FlurryAgent.Builder() .withLogEnabled(true) .build(mAppContext.get().getApplicationContext(), "5RQYRV23928K6DXH8VWV"); @@ -43,6 +44,7 @@ public class analyticManager 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/downloadPluginManager/downloadReciever.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java index d89865d0..cf748550 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/downloadPluginManager/downloadReciever.java @@ -112,7 +112,7 @@ public class downloadReciever extends AsyncTask { .addAction(R.drawable.ic_download, "Cancel",pendingIntent) .setSmallIcon(android.R.drawable.stat_sys_download); - build.setOngoing(Prefs.persistNotifications()); + // build.setOngoing(Prefs.persistNotifications()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel channel = new NotificationChannel(mID + "", diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java index ccc75f8c..6907245e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/langPluginManager/langManager.java @@ -4,10 +4,10 @@ import android.content.res.Configuration; import android.content.res.Resources; 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.Collections; import java.util.List; import java.util.Locale; @@ -21,37 +21,37 @@ public class langManager { /*Initializations*/ - public langManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, Locale pLanguage, Locale pSystemLocale) { + public langManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, Locale pLanguage, Locale pSystemLocale, String pSettingLanguage, String pSettingRegionLanguage, boolean pThemeApplying) { this.mEvent = pEvent; this.mLanguage = pLanguage; this.mSystemLocale = pSystemLocale; - onInitLanguage(pAppContext); + onInitLanguage(pAppContext, pSettingLanguage, pSettingRegionLanguage, pThemeApplying); } - private boolean initLocale(){ - if(!status.mThemeApplying){ + private boolean initLocale(Boolean pThemeApplying){ + if(!pThemeApplying){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { Locale mSystemLocale = Resources.getSystem().getConfiguration().getLocales().get(0); - if(mSystemLocale!=status.mSystemLocale || !mSystemLocale.getLanguage().equals(mLanguage.getLanguage()) ){ - status.mSystemLocale = mSystemLocale; + if(mSystemLocale!=mSystemLocale || !mSystemLocale.getLanguage().equals(mLanguage.getLanguage()) ){ + mEvent.invokeObserver(Collections.singletonList(mSystemLocale), pluginEnums.eLangManager.M_UPDATE_LOCAL); } } else { Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; - if(mSystemLocale!=status.mSystemLocale || !mSystemLocale.getLanguage().equals(mLanguage.getLanguage())){ - status.mSystemLocale = mSystemLocale; + if(mSystemLocale!=mSystemLocale || !mSystemLocale.getLanguage().equals(mLanguage.getLanguage())){ + mEvent.invokeObserver(Collections.singletonList(mSystemLocale), pluginEnums.eLangManager.M_UPDATE_LOCAL); } } } return false; } - private void onInitLanguage(AppCompatActivity pAppContext) { - if(status.sSettingLanguage.equals("default")){ + private void onInitLanguage(AppCompatActivity pAppContext, String pSettingLanguage, String pSettingRegionLanguage, Boolean pThemeApplying) { + if(pSettingLanguage.equals("default")){ if(!mLanguage.getLanguage().equals(Resources.getSystem().getConfiguration().locale.getLanguage()) || !mLanguage.getCountry().equals(Resources.getSystem().getConfiguration().locale.getCountry())) { if(mSystemLocale==null){ - initLocale(); + initLocale(pThemeApplying); } String mSystemLangugage = mSystemLocale.toString(); if(mSystemLangugage.equals("en_US") || mSystemLangugage.equals("de_DE") || mSystemLangugage.equals("ur_UR") || mSystemLangugage.equals("ur_PK") || mSystemLangugage.equals("ca_ES") || mSystemLangugage.equals("zh_CN") || mSystemLangugage.equals("ch_CZ") || mSystemLangugage.equals("nl_NL") || mSystemLangugage.equals("fr_FR") || mSystemLangugage.equals("el_GR") || mSystemLangugage.equals("hu_HU") || mSystemLangugage.equals("in_ID") || mSystemLangugage.equals("it_IT") || mSystemLangugage.equals("ja_JP") || mSystemLangugage.equals("ko_KR") || mSystemLangugage.equals("pt_PT") || mSystemLangugage.equals("ro_RO") || mSystemLangugage.equals("ru_RU") || mSystemLangugage.equals("th_TH") || mSystemLangugage.equals("tr_TR") || mSystemLangugage.equals("uk_UA") || mSystemLangugage.equals("vi_VN")){ @@ -69,7 +69,7 @@ public class langManager { return; } }else { - mLanguage = new Locale(status.sSettingLanguage, status.sSettingLanguageRegion); + mLanguage = new Locale(pSettingLanguage, pSettingRegionLanguage); } Locale.setDefault(mLanguage); @@ -81,16 +81,16 @@ public class langManager { /*Helper Methods*/ - private void onCreate(AppCompatActivity pActivity) { - onInitLanguage(pActivity); + private void onCreate(AppCompatActivity pActivity, String pSettingLanguage, String pSettingRegionLanguage, Boolean pThemeApplying) { + onInitLanguage(pActivity, pSettingLanguage, pSettingRegionLanguage, pThemeApplying); } - private void onResume(AppCompatActivity pActivity) { - onInitLanguage(pActivity); + private void onResume(AppCompatActivity pActivity, String pSettingLanguage, String pSettingRegionLanguage, Boolean pThemeApplying) { + onInitLanguage(pActivity, pSettingLanguage, pSettingRegionLanguage, pThemeApplying); } - private String getSupportedSystemLanguageInfo() { - if(status.sSettingLanguage.equals("default")){ + private String getSupportedSystemLanguageInfo(String pSettingLanguage) { + if(pSettingLanguage.equals("default")){ Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; String mSystemLangugage = mSystemLocale.toString(); @@ -109,20 +109,20 @@ public class langManager { public Object onTrigger(List pData, pluginEnums.eLangManager pEventType) { if(pEventType.equals(pluginEnums.eLangManager.M_ACTIVITY_CREATED)) { - onCreate((AppCompatActivity) pData.get(0)); + onCreate((AppCompatActivity) pData.get(0), (String)pData.get(1), (String)pData.get(2), (boolean)pData.get(3)); } else if(pEventType.equals(pluginEnums.eLangManager.M_RESUME)) { - initLocale(); - onResume((AppCompatActivity) pData.get(0)); + initLocale((boolean)pData.get(3)); + onResume((AppCompatActivity) pData.get(0), (String)pData.get(1), (String)pData.get(2), (boolean)pData.get(3)); } else if(pEventType.equals(pluginEnums.eLangManager.M_SET_LANGUAGE)) { - onInitLanguage((AppCompatActivity) pData.get(0)); + onInitLanguage((AppCompatActivity) pData.get(0), (String) pData.get(1), (String) pData.get(2), (boolean)pData.get(3)); } else if(pEventType.equals(pluginEnums.eLangManager.M_SUPPORTED_SYSTEM_LANGUAGE_INFO)) { - return getSupportedSystemLanguageInfo(); + return getSupportedSystemLanguageInfo((String) pData.get(0)); } return null; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java index 241ccb29..20630feb 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java @@ -10,6 +10,7 @@ import android.graphics.drawable.InsetDrawable; import android.net.Uri; import android.os.Handler; import android.view.Gravity; +import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.EditText; @@ -19,7 +20,6 @@ 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; @@ -260,6 +260,12 @@ public class messageManager mDialog.setOnDismissListener(dialog -> onClearReference()); } + private void applicationCrashed() + { + initializeDialog(R.layout.application_crash, Gravity.BOTTOM); + mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); + mDialog.setOnDismissListener(dialog -> onClearReference()); + } private void openSecureConnectionPopup() { @@ -327,11 +333,14 @@ public class messageManager private void onUpdateBridges() { + String mCustomBridge = (String) mEvent.invokeObserver(null, M_CUSTOM_BRIDGE); + String mBridgeType = (String) mEvent.invokeObserver(null, M_BRIDGE_TYPE); + 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); + if(!mCustomBridge.equals("meek") && !mCustomBridge.equals("obfs4")){ + ((EditText)mDialog.findViewById(R.id.pBridgeInput)).setText(mCustomBridge); + ((EditText)mDialog.findViewById(R.id.pBridgeType)).setText(mBridgeType); } mDialog.setOnShowListener(dialog -> mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)); @@ -358,11 +367,41 @@ public class messageManager handler.postDelayed(runnable, 200); }); + mDialog.findViewById(R.id.mClear).setOnClickListener(v -> { + EditText mBridges = mDialog.findViewById(R.id.pBridgeInput); + TextView mTextView = mDialog.findViewById(R.id.pDescriptionError); + + mBridges.setText(strings.GENERIC_EMPTY_STR); + mTextView.animate().setDuration(250).alpha(0); + }); + mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + String mBridges = ((EditText)mDialog.findViewById(R.id.pBridgeInput)).getText().toString(); + + boolean mBridgeTypeExist = !mBridges.contains("obfs3") && !mBridges.contains("obfs4") && !mBridges.contains("fle") && !mBridges.contains("meek"); + boolean mBridgeSize = mBridges.length()<10 || !mBridges.contains(".") || !mBridges.contains(" "); + + if(mBridgeTypeExist || mBridgeSize){ + TextView mTextView = mDialog.findViewById(R.id.pDescriptionError); + if(mTextView.getAlpha()==0 || mTextView.getAlpha()==1 || mTextView.getVisibility()!=View.VISIBLE){ + mTextView.setAlpha(0); + + mTextView.setVisibility(View.VISIBLE); + mTextView.animate().setDuration(250).alpha(1); + if(mBridgeTypeExist){ + mTextView.setText("➔ Invalid bridge string"); + } + else if(mBridgeSize){ + mTextView.setText("➔ Invalid bridge type"); + } + } + return; + } + 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); + mEvent.invokeObserver(Arrays.asList(mBridges, ((EditText)mDialog.findViewById(R.id.pBridgeType)).getText().toString()), M_SET_BRIDGES); }); } @@ -675,6 +714,11 @@ public class messageManager dataClearedSuccessfully(); break; + case M_APPLICATION_CRASH: + /*VERIFIED*/ + applicationCrashed(); + break; + case M_SECURE_CONNECTION: /*VERIFIED*/ openSecureConnectionPopup(); 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 index 579df878..e706ac34 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/localEngagementManager.java @@ -10,21 +10,19 @@ 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; +import static com.darkweb.genesissearchengine.constants.constants.mUserEngagementNotificationID; public class localEngagementManager extends BroadcastReceiver { public void onReceive (Context context , Intent intent) { try{ - final int NOTIFY_ID = status.mNotificationID; + final int NOTIFY_ID = mUserEngagementNotificationID; String pTitle = strings.NOTIFICATION_TITLE; String pBody = strings.NOTIFICATION_BODY[new Random().nextInt(strings.NOTIFICATION_BODY.length)]; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java index 45a9121e..0996a6a4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/notificationPluginManager/notifictionManager.java @@ -33,7 +33,7 @@ public class notifictionManager private void onNotificationClear(){ NotificationManager notificationManager = (NotificationManager) mAppContext.get().getSystemService(Context.NOTIFICATION_SERVICE); - notificationManager.cancel(status.mNotificationID); + notificationManager.cancel(mUserEngagementNotificationID); } private void onCreateUserEngagementNotification(int pDelay){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java index 8cff22a8..e6f3a600 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotPluginManager/orbotManager.java @@ -6,11 +6,14 @@ 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 org.torproject.android.proxy.wrapper.orbotLocalConstants; import java.lang.ref.WeakReference; import java.util.List; -import com.darkweb.genesissearchengine.constants.*; + +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; @@ -43,11 +46,12 @@ public class orbotManager this.mAppContext = null; } - private void onStartOrbot(){ - orbotLocalConstants.mBridges = status.sBridgeCustomBridge; - orbotLocalConstants.mIsManualBridge = status.sBridgeGatewayManual; - orbotLocalConstants.mManualBridgeType = status.sBridgeCustomType; - Prefs.putBridgesEnabled(status.sBridgeStatus); + private void onStartOrbot(String pBridgeCustomBridge, boolean pBridgeGatewayManual, String pBridgeCustomType, boolean pBridgeStatus, int pShowImages, boolean mClearOnExit, String pBridgesDefault){ + orbotLocalConstants.mBridges = pBridgeCustomBridge; + orbotLocalConstants.mIsManualBridge = pBridgeGatewayManual; + orbotLocalConstants.mManualBridgeType = pBridgeCustomType; + orbotLocalConstants.mBridgesDefault = pBridgesDefault; + Prefs.putBridgesEnabled(pBridgeStatus); Intent mServiceIntent = new Intent(mAppContext.get().getApplicationContext(), OrbotService.class); mServiceIntent.setAction(ACTION_START); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { @@ -59,7 +63,7 @@ public class orbotManager mAppContext.get().startService(mServiceIntent); } - initializeProxy(); + initializeProxy(pShowImages, mClearOnExit); } /*Helper Methods*/ @@ -93,29 +97,15 @@ public class orbotManager /*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, 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() + private void initializeProxy(int pShowImages, boolean mClearOnExit) { PrefsHelper.setPref(keys.PROXY_TYPE, 0); PrefsHelper.setPref(keys.PROXY_SOCKS,null); @@ -138,25 +128,26 @@ public class orbotManager PrefsHelper.setPref("browser.cache.memory.enable",true); PrefsHelper.setPref("browser.cache.disk.capacity",1000); - onUpdatePrivacyPreferences(); + onUpdatePrivacyPreferences(pShowImages, mClearOnExit); } - private void onUpdatePrivacyPreferences() + private void onUpdatePrivacyPreferences(int pShowImages, boolean mClearOnExit) { - PrefsHelper.setPref(keys.PROXY_IMAGE, status.sShowImages); + PrefsHelper.setPref(keys.PROXY_IMAGE, pShowImages); + PrefsHelper.setPref("privacy.clearOnShutdown.cache",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.downloads",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.formdata",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.history",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.passwords",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.sessions",mClearOnExit); + PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",mClearOnExit); + 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); @@ -176,6 +167,10 @@ public class orbotManager return "Warning | " + orbotLocalConstants.mTorLogsStatus; } + else if(orbotLocalConstants.mTorLogsStatus.startsWith("Invalid Configuration")){ + return orbotLocalConstants.mTorLogsStatus; + } + if(!logs.contains("Bootstrapped") && !mLogsStarted){ logs = "Initializing Bootstrap"; mLogsStarted = true; @@ -202,8 +197,8 @@ public class orbotManager return OrbotService.getServiceObject().getProxyStatus(); } - private void onDestroy(){ - if(!status.mThemeApplying) { + private void onDestroy(boolean pThemeApplying){ + if(pThemeApplying) { OrbotService.getServiceObject().onDestroy(); } } @@ -233,11 +228,11 @@ public class orbotManager } else if(pEventType.equals(pluginEnums.eOrbotManager.M_UPDATE_PRIVACY)) { - onUpdatePrivacyPreferences(); + onUpdatePrivacyPreferences((int) pData.get(0),(boolean) pData.get(1)); } else if(pEventType.equals(pluginEnums.eOrbotManager.M_START_ORBOT)) { - onStartOrbot(); + onStartOrbot((String) pData.get(0),(boolean) pData.get(1),(String) pData.get(2),(boolean) pData.get(3),(int) pData.get(4),(boolean) pData.get(5),(String) pData.get(6)); } else if(pEventType.equals(pluginEnums.eOrbotManager.M_IS_ORBOT_RUNNING)) { @@ -273,7 +268,7 @@ public class orbotManager } else if(pEventType.equals(pluginEnums.eOrbotManager.M_DESTROY)) { - onDestroy(); + onDestroy((boolean) pData.get(0)); } 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 9d4401c2..20a3cd6d 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java @@ -29,6 +29,8 @@ 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.eLangManager.M_ACTIVITY_CREATED; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eLangManager.M_RESUME; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.*; @@ -59,7 +61,7 @@ public class pluginController } public void preInitialize(homeController context){ - mLangManager = new langManager(context,new langCallback(), new Locale(status.sSettingLanguage), status.mSystemLocale); + mLangManager = new langManager(context,new langCallback(), new Locale(status.sSettingLanguage), status.mSystemLocale, status.sSettingLanguage, status.sSettingLanguageRegion, status.mThemeApplying); } public void initialize(){ @@ -79,7 +81,7 @@ public class pluginController mNotificationManager = new notifictionManager(mHomeController,new notificationCallback()); mAdManager = new adManager(new admobCallback(), ((homeController)mHomeController.get()).getBannerAd(), status.sPaidStatus); - mAnalyticsManager = new analyticManager(mHomeController,new analyticCallback()); + mAnalyticsManager = new analyticManager(mHomeController,new analyticCallback(), status.sDeveloperBuild); mMessageManager = new messageManager(new messageCallback()); mOrbotManager = orbotManager.getInstance(); mDownloadManager = new downloadManager(mHomeController,new downloadCallback()); @@ -187,6 +189,11 @@ public class pluginController if(mLangManager==null){ return null; } + + if(pEventType.equals(M_RESUME) || pEventType.equals(M_ACTIVITY_CREATED)){ + return mLangManager.onTrigger(Arrays.asList(pData.get(0), status.sSettingLanguage, status.sSettingLanguageRegion, status.mThemeApplying), pEventType); + } + return mLangManager.onTrigger(pData, pEventType); } @@ -194,6 +201,9 @@ public class pluginController @Override public Object invokeObserver(List data, Object event_type) { + if(event_type.equals(pluginEnums.eLangManager.M_UPDATE_LOCAL)){ + status.mSystemLocale = (Locale)data.get(0); + } return null; } } @@ -261,6 +271,12 @@ public class pluginController else if(pEventType.equals(M_APP_RATED)){ dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true)); } + else if(pEventType.equals(M_CUSTOM_BRIDGE)){ + return status.sBridgeCustomBridge; + } + else if(pEventType.equals(M_BRIDGE_TYPE)){ + return status.sBridgeCustomType; + } else if(pEventType.equals(M_DOWNLOAD_FILE)){ ((homeController)mHomeController.get()).onDownloadFile(); } 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 7b4428f6..cbcf790e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java @@ -19,7 +19,7 @@ public class pluginEnums /*Lanuage Manager*/ public enum eLangManager{ - M_SET_LANGUAGE, M_ACTIVITY_CREATED, M_RESUME, M_SUPPORTED_SYSTEM_LANGUAGE_INFO, M_INIT_LOCALE + M_SET_LANGUAGE, M_ACTIVITY_CREATED, M_RESUME, M_SUPPORTED_SYSTEM_LANGUAGE_INFO, M_INIT_LOCALE, M_UPDATE_LOCAL } public enum eLangManagerCallbacks{ @@ -28,10 +28,10 @@ public class pluginEnums /*Message Manager*/ public enum eMessageManager{ - M_RESET, M_DATA_CLEARED, M_SECURE_CONNECTION, M_POPUP_BLOCKED, M_PANIC, M_MAX_TAB_REACHED,M_DOWNLOAD_SINGLE, M_UPDATE_BRIDGES, M_NEW_IDENTITY, M_NOT_SUPPORTED, M_BRIDGE_MAIL, M_LONG_PRESS_WITH_LINK, M_LONG_PRESS_URL, M_LONG_PRESS_DOWNLOAD, M_START_ORBOT, M_DOWNLOAD_FAILURE, M_DOWNLOAD_FILE, M_RATE_APP, M_REPORT_URL, M_CLEAR_BOOKMARK, M_CLEAR_HISTORY, M_BOOKMARK, M_PANIC_RESET, M_RATE_SUCCESS, M_RATE_FAILURE, M_LANGUAGE_SUPPORT_FAILURE, M_WELCOME + M_RESET, M_DATA_CLEARED, M_APPLICATION_CRASH, M_SECURE_CONNECTION, M_POPUP_BLOCKED, M_PANIC, M_MAX_TAB_REACHED,M_DOWNLOAD_SINGLE, M_UPDATE_BRIDGES, M_NEW_IDENTITY, M_NOT_SUPPORTED, M_BRIDGE_MAIL, M_LONG_PRESS_WITH_LINK, M_LONG_PRESS_URL, M_LONG_PRESS_DOWNLOAD, M_START_ORBOT, M_DOWNLOAD_FAILURE, M_DOWNLOAD_FILE, M_RATE_APP, M_REPORT_URL, M_CLEAR_BOOKMARK, M_CLEAR_HISTORY, M_BOOKMARK, M_PANIC_RESET, M_RATE_SUCCESS, M_RATE_FAILURE, M_LANGUAGE_SUPPORT_FAILURE, M_WELCOME } public enum eMessageManagerCallbacks{ - M_CANCEL_WELCOME, M_APP_RATED, M_DOWNLOAD_FILE_MANUAL, M_OPEN_LINK_CURRENT_TAB, M_COPY_LINK, M_REQUEST_BRIDGES, M_SET_BRIDGES, M_OPEN_LINK_NEW_TAB, M_CLEAR_TAB, M_RATE_APPLICATION, M_OPEN_PRIVACY + M_CANCEL_WELCOME, M_APP_RATED, M_DOWNLOAD_FILE_MANUAL, M_OPEN_LINK_CURRENT_TAB, M_COPY_LINK, M_REQUEST_BRIDGES, M_SET_BRIDGES, M_OPEN_LINK_NEW_TAB, M_CLEAR_TAB, M_RATE_APPLICATION, M_OPEN_PRIVACY, M_CUSTOM_BRIDGE, M_BRIDGE_TYPE } /*Download Manager*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java index 47d02bcf..bbb55d08 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginReciever/downloadNotificationReciever.java @@ -7,13 +7,15 @@ import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import java.util.Collections; +import static com.darkweb.genesissearchengine.constants.constants.*; + public class downloadNotificationReciever extends BroadcastReceiver { public void onReceive (Context context , Intent intent) { - int mCommand = intent.getExtras().getInt("N_COMMAND"); + int mCommand = intent.getExtras().getInt(CONST_DOWNLOAD_COMMAND); if(mCommand==1){ - pluginController.getInstance().onDownloadInvoke(Collections.singletonList(intent.getExtras().getInt("N_ID")), pluginEnums.eDownloadManager.M_TRIGGER); + pluginController.getInstance().onDownloadInvoke(Collections.singletonList(intent.getExtras().getInt(CONST_DOWNLOAD_INTENT_KEY)), pluginEnums.eDownloadManager.M_TRIGGER); }else if(mCommand==0 || mCommand==2) { - pluginController.getInstance().onDownloadInvoke(Collections.singletonList(intent.getExtras().getInt("N_ID")), pluginEnums.eDownloadManager.M_CANCEL); + pluginController.getInstance().onDownloadInvoke(Collections.singletonList(intent.getExtras().getInt(CONST_DOWNLOAD_INTENT_KEY)), pluginEnums.eDownloadManager.M_CANCEL); } } } diff --git a/app/src/main/res/anim/popup_scale_in.xml b/app/src/main/res/anim/popup_scale_in.xml new file mode 100644 index 00000000..62fefe5b --- /dev/null +++ b/app/src/main/res/anim/popup_scale_in.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/popup_scale_out.xml b/app/src/main/res/anim/popup_scale_out.xml new file mode 100644 index 00000000..c263dad2 --- /dev/null +++ b/app/src/main/res/anim/popup_scale_out.xml @@ -0,0 +1,21 @@ + + + + + + + \ 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 index ae716280..c90d37d8 100644 --- a/app/src/main/res/custom-xml/generic/xml-v25/shortcuts.xml +++ b/app/src/main/res/custom-xml/generic/xml-v25/shortcuts.xml @@ -10,7 +10,7 @@ + android:targetClass="com.darkweb.genesissearchengine.appManager.externalCommandManager.externalShortcutController"> @@ -23,7 +23,7 @@ + android:targetClass="com.darkweb.genesissearchengine.appManager.externalCommandManager.externalShortcutController"> @@ -36,7 +36,7 @@ + android:targetClass="com.darkweb.genesissearchengine.appManager.externalCommandManager.externalShortcutController"> diff --git a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_bridge_settings.xml b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_bridge_settings.xml new file mode 100644 index 00000000..6ac53b38 --- /dev/null +++ b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_bridge_settings.xml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_repair.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_repair.xml new file mode 100644 index 00000000..ad5e4b42 --- /dev/null +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_repair.xml @@ -0,0 +1,6 @@ + + + + diff --git a/app/src/main/res/layouts/alert/layout/application_crash.xml b/app/src/main/res/layouts/alert/layout/application_crash.xml new file mode 100644 index 00000000..970ff2be --- /dev/null +++ b/app/src/main/res/layouts/alert/layout/application_crash.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + +