diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e466d869..e546fd12 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -126,7 +126,7 @@ android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize|locale|layoutDirection|smallestScreenSize|screenLayout" android:launchMode="singleTask" android:screenOrientation="portrait" - android:windowSoftInputMode="adjustResize"> + android:windowSoftInputMode="adjustPan|adjustResize"> diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java index 3cfedc0d..d7f87e9d 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java @@ -179,6 +179,7 @@ class geckoClients } void onBackPressed(boolean isFinishAllowed){ + mSession.goBackSession(); if(mSession.canGoBack()){ mSession.goBackSession(); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoSession.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoSession.java index cf3ba749..cd0082ff 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoSession.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoSession.java @@ -201,6 +201,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele @Override public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) { + mCanGoBack = true; if(mIsLoaded){ if(!isPageLoading){ mCurrentTitle = "loading"; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java index 23eae729..bb356d57 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java @@ -18,8 +18,10 @@ import android.os.Handler; import android.speech.RecognizerIntent; import android.text.Editable; import android.text.TextWatcher; +import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; +import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.webkit.URLUtil; import android.widget.*; @@ -38,6 +40,7 @@ import com.darkweb.genesissearchengine.appManager.landingManager.landingControll import com.darkweb.genesissearchengine.appManager.languageManager.languageController; import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController; +import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController; import com.darkweb.genesissearchengine.appManager.tabManager.tabController; import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; @@ -49,6 +52,7 @@ import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.KeyboardUtils; +import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.pluginManager.pluginController; @@ -77,6 +81,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba private homeViewController mHomeViewController; private homeModel mHomeModel; private geckoClients mGeckoClient = null; + private GestureDetector mSwipeDirectionDetector; /*View Webviews*/ private NestedGeckoView mGeckoView = null; @@ -97,16 +102,20 @@ public class homeController extends AppCompatActivity implements ComponentCallba private Button mConnectButton; private Button mNewTab; private View mFindBar; + private View mSearchEngineBar; private EditText mFindText; private TextView mFindCount; private ImageButton mVoiceInput; private ImageButton mMenu; private FrameLayout mNestedScroll; + private ImageView mBlockerFullSceen; + private TextView mCopyright; /*Redirection Objects*/ private boolean mPageClosed = false; private boolean isKeyboardOpened = false; private boolean isSuggestionChanged = false; + private String mSearchBarPreviousText = strings.GENERIC_EMPTY_STR; /*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/ @@ -133,6 +142,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba initializeLocalEventHandlers(); initLandingPage(); initLocalLanguage(); + onInitResume(savedInstanceState != null); + } + + public void onInitResume(boolean pStatus){ + if(pStatus){ + mSplashScreen.animate().alpha(0); + } } public void onInitTheme(){ @@ -195,7 +211,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(status.sSettingIsAppStarted){ mHomeViewController.onPageFinished(); - mSplashScreen.setAlpha(0); + mSplashScreen.animate().alpha(0); mHomeViewController.onProgressBarUpdate(100); } } @@ -224,18 +240,21 @@ public class homeController extends AppCompatActivity implements ComponentCallba mConnectButton = findViewById(R.id.Connect); mNewTab = findViewById(R.id.pTabCounter); mFindBar = findViewById(R.id.pFindBar); + mSearchEngineBar = findViewById(R.id.pSearchEngineBar); mFindText = findViewById(R.id.pFindText); mFindCount = findViewById(R.id.pFindCount); mVoiceInput = findViewById(R.id.pVoiceInput); mMenu = findViewById(R.id.pMenu); mBlocker = findViewById(R.id.pBlocker); mNestedScroll = findViewById(R.id.pNestedScroll); + mBlockerFullSceen = findViewById(R.id.pBlockerFullSceen); + mCopyright = findViewById(R.id.pCopyright); mGeckoView.setSaveEnabled(false); mGeckoView.setSaveFromParentEnabled(false); mGeckoClient = new geckoClients(); - mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,(ArrayList)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null), mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker); + mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,(ArrayList)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null), mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright); mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback()); mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false); mGeckoClient.onValidateInitializeFromStartup(); @@ -261,30 +280,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba } } - float oldTouchValue; @Override public boolean dispatchTouchEvent(MotionEvent event) { - - int action=event.getAction(); - - switch (action) { - case (MotionEvent.ACTION_DOWN): - oldTouchValue = event.getX(); - case (MotionEvent.ACTION_MOVE): - if(mSplashScreen.getVisibility()==View.VISIBLE){ - float currentX = event.getX(); - if (oldTouchValue < currentX-100) - { - helperMethod.openActivity(orbotController.class, constants.CONST_LIST_HISTORY, homeController.this,true); - } - else if (oldTouchValue > currentX+100 ) - { - helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this,true); - } - } - default: - return super.onTouchEvent(event); - } + mSwipeDirectionDetector.onTouchEvent(event); + return super.dispatchTouchEvent(event); } public void initPreFixes() { @@ -358,7 +357,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGeckoView.setSession(mTempSession); mHomeViewController.onClearSelections(false); - mHomeViewController.onUpdateSearchBar(mTempSession.getCurrentURL(),false); + mHomeViewController.onUpdateSearchBar(mTempSession.getCurrentURL(),false,true); if(mTempSession.getProgress()>0 && mTempSession.getProgress()<100){ mHomeViewController.onProgressBarUpdate(mTempSession.getProgress()); }else { @@ -428,7 +427,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE) { onSearchBarInvoked(v); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true,true); mHomeViewController.onClearSelections(true); mGeckoClient.setLoading(true); final Handler handler = new Handler(); @@ -456,7 +455,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba helperMethod.hideKeyboard(homeController.this); status.sSettingIsAppStarted = true; pluginController.getInstance().onResetMessage(); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true); } }); @@ -477,17 +476,35 @@ public class homeController extends AppCompatActivity implements ComponentCallba mSearchbar.setOnFocusChangeListener((v, hasFocus) -> { if(!hasFocus) { + mHomeViewController.onUpdateSearchEngineBar(false); + getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); mHomeViewController.initSearchBarFocus(false); if(!mGeckoClient.isLoading()){ - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true); } if(isSuggestionChanged){ isSuggestionChanged = false; mHomeViewController.initializeSuggestionView((ArrayList)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null)); } }else { + mHomeViewController.onUpdateSearchEngineBar(true); mHomeViewController.initSearchBarFocus(true); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true); + getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); + mSearchbar.setText(strings.GENERIC_EMPTY_STR); + } + }); + + mSwipeDirectionDetector=new GestureDetector(this,new SimpleGestureFilter(){ + + @Override + public boolean onSwipe(Direction direction) { + if (direction==Direction.left){ + helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this, true); + } + else if (direction==Direction.right){ + helperMethod.openActivity(orbotController.class, constants.CONST_LIST_HISTORY, homeController.this, true); + } + return true; } }); @@ -501,15 +518,20 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(validated_url!=null){ url = validated_url; } - mHomeViewController.onUpdateSearchBar(url,false); + mHomeViewController.onUpdateSearchBar(url,false,true); onLoadURL(url); } public void onSuggestionInvoked(View view){ - String val = ((TextView)view.findViewById(R.id.hintCompletionUrl)).getText().toString(); - onLoadURL(val); - mSearchbar.setSelection(0); - mHomeViewController.onUpdateSearchBar(val,false); + //String val = ((TextView)view.findViewById(R.id.hintCompletionUrl)).getText().toString(); + //onLoadURL(val); + //mSearchbar.setSelection(0); + //mHomeViewController.onUpdateSearchBar(val,false,true); + } + + public void onSuggestionMove(View view){ + String val = ((ImageButton)view).getTag().toString(); + mHomeViewController.onUpdateSearchBar(val,false,false); } public void applyTheme(){ @@ -532,10 +554,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba initializeGeckoView(true, true); if(status.sOpenURLInNewTab){ onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus)); - mHomeViewController. onUpdateSearchBar(helperMethod.getDomainName(status.sSettingSearchStatus),false); + mHomeViewController. onUpdateSearchBar(helperMethod.getDomainName(status.sSettingSearchStatus),false,true); }else { onLoadURL("about:blank"); - mHomeViewController. onUpdateSearchBar(strings.HOME_BLANK_PAGE,false); + mHomeViewController. onUpdateSearchBar(strings.HOME_BLANK_PAGE,false,true); } mHomeViewController.progressBarReset(); mHomeViewController.onNewTab(isKeyboardOpened,isKeyboardOpenedTemp); @@ -544,13 +566,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void onOpenTabViewBoundary(View view){ mGeckoClient.onRedrawPixel(); - final Handler handler = new Handler(); mNewTab.setPressed(true); - handler.postDelayed(() -> - { - helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true); - overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); - }, 100); + mGeckoClient.onRedrawPixel(); + helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true); + overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); } public void onNotificationInvoked(String message,enums.etype e_type){ @@ -580,6 +599,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(mFindBar.getVisibility() == View.VISIBLE){ mHomeViewController.onUpdateFindBar(false); } + else if(mSearchEngineBar.getVisibility() == View.VISIBLE){ + mHomeViewController.onUpdateSearchEngineBar(false); + } else if(mGeckoClient.getFullScreenStatus()){ mGeckoClient.onBackPressed(true); mHomeViewController.onClearSelections(true); @@ -656,9 +678,15 @@ public class homeController extends AppCompatActivity implements ComponentCallba } if(status.sSettingIsAppStarted){ onStartApplication(null); + tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null); + if(model!=null){ + onLoadTab(model.getSession(),true); + } } - if((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null)<=0){ - //onNewTab(false, false); + if(!mSearchBarPreviousText.equals(strings.GENERIC_EMPTY_STR)){ + mSearchbar.setText(mSearchBarPreviousText); + mSearchbar.requestFocus(); + mSearchBarPreviousText = strings.GENERIC_EMPTY_STR; } super.onResume(); @@ -670,7 +698,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(resultCode == RESULT_OK && null != data){ onSearchBarInvoked(mSearchbar); ArrayList result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); - mHomeViewController.onUpdateSearchBar(result.get(0),false); + mHomeViewController.onUpdateSearchBar(result.get(0),false,true); helperMethod.hideKeyboard(homeController.this); mGeckoClient.setLoading(true); final Handler handler = new Handler(); @@ -752,7 +780,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba initializeGeckoView(true, true); mHomeViewController.progressBarReset(); mHomeViewController.onNewTab(false,isKeyboardOpened); - mHomeViewController.onUpdateSearchBar(url,false); + mHomeViewController.onUpdateSearchBar(url,false,true); mGeckoClient.loadURL(url); } @@ -799,6 +827,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_MATCH_CASE & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); } + public void onOpenSearchEngine(View view){ + mSearchBarPreviousText = mSearchbar.getText().toString(); + helperMethod.openActivity(settingSearchController.class,constants.CONST_LIST_HISTORY, homeController.this,true); + } + public void onFindPrev(View view){ mFindText.setText("0/0"); mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_BACKWARDS & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); @@ -827,6 +860,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if (menuId == R.id.menu9) { helperMethod.hideKeyboard(this); + mGeckoClient.onRedrawPixel(); helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true); } else if (menuId == R.id.menu8) { @@ -937,7 +971,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onSetBannerAdMargin((boolean)data.get(0),pluginController.getInstance().isAdvertLoaded()); } else if(e_type.equals(enums.etype.on_url_load)){ - mHomeViewController.onUpdateLogs("Starting | Genesis Search"); + onOpenLinkNewTab(data.get(0).toString()); onLoadURL(data.get(0).toString()); } else if(e_type.equals(enums.etype.recheck_orbot)){ @@ -982,10 +1016,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onProgressBarUpdate((int)data.get(0)); } else if(e_type.equals(enums.etype.ON_UPDATE_TITLE_BAR)){ - mHomeViewController.onUpdateTitleBar((boolean)data.get(0)); } else if(e_type.equals(enums.etype.on_url_load)){ - mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false); + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true); } else if(e_type.equals(enums.etype.back_list_empty)){ if((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null)>1){ @@ -1039,10 +1072,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().setLanguage(); initLocalLanguage(); mHomeViewController.onPageFinished(); - mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false); + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true); } else if(e_type.equals(enums.etype.search_update)){ - mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false); + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false, true); } else if(e_type.equals(enums.etype.download_file_popup)){ pluginController.getInstance().MessageManagerHandler(homeController.this,Collections.singletonList(dataToStr(data.get(0))),enums.eMessageEnums.M_DOWNLOAD_FILE); @@ -1083,10 +1116,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if(e_type.equals(dataEnums.eTabCommands.M_UPDATE_PIXEL)){ try{ - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(data.get(1), mGeckoView.capturePixels())); - }catch (Exception ignored){ - + }catch (Exception EX){ + EX.printStackTrace(); } } else if(e_type.equals(enums.etype.FINDER_RESULT_CALLBACK)){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java index cbf2834f..bdb5a1ec 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java @@ -10,6 +10,7 @@ import android.content.pm.ActivityInfo; import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; @@ -21,9 +22,9 @@ import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.Window; import android.view.WindowManager; -import android.view.animation.AccelerateDecelerateInterpolator; +import android.view.animation.Animation; import android.view.animation.AnimationUtils; -import android.view.animation.DecelerateInterpolator; +import android.view.animation.Transformation; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.*; @@ -31,10 +32,7 @@ import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.content.ContextCompat; -import androidx.core.widget.NestedScrollView; - import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; import com.darkweb.genesissearchengine.constants.*; import com.darkweb.genesissearchengine.dataManager.dataController; @@ -55,7 +53,6 @@ import java.util.Collections; import java.util.Objects; import java.util.concurrent.Callable; import static android.content.Context.LAYOUT_INFLATER_SERVICE; -import static androidx.appcompat.widget.ListPopupWindow.WRAP_CONTENT; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; class homeViewController @@ -81,6 +78,7 @@ class homeViewController private Button mNewTab; private PopupWindow popupWindow = null; private View mFindBar; + private View mSearchEngineBar; private EditText mFindText; private TextView mFindCount; private FrameLayout mTopLayout; @@ -88,12 +86,14 @@ class homeViewController private ImageButton mMenu; private FrameLayout mNestedScroll; private ImageView mBlocker; + private ImageView mBlockerFullSceen; + private TextView mCopyright; /*Local Variables*/ private Callable mLogs = null; private boolean isLandscape = false; - void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, FrameLayout webviewContainer, TextView loadingText, AnimatedProgressBar progressBar, AutoCompleteTextView searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ArrayList suggestions, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, FrameLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, FrameLayout pNestedScroll, ImageView pBlocker){ + void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, FrameLayout webviewContainer, TextView loadingText, AnimatedProgressBar progressBar, AutoCompleteTextView searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ArrayList suggestions, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, FrameLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, FrameLayout pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright){ this.mContext = context; this.mProgressBar = progressBar; this.mSearchbar = searchbar; @@ -118,6 +118,9 @@ class homeViewController this.mMenu = pMenu; this.mNestedScroll = pNestedScroll; this.mBlocker = pBlocker; + this.mBlockerFullSceen = pBlockerFullSceen; + this.mSearchEngineBar = mSearchEngineBar; + this.mCopyright = pCopyright; initSplashScreen(); initializeSuggestionView(suggestions); @@ -216,7 +219,7 @@ class homeViewController animatedColor ThreeToFour = new animatedColor(ContextCompat.getColor(mContext, R.color.c_background), ContextCompat.getColor(mContext, R.color.c_background)); ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f).setDuration(0); - animator.setStartDelay(600); + animator.setStartDelay(1200); animator.addUpdateListener(animation -> { float v = (float) animation.getAnimatedValue(); @@ -269,25 +272,15 @@ class homeViewController return; } - autoCompleteAdapter suggestionAdapter = new autoCompleteAdapter(mContext, R.layout.hint_view, (ArrayList) suggestions.clone()); int width = Math.round(helperMethod.screenWidth()); mSearchbar.setThreshold(2); mSearchbar.setAdapter(suggestionAdapter); - mSearchbar.setDropDownVerticalOffset(helperMethod.pxFromDp(8)); + mSearchbar.setDropDownVerticalOffset(helperMethod.pxFromDp(0)); mSearchbar.setDropDownWidth(width); - mSearchbar.setDropDownHeight(WRAP_CONTENT); - - Drawable drawable; - Resources res = mContext.getResources(); - try { - drawable = Drawable.createFromXml(res, res.getXml(R.xml.hox_rounded_corner_suggestion)); - mSearchbar.setDropDownBackgroundDrawable(drawable); - mSearchbar.setOutlineProvider(ViewOutlineProvider.BACKGROUND); - mSearchbar.setClipToOutline(true); - } catch (Exception ignored) { - } + mSearchbar.setDropDownBackgroundDrawable(new ColorDrawable(mContext.getResources().getColor(R.color.c_background))); + mSearchbar.setDropDownHeight(helperMethod.getScreenHeight(mContext)*75/100); mSearchbar.setInputType(EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS); } @@ -297,18 +290,23 @@ class homeViewController mLoading.setAnimation(helperMethod.getRotationAnimation()); mLoadingText.setAlpha(0); mLoadingText.setVisibility(View.VISIBLE); - mLoadingText.animate().alpha(1); + mLoadingText.animate().setStartDelay(0).alpha(1); mConnectButton.setClickable(false); mGatewaySplash.setClickable(false); + mBlocker.setClickable(true); + mBlocker.setFocusable(true); } void initHomePage(){ mConnectButton.setClickable(false); mGatewaySplash.setClickable(false); - mConnectButton.animate().alpha(0.4f).withEndAction(this::initSplashLoading); - mGatewaySplash.animate().alpha(0.4f); + mConnectButton.animate().setDuration(200).alpha(0.4f).withEndAction(() -> { + mCopyright.setVisibility(View.GONE); + initSplashLoading(); + }); + mGatewaySplash.animate().setDuration(200).alpha(0.4f); } private void initSplashScreen(){ @@ -327,7 +325,7 @@ class homeViewController void initProxyLoading(Callable logs){ this.mLogs = logs; - if(mSplashScreen.getAlpha()==1){ + if(mSplashScreen.getVisibility()==View.VISIBLE){ new Thread(){ public void run(){ AppCompatActivity temp_context = mContext; @@ -365,9 +363,9 @@ class homeViewController } private void splashScreenDisable(){ mTopBar.setAlpha(1); - if(mSplashScreen.getAlpha()>=1) + if(mSplashScreen.getVisibility()==View.VISIBLE) { - mSplashScreen.animate().setDuration(300).setStartDelay(500).alpha(0).withEndAction((this::triggerPostUI)); + mSplashScreen.animate().setStartDelay(1000).setDuration(500).alpha(0).withEndAction((this::triggerPostUI)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { initStatusBarColor(); } @@ -516,7 +514,7 @@ class homeViewController private Handler searchBarUpdateHandler = new Handler(); private String handlerLocalUrl = ""; - void onUpdateSearchBar(String url,boolean showProtocol){ + void onUpdateSearchBar(String url,boolean showProtocol, boolean pClearText){ int delay = 0; handlerLocalUrl = url; @@ -528,7 +526,7 @@ class homeViewController searchBarUpdateHandler.postDelayed(() -> { searchBarUpdateHandler.removeMessages(100); - triggerUpdateSearchBar(handlerLocalUrl,showProtocol); + triggerUpdateSearchBar(handlerLocalUrl,showProtocol, pClearText); }, delay); } @@ -562,7 +560,22 @@ class homeViewController } } - private void triggerUpdateSearchBar(String url, boolean showProtocol){ + public void onUpdateSearchEngineBar(boolean pStatus) + { + mSearchEngineBar.animate().cancel(); + if(pStatus){ + mSearchEngineBar.setAlpha(0f); + mSearchEngineBar.animate().setDuration(300).alpha(1); + mSearchEngineBar.setVisibility(View.VISIBLE); + }else { + mSearchEngineBar.animate().setDuration(300).alpha(0).withEndAction(() -> { + mSearchEngineBar.setAlpha(0f); + mSearchEngineBar.setVisibility(View.GONE); + }); + } + } + + private void triggerUpdateSearchBar(String url, boolean showProtocol, boolean pClearText){ if (mSearchbar == null || url==null) { return; @@ -608,22 +621,10 @@ class homeViewController void onNewTab(boolean keyboard,boolean isKeyboardOpen){ if(keyboard){ - - if(!isKeyboardOpen){ - final Handler handler = new Handler(); - handler.postDelayed(() -> - { - InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); - Objects.requireNonNull(imm).toggleSoftInput(InputMethodManager.RESULT_UNCHANGED_SHOWN, 0); - }, 250); - } - mSearchbar.requestFocus(); mSearchbar.selectAll(); } } - Handler mProgressHandler = new Handler(); - Runnable mProgressBarRunnable = null; void onUpdateLogs(String log){ mLoadingText.setText(log); @@ -635,62 +636,59 @@ class homeViewController } void onProgressBarUpdate(int value){ - if(mProgressBarRunnable!=null){ - mProgressHandler.removeCallbacks(mProgressBarRunnable); + + mProgressBar.setAlpha(1f); + mProgressBar.setVisibility(View.VISIBLE); + + ProgressBarAnimation mProgressAnimation = new ProgressBarAnimation(mProgressBar, 1000); + mProgressAnimation.setProgress(value*100); + } + + public class ProgressBarAnimation extends Animation { + private ProgressBar mProgressBar; + private int mTo; + private int mFrom; + private long mStepDuration; + + /** + * @param fullDuration - time required to fill progress from 0% to 100% + */ + public ProgressBarAnimation(ProgressBar progressBar, long fullDuration) { + super(); + mProgressBar = progressBar; + mStepDuration = fullDuration / progressBar.getMax(); } - if(mSplashScreen.getAlpha()>0){ - mProgressBar.setProgress(value*100); - } - if(value==100){ - mProgressBar.setAlpha(1f); - setProgressAnimate(mProgressBar,value); - - mProgressBarRunnable = () -> { - animation.removeAllListeners(); - animation.end(); - animation.cancel(); + public void setProgress(int progress) { + if(progress == 10000){ + mProgressBar.animate().setStartDelay(100).alpha(0); + }else { mProgressBar.animate().cancel(); - mProgressBar.animate().alpha(0); - }; - mProgressHandler.postDelayed(mProgressBarRunnable, 250); + mProgressBar.setAlpha(1); + } - return; + if (progress < 0) { + progress = 0; + } + + if (progress > mProgressBar.getMax()) { + progress = mProgressBar.getMax(); + } + + mTo = progress; + + mFrom = mProgressBar.getProgress(); + setDuration(Math.abs(mTo - mFrom) * mStepDuration); + mProgressBar.startAnimation(this); } - else if(mSplashScreen.getAlpha()==0) { - mProgressBar.setVisibility(View.VISIBLE); - mProgressBar.animate().cancel(); - mProgressBar.animate().setStartDelay(50).alpha(1); + + @Override + protected void applyTransformation(float interpolatedTime, Transformation t) { + float value = mFrom + (mTo - mFrom) * interpolatedTime; + mProgressBar.setProgress((int) value); } - setProgressAnimate(mProgressBar,value); } - - private ObjectAnimator animation = null; - private void setProgressAnimate(ProgressBar pb, int progressTo) - { - int progress = 0; - if((progressTo) - { - mTopBar.setClickable(!status); - disableEnableControls(!status, mTopBar); - mTopBar.setAlpha(value); - mBannerAds.setVisibility(View.GONE); + if(status){ + this.mBlockerFullSceen.setVisibility(View.VISIBLE); + this.mBlockerFullSceen.setAlpha(0f); + this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(1).withEndAction(() -> { + mTopBar.setClickable(!status); + disableEnableControls(!status, mTopBar); + mTopBar.setAlpha(value); + mBannerAds.setVisibility(View.GONE); + + defaultFlag = mContext.getWindow().getDecorView().getSystemUiVisibility(); + final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; + mContext.getWindow().getDecorView().setSystemUiVisibility(flags); - if(status){ mProgressBar.setVisibility(View.GONE); mTopBar.setVisibility(View.GONE); mBannerAds.setVisibility(View.GONE); @@ -755,38 +753,43 @@ class homeViewController com.darkweb.genesissearchengine.constants.status.sFullScreenBrowsing = false; initTopBarPadding(); - this.mBlocker.animate().setStartDelay(250).setDuration(200).alpha(0).withEndAction(() -> { - mBlocker.setVisibility(View.GONE); + this.mBlockerFullSceen.animate().setStartDelay(100).setDuration(200).alpha(0).withEndAction(() -> { + mBlockerFullSceen.setVisibility(View.GONE); }); + }); + } + else { + mTopBar.setClickable(!status); + disableEnableControls(!status, mTopBar); + mTopBar.setAlpha(value); + mBannerAds.setVisibility(View.GONE); + + mProgressBar.setVisibility(View.VISIBLE); + mTopBar.setVisibility(View.VISIBLE); + mBannerAds.setVisibility(View.GONE); + mEvent.invokeObserver(Collections.singletonList(!isLandscape), enums.etype.on_init_ads); + + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mWebviewContainer.getLayoutParams(); + params.setMargins(0, 0, 0,0); + mWebviewContainer.setLayoutParams(params); + + ViewGroup.MarginLayoutParams params1 = (ViewGroup.MarginLayoutParams) mWebviewContainer.getLayoutParams(); + params1.setMargins(0, 0, 0,helperMethod.pxFromDp(0)); + mGeckoView.setLayoutParams(params1); + + com.darkweb.genesissearchengine.constants.status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true)); + initTopBarPadding(); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + }else { + mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); } - else { - mProgressBar.setVisibility(View.VISIBLE); - mTopBar.setVisibility(View.VISIBLE); - mBannerAds.setVisibility(View.GONE); - mEvent.invokeObserver(Collections.singletonList(!isLandscape), enums.etype.on_init_ads); - ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mWebviewContainer.getLayoutParams(); - params.setMargins(0, 0, 0,0); - mWebviewContainer.setLayoutParams(params); - - ViewGroup.MarginLayoutParams params1 = (ViewGroup.MarginLayoutParams) mWebviewContainer.getLayoutParams(); - params1.setMargins(0, 0, 0,helperMethod.pxFromDp(60)); - mGeckoView.setLayoutParams(params1); - - com.darkweb.genesissearchengine.constants.status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true)); - initTopBarPadding(); - - this.mBlocker.animate().setStartDelay(250).setDuration(200).alpha(0).withEndAction(() -> { - mBlocker.setVisibility(View.GONE); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - }else { - mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - } - }); - } - }, 200); + this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(0).withEndAction(() -> { + mBlockerFullSceen.setVisibility(View.GONE); + }); + } } @@ -849,6 +852,9 @@ class homeViewController } } } + if(msg.what == messages.MESSAGE_PROGRESSBAR_VALIDATE) + { + } } }; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java index f65952b1..4e94ba50 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogController.java @@ -1,21 +1,21 @@ package com.darkweb.genesissearchengine.appManager.orbotLogManager; import android.os.Bundle; +import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.view.animation.AnimationUtils; import android.view.animation.LayoutAnimationController; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; -import androidx.core.view.MotionEventCompat; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.appManager.settingManager.logManager.settingLogController; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; @@ -36,19 +36,22 @@ public class orbotLogController extends AppCompatActivity { private TextView mLogs; private boolean mActivityClosed = false; - int mLogCounter = 0; + private int mLogCounter = 0; + private GestureDetector mSwipeDirectionDetector; /* INITIALIZATIONS */ @Override protected void onCreate(Bundle savedInstanceState) { + overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse); + super.onCreate(savedInstanceState); setContentView(R.layout.orbot_log_view); viewsInitializations(); onUpdateLogs(); initializeLogs(); - onScrollListener(); + onInitListener(); } public void viewsInitializations() { @@ -60,6 +63,7 @@ public class orbotLogController extends AppCompatActivity { activityContextManager.getInstance().setOrbotLogController(this); mOrbotViewController = new orbotLogViewController(this, mLogs, mRecycleView); mOrbotModel = new orbotLogModel(); + } public void initializeLogs(){ @@ -90,7 +94,7 @@ public class orbotLogController extends AppCompatActivity { /* LISTENERS */ - private void onScrollListener(){ + private void onInitListener(){ mMainScroll.getViewTreeObserver().addOnScrollChangedListener(() -> { int scrollY = mMainScroll.getScrollY(); if(scrollY>0){ @@ -103,6 +107,18 @@ public class orbotLogController extends AppCompatActivity { mFloatingScroller.animate().alpha(0).withEndAction(() -> mFloatingScroller.setVisibility(View.GONE)); } }); + + mSwipeDirectionDetector=new GestureDetector(this,new SimpleGestureFilter(){ + + @Override + public boolean onSwipe(Direction direction) { + if (direction==Direction.left || direction==Direction.right){ + finish(); + overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out); + } + return true; + } + }); } public void onUpdateLogs(){ @@ -161,6 +177,14 @@ public class orbotLogController extends AppCompatActivity { } } + /* Helper Methods */ + + public void onClose(View view){ + finish(); + overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out); + mActivityClosed = true; + } + /* LOCAL OVERRIDES */ @Override @@ -178,42 +202,13 @@ public class orbotLogController extends AppCompatActivity { @Override public void onBackPressed() { - finish(); - mActivityClosed = true; + onClose(null); } - /* Helper Methods */ - - public void openLogSettings(View view) { - helperMethod.openActivity(settingLogController.class, constants.CONST_LIST_HISTORY, this,true); - } - - public void onClose(View view){ - finish(); - mActivityClosed = true; - } - - float oldTouchValue; @Override public boolean dispatchTouchEvent(MotionEvent event) { - - int action=event.getAction(); - - switch (action) { - case (MotionEvent.ACTION_DOWN): - oldTouchValue = event.getX(); - case (MotionEvent.ACTION_MOVE): - float currentX = event.getX(); - if (oldTouchValue < currentX-100) - { - finish(); - }else { - return super.onTouchEvent(event); - } - default: - return super.onTouchEvent(event); - } - + mSwipeDirectionDetector.onTouchEvent(event); + return super.dispatchTouchEvent(event); } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java index fa72d020..87e4b184 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java @@ -1,22 +1,20 @@ package com.darkweb.genesissearchengine.appManager.orbotManager; import android.os.Bundle; +import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.widget.LinearLayout; import androidx.appcompat.app.AppCompatActivity; -import androidx.core.view.MotionEventCompat; - import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController; import com.darkweb.genesissearchengine.appManager.helpManager.helpController; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController; -import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.pluginManager.pluginController; @@ -35,16 +33,20 @@ public class orbotController extends AppCompatActivity { private SwitchMaterial mBridgeSwitch; private SwitchMaterial mVpnSwitch; private LinearLayout mCustomizableBridgeMenu; + private GestureDetector mSwipeDirectionDetector; /* INITIALIZATIONS */ @Override protected void onCreate(Bundle savedInstanceState) { + overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out); + pluginController.getInstance().onCreate(this); super.onCreate(savedInstanceState); setContentView(R.layout.orbot_settings_view); viewsInitializations(); + onInitListener(); } public void viewsInitializations() { @@ -63,6 +65,19 @@ public class orbotController extends AppCompatActivity { /* LISTENERS */ + private void onInitListener(){ + mSwipeDirectionDetector=new GestureDetector(this,new SimpleGestureFilter(){ + + @Override + public boolean onSwipe(Direction direction) { + if (direction==Direction.left || direction==Direction.right){ + onClose(null); + } + return true; + } + }); + } + public class orbotModelCallback implements eventObserver.eventListener{ @Override public Object invokeObserver(List data, Object e_type) @@ -87,6 +102,11 @@ public class orbotController extends AppCompatActivity { dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,status.sBridgeVPNStatus)); } + public void onClose(View view){ + finish(); + overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse); + } + /* LOCAL OVERRIDES */ @Override @@ -105,33 +125,13 @@ public class orbotController extends AppCompatActivity { @Override public void onBackPressed() { - finish(); + onClose(null); } - public void onClose(View view){ - finish(); - } - - float oldTouchValue; @Override public boolean dispatchTouchEvent(MotionEvent event) { - - int action=event.getAction(); - - switch (action) { - case (MotionEvent.ACTION_DOWN): - oldTouchValue = event.getX(); - case (MotionEvent.ACTION_MOVE): - float currentX = event.getX(); - if (oldTouchValue < currentX-100) - { - finish(); - }else { - return super.onTouchEvent(event); - } - default: - return super.onTouchEvent(event); - } - + mSwipeDirectionDetector.onTouchEvent(event); + return super.dispatchTouchEvent(event); } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java index 9a86d2d2..8f16ab4a 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java @@ -122,11 +122,8 @@ public class tabController extends AppCompatActivity public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { int position = viewHolder.getAdapterPosition(); - onClearTabBackup(); - onRemoveTab(position); - mTabAdapter.notifyItemRemoved(position); - initTabCount(); + onRemoveView(position); } @Override @@ -154,9 +151,8 @@ public class tabController extends AppCompatActivity } public void onRemoveView(int pIndex){ - mHomeController.onCloseCurrentTab(mListModel.getList().get(pIndex).getSession()); - onClearTabBackup(); - //onRemoveTab(pIndex); + onRemoveTab(pIndex); + mListModel.getList().remove(pIndex); mTabAdapter.notifyItemRemoved(pIndex); onShowUndoDialog(); } @@ -167,9 +163,17 @@ public class tabController extends AppCompatActivity mHomeController.initTabCount(); } + public void onClose(){ + onClearTabBackup(); + if(mListModel.getList().size()<=0){ + mHomeController.onNewTab(false, false); + } + finish(); + } + public void onNewTabInvoked(){ mHomeController.onNewTab(true,false); - finish(); + onClose(); overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); } @@ -213,11 +217,11 @@ public class tabController extends AppCompatActivity onNewTabInvoked(); } else if(pView.getId() == R.id.pCloseTab){ - mListModel.getList().clear(); mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_DISMISS_MENU, null); - initTabCount(); - mRecycleView.animate().setDuration(300).alpha(0).withEndAction(() -> mTabAdapter.notifyDataSetChanged()); - onShowUndoDialog(); + for(int mCounter=0;mCounter mToastLayoutRoot.animate().alpha(0).withEndAction(() -> mToastLayoutRoot.setVisibility(View.GONE)), 1500); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java index 89e75efc..367fb622 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java @@ -6,4 +6,5 @@ public class messages public final static int MESSAGE_UPDATE_LOADING_TEXT =1; public final static int MESSAGE_ON_URL_LOAD =2; + public final static int MESSAGE_PROGRESSBAR_VALIDATE =3; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java index 3c5d4b2e..bf41640f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java @@ -116,10 +116,12 @@ public class suggestionDataModel { addSuggenstions("https://wowhead.com","Wow Head",true); addSuggenstions("https://bing.com","Bing",true); addSuggenstions("https://google.com","Google",true); - addSuggenstions("https://boogle.store","Genesis Search",true); + addSuggenstions("https://genesis.onion","Genesis Search",true); } private void addSuggenstions(String url, String title,boolean isLoading){ + url = url.replace("boogle.store","genesis.onion"); + title = title.replace("boogle.store","Genesis Search").replace("boogle","genesis"); url = helperMethod.removeLastSlash(url); if(url.length()>1500 || title.equals("$TITLE") || title.equals("loading")){ return; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java index d6a8272c..98942660 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java @@ -61,6 +61,7 @@ class tabDataModel int size = mTabs.size(); for(int counter = 0; counter< size; counter++){ mTabs.get(0).getSession().stop(); + mTabs.get(0).getSession().closeSession(); mTabs.remove(0); } if(mTabs.size()>0){ @@ -68,6 +69,7 @@ class tabDataModel } databaseController.getInstance().execSQL("DELETE FROM tab WHERE 1",null); + } void closeTab(geckoSession mSession) { @@ -158,7 +160,7 @@ class tabDataModel } catch (Throwable throwable) { throwable.printStackTrace(); } - }, 100); + }, 500); } } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/SimpleGestureFilter.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/SimpleGestureFilter.java new file mode 100644 index 00000000..4b73520f --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/SimpleGestureFilter.java @@ -0,0 +1,102 @@ +package com.darkweb.genesissearchengine.helperManager; + +import android.view.GestureDetector.SimpleOnGestureListener; +import android.view.MotionEvent; + +public class SimpleGestureFilter extends SimpleOnGestureListener{ + + @Override + public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { + + float x1 = e1.getX(); + float y1 = e1.getY(); + + float x2 = e2.getX(); + float y2 = e2.getY(); + + Direction direction = getDirection(x1,y1,x2,y2); + return onSwipe(direction); + } + + public boolean onSwipe(Direction direction){ + return false; + } + + /** + * Given two points in the plane p1=(x1, x2) and p2=(y1, y1), this method + * returns the direction that an arrow pointing from p1 to p2 would have. + * @param x1 the x position of the first point + * @param y1 the y position of the first point + * @param x2 the x position of the second point + * @param y2 the y position of the second point + * @return the direction + */ + public Direction getDirection(float x1, float y1, float x2, float y2){ + double angle = getAngle(x1, y1, x2, y2); + return Direction.get(angle); + } + + /** + * + * Finds the angle between two points in the plane (x1,y1) and (x2, y2) + * The angle is measured with 0/360 being the X-axis to the right, angles + * increase counter clockwise. + * + * @param x1 the x position of the first point + * @param y1 the y position of the first point + * @param x2 the x position of the second point + * @param y2 the y position of the second point + * @return the angle between two points + */ + public double getAngle(float x1, float y1, float x2, float y2) { + + double rad = Math.atan2(y1-y2,x2-x1) + Math.PI; + return (rad*180/Math.PI + 180)%360; + } + + + public enum Direction{ + up, + down, + left, + right; + + /** + * Returns a direction given an angle. + * Directions are defined as follows: + * + * Up: [45, 135] + * Right: [0,45] and [315, 360] + * Down: [225, 315] + * Left: [135, 225] + * + * @param angle an angle from 0 to 360 - e + * @return the direction of an angle + */ + public static Direction get(double angle){ + if(inRange(angle, 45, 135)){ + return Direction.up; + } + else if(inRange(angle, 0,45) || inRange(angle, 315, 360)){ + return Direction.right; + } + else if(inRange(angle, 225, 315)){ + return Direction.down; + } + else{ + return Direction.left; + } + + } + + /** + * @param angle an angle + * @param init the initial bound + * @param end the final bound + * @return returns true if the given angle is in the interval [init, end). + */ + private static boolean inRange(double angle, float init, float end){ + return (angle >= init) && (angle < end); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/autoCompleteAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/autoCompleteAdapter.java index 72d3bc87..e7e2d057 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/autoCompleteAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/autoCompleteAdapter.java @@ -8,6 +8,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Filter; +import android.widget.ImageButton; import android.widget.TextView; import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; import com.darkweb.genesissearchengine.constants.strings; @@ -39,6 +40,7 @@ public class autoCompleteAdapter extends ArrayAdapter { TextView customerNameLabel = v.findViewById(R.id.hintCompletionTitle); TextView myTv = v.findViewById( R.id.hintCompletionUrl); + ImageButton mMoveURL = v.findViewById( R.id.pMoveURL); if (customerNameLabel != null) { if(customer.getHeader().equals(strings.GENERIC_EMPTY_STR)){ @@ -47,6 +49,7 @@ public class autoCompleteAdapter extends ArrayAdapter { customerNameLabel.setText(customer.getHeader()); } myTv.setText(customer.getDescription()); + mMoveURL.setTag(customer.getDescription()); } } return v; @@ -72,18 +75,14 @@ public class autoCompleteAdapter extends ArrayAdapter { if(constraint != null && !constraint.equals("about:blank")) { suggestions.clear(); for (historyRowModel customer : itemsAll) { - if(suggestions.size()>10){ + if(suggestions.size()>4){ break; } - - if(!customer.getHeader().equals("$TITLE") && customer.getHeader().length()>2 && customer.getDescription().toLowerCase().length()>2 && (customer.getHeader().toLowerCase().contains(constraint.toString().toLowerCase()) || customer.getDescription().toLowerCase().contains(constraint.toString().toLowerCase()))){ + if(!customer.getHeader().equals("$TITLE") && customer.getHeader().length()>2 && customer.getDescription().toLowerCase().length()>2 && (customer.getHeader().toLowerCase().contains(constraint.toString().toLowerCase()) || constraint.toString().toLowerCase().toLowerCase().contains(customer.getHeader()) || constraint.toString().toLowerCase().contains(customer.getDescription().toLowerCase()) || customer.getDescription().toLowerCase().contains(constraint.toString().toLowerCase()))){ Log.i("memememe:","memememe:"+constraint.toString().toLowerCase().replace("https://","").replace("http://","")); Log.i("memememe1:","memememe2:"+customer.getDescription().replace("https://","").replace("http://","")); - - if(!constraint.toString().toLowerCase().replace("https://","").replace("http://","").equals(customer.getDescription().replace("https://","").replace("http://",""))){ - suggestions.add(customer); - } + suggestions.add(customer); } } FilterResults filterResults = new FilterResults(); @@ -98,7 +97,7 @@ public class autoCompleteAdapter extends ArrayAdapter { protected void publishResults(CharSequence constraint, FilterResults results) { try{ - if(results != null && results.count > 0) { + if(results != null) { ArrayList filteredList = (ArrayList)((ArrayList)results.values).clone(); clear(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java index 7a2d3e9e..f8247d52 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java @@ -246,6 +246,16 @@ public class helperMethod context.startActivity(myIntent); } + public static void openActivityReverse( Class cls,int type,AppCompatActivity context,boolean animation){ + Intent myIntent = new Intent(context, cls); + myIntent.putExtra(keys.PROXY_LIST_TYPE, type); + if(!animation){ + myIntent.addFlags(FLAG_ACTIVITY_NO_ANIMATION); + } + + context.startActivity(myIntent); + } + public static void restartActivity( Intent pIntent, AppCompatActivity pContext){ pContext.finish(); pContext.startActivity(pIntent); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java index c506eb50..7ff97382 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java @@ -162,9 +162,9 @@ class orbotManager mLogsStarted = true; } else { - logs = logs.replaceAll("[^a-zA-Z0-9%\\s+]", ""); - logs = helperMethod.capitalizeString(logs); - logs = logs.replace("(","").replace(":","_FERROR_").replace("NOTICE","").replace(")","").replace("_FERROR_",""); + // logs = logs.replaceAll("[^a-zA-Z0-9%\\s+]", ""); + // logs = helperMethod.capitalizeString(logs); + // logs = logs.replace("(","").replace(":","_FERROR_").replace("NOTICE","").replace(")","").replace("_FERROR_",""); } diff --git a/app/src/main/res/anim/push_anim_in.xml b/app/src/main/res/anim/push_anim_in.xml new file mode 100644 index 00000000..2ccb33fb --- /dev/null +++ b/app/src/main/res/anim/push_anim_in.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/push_anim_in_reverse.xml b/app/src/main/res/anim/push_anim_in_reverse.xml new file mode 100644 index 00000000..4554d2dd --- /dev/null +++ b/app/src/main/res/anim/push_anim_in_reverse.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/push_anim_out.xml b/app/src/main/res/anim/push_anim_out.xml new file mode 100644 index 00000000..1595e488 --- /dev/null +++ b/app/src/main/res/anim/push_anim_out.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/push_anim_out_reverse.xml b/app/src/main/res/anim/push_anim_out_reverse.xml new file mode 100644 index 00000000..da509840 --- /dev/null +++ b/app/src/main/res/anim/push_anim_out_reverse.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/slide_out.xml b/app/src/main/res/anim/slide_out.xml index 23376ce4..f7efa8f9 100755 --- a/app/src/main/res/anim/slide_out.xml +++ b/app/src/main/res/anim/slide_out.xml @@ -1,6 +1,8 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_side_item_suggestions.xml b/app/src/main/res/custom-xml/generic/xml/gx_side_item_suggestions.xml index 1b325f9b..163654fc 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_side_item_suggestions.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_side_item_suggestions.xml @@ -14,10 +14,10 @@ android:bottom="0dp"> - + + android:color="@color/c_edittext_background_dark"/> diff --git a/app/src/main/res/custom-xml/history/xml/hx_menu_popup.xml b/app/src/main/res/custom-xml/history/xml/hx_menu_popup.xml index ee8ce56c..0cf0ba79 100644 --- a/app/src/main/res/custom-xml/history/xml/hx_menu_popup.xml +++ b/app/src/main/res/custom-xml/history/xml/hx_menu_popup.xml @@ -1,6 +1,7 @@ + @@ -16,6 +17,9 @@ android:topLeftRadius="6dp" android:topRightRadius="6dp"/> + #000000 + 5 + 3 @@ -39,6 +43,8 @@ android:endColor="@color/c_alert_background" android:startColor="@color/c_alert_background" android:type="linear" /> + + diff --git a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_suggestion.xml b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_suggestion.xml index bfae54e2..ca29083d 100644 --- a/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_suggestion.xml +++ b/app/src/main/res/custom-xml/home/xml/hox_rounded_corner_suggestion.xml @@ -1,5 +1,5 @@ - + - + - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_baseline_search.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_search.xml similarity index 100% rename from app/src/main/res/drawable/ic_baseline_search.xml rename to app/src/main/res/custom-xml/images/xml/ic_baseline_search.xml diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_select_url.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_select_url.xml new file mode 100644 index 00000000..5e3792ee --- /dev/null +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_select_url.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable-hdpi/genesis_logo_bordered.png b/app/src/main/res/drawable-hdpi/genesis_logo_bordered.png index 0c42bd0a..1666f069 100644 Binary files a/app/src/main/res/drawable-hdpi/genesis_logo_bordered.png and b/app/src/main/res/drawable-hdpi/genesis_logo_bordered.png differ diff --git a/app/src/main/res/drawable-hdpi/glide.png b/app/src/main/res/drawable-hdpi/glide.png index b9af9dbf..454df598 100644 Binary files a/app/src/main/res/drawable-hdpi/glide.png and b/app/src/main/res/drawable-hdpi/glide.png differ diff --git a/app/src/main/res/drawable-hdpi/sheild_logo_bordered.png b/app/src/main/res/drawable-hdpi/sheild_logo_bordered.png index bdc8df6b..4c476967 100644 Binary files a/app/src/main/res/drawable-hdpi/sheild_logo_bordered.png and b/app/src/main/res/drawable-hdpi/sheild_logo_bordered.png differ diff --git a/app/src/main/res/drawable-hdpi/wall2.png b/app/src/main/res/drawable-hdpi/wall2.png index 0a9f31e2..f1ec8460 100644 Binary files a/app/src/main/res/drawable-hdpi/wall2.png and b/app/src/main/res/drawable-hdpi/wall2.png differ diff --git a/app/src/main/res/drawable-hdpi/wall4.png b/app/src/main/res/drawable-hdpi/wall4.png new file mode 100644 index 00000000..0a9f31e2 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/wall4.png differ diff --git a/app/src/main/res/layouts/alert/layout/popup_search_engine.xml b/app/src/main/res/layouts/alert/layout/popup_search_engine.xml new file mode 100644 index 00000000..8a6c3817 --- /dev/null +++ b/app/src/main/res/layouts/alert/layout/popup_search_engine.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/other/layout/hint_view.xml b/app/src/main/res/layouts/other/layout/hint_view.xml index 8f1ae23d..722b9d45 100644 --- a/app/src/main/res/layouts/other/layout/hint_view.xml +++ b/app/src/main/res/layouts/other/layout/hint_view.xml @@ -1,50 +1,77 @@ - + + + android:layout_weight="1" + android:paddingTop="10dp" + android:paddingBottom="10dp"> - + android:text="@string/GENERAL_DEFAULT_HINT_SUGGESTION" + android:textColor="@color/c_text_v1" + android:textSize="14sp" /> - + android:singleLine="true" + android:text="@string/GENERAL_DEFAULT_HINT_SUGGESTION" + android:textColor="@color/c_text_v6" + android:textSize="12.5sp" /> - + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/other/layout/home_view.xml b/app/src/main/res/layouts/other/layout/home_view.xml index e49a3c38..5cfea638 100644 --- a/app/src/main/res/layouts/other/layout/home_view.xml +++ b/app/src/main/res/layouts/other/layout/home_view.xml @@ -24,13 +24,13 @@ android:layout_height="wrap_content" android:background="@color/c_background_keyboard" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" - android:translationZ="10dp"> + android:translationZ="3dp"> + + - + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@+id/pAdView" /> + \ No newline at end of file diff --git a/app/src/main/res/layouts/setting/layout/setting.xml b/app/src/main/res/layouts/setting/layout/setting.xml index db27fe7b..d9d4a3c9 100644 --- a/app/src/main/res/layouts/setting/layout/setting.xml +++ b/app/src/main/res/layouts/setting/layout/setting.xml @@ -213,7 +213,7 @@ android:layout_marginStart="5dp" android:layout_marginEnd="5dp" app:tint="@color/c_icon_tint" - android:src="@drawable/ic_baseline_search" + android:src="@xml/ic_baseline_search" android:contentDescription="@string/GENERAL_TODO" /> #2c2b31 #2c2b31 #3c3946 + #24222a #00000000 #00000000 #00000000 @@ -69,7 +70,7 @@ #0066FF #fdfeff #4d88ff - #212d45 + #0A1727 #eef1f7 #eef1f7 #3385ff diff --git a/app/src/main/res/values-night/strings.xml b/app/src/main/res/values-night/strings.xml index 5fb277c9..74475738 100644 --- a/app/src/main/res/values-night/strings.xml +++ b/app/src/main/res/values-night/strings.xml @@ -4,6 +4,7 @@ Genesis Search or type web address Find in page + Search Engine https://genesis.onion \u0020\u0020\u0020Opps! Some Thing Went Wrong TODO diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index dcd0da5b..ef7f9a7e 100755 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -45,6 +45,7 @@ #000000 #ffffff #f1f3f4 + #f5f5f5 #610505 #b3b3b3 #ffffff @@ -70,8 +71,8 @@ #0066FF #fdfeff #4d88ff - #111722 - #192234 + #0A1727 + #191919 #eef1f7 #eef1f7 #3385ff diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a4f1aaba..86aebeff 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,6 +4,7 @@ Genesis Search or type web address Find in page + Search Engine https://genesis.onion \u0020\u0020\u0020Opps! Some Thing Went Wrong TODO @@ -312,7 +313,7 @@ 1 Connect - Idle | Waiting to start + Idle | Genesis on standby at the moment ~ Genesis on standby at the moment