code refactoring

master
msmannan00 2019-06-22 20:03:44 +05:00
parent 16c20006e7
commit 76a728fe59
29 changed files with 1116 additions and 1121 deletions

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Convert2MethodRef" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -7,7 +7,7 @@ public class app_model
/*Data Objects*/ /*Data Objects*/
private static String currentURL = "http://boogle.store/"; private static String currentURL = "http://boogle.store/";
private static int port = 9150; private static int port = 9150;
private boolean isLoadingURL = false; private boolean isURLLoading = true;
private Context appContext; private Context appContext;
private application_controller appInstance; private application_controller appInstance;
@ -21,16 +21,6 @@ public class app_model
/*Getters Setters*/ /*Getters Setters*/
public boolean getIsLoadingURL()
{
return isLoadingURL;
}
public void setIsLoadingURL(boolean status)
{
isLoadingURL = status;
}
public int getPort() public int getPort()
{ {
return port; return port;
@ -41,16 +31,6 @@ public class app_model
this.port = port; this.port = port;
} }
public String getCurrentURL()
{
return currentURL;
}
public void setCurrentURL(String currentURL)
{
this.currentURL = currentURL;
}
public Context getAppContext() public Context getAppContext()
{ {
return appContext; return appContext;

View File

@ -1,24 +1,49 @@
package com.darkweb.genesissearchengine.appManager; package com.darkweb.genesissearchengine.appManager;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.support.constraint.ConstraintLayout; import android.support.constraint.ConstraintLayout;
import android.support.design.widget.FloatingActionButton;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.WindowManager;
import android.webkit.WebView; import android.webkit.WebView;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.preference_manager;
import com.darkweb.genesissearchengine.helperMethod;
import com.darkweb.genesissearchengine.httpManager.serverRequestManager;
import com.darkweb.genesissearchengine.pluginManager.message_manager;
import com.example.myapplication.R;
import static java.lang.Thread.sleep;
public class applicationViewController public class applicationViewController
{ {
/*ViewControllers*/ /*ViewControllers*/
private WebView webView1; private WebView webView;
private WebView webView2;
private ProgressBar progressBar; private ProgressBar progressBar;
private EditText searchbar; private EditText searchbar;
private ConstraintLayout splashScreen; private ConstraintLayout splashScreen;
private ConstraintLayout requestFailure; private ConstraintLayout requestFailure;
private FloatingActionButton floatingButton;
private ImageView loading;
private ImageView splashlogo;
private boolean pageLoadedSuccessfully = true;
/*ProgressBar Delayed Updater*/
Handler progressBarHandler = null;
/*Initializations*/ /*Initializations*/
private static final applicationViewController ourInstance = new applicationViewController(); private static final applicationViewController ourInstance = new applicationViewController();
public static applicationViewController getInstance() public static applicationViewController getInstance()
{ {
return ourInstance; return ourInstance;
@ -28,55 +53,227 @@ public class applicationViewController
{ {
} }
public void initialization(WebView webView1,WebView webView2,ProgressBar progressBar,EditText searchbar,ConstraintLayout splashScreen,ConstraintLayout requestFailure) public void initialization(WebView webView1, ProgressBar progressBar, EditText searchbar, ConstraintLayout splashScreen, ConstraintLayout requestFailure, FloatingActionButton floatingButton, ImageView loading, ImageView splashlogo)
{ {
this.webView1 = webView1; this.webView = webView1;
this.webView2 = webView2;
this.progressBar = progressBar; this.progressBar = progressBar;
this.searchbar = searchbar; this.searchbar = searchbar;
this.splashScreen = splashScreen; this.splashScreen = splashScreen;
this.requestFailure = requestFailure; this.requestFailure = requestFailure;
this.floatingButton = floatingButton;
this.loading = loading;
this.splashlogo = splashlogo;
app_model.getInstance().getAppInstance().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
checkSSLTextColor();
initSplashScreen();
initLock();
initViews();
} }
public void onRequestURL() public boolean isHiddenView()
{ {
webView1.stopLoading(); return app_model.getInstance().getAppInstance().isGeckoViewRunning();
webView2.stopLoading(); }
progressBar.setProgress(5); public void initViews()
progressBar.setVisibility(View.VISIBLE); {
progressBar.animate().setDuration(150).alpha(1f); floatingButton.setVisibility(View.INVISIBLE);
}
public void initLock()
{
Drawable img = app_model.getInstance().getAppInstance().getResources().getDrawable( R.drawable.icon_lock);
searchbar.measure(0, 0);
img.setBounds( 0, (int)(searchbar.getMeasuredHeight()*0.00), (int)(searchbar.getMeasuredHeight()*1.10), (int)(searchbar.getMeasuredHeight()*0.69) );
searchbar.setCompoundDrawables( img, null, null, null );
}
public void onRequestTriggered(boolean isHiddenWeb,String url)
{
onProgressBarUpdate(4);
helperMethod.hideKeyboard();
pageLoadedSuccessfully = true;
onUpdateSearchBar(url);
checkSSLTextColor();
onClearSearchBarCursor();
searchbar.setFocusableInTouchMode(false);
searchbar.setFocusable(false);
searchbar.setFocusableInTouchMode(true);
searchbar.setFocusable(true);
} }
/*Helper Methods*/ /*Helper Methods*/
public void onInternetError() public void onInternetError()
{ {
splashScreen.animate().setStartDelay(2000).alpha(0); splashScreen.animate().setStartDelay(2000).alpha(0);
progressBar.animate().alpha(0);
requestFailure.setVisibility(View.VISIBLE); requestFailure.setVisibility(View.VISIBLE);
requestFailure.animate().alpha(1f).setDuration(300); webView.setAlpha(0);
requestFailure.animate().alpha(1f).setDuration(150);
pageLoadedSuccessfully = false;
Log.i("jhgjhg",0+"");
onClearSearchBarCursor();
onProgressBarUpdate(0);
} }
public void loadUrlOnWebview(String html) public void onDisableInternetError()
{ {
WebView webView = getCurrentView(); requestFailure.animate().alpha(0f).setDuration(150).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE)));;
webView.bringToFront();
webView.loadDataWithBaseURL(app_model.getInstance().getCurrentURL(),html, "text/html", "utf-8", null);
} }
public WebView getCurrentView() public void onPageFinished(boolean status)
{ {
WebView tempView; helperMethod.hideKeyboard();
if(webView1.getAlpha()==0) progressBar.setProgress(100);
if(!status)
{ {
tempView = webView1; if(pageLoadedSuccessfully)
{
requestFailure.animate().alpha(0f).setStartDelay(200).setDuration(200).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE)));
onUpdateView(true);
}
//onUpdateSearchBar(webView.getUrl());
splashScreen.animate().alpha(0.0f).setStartDelay(150).setDuration(200).setListener(null).withEndAction((() -> splashScreen.setVisibility(View.GONE)));
floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE)));;
onWelcomeMessageCheck();
app_model.getInstance().getAppInstance().stopHiddenView();
} }
else else
{ {
tempView = webView2; onUpdateView(false);
floatingButton.animate().alpha(1).withEndAction((() -> floatingButton.setVisibility(View.VISIBLE)));;
} }
return tempView;
} }
public void checkSSLTextColor()
{
if (searchbar == null)
{
return;
}
if (searchbar.getText().toString().contains("https://"))
{
SpannableString ss = new SpannableString(searchbar.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);
searchbar.setText(ss);
} else if (searchbar.getText().toString().contains("http://"))
{
SpannableString ss = new SpannableString(searchbar.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);
searchbar.setText(ss);
} else
{
SpannableString ss = new SpannableString(searchbar.getText());
ss.setSpan(new ForegroundColorSpan(Color.BLACK), 0, searchbar.getText().length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
searchbar.setText(ss);
}
}
public void onClearSearchBarCursor()
{
searchbar.clearFocus();
}
public void disableFloatingView()
{
floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE)));;
}
public void onUpdateSearchBar(String url)
{
searchbar.setText(url.replace(constants.backendUrlHost,constants.frontEndUrlHost_v1));
checkSSLTextColor();
}
public void initSplashScreen()
{
boolean hasSoftKey = helperMethod.hasSoftKeys(app_model.getInstance().getAppInstance().getWindowManager());
int height = helperMethod.screenHeight(hasSoftKey);
splashlogo.getLayoutParams().height = height;
loading.setAnimation(helperMethod.getRotationAnimation());
loading.setLayoutParams(helperMethod.getCenterScreenPoint(loading.getLayoutParams()));
}
public void onProgressBarUpdate(int progress)
{
progressBar.setVisibility(View.VISIBLE);
if(progress==0)
{
progressBar.animate().alpha(0).withEndAction((() -> progressBar.setProgress(progress)));
}
else
{
progressBar.setProgress(progress);
progressBar.setAlpha(1);
}
}
public void onBackPressed()
{
if(!isHiddenView())
{
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
{
app_model.getInstance().getAppInstance().onHiddenGoBack();
}
}
public void onUpdateView(boolean status)
{
if(status)
{
floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE)));;
webView.setAlpha(1);
webView.setVisibility(View.VISIBLE);
webView.bringToFront();
onProgressBarUpdate(0);
onUpdateSearchBar(webView.getUrl());
}
else
{
webView.animate().alpha(0).setDuration(150).withEndAction((() -> webView.setVisibility(View.GONE)));
}
}
public void onWelcomeMessageCheck()
{
if(!status.isApplicationLoaded)
{
if(!preference_manager.getInstance().getBool("FirstTimeLoaded",false))
{
message_manager.getInstance().welcomeMessage();
}
serverRequestManager.getInstance().versionChecker();
}
}
public void onReload()
{
if(!isHiddenView())
{
onRequestTriggered(false,webView.getUrl());
webView.reload();
}
else
{
app_model.getInstance().getAppInstance().onReloadHiddenView();
}
}
} }

