diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 0d156937..7643783a 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -1,24 +1,10 @@ - - + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..79ee123c --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 61a9130c..fb7f4a8a 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 5e39aaa4..001d9548 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -27,8 +27,8 @@ + - + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 00000000..797acea5 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/aarch64/release/app-aarch64-arm64-v8a-release.apk b/app/aarch64/release/app-aarch64-arm64-v8a-release.apk index 31e24494..8ca283be 100644 Binary files a/app/aarch64/release/app-aarch64-arm64-v8a-release.apk and b/app/aarch64/release/app-aarch64-arm64-v8a-release.apk differ diff --git a/app/aarch64/release/app-aarch64-armeabi-v7a-release.apk b/app/aarch64/release/app-aarch64-armeabi-v7a-release.apk index bbc866c4..95bb9d3e 100644 Binary files a/app/aarch64/release/app-aarch64-armeabi-v7a-release.apk and b/app/aarch64/release/app-aarch64-armeabi-v7a-release.apk differ diff --git a/app/aarch64/release/app-aarch64-x86-release.apk b/app/aarch64/release/app-aarch64-x86-release.apk index b32a98bb..7b26c9b3 100644 Binary files a/app/aarch64/release/app-aarch64-x86-release.apk and b/app/aarch64/release/app-aarch64-x86-release.apk differ diff --git a/app/aarch64/release/app-aarch64-x86_64-release.apk b/app/aarch64/release/app-aarch64-x86_64-release.apk index b6dee8c8..d2d3d8b4 100644 Binary files a/app/aarch64/release/app-aarch64-x86_64-release.apk and b/app/aarch64/release/app-aarch64-x86_64-release.apk differ diff --git a/app/aarch64/release/output-metadata.json b/app/aarch64/release/output-metadata.json index 43490854..a935360f 100644 --- a/app/aarch64/release/output-metadata.json +++ b/app/aarch64/release/output-metadata.json @@ -31,18 +31,6 @@ "versionName": "Build | Dark-Origin 1.1", "outputFile": "app-aarch64-x86-release.apk" }, - { - "type": "ONE_OF_MANY", - "filters": [ - { - "filterType": "ABI", - "value": "arm64-v8a" - } - ], - "versionCode": 1001, - "versionName": "Build | Dark-Origin 1.1", - "outputFile": "app-aarch64-arm64-v8a-release.apk" - }, { "type": "ONE_OF_MANY", "filters": [ @@ -54,6 +42,18 @@ "versionCode": 1001, "versionName": "Build | Dark-Origin 1.1", "outputFile": "app-aarch64-armeabi-v7a-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "arm64-v8a" + } + ], + "versionCode": 1001, + "versionName": "Build | Dark-Origin 1.1", + "outputFile": "app-aarch64-arm64-v8a-release.apk" } ] } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e2e3d053..490f09aa 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -143,7 +143,9 @@ - + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java index c0fd4296..b34a4d04 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java @@ -76,7 +76,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter p_model_list = mPassedList; for(int counter = 0; counter< p_model_list.size(); counter++){ @@ -88,7 +88,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter0){ mEvent.invokeObserver(Collections.singletonList(false),enums.etype.on_verify_selected_url_menu); }else { + if(!pIsComputing){ + notifyDataSetChanged(); + } mEvent.invokeObserver(Collections.singletonList(true),enums.etype.on_verify_selected_url_menu); } } @@ -217,12 +231,19 @@ public class bookmarkAdapter extends RecyclerView.Adapter0){ + initializeModelWithDate(true); + notifyDataSetChanged(); + } + } + @SuppressLint("ClickableViewAccessibility") public void onSwipe(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){ @@ -241,6 +262,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter { @@ -257,12 +279,14 @@ public class bookmarkAdapter extends RecyclerView.Adapter0){ + initializeModelWithDate(true); + notifyDataSetChanged(); + } } public void setPopupWindowEvents(View pView, String pUrl, int pPosition, String pTitle){ @@ -333,29 +366,19 @@ public class bookmarkAdapter extends RecyclerView.Adapter0){ - if(mCurrentList.size()>0 && (mCurrentList.size()>pIndex+1 || mCurrentList.size()==pIndex+1)){ - mDateVerify = true; - } - }else { + + if(mPassedList.size()<=0){ mCurrentList.clear(); return; } - int size = mCurrentList.size(); - if(mDateVerify){ - mCurrentList.remove(pIndex); - notifyItemRemoved(pIndex); - notifyItemRangeChanged(pIndex, mCurrentList.size()); - }else { - mCurrentList.remove(pIndex); - notifyItemRemoved(pIndex); - notifyItemChanged(mCurrentList.size()-1); - } - initializeModelWithDate(false); + mCurrentList.remove(mRealIndex.get(pIndex)); + notifyItemRemoved(mRealIndex.get(pIndex)); + notifyItemRangeChanged(0, mCurrentList.size()); + clearLongSelectedURL(); } + /*View Holder Extensions*/ class listViewHolder extends RecyclerView.ViewHolder { @@ -411,8 +434,13 @@ public class bookmarkAdapter extends RecyclerView.Adapter0){ + mRowMenu.setVisibility(View.INVISIBLE); + mRowMenu.setClickable(false); + }else { + mRowMenu.setVisibility(View.VISIBLE); + mRowMenu.setClickable(true); + } mWebLogo.setVisibility(View.VISIBLE); mHeader.setText(model.getHeader()); mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0)+"")); @@ -443,7 +471,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter { if (!hasFocus) { - mSearchInput.clearFocus(); + // mSearchInput.clearFocus(); }else { - ((bookmarkAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).setFilter(mSearchInput.getText().toString()); - ((bookmarkAdapter) mRecycleView.getAdapter()).invokeFilter(true); + mbookmarkAdapter.setFilter(mSearchInput.getText().toString()); + mbookmarkAdapter.invokeFilter(true); + mbookmarkAdapter.notifyDataSetChanged(); } }); @@ -167,10 +169,12 @@ public class bookmarkController extends AppCompatActivity @Override public void afterTextChanged(Editable editable) { - ((bookmarkAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).setFilter(mSearchInput.getText().toString()); - ((bookmarkAdapter) mRecycleView.getAdapter()).invokeFilter(true); + mbookmarkAdapter.setFilter(mSearchInput.getText().toString()); + mbookmarkAdapter.invokeFilter(true); + mbookmarkAdapter.notifyDataSetChanged(); } }); + } @Override @@ -189,31 +193,14 @@ public class bookmarkController extends AppCompatActivity public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { int position = viewHolder.getAdapterPosition(); - mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.ON_CLOSE,Collections.singletonList(position)); + mbookmarkAdapter.invokeSwipeClose(position); } @Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { - boolean mStatus = (boolean) mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_STATUS, null); - if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) { - if(mStatus){ - return 0; - } - else { - final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; - final int swipeFlags = 0; - return makeMovementFlags(swipeFlags, dragFlags); - } - } else { - if(mStatus){ - return 0; - } - else { - final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; - final int swipeFlags = 0; - return makeMovementFlags(swipeFlags, dragFlags); - } - } + final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; + final int swipeFlags = 0; + return makeMovementFlags(swipeFlags, dragFlags); } @Override @@ -371,9 +358,6 @@ public class bookmarkController extends AppCompatActivity else if(e_type.equals(enums.etype.url_clear)){ mbookmarkModel.onManualClear((int)data.get(0)); - if(mbookmarkModel.getList().size()==0){ - mRecycleView.setAlpha(0); - } } else if(e_type.equals(enums.etype.url_clear_at)){ dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK ,data); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java index 6858eadb..a1c451c0 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkViewController.java @@ -100,6 +100,7 @@ class bookmarkViewController mEmptyListNotification.animate().setDuration(pDuration).alpha(0f); mClearButton.setText(strings.HISTORY_CLEAR_HISTORY); mClearButton.setClickable(true); + mRecycleView.setVisibility(View.VISIBLE); } else { mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3)); @@ -120,6 +121,7 @@ class bookmarkViewController mClearButton.getLayoutParams().height = 0; mClearButton.requestLayout(); + mRecycleView.setVisibility(View.GONE); } } @@ -178,16 +180,13 @@ class bookmarkViewController mSearchInput.setVisibility(View.GONE); mSearchInput.setText(strings.GENERIC_EMPTY_STR); - new Handler().postDelayed(() -> - { - mTitle.setAlpha(0f); - mTitle.setVisibility(View.VISIBLE); - mTitle.animate().setDuration(150).alpha(1); + mTitle.setAlpha(0f); + mTitle.setVisibility(View.VISIBLE); + mTitle.animate().setDuration(150).alpha(1); - mSearchButton.setAlpha(0f); - mSearchButton.setVisibility(View.VISIBLE); - mSearchButton.animate().setDuration(150).alpha(1); - }, 500); + mSearchButton.setAlpha(0f); + mSearchButton.setVisibility(View.VISIBLE); + mSearchButton.animate().setDuration(150).alpha(1); mSearchInput.setText(strings.GENERIC_EMPTY_STR); mSearchInput.setClickable(false); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java index 32fb7d07..535a9df7 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java @@ -91,7 +91,7 @@ public class historyAdapter extends RecyclerView.Adapter p_model_list = mPassedList; int m_date_state = -1; @@ -117,7 +117,7 @@ public class historyAdapter extends RecyclerView.Adapter=1){ @@ -126,20 +126,20 @@ public class historyAdapter extends RecyclerView.Adapter0){ mEvent.invokeObserver(Collections.singletonList(false),enums.etype.on_verify_selected_url_menu); }else { + if(!pIsComputing){ + notifyDataSetChanged(); + } mEvent.invokeObserver(Collections.singletonList(true),enums.etype.on_verify_selected_url_menu); } } @@ -272,7 +289,7 @@ public class historyAdapter extends RecyclerView.Adapter0){ + initializeModelWithDate(true); + notifyDataSetChanged(); + } + } + @SuppressLint("ClickableViewAccessibility") public void onSwipe(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){ @@ -300,6 +324,11 @@ public class historyAdapter extends RecyclerView.Adapter0){ + initializeModelWithDate(true); + notifyDataSetChanged(); + } }; pItemView.setOnTouchListener((v, event) -> { @@ -316,12 +345,15 @@ public class historyAdapter extends RecyclerView.Adapter0){ + initializeModelWithDate(true); + notifyDataSetChanged(); + } + } + + public void invokeSwipeClose(int pPosition){ + onClose(pPosition); + invokeFilter(true); + + if(mPopupWindow!=null){ + mPopupWindow.dismiss(); + } } public void setPopupWindowEvents(View pView, String pUrl, int pPosition, String pTitle){ @@ -393,27 +443,16 @@ public class historyAdapter extends RecyclerView.Adapter0){ - if(mCurrentList.size()>0 && (mCurrentList.size()>pIndex+1 || mCurrentList.size()==pIndex+1)){ - mDateVerify = true; - } - }else { + + if(mPassedList.size()<=0){ mCurrentList.clear(); return; } - int size = mCurrentList.size(); - if(mDateVerify){ - mCurrentList.remove(pIndex); - notifyItemRemoved(pIndex); - notifyItemRangeChanged(pIndex, mCurrentList.size()); - }else { - mCurrentList.remove(pIndex); - notifyItemRemoved(pIndex); - notifyItemChanged(mCurrentList.size()-1); - } - initializeModelWithDate(false); + mCurrentList.remove(pIndex); + notifyItemRemoved(pIndex); + notifyItemRangeChanged(0, mCurrentList.size()); + clearLongSelectedURL(); } /*View Holder Extensions*/ @@ -472,8 +511,14 @@ public class historyAdapter extends RecyclerView.Adapter0){ + mRowMenu.setVisibility(View.INVISIBLE); + mRowMenu.setClickable(false); + }else { + mRowMenu.setVisibility(View.VISIBLE); + mRowMenu.setClickable(true); + } + mWebLogo.setVisibility(View.VISIBLE); mHeader.setText(model.getHeader()); mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0)+"")); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java index bf2a5e63..01ce7c5d 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyController.java @@ -164,6 +164,9 @@ public class historyController extends AppCompatActivity mSearchInput.setOnEditorActionListener((v, actionId, event) ->{ if (actionId == EditorInfo.IME_ACTION_NEXT) { + mHistoryAdapter.setFilter(mSearchInput.getText().toString()); + mHistoryAdapter.invokeFilter(true); + mHistoryAdapter.notifyDataSetChanged(); helperMethod.hideKeyboard(this); return true; } @@ -172,14 +175,15 @@ public class historyController extends AppCompatActivity mSearchInput.setOnFocusChangeListener((v, hasFocus) -> { if (!hasFocus) { - //mSearchInput.clearFocus(); - //onHideSearch(null); + // mSearchInput.clearFocus(); }else { - //mHistoryAdapter.setFilter(mSearchInput.getText().toString()); - //mHistoryAdapter.invokeFilter(true); + mHistoryAdapter.setFilter(mSearchInput.getText().toString()); + mHistoryAdapter.invokeFilter(true); + mHistoryAdapter.notifyDataSetChanged(); } }); + mSearchInput.addTextChangedListener(new TextWatcher() { @Override @@ -197,6 +201,7 @@ public class historyController extends AppCompatActivity { mHistoryAdapter.setFilter(mSearchInput.getText().toString()); mHistoryAdapter.invokeFilter(true); + mHistoryAdapter.notifyDataSetChanged(); } }); } @@ -212,30 +217,18 @@ public class historyController extends AppCompatActivity public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { int position = viewHolder.getAdapterPosition(); - mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.ON_CLOSE,Collections.singletonList(position)); + mHistoryAdapter.invokeSwipeClose(position); } @Override public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { - boolean mStatus = (boolean) mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.GET_LONG_SELECTED_STATUS, null); - if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) { - if(mStatus){ - return 0; - } - else { - final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; - final int swipeFlags = 0; - return makeMovementFlags(swipeFlags, dragFlags); - } - } else { - if(mStatus){ - return 0; - } - else { - final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; - final int swipeFlags = 0; - return makeMovementFlags(swipeFlags, dragFlags); - } + int position = viewHolder.getAdapterPosition(); + if(mHistoryAdapter.isSwipable(position)){ + final int dragFlags = ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; + final int swipeFlags = 0; + return makeMovementFlags(swipeFlags, dragFlags); + }else { + return 0; } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java index 0ce2acfb..25cec772 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyViewController.java @@ -91,6 +91,7 @@ class historyViewController mEmptyListNotification.animate().setDuration(pDuration).alpha(0f); mClearButton.setText(strings.HISTORY_CLEAR_HISTORY); mClearButton.setClickable(true); + mRecycleView.setVisibility(View.VISIBLE); } else { mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3)); @@ -111,6 +112,7 @@ class historyViewController mClearButton.getLayoutParams().height = 0; mClearButton.requestLayout(); + mRecycleView.setVisibility(View.GONE); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java index e5b5f38b..75146e2d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java @@ -4,24 +4,24 @@ import android.content.Context; import androidx.core.view.NestedScrollingChildHelper; import androidx.core.view.ViewCompat; import android.util.AttributeSet; +import android.util.Log; import android.view.MotionEvent; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.helperManager.eventObserver; import org.mozilla.geckoview.GeckoView; -import org.mozilla.geckoview.PanZoomController; - import java.util.Collections; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_CHANGED; + +import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN; +import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_UP_ALWAYS; public class NestedGeckoView extends GeckoView { - private int mLastY = 0; - private int deltaY = 0; + private int mLastY; private final int[] mScrollOffset = new int[2]; private final int[] mScrollConsumed = new int[2]; private int mNestedOffsetY; private NestedScrollingChildHelper mChildHelper; private eventObserver.eventListener mEvent; - private int mInputResult = PanZoomController.INPUT_RESULT_UNHANDLED; + public void onSetHomeEvent(eventObserver.eventListener pEvent){ mEvent = pEvent; @@ -32,71 +32,76 @@ public class NestedGeckoView extends GeckoView { mChildHelper = null; } - public NestedGeckoView(final Context context) { - this(context, null); - } + public NestedGeckoView(Context context, AttributeSet attrs) { + super(context.getApplicationContext(), attrs); - public NestedGeckoView(final Context context, final AttributeSet attrs) { - super(context, attrs); mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); } @Override public boolean onTouchEvent(MotionEvent ev) { - MotionEvent event = MotionEvent.obtain(ev); - final int action = event.getActionMasked(); - int eventY = (int) event.getY(); + final MotionEvent event = MotionEvent.obtain(ev); + final int action = ev.getActionMasked(); + + if (action == MotionEvent.ACTION_DOWN) { + mNestedOffsetY = 0; + } + + final int eventY = (int) event.getY(); + event.offsetLocation(0, mNestedOffsetY); + + if(event.getPointerCount() > 1 && !status.sSettingEnableZoom) { + return true; + } switch (action) { case MotionEvent.ACTION_MOVE: - final boolean allowScroll = !shouldPinOnScreen() && - mInputResult == PanZoomController.INPUT_RESULT_HANDLED; - - if(!status.sSettingEnableZoom){ - mInputResult = PanZoomController.INPUT_RESULT_UNHANDLED; - } + // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); + final boolean allowScroll = status.sFullScreenBrowsing; int deltaY = mLastY - eventY; + if (allowScroll && dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) { deltaY -= mScrollConsumed[1]; - event.offsetLocation(0f, -mScrollOffset[1]); + event.offsetLocation(0, -mScrollOffset[1]); mNestedOffsetY += mScrollOffset[1]; } + mLastY = eventY - mScrollOffset[1]; if (allowScroll && dispatchNestedScroll(0, mScrollOffset[1], 0, deltaY, mScrollOffset)) { mLastY -= mScrollOffset[1]; - event.offsetLocation(0f, mScrollOffset[1]); + event.offsetLocation(0, mScrollOffset[1]); mNestedOffsetY += mScrollOffset[1]; } + + if(status.sFullScreenBrowsing){ + Log.i("wow1", eventY + ""); + } + break; case MotionEvent.ACTION_DOWN: - // A new gesture started. Reset handled status and ask GV if it can handle this. - mInputResult = PanZoomController.INPUT_RESULT_UNHANDLED; - - updateInputResult(event); - - mNestedOffsetY = 0; mLastY = eventY; + startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); + mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_DOWN); + break; - // The event should be handled either by onTouchEvent, - // either by onTouchEventForResult, never by both. - // Early return if we sent it to updateInputResult(..) which calls onTouchEventForResult. - event.recycle(); - return true; - - // We don't care about other touch events case MotionEvent.ACTION_UP: + mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_UP_ALWAYS); case MotionEvent.ACTION_CANCEL: + // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); stopNestedScroll(); break; + + default: + // mEvent.invokeObserver(Collections.singletonList(null), GECKO_SCROLL_FINISHED); } // Execute event handler from parent class in all cases - final boolean eventHandled = callSuperOnTouchEvent(event); + boolean eventHandled = super.onTouchEvent(event); // Recycle previously obtained event event.recycle(); @@ -104,25 +109,6 @@ public class NestedGeckoView extends GeckoView { return eventHandled; } - private boolean callSuperOnTouchEvent(MotionEvent event) { - return super.onTouchEvent(event); - } - - private void updateInputResult(MotionEvent event) { - if(status.sSettingEnableZoom){ - super.onTouchEventForResult(event).accept(inputResult -> { - mInputResult = inputResult; - mInputResult = PanZoomController.INPUT_RESULT_UNHANDLED; - - startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); - }); - } - } - - public int getInputResult() { - return mInputResult; - } - @Override public void setNestedScrollingEnabled(boolean enabled) { mChildHelper.setNestedScrollingEnabled(enabled); @@ -149,11 +135,7 @@ public class NestedGeckoView extends GeckoView { } @Override - public boolean dispatchNestedScroll(int dxConsumed, - int dyConsumed, - int dxUnconsumed, - int dyUnconsumed, - int[] offsetInWindow) { + public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) { return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow); } @@ -167,8 +149,8 @@ public class NestedGeckoView extends GeckoView { return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed); } - @Override - public boolean dispatchNestedPreFling(float velocityX, float velocityY) { - return mChildHelper.dispatchNestedPreFling(velocityX, velocityY); + public int getMaxY(){ + return 1; } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java index f368eb99..6713da70 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java @@ -3,6 +3,7 @@ package com.darkweb.genesissearchengine.appManager.homeManager.geckoManager; import android.annotation.SuppressLint; import android.content.Intent; import android.net.Uri; +import android.os.Handler; import android.util.Log; import android.widget.ImageView; import androidx.appcompat.app.AppCompatActivity; @@ -13,8 +14,12 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; + import java.io.File; import java.util.List; + +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; +import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; import static com.darkweb.genesissearchengine.constants.constants.CONST_REPORT_URL; import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; @@ -71,15 +76,28 @@ public class geckoClients public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ boolean mStatus = mSession.onValidateInitializeFromStartup(); if(mStatus){ - // loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); - mSession.onRestoreState(); - mSession.reload(); + boolean mState = mSession.onRestoreState(); + if(!mState){ + new Handler().postDelayed(() -> + { + mSession.stop(); + mSession.loadUri(mSession.getCurrentURL()); + }, 500); + }else { + String mURL = mSession.getCurrentURL(); + if(mURL.equals("https://boogle.store") || mURL.startsWith(CONST_GENESIS_URL_CACHED) || mURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ + if(!mSession.canGoBack()){ + mNestedGeckoView.releaseSession(); + mSession.close(); + mSession.open(mRuntime); + mNestedGeckoView.setSession(mSession); + }else { + mSession.goBack(); + } + loadURL("boogle.store", mNestedGeckoView, pcontext); + } + } } - - } - - public boolean onGetInitializeFromStartup(){ - return mSession.onGetInitializeFromStartup(); } public geckoSession initFreeSession(GeckoView pGeckoView, AppCompatActivity pcontext, eventObserver.eventListener event){ @@ -223,6 +241,7 @@ public class geckoClients if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){ String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); mSession.getSettings().setAllowJavascript(true); + mSession.initURL(mURL); mSession.loadUri(mURL); }else { String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); @@ -258,6 +277,10 @@ public class geckoClients onLoadFavIcon(pcontext); } + public boolean isLoaded(){ + return mSession.isLoaded(); + } + public void onClearSiteData(){ mRuntime.getStorageController().clearData(SITE_SETTINGS); mRuntime.getStorageController().clearData(SITE_DATA); @@ -278,9 +301,10 @@ public class geckoClients mRuntime.getStorageController().clearData(COOKIES); } - public void onBackPressed(boolean isFinishAllowed, int mTabSize){ + public void onBackPressed(boolean isFinishAllowed, int mTabSize, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ if(mSession.canGoBack()){ mSession.goBackSession(); + mSession.onUpdateBannerAdvert(); } else if(isFinishAllowed){ if(mSession.getRemovableFromBackPressed() && mTabSize>1){ @@ -321,6 +345,10 @@ public class geckoClients } } + public void onClose(){ + mSession.onClose(); + } + public void setRemovableFromBackPressed(boolean pStatus){ mSession.setRemovableFromBackPressed(pStatus); } @@ -331,9 +359,18 @@ public class geckoClients } public void onReload(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ + mSession.stop(); + String url = mSession.getCurrentURL(); + if(url.startsWith("https://boogle.store/?pG") || url.startsWith("https://boogle.store?pG") || url.endsWith("boogle.store") || url.contains(constants.CONST_GENESIS_HELP_URL_SUB) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE) || url.contains(constants.CONST_GENESIS_HELP_URL_CACHE_DARK)){ + loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); + }else{ + mSession.reload(); + } + } + + public void onReloadStatic(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ ///mSession.stop(); - mSession.reload(); - //loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); + loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); } public void manual_download(String url, AppCompatActivity context){ @@ -377,12 +414,53 @@ public class geckoClients mRuntime.getSettings().setFontSizeFactor(font/100); } + public void reinitHomeTheme(){ + String mURLFinal; + mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL); + if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(activityContextManager.getInstance().getHomeController())){ + String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); + mSession.getSettings().setAllowJavascript(true); + mSession.initURL(mURL); + mURLFinal = mURL; + }else { + String mURL = constants.CONST_GENESIS_URL_CACHED_DARK + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); + mSession.getSettings().setAllowJavascript(true); + mSession.initURL(mURL); + mURLFinal = mURL; + } + + if(!mSession.canGoBack()){ + activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession(); + mSession.close(); + mSession.open(mRuntime); + activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession); + }else { + mSession.goBack(); + } + + new Handler().postDelayed(() -> + { + if(!mSession.canGoBack()){ + mSession.close(); + activityContextManager.getInstance().getHomeController().getGeckoView().releaseSession(); + mSession.open(mRuntime); + activityContextManager.getInstance().getHomeController().getGeckoView().setSession(mSession); + } + + mSession.loadUri(mURLFinal); + + }, 10); + + } public class geckoViewClientCallback implements eventObserver.eventListener{ @Override public Object invokeObserver(List data, Object e_type) { - if(mSession!=null && mSession.isClosed()){ + if(e_type.equals(enums.etype.M_CHANGE_HOME_THEME)){ + reinitHomeTheme(); + } + else if(mSession!=null && mSession.isClosed()){ return null; }else if(mSession!=null) { if(e_type.equals(enums.etype.SESSION_ID)){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java index 588e5dfd..1a190584 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java @@ -28,6 +28,8 @@ import androidx.annotation.UiThread; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import androidx.core.content.FileProvider; + +import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; @@ -75,12 +77,14 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele { private eventObserver.eventListener event; + private boolean wasBackPressed = false; private String mSessionID; private boolean mCanGoBack = false; private boolean mCanGoForward = false; private boolean mFullScreen = false; private boolean isPageLoading = false; private int mProgress = 0; + private String mPrevURL = "about:blank"; private String mCurrentTitle = "loading"; private String mCurrentURL = "about:blank"; private Uri mUriPermission = null; @@ -341,6 +345,10 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele event.invokeObserver(Arrays.asList("",mSessionID,mCurrentTitle, m_current_url_id, mTheme, false), dataEnums.eTabCommands.M_UPDATE_PIXEL); } + public boolean isLoaded(){ + return mProgress>=100; + } + /*History Delegate*/ @Override public GeckoResult onVisited(@NonNull GeckoSession var1, @NonNull String var2, @Nullable String var3, int var4) { @@ -360,16 +368,19 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele @UiThread public void onSessionStateChange(@NonNull GeckoSession session, @NonNull SessionState sessionState) { mSessionState = sessionState; - if(!status.sRestoreTabs){ - mSessionState = null; - } - if(mSessionState!=null) + // if(!status.sRestoreTabs){ + // mSessionState = null; + // } + // if(mSessionState!=null) event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, mSessionState.toString()), enums.etype.M_UPDATE_SESSION_STATE); } - public void onRestoreState(){ + public boolean onRestoreState(){ if(mSessionState!=null){ restoreState(mSessionState); + return true; + }else { + return false; } } @@ -379,6 +390,21 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele if(!mIsLoaded){ return; } + if(wasBackPressed && mHistoryList.get(mHistoryList.getCurrentIndex()-1).getUri().equals(var2)){ + if(var2.equals("https://boogle.store") || var2.startsWith(CONST_GENESIS_URL_CACHED) || var2.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ + if(var2.startsWith(CONST_GENESIS_URL_CACHED_DARK) && (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get()))){ + isPageLoading = false; + //stop(); + event.invokeObserver(null, enums.etype.M_CHANGE_HOME_THEME); + } + else if(var2.startsWith(CONST_GENESIS_URL_CACHED) && (status.sTheme != enums.Theme.THEME_LIGHT && !helperMethod.isDayMode(mContext.get()))){ + isPageLoading = false; + //stop(); + event.invokeObserver(null, enums.etype.M_CHANGE_HOME_THEME); + } + } + } + wasBackPressed = false; String newUrl = Objects.requireNonNull(var2).split("#")[0]; if(!mCurrentTitle.equals("loading")){ @@ -441,6 +467,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele } else if(var1.target==2){ event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.open_new_tab); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_EXPAND_TOP_BAR); return GeckoResult.fromValue(AllowOrDeny.DENY); } else if(!var1.uri.equals("about:blank")){ @@ -452,14 +479,13 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele }else { setURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); } - }else{ + }else if(!var1.uri.startsWith("resource://android/assets/homepage/")){ setURL(var1.uri); } event.invokeObserver(Arrays.asList(var1.uri,mSessionID), enums.etype.start_proxy); event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.search_update); checkApplicationRate(); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_EXPAND_TOP_BAR); /* Its Absence causes delay on first launch*/ if(!mCurrentURL.contains("boogle.store")){ @@ -473,6 +499,17 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele } } + public void onUpdateBannerAdvert(){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE); + } + + public void onClose(){ + stop(); + mCurrentURL = mPrevURL; + //mIsLoaded = false; + //isPageLoading = false; + } + @Override public void onCanGoBack(@NonNull GeckoSession session, boolean var2) { @@ -537,6 +574,8 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele } event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_EXPAND_TOP_BAR); + mPrevURL = mCurrentURL; } @UiThread @@ -826,8 +865,8 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele } public String getCurrentURL(){ - if(mCurrentURL.equals("resource://android/assets/Homepage/homepage.html")){ - setURL("https://boogle.store"); + if(mCurrentURL.equals("resource://android/assets/Homepage/homepage.html") || mCurrentURL.equals("resource://android/assets/Homepage/homepage-dark.html")){ + //setURL("https://boogle.store"); } return mCurrentURL; } @@ -940,30 +979,8 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele } void goBackSession(){ - + wasBackPressed = true; goBack(); - /* - if(mHistoryList!=null){ - stop(); - int index = mHistoryList.getCurrentIndex()-1; - initURL(mHistoryList.get(index).getUri()); - if(mHistoryList.size()>index && index>0){ - event.invokeObserver(Arrays.asList(mHistoryList.get(index).getUri(), mSessionID), enums.etype.start_proxy); - } - - final Handler handler = new Handler(); - handler.postDelayed(this::goBack, 100); - mProgress = 5; - event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced); - event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK); - } - else { - final Handler handler = new Handler(); - handler.postDelayed(this::goBack, 100); - mProgress = 5; - event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced); - event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK); - }*/ } void goForwardSession(){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java index f9a4abd8..83a8540f 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/hintManager/hintAdapter.java @@ -64,6 +64,11 @@ public class hintAdapter extends RecyclerView.Adapter pHintList, String pSearch){ mHintList = pHintList; + if(mHintList.size()==1 && mHintList.get(0).getHeader().equals("about:blank")) { + mHintList.clear(); + mHintList.add( new historyRowModel("Genesis Search", "genesis.onion",-1)); + } + notifyDataSetChanged(); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java index 9524649a..15bb05b9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java @@ -1,7 +1,10 @@ package com.darkweb.genesissearchengine.appManager.homeManager.homeController; import android.annotation.SuppressLint; +import android.app.Activity; +import android.app.AlarmManager; import android.app.DownloadManager; +import android.app.PendingIntent; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ComponentCallbacks2; @@ -14,7 +17,6 @@ import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Color; import android.net.Uri; -import android.net.VpnService; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -29,6 +31,7 @@ import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodManager; import android.webkit.URLUtil; import android.widget.*; import androidx.annotation.NonNull; @@ -44,6 +47,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; +import com.darkweb.genesissearchengine.constants.sql; import com.darkweb.genesissearchengine.databaseManager.databaseController; import com.darkweb.genesissearchengine.appManager.historyManager.historyController; import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; @@ -81,10 +85,11 @@ import com.google.android.gms.ads.AdView; import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoSession; +import org.mozilla.geckoview.GeckoView; import org.torproject.android.proxy.OrbotService; import org.torproject.android.proxy.util.Prefs; -import org.torproject.android.proxy.wrapper.LocaleHelper; -import org.torproject.android.proxy.wrapper.orbotLocalConstants; +import org.torproject.android.service.wrapper.LocaleHelper; +import org.torproject.android.service.wrapper.orbotLocalConstants; import java.lang.ref.WeakReference; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -95,15 +100,18 @@ import java.util.List; import java.util.Locale; import java.util.Objects; import java.util.concurrent.Callable; + +import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; -import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_CHANGED; +import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_DOWN; import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_LINK; import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE; import static com.darkweb.genesissearchengine.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB; import static com.darkweb.genesissearchengine.constants.enums.etype.open_new_tab; +import static com.darkweb.genesissearchengine.constants.enums.etype.reload; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; import static java.lang.Character.isLetter; @@ -210,6 +218,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba initAdmob(); initWidget(); initSuggestionView(new ArrayList<>(), strings.GENERIC_EMPTY_STR); + status.sSettingIsAppRunning = true; + org.torproject.android.service.util.Prefs.setContext(activityContextManager.getInstance().getHomeController()); } @@ -218,7 +228,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(!status.sSettingIsAppStarted){ if(mSplashScreen.getAlpha()==1 && mConnectButton.isEnabled()){ onStartApplication(null); - status.sWidgetResponse = enums.WidgetResponse.NONE; } }else { mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); @@ -236,7 +245,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(!status.sSettingIsAppStarted){ if(mSplashScreen.getAlpha()==1 && mConnectButton.isEnabled()){ onStartApplication(null); - status.sWidgetResponse = enums.WidgetResponse.NONE; } }else { if(mSearchEngineBar.getVisibility() != View.VISIBLE){ @@ -328,7 +336,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } onLoadTab(model.getSession(),false,true); //onLoadURL(model.getSession().getCurrentURL()); - mGeckoClient.onReload(mGeckoView, this); + //mGeckoClient.onReload(mGeckoView, this); }else { onNewIntent(getIntent()); onOpenLinkNewTab(helperMethod.getDomainName(mHomeModel.getSearchEngine())); @@ -465,7 +473,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba public boolean dispatchTouchEvent(MotionEvent event) { if(inSignatureArea(event)){ try{ - mSwipeDirectionDetector.onTouchEvent(event); + //mSwipeDirectionDetector.onTouchEvent(event); }catch (Exception ignored){ } } return super.dispatchTouchEvent(event); @@ -558,6 +566,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onLoadURL(String url){ + status.sUIInteracted = true; if(mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ mGeckoView.getSession().open(mGeckoClient.getmRuntime()); } @@ -608,7 +617,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba }catch (Exception ignored){} if(pExpandAppBar){ - mHomeViewController.expandTopBar(); + mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); } if(mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("boogle.store") || mGeckoClient.wasPreviousErrorPage() || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ @@ -704,15 +713,18 @@ public class homeController extends AppCompatActivity implements ComponentCallba @SuppressLint("ClickableViewAccessibility") @Override protected void onDestroy() { + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DESTROY); mBackSplash.setImageDrawable(null); mBackSplash.setBackground(null); - if(!status.sSettingIsAppStarted){ - Intent intent = new Intent(getApplicationContext(), OrbotService.class); - stopService(intent); - }else { - NotificationManagerCompat.from(this).cancelAll(); - } + if(!status.mThemeApplying){ + if(!status.sSettingIsAppStarted){ + Intent intent = new Intent(getApplicationContext(), OrbotService.class); + stopService(intent); + }else { + NotificationManagerCompat.from(this).cancelAll(); + } + } KeyboardUtils.removeAllKeyboardToggleListeners(); mGatewaySplash.setOnTouchListener(null); @@ -755,6 +767,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mNewTab.setOnTouchListener((v, event) -> { if(event.getAction() == MotionEvent.ACTION_DOWN){ + mTopBarContainer.getLayoutTransition().setDuration(200); onOpenTabViewBoundary(null); mNewTab.setPressed(true); } @@ -811,17 +824,19 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGeckoView.setOnTouchListener((v, event) -> { mHomeViewController.onClearSelections(true); - if (event.getAction() == MotionEvent.ACTION_DOWN) + if (event.getAction() == MotionEvent.ACTION_DOWN){ mGatewaySplash.setElevation(9); + status.sUIInteracted = true; + } else if (event.getAction() == MotionEvent.ACTION_UP){ int[] location = new int[2]; mTopLayout.getLocationOnScreen(location); int y = location[1]; if(status.sFullScreenBrowsing){ if(y<=-helperMethod.pxFromDp(6)){ - mAppBar.setExpanded(false,true); + //mAppBar.setExpanded(false,true); }else { - mAppBar.setExpanded(true,true); + //mAppBar.setExpanded(true,true); } } } @@ -910,6 +925,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mSearchbar.setEventHandler(new edittextManagerCallback()); mSearchbar.setOnFocusChangeListener((v, hasFocus) -> { + status.sUIInteracted = true; if(!hasFocus) { mSearchBarWasBackButtonPressed = true; @@ -986,9 +1002,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void onSearchBarInvoked(View view){ String url = ((EditText)view).getText().toString(); String validated_url = mHomeModel.urlComplete(url, mHomeModel.getSearchEngine()); - if(validated_url!=null){ - url = validated_url; - } + url = validated_url; + mHomeViewController.onUpdateSearchBar(url,false,true, false); onLoadURL(url); } @@ -999,13 +1014,15 @@ public class homeController extends AppCompatActivity implements ComponentCallba mVal = ((TextView)view.findViewById(R.id.pHeaderSingle)).getText().toString(); } String pURL = mHomeModel.urlComplete(mVal, status.sSettingSearchStatus); - if(pURL==null){ - pURL = mVal; - } mHomeViewController.onClearSelections(true); - onLoadURL(pURL); mHomeViewController.onUpdateSearchBar(pURL,false,true, true); + + String finalPURL = pURL; + new Handler().postDelayed(() -> + { + onLoadURL(finalPURL); + }, 250); } public void onSuggestionMove(View view){ @@ -1169,12 +1186,16 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), M_INITIALIZE_TAB_SINGLE); } + public String completeURL(String pURL){ + return mHomeModel.urlComplete(pURL, mHomeModel.getSearchEngine()); + } + public void onOpenLinkNewTab(String url){ mNewTab.setPressed(true); final Handler handler = new Handler(); handler.postDelayed(() -> { onGetThumbnail(null, false); - mHomeViewController.expandTopBar(); + mHomeViewController.expandTopBar(false,mGeckoView.getMaxY()); if(status.sSettingSearchStatus.startsWith("https://boogle.store") || !status.sOpenURLInNewTab){ mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); } @@ -1182,11 +1203,16 @@ public class homeController extends AppCompatActivity implements ComponentCallba }, 100); } + public void onClearSelectionTab(){ + mNewTab.setPressed(false); + } + public void onOpenTabViewBoundary(View view){ onInvokePixelGenerator(); if(mScrollHandler!=null){ mScrollHandler.removeCallbacksAndMessages(null); } + onInvokePixelGenerator(); mNewTab.setPressed(true); onOpenTabReady(); } @@ -1218,7 +1244,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba initLocalLanguage(); helperMethod.hideKeyboard(this); - mHomeViewController.onOpenMenu(view,mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() ==View.INVISIBLE),mGeckoClient.getUserAgent(), mGeckoClient.getSession().getCurrentURL()); + mHomeViewController.onOpenMenu(view,mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() == View.INVISIBLE || mGeckoClient.isLoaded()),mGeckoClient.getUserAgent(), mGeckoClient.getSession().getCurrentURL()); view.setClickable(false); new Handler().postDelayed(() -> @@ -1271,14 +1297,18 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if(!mSearchBarWasBackButtonPressed){ int mTabSize = (int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null); - mGeckoClient.onBackPressed(true, mTabSize); + mGeckoClient.onBackPressed(true, mTabSize, mGeckoView, this); } } /*Activity States*/ + public NestedGeckoView getGeckoView(){ + return mGeckoView; + } + public void onReload(View view){ - mHomeViewController.onUpdateLogo(); + onLoadURL(mSearchbar.getText().toString()); } public void onClearSession(){ @@ -1337,7 +1367,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); mHomeViewController.onClearSelections(true); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); + mHomeViewController.initTopBarPadding(); + mHomeViewController.onSetBannerAdMargin(!mGeckoClient.isLoading(),(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)&&!!mGeckoClient.isLoading()); + + mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); + status.sUIInteracted = true; } @Override @@ -1362,6 +1397,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); pluginController.getInstance().onNotificationInvoke(Collections.singletonList(1296000000) , pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION); mSearchBarWasBackButtonPressed = false; + status.sUIInteracted = true; } @Override @@ -1403,7 +1439,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } if(mAppBar!=null){ - mHomeViewController.expandTopBar(); + mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); mAppBar.refreshDrawableState(); mAppBar.invalidate(); @@ -1473,7 +1509,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } if(mAppBar!=null){ - mHomeViewController.expandTopBar(); + mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); mAppBar.refreshDrawableState(); mAppBar.invalidate(); @@ -1512,7 +1548,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onVoiceClick(View view) { - if(status.sSettingEnableVoiceInput){ + if(status.sSettingEnableVoiceInput || status.sWidgetResponse == enums.WidgetResponse.VOICE){ Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); @@ -1523,7 +1559,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba } }else { - mHomeViewController.onClearSelections(true); + mSearchbar.clearFocus(); + new Handler().postDelayed(() -> + { + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false); + }, 170); } } /*-------------------------------------------------------External Callback Methods-------------------------------------------------------*/ @@ -1706,20 +1746,25 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if (menuId == R.id.pMenuQuit) { - status.sSettingIsAppStarted = false; - finishAndRemoveTask(); + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DESTROY); - new Thread(){ - public void run(){ - try { - sleep(1000); - android.os.Process.killProcess(android.os.Process.myPid()); - System.exit(1); - } catch (InterruptedException e) { - e.printStackTrace(); + new Handler().postDelayed(() -> + { + status.sSettingIsAppStarted = false; + finishAndRemoveTask(); + + new Thread(){ + public void run(){ + try { + sleep(1000); + android.os.Process.killProcess(android.os.Process.myPid()); + System.exit(1); + } catch (InterruptedException e) { + e.printStackTrace(); + } } - } - }.start(); + }.start(); + }, 100); } else if (menuId == R.id.pMenuFind) { @@ -1727,8 +1772,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onUpdateFindBar(true); } if (menuId == R.id.menu20) { + mGeckoClient.onClose(); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); helperMethod.hideKeyboard(this); - mGeckoClient.onStop(); } if (menuId == R.id.menu21) { helperMethod.hideKeyboard(this); @@ -1815,6 +1861,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true)); @@ -1839,22 +1887,40 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); + + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null); + dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); + activityContextManager.getInstance().getHomeController().onClearCache(); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + activityContextManager.getInstance().getHomeController().onClearSiteData(); + activityContextManager.getInstance().getHomeController().onClearSession(); + activityContextManager.getInstance().getHomeController().onClearCookies(); + onClearSettings(); + status.initStatus(activityContextManager.getInstance().getHomeController()); + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + activityContextManager.getInstance().getHomeController().initRuntimeSettings(); + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_DATA_CLEARED); + activityContextManager.getInstance().getHomeController().onClearSettings(); + + status.sSettingIsAppStarted = false; finishAndRemoveTask(); - new Thread(){ - public void run(){ - try { - sleep(1000); - android.os.Process.killProcess(android.os.Process.myPid()); - System.exit(1); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }.start(); + Intent intent = new Intent(this, homeController.class); + intent.addFlags(FLAG_ACTIVITY_NEW_TASK); + this.startActivity(intent); + overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); + if (this + instanceof Activity) { + ((Activity) this).finish(); + } + + Runtime.getRuntime().exit(0); + } public class nestedGeckoViewCallback implements eventObserver.eventListener{ @@ -1862,9 +1928,24 @@ public class homeController extends AppCompatActivity implements ComponentCallba @Override public Object invokeObserver(List data, Object e_type) { - if(e_type.equals(GECKO_SCROLL_CHANGED)){ - mHomeViewController.onMoveTopBar((int)data.get(0)); - onInvokePixelGenerator(); + if(status.sFullScreenBrowsing){ + if(e_type.equals(GECKO_SCROLL_DOWN)){ + mTopBarContainer.getLayoutTransition().setDuration(0); + mHomeViewController.onClearSelections(isKeyboardOpened); + mSearchbar.clearFocus(); + } + else { + int[] locatiosn = new int[2]; + mSearchbar.getLocationOnScreen(locatiosn); + int ys = locatiosn[1]; + if(ys!=0){ + if(ys<=50){ + mHomeViewController.shrinkTopBar(true, mGeckoView.getMaxY()); + }else { + mHomeViewController.expandTopBar(true, mGeckoView.getMaxY()); + } + } + } } return null; } @@ -1929,11 +2010,23 @@ public class homeController extends AppCompatActivity implements ComponentCallba { mHomeViewController.onSetBannerAdMargin((boolean)data.get(0),(boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); } + else if(e_type.equals(enums.etype.M_SPLASH_DISABLE)) + { + initWidget(); + } else if(e_type.equals(enums.etype.M_WELCOME_MESSAGE)){ if(status.sSettingIsWelcomeEnabled){ final Handler handler = new Handler(); - Runnable runnable = () -> pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_WELCOME); - handler.postDelayed(runnable, 1300); + Runnable runnable = () -> { + if(!status.sUIInteracted){ + mHomeViewController.closeMenu(); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); + mSearchbar.clearFocus(); + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_WELCOME); + status.sUIInteracted = true; + } + }; + handler.postDelayed(runnable, 2500); } } else if(e_type.equals(enums.etype.on_url_load)){ @@ -2091,7 +2184,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba { if(e_type.equals(enums.etype.ON_EXPAND_TOP_BAR)){ - mHomeViewController.expandTopBar(); + mHomeViewController.expandTopBar(false, mGeckoView.getMaxY()); } else if(e_type.equals(enums.etype.M_ON_BANNER_UPDATE)){ Object mAdvertResponse = pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED); @@ -2203,6 +2296,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(activityContextManager.getInstance().getTabController()!=null && mTabFragment.getVisibility()==View.VISIBLE) activityContextManager.getInstance().getTabController().onTabRowChanged((String) data.get(1)); } + else if(e_type.equals(enums.etype.M_RELOAD)){ + onReload(null); + } else if(e_type.equals(enums.etype.M_UPDATE_SESSION_STATE)){ dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_SESSION_STATE, data); } @@ -2222,6 +2318,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba else if(e_type.equals(enums.etype.M_UPDATE_PIXEL_BACKGROUND)){ onInvokePixelGenerator(); } + else if(e_type.equals(enums.etype.M_INIT_PADDING)){ + mHomeViewController.initTopBarPadding(); + } return null; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java index c34f6069..40a8f0bd 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeModel.java @@ -28,7 +28,7 @@ class homeModel boolean isUrlValid = Patterns.WEB_URL.matcher(updateUrl).matches(); if(isUrlValid && host.getHost().replace("www.","").contains(".")) { - return null; + return pURL; } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java index 317e9117..7b0f309b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java @@ -17,6 +17,7 @@ import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.InsetDrawable; import android.graphics.drawable.StateListDrawable; import android.os.Build; +import android.os.Debug; import android.os.Handler; import android.os.Message; import android.text.method.MovementMethod; @@ -49,7 +50,7 @@ import com.example.myapplication.R; import com.google.android.gms.ads.AdView; import com.google.android.material.appbar.AppBarLayout; import org.mozilla.geckoview.GeckoView; -import org.torproject.android.proxy.wrapper.orbotLocalConstants; +import org.torproject.android.service.wrapper.orbotLocalConstants; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -118,6 +119,7 @@ class homeViewController private MovementMethod mSearchBarMovementMethod = null; private Handler mTabDialogHandler = null; private Runnable mTabDialogRunnable = null; + private boolean mIsTopBarExpanded = true; void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, AnimatedProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, View pPopupLoadNewTab, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo,ImageButton pPanicButtonLandscape){ this.mContext = context; @@ -179,13 +181,10 @@ class homeViewController mTopBarContainer.getLayoutTransition().setDuration(200); final Handler handler = new Handler(); - handler.postDelayed(() -> - { - mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); - }, 1500); + handler.postDelayed(() -> mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER), 1500); updateBannerAdvertStatus(false, false); - expandTopBar(); + expandTopBar(false, 2000); mBlockerFullSceen.setVisibility(View.GONE); mNewTab.setPressed(true); mNewTab.setPressed(false); @@ -194,6 +193,7 @@ class homeViewController View child = mAppBar.getChildAt(0); AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); params.setScrollFlags(1); + mIsTopBarExpanded = false; mAppBar.setExpanded(true,false); mAppBar.refreshDrawableState(); mAppBar.invalidate(); @@ -274,7 +274,7 @@ class homeViewController mPopupLoadNewTab.animate().cancel(); mPopupLoadNewTab.setAlpha(0); mPopupLoadNewTab.setVisibility(View.VISIBLE); - mPopupLoadNewTab.animate().setDuration(350).alpha(1); + mPopupLoadNewTab.animate().setStartDelay(400).setDuration(250).alpha(1); if(mTabDialogHandler!=null){ mTabDialogHandler.removeCallbacksAndMessages(null); @@ -282,14 +282,14 @@ class homeViewController mTabDialogHandler = new Handler(); mTabDialogRunnable = this::onHideLoadTabDialog; - mTabDialogHandler.postDelayed(mTabDialogRunnable, 7500); + mTabDialogHandler.postDelayed(mTabDialogRunnable, 3500); } public void onHideLoadTabDialog() { mPopupLoadNewTab.findViewById(R.id.pBlockerUndo).setVisibility(View.VISIBLE); mPopupLoadNewTab.animate().cancel(); - mPopupLoadNewTab.animate().setDuration(350).alpha(0).withEndAction(() -> { + mPopupLoadNewTab.animate().setDuration(250).alpha(0).withEndAction(() -> { mPopupLoadNewTab.setVisibility(View.GONE); }); } @@ -495,13 +495,13 @@ class homeViewController if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2)); - int mDelay = 800; + int mDelay = 1150; if(status.mThemeApplying || mInstant){ mDelay = 0; } ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f); - animator.setDuration(300).setStartDelay(mDelay); + animator.setDuration(250).setStartDelay(mDelay); animator.addUpdateListener(animation -> { float v = (float) animation.getAnimatedValue(); @@ -647,29 +647,30 @@ class homeViewController if(mSplashScreen.getAlpha()==1){ if(!mIsAnimating){ mIsAnimating = true; - triggerPostUI(); + triggerPostUI(2000); mProgressBar.setVisibility(View.GONE); mSplashScreen.animate().cancel(); onClearSelections(false); mGeckoView.requestFocus(); - mProgressBarIndeterminate.animate().setStartDelay(300).setDuration(250).alpha(0).withEndAction(() -> mSplashScreen.animate().setDuration(350).setStartDelay(200).alpha(0).withEndAction(() -> { - mProgressBarIndeterminate.setVisibility(View.GONE); - mSplashScreen.setClickable(false); - mSplashScreen.setFocusable(false); - mProgressBarIndeterminate.setVisibility(View.GONE); - mSearchbar.setEnabled(true); - mBlocker.setEnabled(false); + mProgressBarIndeterminate.animate().cancel(); + mProgressBarIndeterminate.animate().setStartDelay(750).setDuration(250).alpha(0).withEndAction(() -> { + mSplashScreen.animate().setDuration(250).setStartDelay(100).alpha(0).withEndAction(() -> { + mProgressBarIndeterminate.setVisibility(View.GONE); + mSplashScreen.setClickable(false); + mSplashScreen.setFocusable(false); + mSearchbar.setEnabled(true); + mBlocker.setEnabled(false); - mProgressBarIndeterminate.setVisibility(View.GONE); - mBlocker.setVisibility(View.GONE); - mGatewaySplash.setVisibility(View.GONE); - mConnectButton.setVisibility(View.GONE); - mPanicButton.setVisibility(View.GONE); - mPanicButtonLandscape.setVisibility(View.GONE); + mBlocker.setVisibility(View.GONE); + mGatewaySplash.setVisibility(View.GONE); + mConnectButton.setVisibility(View.GONE); + mPanicButton.setVisibility(View.GONE); + mPanicButtonLandscape.setVisibility(View.GONE); - mEvent.invokeObserver(null, enums.etype.M_CACHE_UPDATE_TAB); - mEvent.invokeObserver(null, enums.etype.M_SPLASH_DISABLE); - })); + mEvent.invokeObserver(null, enums.etype.M_CACHE_UPDATE_TAB); + mEvent.invokeObserver(null, enums.etype.M_SPLASH_DISABLE); + }); + }); mEvent.invokeObserver(null, enums.etype.M_WELCOME_MESSAGE); mOrbotLogManager.setClickable(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { @@ -684,18 +685,79 @@ class homeViewController mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); } - private void triggerPostUI(){ - expandTopBar(); + private void triggerPostUI(int pOffsetY){ + expandTopBar(false, pOffsetY); if(mProgressBar.getProgress()>0 && mProgressBar.getProgress()<10000){ mProgressBar.animate().setStartDelay(0).alpha(1); } } - public void expandTopBar(){ - Object mTag = mAppBar.getTag(R.id.expandableBar); - if(mTag!=null && (boolean) mTag){ + public void disableExpand(){ + + View child = mAppBar.getChildAt(0); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); + params.setScrollFlags(0); + + } + + @SuppressLint("WrongConstant") + private void enableCollapsing() { + View child = mAppBar.getChildAt(0); + AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); + params.setScrollFlags(1); + } + public void expandTopBar(boolean pForced, int pOffsetY){ + + if(pOffsetY == -1){ mAppBar.setExpanded(true,true); + disableExpand(); + }else { + enableCollapsing(); } + + new Handler().postDelayed(() -> + { + mTopBarContainer.getLayoutTransition().setDuration(200); + Object mTag = mAppBar.getTag(R.id.expandableBar); + if(mIsTopBarExpanded && !pForced){ + return; + } + + + if(mTag!=null && (boolean) mTag){ + mAppBar.setExpanded(true,true); + mIsTopBarExpanded = true; + Log.i("wwwwww1","wwwwww"); + } + }, 100); + + } + + public void shrinkTopBar(boolean pForced, int pOffsetY){ + + if(pOffsetY == -1){ + mAppBar.setExpanded(true,true); + disableExpand(); + }else { + enableCollapsing(); + } + + mTopBarContainer.getLayoutTransition().setDuration(0); + new Handler().postDelayed(() -> + { + mTopBarContainer.getLayoutTransition().setDuration(200); + Object mTag = mAppBar.getTag(R.id.expandableBar); + + if(!mIsTopBarExpanded && !pForced){ + return; + } + + if(mTag!=null && (boolean) mTag){ + mIsTopBarExpanded = false; + mAppBar.setExpanded(false,true); + Log.i("wwwwww2","wwwwww"); + } + }, 100); } /*-------------------------------------------------------Helper Methods-------------------------------------------------------*/ @@ -867,15 +929,8 @@ class homeViewController mSearchbar.setTag(R.id.msearchbarProcessing,true); url = CONST_GENESIS_DOMAIN_URL; } - else if(url.startsWith(CONST_GENESIS_HELP_URL_CACHE) || url.startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){ - mSearchbar.setTag(R.id.msearchbarProcessing,true); - url = CONST_GENESIS_HELP_URL; - } - else if(helperMethod.getHost(helperMethod.completeURL(url)).contains("genesis") || helperMethod.getHost(helperMethod.completeURL(url)).contains("boogle")){ - mSearchbar.setTag(R.id.msearchbarProcessing,true); - }else { - mSearchbar.setTag(R.id.msearchbarProcessing,false); - } + + Log.i("FUCK::5",url); if(!mSearchbar.hasFocus() || pClearText || pBypassFocus){ if(mSearchEngineBar.getVisibility() == View.GONE || pBypassFocus){ @@ -1010,7 +1065,7 @@ class homeViewController mNewTab.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1)); mMenu.setColorFilter(ContextCompat.getColor(mContext, R.color.c_navigation_tint)); - mVoiceInput.setColorFilter(ContextCompat.getColor(mContext, R.color.c_navigation_tint)); + mVoiceInput.setColorFilter(ContextCompat.getColor(mContext, R.color.c_text_v8)); mSearchbar.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1)); mSearchbar.setHintTextColor(ContextCompat.getColor(mContext, R.color.c_text_v2)); @@ -1352,6 +1407,8 @@ class homeViewController this.mBlockerFullSceen.animate().setStartDelay(0).setDuration(200).alpha(0).withEndAction(() -> mBlockerFullSceen.setVisibility(View.GONE)); mContext.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); initTopBarPadding(); + + mIsTopBarExpanded = false; mAppBar.setExpanded(true,false); mAppBar.refreshDrawableState(); mAppBar.invalidate(); 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 a303bc72..bca37541 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 @@ -15,7 +15,7 @@ import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.example.myapplication.R; -import org.torproject.android.proxy.wrapper.logRowModel; +import org.torproject.android.service.wrapper.logRowModel; import java.util.ArrayList; import java.util.List; 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 5ec6eb67..694252d7 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 @@ -24,7 +24,7 @@ import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; import com.google.android.material.floatingactionbutton.FloatingActionButton; -import org.torproject.android.proxy.wrapper.orbotLocalConstants; +import org.torproject.android.service.wrapper.orbotLocalConstants; import java.util.Collections; import java.util.List; 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 ee3928e4..9a243b98 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 @@ -2,7 +2,7 @@ package com.darkweb.genesissearchengine.appManager.orbotLogManager; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.helperManager.helperMethod; -import org.torproject.android.proxy.wrapper.logRowModel; +import org.torproject.android.service.wrapper.logRowModel; import java.util.ArrayList; class orbotLogModel diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java index 8e624cf9..caf6ccdf 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/accessibilityManager/settingAccessibilityController.java @@ -2,6 +2,7 @@ package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityM import android.content.res.Configuration; import android.os.Bundle; +import android.os.Handler; import android.view.View; import android.widget.SeekBar; import android.widget.TextView; @@ -171,6 +172,12 @@ public class settingAccessibilityController extends AppCompatActivity { mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING, Collections.singletonList(!mZoom.isChecked())); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,status.sSettingEnableZoom)); mZoom.toggle(); + + new Handler().postDelayed(() -> + { + activityContextManager.getInstance().getHomeController().onReload(null); + }, 300); + } public void onVoiceInputSettingUpdate(View view){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java index d84e6165..3adec515 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/settingManager/clearManager/settingClearController.java @@ -8,8 +8,10 @@ import android.widget.CheckBox; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatDelegate; import androidx.core.content.ContextCompat; import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController; import com.darkweb.genesissearchengine.databaseManager.databaseController; import com.darkweb.genesissearchengine.appManager.helpManager.helpController; import com.darkweb.genesissearchengine.constants.constants; @@ -160,9 +162,25 @@ public class settingClearController extends AppCompatActivity { if(mHomeInvoked){ activityContextManager.getInstance().getHomeController().onClearSettings(); } + + } private void onClearSettings(){ + + boolean mIsThemeChangable = false; + if(!status.sDefaultNightMode){ + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); + mIsThemeChangable = true; + } + }else { + if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); + mIsThemeChangable = true; + } + } + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true)); @@ -197,6 +215,15 @@ public class settingClearController extends AppCompatActivity { dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); + + if(mIsThemeChangable) { + status.mThemeApplying = true; + onBackPressed(); + overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); + activityContextManager.getInstance().getHomeController().onReInitTheme(); + activityContextManager.getInstance().getSettingController().onReInitTheme(); + helperMethod.openActivity(settingClearController.class, constants.CONST_LIST_HISTORY, settingClearController.this, true); + } } /* LOCAL OVERRIDES */ 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 a9774419..97c70c73 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 @@ -356,7 +356,9 @@ public class tabController extends Fragment onClearSelection(null); } initTabCount(400); - activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); + new Handler().postDelayed(() -> { + activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); + }, 500); mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.INIT_FIRST_ROW, null); onSwipeBounce(0); } @@ -375,19 +377,19 @@ public class tabController extends Fragment mTabAdapter.notifyDataSetChanged(); onClearSelection(null); }); - activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); new Handler().postDelayed(() -> { + activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); onSwipeBounce(0); - }, 400); + }, 500); return true; }else{ onShowUndoDialog(); mTabAdapter.notifyItemRangeChanged(pIndex, mTabAdapter.getItemCount() - pIndex); mTabAdapter.notifyItemChanged(0); - activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); new Handler().postDelayed(() -> { + activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); onSwipeBounce(0); - }, 400); + }, 500); return true; } } @@ -435,7 +437,10 @@ public class tabController extends Fragment mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG, null); mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.REINIT_DATA, Collections.singletonList(mBackup)); } - activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); + + new Handler().postDelayed(() -> { + activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); + }, 500); }, 100); } @@ -498,7 +503,9 @@ public class tabController extends Fragment mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_SHOW_SELECTION_MENU, Arrays.asList(false,0)); mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_SELECTION, null); - activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); + new Handler().postDelayed(() -> { + activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); + }, 500); // mTabAdapter.notifyDataSetChanged(); initTabCount(400); 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 d5182275..de514b43 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -4,7 +4,7 @@ public class enums { /*Settings Manager*/ public enum etype{ - on_update_favicon,ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW,ON_NEW_TAB_ANIMATION, M_UPDATE_SESSION_STATE,ON_LOAD_REQUEST,GECKO_SCROLL_CHANGED,ON_UPDATE_SEARCH_BAR,M_ON_MAIL,SESSION_ID,M_UPDATE_PIXEL_BACKGROUND,M_CACHE_UPDATE_TAB, + M_CHANGE_HOME_THEME, on_update_favicon,M_RELOAD,ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW,ON_NEW_TAB_ANIMATION, M_UPDATE_SESSION_STATE,ON_LOAD_REQUEST, GECKO_SCROLL_UP, GECKO_SCROLL_UP_ALWAYS, GECKO_SCROLL_DOWN, GECKO_SCROLL_DOWN_CALLER,ON_UPDATE_SEARCH_BAR,M_ON_MAIL,SESSION_ID,M_UPDATE_PIXEL_BACKGROUND, M_INIT_PADDING,M_CACHE_UPDATE_TAB, on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,M_DOWNLOAD_FAILURE, welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT_FORCED,M_SPLASH_DISABLE,M_NEW_LINK_IN_NEW_TAB,M_RESET_SUGGESTION, url_triggered, url_triggered_new_tab,url_clear,fetch_favicon,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB, diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java index 6b57dfd9..7cfdea26 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -33,6 +33,7 @@ public class status public static String sExternalWebsite = strings.GENERIC_EMPTY_STR; public static String sBridgesDefault = strings.BRIDGES_DEFAULT; + public static boolean sUIInteracted = false; public static boolean sSettingEnableZoom = true; public static boolean sSettingEnableVoiceInput = true; public static boolean sSettingSearchHistory = false; @@ -43,6 +44,7 @@ public class status public static boolean sSettingIsAppPaused = false; public static boolean sSettingIsWelcomeEnabled = true; public static boolean sSettingIsAppStarted = false; + public static boolean sSettingIsAppRunning = false; public static boolean sSettingIsAppRedirected = false; public static boolean sSettingIsAppRestarting = false; public static boolean sSettingIsAppRated = false; @@ -88,6 +90,7 @@ public class status { versionVerifier(pContext); + status.sUIInteracted = false; status.sSettingSearchHistory = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); status.sSearchSuggestionStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); status.sSettingJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true)); 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 5c993740..efc40f3e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java @@ -109,6 +109,10 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess } } + if(mCurrentList.size()<=0) { + mCurrentList.add( mSize,new historyRowModel("Genesis Search", "genesis.onion",-1)); + } + return mCurrentList; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java b/app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java index d0fc9b94..8e3ba5ad 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java @@ -50,7 +50,7 @@ public class databaseController /*Initializations*/ public void prepareDatabaseEnvironment(AppCompatActivity app_context) { - File databaseFile = app_context.getDatabasePath(CONST_DATABASE_NAME); + File databaseFile = app_context.getDatabasePath(CONST_DATABASE_NAME + "_SECURE"); if (!databaseFile.exists()) { databaseFile.getParentFile().mkdirs(); @@ -63,7 +63,7 @@ public class databaseController { SQLiteDatabase.loadLibs(app_context); prepareDatabaseEnvironment(app_context); - mDatabaseInstance = mDatabaseInstance.openOrCreateDatabase(app_context.getDatabasePath(CONST_DATABASE_NAME), constants.CONST_ENCRYPTION_KEY_DATABASE,null, wrapHook(null)); + mDatabaseInstance = mDatabaseInstance.openOrCreateDatabase(app_context.getDatabasePath(CONST_DATABASE_NAME + "_SECURE"), constants.CONST_ENCRYPTION_KEY_DATABASE,null, wrapHook(null)); mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "history" + " (id INT(4) PRIMARY KEY,date DATETIME,url VARCHAR,title VARCHAR);"); mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "bookmark" + " (id INT(4) PRIMARY KEY,title VARCHAR,url VARCHAR);"); @@ -159,22 +159,26 @@ public class databaseController public ArrayList selectTabs(){ ArrayList mTempListModel = new ArrayList<>(); - Cursor c = mDatabaseInstance.rawQuery("SELECT * FROM tab ORDER BY date DESC", null); + Cursor c = mDatabaseInstance.rawQuery("SELECT * FROM tab ORDER BY date ASC", null); if (c.moveToFirst()){ do { geckoSession mSession = activityContextManager.getInstance().getHomeController().onNewTabInit(); tabRowModel model = new tabRowModel(c.getString(0), c.getString(1),c.getBlob(4)); GeckoSession.SessionState session = null; try { - if(status.sRestoreTabs){ + // if(status.sRestoreTabs){ session = GeckoSession.SessionState.fromString(c.getString(6)); - } + // } } catch (Exception ex) { ex.printStackTrace(); } model.setSession(mSession, c.getString(3),c.getString(2), c.getString(5), session); model.getSession().setSessionID(model.getmId()); - mTempListModel.add(model); + if(session != null){ + mTempListModel.add(0, model); + }else { + mTempListModel.add(model); + } } while(c.moveToNext()); } c.close(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalNavigationController.java b/app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalNavigationController.java index 93d39c41..66d9fc9d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalNavigationController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/externalNavigationManager/externalNavigationController.java @@ -10,29 +10,46 @@ import com.darkweb.genesissearchengine.appManager.homeManager.homeController.hom import com.darkweb.genesissearchengine.constants.status; import com.example.myapplication.R; +import org.torproject.android.service.wrapper.orbotLocalConstants; + 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(); - Uri data = externalNavigationController.this.getIntent().getData(); - activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString()); + activityContextManager.getInstance().onClearStack(); - - final Handler handler = new Handler(); - handler.postDelayed(() -> { - Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.darkweb.genesissearchengine"); - startActivity(launchIntent); + 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); + + 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); - Uri data = this.getIntent().getData(); if(data!=null){ if(activityContextManager.getInstance().getHomeController()!=null){ activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString()); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java index 999567a1..627f2621 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java @@ -22,7 +22,11 @@ import android.widget.Toast; import androidx.core.app.NotificationCompat; import androidx.core.content.FileProvider; + +import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.netcipher.client.StrongHttpsClient; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.example.myapplication.R; import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log; import org.torproject.android.proxy.util.Prefs; @@ -37,6 +41,7 @@ import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.text.DecimalFormat; +import java.util.Arrays; import java.util.Collections; import ch.boye.httpclientandroidlib.HttpHost; @@ -196,10 +201,7 @@ public class localFileDownloader extends AsyncTask { } catch (Exception ex) { Log.i("FIZZAHFUCK", ex.getMessage()); - if(mRequestCode>300){ - mEvent.invokeObserver(Collections.singletonList(mRequestCode), M_DOWNLOAD_FAILURE); - //Toast.makeText(context,"Request Forbidden Error Code : ",mRequestCode).show(); - } + mEvent.invokeObserver(Collections.singletonList(mRequestCode), M_DOWNLOAD_FAILURE); onCancel(); } }else { @@ -260,9 +262,7 @@ public class localFileDownloader extends AsyncTask { output.close(); mStream.close(); }catch (Exception ex){ - if(mRequestCode>300){ - mEvent.invokeObserver(Collections.singletonList(mRequestCode), M_DOWNLOAD_FAILURE); - } + pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(Collections.singletonList(mRequestCode), activityContextManager.getInstance().getHomeController()), pluginEnums.eMessageManager.M_DOWNLOAD_FAILURE); onCancel(); } } @@ -299,7 +299,7 @@ public class localFileDownloader extends AsyncTask { build.addAction(0, null, null); build.setContentIntent(pendingIntent); build.setContentText("Download complete"); - build.setSmallIcon(R.xml.ic_check); + build.setSmallIcon(R.drawable.ic_download_complete); build.setColor(Color.parseColor("#84989f")); build.setProgress(0, 0, false); build.setAutoCancel(true); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/userEngagementNotification.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/userEngagementNotification.java index 3a9ffd80..4fe222dd 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/userEngagementNotification.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/userEngagementNotification.java @@ -11,15 +11,12 @@ import android.content.pm.PackageManager; import android.graphics.Color; import android.os.Build; import androidx.core.app.NotificationCompat; -import androidx.core.content.ContextCompat; import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.example.myapplication.R; -import org.torproject.android.proxy.wrapper.orbotLocalConstants; - import java.util.Random; public class userEngagementNotification extends BroadcastReceiver { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java index b44459c7..d1782715 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java @@ -441,7 +441,6 @@ class messageManager mDialog.dismiss(); } }); - mDialog.setOnDismissListener(dialog -> onClearReference()); } private void downloadFileLongPress() @@ -565,7 +564,6 @@ class messageManager }; handler.postDelayed(runnable, 1000); }); - mDialog.setOnDismissListener(dialog -> onClearReference()); } void onReset(){ 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 e642349c..732b3b3f 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java @@ -6,7 +6,7 @@ import androidx.appcompat.app.AppCompatActivity; import org.mozilla.gecko.PrefsHelper; import org.torproject.android.proxy.OrbotService; import org.torproject.android.proxy.util.Prefs; -import org.torproject.android.proxy.wrapper.orbotLocalConstants; +import org.torproject.android.service.wrapper.orbotLocalConstants; import java.lang.ref.WeakReference; import java.util.List; @@ -47,7 +47,7 @@ class orbotManager orbotLocalConstants.mIsManualBridge = status.sBridgeGatewayManual; orbotLocalConstants.mManualBridgeType = status.sBridgeCustomType; Prefs.putBridgesEnabled(status.sBridgeStatus); - Intent mServiceIntent = new Intent(mAppContext.get(), OrbotService.class); + Intent mServiceIntent = new Intent(mAppContext.get().getApplicationContext(), OrbotService.class); mServiceIntent.setAction(ACTION_START); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mAppContext.get().getApplicationContext().startForegroundService(mServiceIntent); @@ -200,6 +200,12 @@ class orbotManager return OrbotService.getServiceObject().getProxyStatus(); } + private void onDestroy(){ + if(!status.mThemeApplying) { + OrbotService.getServiceObject().onDestroy(); + } + } + /*External Triggers*/ Object onTrigger(List pData, pluginEnums.eOrbotManager pEventType) { @@ -263,6 +269,10 @@ class orbotManager { newCircuit(); } + else if(pEventType.equals(pluginEnums.eOrbotManager.M_DESTROY)) + { + onDestroy(); + } return null; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java index f396a4e7..aacb7b51 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java @@ -1,5 +1,8 @@ package com.darkweb.genesissearchengine.pluginManager; +import android.os.Handler; +import android.view.View; + import androidx.appcompat.app.AppCompatActivity; import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; @@ -203,7 +206,10 @@ public class pluginController ((homeController)mHomeController.get()).onLoadURL(pData.get(0).toString()); } else if(pEventType.equals(M_PANIC_RESET)){ - activityContextManager.getInstance().getHomeController().panicExitInvoked(); + new Handler().postDelayed(() -> + { + activityContextManager.getInstance().getHomeController().panicExitInvoked(); + }, 300); } else if(pEventType.equals(M_DOWNLOAD_SINGLE)){ if(pData.size()<3){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java index b40ebf3f..8fcf4518 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginEnums.java @@ -46,6 +46,6 @@ public class pluginEnums /*Orbot Manager*/ public enum eOrbotManager{ - M_GET_NOTIFICATION_STATUS, M_NEW_CIRCUIT,M_ENABLE_NOTIFICATION, M_DISABLE_NOTIFICATION, M_DISABLE_NOTIFICATION_NO_BANDWIDTH, M_GET_LOGS, M_UPDATE_PRIVACY,M_START_ORBOT,M_IS_ORBOT_RUNNING, M_GET_ORBOT_STATUS, M_UPDATE_BRIDGES, M_UPDATE_VPN, M_SET_PROXY, M_SHOW_NOTIFICATION_STATUS, M_ORBOT_RUNNING + M_GET_NOTIFICATION_STATUS, M_NEW_CIRCUIT, M_DESTROY,M_ENABLE_NOTIFICATION, M_DISABLE_NOTIFICATION, M_DISABLE_NOTIFICATION_NO_BANDWIDTH, M_GET_LOGS, M_UPDATE_PRIVACY,M_START_ORBOT,M_IS_ORBOT_RUNNING, M_GET_ORBOT_STATUS, M_UPDATE_BRIDGES, M_UPDATE_VPN, M_SET_PROXY, M_SHOW_NOTIFICATION_STATUS, M_ORBOT_RUNNING } } \ No newline at end of file diff --git a/app/src/main/java/com/widget/search/searchWidgetManager.java b/app/src/main/java/com/widget/search/searchWidgetManager.java index c831d823..3bbef96a 100644 --- a/app/src/main/java/com/widget/search/searchWidgetManager.java +++ b/app/src/main/java/com/widget/search/searchWidgetManager.java @@ -3,20 +3,27 @@ package com.widget.search; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; +import android.appwidget.AppWidgetProviderInfo; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.Color; import android.os.Bundle; +import android.util.Log; import android.widget.RemoteViews; +import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.example.myapplication.R; public class searchWidgetManager extends AppWidgetProvider { private static final String SHARED_PREF_FILE = "com.example.android.appwidgetsample"; private static final String COUNT_KEY = "count"; + private static int mCurrentWidth = -1; private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { @@ -43,9 +50,10 @@ public class searchWidgetManager extends AppWidgetProvider { views.setOnClickPendingIntent(R.id.pSearchLogo, pendingUpdate); views.setOnClickPendingIntent(R.id.pTopBarContainer, pendingUpdate); - views.setOnClickPendingIntent(R.id.pSearchInput, pendingUpdate); + views.setOnClickPendingIntent(R.id.pSearchInputWidget, pendingUpdate); views.setOnClickPendingIntent(R.id.pVoiceInput, mpintentUpdate); appWidgetManager.updateAppWidget(appWidgetId, views); + } public void onReceive(Context context, Intent intent) { @@ -103,10 +111,34 @@ public class searchWidgetManager extends AppWidgetProvider { } } + @Override + public void onAppWidgetOptionsChanged (Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle widgetInfo) { + int width = widgetInfo.getInt (AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH); + mCurrentWidth = width; + int[] appWidgetIds = new int[1]; + appWidgetIds[0] = appWidgetId; + onUpdate(context, appWidgetManager, appWidgetIds); + } + + private int getColsNum (int size) { + return (int) Math.floor ((size - 30) / 70); + } + @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int appWidgetId : appWidgetIds) { updateAppWidget(context, appWidgetManager, appWidgetId); + + int size = getColsNum(mCurrentWidth); + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); + if(mCurrentWidth!=-1){ + if(size<=2){ + views.setTextColor(R.id.pSearchInputWidget, Color.WHITE); + }else { + views.setTextColor(R.id.pSearchInputWidget, Color.GRAY); + } + appWidgetManager.updateAppWidget(appWidgetIds, views); + } } } } \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_generic_input_white.xml b/app/src/main/res/custom-xml/generic/xml/gx_generic_input_white.xml index 9cfc70ea..e523c31d 100644 --- a/app/src/main/res/custom-xml/generic/xml/gx_generic_input_white.xml +++ b/app/src/main/res/custom-xml/generic/xml/gx_generic_input_white.xml @@ -6,7 +6,7 @@ - + - + diff --git a/app/src/main/res/layouts/home/layout/home_view.xml b/app/src/main/res/layouts/home/layout/home_view.xml index 40d977ad..2d8a0b89 100644 --- a/app/src/main/res/layouts/home/layout/home_view.xml +++ b/app/src/main/res/layouts/home/layout/home_view.xml @@ -25,6 +25,7 @@ android:background="@color/c_background" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:fitsSystemWindows="true" + app:layout_scrollFlags="scroll|exitUntilCollapsed|snap" android:translationZ="3dp"> + app:layout_scrollFlags="scroll|exitUntilCollapsed|snap" + android:orientation="vertical"> + app:layout_scrollFlags="scroll|exitUntilCollapsed|snap" + app:layout_constraintTop_toTopOf="parent">