diff --git a/app/build.gradle b/app/build.gradle index 9d798006..c5807d2a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,8 +3,8 @@ apply plugin: 'com.android.application' apply plugin: 'maven' ext { - geckoviewChannel = "nightly" - geckoviewVersion = "66.0.20181225095124" + geckoviewChannel = "" + geckoviewVersion = "66.0.20190322021635" } android { compileSdkVersion 28 @@ -47,8 +47,8 @@ dependencies { implementation "cz.msebera.android:httpclient:4.4.1.2" implementation 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1' implementation 'info.guardianproject.netcipher:netcipher-okhttp3:2.0.0-alpha1' - armImplementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}-armeabi-v7a:${geckoviewVersion}" - aarch64Implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}-arm64-v8a:${geckoviewVersion}" + armImplementation "org.mozilla.geckoview:geckoview-armeabi-v7a:${geckoviewVersion}" + aarch64Implementation "org.mozilla.geckoview:geckoview-arm64-v8a:${geckoviewVersion}" implementation 'com.yarolegovich:lovely-dialog:1.1.0' } diff --git a/app/src/main/java/com/example/myapplication/admanager.java b/app/src/main/java/com/example/myapplication/admanager.java index 81bc9b01..d2ef56e8 100644 --- a/app/src/main/java/com/example/myapplication/admanager.java +++ b/app/src/main/java/com/example/myapplication/admanager.java @@ -20,9 +20,9 @@ public class admanager { public void initialize(Context applicationContext) { - MobileAds.initialize(applicationContext, "ca-app-pub-5074525529134731~2926711128"); + MobileAds.initialize(applicationContext, "ca-app-pub-5074525529134731~2926711128 "); mInterstitialAd = new InterstitialAd(applicationContext); - mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712"); + mInterstitialAd.setAdUnitId("ca-app-pub-5074525529134731/8478420705"); implementListeners(); mInterstitialAd.loadAd(new AdRequest.Builder().build()); } diff --git a/app/src/main/java/com/example/myapplication/application_controller.java b/app/src/main/java/com/example/myapplication/application_controller.java index 9d8926d8..63af3a0f 100644 --- a/app/src/main/java/com/example/myapplication/application_controller.java +++ b/app/src/main/java/com/example/myapplication/application_controller.java @@ -24,7 +24,6 @@ import java.util.Stack; import info.guardianproject.netcipher.proxy.OrbotHelper; import org.mozilla.gecko.PrefsHelper; -import org.mozilla.geckoview.GeckoDisplay; import org.mozilla.geckoview.GeckoRuntime; import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoView; @@ -53,7 +52,8 @@ public class application_controller extends AppCompatActivity private boolean isLoadedUrlSet = false; private boolean isOnnionUrlHalted = false; Handler handler = null; - + Runnable geckoRunnable = null; + boolean isBlackPage = false; /*helper Variables*/ Stack traceUrlList = new Stack(); @@ -63,6 +63,7 @@ public class application_controller extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.application_view); + initializeRunnable(); initializeProxy(); initializeConnections(); initializeOrbot(); @@ -81,6 +82,25 @@ public class application_controller extends AppCompatActivity 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() { admanager.getInstance().initialize(this); @@ -123,9 +143,9 @@ public class application_controller extends AppCompatActivity public void initializeWebViews() { - webRequestHandler.getInstance().initialization(webView1,webView2,progressBar,searchbar,requestFailure,this); + webRequestHandler.getInstance().initialization(webView1,webView2,progressBar,searchbar,requestFailure,this,splashScreen); webView1.bringToFront(); - progressBar.animate().alpha(0f); + progressBar.animate().setDuration(150).alpha(0f); session1 = new GeckoSession(); runtime1 = GeckoRuntime.create(this); @@ -153,7 +173,7 @@ public class application_controller extends AppCompatActivity webView2.animate().setDuration(0).alpha(0f); progressBar.setVisibility(View.INVISIBLE); 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); loadURLAnimate(constants.backendUrl); @@ -187,14 +207,14 @@ public class application_controller extends AppCompatActivity if(!url.toString().contains("boogle")) { - //admanager.getInstance().showAd(); + admanager.getInstance().showAd(); boolean init_status=orbot_manager.getInstance().reinitOrbot(application_controller.this); if(!init_status) { progressBar.setAlpha(0); progressBar.setVisibility(View.VISIBLE); - progressBar.animate().setDuration(300).alpha(1f); + progressBar.animate().setDuration(150).setDuration(300).alpha(1f); isOnnionUrlHalted = false; session1.stop(); @@ -216,7 +236,6 @@ public class application_controller extends AppCompatActivity traceUrlList.add(status.currentURL); status.currentURL = url; } - Log.i("WOW1",url); loadURLAnimate(url); 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) { @@ -259,11 +278,18 @@ public class application_controller extends AppCompatActivity @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { - Log.i("SUP2",errorCode+""); - System.out.println("SUP2 : " + errorCode); - requestFailure.setVisibility(View.VISIBLE); - requestFailure.animate().alpha(1.0f); - loadErrorPage(); + handler = new Handler(); + 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.animate().alpha(1.0f); + } + }, 3000); + super.onReceivedError(view, errorCode, description, failingUrl); } }; @@ -287,6 +313,7 @@ public class application_controller extends AppCompatActivity return client; } + class progressDelegate implements GeckoSession.ProgressDelegate { @Override @@ -316,7 +343,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate } datamodel.getInstance().setIsLoadingURL(true); - boolean isBlackPage = url.equals("about:blank"); + isBlackPage = url.equals("about:blank"); if(!isBlackPage) { searchbar.setText(url); @@ -325,21 +352,16 @@ class progressDelegate implements GeckoSession.ProgressDelegate { progressBar.setAlpha(0); progressBar.setVisibility(View.VISIBLE); - progressBar.animate().setDuration(300).alpha(1f); + progressBar.animate().setDuration(150).alpha(1f); } } @Override public void onPageStop(GeckoSession session, boolean success) { - handler = new Handler(); - handler.postDelayed(new Runnable() { - @Override - public void run() { - progressBar.animate().alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));; - datamodel.getInstance().setIsLoadingURL(false); - message_manager.getInstance().URLNotFoundError(application_controller.this); - } - }, 10000); + if(!success) + { + handler.postDelayed(geckoRunnable, 15000); + } } @Override @@ -358,7 +380,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate boolean isBlackPage = url.equals("about:blank"); if(!isBlackPage && !wasBackPressed) { - Log.i("SHIT1 : ",status.currentURL); + Log.i("SHIT2 : ",status.currentURL); traceUrlList.add(status.currentURL); searchbar.setText(url); status.currentURL = url; @@ -368,15 +390,11 @@ class progressDelegate implements GeckoSession.ProgressDelegate } 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); } - if(handler!=null) - { - handler.removeCallbacksAndMessages(null); - handler= null; - } + handler.removeCallbacks(geckoRunnable); } @Override @@ -403,19 +421,15 @@ class progressDelegate implements GeckoSession.ProgressDelegate public void onHomeButtonPressed(View view) { webRequestHandler.getInstance().isUrlStoped=true; - status.currentURL="https://boogle.store/"; - searchbar.setText("https://boogle.store/"); - //webLoader.releaseSession(); - //session1 = new GeckoSession(); - //session1.open(runtime1); - //session1.setProgressDelegate(new progressDelegate()); - //webLoader.setSession(session1); - progressBar.animate().alpha(0f); + searchbar.setText("https://genesis.onion"); + + status.currentURL="https://boogle.store"; + progressBar.setAlpha(0f); progressBar.setVisibility(View.VISIBLE); - progressBar.animate().setDuration(300).alpha(1f); + progressBar.animate().setDuration(150).alpha(1f); + loadURLAnimate("https://boogle.store"); webView1.stopLoading(); webView2.stopLoading(); - loadURLAnimate("https://boogle.store/"); session1.close(); isOnnionUrlHalted = true; wasBackPressed = false; @@ -425,9 +439,10 @@ class progressDelegate implements GeckoSession.ProgressDelegate public void onReloadButtonPressed(View view) { - progressBar.animate().alpha(0f); + webRequestHandler.getInstance().isReloadedUrl = true; + progressBar.animate().setDuration(150).alpha(0f); progressBar.setVisibility(View.VISIBLE); - progressBar.animate().setDuration(300).alpha(1f); + progressBar.animate().setDuration(150).alpha(1f); loadURLAnimate(status.currentURL); } @@ -449,7 +464,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate session1.close(); webLoader.releaseSession(); 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)));; isOnnionUrlHalted = true; wasBackPressed = false; @@ -462,7 +477,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate loadURLAnimate(traceUrlList.pop().toString()); if(traceUrlList.size()<=0) { - status.currentURL = "https://boogle.store/"; + status.currentURL = "https://boogle.store"; } else { @@ -475,7 +490,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate if(traceUrlList.size()<=0 || traceUrlList.peek().toString().contains("boogle.store")) { Log.i("FITS2 : " , ""); - status.currentURL = "https://boogle.store/"; + status.currentURL = "https://boogle.store"; webLoader.animate().setDuration(250).alpha(0); traceUrlList.pop(); wasBackPressed = false; diff --git a/app/src/main/java/com/example/myapplication/webRequestHandler.java b/app/src/main/java/com/example/myapplication/webRequestHandler.java index 45725b99..40ac0ac3 100644 --- a/app/src/main/java/com/example/myapplication/webRequestHandler.java +++ b/app/src/main/java/com/example/myapplication/webRequestHandler.java @@ -45,9 +45,10 @@ public class webRequestHandler implements StrongBuilder.Callback private Handler updateUIHandler = null; public boolean isUrlStoped = false; private String currenturl = ""; - - private final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1; + private ConstraintLayout splash; 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() { return ourInstance; @@ -57,8 +58,9 @@ public class webRequestHandler implements StrongBuilder.Callback { } - 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[1] = view2; this.progressBar = progressBar; @@ -73,16 +75,19 @@ public class webRequestHandler implements StrongBuilder.Callback 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; preInitialization(url); } else { - //progressBar.animate().setDuration(0).alpha(0f).withEndAction((() -> { - // progressBar.setVisibility(View.INVISIBLE); - //})); + Message message = new Message(); + message.what = RELOAD_ERROR; + updateUIHandler.sendMessage(message); return; } } @@ -106,10 +111,10 @@ public class webRequestHandler implements StrongBuilder.Callback } catch (Exception e) { - if(!isUrlStoped) + if(!e.getMessage().contains("failed to respond")) { Log.i("SUP3",e.getMessage()+""); - //onError(); + onError(); e.printStackTrace(); } } @@ -132,9 +137,9 @@ public class webRequestHandler implements StrongBuilder.Callback clientThread = null; 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.animate().setDuration(300).alpha(1f); + progressBar.animate().setDuration(150).alpha(1f); } @@ -225,12 +230,24 @@ public class webRequestHandler implements StrongBuilder.Callback } else if (msg.what == INTERNET_ERROR) { + splash.animate().setStartDelay(2000).alpha(0); datamodel.getInstance().setIsLoadingURL(false); - progressBar.animate().alpha(0f); + progressBar.animate().setDuration(150).alpha(0f); requestFailure.setVisibility(View.VISIBLE); 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); + + } } }; } diff --git a/app/src/main/res/drawable/pressedcolor.xml b/app/src/main/res/drawable/pressedcolor.xml index a829bc6a..93d778e4 100644 --- a/app/src/main/res/drawable/pressedcolor.xml +++ b/app/src/main/res/drawable/pressedcolor.xml @@ -10,7 +10,7 @@ android:shape="rectangle" android:padding="10dp" > - + @@ -24,7 +24,7 @@ android:shape="rectangle" android:padding="10dp" > - + @@ -37,7 +37,7 @@ android:shape="rectangle" android:padding="10dp" > - + @@ -49,7 +49,7 @@ android:shape="rectangle" android:padding="10dp" > - + \ No newline at end of file diff --git a/app/src/main/res/layout/application_view.xml b/app/src/main/res/layout/application_view.xml index 8f9b3158..d0cc8a09 100644 --- a/app/src/main/res/layout/application_view.xml +++ b/app/src/main/res/layout/application_view.xml @@ -115,14 +115,15 @@ android:layout_marginLeft="5dp" android:layout_marginTop="10.5dp" android:id="@+id/home" - android:bottomRightRadius="3dp" - android:bottomLeftRadius="3dp" - android:topLeftRadius="3dp" + android:bottomRightRadius="13dp" + android:bottomLeftRadius="13dp" + android:topLeftRadius="13dp" + android:topRightRadius="13dp" android:scaleType="fitCenter" android:src="@drawable/homeicon" android:onClick="onHomeButtonPressed" android:background="@drawable/pressedcolor" - android:topRightRadius="3dp"/> + />