View File

@ -0,0 +1,100 @@
package com.darkweb.genesissearchengine.appManager;
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.constants.constants;
import com.darkweb.genesissearchengine.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.fabricManager;
import com.darkweb.genesissearchengine.pluginManager.message_manager;
import java.io.IOException;
import java.net.URL;
public class eventHandler
{
application_controller appContoller;
public eventHandler()
{
appContoller = app_model.getInstance().getAppInstance();
}
public boolean onEditorClicked(TextView v, int actionId, KeyEvent event)
{
if (actionId != EditorInfo.IME_ACTION_NEXT)
{
return false;
}
helperMethod.hideKeyboard();
String url = helperMethod.completeURL(v.getText().toString());
try
{
URL host = new URL(url);
boolean isUrlValid = Patterns.WEB_URL.matcher(url).matches();
if(isUrlValid && host.getHost().replace("www.","").contains("."))
{
if(host.getHost().contains(constants.backendUrlHost) || host.getHost().contains(constants.frontEndUrlHost) || host.getHost().contains(constants.frontEndUrlHost_v1))
{
fabricManager.getInstance().sendEvent("EDITOR BASE URL REQUEST : " + url);
appContoller.onloadURL(url.replace(constants.frontEndUrlHost_v1,constants.backendUrlHost),false);
return true;
}
else /*if(host.getHost().contains(constants.allowedHost))*/
{
fabricManager.getInstance().sendEvent("EDITOR ONION URL REQUEST : " + url);
app_model.getInstance().getAppInstance().onloadURL(url,true);
return true;
}/*
else
{
message_manager.getInstance().baseURLError();
return true;
}*/
}
}
catch (IOException e){}
String editedURL = "https://boogle.store/search?q="+v.getText().toString().replaceAll(" ","+")+"&p_num=1&s_type=all&savesearch=on";
appContoller.onloadURL(editedURL,false);
appContoller.onClearSearchBarCursorView();
fabricManager.getInstance().sendEvent("EDITOR SEARCHED : " + editedURL);
return true;
}
public void onReloadButtonPressed(View view)
{
fabricManager.getInstance().sendEvent("RELOAD BUTTON PRESSSED : ");
appContoller.onReload();
}
public void onHomeButtonPressed()
{
fabricManager.getInstance().sendEvent("HOME BUTTON PRESSSED : ");
applicationViewController.getInstance().checkSSLTextColor();
appContoller.onloadURL(constants.backendUrlSlashed,false);
helperMethod.hideKeyboard();
appContoller.onUpdateSearchBarView(constants.frontUrlSlashed);
appContoller.stopHiddenView();
}
public void onFloatingButtonPressed()
{
fabricManager.getInstance().sendEvent("FLOATING BUTTON PRESSSED : ");
message_manager.getInstance().reportURL();
}
public void onBackPressed()
{
fabricManager.getInstance().sendEvent("BACK BUTTON PRESSSED : ");
appContoller.onBackPressedView();
}
}

View File

