bug fixes

master
msmannan00 2019-04-07 22:25:58 +05:00
parent 6bc71e7464
commit d66273da24
6 changed files with 106 additions and 73 deletions

View File

@ -3,8 +3,8 @@ apply plugin: 'com.android.application'
apply plugin: 'maven' apply plugin: 'maven'
ext { ext {
geckoviewChannel = "nightly" geckoviewChannel = ""
geckoviewVersion = "66.0.20181225095124" geckoviewVersion = "66.0.20190322021635"
} }
android { android {
compileSdkVersion 28 compileSdkVersion 28
@ -47,8 +47,8 @@ dependencies {
implementation "cz.msebera.android:httpclient:4.4.1.2" implementation "cz.msebera.android:httpclient:4.4.1.2"
implementation 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1' implementation 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1'
implementation 'info.guardianproject.netcipher:netcipher-okhttp3:2.0.0-alpha1' implementation 'info.guardianproject.netcipher:netcipher-okhttp3:2.0.0-alpha1'
armImplementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}-armeabi-v7a:${geckoviewVersion}" armImplementation "org.mozilla.geckoview:geckoview-armeabi-v7a:${geckoviewVersion}"
aarch64Implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}-arm64-v8a:${geckoviewVersion}" aarch64Implementation "org.mozilla.geckoview:geckoview-arm64-v8a:${geckoviewVersion}"
implementation 'com.yarolegovich:lovely-dialog:1.1.0' implementation 'com.yarolegovich:lovely-dialog:1.1.0'
} }

View File

