build update

master
msmannan00 2019-07-18 22:15:30 +05:00
parent 819a129fa4
commit 358f318111
24 changed files with 370 additions and 297 deletions

View File

@ -71,7 +71,6 @@ android {
}
}
}
dependencies {
/*Default Libraries*/

View File

@ -12,19 +12,23 @@ import static android.content.Context.MODE_PRIVATE;
public class database_controller
{
/*Private Variables*/
private static final database_controller ourInstance = new database_controller();
private SQLiteDatabase database_instance;
public static database_controller getInstance()
{
return ourInstance;
}
private SQLiteDatabase database_instance;
private database_controller()
{
}
/*Initializations*/
public void initialize()
{
try
@ -41,13 +45,14 @@ public class database_controller
}
/*Helper Methods*/
public void execSQL(String query)
{
database_instance.execSQL(query);
}
public ArrayList<list_row_model> selectHistory()
{
public ArrayList<list_row_model> selectHistory(){
ArrayList<list_row_model> tempmodel = new ArrayList<>();
Cursor c = database_instance.rawQuery("SELECT * FROM history ORDER BY id DESC ", null);
if (c.moveToFirst()){
@ -61,8 +66,7 @@ public class database_controller
return tempmodel;
}
public ArrayList<list_row_model> selectBookmark()
{
public ArrayList<list_row_model> selectBookmark(){
ArrayList<list_row_model> tempmodel = new ArrayList<>();
Cursor c = database_instance.rawQuery("SELECT * FROM bookmark ORDER BY id DESC ", null);

View File

@ -6,6 +6,7 @@ import com.darkweb.genesissearchengine.appManager.database_manager.database_cont
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.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperMethod;
@ -17,6 +18,7 @@ public class app_model
/*Data Objects*/
private ArrayList<list_row_model> history = new ArrayList<list_row_model>();
private ArrayList<list_row_model> bookmarks = new ArrayList<list_row_model>();
private ArrayList<navigation_model> navigation = new ArrayList<navigation_model>();
private HashSet<String> suggestions = new HashSet<String>();
private static int port = 9150;
@ -24,8 +26,7 @@ public class app_model
private application_controller appInstance;
/*Initializations*/
public void initialization()
{
public void initialization(){
database_controller.getInstance().initialize();
initializeHistory();
initializeBookmarks();
@ -151,6 +152,14 @@ public class app_model
return new ArrayList<String>(suggestions);
}
/*Navigation*/
public void addNavigation(String url,enums.navigationType type) {
navigation.add(new navigation_model(url,type));
}
public ArrayList<navigation_model> getNavigation() {
return navigation;
}
/*Helper Method*/
public boolean isUrlRepeatable(String url,String viewUrl){

View File

@ -38,7 +38,7 @@ public class application_controller extends AppCompatActivity
/*Redirection Objects*/
private geckoClients geckoclient = null;
private webviewClient webviewclient = null;
private eventHandler eventhandler = null;
private home_ehandler eventhandler = null;
/*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/
@Override
@ -62,7 +62,7 @@ public class application_controller extends AppCompatActivity
orbot_manager.getInstance().reinitOrbot();
viewController.getInstance().initialization(webView,loadingText,progressBar,searchbar,splashScreen,requestFailure,floatingButton, loadingIcon,splashlogo);
firebase.getInstance().initialize();
geckoclient.initialize(geckoView,false);
geckoclient.initialize(geckoView);
app_model.getInstance().initialization();
initBoogle();
}
@ -89,21 +89,43 @@ public class application_controller extends AppCompatActivity
{
if(status.search_status.equals(enums.searchEngine.Bing.toString()))
{
geckoclient.setRootEngine(constants.backendBing);
webView.stopLoading();
onloadURL(constants.backendBing,true,false);
if(app_model.getInstance().getNavigation().size()!=1)
{
app_model.getInstance().addNavigation(constants.backendBing,enums.navigationType.onion);
}
if(app_model.getInstance().getNavigation().size()>0)
{
app_model.getInstance().getNavigation().set(0,new navigation_model(constants.backendBing,enums.navigationType.onion));
}
return false;
}
else if(status.search_status.equals(enums.searchEngine.Google.toString()))
{
geckoclient.setRootEngine(constants.backendGoogle);
webView.stopLoading();
onloadURL(constants.backendGoogle,true,false);
if(app_model.getInstance().getNavigation().size()!=1)
{
app_model.getInstance().addNavigation(constants.backendGoogle,enums.navigationType.onion);
}
if(app_model.getInstance().getNavigation().size()>0)
{
app_model.getInstance().getNavigation().set(0,new navigation_model(constants.backendGoogle,enums.navigationType.onion));
}
return false;
}
else
{
onloadURL(constants.backendGenesis,false,false);
if(app_model.getInstance().getNavigation().size()!=1)
{
app_model.getInstance().addNavigation(constants.backendGenesis,enums.navigationType.base);
}
if(app_model.getInstance().getNavigation().size()>0)
{
app_model.getInstance().getNavigation().set(0,new navigation_model(constants.backendGenesis,enums.navigationType.base));
}
return true;
}
}
@ -131,12 +153,12 @@ public class application_controller extends AppCompatActivity
webviewclient = new webviewClient();
geckoclient = new geckoClients();
eventhandler = new eventHandler();
eventhandler = new home_ehandler();
}
public void initializeCrashlytics()
{
//fabricManager.getInstance().init();
fabricManager.getInstance().init();
}
public void initializeWebView()
@ -275,7 +297,7 @@ public class application_controller extends AppCompatActivity
}
public void onReInitGeckoView() {
geckoclient.initialize(geckoView,true);
geckoclient.initialize(geckoView);
if(webView.getVisibility() != View.VISIBLE)
{
geckoclient.onReloadHiddenView();
@ -287,13 +309,13 @@ public class application_controller extends AppCompatActivity
geckoclient.onHiddenGoBack(geckoView);
}
public int getHiddenQueueLength()
public void releaseSession()
{
return geckoclient.getHiddenQueueLength();
geckoclient.releaseSession(geckoView);
}
public void stopHiddenView(boolean releaseView) {
geckoclient.stopHiddenView(geckoView,releaseView);
public void stopHiddenView(boolean releaseView,boolean backPressed) {
geckoclient.stopHiddenView(geckoView,releaseView,backPressed);
//geckoclient.removeHistory();
}

View File

@ -18,8 +18,8 @@ import java.util.ArrayList;
class geckoClients
{
private GeckoSession session1 = null;
private GeckoRuntime runtime1 = null;
private final Handler internetErrorHandler = new Handler();
private ArrayList<String> urlList = new ArrayList<>();
private boolean isRunning = false;
private boolean isContentLoading = false;
@ -46,24 +46,21 @@ class geckoClients
this.isUrlSavable = isUrlSavable;
navigatedURL = "";
loadingCompeleted = false;
initialize(geckoView,false);
initialize(geckoView);
session1.loadUri(url);
app_model.getInstance().getAppInstance().onRequestTriggered(true,url);
app_model.getInstance().getAppInstance().onProgressBarUpdateView(4);
isFirstTimeLoad = true;
if(isUrlSavable)
{
urlList.clear();
}
wasBackPressed = false;
isContentLoading = false;
isRunning = false;
}
}
void initialize(GeckoView geckoView,boolean release)
{
if(urlList.size()<=0 || release)
void initialize(GeckoView geckoView)
{
session1 = new GeckoSession();
GeckoRuntime runtime1 = GeckoRuntime.getDefault(app_model.getInstance().getAppContext());
runtime1 = GeckoRuntime.getDefault(app_model.getInstance().getAppContext());
runtime1.getSettings().setJavaScriptEnabled(status.java_status);
session1.open(runtime1);
geckoView.releaseSession();
@ -73,7 +70,6 @@ class geckoClients
geckoView.setVisibility(View.VISIBLE);
geckoView.setAlpha(1);
}
}
class navigationDelegate implements GeckoSession.NavigationDelegate
{
@ -124,7 +120,7 @@ class geckoClients
{
app_model.getInstance().getAppInstance().hideSplashScreen();
}
if(!success && !isContentLoading)
if(!success && !isContentLoading && !wasBackPressed)
{
app_model.getInstance().getAppInstance().onPageFinished(true);
app_model.getInstance().getAppInstance().onInternetErrorView();
@ -132,11 +128,6 @@ class geckoClients
}
else if(success)
{
if((urlList.size() == 0 || !urlList.get(urlList.size() - 1).equals(navigatedURL)) && !wasBackPressed)
{
urlList.add(navigatedURL);
}
urlRequestCount++;
if(urlRequestCount==5)
{
@ -148,27 +139,34 @@ class geckoClients
}
else if(isAppRated)
{
if(isFirstTimeLoad)
if(isFirstTimeLoad && navigatedURL.contains(".onion"))
{
app_model.getInstance().getAppInstance().onShowAd(enums.adID.hidden);
app_model.getInstance().getAppInstance().onShowAd(enums.adID.hidden_onion_start);
}
else
else if(!isFirstTimeLoad && navigatedURL.contains(".onion"))
{
app_model.getInstance().getAppInstance().onShowAd(enums.adID.internal);
app_model.getInstance().getAppInstance().onShowAd(enums.adID.hidden_onion);
}
else if(!isFirstTimeLoad && !navigatedURL.contains(".onion"))
{
app_model.getInstance().getAppInstance().onShowAd(enums.adID.hidden_base);
}
}
if(isUrlSavable && !urlList.get(urlList.size()-1).equals("navigatedURL"))
{
app_model.getInstance().addHistory(navigatedURL);
}
isUrlSavable = true;
app_model.getInstance().getAppInstance().onDisableInternetError();
app_model.getInstance().getAppInstance().onProgressBarUpdateView(0);
fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL SUCCESS : " + success + "--" + isContentLoading);
app_model.getInstance().getAppInstance().onPageFinished(true);
}
if(isUrlSavable && !app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-1).equals(navigatedURL))
{
app_model.getInstance().addHistory(navigatedURL);
app_model.getInstance().addNavigation(navigatedURL,enums.navigationType.onion);
}
isUrlSavable = true;
isFirstTimeLoad = false;
}
}
}, 500);
@ -203,59 +201,39 @@ class geckoClients
void onHiddenGoBack(GeckoView geckoView)
{
if(urlList.size()>1)
{
urlList.remove(urlList.size() - 1);
isRunning = false;
loadingCompeleted = false;
isUrlSavable = false;
wasBackPressed = true;
session1.stop();
session1.loadUri(urlList.get(urlList.size() - 1));
app_model.getInstance().getAppInstance().onUpdateSearchBarView(urlList.get(urlList.size()-1));
}
else if(isRunning)
{
if(navigatedURL.equals(constants.backendGoogle) && status.search_status.equals(strings.google_text) || navigatedURL.equals(constants.backendBing) && status.search_status.equals(strings.bing_text))
{
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();
}
}
session1.loadUri(app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-1).getURL());
}
void stopHiddenView(GeckoView geckoView,boolean releaseView)
void stopHiddenView(GeckoView geckoView,boolean releaseView,boolean backPressed)
{
if(session1!=null)
{
isRunning = false;
loadingCompeleted = false;
wasBackPressed = backPressed;
session1.stop();
if(!releaseView)
{
session1.close();
//session1.close();
}
}
}
int getHiddenQueueLength()
public void releaseSession(GeckoView geckoView)
{
return urlList.size();
geckoView.releaseSession();
}
void setRootEngine(String url)
{
if(urlList.size()>1)
{
urlList.set(0,url);
}
}
boolean isGeckoViewRunning()
@ -265,11 +243,16 @@ class geckoClients
void onReloadHiddenView()
{
if(urlList.size()>0)
if(app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-1).type().equals(enums.navigationType.onion))
{
isRunning = false;
loadingCompeleted = false;
isUrlSavable = false;
wasBackPressed = true;
session1.stop();
session1.loadUri(urlList.get(urlList.size()-1));
session1.loadUri(app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-1).getURL());
}
}
}

View File

@ -19,11 +19,11 @@ import com.example.myapplication.R;
import java.io.IOException;
import java.net.URL;
public class eventHandler
public class home_ehandler
{
application_controller appContoller;
public eventHandler()
public home_ehandler()
{
appContoller = app_model.getInstance().getAppInstance();
}
@ -101,7 +101,7 @@ public class eventHandler
public void onHomeButtonPressed()
{
appContoller.stopHiddenView(true);
appContoller.stopHiddenView(true,false);
fabricManager.getInstance().sendEvent("HOME BUTTON PRESSSED : ");
viewController.getInstance().checkSSLTextColor();
appContoller.initSearchEngine();

View File

@ -0,0 +1,26 @@
package com.darkweb.genesissearchengine.appManager.home_activity;
import com.darkweb.genesissearchengine.constants.enums;
public class navigation_model
{
private String url;
private enums.navigationType type;
/*Initializations*/
public navigation_model(String url, enums.navigationType type) {
this.url = url;
this.type = type;
}
/*Variable Getters*/
public String getURL() {
return url;
}
public enums.navigationType type() {
return type;
}
}

View File

@ -42,7 +42,6 @@ public class viewController
private boolean pageLoadedSuccessfully = true;
private boolean isSplashLoading = false;
private Handler updateUIHandler = null;
private AutoCompleteAdapter suggestionAdapter;
/*ProgressBar Delayed Updater*/
Handler progressBarHandler = null;
@ -59,7 +58,7 @@ public class viewController
{
}
public void initialization(WebView webView1, TextView loadingText, ProgressBar progressBar, AutoCompleteTextView searchbar, ConstraintLayout splashScreen, ConstraintLayout requestFailure, FloatingActionButton floatingButton, ImageView loading, ImageView splashlogo)
void initialization(WebView webView1, TextView loadingText, ProgressBar progressBar, AutoCompleteTextView searchbar, ConstraintLayout splashScreen, ConstraintLayout requestFailure, FloatingActionButton floatingButton, ImageView loading, ImageView splashlogo)
{
this.webView = webView1;
this.progressBar = progressBar;
@ -82,7 +81,7 @@ public class viewController
private void initializeSuggestionView()
{
suggestionAdapter = new AutoCompleteAdapter(app_model.getInstance().getAppInstance(), R.layout.hint_view, R.id.hintCompletionHeader,app_model.getInstance().getSuggestions());
AutoCompleteAdapter 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);
@ -102,22 +101,22 @@ public class viewController
}
public void reInitializeSuggestion()
void reInitializeSuggestion()
{
initializeSuggestionView();
}
public boolean isHiddenView()
private boolean isHiddenView()
{
return app_model.getInstance().getAppInstance().isGeckoViewRunning();
}
public void initViews()
private void initViews()
{
floatingButton.setVisibility(View.INVISIBLE);
}
public void initLock()
private void initLock()
{
Drawable img = app_model.getInstance().getAppInstance().getResources().getDrawable( R.drawable.icon_lock);
searchbar.measure(0, 0);
@ -125,7 +124,7 @@ public class viewController
searchbar.setCompoundDrawables( img, null, null, null );
}
public void onRequestTriggered(boolean isHiddenWeb,String url)
void onRequestTriggered(boolean isHiddenWeb, String url)
{
onProgressBarUpdate(4);
helperMethod.hideKeyboard();
@ -141,7 +140,7 @@ public class viewController
}
/*Helper Methods*/
public void onInternetError()
void onInternetError()
{
disableSplashScreen();
requestFailure.setVisibility(View.VISIBLE);
@ -151,9 +150,10 @@ public class viewController
onClearSearchBarCursor();
onProgressBarUpdate(0);
disableFloatingView();
app_model.getInstance().getAppInstance().releaseSession();
}
public void disableSplashScreen()
private void disableSplashScreen()
{
if(!isSplashLoading)
{
@ -214,14 +214,18 @@ public class viewController
};
}
public void hideSplashScreen()
void hideSplashScreen()
{
if(splashScreen.getVisibility()!=View.GONE)
{
status.isApplicationLoaded = true;
splashScreen.animate().alpha(0.0f).setDuration(200).setListener(null).withEndAction((() -> splashScreen.setVisibility(View.GONE)));
onWelcomeMessageCheck();
}
public boolean onDisableInternetError()
status.isApplicationLoaded = true;
splashScreen.animate().alpha(0.0f).setDuration(200).setListener(null).withEndAction((() -> splashScreen.setVisibility(View.GONE)));
}
boolean onDisableInternetError()
{
if(requestFailure.getAlpha()==1)
{
@ -235,7 +239,7 @@ public class viewController
}
@SuppressLint("RestrictedApi")
public void onPageFinished(boolean status)
void onPageFinished(boolean status)
{
helperMethod.hideKeyboard();
progressBar.setProgress(100);
@ -251,7 +255,7 @@ public class viewController
disableSplashScreen();
floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE)));
app_model.getInstance().getAppInstance().stopHiddenView(false);
app_model.getInstance().getAppInstance().stopHiddenView(false,false);
}
else
{
@ -260,7 +264,7 @@ public class viewController
}
}
public void checkSSLTextColor()
void checkSSLTextColor()
{
if (searchbar == null)
{
@ -287,24 +291,24 @@ public class viewController
}
}
public void onClearSearchBarCursor()
void onClearSearchBarCursor()
{
searchbar.clearFocus();
}
public void disableFloatingView()
void disableFloatingView()
{
floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE)));
}
public void onUpdateSearchBar(String url)
void onUpdateSearchBar(String url)
{
searchbar.setText(url.replace(constants.backendUrlHost,constants.frontEndUrlHost_v1));
checkSSLTextColor();
}
public void initSplashScreen()
private void initSplashScreen()
{
boolean hasSoftKey = helperMethod.hasSoftKeys(app_model.getInstance().getAppInstance().getWindowManager());
int height = helperMethod.screenHeight(hasSoftKey);
@ -314,7 +318,7 @@ public class viewController
loading.setLayoutParams(helperMethod.getCenterScreenPoint(loading.getLayoutParams()));
}
public void onProgressBarUpdate(int progress)
void onProgressBarUpdate(int progress)
{
if(progress==0)
{
@ -335,38 +339,53 @@ public class viewController
}
}
public void onBackPressed()
void onBackPressed()
{
if(webView.getVisibility() == View.VISIBLE)
if(app_model.getInstance().getNavigation().size()>0)
{
if(!webView.canGoBack())
{
if(app_model.getInstance().getAppInstance().getHiddenQueueLength()>0)
{
onUpdateView(false);
}
else
if(app_model.getInstance().getNavigation().size()==1)
{
onProgressBarUpdate(0);
helperMethod.onMinimizeApp();
return;
}
else if(app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-2).type().equals(enums.navigationType.base))
{
app_model.getInstance().getAppInstance().stopHiddenView(true,true);
if(webView.getVisibility()==View.VISIBLE)
{
onProgressBarUpdate(4);
webView.goBack();
app_model.getInstance().getNavigation().remove(app_model.getInstance().getNavigation().size()-1);
}
else
{
webView.goBack();
onProgressBarUpdate(0);
}
webView.bringToFront();
webView.setAlpha(1);
webView.setVisibility(View.VISIBLE);
requestFailure.animate().alpha(0f).setDuration(200).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE)));
onUpdateSearchBar(webView.getUrl());
}
else
{
app_model.getInstance().getAppInstance().stopHiddenView(true,true);
app_model.getInstance().getNavigation().remove(app_model.getInstance().getNavigation().size()-1);
if(webView.getVisibility()==View.VISIBLE)
{
app_model.getInstance().getAppInstance().onReInitGeckoView();
app_model.getInstance().getAppInstance().onReloadHiddenView();
}
else
{
app_model.getInstance().getAppInstance().onHiddenGoBack();
}
}
}
}
public void onUpdateView(boolean status)
void onUpdateView(boolean status)
{
if(status)
{
@ -383,7 +402,7 @@ public class viewController
}
}
public void onWelcomeMessageCheck()
private void onWelcomeMessageCheck()
{
if(!preference_manager.getInstance().getBool("FirstTimeLoaded",false))
{
@ -397,7 +416,7 @@ public class viewController
startPostTask(messages.SHOW_ADS);
}
public void openMenu(View view)
void openMenu(View view)
{
LinearLayout parentView = (LinearLayout)view.getParent();
@ -414,9 +433,9 @@ public class viewController
view.bringToFront();
}
public void onReload()
void onReload()
{
if(!isHiddenView())
if(app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-1).type()==enums.navigationType.base)
{
onRequestTriggered(false,webView.getUrl());
webView.reload();
@ -427,7 +446,7 @@ public class viewController
}
}
public String getSearchBarUrl()
String getSearchBarUrl()
{
return searchbar.getText().toString();
}