@ -0,0 +1,199 @@
package com.darkweb.genesissearchengine.appManager;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import com.darkweb.genesissearchengine.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.fabricManager;
import com.darkweb.genesissearchengine.pluginManager.orbot_manager;
import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView;
public class geckoClients
{
private GeckoSession session1 = null;
private GeckoRuntime runtime1;
private final Handler internetErrorHandler = new Handler();
boolean canSessionGoBack = false;
boolean isRunning = false;
boolean isContentLoading = false;
String navigatedURL = "";
private boolean loadingCompeleted = false;
private String currentURL = "";
public void loadGeckoURL(String url,GeckoView geckoView)
{
boolean init_status = orbot_manager.getInstance().initOrbot(url);
if (init_status)
{
loadingCompeleted = false;
initialize(geckoView);
session1.loadUri(url);
app_model.getInstance().getAppInstance().onRequestTriggered(true,url);
app_model.getInstance().getAppInstance().onProgressBarUpdateView(4);
}
}
public void initialize(GeckoView geckoView)
{
session1 = new GeckoSession();
runtime1 = GeckoRuntime.getDefault(app_model.getInstance().getAppContext());
session1.open(runtime1);
geckoView.releaseSession();
geckoView.setSession(session1);
session1.setProgressDelegate(new progressDelegate());
session1.setNavigationDelegate(new navigationDelegate());
geckoView.setVisibility(View.VISIBLE);
geckoView.setAlpha(1);
}
class navigationDelegate implements GeckoSession.NavigationDelegate
{
@Override
public void onLocationChange(GeckoSession session, String url)
{
navigatedURL = url;
Log.i("SHITJ1",""+url);
}
@Override
public void onCanGoBack(GeckoSession session, boolean canGoBack)
{
canSessionGoBack = canGoBack;
}
}
class progressDelegate implements GeckoSession.ProgressDelegate
{
@Override
public void onPageStart(GeckoSession session, String url)
{
isRunning = true;
loadingCompeleted = false;
currentURL = url;
fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL REQEST : " + url + "--");
if(navigatedURL.equals(currentURL))
{
isContentLoading = false;
}
else
{
isContentLoading = true;
}
Log.i("SHITJ2",""+navigatedURL + "--" + currentURL + "--" + isContentLoading);
navigatedURL = url;
}
@Override
public void onPageStop(GeckoSession session, boolean success)
{
internetErrorHandler.removeCallbacksAndMessages(null);
internetErrorHandler.postDelayed(new Runnable() {
@Override
public void run()
{
if(loadingCompeleted)
{
if(!success && !isContentLoading)
{
app_model.getInstance().getAppInstance().onInternetErrorView();
fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL ERROR : " + success + "--" + isContentLoading);
}
else if(success)
{
app_model.getInstance().getAppInstance().onDisableInternetError();
app_model.getInstance().getAppInstance().onProgressBarUpdateView(0);
fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL SUCCESS : " + success + "--" + isContentLoading);
}
}
}
}, 500);
}
@Override
public void onProgressChange(GeckoSession session, int progress)
{
if(progress>=100)
{
app_model.getInstance().getAppInstance().onPageFinished(true);
loadingCompeleted = true;
isContentLoading = false;
}
if(progress>=5)
{
app_model.getInstance().getAppInstance().onProgressBarUpdateView(progress);
}
else
{
app_model.getInstance().getAppInstance().onProgressBarUpdateView(4);
}
}
@Override
public void onSecurityChange(GeckoSession session, SecurityInformation securityInfo)
{
}
}
public void onHiddenGoBack(GeckoView geckoView)
{
boolean init_status = orbot_manager.getInstance().initOrbot("");
if (init_status)
{
if(canSessionGoBack)
{
app_model.getInstance().getAppInstance().onDisableInternetError();
session1.goBack();
fabricManager.getInstance().sendEvent("ONION LOCAL RETURNED : ");
}
else if(isRunning)
{
fabricManager.getInstance().sendEvent("ONION RETURNED TO GENESIS : ");
geckoView.releaseSession();
stopHiddenView(geckoView);
app_model.getInstance().getAppInstance().onUpdateView(true);
}
}
}
public void stopHiddenView(GeckoView geckoView)
{
if(session1!=null)
{
isRunning = false;
loadingCompeleted = false;
session1.stop();
session1.close();
}
}
public boolean isGeckoViewRunning()
{
return isRunning;
}
public void onReloadHiddenView()
{
boolean init_status = orbot_manager.getInstance().initOrbot("");
if (init_status)
{
if(session1!=null)
{
loadingCompeleted = false;
session1.stop();
session1.reload();
}
}
}
}

View File

@ -0,0 +1,84 @@
package com.darkweb.genesissearchengine.appManager;
import android.util.Log;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.pluginManager.fabricManager;
import com.darkweb.genesissearchengine.pluginManager.orbot_manager;
public class webviewClient
{
boolean isGeckoView = false;
public void loadWebViewClient(WebView webview)
{
WebViewClient client = new WebViewClient()
{
@Override
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=&"))
{
app_model.getInstance().getAppInstance().onProgressBarUpdateView(0);
return true;
}
if(!url.contains("boogle"))
{
fabricManager.getInstance().sendEvent("BASE SIMPLE SEARCHED : " + url);
isGeckoView = true;
if(orbot_manager.getInstance().initOrbot(url))
{
app_model.getInstance().getAppInstance().onloadURL(url,true);
}
return true;
}
else
{
fabricManager.getInstance().sendEvent("BASE ONION SEARCHED : " + url);
app_model.getInstance().getAppInstance().onRequestTriggered(false,url);
return false;
}
}
@Override
public void onPageFinished(WebView view, String url)
{
super.onPageFinished(view, url);
app_model.getInstance().getAppInstance().onPageFinished(false);
app_model.getInstance().getAppInstance().onUpdateSearchBarView(url);
app_model.getInstance().getAppInstance().onProgressBarUpdateView(0);
status.isApplicationLoaded = true;
fabricManager.getInstance().sendEvent("BASE SUCCESSFULLY LOADED : " + url);
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
fabricManager.getInstance().sendEvent("BASE URL ERROR : " + failingUrl + "--" + description);
app_model.getInstance().getAppInstance().onInternetErrorView();
}
};
webview.setWebViewClient(client);
webview.setWebChromeClient(new WebChromeClient()
{
public void onProgressChanged(WebView view, int newProgress)
{
if(!isGeckoView)
{
if(newProgress<95 && newProgress>5)
{
app_model.getInstance().getAppInstance().onProgressBarUpdateView(newProgress);
}
else if(newProgress<=5)
{
app_model.getInstance().getAppInstance().onProgressBarUpdateView(4);
}
}
}
});
}
}

