diff --git a/.idea/misc.xml b/.idea/misc.xml index 7bfef59d..bd8f4892 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,40 @@ + + + + diff --git a/app/build.gradle b/app/build.gradle index 0e6a4422..e5941d18 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -49,13 +49,13 @@ android { versionName "180" dimension "abi" buildConfigField "String", "VARIANT", "\"arm\"" - } + }*/ aarch64 { versionCode 181 versionName "181" dimension "abi" buildConfigField "String", "VARIANT", "\"aarch64\"" - }*/ + }/* x86 { versionCode 182 versionName "182" @@ -108,10 +108,10 @@ dependencies { implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta2' implementation 'cz.msebera.android:httpclient:4.5.8' - x86Implementation "org.mozilla.geckoview:geckoview-x86:67.0.20190613202504" + //x86Implementation "org.mozilla.geckoview:geckoview-x86:67.0.20190613202504" //x86_64Implementation "org.mozilla.geckoview:geckoview-x86_64:67.0.20190613202504" //armImplementation "org.mozilla.geckoview:geckoview-armeabi-v7a:67.0.20190613202504" - //aarch64Implementation "org.mozilla.geckoview:geckoview-arm64-v8a:67.0.20190613202504" + aarch64Implementation "org.mozilla.geckoview:geckoview-arm64-v8a:67.0.20190613202504" implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' @@ -130,7 +130,7 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha03' implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') { - transitive = true; + transitive = true } implementation 'com.android.support:appcompat-v7:28.0.0' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 72c52ac9..41104a36 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -22,7 +22,7 @@ android:windowSoftInputMode="adjustNothing" android:label="@string/title_activity_setting_controller"> - @@ -31,7 +31,7 @@ android:required="false"/> diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/data_helper/database_helper.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/data_helper/database_helper.java deleted file mode 100644 index efd410f2..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/data_helper/database_helper.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.darkweb.genesissearchengine.appManager.data_helper; - -import android.content.ContentValues; -import android.content.Context; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteException; -import android.database.sqlite.SQLiteOpenHelper; -import com.darkweb.genesissearchengine.appManager.list_activity.list_model; -import com.darkweb.genesissearchengine.appManager.list_activity.list_row_model; - -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; - -public class database_helper extends SQLiteOpenHelper -{ - private Context mContext; - private String mDbPath; - private String mDbName; - private int mDbVersion; - - public SQLiteDatabase db; - - public database_helper(Context context, String dbName, int version) { - super(context, dbName, null, version); - mContext = context; - mDbPath = context.getApplicationInfo().dataDir + "/databases/"; - mDbName = dbName; - mDbVersion = version; - } - - public boolean exists() { - SQLiteDatabase db = null; - - try { - db = SQLiteDatabase.openDatabase(mDbPath + mDbName, null, SQLiteDatabase.OPEN_READONLY); - } - catch (SQLiteException e) { - //database does not exist yet. - } - - if (db != null) { - db.close(); - return true; - } else { - return false; - } - } - - public void openDatabase(int flag) throws SQLiteException, IOException { - if (!exists()) { - if (flag == SQLiteDatabase.OPEN_READONLY) { - this.getReadableDatabase(); - } else if (flag == SQLiteDatabase.OPEN_READWRITE) { - this.getWritableDatabase(); - } - InputStream iStream = null; - OutputStream oStream = null; - try { - iStream = mContext.getAssets().open(mDbName); - oStream = new FileOutputStream(mDbPath + mDbName); - byte[] buffer = new byte[1024]; - int length; - - while ((length = iStream.read(buffer)) > 0) { - oStream.write(buffer, 0, length); - } - } catch (IOException e) { - throw e; - } finally { - if (iStream != null) { - iStream.close(); - } - - if (oStream != null) { - oStream.flush(); - oStream.close(); - } - } - } - - try { - if (flag == SQLiteDatabase.OPEN_READONLY) { - db = SQLiteDatabase.openDatabase(mDbPath + mDbName, null, - SQLiteDatabase.OPEN_READONLY); - } else if (flag == SQLiteDatabase.OPEN_READWRITE) { - db = SQLiteDatabase.openDatabase(mDbPath + mDbName, null, - SQLiteDatabase.OPEN_READWRITE); - } - } catch (SQLiteException e) { - throw e; - } - } - - @Override - public synchronized void close() { - if (db != null) { - db.close(); - } - super.close(); - } - - @Override - public void onCreate(SQLiteDatabase db) { - - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - - } - - public void runQuery(String query) - { - db.execSQL(query); - } - - public ArrayList selectHistory() - { - ArrayList tempmodel = new ArrayList(); - Cursor c = db.rawQuery("SELECT * FROM history ", null); - if (c.moveToFirst()){ - do { - tempmodel.add(new list_row_model(c.getString(0),c.getString(1),Integer.parseInt(c.getString(0)))); - } while(c.moveToNext()); - } - c.close(); - ///db.close(); - - return tempmodel; - } -} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/data_helper/database_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/database_manager/database_controller.java similarity index 78% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/data_helper/database_controller.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/database_manager/database_controller.java index ca23131a..fa7c0a3c 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/data_helper/database_controller.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/database_manager/database_controller.java @@ -1,14 +1,11 @@ -package com.darkweb.genesissearchengine.appManager.data_helper; +package com.darkweb.genesissearchengine.appManager.database_manager; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteException; -import com.darkweb.genesissearchengine.appManager.list_activity.list_row_model; -import com.darkweb.genesissearchengine.appManager.main_activity.app_model; +import com.darkweb.genesissearchengine.appManager.list_manager.list_row_model; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.helperMethod; -import java.io.IOException; import java.util.ArrayList; import static android.content.Context.MODE_PRIVATE; @@ -32,7 +29,7 @@ public class database_controller { try { - database_instance = app_model.getInstance().getAppInstance().openOrCreateDatabase("DatabaseName", MODE_PRIVATE, null); + database_instance = app_model.getInstance().getAppInstance().openOrCreateDatabase(constants.databae_name, MODE_PRIVATE, null); database_instance.execSQL("CREATE TABLE IF NOT EXISTS " + "history" + " (id INT(4),date VARCHAR,url VARCHAR);"); database_instance.execSQL("CREATE TABLE IF NOT EXISTS " + "bookmark" + " (id INT(4),title VARCHAR,url VARCHAR);"); @@ -51,7 +48,7 @@ public class database_controller public ArrayList selectHistory() { - ArrayList tempmodel = new ArrayList(); + ArrayList tempmodel = new ArrayList<>(); Cursor c = database_instance.rawQuery("SELECT * FROM history ORDER BY id DESC ", null); if (c.moveToFirst()){ do { @@ -66,7 +63,7 @@ public class database_controller public ArrayList selectBookmark() { - ArrayList tempmodel = new ArrayList(); + ArrayList tempmodel = new ArrayList<>(); Cursor c = database_instance.rawQuery("SELECT * FROM bookmark ORDER BY id DESC ", null); if (c.moveToFirst()){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/AutoCompleteAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/AutoCompleteAdapter.java similarity index 94% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/AutoCompleteAdapter.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/AutoCompleteAdapter.java index 4c42019a..4e5cb4fb 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/AutoCompleteAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/AutoCompleteAdapter.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.main_activity; +package com.darkweb.genesissearchengine.appManager.home_activity; import java.util.ArrayList; import java.util.List; @@ -9,6 +9,9 @@ import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Filter; import android.widget.Filterable; +import android.widget.TextView; +import com.darkweb.genesissearchengine.appManager.list_manager.list_model; +import com.example.myapplication.R; public class AutoCompleteAdapter extends ArrayAdapter implements Filterable { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/app_model.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/app_model.java similarity index 80% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/app_model.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/app_model.java index 992c6dcf..c91caa89 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/app_model.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/app_model.java @@ -1,11 +1,10 @@ -package com.darkweb.genesissearchengine.appManager.main_activity; +package com.darkweb.genesissearchengine.appManager.home_activity; import android.content.Context; import android.net.Uri; -import com.darkweb.genesissearchengine.appManager.data_helper.database_controller; -import com.darkweb.genesissearchengine.appManager.list_activity.list_controller; -import com.darkweb.genesissearchengine.appManager.list_activity.list_model; -import com.darkweb.genesissearchengine.appManager.list_activity.list_row_model; +import com.darkweb.genesissearchengine.appManager.database_manager.database_controller; +import com.darkweb.genesissearchengine.appManager.list_manager.list_controller; +import com.darkweb.genesissearchengine.appManager.list_manager.list_row_model; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.helperMethod; @@ -24,9 +23,6 @@ public class app_model private Context appContext; private application_controller appInstance; - private Context listContext; - private list_controller listInstance; - /*Initializations*/ public void initialization() { @@ -50,7 +46,7 @@ public class app_model } public void setPort(int port) { - this.port = port; + app_model.port = port; } @@ -100,7 +96,7 @@ public class app_model } addSuggestions(url); - SimpleDateFormat d_form = new SimpleDateFormat("yyyy-MM-dd | HH-mm-ss"); + SimpleDateFormat d_form = new SimpleDateFormat("dd MMMM | hh:mm a"); String date = d_form.format(new Date()); database_controller.getInstance().execSQL("INSERT INTO history(id,date,url) VALUES("+autoval+",'"+date+"','"+url+"');"); history.add(0,new list_row_model(url,date,autoval)); @@ -139,7 +135,7 @@ public class app_model public void initSuggestions(String url) { - suggestions.add(url); + suggestions.add(url.replace("https://","").replace("http://","")); } public void addSuggestions(String url) { if(url.contains("boogle.store")) @@ -148,7 +144,7 @@ public class app_model String actual_url = uri.getQueryParameter("q"); suggestions.add(actual_url); } - suggestions.add(url); + suggestions.add(url.replace("https://","").replace("http://","")); app_model.getInstance().getAppInstance().reInitializeSuggestion(); } public ArrayList getSuggestions() { @@ -156,19 +152,10 @@ public class app_model } - public void setListInstance(list_controller listInstance){ - this.listInstance = listInstance; - } - public list_controller getListInstance(){ - return listInstance; - } + /*Helper Method*/ + public boolean isUrlRepeatable(String url,String viewUrl){ + return url.equals(viewUrl) && !app_model.getInstance().getAppInstance().isInternetErrorOpened() || url.contains("https://boogle.store/search?q=&"); - - public void setListContext(Context listContext) { - this.listContext = listContext; - } - public Context getListContext(){ - return listContext; } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/application_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/application_controller.java similarity index 70% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/application_controller.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/application_controller.java index 914aa6b8..874cbfa5 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/application_controller.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/application_controller.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.appManager.main_activity; +package com.darkweb.genesissearchengine.appManager.home_activity; import android.os.Build; import android.os.Bundle; @@ -45,10 +45,10 @@ public class application_controller extends AppCompatActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.home_view); if(helperMethod.isBuildValid()) { + setContentView(R.layout.home_view); initializeAppModel(); preference_manager.getInstance().initialize(); @@ -60,16 +60,16 @@ public class application_controller extends AppCompatActivity initAdManager(); orbot_manager.getInstance().reinitOrbot(); - applicationViewController.getInstance().initialization(webView,loadingText,progressBar,searchbar,splashScreen,requestFailure,floatingButton, loadingIcon,splashlogo); + viewController.getInstance().initialization(webView,loadingText,progressBar,searchbar,splashScreen,requestFailure,floatingButton, loadingIcon,splashlogo); firebase.getInstance().initialize(); - geckoclient.initialize(geckoView); + geckoclient.initialize(geckoView,false); app_model.getInstance().initialization(); - - initSearchEngine(); + initBoogle(); } else { - setContentView(R.layout.invalid_setup); + initializeAppModel(); + setContentView(R.layout.invalid_setup_view); message_manager.getInstance().abiError(Build.SUPPORTED_ABIS[0]); } @@ -80,20 +80,31 @@ public class application_controller extends AppCompatActivity admanager.getInstance().initialize(); } - public void initSearchEngine() + public void initBoogle() { - fabricManager.getInstance().sendEvent("HOME PAGE LOADING : " ); - if(status.search_status.equals(enums.searchEngine.Google.toString())) + onloadURL(constants.backendGenesis,false,false); + } + + public Boolean initSearchEngine() + { + if(status.search_status.equals(enums.searchEngine.Bing.toString())) { - webView.loadUrl(constants.backendGoogle); + geckoclient.setRootEngine(constants.backendBing); + webView.stopLoading(); + onloadURL(constants.backendBing,true,false); + return false; } - else if(status.search_status.equals(enums.searchEngine.Bing.toString())) + else if(status.search_status.equals(enums.searchEngine.Google.toString())) { - webView.loadUrl(constants.backendBing); + geckoclient.setRootEngine(constants.backendGoogle); + webView.stopLoading(); + onloadURL(constants.backendGoogle,true,false); + return false; } else { - webView.loadUrl(constants.backendGenesis); + onloadURL(constants.backendGenesis,false,false); + return true; } } @@ -137,7 +148,7 @@ public class application_controller extends AppCompatActivity public void setWebViewSettings(WebView view) { view.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); - view.getSettings().setJavaScriptEnabled(false); + view.getSettings().setJavaScriptEnabled(status.java_status); view.getSettings().setUseWideViewPort(true); } @@ -183,7 +194,7 @@ public class application_controller extends AppCompatActivity { geckoclient.loadGeckoURL(url,geckoView,isUrlSavable); } - else + else if(!app_model.getInstance().isUrlRepeatable(url,webView.getUrl()) || webView.getVisibility() == View.GONE) { webView.loadUrl(url); onRequestTriggered(isHiddenWeb,url); @@ -191,76 +202,84 @@ public class application_controller extends AppCompatActivity } public void onRequestTriggered(boolean isHiddenWeb,String url) { - applicationViewController.getInstance().onRequestTriggered(isHiddenWeb,url); + viewController.getInstance().onRequestTriggered(isHiddenWeb,url); } public void onClearSearchBarCursorView() { - applicationViewController.getInstance().onClearSearchBarCursor(); + viewController.getInstance().onClearSearchBarCursor(); } public void onUpdateSearchBarView(String url) { - applicationViewController.getInstance().onUpdateSearchBar(url); + viewController.getInstance().onUpdateSearchBar(url); } public void onInternetErrorView() { - applicationViewController.getInstance().onInternetError(); - applicationViewController.getInstance().disableFloatingView(); + viewController.getInstance().onInternetError(); + viewController.getInstance().disableFloatingView(); } public boolean onDisableInternetError() { - return applicationViewController.getInstance().onDisableInternetError(); + return viewController.getInstance().onDisableInternetError(); } public void onProgressBarUpdateView(int progress) { - applicationViewController.getInstance().onProgressBarUpdate(progress); + viewController.getInstance().onProgressBarUpdate(progress); } public void onBackPressedView() { - applicationViewController.getInstance().onBackPressed(); + viewController.getInstance().onBackPressed(); } public void onPageFinished(boolean isHidden) { - applicationViewController.getInstance().onPageFinished(isHidden); + viewController.getInstance().onPageFinished(isHidden); } public void onUpdateView(boolean status) { - applicationViewController.getInstance().onUpdateView(status); + viewController.getInstance().onUpdateView(status); } public void onReload() { - applicationViewController.getInstance().onReload(); + viewController.getInstance().onReload(); } - public void onShowAds() + public void onShowAd(enums.adID id) { - applicationViewController.getInstance().onShowAds(); + admanager.getInstance().showAd(id); } public void openMenu(View view) { - applicationViewController.getInstance().openMenu(view); + + viewController.getInstance().openMenu(view); } public void reInitializeSuggestion() { - applicationViewController.getInstance().reInitializeSuggestion(); + viewController.getInstance().reInitializeSuggestion(); + } + + public void hideSplashScreen(){ + viewController.getInstance().hideSplashScreen(); } /*-------------------------------------------------------Helper Method Out UI Redirection----------------------------------------------------*/ public String getSearchBarUrl() { - return applicationViewController.getInstance().getSearchBarUrl(); + return viewController.getInstance().getSearchBarUrl(); } public void onReInitGeckoView() { - geckoclient.initialize(geckoView); - geckoclient.onReloadHiddenView(); + geckoclient.initialize(geckoView,true); + if(webView.getVisibility() != View.VISIBLE) + { + geckoclient.onReloadHiddenView(); + } } public void onHiddenGoBack() @@ -268,9 +287,14 @@ public class application_controller extends AppCompatActivity geckoclient.onHiddenGoBack(geckoView); } - public void stopHiddenView() { - geckoclient.stopHiddenView(geckoView); - geckoclient.removeHistory(); + public int getHiddenQueueLength() + { + return geckoclient.getHiddenQueueLength(); + } + + public void stopHiddenView(boolean releaseView) { + geckoclient.stopHiddenView(geckoView,releaseView); + //geckoclient.removeHistory(); } public void onReloadHiddenView() diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/eventHandler.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/eventHandler.java similarity index 93% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/eventHandler.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/eventHandler.java index baeb6284..1056730a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/eventHandler.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/eventHandler.java @@ -1,11 +1,12 @@ -package com.darkweb.genesissearchengine.appManager.main_activity; +package com.darkweb.genesissearchengine.appManager.home_activity; +import android.util.Log; import android.util.Patterns; import android.view.KeyEvent; import android.view.View; import android.view.inputmethod.EditorInfo; import android.widget.TextView; -import com.darkweb.genesissearchengine.appManager.list_activity.list_controller; +import com.darkweb.genesissearchengine.appManager.list_manager.list_controller; import com.darkweb.genesissearchengine.appManager.setting_manager.setting_controller; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.enums; @@ -100,12 +101,11 @@ public class eventHandler public void onHomeButtonPressed() { - appContoller.stopHiddenView(); + appContoller.stopHiddenView(true); fabricManager.getInstance().sendEvent("HOME BUTTON PRESSSED : "); - applicationViewController.getInstance().checkSSLTextColor(); + viewController.getInstance().checkSSLTextColor(); appContoller.initSearchEngine(); helperMethod.hideKeyboard(); - appContoller.onUpdateSearchBarView(constants.frontUrlSlashed); } public void onFloatingButtonPressed() diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/geckoClients.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/geckoClients.java similarity index 67% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/geckoClients.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/geckoClients.java index 0ffd4d25..8b6716ae 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/geckoClients.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/geckoClients.java @@ -1,47 +1,44 @@ -package com.darkweb.genesissearchengine.appManager.main_activity; +package com.darkweb.genesissearchengine.appManager.home_activity; import android.os.Handler; -import android.util.Log; import android.view.View; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.*; import com.darkweb.genesissearchengine.dataManager.preference_manager; +import com.darkweb.genesissearchengine.helperMethod; import com.darkweb.genesissearchengine.pluginManager.fabricManager; import com.darkweb.genesissearchengine.pluginManager.message_manager; import com.darkweb.genesissearchengine.pluginManager.orbot_manager; +import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoRuntime; import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoView; import java.util.ArrayList; -public class geckoClients +class geckoClients { private GeckoSession session1 = null; - private GeckoRuntime runtime1; private final Handler internetErrorHandler = new Handler(); + private ArrayList urlList = new ArrayList<>(); - boolean canSessionGoBack = false; - boolean isRunning = false; - boolean isContentLoading = false; - String navigatedURL = ""; - boolean isFirstTimeLoad = true; - ArrayList urlList = new ArrayList<>(); + private boolean isRunning = false; + private boolean isContentLoading = false; + private String navigatedURL = ""; + private boolean isFirstTimeLoad = true; private boolean loadingCompeleted = false; - private String currentURL = ""; private boolean wasBackPressed = false; private boolean isUrlSavable = true; private int urlRequestCount = 0; private boolean isAppRated = false; - public geckoClients() + geckoClients() { isAppRated = preference_manager.getInstance().getBool(keys.isAppRated,false); } - public void loadGeckoURL(String url,GeckoView geckoView,boolean isUrlSavable) + void loadGeckoURL(String url,GeckoView geckoView,boolean isUrlSavable) { boolean init_status = orbot_manager.getInstance().initOrbot(url); if (init_status) @@ -49,7 +46,7 @@ public class geckoClients this.isUrlSavable = isUrlSavable; navigatedURL = ""; loadingCompeleted = false; - initialize(geckoView); + initialize(geckoView,false); session1.loadUri(url); app_model.getInstance().getAppInstance().onRequestTriggered(true,url); app_model.getInstance().getAppInstance().onProgressBarUpdateView(4); @@ -61,12 +58,12 @@ public class geckoClients } } - public void initialize(GeckoView geckoView) + void initialize(GeckoView geckoView,boolean release) { - if(urlList.size()<=0) + if(urlList.size()<=0 || release) { session1 = new GeckoSession(); - runtime1 = GeckoRuntime.getDefault(app_model.getInstance().getAppContext()); + GeckoRuntime runtime1 = GeckoRuntime.getDefault(app_model.getInstance().getAppContext()); runtime1.getSettings().setJavaScriptEnabled(status.java_status); session1.open(runtime1); geckoView.releaseSession(); @@ -87,10 +84,12 @@ public class geckoClients } @Override - public void onCanGoBack(GeckoSession session, boolean canGoBack) + public GeckoResult onNewSession(GeckoSession session, String uri) { - canSessionGoBack = canGoBack; + session1.loadUri(uri); + return null; } + } class progressDelegate implements GeckoSession.ProgressDelegate @@ -101,20 +100,11 @@ public class geckoClients wasBackPressed = false; isRunning = true; loadingCompeleted = false; - currentURL = url; fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL REQEST : " + url + "--"); app_model.getInstance().getAppInstance().onUpdateSearchBarView(url); - if(navigatedURL.equals(currentURL)) - { - isContentLoading = false; - } - else - { - isContentLoading = true; - } + isContentLoading = !navigatedURL.equals(url); - Log.i("SHITJ2",""+navigatedURL + "--" + currentURL + "--" + isContentLoading); navigatedURL = url; } @@ -123,12 +113,17 @@ public class geckoClients { internetErrorHandler.removeCallbacksAndMessages(null); - internetErrorHandler.postDelayed(new Runnable() { + internetErrorHandler.postDelayed(new Runnable() + { @Override public void run() { if(loadingCompeleted) { + if(isFirstTimeLoad) + { + app_model.getInstance().getAppInstance().hideSplashScreen(); + } if(!success && !isContentLoading) { app_model.getInstance().getAppInstance().onPageFinished(true); @@ -137,21 +132,11 @@ public class geckoClients } else if(success) { - if(isFirstTimeLoad) - { - //admanager.getInstance().showAd(true); - isFirstTimeLoad = false; - } - - if((urlList.size()==0 || urlList.size()>0 && !urlList.get(urlList.size()-1).equals(navigatedURL))&& !wasBackPressed) + if((urlList.size() == 0 || !urlList.get(urlList.size() - 1).equals(navigatedURL)) && !wasBackPressed) { urlList.add(navigatedURL); } - if(urlList.size()>0) - { - //admanager.getInstance().showAd(false); - } urlRequestCount++; if(urlRequestCount==5) { @@ -161,9 +146,16 @@ public class geckoClients message_manager.getInstance().rateApp(); } } - else if(urlRequestCount>=4 && isAppRated) + else if(isAppRated) { - app_model.getInstance().getAppInstance().onShowAds(); + if(isFirstTimeLoad) + { + app_model.getInstance().getAppInstance().onShowAd(enums.adID.hidden); + } + else + { + app_model.getInstance().getAppInstance().onShowAd(enums.adID.internal); + } } if(isUrlSavable && !urlList.get(urlList.size()-1).equals("navigatedURL")) @@ -176,6 +168,7 @@ public class geckoClients fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL SUCCESS : " + success + "--" + isContentLoading); app_model.getInstance().getAppInstance().onPageFinished(true); } + isFirstTimeLoad = false; } } }, 500); @@ -191,8 +184,7 @@ public class geckoClients loadingCompeleted = true; isContentLoading = false; } - - if(progress>=5) + else if(progress>=5) { app_model.getInstance().getAppInstance().onProgressBarUpdateView(progress); } @@ -209,7 +201,7 @@ public class geckoClients } - public void onHiddenGoBack(GeckoView geckoView) + void onHiddenGoBack(GeckoView geckoView) { if(urlList.size()>1) { @@ -221,19 +213,24 @@ public class geckoClients } else if(isRunning) { - if(urlList.size()>0) + if(navigatedURL.equals(constants.backendGoogle) && status.search_status.equals(strings.google_text) || navigatedURL.equals(constants.backendBing) && status.search_status.equals(strings.bing_text)) { - urlList.remove(urlList.size()-1); + helperMethod.onMinimizeApp(); + } + else + { + if(urlList.size()>0) + { + urlList.remove(urlList.size()-1); + } + stopHiddenView(geckoView,false); + app_model.getInstance().getAppInstance().onUpdateView(true); + app_model.getInstance().getAppInstance().onDisableInternetError(); } - stopHiddenView(geckoView); - app_model.getInstance().getAppInstance().onUpdateView(true); - app_model.getInstance().getAppInstance().onDisableInternetError(); } - - } - public void stopHiddenView(GeckoView geckoView) + void stopHiddenView(GeckoView geckoView,boolean releaseView) { if(session1!=null) { @@ -241,30 +238,38 @@ public class geckoClients loadingCompeleted = false; session1.stop(); - session1.close(); + if(!releaseView) + { + session1.close(); + } } - - geckoView.releaseSession(); - } - public void removeHistory() + int getHiddenQueueLength() { - urlList.clear(); + return urlList.size(); } - public boolean isGeckoViewRunning() + void setRootEngine(String url) + { + if(urlList.size()>1) + { + urlList.set(0,url); + } + } + + boolean isGeckoViewRunning() { return isRunning; } - public void onReloadHiddenView() + void onReloadHiddenView() { if(urlList.size()>0) { wasBackPressed = true; session1.stop(); - session1.loadUri(navigatedURL); + session1.loadUri(urlList.get(urlList.size()-1)); } } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/applicationViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/viewController.java similarity index 75% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/applicationViewController.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/viewController.java index 229d548e..2bd2b252 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/applicationViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/viewController.java @@ -1,6 +1,7 @@ -package com.darkweb.genesissearchengine.appManager.main_activity; +package com.darkweb.genesissearchengine.appManager.home_activity; import android.annotation.SuppressLint; +import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Handler; @@ -9,17 +10,12 @@ import android.text.SpannableString; import android.text.Spanned; import android.text.style.ForegroundColorSpan; import android.util.Log; -import android.view.MenuInflater; -import android.view.View; -import android.view.WindowManager; +import android.view.*; import android.webkit.WebView; import android.widget.*; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.view.MenuCompat; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.constants.messages; -import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.*; import com.darkweb.genesissearchengine.dataManager.preference_manager; import com.darkweb.genesissearchengine.helperMethod; import com.darkweb.genesissearchengine.httpManager.serverRequestManager; @@ -29,9 +25,7 @@ import com.darkweb.genesissearchengine.pluginManager.orbot_manager; import com.example.myapplication.R; import com.google.android.material.floatingactionbutton.FloatingActionButton; -import java.util.ArrayList; - -public class applicationViewController +public class viewController { /*ViewControllers*/ private WebView webView; @@ -54,14 +48,14 @@ public class applicationViewController Handler progressBarHandler = null; /*Initializations*/ - private static final applicationViewController ourInstance = new applicationViewController(); + private static final viewController ourInstance = new viewController(); - public static applicationViewController getInstance() + public static viewController getInstance() { return ourInstance; } - private applicationViewController() + private viewController() { } @@ -88,15 +82,23 @@ public class applicationViewController private void initializeSuggestionView() { - suggestionAdapter = new AutoCompleteAdapter(app_model.getInstance().getAppInstance(), R.layout.hint_completion_layout, R.id.hintCompletionText,app_model.getInstance().getSuggestions()); + suggestionAdapter = new AutoCompleteAdapter(app_model.getInstance().getAppInstance(), R.layout.hint_view, R.id.hintCompletionHeader,app_model.getInstance().getSuggestions()); + int width = Math.round(helperMethod.screenWidth()); searchbar.setThreshold(2); searchbar.setAdapter(suggestionAdapter); - searchbar.setDropDownVerticalOffset(27); - searchbar.setDropDownWidth(helperMethod.screenWidth()-80); - searchbar.setDropDownHorizontalOffset(-88); - searchbar.setDropDownHeight(Math.round(helperMethod.screenHeight(false)*0.35f)); - searchbar.setDropDownBackgroundDrawable(app_model.getInstance().getAppInstance().getResources().getDrawable(R.drawable.rouned_corner)); + searchbar.setDropDownVerticalOffset(22); + searchbar.setDropDownWidth(Math.round(width*0.95f)); + searchbar.setDropDownHorizontalOffset(Math.round(width*0.114f)*-1); + + Drawable drawable; + Resources res = app_model.getInstance().getAppInstance().getResources(); + try { + drawable = Drawable.createFromXml(res, res.getXml(R.xml.rouned_corner)); + searchbar.setDropDownBackgroundDrawable(drawable); + } catch (Exception ex) { + Log.i("sdfsdf", ex.getMessage()); + } } @@ -163,11 +165,11 @@ public class applicationViewController try { boolean isFirstInstall = preference_manager.getInstance().getBool(keys.hasOrbotInstalled,true); - //while (!status.isTorInitialized && isFirstInstall) - //{ - // startPostTask(messages.UPDATE_LOADING_TEXT); - // sleep(100); - //} + while (!status.isTorInitialized && (isFirstInstall || status.search_status.equals(enums.searchEngine.Google.toString()) || status.search_status.equals(enums.searchEngine.Bing.toString()))) + { + startPostTask(messages.UPDATE_LOADING_TEXT); + sleep(100); + } preference_manager.getInstance().setBool(keys.hasOrbotInstalled,false); startPostTask(messages.DISABLE_SPLASH_SCREEN); } @@ -201,10 +203,12 @@ public class applicationViewController } else if(msg.what == messages.DISABLE_SPLASH_SCREEN) { - status.isApplicationLoaded = true; - splashScreen.animate().alpha(0.0f).setDuration(200).setListener(null).withEndAction((() -> splashScreen.setVisibility(View.GONE))); - onWelcomeMessageCheck(); - //app_model.getInstance().getAppInstance().initAdManager(); + boolean e_status = app_model.getInstance().getAppInstance().initSearchEngine(); + + if(e_status) + { + hideSplashScreen(); + } } else if(msg.what == messages.SHOW_ADS) { @@ -214,11 +218,18 @@ public class applicationViewController }; } + public void hideSplashScreen() + { + status.isApplicationLoaded = true; + splashScreen.animate().alpha(0.0f).setDuration(200).setListener(null).withEndAction((() -> splashScreen.setVisibility(View.GONE))); + onWelcomeMessageCheck(); + } + public boolean onDisableInternetError() { if(requestFailure.getAlpha()==1) { - requestFailure.animate().alpha(0f).setDuration(150).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE)));; + requestFailure.animate().alpha(0f).setDuration(150).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE))); return true; } else @@ -242,14 +253,14 @@ public class applicationViewController } //onUpdateSearchBar(webView.getUrl()); disableSplashScreen(); - floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE)));; + floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE))); - app_model.getInstance().getAppInstance().stopHiddenView(); + app_model.getInstance().getAppInstance().stopHiddenView(false); } else { onUpdateView(false); - floatingButton.animate().alpha(1).withEndAction((() -> floatingButton.setVisibility(View.VISIBLE)));; + floatingButton.animate().alpha(1).withEndAction((() -> floatingButton.setVisibility(View.VISIBLE))); } } @@ -287,7 +298,7 @@ public class applicationViewController public void disableFloatingView() { - floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE)));; + floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE))); } @@ -309,28 +320,49 @@ public class applicationViewController public void onProgressBarUpdate(int progress) { - progressBar.setVisibility(View.VISIBLE); if(progress==0) { progressBar.animate().alpha(0).withEndAction((() -> progressBar.setProgress(progress))); } - else + else if(splashScreen.getVisibility() == View.GONE) { - progressBar.setProgress(progress); + if(progressBar.getVisibility()==View.INVISIBLE) + { + progressBar.setProgress(4); + } + else + { + progressBar.setProgress(progress); + } + progressBar.setVisibility(View.VISIBLE); progressBar.setAlpha(1); } } public void onBackPressed() { - if(!isHiddenView()) + if(webView.getVisibility() == View.VISIBLE) { - webView.goBack(); - webView.bringToFront(); - webView.setAlpha(1); - webView.setVisibility(View.VISIBLE); - requestFailure.animate().alpha(0f).setDuration(200).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE))); - onUpdateSearchBar(webView.getUrl()); + if(!webView.canGoBack()) + { + if(app_model.getInstance().getAppInstance().getHiddenQueueLength()>0) + { + onUpdateView(false); + } + else + { + helperMethod.onMinimizeApp(); + } + } + else + { + webView.goBack(); + webView.bringToFront(); + webView.setAlpha(1); + webView.setVisibility(View.VISIBLE); + requestFailure.animate().alpha(0f).setDuration(200).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE))); + onUpdateSearchBar(webView.getUrl()); + } } else { @@ -342,7 +374,7 @@ public class applicationViewController { if(status) { - floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE)));; + floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE))); webView.setAlpha(1); webView.setVisibility(View.VISIBLE); webView.bringToFront(); @@ -371,11 +403,19 @@ public class applicationViewController public void openMenu(View view) { - PopupMenu popup = new PopupMenu(app_model.getInstance().getAppInstance(), view); + LinearLayout parentView = (LinearLayout)view.getParent(); + + PopupMenu popup = new PopupMenu(app_model.getInstance().getAppInstance(), parentView,Gravity.RIGHT); MenuInflater inflater = popup.getMenuInflater(); inflater.inflate(R.menu.menu_main, popup.getMenu()); MenuCompat.setGroupDividerEnabled(popup.getMenu(), true); + popup.setOnMenuItemClickListener(item -> + { + app_model.getInstance().getAppInstance().onMenuOptionSelected(item); + return true; + }); popup.show(); + view.bringToFront(); } public void onReload() diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/webviewClient.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/webviewClient.java similarity index 89% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/webviewClient.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/webviewClient.java index d64ab42e..f160ba70 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/main_activity/webviewClient.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/webviewClient.java @@ -1,9 +1,10 @@ -package com.darkweb.genesissearchengine.appManager.main_activity; +package com.darkweb.genesissearchengine.appManager.home_activity; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.pluginManager.fabricManager; import com.darkweb.genesissearchengine.pluginManager.orbot_manager; @@ -20,14 +21,14 @@ public class webviewClient public boolean shouldOverrideUrlLoading(WebView view, String url) { isGeckoView = false; - if(url.equals(view.getUrl()) && !app_model.getInstance().getAppInstance().isInternetErrorOpened() || url.contains("https://boogle.store/search?q=&")) + if(app_model.getInstance().isUrlRepeatable(url,view.getUrl())) { app_model.getInstance().getAppInstance().onProgressBarUpdateView(0); return true; } - if(!url.contains("boogle") && !url.equals(constants.backendGoogle) && !url.equals(constants.backendBing)) + if(!url.contains("boogle")) { - app_model.getInstance().getAppInstance().stopHiddenView(); + app_model.getInstance().getAppInstance().stopHiddenView(false); fabricManager.getInstance().sendEvent("BASE SIMPLE SEARCHED : " + url); isGeckoView = true; if(orbot_manager.getInstance().initOrbot(url)) diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_adapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_adapter.java deleted file mode 100644 index 8a988abd..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_adapter.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.darkweb.genesissearchengine.appManager.list_activity; - -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.*; -import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.data_helper.database_controller; -import com.darkweb.genesissearchengine.appManager.main_activity.app_model; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.helperMethod; -import com.darkweb.genesissearchengine.pluginManager.orbot_manager; -import com.example.myapplication.R; - -public class list_adapter extends RecyclerView.Adapter -{ - private ImageView empty_list; - private list_controller controller; - - public list_adapter() - { - } - - public void initialize(ImageView empty_list,list_controller controller) - { - this.empty_list = empty_list; - this.controller = controller; - } - - @Override - public listViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_manager_row, parent, false); - listViewHolder viewHolder = new listViewHolder(view); - return viewHolder; - } - - @Override - public void onBindViewHolder(list_adapter.listViewHolder holder, int position) - { - holder.bindListView(list_model.getInstance().getModel().get(position)); - clearMessageItem(holder.messageButton,holder.empty_message,position); - } - - @Override - public int getItemCount() { - return list_model.getInstance().getModel().size(); - } - - public class listViewHolder extends RecyclerView.ViewHolder - { - public TextView heaaderText; - public TextView descriptionText; - public ImageButton messageButton; - public ImageView empty_message; - - public listViewHolder(View itemView) { - super(itemView); - } - - public void bindListView(list_row_model model) { - - heaaderText = itemView.findViewById(R.id.header); - descriptionText = itemView.findViewById(R.id.description); - - String header = model.getHeader(); - descriptionText.setText(model.getDescription()); - - if(model.getHeader().length()<=2) - { - header = model.getDescription() + model.getHeader(); - } - heaaderText.setText(header); - - - messageButton = itemView.findViewById(R.id.message_button); - empty_message = itemView.findViewById(R.id.empty_list); - - setItemViewOnClickListener(itemView,header); - } - } - - public void setItemViewOnClickListener(View itemView,String url) - { - itemView.setOnClickListener(new View.OnClickListener(){ - - @Override - public void onClick(View v) - { - - String tempurl = url; - isValidUrl(tempurl); - controller.finish(); - } - }); - } - - public boolean isValidUrl(String url) - { - url = helperMethod.completeURL(url); - - if(!url.contains("boogle") && !url.equals(constants.backendGoogle) && !url.equals(constants.backendBing)) - { - if(orbot_manager.getInstance().initOrbot(url)) - { - app_model.getInstance().getAppInstance().onloadURL(url,true,false); - return true; - } - return false; - } - else - { - app_model.getInstance().getAppInstance().onloadURL(url,false,false); - return true; - } - } - - public void clearMessageItem(ImageButton messageButton,ImageView view,int index) - { - ImageView newview = view; - messageButton.setOnClickListener(new View.OnClickListener() - { - @Override - public void onClick(View v) - { - deleteFromDatabase(list_model.getInstance().getModel().get(index).getId()); - list_model.getInstance().getModel().remove(index); - list_model.getInstance().removeFromMainList(list_model.getInstance().getIndex().get(index)); - list_model.getInstance().removeIndex(index); - list_adapter.this.notifyItemRemoved(index); - list_adapter.this.notifyDataSetChanged(); - isListEmpty(newview); - } - }); - } - - public void deleteFromDatabase(int index) - { - String table="bookmark"; - if(list_model.getInstance().getType()==constants.list_history) - { - table = "history"; - } - Log.i("dgfdfg","delete from "+table+" where id="+index); - database_controller.getInstance().execSQL("delete from "+table+" where id="+index); - } - - public void isListEmpty(ImageView view) - { - if(list_model.getInstance().getModel().size()<=0) - { - empty_list.setAlpha(0f); - empty_list.setVisibility(View.VISIBLE); - empty_list.animate().alpha(1); - } - - } - -} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_controller.java deleted file mode 100644 index 24338380..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_controller.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.darkweb.genesissearchengine.appManager.list_activity; - -import android.view.View; -import android.view.inputmethod.EditorInfo; -import android.widget.EditText; -import android.widget.ImageView; -import androidx.appcompat.app.AppCompatActivity; -import android.os.Bundle; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import com.darkweb.genesissearchengine.appManager.data_helper.database_controller; -import com.darkweb.genesissearchengine.appManager.main_activity.app_model; -import com.darkweb.genesissearchengine.constants.constants; -import com.darkweb.genesissearchengine.constants.keys; -import com.darkweb.genesissearchengine.pluginManager.message_manager; -import com.example.myapplication.R; -import java.util.ArrayList; - -public class list_controller extends AppCompatActivity -{ - private ImageView empty_list; - private EditText search_bar; - - @Override - protected void onCreate(Bundle savedInstanceState) - { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_app_list_manager); - - initializeListInstance(); - initializeListModel(); - initializeListController(); - initSearchBar(); - updatelist(); - } - - public void initializeListInstance() - { - app_model.getInstance().setListInstance(this); - app_model.getInstance().setListContext(this); - } - - - public void initializeListModel() - { - Bundle bundle = getIntent().getExtras(); - if(bundle.getInt(keys.list_type)==constants.list_bookmark) - { - list_model.getInstance().setType(constants.list_bookmark); - list_model.getInstance().setMainList(app_model.getInstance().getBookmark()); - } - else - { - list_model.getInstance().setType(constants.list_history); - list_model.getInstance().setMainList(app_model.getInstance().getHistory()); - } - } - - public void initializeListController() - { - empty_list = findViewById(R.id.empty_list); - search_bar = findViewById(R.id.search); - RecyclerView list_view = findViewById(R.id.listview); - - list_adapter adapter = new list_adapter(); - adapter.initialize(empty_list,this); - list_view.setAdapter(adapter); - list_view.setLayoutManager(new LinearLayoutManager(this)); - isListEmpty(); - } - - public void clearHistory(View view) - { - if(app_model.getInstance().getHistory().size()>0) - { - message_manager.getInstance().clearData(); - } - } - - public void clearAll() - { - list_model.getInstance().getModel().clear(); - list_model.getInstance().getMainList().clear(); - initializeListController(); - - empty_list.setAlpha(0f); - empty_list.setVisibility(View.VISIBLE); - empty_list.animate().alpha(1); - search_bar.setText(""); - - String table="bookmark"; - if(list_model.getInstance().getType()==constants.list_history) - { - table = "history"; - } - database_controller.getInstance().execSQL("delete from "+table+" where 1"); - - } - - public void isListEmpty() - { - if(list_model.getInstance().getModel().size()<=0) - { - empty_list.setVisibility(View.VISIBLE); - } - else - { - empty_list.setVisibility(View.GONE); - } - - } - - public void initSearchBar() - { - search_bar.setOnEditorActionListener((v, actionId, event) -> - { - if (actionId != EditorInfo.IME_ACTION_NEXT) - { - return false; - } - else - { - return updatelist(); - } - }); - } - - public boolean updatelist() - { - String query = search_bar.getText().toString(); - ArrayList temp_model = new ArrayList(); - list_model.getInstance().getIndex().clear(); - for(int counter=0;counter<=list_model.getInstance().getMainList().size()-1;counter++) - { - if(list_model.getInstance().getMainList().get(counter).getHeader().contains(query) || list_model.getInstance().getMainList().get(counter).getDescription().contains(query)) - { - temp_model.add(list_model.getInstance().getMainList().get(counter)); - list_model.getInstance().setIndex(counter); - } - } - list_model.getInstance().setModel(temp_model); - initializeListController(); - - return true; - } - - public void onBackPressed(View view) - { - finish(); - } - -} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_model.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_model.java deleted file mode 100644 index e9bbf7ba..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_model.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.darkweb.genesissearchengine.appManager.list_activity; - -import java.util.ArrayList; - -public class list_model -{ - private static final list_model ourInstance = new list_model(); - - public static list_model getInstance() - { - return ourInstance; - } - - private list_model() - { - } - - public ArrayList list_model = new ArrayList(); - public ArrayList list_index = new ArrayList(); - private ArrayList main_model_ref = new ArrayList(); - - public int listType; - - public void setType(int listType) - { - this.listType = listType; - } - - public int getType() - { - return listType; - } - - public void setModel(ArrayList list_model) - { - this.list_model = list_model; - } - - public ArrayList getModel() - { - return list_model; - } - - public void setIndex(int index) - { - list_index.add(index); - } - - public ArrayList getIndex() - { - return list_index; - } - - public void removeIndex(int index) - { - list_index.remove(index); - for(int counter=index;counter<=list_index.size()-1;counter++) - { - list_index.set(counter,list_index.get(counter)-1); - } - } - - public void setMainList(ArrayList model) - { - main_model_ref = model; - } - - public ArrayList getMainList() - { - return main_model_ref; - } - - public void removeFromMainList(int index) - { - main_model_ref.remove(index); - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_adapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_adapter.java new file mode 100644 index 00000000..ed473251 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_adapter.java @@ -0,0 +1,93 @@ +package com.darkweb.genesissearchengine.appManager.list_manager; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.*; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.constants.constants; +import com.example.myapplication.R; + +public class list_adapter extends RecyclerView.Adapter +{ + list_adapter() { + } + + /*Initializations*/ + + @NonNull + @Override + public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_row_view, parent, false); + return new listViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull list_adapter.listViewHolder holder, int position) + { + holder.bindListView(list_model.getInstance().getModel().get(position)); + clearMessageItem(holder.messageButton,position); + } + + @Override + public int getItemCount() { + return list_model.getInstance().getModel().size(); + } + + private void setItemViewOnClickListener(View itemView, String url) + { + itemView.setOnClickListener(v -> + { + list_model.getInstance().getListInstance().onUrlClick(url); + }); + } + + private void clearMessageItem(ImageButton clearButton, int index) + { + list_model.getInstance().getListInstance().onClickListenersInitialize(clearButton,index); + } + + /*View Holder Extensions*/ + class listViewHolder extends RecyclerView.ViewHolder + { + TextView heaaderText; + TextView descriptionText; + ImageButton messageButton; + ImageView empty_message; + + listViewHolder(View itemView) { + super(itemView); + } + + void bindListView(list_row_model model) { + + heaaderText = itemView.findViewById(R.id.header); + descriptionText = itemView.findViewById(R.id.description); + + String header = model.getHeader(); + + if(model.getHeader().length()<=2) + { + header = model.getDescription() + model.getHeader(); + } + + if(list_model.getInstance().getType() == constants.list_bookmark) + { + heaaderText.setText(list_model.getInstance().getListInstance().removeHttpRequest(model.getDescription())); + descriptionText.setText(header); + } + else + { + heaaderText.setText(list_model.getInstance().getListInstance().removeHttpRequest(header)); + descriptionText.setText(model.getDescription()); + } + + messageButton = itemView.findViewById(R.id.message_button); + empty_message = itemView.findViewById(R.id.empty_list); + + setItemViewOnClickListener(itemView,header); + } + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_controller.java new file mode 100644 index 00000000..6e20c1e7 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_controller.java @@ -0,0 +1,123 @@ +package com.darkweb.genesissearchengine.appManager.list_manager; + +import android.view.View; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.keys; +import com.example.myapplication.R; +import java.util.Objects; + +public class list_controller extends AppCompatActivity +{ + /*Private Variables*/ + + private ImageView emptyListNotifier; + private EditText searchBar; + private RecyclerView listView; + + private list_view_controller viewController; + + /*Initializations*/ + + @Override + protected void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + setContentView(R.layout.list_view); + + initializeListInstance(); + initializeListModel(); + initializeViews(); + initializeList(); + initSearchBar(); + updatelist(); + } + public void initializeListInstance(){ + list_model.getInstance().setListInstance(this); + list_model.getInstance().setListContext(this); + } + public void initializeListModel(){ + Bundle bundle = getIntent().getExtras(); + if(Objects.requireNonNull(bundle).getInt(keys.list_type)==constants.list_bookmark) + { + list_model.getInstance().setType(constants.list_bookmark); + list_model.getInstance().setMainList(app_model.getInstance().getBookmark()); + } + else + { + list_model.getInstance().setType(constants.list_history); + list_model.getInstance().setMainList(app_model.getInstance().getHistory()); + } + } + public void initializeViews(){ + emptyListNotifier = findViewById(R.id.empty_list); + searchBar = findViewById(R.id.search); + listView = findViewById(R.id.listview); + viewController = new list_view_controller(emptyListNotifier,searchBar,listView); + } + public void initializeList(){ + list_adapter adapter = new list_adapter(); + listView.setAdapter(adapter); + listView.setLayoutManager(new LinearLayoutManager(this)); + updateListStatus(false); + } + + /*View Handlers*/ + + public void onClearHistory(View view) + { + viewController.onClearHistory(); + } + public void onClearAll(){ + viewController.onClearAll(); + initializeViews(); + } + public void updateListStatus(boolean animate) + { + viewController.updateListStatus(animate); + } + public void initSearchBar() + { + list_ehandler.getInstance().onEditorActionListener(searchBar); + } + public boolean updatelist(){ + viewController.updateList(); + updateListStatus(false); + return true; + } + public void closeView() + { + viewController.closeView(); + } + public void onDatasetChanged(int index) + { + viewController.onDatasetChanged(index); + } + public void onClearSearchBarCursor() { + viewController.onClearSearchBarCursor(); + } + public String removeHttpRequest(String view){ + return viewController.removeHttpRequest(view); + } + + /*Event Handlers*/ + + public void onBackPressed(View view) + { + list_ehandler.getInstance().onBackPressed(); + } + public void onUrlClick(String url) + { + list_ehandler.getInstance().onUrlClick(url); + } + public void onClickListenersInitialize(View view,int index) { + list_ehandler.getInstance().onClickListenersInitialize(view,index); + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_ehandler.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_ehandler.java new file mode 100644 index 00000000..2d366476 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_ehandler.java @@ -0,0 +1,93 @@ +package com.darkweb.genesissearchengine.appManager.list_manager; + +import android.content.Context; +import android.view.View; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.orbot_manager; +import com.example.myapplication.R; + +public class list_ehandler +{ + /*Initializations*/ + + private static final list_ehandler ourInstance = new list_ehandler(); + public static list_ehandler getInstance() + { + return ourInstance; + } + private list_ehandler(){ + } + + /*Listener Initializations*/ + + void onEditorActionListener(EditText view) + { + view.setOnEditorActionListener((v, actionId, event) -> + { + if (actionId != EditorInfo.IME_ACTION_NEXT) + { + return false; + } + else + { + list_model.getInstance().getListInstance().onClearSearchBarCursor(); + InputMethodManager imm = (InputMethodManager) list_model.getInstance().getListInstance().getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(view.getWindowToken(), 0); + return list_model.getInstance().getListInstance().updatelist(); + } + }); + } + + void onClickListenersInitialize(View view,int index) + { + view.setOnClickListener(v -> + { + if(v.getId() == R.id.message_button) + { + onManualClear(index); + } + }); + } + + /*Listeners*/ + + private void onManualClear(int index) + { + list_model.getInstance().deleteFromDatabase(list_model.getInstance().getModel().get(index).getId()); + list_model.getInstance().getModel().remove(index); + list_model.getInstance().removeFromMainList(list_model.getInstance().getIndex().get(index)); + list_model.getInstance().removeIndex(index); + list_model.getInstance().getListInstance().onDatasetChanged(index); + list_model.getInstance().getListInstance().updateListStatus(true); + } + + void onBackPressed() + { + list_model.getInstance().getListInstance().closeView(); + } + + void onUrlClick(String url) + { + String url_temp = helperMethod.completeURL(url); + + if(!url_temp.contains("boogle") && !url_temp.equals(constants.backendGoogle) && !url_temp.equals(constants.backendBing)) + { + if(orbot_manager.getInstance().initOrbot(url_temp)) + { + app_model.getInstance().getAppInstance().onloadURL(url_temp,true,false); + } + } + else + { + app_model.getInstance().getAppInstance().onloadURL(url_temp,false,false); + } + list_model.getInstance().getListInstance().closeView(); + + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_model.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_model.java new file mode 100644 index 00000000..a95121eb --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_model.java @@ -0,0 +1,108 @@ +package com.darkweb.genesissearchengine.appManager.list_manager; + +import android.content.Context; +import com.darkweb.genesissearchengine.appManager.database_manager.database_controller; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.strings; + +import java.util.ArrayList; + +public class list_model +{ + /*Private Variables*/ + + private ArrayList list_model = new ArrayList<>(); + private ArrayList list_index; + private ArrayList main_model_ref = new ArrayList<>(); + private list_controller listInstance; + private Context listContext; + private int listType; + + /*Initializations*/ + + private static final list_model ourInstance = new list_model(); + public static list_model getInstance() + { + return ourInstance; + } + private list_model(){ + list_index = new ArrayList<>(); + } + + /*Helper Methods*/ + + void setType(int listType) + { + this.listType = listType; + } + int getType() + { + return listType; + } + + void setModel(ArrayList list_model) + { + this.list_model = list_model; + } + ArrayList getModel() + { + return list_model; + } + + void setIndex(int index){ + list_index.add(index); + } + void removeIndex(int index){ + list_index.remove(index); + for(int counter=index;counter<=list_index.size()-1;counter++) + { + list_index.set(counter,list_index.get(counter)-1); + } + } + ArrayList getIndex(){ + return list_index; + } + + void setMainList(ArrayList model) + { + main_model_ref = model; + } + ArrayList getMainList() + { + return main_model_ref; + } + void removeFromMainList(int index) + { + main_model_ref.remove(index); + } + + public list_controller getListInstance() + { + return listInstance; + } + void setListInstance(list_controller listInstance) + { + this.listInstance = listInstance; + } + + public Context getListContext(){ + return listContext; + } + void setListContext(Context listContext) + { + this.listContext = listContext; + } + + /*Database Handler*/ + + void deleteFromDatabase(int index) { + String table = strings.bookmark_text; + if(getType()== constants.list_history) + { + table = strings.history_text; + } + database_controller.getInstance().execSQL("delete from "+table+" where id="+index); + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_row_model.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_row_model.java similarity index 76% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_row_model.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_row_model.java index 8da32334..d2084782 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_activity/list_row_model.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_row_model.java @@ -1,25 +1,29 @@ -package com.darkweb.genesissearchengine.appManager.list_activity; +package com.darkweb.genesissearchengine.appManager.list_manager; public class list_row_model { + /*Private Variables*/ + private int id; private String header; private String description; + /*Initializations*/ + public list_row_model(String header, String description,int id) { this.id = id; this.header = header; this.description = description; } + /*Variable Getters*/ + public String getHeader() { return header; } - public String getDescription() { return description; } - public int getId() { return id; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_view_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_view_controller.java new file mode 100644 index 00000000..bbb374f3 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_view_controller.java @@ -0,0 +1,165 @@ +package com.darkweb.genesissearchengine.appManager.list_manager; + +import android.graphics.Color; +import android.text.SpannableString; +import android.text.Spanned; +import android.text.style.ForegroundColorSpan; +import android.view.View; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; +import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.appManager.database_manager.database_controller; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.pluginManager.message_manager; + +import java.util.ArrayList; +import java.util.Objects; + +class list_view_controller +{ + /*Private Variables*/ + + private ImageView emptyListNotifier; + private EditText searchBar; + private RecyclerView listView; + + /*Initializations*/ + + list_view_controller(ImageView emptyListNotifier, EditText searchBar,RecyclerView listView) + { + this.emptyListNotifier = emptyListNotifier; + this.searchBar = searchBar; + this.listView = listView; + } + + /*Handlers*/ + + void onClearHistory() + { + if(app_model.getInstance().getHistory().size()>0) + { + message_manager.getInstance().clearData(); + } + } + + void onClearAll() + { + list_model.getInstance().getModel().clear(); + list_model.getInstance().getMainList().clear(); + app_model.getInstance().getSuggestions().clear(); + + emptyListNotifier.setAlpha(0f); + emptyListNotifier.setVisibility(View.VISIBLE); + emptyListNotifier.animate().alpha(1); + searchBar.setText(strings.emptyStr); + + String table = strings.bookmark_text; + if(list_model.getInstance().getType()== constants.list_history) + { + table = strings.history_text; + } + database_controller.getInstance().execSQL("delete from "+table+" where 1"); + } + + void updateListStatus(boolean animate) + { + if(list_model.getInstance().getModel().size()<=0) + { + if(animate) + { + emptyListNotifier.setAlpha(0f); + emptyListNotifier.setVisibility(View.VISIBLE); + emptyListNotifier.animate().alpha(1); + } + else + { + emptyListNotifier.setVisibility(View.VISIBLE); + } + } + else + { + emptyListNotifier.setVisibility(View.GONE); + } + + } + + void updateList() + { + String query = searchBar.getText().toString(); + ArrayList temp_model = new ArrayList<>(); + list_model.getInstance().getIndex().clear(); + for(int counter=0;counter<=list_model.getInstance().getMainList().size()-1;counter++) + { + if(list_model.getInstance().getMainList().get(counter).getHeader().contains(query) || list_model.getInstance().getMainList().get(counter).getDescription().contains(query)) + { + temp_model.add(list_model.getInstance().getMainList().get(counter)); + list_model.getInstance().setIndex(counter); + } + } + list_model.getInstance().setModel(temp_model); + listView.getAdapter().notifyDataSetChanged(); + } + + void onDatasetChanged(int index) + { + Objects.requireNonNull(listView.getAdapter()).notifyItemRemoved(index); + listView.getAdapter().notifyDataSetChanged(); + } + + + void closeView() + { + list_model.getInstance().getListInstance().finish(); + } + + public void onClearSearchBarCursor() + { + searchBar.clearFocus(); + } + + public String removeHttpRequest(String url) + { + + if (url.startsWith("https://")) + { + return url.substring(8); + } + else if (url.startsWith("http://")) + { + return url.substring(7); + } + else + { + return url; + } + /* + if (view == null) + { + return; + } + + if (view.getText().toString().contains("https://")) + { + SpannableString ss = new SpannableString(view.getText()); + ss.setSpan(new ForegroundColorSpan(Color.argb(255, 0, 123, 43)), 0, 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + ss.setSpan(new ForegroundColorSpan(Color.GRAY), 5, 8, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + view.setText(ss); + } else if (view.getText().toString().contains("http://")) + { + SpannableString ss = new SpannableString(view.getText()); + ss.setSpan(new ForegroundColorSpan(Color.argb(255, 0, 128, 43)), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + ss.setSpan(new ForegroundColorSpan(Color.GRAY), 4, 7, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + view.setText(ss); + } else + { + SpannableString ss = new SpannableString(view.getText()); + ss.setSpan(new ForegroundColorSpan(Color.BLACK), 0, view.getText().length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + view.setText(ss); + }*/ + } + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_controller.java index 265c034c..270a0537 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_controller.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_controller.java @@ -22,8 +22,9 @@ public class setting_controller extends AppCompatActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.settings_activity); + setContentView(R.layout.settings_view); + setting_model.getInstance().init_status(); viewsInitializations(); listenersInitializations(); initializeModel(); @@ -64,6 +65,11 @@ public class setting_controller extends AppCompatActivity /*View Handlers*/ + @Override + public void onBackPressed(){ + closeView(); + } + public void closeView() { viewController.closeView(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_model.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_model.java index 67088e4f..210f6b9f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_model.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_model.java @@ -1,5 +1,8 @@ package com.darkweb.genesissearchengine.appManager.setting_manager; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; + public class setting_model { private static final setting_model ourInstance = new setting_model(); @@ -20,4 +23,17 @@ public class setting_model { this.settingInstance = settingInstance; } + + public void init_status() + { + setting_model.getInstance().search_status = status.search_status; + setting_model.getInstance().history_status = status.history_status; + setting_model.getInstance().java_status = status.java_status; + } + + /*Changed Status*/ + public String search_status = strings.emptyStr; + public boolean java_status = false; + public boolean history_status = true; + } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_view_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_view_controller.java index 7a0cc39d..9292ad8b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_view_controller.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_view_controller.java @@ -2,7 +2,9 @@ package com.darkweb.genesissearchengine.appManager.setting_manager; import android.widget.ArrayAdapter; import android.widget.Spinner; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.dataManager.preference_manager; @@ -22,14 +24,22 @@ class setting_view_controller setting_view_controller(Spinner search, Spinner javascript, Spinner history) { this.search = search; - this.search = javascript; - this.search = history; + this.javascript = javascript; + this.history = history; + initViews(); initJavascript(); initHistory(); initSearchEngine(); } + private void initViews() + { + search.setDropDownVerticalOffset(15); + javascript.setDropDownVerticalOffset(15); + history.setDropDownVerticalOffset(15); + } + private void initJavascript() { if (java_status) @@ -67,6 +77,20 @@ class setting_view_controller void closeView() { + + if(status.search_status != setting_model.getInstance().search_status) + { + status.search_status = setting_model.getInstance().search_status; + app_model.getInstance().getAppInstance().initSearchEngine(); + } + else if(status.java_status != setting_model.getInstance().java_status) + { + status.java_status = setting_model.getInstance().java_status; + app_model.getInstance().getAppInstance().onReInitGeckoView(); + } + + status.history_status = setting_model.getInstance().history_status; + setting_model.getInstance().getSettingInstance().finish(); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/settings_ehandler.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/settings_ehandler.java index f62db563..d07bfc1b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/settings_ehandler.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/settings_ehandler.java @@ -3,7 +3,7 @@ package com.darkweb.genesissearchengine.appManager.setting_manager; import android.view.View; import android.widget.AdapterView; import android.widget.Spinner; -import com.darkweb.genesissearchengine.appManager.main_activity.app_model; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.dataManager.preference_manager; import com.example.myapplication.R; @@ -28,20 +28,17 @@ public class settings_ehandler /*Listeners*/ - @SuppressWarnings("ConstantConditions") private void onJavaScriptListener(int position) { if(position==1 && java_status) { - java_status = false; - preference_manager.getInstance().setBool(keys.java_script, java_status); - app_model.getInstance().getAppInstance().onReInitGeckoView(); + setting_model.getInstance().java_status = false; + preference_manager.getInstance().setBool(keys.java_script, false); } else if(!java_status) { - java_status = true; - preference_manager.getInstance().setBool(keys.java_script, java_status); - app_model.getInstance().getAppInstance().onReInitGeckoView(); + setting_model.getInstance().java_status = true; + preference_manager.getInstance().setBool(keys.java_script, true); } } @@ -49,24 +46,22 @@ public class settings_ehandler { if(!search_status.equals(parentView.getItemAtPosition(position).toString())) { - search_status = parentView.getItemAtPosition(position).toString(); - preference_manager.getInstance().setString(keys.search_engine, search_status); - app_model.getInstance().getAppInstance().initSearchEngine(); + setting_model.getInstance().search_status = parentView.getItemAtPosition(position).toString(); + preference_manager.getInstance().setString(keys.search_engine, setting_model.getInstance().search_status); } } - @SuppressWarnings("ConstantConditions") private void onHistoryListener(int position) { if(position==1 && history_status) { - history_status = false; - preference_manager.getInstance().setBool(keys.history_clear, history_status); + setting_model.getInstance().history_status = false; + preference_manager.getInstance().setBool(keys.history_clear, false); } else if(!java_status) { - history_status = true; - preference_manager.getInstance().setBool(keys.history_clear, history_status); + setting_model.getInstance().history_status = true; + preference_manager.getInstance().setBool(keys.history_clear, true); } } @@ -82,17 +77,17 @@ public class settings_ehandler view.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parentView, View selectedItemView, int position, long id) { - if(selectedItemView.getId()== R.id.search_manager) + if(parentView.getId()== R.id.search_manager) { - settings_ehandler.getInstance().onJavaScriptListener(position); + onSearchListner(parentView,position); } - else if(selectedItemView.getId()== R.id.javascript_manager) + else if(parentView.getId()== R.id.javascript_manager) { - settings_ehandler.getInstance().onHistoryListener(position); + onJavaScriptListener(position); } - else if(selectedItemView.getId()== R.id.history_manager) + else if(parentView.getId()== R.id.history_manager) { - settings_ehandler.getInstance().onSearchListner(parentView,position); + onHistoryListener(position); } } @Override 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 6b7bc6e9..6cfff191 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java @@ -3,13 +3,15 @@ package com.darkweb.genesissearchengine.constants; public class constants { /*LOCAL URL CONSTANTS*/ + public static String blackMarket = "https://boogle.store/search?q=black+market&p_num=1&s_type=all"; public static String leakedDocument = "https://boogle.store/search?q=leaked+document&p_num=1&s_type=all&p_num=1&s_type=all"; public static String news = "https://boogle.store/search?q=latest%20news&p_num=1&s_type=news"; public static String softwares = "https://boogle.store/search?q=softwares+tools&p_num=1&s_type=all&p_num=1&s_type=all"; /*URL CONSTANTS*/ - public static String backendGenesis = "https://boogle.store"; + + public static String backendGenesis = "https://boogle.store/"; public static String backendGoogle = "https://www.google.com/"; public static String backendBing = "https://www.bing.com/"; public static String backendUrlHost = "boogle.store"; @@ -23,10 +25,12 @@ public class constants public static String playstoreUrl = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine"; /*BUILD CONSTANTS*/ + public static String build_type = "playstore"; //public static String build_type = "local"; - /*BUILD PROXY*/ + /*PROXY CONSTANTS*/ + public static int proxy_type = 1; public static String proxy_socks = "127.0.0.1"; public static int proxy_socks_version = 5; @@ -37,12 +41,15 @@ public class constants public static boolean proxy_donottrackheader_enabled = false; public static int proxy_donottrackheader_value = 1; + /*MENU CONSTANTS*/ + public static int list_history = 1; public static int list_bookmark = 2; - public static String databae_name="genesis.db"; - public static int databae_version=1; + /*SETTINGS CONSTANTS*/ + + public static int max_history_size=500; + public static int max_bookmark_size=500; + public static String databae_name="genesis_dbase"; - public static int max_history_size=3; - public static int max_bookmark_size=3; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java index 424286f6..768088da 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -2,9 +2,9 @@ package com.darkweb.genesissearchengine.constants; public class enums { - /*Web Request*/ - public enum webRequestStatus{notRunning,running,repeat;} + /*SETTINGS*/ public enum searchEngine{Darkweb,Bing,Google} + public enum adID{hidden, internal} } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java index ec891b3b..74ab7e60 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java @@ -2,11 +2,10 @@ package com.darkweb.genesissearchengine.constants; public class messages { - /*Post Messages*/ - public final static int LOCAL_HOMEPAGE_CACHED =0; + /*POST MESSAGES KEYS*/ + public final static int INTERNET_ERROR =2; public final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1; - public final static int LOAD_WEBVIEW_BACKGROUND = 2; public final static int DISABLE_SPLASH_SCREEN =3; public final static int UPDATE_LOADING_TEXT =5; public final static int SHOW_ADS =6; 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 7b041ab1..ecbb98a3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -1,5 +1,6 @@ package com.darkweb.genesissearchengine.constants; +import android.util.Log; import com.darkweb.genesissearchengine.dataManager.preference_manager; public class status @@ -11,7 +12,7 @@ public class status public static String version_code = "6.0"; /*Settings Level*/ - public static String search_status = ""; + public static String search_status = strings.emptyStr; public static boolean java_status = false; public static boolean history_status = true; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java index 24c39d25..a6e8bbb4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java @@ -2,8 +2,12 @@ package com.darkweb.genesissearchengine.constants; public class strings { + /*Orbot Manager*/ + public static String torfolder = "torfiles"; + /*Messsage Manager*/ + public static String welcome_message_title = "Welcome | Deep Web Gateway"; public static String welcome_message_desc = "\nWelcome to Deep Web | Dark Web Gateway. This application provide you a platform to Search and Open Dark Web urls.\n\nYou cannot open any url related to normal internet as its not the intended purpose. You can check out following urls to get yourself started\n\nHere are few Suggestions\n"; public static String welcome_message_bt1 = "Deep Web Online Market"; @@ -58,7 +62,17 @@ public class strings public static String clear_bt1 = "Clear Data"; public static String clear_bt2 = "Dismiss"; + + /*Text Manager*/ + public static String darkweb = "Darkweb"; + public static String emptyStr = ""; + public static String bookmark_text = "bookmark"; + public static String history_text = "history"; + public static String bing_text = "Bing"; + public static String google_text = "Google"; + + } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preference_manager.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preference_manager.java index 3a2a53ab..7c8a3a46 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preference_manager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preference_manager.java @@ -2,7 +2,7 @@ package com.darkweb.genesissearchengine.dataManager; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import com.darkweb.genesissearchengine.appManager.main_activity.app_model; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; public class preference_manager { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperMethod.java b/app/src/main/java/com/darkweb/genesissearchengine/helperMethod.java index d560c8f4..12e4f829 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperMethod.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperMethod.java @@ -2,15 +2,15 @@ package com.darkweb.genesissearchengine; import android.content.Context; import android.content.Intent; -import android.content.SharedPreferences; import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.Canvas; +import android.graphics.Color; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.Build; -import android.preference.PreferenceManager; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.style.ForegroundColorSpan; import android.util.DisplayMetrics; import android.view.Display; import android.view.View; @@ -20,15 +20,15 @@ import android.view.animation.Animation; import android.view.animation.RotateAnimation; import android.view.inputmethod.InputMethodManager; import androidx.core.app.ShareCompat; -import com.darkweb.genesissearchengine.appManager.list_activity.list_controller; -import com.darkweb.genesissearchengine.appManager.main_activity.app_model; -import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.dataManager.preference_manager; import com.example.myapplication.BuildConfig; import java.net.MalformedURLException; import java.net.URL; +import java.text.Normalizer; +import java.util.Locale; public class helperMethod { @@ -37,11 +37,7 @@ public class helperMethod { ConnectivityManager cm = (ConnectivityManager) app_model.getInstance().getAppContext().getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = cm.getActiveNetworkInfo(); - if (networkInfo != null && networkInfo.isConnected()) - { - return true; - } - return false; + return networkInfo != null && networkInfo.isConnected(); } @@ -70,17 +66,17 @@ public class helperMethod { if(!hasSoftKeys) { - return (int)(Resources.getSystem().getDisplayMetrics().heightPixels)-(helperMethod.getNavigationBarHeight()); + return Resources.getSystem().getDisplayMetrics().heightPixels -(helperMethod.getNavigationBarHeight()); } else { - return (int)(Resources.getSystem().getDisplayMetrics().heightPixels); + return (Resources.getSystem().getDisplayMetrics().heightPixels); } } public static int screenWidth() { - return (int)(Resources.getSystem().getDisplayMetrics().widthPixels); + return (Resources.getSystem().getDisplayMetrics().widthPixels); } public static int getNavigationBarHeight() { @@ -130,14 +126,7 @@ public class helperMethod public static boolean isBuildValid () { - if(BuildConfig.FLAVOR.equals("aarch64")&& Build.SUPPORTED_ABIS[0].equals("arm64-v8a") || BuildConfig.FLAVOR.equals("arm")&&Build.SUPPORTED_ABIS[0].equals("armeabi-v7a") || BuildConfig.FLAVOR.equals("x86")&&Build.SUPPORTED_ABIS[0].equals("x86") || BuildConfig.FLAVOR.equals("x86_64")&&Build.SUPPORTED_ABIS[0].equals("x86_64")) - { - return true; - } - else - { - return false; - } + return BuildConfig.FLAVOR.equals("aarch64") && Build.SUPPORTED_ABIS[0].equals("arm64-v8a") || BuildConfig.FLAVOR.equals("arm") && Build.SUPPORTED_ABIS[0].equals("armeabi-v7a") || BuildConfig.FLAVOR.equals("x86") && Build.SUPPORTED_ABIS[0].equals("x86") || BuildConfig.FLAVOR.equals("x86_64") && Build.SUPPORTED_ABIS[0].equals("x86_64"); } @@ -151,8 +140,9 @@ public class helperMethod { ShareCompat.IntentBuilder.from(app_model.getInstance().getAppInstance()) .setType("text/plain") - .setChooserTitle("Genesis | Onion Search") - .setText("http://play.google.com/store/apps/details?id=" + app_model.getInstance().getAppInstance().getPackageName()) + .setChooserTitle("Hi! Check out this Awesome App") + .setSubject("Hi! Check out this Awesome App") + .setText("Genesis | Onion Search | http://play.google.com/store/apps/details?id=" + app_model.getInstance().getAppInstance().getPackageName()) .startChooser(); } @@ -180,4 +170,43 @@ public class helperMethod app_model.getInstance().getAppInstance().startActivity(myIntent); } + public static CharSequence highlight(String search, String originalText) { + // ignore case and accents + // the same thing should have been done for the search text + String normalizedText = Normalizer + .normalize(originalText, Normalizer.Form.NFD) + .replaceAll("\\p{InCombiningDiacriticalMarks}+", "") + .toLowerCase(Locale.ENGLISH); + + int start = normalizedText.indexOf(search.toLowerCase(Locale.ENGLISH)); + if (start < 0) { + // not found, nothing to to + return originalText; + } else { + // highlight each appearance in the original text + // while searching in normalized text + Spannable highlighted = new SpannableString(originalText); + while (start >= 0) { + int spanStart = Math.min(start, originalText.length()); + int spanEnd = Math.min(start + search.length(), + originalText.length()); + + highlighted.setSpan(new ForegroundColorSpan(Color.BLUE), + spanStart, spanEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + + start = normalizedText.indexOf(search, spanEnd); + } + + return highlighted; + } + } + + public static void onMinimizeApp() + { + Intent startMain = new Intent(Intent.ACTION_MAIN); + startMain.addCategory(Intent.CATEGORY_HOME); + startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + app_model.getInstance().getAppInstance().startActivity(startMain); + } + } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/httpManager/httpclient.java b/app/src/main/java/com/darkweb/genesissearchengine/httpManager/httpclient.java index eced7892..0dd29bb9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/httpManager/httpclient.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/httpManager/httpclient.java @@ -32,7 +32,7 @@ public class httpclient { String c_url = url.replace("http://boogle","https://boogle").replaceAll("genesis.onion","boogle.store").replaceAll("genesis.store","boogle.store"); - HttpClient client=new DefaultHttpClient();; + HttpClient client=new DefaultHttpClient(); SSLConnectionSocketFactory scsf = new SSLConnectionSocketFactory( SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build(), NoopHostnameVerifier.INSTANCE); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/httpManager/serverRequestManager.java b/app/src/main/java/com/darkweb/genesissearchengine/httpManager/serverRequestManager.java index 2f6b9933..fd61e3a3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/httpManager/serverRequestManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/httpManager/serverRequestManager.java @@ -30,7 +30,7 @@ public class serverRequestManager try { HttpGet reportrequest = new HttpGet(url); - HttpClient client=new DefaultHttpClient();; + HttpClient client=new DefaultHttpClient(); client.execute(reportrequest); } catch (Exception ex) diff --git a/app/src/main/java/com/darkweb/genesissearchengine/httpManager/webRequestHandler.java b/app/src/main/java/com/darkweb/genesissearchengine/httpManager/webRequestHandler.java index 5e825f22..83d46a21 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/httpManager/webRequestHandler.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/httpManager/webRequestHandler.java @@ -5,7 +5,7 @@ import android.os.Message; import android.os.Handler; -import com.darkweb.genesissearchengine.appManager.main_activity.app_model; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.constants.messages; public class webRequestHandler diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/admanager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/admanager.java index 25cfbea8..65d15d15 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/admanager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/admanager.java @@ -1,6 +1,7 @@ package com.darkweb.genesissearchengine.pluginManager; -import com.darkweb.genesissearchengine.appManager.main_activity.app_model; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; +import com.darkweb.genesissearchengine.constants.enums; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.InterstitialAd; import com.google.android.gms.ads.MobileAds; @@ -10,7 +11,8 @@ public class admanager /*Private Variables*/ private static final admanager ourInstance = new admanager(); - private InterstitialAd mInterstitialAd; + private InterstitialAd mInterstitialHidden; + private InterstitialAd mInterstitialInternal; private int adCount = 0; boolean isAdShown = false; @@ -26,51 +28,31 @@ public class admanager public void initialize() { MobileAds.initialize(app_model.getInstance().getAppInstance(), "ca-app-pub-5074525529134731~2926711128"); - mInterstitialAd = new InterstitialAd(app_model.getInstance().getAppInstance()); - mInterstitialAd.setAdUnitId("ca-app-pub-5074525529134731/8478420705"); - mInterstitialAd.loadAd(new AdRequest.Builder().build()); + initAd(mInterstitialHidden,"ca-app-pub-5074525529134731/4332539288"); + initAd(mInterstitialInternal,"ca-app-pub-5074525529134731/8478420705"); + } + + public void initAd(InterstitialAd adInstance,String id) + { + adInstance = new InterstitialAd(app_model.getInstance().getAppInstance()); + + adInstance.setAdUnitId(id); + adInstance.loadAd(new AdRequest.Builder().build()); } /*Helper Methods*/ - public void showAd(boolean isAdForced) + public void showAd(enums.adID id) { - if(isAdShown) + if(id.equals(enums.adID.hidden)) { - return; - } - - if(!mInterstitialAd.isLoading() && !mInterstitialAd.isLoaded()) - { - mInterstitialAd.loadAd(new AdRequest.Builder().build()); - if(isAdForced || adCount==0 || adCount%3==0) - { - adCount = 0; - } - else - { - adCount+=1; - } + mInterstitialHidden.show(); + mInterstitialHidden.loadAd(new AdRequest.Builder().build()); } else { - if(mInterstitialAd.isLoaded()) - { - if(isAdForced) - { - isAdShown = true; - mInterstitialAd.show(); - adCount = 1; - } - else - { - if(adCount%3==0) - { - mInterstitialAd.show(); - } - adCount += 1; - } - } + mInterstitialInternal.show(); + mInterstitialInternal.loadAd(new AdRequest.Builder().build()); } } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/message_manager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/message_manager.java index 9f4d223c..46e7082d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/message_manager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/message_manager.java @@ -6,14 +6,13 @@ import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Handler; -import android.widget.RelativeLayout; -import android.widget.RelativeLayout.LayoutParams; import android.text.InputType; import android.widget.EditText; import androidx.core.content.ContextCompat; import com.crowdfire.cfalertdialog.CFAlertDialog; -import com.darkweb.genesissearchengine.appManager.main_activity.app_model; -import com.darkweb.genesissearchengine.appManager.main_activity.application_controller; +import com.darkweb.genesissearchengine.appManager.list_manager.list_model; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; +import com.darkweb.genesissearchengine.appManager.home_activity.application_controller; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.strings; @@ -187,15 +186,15 @@ public class message_manager public void clearData() { - Context application_context = app_model.getInstance().getListContext(); - CFAlertDialog.Builder builder = new CFAlertDialog.Builder(app_model.getInstance().getListContext()) + Context application_context = list_model.getInstance().getListContext(); + CFAlertDialog.Builder builder = new CFAlertDialog.Builder(list_model.getInstance().getListContext()) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setTitle(strings.clear_title) .setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2)) .setTextColor(application_context.getResources().getColor(R.color.black)) .setMessage(strings.clear_desc) .addButton(strings.clear_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { - app_model.getInstance().getListInstance().clearAll(); + list_model.getInstance().getListInstance().onClearAll(); dialog.dismiss(); }) .addButton(strings.clear_bt2, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbot_manager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbot_manager.java index ce7fe711..ea8c6d93 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbot_manager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbot_manager.java @@ -1,6 +1,6 @@ package com.darkweb.genesissearchengine.pluginManager; -import com.darkweb.genesissearchengine.appManager.main_activity.app_model; +import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.status; diff --git a/app/src/main/res/drawable/back_arrow.webp b/app/src/main/res/drawable/back_arrow.webp new file mode 100644 index 00000000..1d0c464a Binary files /dev/null and b/app/src/main/res/drawable/back_arrow.webp differ diff --git a/app/src/main/res/drawable/cancel.png b/app/src/main/res/drawable/cancel.png index 964dc9d7..54d6587f 100644 Binary files a/app/src/main/res/drawable/cancel.png and b/app/src/main/res/drawable/cancel.png differ diff --git a/app/src/main/res/drawable/cancel.webp b/app/src/main/res/drawable/cancel.webp new file mode 100644 index 00000000..74c67a91 Binary files /dev/null and b/app/src/main/res/drawable/cancel.webp differ diff --git a/app/src/main/res/drawable/dustbin.png b/app/src/main/res/drawable/dustbin.png new file mode 100644 index 00000000..340c8ce3 Binary files /dev/null and b/app/src/main/res/drawable/dustbin.png differ diff --git a/app/src/main/res/layout/hint_completion_layout.xml b/app/src/main/res/layout/hint_view.xml similarity index 70% rename from app/src/main/res/layout/hint_completion_layout.xml rename to app/src/main/res/layout/hint_view.xml index 954c57c7..81f8d599 100644 --- a/app/src/main/res/layout/hint_completion_layout.xml +++ b/app/src/main/res/layout/hint_view.xml @@ -3,7 +3,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingRight="15dp" - android:layout_marginTop="60dp" android:paddingLeft="15dp" android:paddingBottom="-35dp" android:background="@color/white" @@ -11,19 +10,22 @@ android:orientation="vertical"> + android:textColor="@color/text_color_v1" + android:textSize="15.5sp"/> diff --git a/app/src/main/res/layout/home_view.xml b/app/src/main/res/layout/home_view.xml index 4a2d54b5..5d516814 100644 --- a/app/src/main/res/layout/home_view.xml +++ b/app/src/main/res/layout/home_view.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" - tools:context="com.darkweb.genesissearchengine.appManager.main_activity.application_controller"> + tools:context="com.darkweb.genesissearchengine.appManager.home_activity.application_controller"> @@ -153,14 +153,16 @@ android:textColorHighlight="@color/text_color_highlight_v1" android:background="@xml/search_back_default" android:textCursorDrawable="@xml/search_cursor_state" - android:hint="@string/SearchHint" + android:hint="@string/SearchHintMain" android:text="@string/homeUrl" android:ems="10" android:layout_marginTop="8dp" + android:dropDownHeight="220dp" android:inputType="textNoSuggestions" android:layout_marginBottom="8dp" - android:completionHintView="@layout/hint_completion_layout" + android:completionHintView="@layout/hint_view" android:layout_marginEnd="0dp" + android:dropDownSelector="@xml/rouned_corner" android:layout_marginStart="10dp" android:maxLines="1" android:id="@+id/search" android:layout_weight="1" android:importantForAutofill="no" diff --git a/app/src/main/res/layout/invalid_setup.xml b/app/src/main/res/layout/invalid_setup_view.xml similarity index 57% rename from app/src/main/res/layout/invalid_setup.xml rename to app/src/main/res/layout/invalid_setup_view.xml index 6c159a4e..9168d840 100644 --- a/app/src/main/res/layout/invalid_setup.xml +++ b/app/src/main/res/layout/invalid_setup_view.xml @@ -1,6 +1,6 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/list_manager_row.xml b/app/src/main/res/layout/list_row_view.xml similarity index 81% rename from app/src/main/res/layout/list_manager_row.xml rename to app/src/main/res/layout/list_row_view.xml index 4516d30a..de254430 100644 --- a/app/src/main/res/layout/list_manager_row.xml +++ b/app/src/main/res/layout/list_row_view.xml @@ -11,9 +11,9 @@ @@ -21,6 +21,7 @@ android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" + android:textColor="@color/black" android:singleLine="true" /> @@ -29,8 +30,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" + android:layout_marginTop="2dp" android:ellipsize="end" - android:textColor="@color/ease_blue" + android:textSize="12sp" + android:textColor="@color/holo_dark_gray" /> @@ -38,7 +41,7 @@ android:layout_width="35dp" android:layout_height="35dp" android:layout_marginEnd="10dp" - android:layout_marginTop="5dp" + android:layout_marginTop="0dp" android:id="@+id/message_button" android:onClick="onHomeButtonPressed" android:scaleType="fitCenter" diff --git a/app/src/main/res/layout/activity_app_list_manager.xml b/app/src/main/res/layout/list_view.xml similarity index 82% rename from app/src/main/res/layout/activity_app_list_manager.xml rename to app/src/main/res/layout/list_view.xml index 1cabcb6c..07b0fd91 100644 --- a/app/src/main/res/layout/activity_app_list_manager.xml +++ b/app/src/main/res/layout/list_view.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" - tools:context="com.darkweb.genesissearchengine.appManager.list_activity.list_controller"> + tools:context="com.darkweb.genesissearchengine.appManager.list_manager.list_controller"> -