diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index c1506234..6eea2210 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -5,10 +5,6 @@
-
-
-
-
@@ -22,6 +18,7 @@
+
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java
index 7f971109..8a008b22 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkController.java
@@ -16,6 +16,9 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -51,6 +54,8 @@ public class bookmarkController extends AppCompatActivity
private homeController mHomeController;
private activityContextManager mContextManager;
private bookmarkAdapter mbookmarkAdapter;
+ private LinearLayout mHeaderContainer;
+ private TextView mTitle;
/*Private Views*/
@@ -91,28 +96,19 @@ public class bookmarkController extends AppCompatActivity
mClearButton = findViewById(R.id.pClearButton);
mMenuButton = findViewById(R.id.pMenuButton);
mSearchButton = findViewById(R.id.pSearchButton);
+ mTitle = findViewById(R.id.pTitle);
+ mHeaderContainer = findViewById(R.id.pHeaderContainer);
- mbookmarkViewController = new bookmarkViewController(mEmptyListNotification, mSearchInput, mRecycleView, mClearButton,this, mMenuButton, mSearchButton);
+ mbookmarkViewController = new bookmarkViewController(mEmptyListNotification, mSearchInput, mRecycleView, mClearButton,this, mMenuButton, mSearchButton, mHeaderContainer, mTitle);
}
+
public void initializeList(){
ArrayList model = (ArrayList) dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_GET_BOOKMARK ,null);
mbookmarkModel.setList(model);
bookmarkAdapter adapter = new bookmarkAdapter(mbookmarkModel.getList(),new adapterCallback(), this);
mbookmarkAdapter = adapter;
adapter.invokeFilter(false);
- mRecycleView.setNestedScrollingEnabled(false);
- mRecycleView.setHasFixedSize(true);
-
- mRecycleView.setItemAnimator(new FadeInRightAnimator());
- Objects.requireNonNull(mRecycleView.getItemAnimator()).setAddDuration(200);
- mRecycleView.getItemAnimator().setRemoveDuration(200);
- mRecycleView.getItemAnimator().setMoveDuration(200);
- mRecycleView.getItemAnimator().setChangeDuration(450);
-
mRecycleView.setAdapter(adapter);
- mRecycleView.setItemViewCacheSize(100);
- mRecycleView.setDrawingCacheEnabled(true);
- mRecycleView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
mRecycleView.setLayoutManager(new LinearLayoutManager(this));
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mbookmarkModel.getList().size(),0));
@@ -235,14 +231,14 @@ public class bookmarkController extends AppCompatActivity
}else if((Boolean) mbookmarkAdapter.onTrigger(bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_STATUS,null)){
onClearMultipleSelection(null);
}else {
- onBackPressed(null);
+ finish();
}
}
/*External XML Listeners*/
public void onBackPressed(View view){
- this.finish();
+ onBackPressed();
}
public void onHideSearch(View view) {
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 e244fd1d..ed0f931b 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
@@ -10,14 +10,20 @@ import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import android.view.animation.Animation;
+import android.view.animation.Transformation;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.PopupWindow;
+import android.widget.TextView;
+
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
@@ -31,21 +37,23 @@ class bookmarkViewController
{
/*Private Variables*/
private AppCompatActivity mContext;
-
private ImageView mEmptyListNotification;
private EditText mSearchInput;
private RecyclerView mRecycleView;
private Button mClearButton;
private ImageButton mMenuButton;
private ImageButton mSearchButton;
+ private PopupWindow mPopupWindow = null;
+ private LinearLayout mHeaderContainer;
+ private TextView mTitle;
/*Private Local Variables*/
private Paint mPainter = new Paint();
- private PopupWindow mPopupWindow = null;
+ private boolean isClearButtonVisible = true;
/*Initializations*/
- bookmarkViewController(ImageView pEmptyListNotification, EditText pSearchInput, RecyclerView pRecycleView, Button pClearButton,AppCompatActivity pContext,ImageButton pMenuButton,ImageButton pSearchButton)
+ bookmarkViewController(ImageView pEmptyListNotification, EditText pSearchInput, RecyclerView pRecycleView, Button pClearButton,AppCompatActivity pContext,ImageButton pMenuButton,ImageButton pSearchButton, LinearLayout pHeaderContainer, TextView pTitle)
{
this.mEmptyListNotification = pEmptyListNotification;
this.mSearchInput = pSearchInput;
@@ -54,6 +62,8 @@ class bookmarkViewController
this.mContext = pContext;
this.mMenuButton = pMenuButton;
this.mSearchButton = pSearchButton;
+ this.mHeaderContainer = pHeaderContainer;
+ this.mTitle = pTitle;
initPostUI();
}
@@ -86,20 +96,21 @@ class bookmarkViewController
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mEmptyListNotification.animate().setDuration(pDuration).alpha(1f);
- mClearButton.animate().setDuration(pDuration).alpha(0.4f);
- mSearchButton.animate().setDuration(pDuration).alpha(0f);
- mMenuButton.animate().setDuration(pDuration).alpha(0f);
+ mSearchButton.setAlpha(0f);
+ mMenuButton.setAlpha(0f);
mClearButton.setEnabled(false);
mSearchButton.setClickable(false);
mMenuButton.setClickable(false);
mSearchInput.setVisibility(View.GONE);
- mClearButton.setAlpha(0f);
- mClearButton.animate().setDuration(300).alpha(1);
+ mTitle.setVisibility(View.VISIBLE);
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mClearButton.setText(strings.BOOKMARK_NO_BOOKMARK_FOUND);
mClearButton.setClickable(false);
+
+ mClearButton.getLayoutParams().height = 0;
+ mClearButton.requestLayout();
}
}
@@ -113,10 +124,11 @@ class bookmarkViewController
private void onSelectionMenu(boolean pStatus){
if(!pStatus){
mClearButton.setClickable(false);
- mClearButton.animate().cancel();
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
- mClearButton.animate().setDuration(200).alpha(0.4f);
mMenuButton.setVisibility(View.VISIBLE);
+ collapse(mClearButton);
+ //mHeaderContainer.setElevation(0);
+ mTitle.setVisibility(View.VISIBLE);
mSearchButton.setVisibility(View.GONE);
if (mSearchInput.getVisibility() == View.VISIBLE){
onHideSearch();
@@ -125,12 +137,9 @@ class bookmarkViewController
if (mSearchInput.getVisibility() != View.VISIBLE) {
mClearButton.setClickable(true);
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
- mClearButton.animate().cancel();
- mClearButton.animate().setDuration(200).alpha(1);
}
mMenuButton.setVisibility(View.GONE);
mSearchButton.setVisibility(View.VISIBLE);
-
}
}
@@ -155,36 +164,108 @@ class bookmarkViewController
private boolean onHideSearch() {
if(mSearchInput.getVisibility() == View.VISIBLE){
- mSearchInput.animate().cancel();
- mSearchInput.animate().alpha(0).setDuration(150).withEndAction(() -> {
+ mSearchInput.animate().setDuration(200).alpha(0).withEndAction(() -> {
mSearchInput.getText().clear();
mSearchInput.setVisibility(View.GONE);
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
+
+ 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);
+
+ mSearchInput.setText(strings.GENERIC_EMPTY_STR);
+ mSearchInput.setClickable(false);
+ mClearButton.setClickable(true);
+ mClearButton.animate().setDuration(150).alpha(1);
});
- mSearchInput.setText(strings.GENERIC_EMPTY_STR);
- mSearchInput.setClickable(false);
- mClearButton.setClickable(true);
- mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
- mClearButton.animate().cancel();
- mClearButton.animate().setDuration(150).alpha(1f);
+
return false;
}else {
- mSearchInput.animate().cancel();
mSearchInput.setAlpha(0f);
- mSearchInput.animate().setDuration(150).alpha(1);
mSearchInput.setVisibility(View.VISIBLE);
+ mSearchInput.animate().setDuration(300).alpha(1);
mSearchInput.setClickable(true);
mClearButton.setClickable(false);
mSearchInput.requestFocus();
- mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
- mClearButton.animate().cancel();
- mClearButton.animate().setDuration(150).alpha(0.4f);
+ mClearButton.animate().setDuration(300).alpha(0.3f);
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
+ mSearchButton.setVisibility(View.GONE);
+ mMenuButton.setVisibility(View.GONE);
+ mTitle.setVisibility(View.GONE);
return true;
}
}
+ public void expand(final View v) {
+ if(isClearButtonVisible){
+ v.animate().alpha(1);
+ v.measure(CoordinatorLayout.LayoutParams.MATCH_PARENT, CoordinatorLayout.LayoutParams.WRAP_CONTENT);
+ final int targtetHeight = v.getMeasuredHeight();
+ v.getLayoutParams().height = 0;
+ Animation a = new Animation() {
+ @Override
+ protected void applyTransformation(float interpolatedTime,
+ Transformation t) {
+ v.getLayoutParams().height = interpolatedTime == 1 ? CoordinatorLayout.LayoutParams.WRAP_CONTENT
+ : (int) (targtetHeight * interpolatedTime);
+ v.requestLayout();
+ mClearButton.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public boolean willChangeBounds() {
+ return true;
+ }
+ };
+ a.setDuration(250);
+ v.startAnimation(a);
+ }
+ }
+
+ public void collapse(final View v) {
+ int[] location = new int[2];
+ v.getLocationOnScreen(location);
+
+ if(location[1]==207){
+ isClearButtonVisible = true;
+ }else {
+ isClearButtonVisible = false;
+ return;
+ }
+
+ v.animate().alpha(1);
+
+ if(mClearButton.getVisibility() == View.VISIBLE){
+ final int initialHeight = v.getMeasuredHeight();
+ v.animate().alpha(0);
+ Animation a = new Animation() {
+ @Override
+ protected void applyTransformation(float interpolatedTime,
+ Transformation t) {
+ if (interpolatedTime == 1) {
+ v.setVisibility(View.GONE);
+ } else {
+ v.getLayoutParams().height = initialHeight
+ - (int) (initialHeight * interpolatedTime);
+ v.requestLayout();
+ }
+ }
+
+ @Override
+ public boolean willChangeBounds() {
+ return true;
+ }
+ };
+ a.setDuration(250);
+ v.startAnimation(a);
+ }
+ }
+
private void onLongPressMenu(View pView) {
mPopupWindow = helperMethod.onCreateMenu(pView, R.layout.recyclerview__menu);
}
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 3b53fdc8..ec4e1df2 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
@@ -16,6 +16,9 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -37,8 +40,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import java.util.Objects;
-import jp.wasabeef.recyclerview.animators.FadeInRightAnimator;
import static com.darkweb.genesissearchengine.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU;
public class historyController extends AppCompatActivity
@@ -49,6 +50,8 @@ public class historyController extends AppCompatActivity
private homeController mHomeController;
private activityContextManager mContextManager;
private historyAdapter mHistoryAdapter;
+ private LinearLayout mHeaderContainer;
+ private TextView mTitle;
/*Private Views*/
@@ -91,22 +94,19 @@ public class historyController extends AppCompatActivity
mClearButton = findViewById(R.id.pClearButton);
mMenuButton = findViewById(R.id.pMenuButton);
mSearchButton = findViewById(R.id.pSearchButton);
+ mHeaderContainer = findViewById(R.id.pHeaderContainer);
+ mTitle = findViewById(R.id.pTitle);
- mHistoryViewController = new historyViewController(mEmptyListNotification, mSearchInput, mRecycleView, mClearButton,this, mMenuButton, mSearchButton);
+ mHistoryViewController = new historyViewController(mEmptyListNotification, mSearchInput, mRecycleView, mClearButton,this, mMenuButton, mSearchButton, mHeaderContainer, mTitle);
}
+
public void initializeList(){
ArrayList model = (ArrayList) dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_GET_HISTORY ,null);
mHistoryModel.setList(model);
historyAdapter adapter = new historyAdapter(mHistoryModel.getList(),new adapterCallback(), this);
mHistoryAdapter = adapter;
adapter.invokeFilter(false);
- mRecycleView.setNestedScrollingEnabled(false);
- mRecycleView.setHasFixedSize(true);
-
mRecycleView.setAdapter(adapter);
- mRecycleView.setItemViewCacheSize(100);
- mRecycleView.setDrawingCacheEnabled(true);
- mRecycleView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
mRecycleView.setLayoutManager(new LinearLayoutManager(this));
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mHistoryModel.getList().size(),0));
@@ -139,7 +139,9 @@ public class historyController extends AppCompatActivity
});
mClearButton.requestFocusFromTouch();
- mClearButton.setOnClickListener(v -> pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHistoryController(), Collections.singletonList(strings.GENERIC_EMPTY_STR), enums.etype.clear_history));
+ mClearButton.setOnClickListener(v -> {
+ pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHistoryController(), Collections.singletonList(strings.GENERIC_EMPTY_STR), enums.etype.clear_history);
+ });
mSearchInput.setOnEditorActionListener((v, actionId, event) ->{
if (actionId == EditorInfo.IME_ACTION_NEXT)
@@ -152,10 +154,11 @@ public class historyController extends AppCompatActivity
mSearchInput.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
- mSearchInput.clearFocus();
+ //mSearchInput.clearFocus();
+ //onHideSearch(null);
}else {
- mHistoryAdapter.setFilter(mSearchInput.getText().toString());
- mHistoryAdapter.invokeFilter(true);
+ //mHistoryAdapter.setFilter(mSearchInput.getText().toString());
+ //mHistoryAdapter.invokeFilter(true);
}
});
@@ -255,14 +258,14 @@ public class historyController extends AppCompatActivity
}else if((Boolean) mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.GET_LONG_SELECTED_STATUS,null)){
onClearMultipleSelection(null);
}else {
- onBackPressed(null);
+ finish();
}
}
/*External XML Listeners*/
public void onBackPressed(View view){
- this.finish();
+ onBackPressed();
}
public void onHideSearch(View view) {
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 a101e963..c82bd988 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
@@ -10,14 +10,20 @@ import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import android.view.animation.Animation;
+import android.view.animation.Transformation;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.PopupWindow;
+import android.widget.TextView;
+
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
@@ -38,13 +44,15 @@ class historyViewController
private ImageButton mMenuButton;
private ImageButton mSearchButton;
private PopupWindow mPopupWindow = null;
+ private TextView mTitle;
/*Private Local Variables*/
private Paint mPainter = new Paint();
+ private boolean isClearButtonVisible = true;
/*Initializations*/
- historyViewController(ImageView pEmptyListNotification, EditText pSearchInput, RecyclerView pRecycleView, Button pClearButton,AppCompatActivity pContext,ImageButton pMenuButton,ImageButton pSearchButton)
+ historyViewController(ImageView pEmptyListNotification, EditText pSearchInput, RecyclerView pRecycleView, Button pClearButton,AppCompatActivity pContext,ImageButton pMenuButton,ImageButton pSearchButton, LinearLayout pHeaderContainer, TextView pTitle)
{
this.mEmptyListNotification = pEmptyListNotification;
this.mSearchInput = pSearchInput;
@@ -53,6 +61,7 @@ class historyViewController
this.mContext = pContext;
this.mMenuButton = pMenuButton;
this.mSearchButton = pSearchButton;
+ this.mTitle = pTitle;
initPostUI();
}
@@ -85,19 +94,21 @@ class historyViewController
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mEmptyListNotification.animate().setDuration(pDuration).alpha(1f);
- mClearButton.animate().setDuration(pDuration).alpha(0.4f);
- mSearchButton.animate().setDuration(pDuration).alpha(0f);
- mMenuButton.animate().setDuration(pDuration).alpha(0f);
+ mSearchButton.setAlpha(0f);
+ mMenuButton.setAlpha(0f);
mClearButton.setEnabled(false);
mSearchButton.setClickable(false);
mMenuButton.setClickable(false);
mSearchInput.setVisibility(View.GONE);
- mClearButton.animate().setDuration(300).alpha(1);
+ mTitle.setVisibility(View.VISIBLE);
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mClearButton.setText(strings.HISTORY_NO_HISTORY_FOUND);
mClearButton.setClickable(false);
+
+ mClearButton.getLayoutParams().height = 0;
+ mClearButton.requestLayout();
}
}
@@ -111,10 +122,10 @@ class historyViewController
private void onSelectionMenu(boolean pStatus){
if(!pStatus){
mClearButton.setClickable(false);
- mClearButton.animate().cancel();
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
- mClearButton.animate().setDuration(200).alpha(0.4f);
mMenuButton.setVisibility(View.VISIBLE);
+ collapse(mClearButton);
+ mTitle.setVisibility(View.VISIBLE);
mSearchButton.setVisibility(View.GONE);
if (mSearchInput.getVisibility() == View.VISIBLE){
onHideSearch();
@@ -123,12 +134,9 @@ class historyViewController
if (mSearchInput.getVisibility() != View.VISIBLE) {
mClearButton.setClickable(true);
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
- mClearButton.animate().cancel();
- mClearButton.animate().setDuration(200).alpha(1);
}
mMenuButton.setVisibility(View.GONE);
mSearchButton.setVisibility(View.VISIBLE);
-
}
}
@@ -153,36 +161,108 @@ class historyViewController
private boolean onHideSearch() {
if(mSearchInput.getVisibility() == View.VISIBLE){
- mSearchInput.animate().cancel();
- mSearchInput.animate().alpha(0).setDuration(150).withEndAction(() -> {
+ mSearchInput.animate().setDuration(200).alpha(0).withEndAction(() -> {
mSearchInput.getText().clear();
mSearchInput.setVisibility(View.GONE);
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
+
+ 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);
+
+ mSearchInput.setText(strings.GENERIC_EMPTY_STR);
+ mSearchInput.setClickable(false);
+ mClearButton.setClickable(true);
+ mClearButton.animate().setDuration(150).alpha(1);
});
- mSearchInput.setText(strings.GENERIC_EMPTY_STR);
- mSearchInput.setClickable(false);
- mClearButton.setClickable(true);
- mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
- mClearButton.animate().cancel();
- mClearButton.animate().setDuration(150).alpha(1f);
+
return false;
}else {
- mSearchInput.animate().cancel();
mSearchInput.setAlpha(0f);
- mSearchInput.animate().setDuration(150).alpha(1);
mSearchInput.setVisibility(View.VISIBLE);
+ mSearchInput.animate().setDuration(300).alpha(1);
mSearchInput.setClickable(true);
mClearButton.setClickable(false);
mSearchInput.requestFocus();
- mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
- mClearButton.animate().cancel();
- mClearButton.animate().setDuration(150).alpha(0.4f);
+ mClearButton.animate().setDuration(300).alpha(0.3f);
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
+ mSearchButton.setVisibility(View.GONE);
+ mMenuButton.setVisibility(View.GONE);
+ mTitle.setVisibility(View.GONE);
return true;
}
}
+ public void expand(final View v) {
+ if(isClearButtonVisible){
+ v.animate().alpha(1);
+ v.measure(CoordinatorLayout.LayoutParams.MATCH_PARENT, CoordinatorLayout.LayoutParams.WRAP_CONTENT);
+ final int targtetHeight = v.getMeasuredHeight();
+ v.getLayoutParams().height = 0;
+ Animation a = new Animation() {
+ @Override
+ protected void applyTransformation(float interpolatedTime,
+ Transformation t) {
+ v.getLayoutParams().height = interpolatedTime == 1 ? CoordinatorLayout.LayoutParams.WRAP_CONTENT
+ : (int) (targtetHeight * interpolatedTime);
+ v.requestLayout();
+ mClearButton.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public boolean willChangeBounds() {
+ return true;
+ }
+ };
+ a.setDuration(250);
+ v.startAnimation(a);
+ }
+ }
+
+ public void collapse(final View v) {
+ int[] location = new int[2];
+ v.getLocationOnScreen(location);
+
+ if(location[1]==207){
+ isClearButtonVisible = true;
+ }else {
+ isClearButtonVisible = false;
+ return;
+ }
+
+ v.animate().alpha(1);
+
+ if(mClearButton.getVisibility() == View.VISIBLE){
+ final int initialHeight = v.getMeasuredHeight();
+ v.animate().alpha(0);
+ Animation a = new Animation() {
+ @Override
+ protected void applyTransformation(float interpolatedTime,
+ Transformation t) {
+ if (interpolatedTime == 1) {
+ v.setVisibility(View.GONE);
+ } else {
+ v.getLayoutParams().height = initialHeight
+ - (int) (initialHeight * interpolatedTime);
+ v.requestLayout();
+ }
+ }
+
+ @Override
+ public boolean willChangeBounds() {
+ return true;
+ }
+ };
+ a.setDuration(250);
+ v.startAnimation(a);
+ }
+ }
+
private void onLongPressMenu(View pView) {
mPopupWindow = helperMethod.onCreateMenu(pView, R.layout.recyclerview__menu);
}
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/NestedGeckoView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/NestedGeckoView.java
new file mode 100644
index 00000000..f48b9c08
--- /dev/null
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/NestedGeckoView.java
@@ -0,0 +1,144 @@
+package com.darkweb.genesissearchengine.appManager.homeManager;
+
+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 java.util.Collections;
+
+import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_CHANGED;
+
+public class NestedGeckoView extends GeckoView {
+ private int mLastY;
+ private final int[] mScrollOffset = new int[2];
+ private final int[] mScrollConsumed = new int[2];
+ private int mNestedOffsetY;
+ private final NestedScrollingChildHelper mChildHelper;
+ private eventObserver.eventListener mEvent;
+
+
+ public void onSetHomeEvent(eventObserver.eventListener pEvent){
+ mEvent = pEvent;
+ }
+
+ public NestedGeckoView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ mChildHelper = new NestedScrollingChildHelper(this);
+ setNestedScrollingEnabled(true);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ 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);
+
+ switch (action) {
+ case MotionEvent.ACTION_MOVE:
+ final boolean allowScroll = status.sFullScreenBrowsing;
+ int deltaY = mLastY - eventY;
+
+ if (allowScroll && dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) {
+ deltaY -= mScrollConsumed[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(0, mScrollOffset[1]);
+ mNestedOffsetY += mScrollOffset[1];
+ }
+
+ if(status.sFullScreenBrowsing){
+ Log.i("wow1", eventY + "");
+ mEvent.invokeObserver(Collections.singletonList(deltaY), GECKO_SCROLL_CHANGED);
+ }
+
+ break;
+
+ case MotionEvent.ACTION_DOWN:
+ mLastY = eventY;
+ startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL);
+ break;
+
+ case MotionEvent.ACTION_UP:
+ case MotionEvent.ACTION_CANCEL:
+ stopNestedScroll();
+ break;
+
+ default:
+ // We don't care about other touch events
+ }
+
+ // Execute event handler from parent class in all cases
+ boolean eventHandled = super.onTouchEvent(event);
+
+ // Recycle previously obtained event
+ event.recycle();
+
+ return eventHandled;
+ }
+
+ @Override
+ public void setNestedScrollingEnabled(boolean enabled) {
+ mChildHelper.setNestedScrollingEnabled(enabled);
+ }
+
+ @Override
+ public boolean isNestedScrollingEnabled() {
+ return mChildHelper.isNestedScrollingEnabled();
+ }
+
+ @Override
+ public boolean startNestedScroll(int axes) {
+ return mChildHelper.startNestedScroll(axes);
+ }
+
+ @Override
+ public void stopNestedScroll() {
+ mChildHelper.stopNestedScroll();
+ }
+
+ @Override
+ public boolean hasNestedScrollingParent() {
+ return mChildHelper.hasNestedScrollingParent();
+ }
+
+ @Override
+ public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) {
+ return mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow);
+ }
+
+ @Override
+ public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) {
+ return mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow);
+ }
+
+ @Override
+ public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) {
+ return mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed);
+ }
+
+ @Override
+ public boolean dispatchNestedPreFling(float velocityX, float velocityY) {
+ return mChildHelper.dispatchNestedPreFling(velocityX, velocityY);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoSession.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoSession.java
index dc373656..49f3dd72 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoSession.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoSession.java
@@ -18,6 +18,7 @@ import android.os.Environment;
import android.os.Handler;
import android.util.Base64;
import android.util.Log;
+import android.view.View;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillValue;
import android.widget.Toast;
@@ -25,6 +26,7 @@ import org.mozilla.gecko.EventDispatcher;
import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
import androidx.annotation.UiThread;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
@@ -54,6 +56,9 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
+
+import mozilla.components.browser.engine.gecko.GleanMetrics.Geckoview;
+
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
@@ -84,13 +89,13 @@ public class geckoSession extends GeckoSession implements GeckoSession.ScrollDel
this.mGeckoView = pGeckoView;
this.mContext = mContext;
this.mSessionID = mSessionID;
+
setProgressDelegate(this);
setHistoryDelegate(this);
setNavigationDelegate(this);
setContentDelegate(this);
setAutoFillDelegate();
setPermissionDelegate(this);
- setScrollDelegate(this);
mDownloadManager = new geckoDownloadManager();
setPromptDelegate(new geckoPromptView(mContext));
this.event = event;
@@ -118,12 +123,6 @@ public class geckoSession extends GeckoSession implements GeckoSession.ScrollDel
/*Scroll Delegate*/
- @Override
- public void onScrollChanged(GeckoSession session, int scrollX, int scrollY){
- Log.i("SUPERMAN",scrollX + " - " + scrollY);
- event.invokeObserver(Collections.singletonList(true), enums.etype.ON_UPDATE_TITLE_BAR);
- }
-
/*Autofill Delegate*/
public void setAutoFillDelegate(){
diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java
index e2f5b7e5..830b9836 100755
--- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java
+++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController.java
@@ -16,6 +16,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
+import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
@@ -25,6 +26,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.core.widget.NestedScrollView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
@@ -69,6 +71,8 @@ import java.util.Locale;
import java.util.Objects;
import java.util.concurrent.Callable;
+import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_CHANGED;
+
public class homeController extends AppCompatActivity implements ComponentCallbacks2
{
/*Model Declaration*/
@@ -77,7 +81,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private geckoClients mGeckoClient = null;
/*View Webviews*/
- private GeckoView mGeckoView = null;
+ private NestedGeckoView mGeckoView = null;
+ private FrameLayout mTopLayout;
private FrameLayout mWebViewContainer;
/*View Objects*/
@@ -100,7 +105,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private boolean mPageClosed = false;
private boolean isKeyboardOpened = false;
private boolean isSuggestionChanged = false;
- private boolean isTabMenuOpened = false;
/*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/
@@ -213,8 +217,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mSearchbar = findViewById(R.id.pSearchInput);
mLoadingIcon = findViewById(R.id.imageView_loading_back);
mLoadingText = findViewById(R.id.loadingText);
- mWebViewContainer = findViewById(R.id.webviewContainer);
- mBannerAds = findViewById(R.id.adView);
+ mWebViewContainer = findViewById(R.id.pWebLayoutView);
+ mTopLayout = findViewById(R.id.pTopLayout);
+ mBannerAds = findViewById(R.id.pAdView);
mGatewaySplash = findViewById(R.id.gateway_splash);
mTopBar = findViewById(R.id.topbar);
mBackSplash = findViewById(R.id.backsplash);
@@ -228,7 +233,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoView.setSaveFromParentEnabled(false);
mGeckoClient = new geckoClients();
- mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,(ArrayList)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null), mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount);
+ mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,(ArrayList)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null), mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount, mTopLayout);
+ mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback());
}
public void onChangeTheme(){
@@ -241,7 +247,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
try {
Class clazz = Class.forName("java.lang.Daemons$FinalizerWatchdogDaemon");
- Method method = clazz.getSuperclass().getDeclaredMethod("stop");
+ Method method = Objects.requireNonNull(clazz.getSuperclass()).getDeclaredMethod("stop");
method.setAccessible(true);
Field field = clazz.getDeclaredField("INSTANCE");
@@ -298,10 +304,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoClient.loadURL(url.replace("genesis.onion","boogle.store"));
}
- public GeckoView getmGeckoView(){
- return mGeckoView;
- }
-
public void onLoadTab(geckoSession mTempSession,boolean isSessionClosed){
if(!isSessionClosed){
dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession));
@@ -491,7 +493,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoClient.onRedrawPixel();
final Handler handler = new Handler();
mNewTab.setPressed(true);
- isTabMenuOpened = true;
handler.postDelayed(() ->
{
helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
@@ -515,6 +516,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onOpenMenu(view,mGeckoClient.canGoBack(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() ==View.INVISIBLE),mGeckoClient.getUserAgent());
}
+ public void onFullScreenSettingChanged(){
+ mHomeViewController.initTopBarPadding();
+ }
+
@Override
public void onBackPressed(){
pluginController.getInstance().logEvent(strings.EVENT_ON_BACK);
@@ -701,14 +706,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null));
}
- public void loadExistingTab(){
- tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
- if (model != null)
- {
- onLoadTab(model.getSession(), true);
- }
- }
-
/*-------------------------------------------------------CALLBACKS-------------------------------------------------------*/
public void onHideFindBar(View view){
@@ -833,6 +830,18 @@ public class homeController extends AppCompatActivity implements ComponentCallba
helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
}
+ public class nestedGeckoViewCallback implements eventObserver.eventListener{
+
+ @Override
+ public Object invokeObserver(List