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