View File

@ -28,7 +28,7 @@ public class webviewClient
}
if(!url.contains("boogle"))
{
app_model.getInstance().getAppInstance().stopHiddenView(false);
app_model.getInstance().getAppInstance().stopHiddenView(false,false);
fabricManager.getInstance().sendEvent("BASE SIMPLE SEARCHED : " + url);
isGeckoView = true;
if(orbot_manager.getInstance().initOrbot(url))
@ -39,6 +39,7 @@ public class webviewClient
}
else
{
app_model.getInstance().addNavigation(url,enums.navigationType.base);
app_model.getInstance().addHistory(url);
fabricManager.getInstance().sendEvent("BASE ONION SEARCHED : " + url);
app_model.getInstance().getAppInstance().onRequestTriggered(false,url);

View File

@ -36,8 +36,11 @@ class setting_view_controller
private void initViews()
{
search.setDropDownVerticalOffset(15);
search.setDropDownHorizontalOffset(-15);
javascript.setDropDownVerticalOffset(15);
javascript.setDropDownHorizontalOffset(-15);
history.setDropDownVerticalOffset(15);
history.setDropDownHorizontalOffset(-15);
}
private void initJavascript()

View File

@ -30,12 +30,12 @@ public class settings_ehandler
private void onJavaScriptListener(int position)
{
if(position==1 && java_status)
if(position==1 && setting_model.getInstance().java_status)
{
setting_model.getInstance().java_status = false;
preference_manager.getInstance().setBool(keys.java_script, false);
}
else if(!java_status)
else if(!setting_model.getInstance().java_status)
{
setting_model.getInstance().java_status = true;
preference_manager.getInstance().setBool(keys.java_script, true);
@ -44,7 +44,7 @@ public class settings_ehandler
private void onSearchListner(AdapterView<?> parentView,int position)
{
if(!search_status.equals(parentView.getItemAtPosition(position).toString()))
if(!setting_model.getInstance().search_status.equals(parentView.getItemAtPosition(position).toString()))
{
setting_model.getInstance().search_status = parentView.getItemAtPosition(position).toString();
preference_manager.getInstance().setString(keys.search_engine, setting_model.getInstance().search_status);
@ -53,12 +53,12 @@ public class settings_ehandler
private void onHistoryListener(int position)
{
if(position==1 && history_status)
if(position==1 && setting_model.getInstance().history_status)
{
setting_model.getInstance().history_status = false;
preference_manager.getInstance().setBool(keys.history_clear, false);
}
else if(!java_status)
else if(!setting_model.getInstance().history_status)
{
setting_model.getInstance().history_status = true;
preference_manager.getInstance().setBool(keys.history_clear, true);

View File

@ -12,16 +12,15 @@ public class constants
/*URL CONSTANTS*/
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";
public static String backendUrlSlashed = "https://boogle.store/";
public static String frontUrlSlashed = "https://genesis.onion/";
public static String updateUrl = "https://boogle.store/manual?abi=";
public static String frontEndUrlHost = "genesis.store";
public static String frontEndUrlHost_v1 = "genesis.onion";
public static String backendGoogle = "https://www.google.com/";
public static String backendBing = "https://www.bing.com/";
public static String allowedHost = ".onion";
public static String reportUrl = "https://boogle.store/reportus?r_key=";
public static String updateUrl = "https://boogle.store/manual?abi=";
public static String playstoreUrl = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine";
/*BUILD CONSTANTS*/

View File

@ -5,6 +5,7 @@ public class enums
/*SETTINGS*/
public enum searchEngine{Darkweb,Bing,Google}
public enum adID{hidden, internal}
public enum adID{hidden_onion, hidden_onion_start,hidden_base}
public enum navigationType{onion, base}
}

View File

@ -3,12 +3,15 @@ package com.darkweb.genesissearchengine.constants;
public class keys
{
/*Welcome Message Prefs*/
public static String first_time_loaded = "FirstTimeLoaded";
/*Home page*/
public static String homepage_html_key = "internalhtml";
/*Proxy Manager*/
public static String proxy_type = "network.proxy.type";
public static String proxy_socks = "network.proxy.socks";
public static String proxy_socks_port = "network.proxy.socks_port";
@ -24,6 +27,7 @@ public class keys
public static String list_type = "list_type";
/*Settings*/
public static String search_engine = "search_engine";
public static String java_script = "java_script";
public static String history_clear = "history_clear";

View File

@ -6,12 +6,14 @@ import com.darkweb.genesissearchengine.dataManager.preference_manager;
public class status
{
/*App Level*/
public static boolean isApplicationLoaded = false;
public static boolean isPlayStoreInstalled = true;
public static boolean isTorInitialized = false;
public static String version_code = "6.0";
public static String version_code = "7.0";
/*Settings Level*/
public static String search_status = strings.emptyStr;
public static boolean java_status = false;
public static boolean history_status = true;

View File

@ -7,6 +7,7 @@ import com.darkweb.genesissearchengine.appManager.home_activity.app_model;
public class preference_manager
{
/*Private Declarations*/
private static final preference_manager ourInstance = new preference_manager();
private SharedPreferences prefs;
private SharedPreferences.Editor edit;
@ -17,6 +18,7 @@ public class preference_manager
}
/*Initializations*/
private preference_manager()
{
}
@ -28,6 +30,7 @@ public class preference_manager
}
/*Saving Preferences*/
public void setString(String valueKey, String value)
{
edit.putString(valueKey, value);
@ -41,6 +44,7 @@ public class preference_manager
}
/*Recieving Preferences*/
public String getString(String valueKey, String valueDefault)
{
return prefs.getString(valueKey, valueDefault);

View File

@ -33,16 +33,14 @@ import java.util.Locale;
public class helperMethod
{
/*Helper Methods*/
public static boolean isNetworkAvailable()
{
public static boolean isNetworkAvailable(){
ConnectivityManager cm = (ConnectivityManager) app_model.getInstance().getAppContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
return networkInfo != null && networkInfo.isConnected();
}
public static String completeURL(String url)
{
public static String completeURL(String url){
if(!url.startsWith("www.")&& !url.startsWith("http://")&& !url.startsWith("https://")){
url = "www."+url;
}
@ -52,8 +50,7 @@ public class helperMethod
return url;
}
public static void hideKeyboard()
{
public static void hideKeyboard() {
View view = app_model.getInstance().getAppInstance().findViewById(android.R.id.content);
if (view != null)
{
@ -62,8 +59,52 @@ public class helperMethod
}
}
public static int screenHeight(boolean hasSoftKeys)
public static void rateApp(){
preference_manager.getInstance().setBool(keys.isAppRated,true);
app_model.getInstance().getAppInstance().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine")));
}
public static void shareApp() {
ShareCompat.IntentBuilder.from(app_model.getInstance().getAppInstance())
.setType("text/plain")
.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();
}
public static String getHost(String link){
URL url = null;
try
{
url = new URL(link);
String host = url.getHost();
return host;
}
catch (MalformedURLException e)
{
e.printStackTrace();
return "";
}
}
public static void openActivity( Class<?> cls,int type){
Intent myIntent = new Intent(app_model.getInstance().getAppInstance(), cls);
myIntent.putExtra(keys.list_type, type);
app_model.getInstance().getAppInstance().startActivity(myIntent);
}
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);
}
/*Splash Screen Initializations*/
public static int screenHeight(boolean hasSoftKeys) {
if(!hasSoftKeys)
{
return Resources.getSystem().getDisplayMetrics().heightPixels -(helperMethod.getNavigationBarHeight());
@ -88,16 +129,14 @@ public class helperMethod
return 0;
}
public static RotateAnimation getRotationAnimation()
{
public static RotateAnimation getRotationAnimation(){
RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);
rotate.setDuration(2000);
rotate.setRepeatCount(Animation.INFINITE);
return rotate;
}
public static ViewGroup.MarginLayoutParams getCenterScreenPoint(ViewGroup.LayoutParams itemLayoutParams)
{
public static ViewGroup.MarginLayoutParams getCenterScreenPoint(ViewGroup.LayoutParams itemLayoutParams) {
double heightloader = Resources.getSystem().getDisplayMetrics().heightPixels*0.78;
ViewGroup.MarginLayoutParams params_loading = (ViewGroup.MarginLayoutParams) itemLayoutParams;
params_loading.topMargin = (int)(heightloader);
@ -105,8 +144,7 @@ public class helperMethod
return params_loading;
}
public static boolean hasSoftKeys(WindowManager windowManager)
{
public static boolean hasSoftKeys(WindowManager windowManager){
Display d = windowManager.getDefaultDisplay();
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
@ -124,89 +162,9 @@ public class helperMethod
return (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0;
}
public static boolean isBuildValid ()
{
public static boolean isBuildValid (){
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");
}
public static void rateApp()
{
preference_manager.getInstance().setBool(keys.isAppRated,true);
app_model.getInstance().getAppInstance().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine")));
}
public static void shareApp()
{
ShareCompat.IntentBuilder.from(app_model.getInstance().getAppInstance())
.setType("text/plain")
.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();
}
public static String getHost(String link)
{
URL url = null;
try
{
url = new URL(link);
String host = url.getHost();
return host;
}
catch (MalformedURLException e)
{
e.printStackTrace();
return "";
}
}
public static void openActivity( Class<?> cls,int type)
{
Intent myIntent = new Intent(app_model.getInstance().getAppInstance(), cls);
myIntent.putExtra(keys.list_type, type);
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);
}
}

View File

@ -11,8 +11,9 @@ public class admanager
/*Private Variables*/
private static final admanager ourInstance = new admanager();
private InterstitialAd mInterstitialHidden;
private InterstitialAd mInterstitialHidden_onion;
private InterstitialAd mInterstitialInternal;
private InterstitialAd mInterstitialHidden_base;
private int adCount = 0;
boolean isAdShown = false;
@ -28,26 +29,33 @@ public class admanager
public void initialize()
{
MobileAds.initialize(app_model.getInstance().getAppInstance(), "ca-app-pub-5074525529134731~2926711128");
initAd(mInterstitialHidden,"ca-app-pub-5074525529134731/4332539288");
initAd(mInterstitialInternal,"ca-app-pub-5074525529134731/8478420705");
mInterstitialHidden_base = initAd("ca-app-pub-5074525529134731/1637043432");
mInterstitialHidden_onion = initAd("ca-app-pub-5074525529134731/4332539288");
mInterstitialInternal = initAd("ca-app-pub-5074525529134731/8478420705");
}
public void initAd(InterstitialAd adInstance,String id)
public InterstitialAd initAd(String id)
{
adInstance = new InterstitialAd(app_model.getInstance().getAppInstance());
InterstitialAd adInstance = new InterstitialAd(app_model.getInstance().getAppInstance());
adInstance.setAdUnitId(id);
adInstance.loadAd(new AdRequest.Builder().build());
return adInstance;
}
/*Helper Methods*/
public void showAd(enums.adID id)
{
if(id.equals(enums.adID.hidden))
if(id.equals(enums.adID.hidden_base))
{
mInterstitialHidden.show();
mInterstitialHidden.loadAd(new AdRequest.Builder().build());
mInterstitialHidden_base.show();
mInterstitialHidden_base.loadAd(new AdRequest.Builder().build());
}
else if(id.equals(enums.adID.hidden_onion))
{
mInterstitialHidden_onion.show();
mInterstitialHidden_onion.loadAd(new AdRequest.Builder().build());
}
else
{

View File

@ -11,6 +11,7 @@ import java.util.UUID;
public class analyticmanager
{
/*Private Variables*/
private static final analyticmanager ourInstance = new analyticmanager();
private String uniqueID = null;
@ -19,6 +20,7 @@ public class analyticmanager
}
/*Initializations*/
private analyticmanager()
{
}

View File

@ -1,9 +1,17 @@
package com.darkweb.genesissearchengine.pluginManager;
import com.crashlytics.android.Crashlytics;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model;
import io.fabric.sdk.android.Fabric;
public class fabricManager
{
/*Private Variables*/
private static final fabricManager ourInstance = new fabricManager();
/*Initializations*/
public static fabricManager getInstance()
{
return ourInstance;
@ -15,13 +23,15 @@ public class fabricManager
public void init()
{
//Fabric.with(app_model.getInstance().getAppContext(), new Crashlytics());
//analyticmanager.getInstance().initialize(app_model.getInstance().getAppContext());
//analyticmanager.getInstance().logUser();
Fabric.with(app_model.getInstance().getAppContext(), new Crashlytics());
analyticmanager.getInstance().initialize(app_model.getInstance().getAppContext());
analyticmanager.getInstance().logUser();
}
/*Helper Methods*/
public void sendEvent(String value)
{
//analyticmanager.getInstance().sendEvent(value);
analyticmanager.getInstance().sendEvent(value);
}
}

View File

@ -4,8 +4,12 @@ package com.darkweb.genesissearchengine.pluginManager;
public class firebase
{
/*Private Variables*/
private static final firebase ourInstance = new firebase();
/*Initializations*/
public static firebase getInstance()
{
return ourInstance;
@ -18,6 +22,8 @@ public class firebase
//mFirebaseAnalytics = FirebaseAnalytics.getInstance(app_model.getInstance().getAppContext());
}
/*Helper Methods*/
public void logEvent(String value,String id)
{
/*

View File

@ -5,6 +5,7 @@ import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperMethod;
import com.msopentech.thali.android.toronionproxy.AndroidOnionProxyManager;
import com.msopentech.thali.toronionproxy.OnionProxyManager;
import org.mozilla.gecko.PrefsHelper;
@ -12,12 +13,15 @@ import org.mozilla.gecko.PrefsHelper;
public class orbot_manager {
/*Private Variables*/
private boolean isLoading = false;
private int threadCounter = 100;
/*Local Initialization*/
private static final orbot_manager ourInstance = new orbot_manager();
private OnionProxyManager onionProxyManager = null;
/*Local Initialization*/
private static final orbot_manager ourInstance = new orbot_manager();
public static orbot_manager getInstance()
{
return ourInstance;
@ -28,6 +32,7 @@ public class orbot_manager {
}
/*Orbot Initialization*/
public boolean initOrbot(String url)
{
if(!status.isTorInitialized)
@ -59,8 +64,14 @@ public class orbot_manager {
status.isTorInitialized = true;
threadCounter = 5000;
}
else
{
status.isTorInitialized = false;
}
}
if(!isLoading && !status.isTorInitialized)
{
if(helperMethod.isNetworkAvailable())
{
if(onionProxyManager == null)
{
@ -70,6 +81,7 @@ public class orbot_manager {
status.isTorInitialized = false;
initializeTorClient();
}
}
else
{
sleep(threadCounter);
@ -85,21 +97,6 @@ public class orbot_manager {
}.start();
}
public String getLogs()
{
if(onionProxyManager!=null)
{
String Logs = onionProxyManager.getLastLog();
if(Logs.equals(""))
{
return "Loading Please Wait";
}
Logs=Logs.replace("FAILED","Securing");
return Logs;
}
return "Loading Please Wait";
}
public void initializeTorClient()
{
if(!isLoading)
@ -142,13 +139,14 @@ public class orbot_manager {
}
/*Proxy Initialization*/
public void initializeProxy()
{
PrefsHelper.setPref(keys.proxy_type, constants.proxy_type); //manual proxy settings
PrefsHelper.setPref(keys.proxy_socks,constants.proxy_socks); //manual proxy settings
PrefsHelper.setPref(keys.proxy_socks_port, app_model.getInstance().getPort()); //manual proxy settings
PrefsHelper.setPref(keys.proxy_socks_version,constants.proxy_socks_version); //manual proxy settings
PrefsHelper.setPref(keys.proxy_socks_remote_dns,constants.proxy_socks_remote_dns); //manual proxy settings
PrefsHelper.setPref(keys.proxy_type, constants.proxy_type);
PrefsHelper.setPref(keys.proxy_socks,constants.proxy_socks);
PrefsHelper.setPref(keys.proxy_socks_port, app_model.getInstance().getPort());
PrefsHelper.setPref(keys.proxy_socks_version,constants.proxy_socks_version);
PrefsHelper.setPref(keys.proxy_socks_remote_dns,constants.proxy_socks_remote_dns);
PrefsHelper.setPref(keys.proxy_cache,constants.proxy_cache);
PrefsHelper.setPref(keys.proxy_memory,constants.proxy_memory);
PrefsHelper.setPref(keys.proxy_useragent_override, constants.proxy_useragent_override);
@ -156,6 +154,21 @@ public class orbot_manager {
PrefsHelper.setPref(keys.proxy_donottrackheader_value,constants.proxy_donottrackheader_value);
}
/*Helper Methods*/
public String getLogs()
{
if(onionProxyManager!=null)
{
String Logs = onionProxyManager.getLastLog();
if(Logs.equals(""))
{
return "Loading Please Wait";
}
Logs=Logs.replace("FAILED","Securing");
return Logs;
}
return "Loading Please Wait";
}
}

View File

@ -93,7 +93,7 @@
android:layout_marginTop="1dp"
style="@style/Widget.AppCompat.DropDownItem.Spinner"
android:dropDownWidth="200dp"
android:dropDownWidth="160dp"
android:popupBackground="@android:color/white"
android:overlapAnchor="false"
android:popupTheme="@style/AppTheme.PopupOverlay"
@ -138,7 +138,7 @@
android:popupTheme="@style/AppTheme.PopupOverlay"
style="@style/Widget.AppCompat.DropDownItem.Spinner"
android:dropDownWidth="200dp"
android:dropDownWidth="160dp"
android:popupBackground="@android:color/white"
android:overlapAnchor="false"
android:popupElevation="3dp"
@ -181,7 +181,7 @@
android:popupTheme="@style/AppTheme.PopupOverlay"
style="@style/Widget.AppCompat.DropDownItem.Spinner"
android:dropDownWidth="200dp"
android:dropDownWidth="160dp"
android:popupBackground="@android:color/white"
android:overlapAnchor="false"
android:popupElevation="3dp"

View File

@ -1,18 +1,18 @@
/*arm versions*/
project.ext.arm_vname = '180'
project.ext.arm_vcode = 180
project.ext.arm_vname = '188'
project.ext.arm_vcode = 188
/*aarch versions*/
project.ext.aarch_vname = '181'
project.ext.aarch_vcode = 181
project.ext.aarch_vname = '189'
project.ext.aarch_vcode = 189
/*x86 versions*/
project.ext.x86_vname = '182'
project.ext.x86_vcode = 182
project.ext.x86_vname = '190'
project.ext.x86_vcode = 190
/*x64 versions*/
project.ext.x64_vname = '183'
project.ext.x64_vcode = 183
project.ext.x64_vname = '191'
project.ext.x64_vcode = 191
/*dimension*/
project.ext.dimen = 'abi'