@ -22,7 +22,7 @@ public class admanager {
{ {
MobileAds.initialize(applicationContext, "ca-app-pub-5074525529134731~2926711128 "); MobileAds.initialize(applicationContext, "ca-app-pub-5074525529134731~2926711128 ");
mInterstitialAd = new InterstitialAd(applicationContext); mInterstitialAd = new InterstitialAd(applicationContext);
mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712"); mInterstitialAd.setAdUnitId("ca-app-pub-5074525529134731/8478420705");
implementListeners(); implementListeners();
mInterstitialAd.loadAd(new AdRequest.Builder().build()); mInterstitialAd.loadAd(new AdRequest.Builder().build());
} }

View File

@ -24,7 +24,6 @@ import java.util.Stack;
import info.guardianproject.netcipher.proxy.OrbotHelper; import info.guardianproject.netcipher.proxy.OrbotHelper;
import org.mozilla.gecko.PrefsHelper; import org.mozilla.gecko.PrefsHelper;
import org.mozilla.geckoview.GeckoDisplay;
import org.mozilla.geckoview.GeckoRuntime; import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView; import org.mozilla.geckoview.GeckoView;
@ -53,7 +52,8 @@ public class application_controller extends AppCompatActivity
private boolean isLoadedUrlSet = false; private boolean isLoadedUrlSet = false;
private boolean isOnnionUrlHalted = false; private boolean isOnnionUrlHalted = false;
Handler handler = null; Handler handler = null;
Runnable geckoRunnable = null;
boolean isBlackPage = false;
/*helper Variables*/ /*helper Variables*/
Stack traceUrlList = new Stack<String>(); Stack traceUrlList = new Stack<String>();
@ -63,6 +63,7 @@ public class application_controller extends AppCompatActivity
{ {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.application_view); setContentView(R.layout.application_view);
initializeRunnable();
initializeProxy(); initializeProxy();
initializeConnections(); initializeConnections();
initializeOrbot(); initializeOrbot();
@ -81,6 +82,25 @@ public class application_controller extends AppCompatActivity
webRequestHandler.getInstance().getVersion(this); webRequestHandler.getInstance().getVersion(this);
} }
public void initializeRunnable()
{
handler = new Handler();
handler.postDelayed(geckoRunnable,15000);
Runnable my_runnable = new Runnable() {
@Override
public void run() {
if(!isBlackPage)
{
Log.i("SHIT1 : ",status.currentURL);
progressBar.animate().setDuration(150).alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));;
datamodel.getInstance().setIsLoadingURL(false);
message_manager.getInstance().URLNotFoundError(application_controller.this);
}
}
};
}
public void initializeAds() public void initializeAds()
{ {
admanager.getInstance().initialize(this); admanager.getInstance().initialize(this);
@ -123,9 +143,9 @@ public class application_controller extends AppCompatActivity
public void initializeWebViews() public void initializeWebViews()
{ {
webRequestHandler.getInstance().initialization(webView1,webView2,progressBar,searchbar,requestFailure,this); webRequestHandler.getInstance().initialization(webView1,webView2,progressBar,searchbar,requestFailure,this,splashScreen);
webView1.bringToFront(); webView1.bringToFront();
progressBar.animate().alpha(0f); progressBar.animate().setDuration(150).alpha(0f);
session1 = new GeckoSession(); session1 = new GeckoSession();
runtime1 = GeckoRuntime.create(this); runtime1 = GeckoRuntime.create(this);
@ -153,7 +173,7 @@ public class application_controller extends AppCompatActivity
webView2.animate().setDuration(0).alpha(0f); webView2.animate().setDuration(0).alpha(0f);
progressBar.setVisibility(View.INVISIBLE); progressBar.setVisibility(View.INVISIBLE);
requestFailure.animate().setDuration(0).alpha(0.0f); requestFailure.animate().setDuration(0).alpha(0.0f);
progressBar.animate().alpha(0f); progressBar.animate().setDuration(150).alpha(0f);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
loadURLAnimate(constants.backendUrl); loadURLAnimate(constants.backendUrl);
@ -187,14 +207,14 @@ public class application_controller extends AppCompatActivity
if(!url.toString().contains("boogle")) if(!url.toString().contains("boogle"))
{ {
//admanager.getInstance().showAd(); admanager.getInstance().showAd();
boolean init_status=orbot_manager.getInstance().reinitOrbot(application_controller.this); boolean init_status=orbot_manager.getInstance().reinitOrbot(application_controller.this);
if(!init_status) if(!init_status)
{ {
progressBar.setAlpha(0); progressBar.setAlpha(0);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
progressBar.animate().setDuration(300).alpha(1f); progressBar.animate().setDuration(150).setDuration(300).alpha(1f);
isOnnionUrlHalted = false; isOnnionUrlHalted = false;
session1.stop(); session1.stop();
@ -216,7 +236,6 @@ public class application_controller extends AppCompatActivity
traceUrlList.add(status.currentURL); traceUrlList.add(status.currentURL);
status.currentURL = url; status.currentURL = url;
} }
Log.i("WOW1",url);
loadURLAnimate(url); loadURLAnimate(url);
return true; return true;
} }
@ -235,7 +254,7 @@ public class application_controller extends AppCompatActivity
}));; }));;
progressBar.animate().alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));; progressBar.animate().setDuration(150).alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));;
if(!status.hasApplicationLoaded) if(!status.hasApplicationLoaded)
{ {
@ -259,11 +278,18 @@ public class application_controller extends AppCompatActivity
@Override @Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{ {
Log.i("SUP2",errorCode+""); handler = new Handler();
System.out.println("SUP2 : " + errorCode); handler.postDelayed(new Runnable() {
@Override
public void run() {
progressBar.animate().setDuration(150).alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));;
datamodel.getInstance().setIsLoadingURL(false);
splashScreen.animate().alpha(0);
requestFailure.setVisibility(View.VISIBLE); requestFailure.setVisibility(View.VISIBLE);
requestFailure.animate().alpha(1.0f); requestFailure.animate().alpha(1.0f);
loadErrorPage(); }
}, 3000);
super.onReceivedError(view, errorCode, description, failingUrl); super.onReceivedError(view, errorCode, description, failingUrl);
} }
}; };
@ -287,6 +313,7 @@ public class application_controller extends AppCompatActivity
return client; return client;
} }
class progressDelegate implements GeckoSession.ProgressDelegate class progressDelegate implements GeckoSession.ProgressDelegate
{ {
@Override @Override
@ -316,7 +343,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate
} }
datamodel.getInstance().setIsLoadingURL(true); datamodel.getInstance().setIsLoadingURL(true);
boolean isBlackPage = url.equals("about:blank"); isBlackPage = url.equals("about:blank");
if(!isBlackPage) if(!isBlackPage)
{ {
searchbar.setText(url); searchbar.setText(url);
@ -325,21 +352,16 @@ class progressDelegate implements GeckoSession.ProgressDelegate
{ {
progressBar.setAlpha(0); progressBar.setAlpha(0);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
progressBar.animate().setDuration(300).alpha(1f); progressBar.animate().setDuration(150).alpha(1f);
} }
} }
@Override @Override
public void onPageStop(GeckoSession session, boolean success) public void onPageStop(GeckoSession session, boolean success)
{ {
handler = new Handler(); if(!success)
handler.postDelayed(new Runnable() { {
@Override handler.postDelayed(geckoRunnable, 15000);
public void run() {
progressBar.animate().alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));;
datamodel.getInstance().setIsLoadingURL(false);
message_manager.getInstance().URLNotFoundError(application_controller.this);
} }
}, 10000);
} }
@Override @Override
@ -358,7 +380,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate
boolean isBlackPage = url.equals("about:blank"); boolean isBlackPage = url.equals("about:blank");
if(!isBlackPage && !wasBackPressed) if(!isBlackPage && !wasBackPressed)
{ {
Log.i("SHIT1 : ",status.currentURL); Log.i("SHIT2 : ",status.currentURL);
traceUrlList.add(status.currentURL); traceUrlList.add(status.currentURL);
searchbar.setText(url); searchbar.setText(url);
status.currentURL = url; status.currentURL = url;
@ -368,15 +390,11 @@ class progressDelegate implements GeckoSession.ProgressDelegate
} }
if(progress>=100) if(progress>=100)
{ {
progressBar.animate().alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));; progressBar.animate().setDuration(150).alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));;
datamodel.getInstance().setIsLoadingURL(false); datamodel.getInstance().setIsLoadingURL(false);
} }
if(handler!=null) handler.removeCallbacks(geckoRunnable);
{
handler.removeCallbacksAndMessages(null);
handler= null;
}
} }
@Override @Override
@ -403,19 +421,15 @@ class progressDelegate implements GeckoSession.ProgressDelegate
public void onHomeButtonPressed(View view) public void onHomeButtonPressed(View view)
{ {
webRequestHandler.getInstance().isUrlStoped=true; webRequestHandler.getInstance().isUrlStoped=true;
status.currentURL="https://boogle.store/"; searchbar.setText("https://genesis.onion");
searchbar.setText("https://boogle.store/");
//webLoader.releaseSession(); status.currentURL="https://boogle.store";
//session1 = new GeckoSession(); progressBar.setAlpha(0f);
//session1.open(runtime1);
//session1.setProgressDelegate(new progressDelegate());
//webLoader.setSession(session1);
progressBar.animate().alpha(0f);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
progressBar.animate().setDuration(300).alpha(1f); progressBar.animate().setDuration(150).alpha(1f);
loadURLAnimate("https://boogle.store");
webView1.stopLoading(); webView1.stopLoading();
webView2.stopLoading(); webView2.stopLoading();
loadURLAnimate("https://boogle.store/");
session1.close(); session1.close();
isOnnionUrlHalted = true; isOnnionUrlHalted = true;
wasBackPressed = false; wasBackPressed = false;
@ -425,9 +439,10 @@ class progressDelegate implements GeckoSession.ProgressDelegate
public void onReloadButtonPressed(View view) public void onReloadButtonPressed(View view)
{ {
progressBar.animate().alpha(0f); webRequestHandler.getInstance().isReloadedUrl = true;
progressBar.animate().setDuration(150).alpha(0f);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
progressBar.animate().setDuration(300).alpha(1f); progressBar.animate().setDuration(150).alpha(1f);
loadURLAnimate(status.currentURL); loadURLAnimate(status.currentURL);
} }
@ -449,7 +464,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate
session1.close(); session1.close();
webLoader.releaseSession(); webLoader.releaseSession();
status.currentURL = traceUrlList.pop().toString(); status.currentURL = traceUrlList.pop().toString();
progressBar.animate().alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));; progressBar.animate().setDuration(150).alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));;
webLoader.animate().alpha(0f).withEndAction((() -> webLoader.setVisibility(View.INVISIBLE)));; webLoader.animate().alpha(0f).withEndAction((() -> webLoader.setVisibility(View.INVISIBLE)));;
isOnnionUrlHalted = true; isOnnionUrlHalted = true;
wasBackPressed = false; wasBackPressed = false;
@ -462,7 +477,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate
loadURLAnimate(traceUrlList.pop().toString()); loadURLAnimate(traceUrlList.pop().toString());
if(traceUrlList.size()<=0) if(traceUrlList.size()<=0)
{ {
status.currentURL = "https://boogle.store/"; status.currentURL = "https://boogle.store";
} }
else else
{ {
@ -475,7 +490,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate
if(traceUrlList.size()<=0 || traceUrlList.peek().toString().contains("boogle.store")) if(traceUrlList.size()<=0 || traceUrlList.peek().toString().contains("boogle.store"))
{ {
Log.i("FITS2 : " , ""); Log.i("FITS2 : " , "");
status.currentURL = "https://boogle.store/"; status.currentURL = "https://boogle.store";
webLoader.animate().setDuration(250).alpha(0); webLoader.animate().setDuration(250).alpha(0);
traceUrlList.pop(); traceUrlList.pop();
wasBackPressed = false; wasBackPressed = false;

View File

@ -45,9 +45,10 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
private Handler updateUIHandler = null; private Handler updateUIHandler = null;
public boolean isUrlStoped = false; public boolean isUrlStoped = false;
private String currenturl = ""; private String currenturl = "";
private ConstraintLayout splash;
private final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1;
private final static int INTERNET_ERROR =2; private final static int INTERNET_ERROR =2;
private final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1;
private final static int RELOAD_ERROR =3;
public static webRequestHandler getInstance() { public static webRequestHandler getInstance() {
return ourInstance; return ourInstance;
@ -57,8 +58,9 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
{ {
} }
public void initialization(WebView view1, WebView view2, ProgressBar progressBar, EditText searchbar, ConstraintLayout requestFailure, Context applicationContext) public void initialization(WebView view1, WebView view2, ProgressBar progressBar, EditText searchbar, ConstraintLayout requestFailure, Context applicationContext,ConstraintLayout splash)
{ {
this.splash = splash;
this.view[0] = view1; this.view[0] = view1;
this.view[1] = view2; this.view[1] = view2;
this.progressBar = progressBar; this.progressBar = progressBar;
@ -73,16 +75,19 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
try try
{ {
if(!currenturl.equals(url)) Log.i("WOW MAN 0","WOW MAN 2 : " + currenturl + "----" + url);
if(!currenturl.equals(url) || isReloadedUrl)
{ {
Log.i("WOW MAN 1","WOW MAN 2");
isReloadedUrl = false;
currenturl = url; currenturl = url;
preInitialization(url); preInitialization(url);
} }
else else
{ {
//progressBar.animate().setDuration(0).alpha(0f).withEndAction((() -> { Message message = new Message();
// progressBar.setVisibility(View.INVISIBLE); message.what = RELOAD_ERROR;
//})); updateUIHandler.sendMessage(message);
return; return;
} }
} }
@ -106,10 +111,10 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
} }
catch (Exception e) catch (Exception e)
{ {
if(!isUrlStoped) if(!e.getMessage().contains("failed to respond"))
{ {
Log.i("SUP3",e.getMessage()+""); Log.i("SUP3",e.getMessage()+"");
//onError(); onError();
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -132,9 +137,9 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
clientThread = null; clientThread = null;
searchbar.setText(url.replace("http://boogle.store","http://genesis.onion")); searchbar.setText(url.replace("http://boogle.store","http://genesis.onion"));
} }
progressBar.animate().alpha(0f); progressBar.animate().setDuration(150).alpha(0f);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
progressBar.animate().setDuration(300).alpha(1f); progressBar.animate().setDuration(150).alpha(1f);
} }
@ -225,12 +230,24 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
} }
else if (msg.what == INTERNET_ERROR) else if (msg.what == INTERNET_ERROR)
{ {
splash.animate().setStartDelay(2000).alpha(0);
datamodel.getInstance().setIsLoadingURL(false); datamodel.getInstance().setIsLoadingURL(false);
progressBar.animate().alpha(0f); progressBar.animate().setDuration(150).alpha(0f);
requestFailure.setVisibility(View.VISIBLE); requestFailure.setVisibility(View.VISIBLE);
requestFailure.animate().alpha(1f).setDuration(300).withEndAction((() -> { requestFailure.animate().alpha(1f).setDuration(300).withEndAction((() -> {
})); }));
} }
else if (msg.what == RELOAD_ERROR)
{
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
progressBar.animate().setDuration(150).alpha(0f);
}
}, 1000);
}
} }
}; };
} }

