From d6c0708814934ddb47462f945f83d0defc74b84a Mon Sep 17 00:00:00 2001 From: msmannan00 Date: Tue, 13 Apr 2021 13:20:07 +0500 Subject: [PATCH] Bug Fixes Bug Fixes --- app/src/main/AndroidManifest.xml | 1 + .../geckoManager/geckoSession.java | 1 - .../homeController/homeController.java | 16 ++---- .../homeController/homeViewController.java | 54 +++++++++++-------- .../appManager/tabManager/tabAdapter.java | 20 +++++-- .../appManager/tabManager/tabController.java | 31 +++++++++-- .../appManager/tabManager/tabRowModel.java | 8 +++ .../tabManager/tabViewController.java | 4 +- .../dataManager/tabDataModel.java | 8 +++ .../helperManager/localFileDownloader.java | 23 +++++++- .../pluginManager/messageManager.java | 6 ++- .../res/layouts/home/layout/home_view.xml | 35 ++++++------ 12 files changed, 140 insertions(+), 67 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d5b23f6d..1a6026bd 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,6 +15,7 @@ - { - mTabFragment.setAlpha(1f); - mTabFragment.setVisibility(View.VISIBLE); - activityContextManager.getInstance().getTabController().onInit(); - mTabFragment.setVisibility(View.GONE); - }, 500); } initSuggestionView(new ArrayList<>(), strings.GENERIC_EMPTY_STR); } @@ -551,7 +543,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } mAppBar.animate().cancel(); - mHomeViewController.onClearSelections(true); Objects.requireNonNull(mGeckoView.getSession()).stop(); mGeckoClient.loadURL(url.replace("genesis.onion","boogle.store"),mGeckoView, homeController.this); } @@ -957,6 +948,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba pURL = mVal; } + mHomeViewController.onClearSelections(true); onLoadURL(pURL); mHomeViewController.onUpdateSearchBar(pURL,false,true, false); } @@ -1015,7 +1007,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba initializeGeckoView(true, true); if(status.sOpenURLInNewTab){ if(mGeckoView.getSession()!=null && !mGeckoView.getSession().isOpen()){ - mGeckoView.getSession().open(mGeckoClient.getmRuntime()); + mGeckoView.getSession().open(mGeckoClient.getmRuntime()); } mHomeViewController. onUpdateSearchBar(helperMethod.getDomainName(status.sSettingSearchStatus),false,true, false); @@ -1562,9 +1554,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if (menuId == R.id.pMenuOpenRecentTab) { - mHomeViewController.onShowTabContainer(); - Log.i("I AM FUCKED,","I AM FUCKED : 1"); activityContextManager.getInstance().getTabController().onInit(); + mHomeViewController.onShowTabContainer(); // overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); } else if (menuId == R.id.pMenuOpenNewTab) @@ -1688,6 +1679,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba { if(e_type.equals(GECKO_SCROLL_CHANGED)){ mHomeViewController.onMoveTopBar((int)data.get(0)); + onInvokePixelGenerator(); } return null; } 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 0658cc22..be201a9f 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 @@ -790,9 +790,6 @@ class homeViewController } } - public void performDummyClick(){ - } - void updateBannerAdvertStatus(boolean status, boolean pIsAdvertLoaded){ if(status && pIsAdvertLoaded){ if(mBannerAds.getAlpha()==0){ @@ -1064,6 +1061,10 @@ class homeViewController mSearchbar.setSelection(mSearchbar.getText().length()); mSearchbar.selectAll(); } + + if(mSearchbar.getText().toString().equals("loading")){ + mSearchbar.setText("about:blank"); + } } private String removeEndingSlash(String url){ @@ -1071,8 +1072,10 @@ class homeViewController } void onNewTab(){ - mSearchbar.requestFocus(); - mSearchbar.selectAll(); + if(!mSearchbar.isFocused()){ + mSearchbar.requestFocus(); + mSearchbar.selectAll(); + } } void onUpdateLogs(String log){ @@ -1119,18 +1122,23 @@ class homeViewController public void onNewTabAnimation(List data, Object e_type){ mGeckoView.setPivotX(0); mGeckoView.setPivotY(0); - mGeckoView.setClickable(false); - mGeckoView.setFocusable(false); - mGeckoView.setEnabled(false); + //mGeckoView.setClickable(false); + //mGeckoView.setFocusable(false); + //mGeckoView.setEnabled(false); + ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mGeckoView, - PropertyValuesHolder.ofFloat("scaleX", 1, 0.35f), - PropertyValuesHolder.ofFloat("scaleY", 1, 0.35f)); - scaleDown.setDuration(300); - mNewTabBlocker.setAlpha(0f); + PropertyValuesHolder.ofFloat("scaleX", 1, 0.8f), + PropertyValuesHolder.ofFloat("scaleY", 1, 0.8f)); + mNewTabBlocker.setVisibility(View.VISIBLE); - mNewTabBlocker.animate().setDuration(300).alpha(1); - mNewTabBlocker.setTranslationZ(100); + ObjectAnimator alpha = ObjectAnimator.ofPropertyValuesHolder(mNewTabBlocker, + PropertyValuesHolder.ofFloat("alpha", 0, 1f)); + + scaleDown.setDuration(150); + alpha.setDuration(150); + scaleDown.start(); + alpha.start(); scaleDown.addListener(new Animator.AnimatorListener() { @Override @@ -1141,18 +1149,18 @@ class homeViewController public void onAnimationEnd(Animator animation, boolean isReverse) { mEvent.invokeObserver(data, e_type); ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mGeckoView, - PropertyValuesHolder.ofFloat("scaleX", 0.35f, 1f), - PropertyValuesHolder.ofFloat("scaleY", 0.35f, 1f)); - scaleDown.setDuration(300); - scaleDown.setStartDelay(650); - mNewTabBlocker.animate().setStartDelay(650).setDuration(300).alpha(0).withEndAction(() -> { - mNewTabBlocker.setAlpha(0f); + PropertyValuesHolder.ofFloat("scaleX", 0.8f, 1f), + PropertyValuesHolder.ofFloat("scaleY", 0.8f, 1f)); + + scaleDown.setDuration(150); + scaleDown.setStartDelay(0); + mNewTabBlocker.animate().setStartDelay(350).setDuration(150).alpha(0f).withEndAction(() -> { mNewTabBlocker.setVisibility(View.GONE); }); scaleDown.start(); - mGeckoView.setClickable(true); - mGeckoView.setFocusable(true); - mGeckoView.setEnabled(true); + //mGeckoView.setClickable(true); + //mGeckoView.setFocusable(true); + //mGeckoView.setEnabled(true); } @Override diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java index dfd69f53..535ed13d 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabAdapter.java @@ -350,17 +350,25 @@ public class tabAdapter extends RecyclerView.Adapter } mItemSelectionMenu.setVisibility(View.GONE); - if(model.getSession().getTitle().contains("TITLE") || model.getSession().getTitle().contains("title") || model.getSession().getTitle().toLowerCase().equals("loading")){ - mHeader.setText(helperMethod.getDomainName(mURL)); - }else { - mHeader.setText(model.getSession().getTitle()); - } if(status.sTabGridLayoutEnabled){ mDescription.setText((model.getSession().getTitle())); }else { + mHeader.setText(model.getSession().getTitle()); mDescription.setText(mURL); } + + String mHeadText = mHeader.getText().toString(); + String mDescText = mDescription.getText().toString(); + + if(mHeadText.equals("$TITLE") || mDescText.startsWith("http://loading") || mDescText.startsWith("loading")){ + mHeader.setText("about:blank"); + } + + if(mDescText.equals("$TITLE") || mDescText.startsWith("http://loading") || mDescText.startsWith("loading")){ + mDescription.setText("about:blank"); + } + mDate.setText(model.getDate()); if(mURL.equals("about:blank")){ @@ -474,6 +482,8 @@ public class tabAdapter extends RecyclerView.Adapter }else { if(status.sTabGridLayoutEnabled){ scaleView(itemView, mModelList.get(this.getLayoutPosition())); + }else { + onTriggerURL(mModelList.get(this.getLayoutPosition())); } } }else { 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 5b9921c8..0c02dded 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 @@ -1,8 +1,9 @@ package com.darkweb.genesissearchengine.appManager.tabManager; +import android.animation.ObjectAnimator; +import android.animation.PropertyValuesHolder; import android.annotation.SuppressLint; import android.content.res.Configuration; -import android.content.res.Resources; import android.graphics.Canvas; import android.os.Bundle; import android.os.Handler; @@ -47,6 +48,7 @@ public class tabController extends Fragment private ImageView mRemoveSelection; private ImageButton mMenuButton; private ImageButton mClearSelection; + private TextView mEmptyView; private View mPopupUndo; private TextView mSelectionCount; private ImageView mBlocker; @@ -70,6 +72,7 @@ public class tabController extends Fragment private float getmScreenWidth; private boolean mClosed = false; private boolean mClosedByNewTab = false; + private boolean mFirstLaunch = true; boolean mScrolled = true; /*Initializations*/ @@ -95,6 +98,7 @@ public class tabController extends Fragment mScrollHandler = null; mScrollRunnable = null; mScrolled = false; + mFirstLaunch = false; super.onDestroy(); } @@ -109,13 +113,14 @@ public class tabController extends Fragment public void onInit(){ - initializeActivity(); initializeViews(); + initializeActivity(); initializeLocalEventHandlers(); initializeList(); initSwipe(); mClosed = false; + mFirstLaunch = false; mTabGridLayoutEnabled = status.sTabGridLayoutEnabled; mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_RELEASE_BLOCKER, null); mNestedScrollView.scrollTo(0,0); @@ -125,13 +130,30 @@ public class tabController extends Fragment } public void onInitInvoked(){ + if(mFirstLaunch){ + mRecycleView.setAlpha(0); + mFirstLaunch = false; + + ObjectAnimator alpha = ObjectAnimator.ofPropertyValuesHolder(mRecycleView, PropertyValuesHolder.ofFloat("alpha", 0, 1f)); + alpha.setDuration(300); + alpha.setStartDelay(600); + alpha.start(); + mEmptyView.setAlpha(0); + new Handler().postDelayed(() -> + { + mEmptyView.setAlpha(1); + }, 1000); + }else { + mRecycleView.setAlpha(1); + mEmptyView.setAlpha(1); + } + initializeList(); mClosed = false; mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_RELEASE_BLOCKER, null); mNestedScrollView.scrollTo(0,0); mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG_INIT, null); - mRecycleView.setAlpha(1); mTabAdapter.notifyDataSetChanged(); } @@ -156,6 +178,7 @@ public class tabController extends Fragment public void initializeViews(){ mRecycleView = mRootView.findViewById(R.id.pRecycleView); mTabs = mRootView.findViewById(R.id.pTabs); + mEmptyView = mRootView.findViewById(R.id.pEmptyView); mRemoveSelection = mRootView.findViewById(R.id.pRemoveSelection); mMenuButton = mRootView.findViewById(R.id.pMenuButton); mClearSelection = mRootView.findViewById(R.id.pClearSelection); @@ -164,7 +187,7 @@ public class tabController extends Fragment mBlocker = mRootView.findViewById(R.id.pBlocker); mNestedScrollView = mRootView.findViewById(R.id.pNestedScroll); - mtabViewController = new tabViewController(this, mTabs, mRemoveSelection, mMenuButton, mClearSelection, mPopupUndo, mSelectionCount, mBlocker, mRecycleView, mNestedScrollView); + mtabViewController = new tabViewController(this, mTabs, mRemoveSelection, mMenuButton, mClearSelection, mPopupUndo, mSelectionCount, mBlocker, mRecycleView, mNestedScrollView, mEmptyView); } @SuppressLint("ClickableViewAccessibility") diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java index bcd0efef..63a2d3fb 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java @@ -4,6 +4,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; +import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.helperManager.helperMethod; public class tabRowModel @@ -44,6 +45,13 @@ public class tabRowModel mSession.setTitle(pTitle); mSession.setURL(pURL); mSession.setTheme(pTheme); + + if(!status.sSettingIsAppStarted){ + if(pTitle.equals("$TITLE") || pTitle.startsWith("http://loading") || pTitle.startsWith("loading") || pURL.equals("$TITLE") || pURL.startsWith("http://loading") || pURL.startsWith("loading")){ + mSession.setTitle("about:blank"); + mSession.setURL("about:blank"); + } + } } public String getmId() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java index 034f80fa..7b0ae252 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java @@ -51,6 +51,7 @@ class tabViewController private ImageView mBlocker; private RecyclerView mRecycleView; private NestedScrollView mNestedScrollView; + private TextView mEmptyView; /*Private Local Variables*/ private Handler mDelayHandler = new Handler(); @@ -58,7 +59,7 @@ class tabViewController /*Initializations*/ - tabViewController(Fragment mContext, Button pTabs, ImageView pRemoveSelection, ImageButton pMenuButton, ImageButton pClearSelection, View pToastLayoutRoot, TextView pSelectionCount, ImageView pBlocker, RecyclerView pRecycleView, NestedScrollView pNestedScrollView) + tabViewController(Fragment mContext, Button pTabs, ImageView pRemoveSelection, ImageButton pMenuButton, ImageButton pClearSelection, View pToastLayoutRoot, TextView pSelectionCount, ImageView pBlocker, RecyclerView pRecycleView, NestedScrollView pNestedScrollView, TextView pEmptyView) { this.mContext = mContext; this.mTabs = pTabs; @@ -70,6 +71,7 @@ class tabViewController this.mBlocker = pBlocker; this.mRecycleView = pRecycleView; this.mNestedScrollView = pNestedScrollView; + this.mEmptyView = pEmptyView; initUI(); initPostUI(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java index 60625e78..b44640ae 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java @@ -66,6 +66,14 @@ class tabDataModel params[2] = mTabModel.getSession().getTheme(); String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); + if(mTabModel.getSession().getTitle().equals("$TITLE") || mTabModel.getSession().getTitle().startsWith("http://loading") || mTabModel.getSession().getTitle().startsWith("loading")){ + return enums.AddTabCallback.TAB_ADDED; + } + + if(mTabModel.getSession().getCurrentURL().equals("$TITLE") || mTabModel.getSession().getCurrentURL().startsWith("http://loading") || mTabModel.getSession().getCurrentURL().startsWith("loading")){ + return enums.AddTabCallback.TAB_ADDED; + } + databaseController.getInstance().execSQL("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabModel.getmId() +"','" + m_date + "',?,?,?);",params); } return enums.AddTabCallback.TAB_ADDED; 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 787ac2db..7bdd70ff 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/localFileDownloader.java @@ -7,6 +7,8 @@ import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.ActivityNotFoundException; +import android.content.ContentResolver; +import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.graphics.Color; @@ -15,6 +17,8 @@ import android.os.AsyncTask; import android.os.Build; import android.os.Environment; import android.os.StrictMode; +import android.provider.MediaStore; + import androidx.core.app.NotificationCompat; import androidx.core.content.FileProvider; @@ -194,8 +198,23 @@ public class localFileDownloader extends AsyncTask { File mFile = new File(mPath); - Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", mFile); - dm.addCompletedDownload(mFileName, mURL, false, helperMethod.getMimeType(uri.toString()), mFile.getAbsolutePath(), mFile.length(), false); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", mFile); + + ContentValues contentValues = new ContentValues(); + contentValues.put(MediaStore.Downloads.TITLE, mFileName); + contentValues.put(MediaStore.Downloads.DISPLAY_NAME, mFileName); + contentValues.put(MediaStore.Downloads.SIZE, mDownloadByte); + contentValues.put(MediaStore.Downloads.MIME_TYPE, helperMethod.getMimeType(uri.toString())); + + contentValues.put(MediaStore.Downloads.RELATIVE_PATH, Environment.DIRECTORY_DOWNLOADS + File.separator + "Temp"); + + ContentResolver database = context.getContentResolver(); + database.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues); + } else { + Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", mFile); + dm.addCompletedDownload(mFileName, mURL, false, helperMethod.getMimeType(uri.toString()), mFile.getAbsolutePath(), mFile.length(), false); + } } 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 7b51016d..921829fb 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java @@ -29,6 +29,7 @@ import com.google.android.material.switchmaterial.SwitchMaterial; import org.mozilla.geckoview.ContentBlocking; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -384,12 +385,15 @@ class messageManager ((TextView) mDialog.findViewById(R.id.pDescription)).setText(mData.get(0).toString()); mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); mDialog.findViewById(R.id.pNext).setOnClickListener(v -> { + ArrayList tempData = new ArrayList<>(); + tempData.addAll(mData); mDialog.dismiss(); final Handler handler = new Handler(); Runnable runnable = () -> { - mEvent.invokeObserver(mData, M_DOWNLOAD_SINGLE); + mEvent.invokeObserver(tempData, M_DOWNLOAD_SINGLE); }; handler.postDelayed(runnable, 1000); + onClearReference(); }); mDialog.setOnDismissListener(dialog -> onClearReference()); } 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 9e093d99..160501a4 100644 --- a/app/src/main/res/layouts/home/layout/home_view.xml +++ b/app/src/main/res/layouts/home/layout/home_view.xml @@ -257,24 +257,6 @@ app:shiftDuration="@integer/progress_shift_duration" app:wrapShiftDrawable="true" tools:progress="0" /> - - - @@ -814,4 +796,21 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + \ No newline at end of file