From f7384e8b5364fd3b5a155110c865a846160a2888 Mon Sep 17 00:00:00 2001 From: Genesis Date: Tue, 15 Jun 2021 16:18:26 +0500 Subject: [PATCH] Bug Fixes --- .idea/inspectionProfiles/Project_Default.xml | 1 + app/src/main/AndroidManifest.xml | 2 +- .../geckoManager/geckoSession.java | 15 +- .../homeController/homeController.java | 1 + .../appManager/tabManager/tabController.java | 2 +- .../dataManager/sqlCipherDataModel.java | 16 +- .../messagePluginManager/messageManager.java | 4 +- .../orbotPluginManager/orbotManager.java | 9 ++ .../widget/Genesis/constants/constants.java | 7 +- .../com/widget/Genesis/eventObserver.java | 2 +- .../Genesis/helperMethod/helperMethod.java | 18 ++- .../widgetManager/widgetController.java | 146 ++++++++---------- .../Genesis/widgetManager/widgetEnums.java | 20 ++- .../widgetManager/widgetModelController.java | 22 +-- .../widgetManager/widgetViewController.java | 130 ++++------------ .../com/widget/search/constants/enums.java | 49 ------ .../com/widget/search/constants/keys.java | 70 --------- .../com/widget/search/constants/messages.java | 10 -- .../java/com/widget/search/constants/sql.java | 12 -- .../com/widget/search/constants/status.java | 139 ----------------- .../com/widget/search/constants/strings.java | 67 -------- app/src/main/res/anim/linear_out_slow_in.xml | 6 + .../layout/widget_search_controller.xml | 98 +++++++----- .../android/service/OrbotService.java | 22 ++- .../android/service/util/Prefs.java | 4 + 25 files changed, 253 insertions(+), 619 deletions(-) delete mode 100644 app/src/main/java/com/widget/search/constants/enums.java delete mode 100644 app/src/main/java/com/widget/search/constants/keys.java delete mode 100644 app/src/main/java/com/widget/search/constants/messages.java delete mode 100644 app/src/main/java/com/widget/search/constants/sql.java delete mode 100644 app/src/main/java/com/widget/search/constants/status.java delete mode 100644 app/src/main/java/com/widget/search/constants/strings.java diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 279d02fa..676c6da7 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -25,6 +25,7 @@ + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ce700394..1b423aba 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -28,7 +28,7 @@ android:theme="@style/AppTheme" android:usesCleartextTraffic="true" tools:targetApi="n"> - + 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 3a3fabc1..cddb1803 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 @@ -402,7 +402,10 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes public GeckoResult onVisited(@NonNull GeckoSession var1, @NonNull String var2, @Nullable String var3, int var4) { if(var4==3 || var4==5 || var4==1){ event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_url_load); - m_current_url_id = (int)event.invokeObserver(Arrays.asList(var2,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); + Object mID = event.invokeObserver(Arrays.asList(var2,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); + if(mID!=null){ + m_current_url_id = (int)mID; + } isPageLoading = false; } return null; @@ -438,7 +441,15 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes if(!mIsLoaded){ return; } - if(wasBackPressed && mHistoryList.get(mHistoryList.getCurrentIndex()-1).getUri().equals(var2)){ + + boolean mPastURLVerify = false; + try { + if(mHistoryList.getCurrentIndex()-1>=0 && mHistoryList.getCurrentIndex()-1 { helperMethod.openActivity(settingAdvanceController.class, constants.CONST_LIST_HISTORY, activityContextManager.getInstance().getHomeController(),true); - }, 300); + }, 250); } mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_DISMISS_MENU, null); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java index 7a67f876..7cdfd8e5 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/sqlCipherDataModel.java @@ -145,19 +145,17 @@ public class sqlCipherDataModel tabRowModel model = new tabRowModel(c.getString(0), c.getString(1),c.getBlob(4)); GeckoSession.SessionState session = null; try { - // if(status.sRestoreTabs){ session = GeckoSession.SessionState.fromString(c.getString(6)); - // } + model.setSession(mSession, c.getString(3),c.getString(2), c.getString(5), session); + model.getSession().setSessionID(model.getmId()); + if(session != null){ + mTempListModel.add(0, model); + }else { + mTempListModel.add(model); + } } catch (Exception ex) { ex.printStackTrace(); } - model.setSession(mSession, c.getString(3),c.getString(2), c.getString(5), session); - model.getSession().setSessionID(model.getmId()); - if(session != null){ - mTempListModel.add(0, model); - }else { - mTempListModel.add(model); - } } while(c.moveToNext()); } c.close(); 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 9416161b..cb786c28 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 @@ -49,7 +49,6 @@ public class messageManager private void onClearReference(){ mContext = null; - mData = null; } private void initializeDialog(int pLayout, int pGravity){ @@ -631,7 +630,7 @@ public class messageManager } void onReset(){ - if(mDialog !=null){ + if(mDialog !=null && !mDialog.isShowing()){ mDialog.dismiss(); } } @@ -642,6 +641,7 @@ public class messageManager { if(!pEventType.equals(M_RATE_FAILURE) && !pEventType.equals(M_RATE_SUCCESS) && !pEventType.equals(M_NOT_SUPPORTED)){ onClearReference(); + mData = null; } if(pEventType.equals(pluginEnums.eMessageManager.M_RESET)){ onReset(); 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 e45009ee..ba597dbb 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 @@ -2,6 +2,9 @@ package com.darkweb.genesissearchengine.pluginManager.orbotPluginManager; import android.content.Intent; import android.os.Build; +import android.os.Handler; +import android.view.View; + import androidx.appcompat.app.AppCompatActivity; import org.mozilla.gecko.PrefsHelper; import org.torproject.android.service.OrbotService; @@ -9,14 +12,20 @@ import org.torproject.android.service.util.Prefs; import org.torproject.android.service.wrapper.orbotLocalConstants; import java.lang.ref.WeakReference; +import java.util.Collections; import java.util.List; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.eventObserver; +import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; +import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_APPLICATION_CRASH; import static org.torproject.android.service.TorServiceConstants.ACTION_START; diff --git a/app/src/main/java/com/widget/Genesis/constants/constants.java b/app/src/main/java/com/widget/Genesis/constants/constants.java index bc06d783..c3d7ed52 100644 --- a/app/src/main/java/com/widget/Genesis/constants/constants.java +++ b/app/src/main/java/com/widget/Genesis/constants/constants.java @@ -1,10 +1,7 @@ -package com.widget.search.constants; - -import static com.darkweb.genesissearchengine.constants.constants.CONST_WIDGET_NAME; +package com.widget.Genesis.constants; public class constants { /*LOCAL URL CONSTANTS*/ - public static final String SHARED_PREF_FILE = CONST_WIDGET_NAME; - public static final String COUNT_KEY = "count"; + } diff --git a/app/src/main/java/com/widget/Genesis/eventObserver.java b/app/src/main/java/com/widget/Genesis/eventObserver.java index a04781fc..69aab19b 100644 --- a/app/src/main/java/com/widget/Genesis/eventObserver.java +++ b/app/src/main/java/com/widget/Genesis/eventObserver.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine; +package com.widget.Genesis; import java.util.List; diff --git a/app/src/main/java/com/widget/Genesis/helperMethod/helperMethod.java b/app/src/main/java/com/widget/Genesis/helperMethod/helperMethod.java index ad7e789a..38b975bb 100644 --- a/app/src/main/java/com/widget/Genesis/helperMethod/helperMethod.java +++ b/app/src/main/java/com/widget/Genesis/helperMethod/helperMethod.java @@ -1,19 +1,31 @@ -package com.widget.search.helperMethod; +package com.widget.Genesis.helperMethod; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; -import com.widget.search.searchWidgetManager; +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.keys; +import com.widget.Genesis.widgetManager.widgetController; + +import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; +import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; public class helperMethod { /*Helper Methods General*/ public static PendingIntent onCreatePendingIntent(Context pContext,int pFlag, int pID, String pAction){ - Intent intentUpdate = new Intent(pContext, searchWidgetManager.class); + Intent intentUpdate = new Intent(pContext, widgetController.class); intentUpdate.setAction(pAction); PendingIntent pendingUpdate = PendingIntent.getBroadcast(pContext, pID, intentUpdate, pFlag); return pendingUpdate; } + public static void onStartApplication(Context pContext,String pPackageName){ + Intent launchIntent = pContext.getPackageManager().getLaunchIntentForPackage(pPackageName); + pContext.startActivity(launchIntent); + } + } diff --git a/app/src/main/java/com/widget/Genesis/widgetManager/widgetController.java b/app/src/main/java/com/widget/Genesis/widgetManager/widgetController.java index cc0dc5ee..ab129edc 100644 --- a/app/src/main/java/com/widget/Genesis/widgetManager/widgetController.java +++ b/app/src/main/java/com/widget/Genesis/widgetManager/widgetController.java @@ -1,97 +1,54 @@ -package com.widget.search; +package com.widget.Genesis.widgetManager; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; -import android.graphics.Color; import android.os.Bundle; -import android.view.View; import android.widget.RemoteViews; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.eventObserver; import com.example.myapplication.R; -import com.widget.search.helperMethod.helperMethod; -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; +import com.widget.Genesis.helperMethod.helperMethod; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; -public class searchWidgetManager extends AppWidgetProvider { +public class widgetController extends AppWidgetProvider { + + /*Model Declaration*/ + private widgetViewController mWidgetViewController; + private widgetModelController mWidgetModelController; /* Local Variables */ - int mCurrentWidth; + private int mCurrentWidth; + private RemoteViews mViews; /* Navigator Initializations */ - private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { + private void initializeAppWidget(Context pContext, AppWidgetManager pAppWidgetManager, int pAppWidgetId) { + initializeModel(pContext); + initializeLocalEventHandler(pContext, pAppWidgetId); + pAppWidgetManager.updateAppWidget(pAppWidgetId, mViews); + } - RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); + private void initializeLocalEventHandler(Context pContext, int pAppWidgetId){ + mViews.setOnClickPendingIntent(R.id.pTextInvoker, helperMethod.onCreatePendingIntent(pContext, pAppWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenApplication")); + mViews.setOnClickPendingIntent(R.id.pVoiceInvoker, helperMethod.onCreatePendingIntent(pContext, pAppWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenVoice")); + } - views.setOnClickPendingIntent(R.id.pTextInvoker, helperMethod.onCreatePendingIntent(context, appWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenApplication")); - views.setOnClickPendingIntent(R.id.pVoiceInvoker, helperMethod.onCreatePendingIntent(context, appWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenVoice")); - appWidgetManager.updateAppWidget(appWidgetId, views); + private void initializeModel(Context pContext){ + mViews = new RemoteViews(pContext.getPackageName(), R.layout.widget_search_controller); + mWidgetViewController = new widgetViewController(pContext, new widgetViewCallback(), mViews); + mWidgetModelController = new widgetModelController(new widgetModelCallback()); } public void onReceive(Context context, Intent intent) { - - String action = intent.getAction(); - switch (action) { - case enums.WidgetCommands.OPEN_APPLICATION: { - status.sWidgetResponse = enums.WidgetResponse.SEARCHBAR; - Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); - launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true); - context.startActivity(launchIntent); - break; - } - case enums.WidgetCommands.OPEN_VOICE: { - status.sWidgetResponse = enums.WidgetResponse.VOICE; - Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); - launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true); - context.startActivity(launchIntent); - break; - } - case AppWidgetManager.ACTION_APPWIDGET_UPDATE: { - Bundle extras = intent.getExtras(); - if (extras != null) { - int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); - if (appWidgetIds != null && appWidgetIds.length > 0) { - this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); - } - } - break; - } - case AppWidgetManager.ACTION_APPWIDGET_DELETED: { - Bundle extras = intent.getExtras(); - if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) { - final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); - this.onDeleted(context, new int[]{appWidgetId}); - } - break; - } - case AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED: { - Bundle extras = intent.getExtras(); - if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)&& extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) { - int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); - Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS); - this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context),appWidgetId, widgetExtras); - } - break; - } - - case AppWidgetManager.ACTION_APPWIDGET_RESTORED: { - Bundle extras = intent.getExtras(); - if (extras != null) { - int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS); - int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); - if (oldIds != null && oldIds.length > 0) { - this.onRestored(context, oldIds, newIds); - this.onUpdate(context, AppWidgetManager.getInstance(context), newIds); - } - } - break; - } - } + initializeModel(context); + mWidgetModelController.onTrigger(widgetEnums.eModelViewController.M_ON_RECIEVE, Arrays.asList(context, intent)); } + /* Local Overrides */ @Override @@ -102,20 +59,41 @@ public class searchWidgetManager extends AppWidgetProvider { @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { + initializeModel(context); if(mCurrentWidth!=0){ - RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); - int size = (int) Math.floor ((mCurrentWidth - 30) / 70);; - - if(size<=3){ - views.setViewVisibility(R.id.pVoiceInput, View.GONE); - views.setViewVisibility(R.id.pSearchInputWidget, View.GONE); - }else { - views.setViewVisibility(R.id.pVoiceInput, View.VISIBLE); - views.setViewVisibility(R.id.pSearchInputWidget, View.VISIBLE); - } - appWidgetManager.updateAppWidget(appWidgetIds, views); + int size = (int) Math.floor ((mCurrentWidth - 30) / 70); + mWidgetViewController.onTrigger(widgetEnums.eWidgetViewController.M_INIT, Collections.singletonList(size)); + appWidgetManager.updateAppWidget(appWidgetIds, mViews); }else { - updateAppWidget(context, appWidgetManager, appWidgetIds[0]); + initializeAppWidget(context, appWidgetManager, appWidgetIds[0]); + } + } + + /* Callbacks */ + + public class widgetViewCallback implements eventObserver.eventListener { + @Override + public Object invokeObserver(List data, Object e_type) { + return null; + } + } + + public class widgetModelCallback implements eventObserver.eventListener { + @Override + public Object invokeObserver(List data, Object e_type) { + if(e_type.equals(widgetEnums.eWidgetControllerCallback.M_UPDATE)){ + onUpdate((Context)data.get(0), (AppWidgetManager)data.get(1), (int[])data.get(2)); + } + else if(e_type.equals(widgetEnums.eWidgetControllerCallback.M_OPTION_CHANGE)){ + onAppWidgetOptionsChanged((Context)data.get(0), (AppWidgetManager)data.get(1), (int)data.get(2), (Bundle)data.get(3)); + } + else if(e_type.equals(widgetEnums.eWidgetControllerCallback.M_RESTORE)){ + onRestored((Context) data.get(0), (int[]) data.get(1), (int[]) data.get(2)); + } + else if(e_type.equals(widgetEnums.eWidgetControllerCallback.M_DELETE)){ + onDeleted((Context) data.get(0), (int[]) data.get(1)); + } + return null; } } } \ No newline at end of file diff --git a/app/src/main/java/com/widget/Genesis/widgetManager/widgetEnums.java b/app/src/main/java/com/widget/Genesis/widgetManager/widgetEnums.java index c87345b2..373a7dda 100644 --- a/app/src/main/java/com/widget/Genesis/widgetManager/widgetEnums.java +++ b/app/src/main/java/com/widget/Genesis/widgetManager/widgetEnums.java @@ -1,13 +1,21 @@ -package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; +package com.widget.Genesis.widgetManager; -public class settingHomeEnums +public class widgetEnums { - /*History Manager*/ - public enum eHomeModel { - } + /*Widget Manager*/ - public enum eHomeViewController { + public enum eWidgetViewController { M_INIT } + public enum eModelViewController { + M_ON_RECIEVE + } + + /*Widget Manager Callback*/ + + public enum eWidgetControllerCallback { + M_UPDATE, M_DELETE, M_OPTION_CHANGE, M_RESTORE + } + } \ No newline at end of file diff --git a/app/src/main/java/com/widget/Genesis/widgetManager/widgetModelController.java b/app/src/main/java/com/widget/Genesis/widgetManager/widgetModelController.java index 84cf2e9c..5886561d 100644 --- a/app/src/main/java/com/widget/Genesis/widgetManager/widgetModelController.java +++ b/app/src/main/java/com/widget/Genesis/widgetManager/widgetModelController.java @@ -1,24 +1,18 @@ package com.widget.Genesis.widgetManager; import android.appwidget.AppWidgetManager; -import android.appwidget.AppWidgetProvider; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.view.View; -import android.widget.RemoteViews; - import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.eventObserver; -import com.example.myapplication.R; import com.widget.Genesis.helperMethod.helperMethod; - +import java.util.Arrays; import java.util.List; - import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; -public class modelViewController extends AppWidgetProvider { +public class widgetModelController { /*Private Variables*/ @@ -26,7 +20,7 @@ public class modelViewController extends AppWidgetProvider { /*Initializations*/ - modelViewController(eventObserver.eventListener pEvent) + widgetModelController(eventObserver.eventListener pEvent) { this.mEvent = pEvent; } @@ -49,7 +43,7 @@ public class modelViewController extends AppWidgetProvider { if (extras != null) { int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); if (appWidgetIds != null && appWidgetIds.length > 0) { - this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); + mEvent.invokeObserver(Arrays.asList(context, AppWidgetManager.getInstance(context), appWidgetIds), widgetEnums.eWidgetControllerCallback.M_UPDATE); } } break; @@ -58,7 +52,7 @@ public class modelViewController extends AppWidgetProvider { Bundle extras = intent.getExtras(); if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) { final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); - this.onDeleted(context, new int[]{appWidgetId}); + mEvent.invokeObserver(Arrays.asList(context, new int[]{appWidgetId}), widgetEnums.eWidgetControllerCallback.M_DELETE); } break; } @@ -67,7 +61,7 @@ public class modelViewController extends AppWidgetProvider { if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)&& extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) { int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS); - this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context),appWidgetId, widgetExtras); + mEvent.invokeObserver(Arrays.asList(context, AppWidgetManager.getInstance(context),appWidgetId, widgetExtras), widgetEnums.eWidgetControllerCallback.M_OPTION_CHANGE); } break; } @@ -78,8 +72,8 @@ public class modelViewController extends AppWidgetProvider { int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS); int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); if (oldIds != null && oldIds.length > 0) { - this.onRestored(context, oldIds, newIds); - this.onUpdate(context, AppWidgetManager.getInstance(context), newIds); + mEvent.invokeObserver(Arrays.asList(context, oldIds, newIds), widgetEnums.eWidgetControllerCallback.M_RESTORE); + mEvent.invokeObserver(Arrays.asList(context, AppWidgetManager.getInstance(context), newIds), widgetEnums.eWidgetControllerCallback.M_UPDATE); } } break; diff --git a/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java b/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java index ee1c321a..6b5b28d6 100644 --- a/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java +++ b/app/src/main/java/com/widget/Genesis/widgetManager/widgetViewController.java @@ -1,120 +1,48 @@ package com.widget.Genesis.widgetManager; -import android.app.PendingIntent; -import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.content.Context; -import android.content.Intent; -import android.os.Bundle; import android.view.View; import android.widget.RemoteViews; -import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; + +import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeEnums; +import com.darkweb.genesissearchengine.eventObserver; import com.example.myapplication.R; -import com.widget.Genesis.helperMethod.helperMethod; -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; -public class widgetController extends AppWidgetProvider { +import java.util.List; - /* Local Variables */ +public class widgetViewController extends AppWidgetProvider { - int mCurrentWidth; + /*Private Variables*/ - /* Navigator Initializations */ + private eventObserver.eventListener mEvent; + private Context mContext; + private RemoteViews mViews; - private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { + /*Initializations*/ - RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); - - views.setOnClickPendingIntent(R.id.pTextInvoker, helperMethod.onCreatePendingIntent(context, appWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenApplication")); - views.setOnClickPendingIntent(R.id.pVoiceInvoker, helperMethod.onCreatePendingIntent(context, appWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenVoice")); - appWidgetManager.updateAppWidget(appWidgetId, views); + widgetViewController(Context pContext, eventObserver.eventListener pEvent, RemoteViews pViews) + { + this.mEvent = pEvent; + this.mContext = pContext; + this.mViews = pViews; } - public void onReceive(Context context, Intent intent) { - - String action = intent.getAction(); - switch (action) { - case enums.WidgetCommands.OPEN_APPLICATION: { - status.sWidgetResponse = enums.WidgetResponse.SEARCHBAR; - Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); - launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true); - context.startActivity(launchIntent); - break; - } - case enums.WidgetCommands.OPEN_VOICE: { - status.sWidgetResponse = enums.WidgetResponse.VOICE; - Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); - launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true); - context.startActivity(launchIntent); - break; - } - case AppWidgetManager.ACTION_APPWIDGET_UPDATE: { - Bundle extras = intent.getExtras(); - if (extras != null) { - int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); - if (appWidgetIds != null && appWidgetIds.length > 0) { - this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); - } - } - break; - } - case AppWidgetManager.ACTION_APPWIDGET_DELETED: { - Bundle extras = intent.getExtras(); - if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) { - final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); - this.onDeleted(context, new int[]{appWidgetId}); - } - break; - } - case AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED: { - Bundle extras = intent.getExtras(); - if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)&& extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) { - int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); - Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS); - this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context),appWidgetId, widgetExtras); - } - break; - } - - case AppWidgetManager.ACTION_APPWIDGET_RESTORED: { - Bundle extras = intent.getExtras(); - if (extras != null) { - int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS); - int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); - if (oldIds != null && oldIds.length > 0) { - this.onRestored(context, oldIds, newIds); - this.onUpdate(context, AppWidgetManager.getInstance(context), newIds); - } - } - break; - } - } - } - /* Local Overrides */ - - @Override - public void onAppWidgetOptionsChanged (Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle widgetInfo) { - mCurrentWidth = widgetInfo.getInt (AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH); - onUpdate(context, appWidgetManager, new int[]{appWidgetId}); - } - - @Override - public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { - if(mCurrentWidth!=0){ - RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); - int size = (int) Math.floor ((mCurrentWidth - 30) / 70);; - - if(size<=3){ - views.setViewVisibility(R.id.pVoiceInput, View.GONE); - views.setViewVisibility(R.id.pSearchInputWidget, View.GONE); - }else { - views.setViewVisibility(R.id.pVoiceInput, View.VISIBLE); - views.setViewVisibility(R.id.pSearchInputWidget, View.VISIBLE); - } - appWidgetManager.updateAppWidget(appWidgetIds, views); + private void initialize(int pSize){ + if(pSize<=3){ + mViews.setViewVisibility(R.id.pVoiceInput, View.GONE); + mViews.setViewVisibility(R.id.pSearchInputWidget, View.GONE); }else { - updateAppWidget(context, appWidgetManager, appWidgetIds[0]); + mViews.setViewVisibility(R.id.pVoiceInput, View.VISIBLE); + mViews.setViewVisibility(R.id.pSearchInputWidget, View.VISIBLE); } } + + public Object onTrigger(widgetEnums.eWidgetViewController pCommands, List pData){ + if(pCommands.equals(widgetEnums.eWidgetViewController.M_INIT)){ + initialize((int)pData.get(0)); + } + return null; + } + } \ No newline at end of file diff --git a/app/src/main/java/com/widget/search/constants/enums.java b/app/src/main/java/com/widget/search/constants/enums.java deleted file mode 100644 index a6acbd4d..00000000 --- a/app/src/main/java/com/widget/search/constants/enums.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.darkweb.genesissearchengine.constants; - -public class enums -{ - /*Settings Manager*/ - public enum etype{ - M_CHANGE_HOME_THEME, M_IS_ERROR_PAGE, on_update_favicon,M_RELOAD,ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW,ON_NEW_TAB_ANIMATION, M_UPDATE_SESSION_STATE,ON_LOAD_REQUEST, GECKO_SCROLL_UP, GECKO_SCROLL_UP_ALWAYS, GECKO_SCROLL_DOWN, WAS_SCROLL_CHANGED, GECKO_SCROLL_DOWN_MOVE, GECKO_SCROLL_UP_MOVE, GECKO_SCROLL_DOWN_CALLER,ON_UPDATE_SEARCH_BAR,M_ON_MAIL,SESSION_ID,M_UPDATE_PIXEL_BACKGROUND, M_ON_SCROLL_BOUNDARIES, M_ON_SCROLL_TOP_BOUNDARIES, M_ON_SCROLL_NO_BOUNDARIES, M_INIT_PADDING, M_RATE_COUNT,M_CACHE_UPDATE_TAB,M_DEFAULT_BROWSER, - on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,M_DOWNLOAD_FAILURE, M_ADVERT_LOADED, - welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT_FORCED,M_SPLASH_DISABLE,M_NEW_LINK_IN_NEW_TAB,M_RESET_SUGGESTION, - url_triggered, url_triggered_new_tab,url_clear,fetch_favicon, M_COPY_URL,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB, - on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_NEW_IDENTITY, M_NEW_IDENTITY_MESSAGED, M_INITIALIZE_TAB_SINGLE, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_FIRST_PAINT, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error, M_ORBOT_LOADING,download_file_popup,on_init_ads, M_GET_CURRENT_URL,search_update, open_new_tab,open_new_tab_instant - } - - /*General Enums*/ - - public static class AddTabCallback { - public static final int TAB_ADDED = 0; - public static final int TAB_FULL = 1; - } - - public static class Theme { - public static final int THEME_LIGHT = 0; - public static final int THEME_DARK = 1; - public static final int THEME_DEFAULT = 2; - } - - public static class WidgetResponse { - public static final int NONE = 0; - public static final int VOICE = 1; - public static final int SEARCHBAR = 2; - } - - public static class ImageQueueStatus { - public static final int M_IMAGE_LOADING = 0; - public static final int M_IMAGE_LOADED_SUCCESSFULLY = 1; - public static final int M_IMAGE_LOADING_FAILED = 2; - } - - public static class ScrollDirection { - public static final int HORIZONTAL = 0; - public static final int VERTICAL = 1; - } - - public static class WidgetCommands { - public static final String OPEN_APPLICATION = "mOpenApplication"; - public static final String OPEN_VOICE = "mOpenVoice"; - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/widget/search/constants/keys.java b/app/src/main/java/com/widget/search/constants/keys.java deleted file mode 100644 index 7745a57e..00000000 --- a/app/src/main/java/com/widget/search/constants/keys.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.darkweb.genesissearchengine.constants; - -public class keys -{ - /*Home page*/ - - public static String HOME_LOW_MEMORY = "LOW_MEMORY"; - public static final String HOME_REFERENCE_WEBSITES = "HOME_REFERENCE_WEBSITES"; - - /*Proxy Manager*/ - - public static final String PROXY_TYPE = "network.proxy.type"; - public static final String PROXY_SOCKS = "network.proxy.socks"; - public static final String PROXY_SOCKS_PORT = "network.proxy.socks_port"; - public static final String PROXY_SOCKS_VERSION = "network.proxy.socks_version"; - public static final String PROXY_SOCKS_REMOTE_DNS = "network.proxy.socks_remote_dns"; - public static final String PROXY_CACHE = "browser.cache.disk.enable"; - public static final String PROXY_MEMORY = "browser.cache.memory.enable"; - public static final String PROXY_DO_NOT_TRACK_HEADER_ENABLED = "privacy.donottrackheader.enabled"; - public static final String PROXY_DO_NOT_TRACK_HEADER_VALUE = "privacy.donottrackheader.value"; - public static final String PROXY_IS_APP_RATED = "IS_APP_RATED"; - public static final String PROXY_LIST_TYPE = "list_type"; - public static final String PROXY_IMAGE = "permissions.default.image"; - - /*Settings*/ - - public static final String SETTING_VERSION = "VERSION_V1"; - public static final String SETTING_LANGUAGE = "LANGUAGE_V1"; - public static final String SETTING_LANGUAGE_REGION = "LANGUAGE_REGION_V1"; - public static final String SETTING_SEARCH_ENGINE = "SEARCH_ENGINE_V1"; - public static final String SETTING_FIRST_INSTALLED = "FIRST_INSTALLED_V1"; - public static final String SETTING_JAVA_SCRIPT = "JAVA_SCRIPT_V1"; - public static final String SETTING_POPUP = "POPUP_V1"; - public static final String SETTING_HISTORY_CLEAR = "HISTORY_CLEAR_V1"; - public static final String SETTING_GATEWAY = "pref_bridges_enabled_auto_V1"; - public static final String SETTING_GATEWAY_MANUAL = "pref_bridges_enabled_manual_V1"; - public static final String SETTING_IS_BOOTSTRAPPED = "IS_BOOTSTRAPPED_V1"; - public static final String SETTING_IS_WELCOME_ENABLED = "IS_WELCOME_ENABLED_V1"; - public static final String SETTING_FONT_SIZE = "FONT_SIZE_V1"; - public static final String SETTING_FONT_ADJUSTABLE = "FONT_ADJUSTABLE_V1"; - public static final String SETTING_COOKIE_ADJUSTABLE = "COOKIE_ADJUSTABLE_NEW_V1"; - public static final String SETTING_NOTIFICATION_STATUS = "NOTIFICATION_STATUS_V1"; - public static final String SETTING_SEARCH_HISTORY = "SETTING_SEARCH_HISTORY_V1"; - public static final String SETTING_SEARCH_SUGGESTION = "SETTING_SEARCH_STATUS_V1"; - public static final String SETTING_ZOOM = "SETTING_ZOOM_V1"; - public static final String SETTING_VOICE_INPUT = "SETTING_VOICE_INPUT_V1"; - public static final String SETTING_TRACKING_PROTECTION = "SETTING_TRACKING_PROTECTION_V1"; - public static final String SETTING_RATE_COUNT = "SETTING_RATE_COUNT_V1"; - public static final String SETTING_DONOT_TRACK = "SETTING_DONOT_TRACK_V1"; - public static final String SETTING_RESTORE_TAB = "SETTING_RESTORE_TAB_V1"; - public static final String SETTING_CHARACTER_ENCODING = "SETTING_CHARACTER_ENCODING_V1"; - public static final String SETTING_SHOW_IMAGES = "SETTING_SHOW_IMAGES_V1"; - public static final String SETTING_SHOW_TAB_GRID = "SETTING_SHOW_TAB_GRID_V1"; - public static final String SETTING_SHOW_FONTS = "SETTING_SHOW_FONTS_V1"; - public static final String SETTING_TOOLBAR_THEME = "SETTING_TOOLBAR_THEME_V1"; - public static final String SETTING_THEME = "SETTING_THEME_LIGHT_V1"; - public static final String SETTING_FULL_SCREEN_BROWSIING = "SETTING_FULL_SCREEN_BROWSIING_V2"; - public static final String SETTING_OPEN_URL_IN_NEW_TAB = "SETTING_OPEN_URL_IN_NEW_TAB_V1"; - public static final String SETTING_LIST_VIEW = "SETTING_LIST_VIEW_V1"; - public static final String SETTING_INSTALLED = "SETTING_INSTALLED_V1"; - - /*Bridge Settings*/ - - public static final String BRIDGE_CUSTOM_BRIDGE_1 = "CLEAR_PREFS_V1"; - public static final String BRIDGE_CUSTOM_TYPE = "BRIDGE_CUSTOM_TYPE_V1"; - public static final String BRIDGE_ENABLES = "pref_bridges_enabled_V1"; - public static final String VPN_ENABLED = "pref_vpn_V1"; - public static final String BRIDGE_DEFAULT = "BRIDGE_DEFAULT"; - -} diff --git a/app/src/main/java/com/widget/search/constants/messages.java b/app/src/main/java/com/widget/search/constants/messages.java deleted file mode 100644 index 367fb622..00000000 --- a/app/src/main/java/com/widget/search/constants/messages.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.darkweb.genesissearchengine.constants; - -public class messages -{ - /*POST MESSAGES KEYS*/ - - public final static int MESSAGE_UPDATE_LOADING_TEXT =1; - public final static int MESSAGE_ON_URL_LOAD =2; - public final static int MESSAGE_PROGRESSBAR_VALIDATE =3; -} diff --git a/app/src/main/java/com/widget/search/constants/sql.java b/app/src/main/java/com/widget/search/constants/sql.java deleted file mode 100644 index 6b3e5c64..00000000 --- a/app/src/main/java/com/widget/search/constants/sql.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.darkweb.genesissearchengine.constants; - -public class sql -{ - /*HISTORY*/ - - public static final String SQL_CLEAR_HISTORY = "delete from history where 1"; - public static final String SQL_CLEAR_BOOKMARK = "delete from bookmark where 1"; - public static final String SQL_CLEAR_TAB = "delete from tab where 1"; - - -} diff --git a/app/src/main/java/com/widget/search/constants/status.java b/app/src/main/java/com/widget/search/constants/status.java deleted file mode 100644 index 7eb15b78..00000000 --- a/app/src/main/java/com/widget/search/constants/status.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.darkweb.genesissearchengine.constants; - -import android.content.Context; - -import com.darkweb.genesissearchengine.dataManager.dataController; -import com.darkweb.genesissearchengine.dataManager.dataEnums; - -import org.mozilla.geckoview.ContentBlocking; - -import java.util.Arrays; -import java.util.Locale; - -import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; - -public class status -{ - /*App Status*/ - - public static boolean sPaidStatus = false; - public static boolean sDeveloperBuild = false; - - /*Settings Status*/ - public static Locale mSystemLocale = null; - - public static String sSettingSearchStatus = constants.CONST_BACKEND_GENESIS_URL; - public static String sSettingRedirectStatus = strings.GENERIC_EMPTY_STR; - public static String sSettingLanguage = "en"; - public static String sSettingLanguageRegion = "Us"; - public static String sReferenceWebsites; - public static String sBridgeCustomBridge = strings.GENERIC_EMPTY_STR; - public static String sBridgeCustomType = strings.GENERIC_EMPTY_STR; - public static String sVersion = ""; - public static String sExternalWebsite = strings.GENERIC_EMPTY_STR; - public static String sBridgesDefault = strings.BRIDGES_DEFAULT; - - public static boolean sUIInteracted = false; - public static boolean sSettingEnableZoom = true; - public static boolean sSettingEnableVoiceInput = true; - public static boolean sSettingSearchHistory = false; - public static boolean sSearchSuggestionStatus = false; - public static boolean sSettingJavaStatus = true; - public static boolean sSettingPopupStatus = false; - public static boolean sClearOnExit = true; - public static boolean sSettingIsAppPaused = false; - public static boolean sSettingIsWelcomeEnabled = true; - public static boolean sSettingIsAppStarted = false; - public static boolean sSettingIsAppRunning = false; - public static boolean sSettingIsAppRedirected = false; - public static boolean sSettingIsAppRestarting = false; - public static boolean sSettingIsAppRated = false; - public static boolean sSettingFontAdjustable = true; - public static boolean sSettingFirstStart = true; - public static boolean mThemeApplying = false; - public static boolean sTabGridLayoutEnabled = true; - public static boolean sStatusDoNotTrack = true; - public static boolean sRestoreTabs = false; - public static boolean sCharacterEncoding = false; - public static boolean sShowWebFonts = true; - public static boolean sToolbarTheme = false; - public static boolean sFullScreenBrowsing = false; - public static boolean sOpenURLInNewTab = true; - public static boolean sDefaultNightMode; - public static boolean sLogThemeStyleAdvanced; - public static boolean sBridgeGatewayAuto = false; - public static boolean sBridgeGatewayManual = false; - public static boolean sVPNStatus = false; - public static boolean sVPNPermission = false; - public static boolean sBridgeStatus = false; - public static boolean sAppInstalled = false; - - public static int sTheme = enums.Theme.THEME_DEFAULT; - public static int sSettingCookieStatus = ContentBlocking.AntiTracking.DEFAULT; - public static int sShowImages = -1; - public static int sWidgetResponse = enums.WidgetResponse.NONE; - public static int sBridgeNotificationManual = 0; - public static int sSettingTrackingProtection = 0; - public static int sGlobalURLCount = 0; - - public static float sSettingFontSize = 1; - - public static boolean sDisableExpandTemp = false; - - private static void versionVerifier(Context pContext){ - status.sVersion = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_VERSION,strings.GENERIC_EMPTY_STR)); - if(!status.sVersion.equals("1.0.0.1")){ - pContext.deleteDatabase(constants.CONST_DATABASE_NAME); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_CLEAR_PREFS, null); - status.sVersion = "1.0.0.1"; - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_VERSION,strings.SETTING_DEFAULT_VERSION)); - } - } - - public static void initStatus(Context pContext) - { - versionVerifier(pContext); - - status.sUIInteracted = false; - status.sSettingSearchHistory = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); - status.sSearchSuggestionStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); - status.sSettingJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true)); - status.sSettingPopupStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); - status.sClearOnExit = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true)); - status.sBridgeGatewayAuto = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true)); - status.sBridgeGatewayManual = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); - status.sSettingIsWelcomeEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); - status.sSettingIsAppRated = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); - status.sVPNStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); - status.sBridgeStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); - status.sSettingFontAdjustable = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); - status.sSettingFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FIRST_INSTALLED,true)); - status.sSettingEnableZoom = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true)); - status.sSettingEnableVoiceInput = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true)); - status.sSettingTrackingProtection = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT)); - status.sStatusDoNotTrack = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true)); - status.sSettingCookieStatus = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY)); - status.sSettingFontSize = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100)); - status.sSettingLanguage = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_LANGUAGE,strings.SETTING_DEFAULT_LANGUAGE)); - status.sReferenceWebsites = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.HOME_REFERENCE_WEBSITES,strings.HOME_REFERENCE_WEBSITES_DEFAULT)); - status.sSettingLanguageRegion = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION)); - status.sSettingSearchStatus = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL)); - status.sBridgeCustomBridge = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); - status.sBridgeCustomType = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.GENERIC_EMPTY_SPACE)); - status.sBridgesDefault = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_DEFAULT,strings.BRIDGES_DEFAULT)); - status.sBridgeNotificationManual = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1)); - status.sRestoreTabs = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false)); - status.sCharacterEncoding = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false)); - status.sShowImages = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0)); - status.sShowWebFonts = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true)); - status.sFullScreenBrowsing = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,false)); - status.sToolbarTheme = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true)); - status.sTheme = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_THEME,enums.Theme.THEME_DEFAULT)); - status.sOpenURLInNewTab = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true)); - status.sLogThemeStyleAdvanced = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true)); - status.sTabGridLayoutEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true)); - status.sGlobalURLCount = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_RATE_COUNT, 0)); - status.sAppInstalled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,false)); - } - -} diff --git a/app/src/main/java/com/widget/search/constants/strings.java b/app/src/main/java/com/widget/search/constants/strings.java deleted file mode 100644 index 2ac6fec6..00000000 --- a/app/src/main/java/com/widget/search/constants/strings.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.darkweb.genesissearchengine.constants; - -public class strings -{ - /*Notification Manager Manager*/ - public static final String NOTIFICATION_TITLE = "Genesis Browser"; - public static final String[] NOTIFICATION_BODY = {"Genesis Browser updated successfully", - "Use Genesis Browser to enhance your privacy", - "Privacy and security enhanced, use Genesis Browser", - "Hidden web & Genesis Search Engine updated", - "Live websites updated on Genesis Search Engine", - "Access secure part of internet, Use Genesis Browser", - "Your privacy matters to us, Use Genesis browser", - "Stop tracking, use Genesis Browser"}; - - - /*History Manager*/ - public static final String HISTORY_TITLE = "history"; - public static final String HISTORY_CLEAR_HISTORY = "Clear History"; - public static final String HISTORY_NO_HISTORY_FOUND = "No History Found"; - - /*Bookmark Manager*/ - public static final String BOOKMARK_CLEAR_BOOKMARK = "Clear Bookmark"; - public static final String BOOKMARK_NO_BOOKMARK_FOUND = "No Bookmark Found"; - public static final String BOOKMARK_DEFAULT_TITLE = "New Bookmark"; - - /*Bridge Manager*/ - - public static final String BRIDGE_CUSTOM_BRIDGE_OBFS4 = "obfs4"; - public static final String BRIDGE_CUSTOM_BRIDGE_MEEK = "meek"; - public static final String BRIDGES_DEFAULT = "obfs4 78.215.187.186:45675 AE907EE5FAA5D0D27E0C83EFA6ADF8E79FCC0FF1 cert=/TRjMo+RinKaixARMjMtZZBhystaBe+aDaapPrbiITFtWx3M/AJcvpjHjO54tJqLd1+IWQ iat-mode=0\n" + - "obfs4 107.160.7.24:443 7A0904F6D182B81BEFE0DEDAFEC974494672627B cert=a5/IlZMnDvb8d92LTHMfsBIgL7QlDLPiXiLwe85uedC80mGD0QerygzmsWnMEdwG9ER9Eg iat-mode=0\n" + - "obfs4 79.136.160.201:46501 66AC975BF7CB429D057AE07FC0312C57D61BAEC1 cert=dCtn9Ya8z+R8YQikdWgC3XTAt58z5Apnm95QHrJwnhFSdnphPPEz+NMm6OawWc2srKLjJg iat-mode=0\n" + - "obfs4 94.242.249.2:58809 6AF3024788A7EA8F84E3FA3F60018B62291803E4 cert=X0sDCJLKMM/EISdGDEfGrsks41UYmScjIIXQ9AZgWFVKNKS6klcNEpdF4tNXFz6kIyk4Ug iat-mode=0\n" + - "obfs4 35.203.134.33:2224 15524C683CC872C8C8FB5B779A8D53F54F7ADCD4 cert=bXLTv0Kwt1zgPBoeVF86vC+0tYAHepR7+QMczhhTQw9hpAIhatt/Bpe6rSGY63Zh8aZ+dQ iat-mode=0\n" + - "obfs4 188.166.252.228:9443 595770328CA95E39FF5B81013880B46CA1B29546 cert=3PjhGUq3xWDMrBAzbV1eU4zPSB3GRGBpYdXQEs9hkrwC9RSZdnEe1P+cg7VgLgYTj/2MMg iat-mode=0\n" + - "obfs4 89.163.181.169:443 6A17D1E29E2807A1A4314215553079001031A7FF cert=e8JIYivx1zbYNOqq3a3+nDf/NDHoDQ/th/RVAnlVQePUIHxllG7aOku7pSwZisZ7i6ybVw iat-mode=0\n" + - "obfs4 94.242.249.2:40190 C7BE8154678E7537CCAC60B097D51A8A7EF8BCDF cert=8jw57wlMlVXCKsCnF7gCdApx7sRZLD5zPl8qdccwp0zltYG6kMYqBNm60dP8IxRH/l8OcQ iat-mode=0\n" + - "obfs4 77.81.104.251:443 115C90EBD0EB631C177560A872535772215478D9 cert=UsuF7oN4KNKviZP54JOyTCoCphrdM5gwZK4vT8GnCAcmqLUJEJxyw1dpko9a/ii6He4iZg iat-mode=0\n" + - "obfs4 5.249.146.133:80 FAF3A0073330D6AD92F3B4874B0D945562A633EF cert=TRe8bAODtjcGij7EPQaUayWEOqR99wDh2l3B4hFtCsn1JTJCph03pRZ9tx8wynpLYKWMQg iat-mode=0\n" + - "meek_lite 0.0.2.0:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com\n" + - "snowflake 192.0.2.3:1"; - - /*Generic*/ - - public static final String GENERIC_EMPTY_STR = ""; - public static final String GENERIC_EMPTY_SPACE = " "; - - /*Language Manager*/ - public static final String LANGUAGE_NOT_SUPPORTED = "is unsupported"; - - /*Settings Manager*/ - - public static final String SETTING_DEFAULT_LANGUAGE = "en"; - public static final String SETTING_DEFAULT_LANGUAGE_REGION = "Us"; - public static final String SETTING_DEFAULT_VERSION = "1.0.0.1"; - - /*Home Manager*/ - - public static final String HOME_BLANK_PAGE = "about:blank"; - public static final String HOME_REFERENCE_WEBSITES_DEFAULT = "[{\"mUrl\":\"https://www.wikileaks.org/wiki/Wikileaks\",\"mIcon\":\"https://www.wikileaks.org/wiki/Wikileaks/w/images/favicon.ico\",\"mHeader\":\"WikiLeaks (en)\",\"mBody\":\"WikiLeaks specializes in the publication of censored or otherwise restricted official materials involving war, and corruption\"},{\"mUrl\":\"http://p53lf57qovyuvwsc6xnrppyply3vtqm7l6pcobkmyqsiofyeznfu5uqd.onion/\",\"mIcon\":\"http://assets.p53lf57qovyuvwsc6xnrppyply3vtqm7l6pcobkmyqsiofyeznfu5uqd.onion/static/prod/v4/images/favicon-32x32.png\",\"mHeader\":\"Pro Publica\",\"mBody\":\"ProPublica is an independent, nonprofit newsroom that produces investigative journalism with moral force\"},{\"mUrl\":\"http://nzh3fv6jc6jskki3.onion/\",\"mIcon\":\"http://nzh3fv6jc6jskki3.onion/assets/images/favicon.png\",\"mHeader\":\"Rise UP | Communication Service\",\"mBody\":\"We are a project to create democratic alternatives and practiceself-determination by controlling our own secure means of communications\"},{\"mUrl\":\"http://answerszuvs3gg2l64e6hmnryudl5zgrmwm3vh65hzszdghblddvfiqd.onion/\",\"mIcon\":\"https://www.freeiconspng.com/uploads/questions-and-answers-icon-1.png\",\"mHeader\":\"Hidden Answer\",\"mBody\":\"Once you access the site, you’ll soon notice that the questions on Hidden Answers touch upon a variety of topics\"},{\"mUrl\":\"http://zerobinqmdqd236y.onion/\",\"mIcon\":\"https://icon-library.net//images/zero-icon/zero-icon-15.jpg\",\"mHeader\":\"Zero Bin\",\"mBody\":\"ZeroBin.net is a minimalist, open source online pastebin where the server has zero knowledge of pasted data\"},{\"mUrl\":\"http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion/\",\"mIcon\":\"http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion/img/favicon.ico\",\"mHeader\":\"Imperial Library\",\"mBody\":\"The Imperial Library of Trantor (also known as Galactic Library) is a repository of DRM-free ebooks on ePub format\"},{\"mUrl\":\"http://zqktlwiuavvvqqt4ybvgvi7tyo4hjl5xgfuvpdf6otjiycgwqbym2qad.onion/wiki/index.php/Main_Page\",\"mIcon\":\"http://zqktlwiuavvvqqt4ybvgvi7tyo4hjl5xgfuvpdf6otjiycgwqbym2qad.onion/wiki/resources/favicon.ico\",\"mHeader\":\"Hidden Wiki\",\"mBody\":\"One of the largest repository of categorized hidden web URL's\"},{\"mUrl\":\"https://www.facebookcorewwwi.onion/\",\"mIcon\":\"https://cdn1.iconfinder.com/data/icons/logotypes/32/square-facebook-512.png\",\"mHeader\":\"Facebook\",\"mBody\":\"Connect with friends and the world around you on Facebook\"},{\"mUrl\":\"https://www.bbcnewsv2vjtpsuy.onion/\",\"mIcon\":\"https://gn-web-assets.api.bbc.com/wwhp/20210105-1702-7302953dc6fd22d3eb4efd4d73bfd2a8d91bb7df/responsive/img/apple-touch/apple-touch-180.jpg\",\"mHeader\":\"BBC News\",\"mBody\":\"We’re impartial and independent, and every day we create distinctive, world class programmes and content which inform millions of people around the world\"},{\"mUrl\":\"http://archivecaslytosk.onion/\",\"mIcon\":\"https://archive.is/apple-touch-icon-144x144.png\",\"mHeader\":\"Archieve Today\",\"mBody\":\"It takes a 'snapshot' of a webpage that will always be online even if the original page disappears. It saves a text and a graphical copy of the legacy page\"},{\"mUrl\":\"http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion/\",\"mIcon\":\"http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion/images/favicon.ico\",\"mHeader\":\"Wasabi Wallet\",\"mBody\":\"Wasabi is an open-source, non-custodial, privacy-focused Bitcoin wallet for Desktop, that implements trustless CoinJoin\"},{\"mUrl\":\"http://ow24et3tetp6tvmk.onion/\",\"mIcon\":\"http://ow24et3tetp6tvmk.onion/favicon.ico\",\"mHeader\":\"Onion Wallet\",\"mBody\":\"When using Bitcoin together with Tor you are combining the best online money with the best encryption and privacy technology available\"},{\"mUrl\":\"http://piratebayztemzmv.onion/\",\"mIcon\":\"http://piratebayztemzmv.onion/images/tpb.jpg\",\"mHeader\":\"The Pirate Bay\",\"mBody\":\"The Pirate Bay allows users to search for Magnet links. These are used to reference resources available for download via peer-to-peer networks\"}]"; - - /*Message Manager*/ - - public static final String MESSAGE_PLAYSTORE_NOT_FOUND = "Playstore Not Found"; -} - diff --git a/app/src/main/res/anim/linear_out_slow_in.xml b/app/src/main/res/anim/linear_out_slow_in.xml index e69de29b..712dff05 100644 --- a/app/src/main/res/anim/linear_out_slow_in.xml +++ b/app/src/main/res/anim/linear_out_slow_in.xml @@ -0,0 +1,6 @@ + + diff --git a/app/src/main/res/layouts/searchWidget/layout/widget_search_controller.xml b/app/src/main/res/layouts/searchWidget/layout/widget_search_controller.xml index 220b832e..a8a333bb 100644 --- a/app/src/main/res/layouts/searchWidget/layout/widget_search_controller.xml +++ b/app/src/main/res/layouts/searchWidget/layout/widget_search_controller.xml @@ -1,4 +1,5 @@ @@ -26,45 +26,38 @@ android:layout_gravity="center_vertical" android:layout_marginStart="2.5dp" android:background="@color/clear_alpha" + android:clickable="false" android:contentDescription="@string/GENERAL_TODO" + android:focusable="false" android:padding="6dp" android:scaleType="fitCenter" android:src="@drawable/genesis" - android:translationZ="1dp"/> + android:translationZ="1dp" /> - + android:orientation="horizontal" + android:background="@xml/gx_generic_input_white"> - + + + + + + + + + + + \ No newline at end of file diff --git a/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java b/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java index a06b7dea..19fe19c9 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java +++ b/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java @@ -65,6 +65,8 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.PrintWriter; +import java.io.Reader; +import java.io.StringReader; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Arrays; @@ -86,6 +88,7 @@ import androidx.core.app.NotificationCompat; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; +import static org.torproject.android.service.wrapper.orbotLocalConstants.mBridgesDefault; public class OrbotService extends VpnService implements TorServiceConstants, OrbotConstants { @@ -807,7 +810,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb startTorService(); - /* if (Prefs.hostOnionServicesEnabled()) { + if (Prefs.hostOnionServicesEnabled()) { try { updateLegacyV2OnionNames(); } catch (SecurityException se) { @@ -818,7 +821,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb } catch (SecurityException se) { logNotice("unable to upload v3 onion names"); } - } */ + } } catch (Exception e) { Log.i("sad","asd"); logException("Unable to start Tor: " + e.toString(), e); @@ -924,7 +927,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb torService = ((TorService.LocalBinder) iBinder).getService(); try { conn = torService.getTorControlConnection(); - while (conn == null || !orbotLocalConstants.mIsTorInitialized) { + while (conn == null) { Log.v(TAG, "Waiting for Tor Control Connection..."); Thread.sleep(500); conn = torService.getTorControlConnection(); @@ -1656,9 +1659,12 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb try { - BufferedReader in = - new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.bridges), "UTF-8")); + BufferedReader in = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.bridges), "UTF-8")); + if(mBridgesDefault.length()>1){ + Reader inputString = new StringReader(mBridgesDefault); + in = new BufferedReader(inputString); + } String str; while ((str = in.readLine()) != null) { @@ -1691,7 +1697,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb Collections.shuffle(alBridges, bridgeSelectRandom); - int maxBridges = 2; + int maxBridges = 12; int bridgeCount = 0; @@ -1788,8 +1794,8 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb if (!TextUtils.isEmpty(action)) { if (action.equals(ACTION_START) || action.equals(ACTION_START_ON_BOOT)) { - //if (useIPtObfsMeekProxy()) - // IPtProxy.startObfs4Proxy("DEBUG", true, false); + if (useIPtObfsMeekProxy()) + IPtProxy.startObfs4Proxy("DEBUG", true, false); if (useIPtSnowflakeProxy()) startSnowflakeClient(); diff --git a/orbotmanager/src/main/java/org/torproject/android/service/util/Prefs.java b/orbotmanager/src/main/java/org/torproject/android/service/util/Prefs.java index aa39b7be..f68ac98f 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/util/Prefs.java +++ b/orbotmanager/src/main/java/org/torproject/android/service/util/Prefs.java @@ -43,6 +43,10 @@ public class Prefs { return prefs.getBoolean(PREF_BRIDGES_ENABLED, bridgesEnabledDefault); } + public static boolean hostOnionServicesEnabled(){ + return false; + } + public static void putBridgesEnabled(boolean value) { putBoolean(PREF_BRIDGES_ENABLED, value); }