View File

@ -10,7 +10,7 @@
android:shape="rectangle" android:padding="10dp" > android:shape="rectangle" android:padding="10dp" >
<!-- you can use any color you want I used here gray color--> <!-- you can use any color you want I used here gray color-->
<solid android:color="#d9d9d9"/> <solid android:color="#d9d9d9"/>
<corners android:radius="25dp"/> <corners android:radius="125dp"/>
</shape> </shape>
</item> </item>
@ -24,7 +24,7 @@
android:shape="rectangle" android:padding="10dp" > android:shape="rectangle" android:padding="10dp" >
<!-- you can use any color you want I used here gray color--> <!-- you can use any color you want I used here gray color-->
<solid android:color="#d9d9d9"/> <solid android:color="#d9d9d9"/>
<corners android:radius="25dp"/> <corners android:radius="125dp"/>
</shape> </shape>
</item> </item>
<!-- focused state --> <!-- focused state -->
@ -37,7 +37,7 @@
android:shape="rectangle" android:padding="10dp" > android:shape="rectangle" android:padding="10dp" >
<!-- you can use any color you want I used here gray color--> <!-- you can use any color you want I used here gray color-->
<solid android:color="#d9d9d9"/> <solid android:color="#d9d9d9"/>
<corners android:radius="25dp"/> <corners android:radius="125dp"/>
</shape> </shape>
</item> </item>
<!-- enabled state / default state--> <!-- enabled state / default state-->
@ -49,7 +49,7 @@
android:shape="rectangle" android:padding="10dp" > android:shape="rectangle" android:padding="10dp" >
<!-- you can use any color you want I used here gray color--> <!-- you can use any color you want I used here gray color-->
<solid android:color="#d9d9d9"/> <solid android:color="#d9d9d9"/>
<corners android:radius="25dp"/> <corners android:radius="125dp"/>
</shape> </shape>
</item> </item>
</selector> </selector>

View File

@ -115,14 +115,15 @@
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginTop="10.5dp" android:layout_marginTop="10.5dp"
android:id="@+id/home" android:id="@+id/home"
android:bottomRightRadius="3dp" android:bottomRightRadius="13dp"
android:bottomLeftRadius="3dp" android:bottomLeftRadius="13dp"
android:topLeftRadius="3dp" android:topLeftRadius="13dp"
android:topRightRadius="13dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/homeicon" android:src="@drawable/homeicon"
android:onClick="onHomeButtonPressed" android:onClick="onHomeButtonPressed"
android:background="@drawable/pressedcolor" android:background="@drawable/pressedcolor"
android:topRightRadius="3dp"/> />
<EditText <EditText
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"