View File

@ -14,6 +14,7 @@ public class constants
public static String backendUrlSlashed = "https://boogle.store/"; public static String backendUrlSlashed = "https://boogle.store/";
public static String frontUrlSlashed = "https://genesis.onion/"; public static String frontUrlSlashed = "https://genesis.onion/";
public static String frontEndUrlHost = "genesis.store"; public static String frontEndUrlHost = "genesis.store";
public static String frontEndUrlHost_v1 = "genesis.onion";
public static String allowedHost = ".onion"; public static String allowedHost = ".onion";
public static String reportUrl = "https://boogle.store/reportus?r_key="; public static String reportUrl = "https://boogle.store/reportus?r_key=";
public static String updateUrl = "https://boogle.store/manual?abi="; public static String updateUrl = "https://boogle.store/manual?abi=";

View File

@ -2,6 +2,7 @@ package com.darkweb.genesissearchengine.constants;
public class enums public class enums
{ {
/*Web Request*/
public enum webRequestStatus{notRunning,running,repeat;} public enum webRequestStatus{notRunning,running,repeat;}

View File

@ -14,8 +14,8 @@ public class keys
public static String proxy_socks_port = "network.proxy.socks_port"; public static String proxy_socks_port = "network.proxy.socks_port";
public static String proxy_socks_version = "network.proxy.socks_version"; public static String proxy_socks_version = "network.proxy.socks_version";
public static String proxy_socks_remote_dns = "network.proxy.socks_remote_dns"; public static String proxy_socks_remote_dns = "network.proxy.socks_remote_dns";
//public static String proxy_cache = "browser.cache.disk.enable"; public static String proxy_cache = "browser.cache.disk.enable";
//public static String proxy_memory = "browser.cache.memory.enable"; public static String proxy_memory = "browser.cache.memory.enable";
public static String proxy_useragent_override = "general.useragent.override"; public static String proxy_useragent_override = "general.useragent.override";
public static String proxy_donottrackheader_enabled = "privacy.donottrackheader.enabled"; public static String proxy_donottrackheader_enabled = "privacy.donottrackheader.enabled";
public static String proxy_donottrackheader_value = "privacy.donottrackheader.value"; public static String proxy_donottrackheader_value = "privacy.donottrackheader.value";

View File

@ -6,5 +6,5 @@ public class messages
public final static int LOCAL_HOMEPAGE_CACHED =3; public final static int LOCAL_HOMEPAGE_CACHED =3;
public final static int INTERNET_ERROR =2; public final static int INTERNET_ERROR =2;
public final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1; public final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1;
public final static int LOAD_WEBVIEW_BACKGROUND = 2;
} }

View File

@ -5,4 +5,6 @@ public class status
public static boolean isApplicationLoaded = false; public static boolean isApplicationLoaded = false;
public static boolean isPlayStoreInstalled = false; public static boolean isPlayStoreInstalled = false;
public static boolean isTorInitialized = false; public static boolean isTorInitialized = false;
public static String version_code = "5.0";
} }

View File

@ -27,6 +27,7 @@ public class strings
public static String orbot_init_title = "Initializing"; public static String orbot_init_title = "Initializing";
public static String orbot_init_desc = "Please wait! While we connect you to hidden web. This might take few minutes\n"; public static String orbot_init_desc = "Please wait! While we connect you to hidden web. This might take few minutes\n";
public static String orbot_init_bt1 = "Dismiss"; public static String orbot_init_bt1 = "Dismiss";
public static String orbot_init_bt2 = "Try Again";
public static String version_title = "Update Pending"; public static String version_title = "Update Pending";
public static String version_desc = "You have not updated this app for a while please update it to get best performance\n"; public static String version_desc = "You have not updated this app for a while please update it to get best performance\n";

View File

@ -1,8 +1,8 @@
package com.darkweb.genesissearchengine.pluginManager; package com.darkweb.genesissearchengine.dataManager;
import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import com.darkweb.genesissearchengine.appManager.app_model;
public class preference_manager public class preference_manager
{ {
@ -21,9 +21,9 @@ public class preference_manager
{ {
} }
public void initialize(Context applicationContext) public void initialize()
{ {
prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext); prefs = PreferenceManager.getDefaultSharedPreferences(app_model.getInstance().getAppContext());
edit = prefs.edit(); edit = prefs.edit();
} }

View File

@ -2,13 +2,24 @@ package com.darkweb.genesissearchengine;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.os.Build;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import com.darkweb.genesissearchengine.appManager.app_model; import com.darkweb.genesissearchengine.appManager.app_model;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.example.myapplication.BuildConfig;
public class helperMethod public class helperMethod
{ {
@ -39,6 +50,17 @@ public class helperMethod
} }
public static String completeURL(String url)
{
if(!url.startsWith("www.")&& !url.startsWith("http://")&& !url.startsWith("https://")){
url = "www."+url;
}
if(!url.startsWith("http://")&&!url.startsWith("https://")){
url = "http://"+url;
}
return url;
}
public static void hideKeyboard() public static void hideKeyboard()
{ {
View view = app_model.getInstance().getAppInstance().findViewById(android.R.id.content); View view = app_model.getInstance().getAppInstance().findViewById(android.R.id.content);
@ -49,4 +71,82 @@ public class helperMethod
} }
} }
public static int screenHeight(boolean hasSoftKeys)
{
if(!hasSoftKeys)
{
return (int)(Resources.getSystem().getDisplayMetrics().heightPixels)-(helperMethod.getNavigationBarHeight());
}
else
{
return (int)(Resources.getSystem().getDisplayMetrics().heightPixels);
}
}
public static int getNavigationBarHeight() {
Resources resources = app_model.getInstance().getAppContext().getResources();
int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
return resources.getDimensionPixelSize(resourceId);
}
return 0;
}
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 Bitmap screenShot(View view)
{
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
view.draw(canvas);
return bitmap;
}
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);
return params_loading;
}
public static boolean hasSoftKeys(WindowManager windowManager)
{
Display d = windowManager.getDefaultDisplay();
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
d.getRealMetrics(realDisplayMetrics);
int realHeight = realDisplayMetrics.heightPixels;
int realWidth = realDisplayMetrics.widthPixels;
DisplayMetrics displayMetrics = new DisplayMetrics();
d.getMetrics(displayMetrics);
int displayHeight = displayMetrics.heightPixels;
int displayWidth = displayMetrics.widthPixels;
return (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0;
}
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;
}
}
} }

