From 2d40f80bc1a01dc49e62e991ad2e555a20071463 Mon Sep 17 00:00:00 2001 From: msmannan00 Date: Sat, 15 May 2021 23:56:17 +0500 Subject: [PATCH] Bug Fixes Bug Fixes --- Release Checklist.xlsx | Bin 9087 -> 9123 bytes app/src/main/AndroidManifest.xml | 6 +- .../externalNavigationController.java | 77 ++++++++++ .../externalShortcuts.java | 56 +------ .../orbotLogManager/orbotLogAdapter.java | 2 +- .../orbotLogManager/orbotLogController.java | 139 ++++++++++++------ .../orbotLogManager/orbotLogEnums.java | 3 +- .../orbotLogManager/orbotLogModel.java | 24 ++- .../orbotLogViewController.java | 21 ++- .../constants/constants.java | 4 +- .../genesissearchengine/constants/enums.java | 6 + .../externalNavigationController.java | 90 ------------ .../xml/ic_baseline_shortcut_erase_back.xml | 12 ++ .../res/custom-xml/generic/xml/shortcuts.xml | 18 +-- .../images/xml/ic_baseline_shortcut_erase.xml | 7 +- .../layout/popup_data_cleared_shortcut.xml | 4 +- .../xml/ic_baseline_shortcut_add_new_back.xml | 12 ++ .../xml/ic_baseline_shortcut_cross_back.xml | 12 ++ .../orbotLog/layout/orbot_log_view.xml | 11 +- app/src/main/res/values/strings.xml | 2 +- progress.txt | 7 +- 21 files changed, 286 insertions(+), 227 deletions(-) create mode 100644 app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java rename app/src/main/java/com/darkweb/genesissearchengine/{ => appManager}/externalNavigationManager/externalShortcuts.java (76%) delete mode 100644 app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalNavigationController.java create mode 100644 app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml create mode 100644 app/src/main/res/layouts/history/xml/ic_baseline_shortcut_add_new_back.xml create mode 100644 app/src/main/res/layouts/history/xml/ic_baseline_shortcut_cross_back.xml diff --git a/Release Checklist.xlsx b/Release Checklist.xlsx index 0a63db35233ba8de448f7006c56ed5bc3950838c..a28794bb2eea31782199855fb9eea35575e1cc93 100644 GI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U23`$tDO9owm&y;rS>H~y&OOL zN#?VafE~6~MT)O;@`+9tSw@oi%ni`rf*&-xj|^LW=Or%;2NFsmJD*D_pDpkUgi=VU z9l)k!g%NxH$jdS(Pjmt^{;y-P_dtQ+ODKDzN6{G=sh zv(J4tg=}xv43aJOlLhC*_rL}o&jSk-NPwZEfgWKR+v4o**qg5Dm-ua#oZONKmTQ=U z{XCr|d)V5dRru%;Cxwgt651^Z6hiSmg|HdjK3px*CUSl4L}q6qJ;FT$uCEIpfGOyf zjNTS$2ORB|YvagHWjke8i?oSCk$>Yeksg6W`T!PrS`u^;_NOOu5)apC^Mo2FXBs^M zY4icC@w6n+2(x$n*jsQ;#_rK|WA6iq7a;-~`=xvJ(`CT{jSnCiga~LJhR|4WK;r|5 z1|b3(3WtgTW?|6*ky~$l(t4n61%+D@VhE7}OI>OHr} z2Dybp2UWEZM1?Wo>0*#uWL7=5Xd{^FJ-2|P>wrhtp~I?rZh*F#Elw6(v#NQ4HzshVnQmHkC=m%0&}l9Wwee5L%}TQ|lRCsNKtPd(E|eMA+vzc~`nX8#8Qhg1zlN zZIAy@@BCB@{+7Sml*%43hcFz{7_Gaue0F6-@r(gU;0=kr%$92_*vEYS)$6jH`2mxW z0~7_)+A)Spv)~&&0S8!7d<)6lR+A(hCI$C7dMP)PPaQFTU1JsZ;b`~RaPh(SfKx&i zSb^t~dyYF`Y(^qFBc<=F`?aKne^sDA3+vno#`X^Bjl&}ZTtA#SB)#(?MeVDGAWp_z3gOsL<)XaK?jOnxDpEq{FVp*D0F#je6ti3&I|BrLk0uV2n<0S-&8LP-)dK(kJd-6NR{;%^eIh^s z(UZO+ARNh5TxswC004La000yK000000000000000h8mNu8WxifBM=+X+A)Sp0RRAP m0ssIJ0000000000000000H~8YBR&BtlX@c~2I(LG0001xzhR;P diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bc9f8b8d..24ba4b5a 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -101,7 +101,7 @@ android:windowSoftInputMode="adjustPan" /> - - diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java new file mode 100644 index 00000000..17796412 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java @@ -0,0 +1,77 @@ +package com.darkweb.genesissearchengine.appManager.externalNavigationManager; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; + +public class externalNavigationController extends AppCompatActivity { + @Override + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Uri data = externalNavigationController.this.getIntent().getData(); + if(data == null || status.sSettingIsAppStarted){ + + /* Close Activity */ + + finish(); + activityContextManager.getInstance().onClearStack(); + + /* Create Request Handler */ + + if(status.sSettingIsAppStarted && data!=null){ + helperMethod.onDelayHandler(this, 3000, () -> { + activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString())); + activityContextManager.getInstance().getHomeController().onClearSelectionTab(); + return null; + }); + } + + Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class); + bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(bringToForegroundIntent); + } + else if(status.sSettingIsAppRunning){ + + /* Refresh Intent Data */ + + finish(); + status.sExternalWebsite = data.toString(); + + }else { + + /* Start Required Activity */ + + Intent intent = new Intent(this.getIntent()); + intent.setClassName(this.getApplicationContext(), homeController.class.getName()); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); + + if(activityContextManager.getInstance().getHomeController()!=null){ + activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString()); + }else { + status.sExternalWebsite = data.toString(); + } + + this.startActivity(intent); + this.overridePendingTransition(0, 0); + + /* Bring Application To Front */ + + Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); + startActivity(launchIntent); + + /* Close Activity */ + + helperMethod.onDelayHandler(this, 1000, () -> { + finish(); + return null; + }); + } + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalShortcuts.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalShortcuts.java similarity index 76% rename from app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalShortcuts.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalShortcuts.java index cefbaa19..be006bf2 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalShortcuts.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalShortcuts.java @@ -1,4 +1,4 @@ -package com.darkweb.genesissearchengine.externalNavigationManager; +package com.darkweb.genesissearchengine.appManager.externalNavigationManager; import android.content.Intent; import android.net.Uri; @@ -16,6 +16,7 @@ import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.databaseManager.databaseController; +import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; import org.mozilla.geckoview.ContentBlocking; import org.torproject.android.service.wrapper.orbotLocalConstants; @@ -58,66 +59,15 @@ public class externalShortcuts extends AppCompatActivity { new Handler().postDelayed(() -> { - Uri data = this.getIntent().getData(); - if(data == null){ - finish(); - activityContextManager.getInstance().onClearStack(); - Intent bringToForegroundIntent = new Intent(externalShortcuts.this, homeController.class); - bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(bringToForegroundIntent); - overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); - return; - } - - if(status.sSettingIsAppStarted){ - finish(); - activityContextManager.getInstance().onClearStack(); - - new Handler().postDelayed(() -> - { - activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString())); - activityContextManager.getInstance().getHomeController().onClearSelectionTab(); - }, 500); - - Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class); - bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(bringToForegroundIntent); - overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); - - return; - }else if(status.sSettingIsAppRunning){ - finish(); - status.sExternalWebsite = data.toString(); - return; - } + /* Start Required Activity */ Intent intent = new Intent(this.getIntent()); intent.setClassName(this.getApplicationContext(), homeController.class.getName()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); - if(activityContextManager.getInstance().getHomeController()!=null){ - activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString()); - }else { - status.sExternalWebsite = data.toString(); - } - this.startActivity(intent); overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); - new Thread(){ - public void run(){ - try { - sleep(1000); - externalShortcuts.this.runOnUiThread(() -> finish()); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }.start(); - - Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); - startActivity(launchIntent); - overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant); }, 800); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java index 28897e4c..1ee10d90 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java @@ -71,7 +71,7 @@ public class orbotLogAdapter extends RecyclerView.Adapter { + if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { + if(!orbotLogStatus.sUIInteracted && ((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1)){ + if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ + onScrollBottom(); + } + }else { + mNestedScrollView.scrollTo(0,0); + } + orbotLogStatus.sScrollPosition = -1; + } + + return null; + }); + super.onConfigurationChanged(newConfig); } - public void initializeViews() { + + private void initializeViews() { mLogRecycleView = findViewById(R.id.pLogRecycleView); mLogs = findViewById(R.id.pLogs); mNestedScrollView = findViewById(R.id.pNestedScrollView); @@ -92,13 +115,13 @@ public class orbotLogController extends AppCompatActivity { mOrbotModel = new orbotLogModel(); } - public void initializeLogs(){ + private void initializeLogs(){ mLogCounter = 0; + mOrbotModel.setList(orbotLocalConstants.mTorLogsHistory); if(status.sLogThemeStyleAdvanced){ - mLogCounter = orbotLocalConstants.mTorLogsHistory.size(); - mOrbotModel.setList(orbotLocalConstants.mTorLogsHistory); + mLogCounter = (int)mOrbotModel.onTrigger(M_GET_LIST_SIZE); LinearLayoutManager layoutManager = new LinearLayoutManager(orbotLogController.this); - orbotLogAdapter adapter = new orbotLogAdapter(mOrbotModel.getList(),new orbotLogController.orbotModelCallback()); + orbotLogAdapter adapter = new orbotLogAdapter(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)),new orbotLogController.orbotModelCallback()); mOrbotAdapter = adapter; layoutManager.setReverseLayout(true); @@ -114,12 +137,13 @@ public class orbotLogController extends AppCompatActivity { logToString(); } mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS, Collections.singletonList(status.sLogThemeStyleAdvanced)); - mLogRecycleView.smoothScrollToPosition(mOrbotModel.getList().size()); + mLogRecycleView.smoothScrollToPosition((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)); } /* LISTENERS */ + @RequiresApi(api = Build.VERSION_CODES.M) @SuppressLint("ClickableViewAccessibility") private void initListener(){ @@ -127,29 +151,27 @@ public class orbotLogController extends AppCompatActivity { @SuppressLint("NewApi") @SuppressWarnings("deprecation") @Override public void onGlobalLayout() { - if(orbotLogStatus.sScrollPosition!=-1){ + if(orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sUIInteracted){ mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition); - }else if(mNestedScrollView.canScrollVertically(1)){ - onScrollBottom(null); + }else if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ + onScrollBottom(); } if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { - mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { - orbotLogStatus.sScrollPosition = scrollY; - }); + mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> orbotLogStatus.sScrollPosition = scrollY); } - mOrbotLogViewController.onTrigger(M_SCROLL_THEME_UPDATE); + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } }); mNestedScrollView.setOnTouchListener((v, event) -> { - if(mNestedScrollView.canScrollVertically(1)){ + if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ orbotLogStatus.sUIInteracted = true; } if(event.getAction() == MotionEvent.ACTION_UP){ - mOrbotLogViewController.onTrigger(M_SCROLL_THEME_UPDATE); + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); } if(event.getAction() == MotionEvent.ACTION_UP){ @@ -161,9 +183,23 @@ public class orbotLogController extends AppCompatActivity { return false; }); + mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { + super.onScrollStateChanged(recyclerView, newState); + if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) { + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + } + } + }); + mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> { - if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) { - mOrbotLogViewController.onTrigger(M_SCROLL_THEME_UPDATE); + if (mNestedScrollView.getScrollY() == 0) + { + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + } + else if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) { + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); if(!mIsRecycleviewInteracting){ orbotLogStatus.sUIInteracted = false; @@ -172,60 +208,73 @@ public class orbotLogController extends AppCompatActivity { }); } - public void logToString(){ - for(int mCounter=0;mCounter1){ + for(int mCounter=0;mCounter<(int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);mCounter++){ + mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)).get(mCounter).getLog())); + mLogCounter+=1; + } } } - public void updateLogs(){ + private void updateLogs(){ new Thread(){ public void run(){ + try { + sleep(1000); while (!mActivityClosed){ - try { if(status.sLogThemeStyleAdvanced){ sleep(800); }else { sleep(100); } - if(orbotLocalConstants.mTorLogsHistory.size()>0){ + if(mLogCounter>0){ runOnUiThread(() -> { if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){ - mOrbotModel.getList().add(orbotLocalConstants.mTorLogsHistory.get(mLogCounter)); + ((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)).add(orbotLocalConstants.mTorLogsHistory.get(mLogCounter)); if(!status.sLogThemeStyleAdvanced){ - mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(orbotLocalConstants.mTorLogsHistory.get(mLogCounter).getLog())); + mOrbotLogViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(((ArrayList)mOrbotModel.onTrigger(M_GET_LIST)).get(mLogCounter).getLog())); }else { if(mOrbotAdapter!=null){ - mOrbotAdapter.notifyItemInserted(mOrbotModel.getList().size()-1); + mOrbotAdapter.notifyItemInserted((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)-1); } } + + if(!orbotLogStatus.sUIInteracted){ + helperMethod.onDelayHandler(orbotLogController.this, 150, () -> { + if(!orbotLogStatus.sUIInteracted){ + onScrollBottomAnimated(null); + } + return null; + }); + } mLogCounter+=1; } }); } - sleep(100); - if(!orbotLogStatus.sUIInteracted){ - runOnUiThread(() -> { - if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter) { - onScrollBottom(null); - } - }); - } - } catch (InterruptedException e) { - e.printStackTrace(); } } + catch (InterruptedException e) { + e.printStackTrace(); + } } }.start(); } + private void onScrollBottom() { + mNestedScrollView.scrollTo(0,helperMethod.pxFromDp((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)*100)); + } + /* View Callback */ - public void onScrollBottom(View view) { + public void onScrollBottomAnimated(View view) { mNestedScrollView.fullScroll(View.FOCUS_DOWN); orbotLogStatus.sUIInteracted = false; + + if(view!=null){ + mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); + } } public void onOpenInfo(View view) { @@ -287,8 +336,12 @@ public class orbotLogController extends AppCompatActivity { /* External Calls */ public void onRefreshLayoutTheme(){ - orbotLogStatus.sScrollPosition = 0; - orbotLogStatus.sUIInteracted = false; + if(!orbotLogStatus.sUIInteracted){ + orbotLogStatus.sScrollPosition = -1; + }else { + orbotLogStatus.sScrollPosition = 0; + } + mIsRecycleviewInteracting = false; recreate(); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java index 14ec6159..7a45a5e4 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogEnums.java @@ -5,11 +5,12 @@ public class orbotLogEnums /*Orbot Log View Manager*/ public enum eOrbotLogViewCommands { - M_UPDATE_LOGS, M_INIT_VIEWS, M_SCROLL_THEME_UPDATE + M_UPDATE_LOGS, M_INIT_VIEWS, M_FLOAT_BUTTON_UPDATE } /*Orbot Log Model Manager*/ public enum eOrbotLogModelCommands { + M_GET_LIST, M_GET_LIST_SIZE } } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java index 8ca2f481..bf9b10a3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogModel.java @@ -4,6 +4,7 @@ import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.helperManager.helperMethod; import org.torproject.android.service.wrapper.logRowModel; import java.util.ArrayList; +import java.util.List; class orbotLogModel { @@ -24,8 +25,29 @@ class orbotLogModel } } - ArrayList getList() + private ArrayList getList() { return mModelList; } + + private int getListSize() + { + return mModelList.size(); + } + + /*Triggers*/ + + public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List pData){ + } + + public Object onTrigger(orbotLogEnums.eOrbotLogModelCommands pCommands){ + if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST)){ + return getList(); + } + else if(pCommands.equals(orbotLogEnums.eOrbotLogModelCommands.M_GET_LIST_SIZE)){ + return getListSize(); + } + return null; + } + } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java index de5931e1..f13f6691 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogViewController.java @@ -6,6 +6,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.RecyclerView; +import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.sharedUIMethod; import com.google.android.material.floatingactionbutton.FloatingActionButton; @@ -56,19 +57,17 @@ class orbotLogViewController private void onUpdateLogs(String pLogs){ pLogs = "~ " + pLogs; - mLogs.setText(String.format("%s%s",mLogs.getText() ,pLogs + "\n\n")); + mLogs.setText(String.format("%s%s",mLogs.getText() , "\n\n" + pLogs )); } - private void onScrollThemeUpdate(){ - if(mNestedScrollView.canScrollVertically(1)){ - if(mFloatingScroller.getAlpha()==0){ - mFloatingScroller.setVisibility(View.VISIBLE); - mFloatingScroller.animate().cancel(); - mFloatingScroller.animate().alpha(1); - } + private void onFloatButtonUpdate(){ + if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ + mFloatingScroller.setVisibility(View.VISIBLE); + mFloatingScroller.animate().cancel(); + mFloatingScroller.animate().setDuration(250).alpha(1); }else { mFloatingScroller.animate().cancel(); - mFloatingScroller.animate().alpha(0).withEndAction(() -> mFloatingScroller.setVisibility(View.GONE)); + mFloatingScroller.animate().setDuration(250).alpha(0).withEndAction(() -> mFloatingScroller.setVisibility(View.GONE)); } } @@ -82,8 +81,8 @@ class orbotLogViewController else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_INIT_VIEWS)){ initViews((boolean)pData.get(0)); } - else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_SCROLL_THEME_UPDATE)){ - onScrollThemeUpdate(); + else if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_FLOAT_BUTTON_UPDATE)){ + onFloatButtonUpdate(); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java index 2eae1493..5d0060e3 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java @@ -14,7 +14,7 @@ public class constants public static final String CONST_PRIVACY_POLICY_URL = "https://genesishiddentechnologies.com/privacy"; public static final String CONST_REPORT_URL = "https://genesishiddentechnologies.com/reportus?url="; public static final String CONST_SITEMAP = "https://genesishiddentechnologies.com/create"; - public static final String CONST_PACKAGE_NAME = "com.darkweb.genesissearchengine"; + public static final String CONST_PACKAGE_NAME = "com.darkweb.genesissearchengine.dev"; /*DRIVE URL DEV*/ @@ -47,7 +47,7 @@ public class constants public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com?q=$s&ia=web"; public static final String CONST_BACKEND_BING_URL = "https://bing.com/search?q=$s"; public static final String CONST_BACKEND_WIKI_URL = "https://en.wikipedia.org/wiki/$s"; - public static final String CONST_LOG_DUCKDUCK = "https://duckduckgo.com/?q=tor logs"; + public static final String CONST_LOG_DUCKDUCK = "https://duckduckgo.com/?q=tor "; /*PROXY CONSTANTS*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java index 94034c05..f5e3a1c5 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -35,4 +35,10 @@ public class enums public static final int M_IMAGE_LOADED_SUCCESSFULLY = 1; public static final int M_IMAGE_LOADING_FAILED = 2; } + + public static class ScrollDirection { + public static final int HORIZONTAL = 0; + public static final int VERTICAL = 1; + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalNavigationController.java b/app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalNavigationController.java deleted file mode 100644 index 66dc8c3a..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalNavigationController.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.darkweb.genesissearchengine.externalNavigationManager; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.os.Handler; -import android.os.Looper; -import androidx.appcompat.app.AppCompatActivity; -import com.darkweb.genesissearchengine.appManager.activityContextManager; -import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; -import com.darkweb.genesissearchengine.constants.status; - -import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; - -public class externalNavigationController extends AppCompatActivity { - @Override - - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - Uri data = externalNavigationController.this.getIntent().getData(); - if(data == null){ - finish(); - activityContextManager.getInstance().onClearStack(); - Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class); - bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(bringToForegroundIntent); - return; - } - - if(status.sSettingIsAppStarted){ - finish(); - activityContextManager.getInstance().onClearStack(); - - new Handler(Looper.getMainLooper()).postDelayed(() -> { - activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString())); - activityContextManager.getInstance().getHomeController().onClearSelectionTab(); - }, 3000); - - Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class); - bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(bringToForegroundIntent); - - return; - }else if(status.sSettingIsAppRunning){ - finish(); - status.sExternalWebsite = data.toString(); - return; - } - - Intent intent = new Intent(this.getIntent()); - intent.setClassName(this.getApplicationContext(), homeController.class.getName()); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); - - if(activityContextManager.getInstance().getHomeController()!=null){ - activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString()); - }else { - status.sExternalWebsite = data.toString(); - } - - this.startActivity(intent); - this.overridePendingTransition(0, 0); - - new Thread(){ - public void run(){ - try { - sleep(1000); - externalNavigationController.this.runOnUiThread(() -> finish()); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }.start(); - - Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); - startActivity(launchIntent); - - } - - @Override - protected void onNewIntent(Intent intent) - { - super.onNewIntent(intent); - Uri data = intent.getData(); - if(data!=null){ - activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString()); - Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); - startActivity(launchIntent); - } - } -} diff --git a/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml b/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml new file mode 100644 index 00000000..0a96d2fc --- /dev/null +++ b/app/src/main/res/custom-xml/generic/xml/ic_baseline_shortcut_erase_back.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/shortcuts.xml b/app/src/main/res/custom-xml/generic/xml/shortcuts.xml index 0633ade9..2dce1ea5 100644 --- a/app/src/main/res/custom-xml/generic/xml/shortcuts.xml +++ b/app/src/main/res/custom-xml/generic/xml/shortcuts.xml @@ -4,39 +4,39 @@ + android:targetPackage="com.darkweb.genesissearchengine.dev" + android:targetClass="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalShortcuts"> + android:targetPackage="com.darkweb.genesissearchengine.dev" + android:targetClass="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalShortcuts"> + android:targetPackage="com.darkweb.genesissearchengine.dev" + android:targetClass="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalShortcuts"> diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_shortcut_erase.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_shortcut_erase.xml index fbaff4f7..f446b31d 100644 --- a/app/src/main/res/custom-xml/images/xml/ic_baseline_shortcut_erase.xml +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_shortcut_erase.xml @@ -1,5 +1,6 @@ - - + android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> + + diff --git a/app/src/main/res/layouts/alert/layout/popup_data_cleared_shortcut.xml b/app/src/main/res/layouts/alert/layout/popup_data_cleared_shortcut.xml index d7bbffe7..43ef7bdb 100644 --- a/app/src/main/res/layouts/alert/layout/popup_data_cleared_shortcut.xml +++ b/app/src/main/res/layouts/alert/layout/popup_data_cleared_shortcut.xml @@ -82,9 +82,9 @@ android:layout_height="match_parent" android:background="@xml/ax_ripple_default_round_bottom" android:padding="0dp" - android:textAlignment="textStart" - android:paddingStart="28.5dp" + android:paddingStart="38dp" android:text="@string/ALERT_DATA_CLEARED_BUTTON" + android:textAlignment="textStart" android:textAllCaps="false" android:textColor="@color/holo_gray" android:textSize="14sp" diff --git a/app/src/main/res/layouts/history/xml/ic_baseline_shortcut_add_new_back.xml b/app/src/main/res/layouts/history/xml/ic_baseline_shortcut_add_new_back.xml new file mode 100644 index 00000000..c20e9ecf --- /dev/null +++ b/app/src/main/res/layouts/history/xml/ic_baseline_shortcut_add_new_back.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/history/xml/ic_baseline_shortcut_cross_back.xml b/app/src/main/res/layouts/history/xml/ic_baseline_shortcut_cross_back.xml new file mode 100644 index 00000000..d398a0b8 --- /dev/null +++ b/app/src/main/res/layouts/history/xml/ic_baseline_shortcut_cross_back.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/orbotLog/layout/orbot_log_view.xml b/app/src/main/res/layouts/orbotLog/layout/orbot_log_view.xml index 4eb45204..1127d845 100644 --- a/app/src/main/res/layouts/orbotLog/layout/orbot_log_view.xml +++ b/app/src/main/res/layouts/orbotLog/layout/orbot_log_view.xml @@ -126,14 +126,13 @@ android:id="@+id/pLogs" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginEnd="12dp" android:background="@xml/sx_border_left" android:layout_marginStart="10dp" android:paddingStart="15dp" - android:paddingEnd="10dp" - android:paddingTop="25dp" - android:paddingBottom="5dp" - android:layout_marginBottom="190dp" + android:paddingEnd="15dp" + android:paddingTop="20dp" + android:paddingBottom="20dp" + android:layout_marginBottom="150dp" android:layout_marginTop="20dp" android:textColor="@color/c_text_v4" android:textSize="14sp" @@ -160,7 +159,7 @@ android:visibility="gone" android:layout_marginEnd="16dp" android:layout_marginBottom="16dp" - android:onClick="onScrollBottom" + android:onClick="onScrollBottomAnimated" android:clickable="true" android:tint="@color/white" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e31beafd..b1517969 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -23,7 +23,7 @@ Erase browsing history Erase & open Erase and open - Restart + Restart or Open Restart Application diff --git a/progress.txt b/progress.txt index 73bdc06d..aa29bdb5 100644 --- a/progress.txt +++ b/progress.txt @@ -7,4 +7,9 @@ settingLogModel settingLogViewController /* In Progress */ -OrbotLogs \ No newline at end of file +orbotLogAdapter +orbotLogController +orbotLogEnums +orbotLogModel +orbotLogStatus +orbotLogViewController