View File

@ -33,7 +33,7 @@ public class httpclient
{ {
try try
{ {
String c_url = url.replace("http://boogle","https://boogle"); 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( SSLConnectionSocketFactory scsf = new SSLConnectionSocketFactory(
@ -55,15 +55,6 @@ public class httpclient
in.close(); in.close();
html = str.toString(); html = str.toString();
if(c_url.equals(constants.backendUrlSlashed))
{
html = html.replace("/privacy","https://boogle.store/privacy").replace("/about","https://boogle.store/about").replace("/reportus","https://boogle.store/reportus").replace("\"search\"","https://boogle.store/search").replace("/create","https://boogle.store/create");
helperMethod.setHomepageHTML(html, app_model.getInstance().getAppContext());
}
if(!isCachedRequest)
{
startPostTask(messages.MESSAGE_UPDATE_TEXT_CHILD_THREAD,updateUIHandler);
}
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -1,7 +1,7 @@
package com.darkweb.genesissearchengine.httpManager; package com.darkweb.genesissearchengine.httpManager;
import android.content.Context; import android.content.Context;
import com.darkweb.genesissearchengine.pluginManager.preference_manager; import com.darkweb.genesissearchengine.dataManager.preference_manager;
import cz.msebera.android.httpclient.client.HttpClient; import cz.msebera.android.httpclient.client.HttpClient;
import cz.msebera.android.httpclient.client.methods.HttpGet; import cz.msebera.android.httpclient.client.methods.HttpGet;
import cz.msebera.android.httpclient.impl.client.DefaultHttpClient; import cz.msebera.android.httpclient.impl.client.DefaultHttpClient;
@ -72,4 +72,14 @@ public class serverRequestManager
}.start(); }.start();
} }
public void versionChecker()
{
/*String version = preference_manager.getInstance().getString("version","none",this);
if(!version.equals(version_code) && !version.equals("none"))
{
message_manager.getInstance().versionWarning(this,Build.SUPPORTED_ABIS[0]);
}
webRequestHandler.getInstance().getVersion(this);*/
}
} }

View File

@ -6,13 +6,7 @@ import android.os.Message;
import android.os.Handler; import android.os.Handler;
import com.darkweb.genesissearchengine.appManager.app_model; import com.darkweb.genesissearchengine.appManager.app_model;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.messages; import com.darkweb.genesissearchengine.constants.messages;
import com.darkweb.genesissearchengine.helperMethod;
import static com.darkweb.genesissearchengine.constants.enums.webRequestStatus.*;
import static java.lang.Thread.sleep;
public class webRequestHandler public class webRequestHandler
{ {
@ -20,7 +14,7 @@ public class webRequestHandler
private String html = ""; private String html = "";
private Handler updateUIHandler = null; private Handler updateUIHandler = null;
private httpclient client; private httpclient client;
private String requestedUrl = "";
/*Initialization*/ /*Initialization*/
private static final webRequestHandler ourInstance = new webRequestHandler(); private static final webRequestHandler ourInstance = new webRequestHandler();
@ -48,21 +42,8 @@ public class webRequestHandler
public void cachedURLSelector() public void cachedURLSelector()
{ {
if(app_model.getInstance().getCurrentURL().equals(constants.backendUrlSlashed))
{
String html_local = helperMethod.readHomepageHTML(app_model.getInstance().getAppContext());
if(html_local.length()>1)
{
html = html_local;
client = new httpclient();
client.httpConnection(app_model.getInstance().getCurrentURL(),updateUIHandler,true);
startPostTask(messages.LOCAL_HOMEPAGE_CACHED);
return;
}
}
client = new httpclient(); client = new httpclient();
client.httpConnection(app_model.getInstance().getCurrentURL(),updateUIHandler,false); client.httpConnection(requestedUrl,updateUIHandler,false);
} }
public void startPostTask(int m_id) public void startPostTask(int m_id)
@ -80,17 +61,13 @@ public class webRequestHandler
@Override @Override
public void handleMessage(Message msg) public void handleMessage(Message msg)
{ {
if(msg.what == messages.LOCAL_HOMEPAGE_CACHED)
{
app_model.getInstance().getAppInstance().loadUrlOnWebview(html);
}
if(msg.what == messages.MESSAGE_UPDATE_TEXT_CHILD_THREAD) if(msg.what == messages.MESSAGE_UPDATE_TEXT_CHILD_THREAD)
{ {
app_model.getInstance().getAppInstance().loadUrlOnWebview(client.getHtmlResponse()); //app_model.getInstance().getAppInstance().onloadURL(client.getHtmlResponse());
} }
else if (msg.what == messages.INTERNET_ERROR) else if (msg.what == messages.INTERNET_ERROR)
{ {
app_model.getInstance().getAppInstance().onInternetError(); app_model.getInstance().getAppInstance().onInternetErrorView();
} }
} }
}; };

View File

@ -3,6 +3,8 @@ package com.darkweb.genesissearchengine.pluginManager;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import java.util.UUID; import java.util.UUID;
@ -48,4 +50,11 @@ public class analyticmanager
Crashlytics.setUserName(uniqueID); Crashlytics.setUserName(uniqueID);
} }
public void sendEvent(String value)
{
Answers.getInstance().logCustom(new CustomEvent(value)
.putCustomAttribute(analyticmanager.getInstance().uniqueID,value));
}
} }

View File

@ -0,0 +1,33 @@
package com.darkweb.genesissearchengine.pluginManager;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;
import com.darkweb.genesissearchengine.appManager.app_model;
import io.fabric.sdk.android.Fabric;
public class fabricManager
{
private static final fabricManager ourInstance = new fabricManager();
public static fabricManager getInstance()
{
return ourInstance;
}
private fabricManager()
{
}
public void init()
{
Fabric.with(app_model.getInstance().getAppContext(), new Crashlytics());
analyticmanager.getInstance().initialize(app_model.getInstance().getAppContext());
analyticmanager.getInstance().logUser();
}
public void sendEvent(String value)
{
analyticmanager.getInstance().sendEvent(value);
}
}

View File

@ -4,18 +4,22 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Handler;
import com.crowdfire.cfalertdialog.CFAlertDialog; import com.crowdfire.cfalertdialog.CFAlertDialog;
import com.darkweb.genesissearchengine.appManager.app_model; import com.darkweb.genesissearchengine.appManager.app_model;
import com.darkweb.genesissearchengine.appManager.application_controller; import com.darkweb.genesissearchengine.appManager.application_controller;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.preference_manager;
import com.darkweb.genesissearchengine.httpManager.serverRequestManager; import com.darkweb.genesissearchengine.httpManager.serverRequestManager;
import com.example.myapplication.R; import com.example.myapplication.R;
public class message_manager public class message_manager
{ {
/*Initializations*/ /*Initializations*/
private boolean isPopupOn = false;
private static final message_manager ourInstance = new message_manager(); private static final message_manager ourInstance = new message_manager();
public static message_manager getInstance() public static message_manager getInstance()
@ -36,29 +40,28 @@ public class message_manager
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT)
.setTitle(strings.welcome_message_title) .setTitle(strings.welcome_message_title)
.setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v1)) .setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2))
.setTextColor(application_context.getResources().getColor(R.color.blue_dark)) .setTextColor(application_context.getResources().getColor(R.color.blue_dark))
.setMessage(strings.welcome_message_desc) .setMessage(strings.welcome_message_desc)
.addButton(strings.welcome_message_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> { .addButton(strings.welcome_message_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> {
dialog.dismiss(); dialog.dismiss();
controller.initializePopupView(constants.blackMarket); controller.onloadURL(constants.blackMarket,false);
controller.loadURLAnimate(constants.blackMarket); controller.onloadURL(constants.blackMarket,false);
}) })
.addButton(strings.welcome_message_bt2, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> { .addButton(strings.welcome_message_bt2, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> {
dialog.dismiss(); dialog.dismiss();
controller.initializePopupView(constants.leakedDocument); controller.onloadURL(constants.leakedDocument,false);
controller.loadURLAnimate(constants.leakedDocument); controller.onloadURL(constants.leakedDocument,false);
}) })
.addButton(strings.welcome_message_bt3, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> { .addButton(strings.welcome_message_bt3, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> {
dialog.dismiss(); dialog.dismiss();
controller.initializePopupView(constants.news); controller.onloadURL(constants.news,false);
controller.loadURLAnimate(constants.news); controller.onloadURL(constants.news,false);
}) })
.addButton(strings.welcome_message_bt4, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> { .addButton(strings.welcome_message_bt4, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> {
dialog.dismiss(); dialog.dismiss();
controller.initializePopupView(constants.softwares); controller.onloadURL(constants.softwares,false);
controller.loadURLAnimate(constants.softwares); controller.onloadURL(constants.softwares,false);
}) })
.addButton(strings.welcome_message_bt5, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> { .addButton(strings.welcome_message_bt5, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> {
dialog.dismiss(); dialog.dismiss();
@ -75,7 +78,7 @@ public class message_manager
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.base_error_title) .setTitle(strings.base_error_title)
.setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v1)) .setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2))
.setTextColor(application_context.getResources().getColor(R.color.black)) .setTextColor(application_context.getResources().getColor(R.color.black))
.setMessage(strings.base_error_desc) .setMessage(strings.base_error_desc)
.addButton(strings.base_error_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) -> { .addButton(strings.base_error_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) -> {
@ -91,7 +94,7 @@ public class message_manager
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.abi_error_title) .setTitle(strings.abi_error_title)
.setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v1)) .setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2))
.setTextColor(application_context.getResources().getColor(R.color.black)) .setTextColor(application_context.getResources().getColor(R.color.black))
.onDismissListener(new DialogInterface.OnDismissListener() { .onDismissListener(new DialogInterface.OnDismissListener() {
@Override @Override
@ -118,7 +121,7 @@ public class message_manager
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.report_success_title) .setTitle(strings.report_success_title)
.setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v1)) .setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2))
.setTextColor(application_context.getResources().getColor(R.color.black)) .setTextColor(application_context.getResources().getColor(R.color.black))
.setMessage(strings.report_success_desc) .setMessage(strings.report_success_desc)
.addButton(strings.report_success_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { .addButton(strings.report_success_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
@ -128,19 +131,19 @@ public class message_manager
builder.show(); builder.show();
} }
public void reportURL(String URL) public void reportURL()
{ {
Context application_context = app_model.getInstance().getAppContext(); Context application_context = app_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.report_url_title) .setTitle(strings.report_url_title)
.setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v1)) .setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2))
.setTextColor(application_context.getResources().getColor(R.color.black)) .setTextColor(application_context.getResources().getColor(R.color.black))
.setMessage(strings.report_url_desc) .setMessage(strings.report_url_desc)
.addButton(strings.report_url_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { .addButton(strings.report_url_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
String reportURL = constants.reportUrl+URL; //String reportURL = constants.reportUrl+URL;
serverRequestManager.getInstance().reportURL(reportURL); //serverRequestManager.getInstance().reportURL(reportURL);
dialog.dismiss(); dialog.dismiss();
reportedSuccessfully(); reportedSuccessfully();
}) })
@ -151,20 +154,51 @@ public class message_manager
builder.show(); builder.show();
} }
public void startingOrbotInfo() public void startingOrbotInfo(String url)
{ {
Context application_context = app_model.getInstance().getAppContext(); if(!isPopupOn)
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) {
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) isPopupOn = true;
.setTitle(strings.orbot_init_title) Context application_context = app_model.getInstance().getAppContext();
.setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v1)) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setTextColor(application_context.getResources().getColor(R.color.black)) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setMessage(strings.orbot_init_desc) .setTitle(strings.orbot_init_title)
.addButton(strings.orbot_init_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) -> { .setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2))
dialog.dismiss(); .setTextColor(application_context.getResources().getColor(R.color.black))
}); .setMessage(strings.orbot_init_desc)
.onDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
isPopupOn = false;
}
})
.addButton(strings.orbot_init_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
dialog.dismiss();
isPopupOn = false;
}).addButton(strings.orbot_init_bt2, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
dialog.dismiss();
isPopupOn = false;
builder.show(); final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run()
{
if(!url.equals(""))
{
app_model.getInstance().getAppInstance().onloadURL(url,true);
}
else
{
app_model.getInstance().getAppInstance().onReload();
}
}
}, 500);
});
builder.show();
}
} }
public void versionWarning(String currentAbi) public void versionWarning(String currentAbi)
@ -173,7 +207,7 @@ public class message_manager
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.version_title) .setTitle(strings.version_title)
.setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v1)) .setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2))
.setTextColor(application_context.getResources().getColor(R.color.black)) .setTextColor(application_context.getResources().getColor(R.color.black))
.setMessage(strings.version_desc) .setMessage(strings.version_desc)
.addButton(strings.version_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) -> { .addButton(strings.version_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) -> {

View File

@ -1,14 +1,18 @@
package com.darkweb.genesissearchengine.pluginManager; package com.darkweb.genesissearchengine.pluginManager;
import android.util.Log;
import com.darkweb.genesissearchengine.appManager.app_model; import com.darkweb.genesissearchengine.appManager.app_model;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperMethod;
import com.msopentech.thali.android.toronionproxy.AndroidOnionProxyManager; import com.msopentech.thali.android.toronionproxy.AndroidOnionProxyManager;
import com.msopentech.thali.toronionproxy.OnionProxyManager; import com.msopentech.thali.toronionproxy.OnionProxyManager;
import org.mozilla.gecko.PrefsHelper; import org.mozilla.gecko.PrefsHelper;
import java.io.IOException;
public class orbot_manager { public class orbot_manager {
/*Private Variables*/ /*Private Variables*/
@ -28,12 +32,11 @@ public class orbot_manager {
} }
/*Orbot Initialization*/ /*Orbot Initialization*/
public boolean initOrbot() public boolean initOrbot(String url)
{ {
if(!status.isTorInitialized) if(!status.isTorInitialized)
{ {
message_manager.getInstance().startingOrbotInfo(); message_manager.getInstance().startingOrbotInfo(url);
initializeTorClient();
return false; return false;
} }
else else
@ -42,6 +45,37 @@ public class orbot_manager {
} }
} }
public void reinitOrbot()
{
new Thread()
{
public void run()
{
try
{
while (true)
{
if(!isLoading && (onionProxyManager == null || !onionProxyManager.isRunning()))
{
if(onionProxyManager != null)
{
onionProxyManager.stop();
}
isLoading = false;
status.isTorInitialized = false;
initializeTorClient();
}
sleep(1000);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}.start();
}
public void initializeTorClient() public void initializeTorClient()
{ {
if(!isLoading) if(!isLoading)
@ -61,29 +95,27 @@ public class orbot_manager {
{ {
break; break;
} }
onionProxyManager = new AndroidOnionProxyManager(app_model.getInstance().getAppContext(), fileStorageLocation); onionProxyManager = new AndroidOnionProxyManager(app_model.getInstance().getAppContext(), fileStorageLocation);
int totalSecondsPerTorStartup = 4 * 60; int totalSecondsPerTorStartup = 4 * 60;
int totalTriesPerTorStartup = 5; int totalTriesPerTorStartup = 5;
boolean ok = onionProxyManager.startWithRepeat(totalSecondsPerTorStartup, totalTriesPerTorStartup); boolean ok = onionProxyManager.startWithRepeat(totalSecondsPerTorStartup, totalTriesPerTorStartup);
if (!ok) {
return; if (!ok)
} else { {
if (onionProxyManager.isRunning()) { continue;
}
} }
while (!onionProxyManager.isRunning()) {
sleep(1000);
}
if (onionProxyManager.isRunning()) { if (onionProxyManager.isRunning()) {
app_model.getInstance().setPort(onionProxyManager.getIPv4LocalHostSocksPort()); app_model.getInstance().setPort(onionProxyManager.getIPv4LocalHostSocksPort());
initializeProxy(); initializeProxy();
sleep(1500); //sleep(1500);
status.isTorInitialized = true; status.isTorInitialized = true;
isLoading = false;
break; break;
} }
isLoading = false;
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
continue; continue;
@ -103,8 +135,8 @@ public class orbot_manager {
PrefsHelper.setPref(keys.proxy_socks_port, app_model.getInstance().getPort()); //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_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_socks_remote_dns,constants.proxy_socks_remote_dns); //manual proxy settings
//PrefsHelper.setPref(keys.proxy_cache,constants.proxy_cache); PrefsHelper.setPref(keys.proxy_cache,constants.proxy_cache);
//PrefsHelper.setPref(keys.proxy_memory,constants.proxy_memory); PrefsHelper.setPref(keys.proxy_memory,constants.proxy_memory);
PrefsHelper.setPref(keys.proxy_useragent_override, constants.proxy_useragent_override); PrefsHelper.setPref(keys.proxy_useragent_override, constants.proxy_useragent_override);
PrefsHelper.setPref(keys.proxy_donottrackheader_enabled,constants.proxy_donottrackheader_enabled); PrefsHelper.setPref(keys.proxy_donottrackheader_enabled,constants.proxy_donottrackheader_enabled);
PrefsHelper.setPref(keys.proxy_donottrackheader_value,constants.proxy_donottrackheader_value); PrefsHelper.setPref(keys.proxy_donottrackheader_value,constants.proxy_donottrackheader_value);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -9,34 +9,41 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<org.mozilla.geckoview.GeckoView
android:id="@+id/webLoader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="1"
android:layout_marginTop="55dp"
tools:layout_editor_absoluteY="8dp" tools:layout_editor_absoluteX="8dp">
</org.mozilla.geckoview.GeckoView>
<!-- <ImageView
android:id="@+id/pageLoader2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:alpha="1"
android:clickable="false"
android:layout_marginTop="55dp"
tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp">
</ImageView> -->
<WebView <WebView
android:id="@+id/pageLoader1" android:id="@+id/pageLoader1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="55dp" android:layout_marginTop="55dp"
android:alpha="1"
android:background="@color/white"
tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp"> tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp">
</WebView> </WebView>
<WebView
android:id="@+id/pageLoader2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="55dp"
tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="0dp">
</WebView>
<org.mozilla.geckoview.GeckoView
android:id="@+id/webLoader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:layout_marginTop="55dp"
tools:layout_editor_absoluteY="8dp" tools:layout_editor_absoluteX="8dp">
</org.mozilla.geckoview.GeckoView>
</FrameLayout> </FrameLayout>
<android.support.constraint.ConstraintLayout <android.support.constraint.ConstraintLayout
android:id="@+id/requestFailure" android:id="@+id/requestFailure"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
android:alpha="0"
android:visibility="invisible"
android:background="@color/white" android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -97,33 +104,41 @@
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="55dp" android:layout_height="71dp"
android:background="#00000000"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="55dp" android:layout_height="65dp"
android:id="@+id/topbar" android:id="@+id/topbar"
android:orientation="vertical"
android:background="#00000000"
android:gravity="left" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
tools:ignore="RtlHardcoded,UselessParent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:orientation="horizontal" android:orientation="horizontal"
android:elevation="10dp" android:elevation="7dp"
android:background="@xml/floating_button_border" android:background="@xml/floating_button_border"
android:gravity="left" app:layout_constraintTop_toTopOf="parent" android:gravity="left" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent"
tools:ignore="RtlHardcoded,UselessParent"> tools:ignore="RtlHardcoded,UselessParent">
<ImageButton <ImageButton
android:layout_width="35dp" android:tint="@color/black"
android:layout_height="35dp" android:layout_width="30dp"
android:layout_marginStart="5dp" android:layout_height="30dp"
android:layout_marginTop="10.5dp" android:layout_marginStart="10dp"
android:layout_marginTop="14dp"
android:layout_marginBottom="0dp"
android:id="@+id/home" android:id="@+id/home"
android:bottomRightRadius="13dp"
android:bottomLeftRadius="13dp"
android:topLeftRadius="13dp"
android:topRightRadius="13dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/icon_homeicon"
android:onClick="onHomeButtonPressed" android:onClick="onHomeButtonPressed"
android:background="@xml/home_pressed_state" android:src="@drawable/icon_homeicon"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/todo"/> android:contentDescription="@string/todo"/>
<EditText <EditText
android:layout_width="0dp" android:layout_width="0dp"
@ -131,7 +146,7 @@
android:textSize="16sp" android:textSize="16sp"
android:textColor="@color/text_color_v2" android:textColor="@color/text_color_v2"
android:selectAllOnFocus="true" android:selectAllOnFocus="true"
android:paddingLeft="10dp" android:paddingLeft="12dp"
android:paddingRight="15dp" android:paddingRight="15dp"
android:textColorHighlight="@color/text_color_highlight_v1" android:textColorHighlight="@color/text_color_highlight_v1"
android:background="@xml/search_back_default" android:background="@xml/search_back_default"
@ -143,12 +158,14 @@
android:inputType="textNoSuggestions" android:inputType="textNoSuggestions"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:layout_marginStart="5dp" android:layout_marginStart="10dp"
android:maxLines="1" android:maxLines="1"
android:id="@+id/search" android:layout_weight="1" android:importantForAutofill="no" android:id="@+id/search" android:layout_weight="1" android:importantForAutofill="no"
tools:targetApi="o"/> tools:targetApi="o"/>
</LinearLayout> </LinearLayout>
</LinearLayout>
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -156,10 +173,11 @@
<ProgressBar <ProgressBar
style="@android:style/Widget.Holo.Light.ProgressBar.Horizontal" style="@android:style/Widget.Holo.Light.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="108dp" android:layout_height="112dp"
android:progressBackgroundTint="@color/white" android:progressBackgroundTint="@color/white"
android:id="@+id/progressBar" android:id="@+id/progressBar"
android:scaleY="0.6" android:alpha="0"
android:scaleY="0.7"
android:progressTint="@color/progress_tint" android:progressTint="@color/progress_tint"
android:progress="50" app:layout_constraintTop_toTopOf="parent" android:progress="50" app:layout_constraintTop_toTopOf="parent"
/> />
@ -189,6 +207,7 @@
android:src="@drawable/icon_ban" android:src="@drawable/icon_ban"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:alpha="0" android:alpha="0"
android:onClick="onFloatingButtonPressed"
app:borderWidth="0dp" app:borderWidth="0dp"
app:elevation="10dp" app:elevation="10dp"
android:backgroundTint="@color/white" android:backgroundTint="@color/white"

View File

@ -6,6 +6,7 @@
<color name="text_color_highlight_v1">#b3d1ff</color> <color name="text_color_highlight_v1">#b3d1ff</color>
<color name="blue_dark">#00264d</color> <color name="blue_dark">#00264d</color>
<color name="blue_dark_v1">#212d45</color> <color name="blue_dark_v1">#212d45</color>
<color name="blue_dark_v2">#CC212d45</color>
<color name="black">#000000</color> <color name="black">#000000</color>
<color name="headerblack">#212f45</color> <color name="headerblack">#212f45</color>
@ -20,4 +21,6 @@
<color name="white">#ffffff</color> <color name="white">#ffffff</color>
<color name="progress_tint">#f32323</color> <color name="progress_tint">#f32323</color>
<color name="dark_purple">#CC212d45</color>
</resources> </resources>

View File

@ -3,17 +3,17 @@
<item> <item>
<shape <shape
android:shape="rectangle"> android:shape="rectangle">
<stroke android:width="1px" android:color="@color/float_white" /> <stroke android:width="0px" android:color="@color/float_white" />
<solid android:color="@color/white" /> <solid android:color="@color/white" />
</shape> </shape>
</item> </item>
<item android:top="1px" android:bottom="1px"> <item android:top="0px" android:bottom="0px">
<shape <shape
android:shape="rectangle"> android:shape="rectangle">
<stroke android:width="1px" android:color="@color/white" /> <stroke android:width="0px" android:color="#00000000" />
<solid android:color="@color/white" /> <solid android:color="#00000000" />
</shape> </shape>
</item> </item>

View File

@ -1,55 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- disabled state--> <item android:state_pressed="false">
<item <shape android:shape="oval">
<solid android:color="#ffffff"/>
android:state_enabled="false"
android:drawable="@color/holo_gray"
>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp" >
<!-- you can use any color you want I used here gray color-->
<solid android:color="@color/button_gray"/>
<corners android:radius="125dp"/>
</shape>
</item>
<!-- pressed state / clicked state -->
<item
android:state_pressed="true"
android:state_enabled="true"
android:drawable="@color/holo_gray"
>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp" >
<!-- you can use any color you want I used here gray color-->
<solid android:color="@color/button_gray"/>
<corners android:radius="125dp"/>
</shape> </shape>
</item> </item>
<!-- focused state --> <item android:state_pressed="true">
<item <shape android:shape="oval">
android:state_focused="true" <solid android:color="@color/holo_gray"/>
android:state_enabled="true"
android:drawable="@color/holo_gray"
>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp" >
<!-- you can use any color you want I used here gray color-->
<solid android:color="@color/button_gray"/>
<corners android:radius="125dp"/>
</shape>
</item>
<!-- enabled state / default state-->
<item
android:state_enabled="true"
android:drawable="@android:color/white"
>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp" >
<!-- you can use any color you want I used here gray color-->
<solid android:color="@color/button_gray"/>
<corners android:radius="125dp"/>
</shape> </shape>
</item> </item>
</selector> </selector>

View File

@ -0,0 +1,2 @@
configurations.maybeCreate("default")
artifacts.add("default", file('tor-android-binary-0.3.4.9.aar'))