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 bafca596..81e1bdac 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 @@ -102,6 +102,17 @@ public class geckoClients onUpdateFont(); } + public geckoSession initializeBackground(GeckoView geckoView, eventObserver.eventListener event, AppCompatActivity context, boolean isForced) + { + geckoSession mSessionTemp; + mSessionTemp = new geckoSession(new geckoViewClientCallback(),helperMethod.createRandomID(),context, geckoView); + mSessionTemp.open(mRuntime); + mSessionTemp.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); + mSessionTemp.getSettings().setFullAccessibilityTree(true); + mSessionTemp.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); + mSessionTemp.getSettings().setAllowJavascript(status.sSettingJavaStatus); + return mSessionTemp; + } public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ boolean mStatus = mSession.onValidateInitializeFromStartup(); @@ -632,7 +643,7 @@ public class geckoClients if(e_type.equals(enums.etype.SESSION_ID)){ return mSession.getSessionID(); } - else if (mSessionID!=null && mSessionID.equals(data.get(1)) || e_type.equals(enums.etype.M_RATE_COUNT) || e_type.equals(enums.etype.FINDER_RESULT_CALLBACK) || e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE) || e_type.equals(enums.etype.on_update_favicon) ||e_type.equals(enums.etype.on_update_history) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url)) + else if (mSessionID!=null && mSessionID.equals(data.get(1)) || e_type.equals(enums.etype.ON_INVOKE_PARSER) || e_type.equals(enums.etype.M_RATE_COUNT) || e_type.equals(enums.etype.FINDER_RESULT_CALLBACK) || e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE) || e_type.equals(enums.etype.on_update_favicon) ||e_type.equals(enums.etype.on_update_history) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url)) { if(mSession!=null && mSession.isClosed()){ return null; 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 9485d456..7faccc6b 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 @@ -384,6 +384,7 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update)); }else { if(progress==100){ + event.invokeObserver(Arrays.asList(mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_INVOKE_PARSER); if(!mCurrentURL.contains("genesis") && helperMethod.getHost(mCurrentURL).contains(".onion")){ checkApplicationRate(); } 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 868b6613..c5815a7a 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 @@ -193,6 +193,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba private boolean mSearchBarLoading = false; private boolean mSearchBarLoadingOpening = false; private boolean mSearchBarWasBackButtonPressed = false; + private boolean mWasEdittextChanged = false; private String mSearchBarPreviousText = strings.GENERIC_EMPTY_STR; private Handler mScrollHandler = null; private Runnable mScrollRunnable = null; @@ -377,7 +378,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void onUpdateBannerAdvert(){ mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - mHomeViewController.initSearchEngineView(); + + new Handler().postDelayed(() -> + { + mHomeViewController.initSearchEngineView(); + }, 100); } public void onLoadTabOnResume(){ @@ -864,7 +869,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE) { onSearchBarInvoked(v); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false); + if(!mSearchBarPreviousText.equals(mSearchbar.getText())){ + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false); + } mHomeViewController.onClearSelections(true); mGeckoClient.setLoading(true); @@ -930,6 +937,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba @Override public void onTextChanged(CharSequence s, int start, int before, int count) { + mWasEdittextChanged = true; new Handler().postDelayed(() -> { String mText = mSearchbar.getText().toString(); @@ -946,6 +954,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } if(mSearchBarLoadingOpening){ mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION, Collections.singletonList(mText)); + mSearchBarPreviousText = mSearchbar.getText().toString(); mHomeViewController.onUpdateSearchEngineBar(true, 0); onUpdateSuggestionList(mSuggestions); mEdittextChanged.postDelayed(postToServerRunnable, 0); @@ -953,7 +962,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mSearchBarLoading = false; mEdittextChanged.removeCallbacks(postToServerRunnable); - mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mText)); + mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mText)); mEdittextChanged.postDelayed(postToServerRunnable, 150); return; } @@ -994,6 +1003,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba status.sUIInteracted = true; if(!hasFocus) { + mWasEdittextChanged = false; mSearchBarWasBackButtonPressed = true; new Handler().postDelayed(() -> { @@ -1044,6 +1054,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void onSearchBarInvoked(View view){ String url = mGeckoClient.getSession().getCurrentURL(); + if(!mSearchBarPreviousText.equals(mSearchbar.getText().toString())){ + url = mSearchbar.getText().toString(); + }else { + url = mGeckoClient.getSession().getCurrentURL(); + } + String validated_url = mHomeModel.urlComplete(url, mHomeModel.getSearchEngine()); url = validated_url; @@ -1087,7 +1103,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGeckoClient.getSession().setTheme(null); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); mHomeViewController.onNewTabAnimation(Collections.singletonList(helperMethod.getDomainName(mHomeModel.getSearchEngine())), M_HOME_BUTTON_PRESSED); - mGeckoClient.onExtentionClicked(); } /*TAB CONTROLLER EVENTS*/ @@ -1148,7 +1163,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.progressBarReset(); mHomeViewController.onUpdateSearchBar(url,false,true, false); mGeckoClient.loadURL(url, mGeckoView, homeController.this); - Log.i("superman2222","superman2222"); if(isRemovable){ mGeckoClient.setRemovableFromBackPressed(true); } @@ -1168,18 +1182,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba mAppBar.setTag(R.id.expandableBar,false); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false)); - geckoSession mSession = mGeckoClient.getSession(); - mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,true); - geckoSession mNewSession = mGeckoClient.getSession(); + geckoSession mNewSession = mGeckoClient.initializeBackground(mGeckoView, new geckoViewCallback(), this,true); + onSaveCurrentTab(mNewSession,false); - mGeckoClient.initURL(url); - mGeckoClient.getSession().setURL(url); - onSaveCurrentTab(mGeckoClient.getSession(),false); - onLoadTab(mSession,false,false, false); + mNewSession.setURL(url); mHomeViewController.progressBarReset(); - initTabCountForced(); - mHomeViewController.onUpdateSearchBar(mSession.getCurrentURL(),false,true, false); mNewSession.loadUri(url); mAppBar.setTag(R.id.expandableBar,true); @@ -2402,6 +2410,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if(e_type.equals(enums.etype.ON_FIRST_PAINT)){ mHomeViewController.onFirstPaint(); + } + else if(e_type.equals(enums.etype.ON_INVOKE_PARSER)){ mGeckoClient.onExtentionClicked(); } else if(e_type.equals(enums.etype.ON_SESSION_REINIT)){ 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 65d8ff36..a2f9d00b 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 @@ -244,6 +244,8 @@ class homeViewController mBannerAds.setMinimumHeight(mBannerAds.getHeight()); layoutParams.setMargins(0, mBannerAds.getHeight() + mTopBar.getHeight(), 0, 0); + + initTopBarPadding(); }else { layoutParams.setMargins(0, helperMethod.pxFromDp(60), 0, 0); } @@ -258,29 +260,9 @@ class homeViewController return; } if(!status.sFullScreenBrowsing){ - /*int paddingDp = 110; - if(isFullScreen){ - paddingDp = 60; - }else { - if(mContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){ - paddingDp = 0; - }else { - mGeckoView.setPadding(0,0,0,0); - View child = mAppBar.getChildAt(0); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); - params.setScrollFlags(0); - onFullScreen(false); - return; - } - } - float density = mContext.getResources().getDisplayMetrics().density; - int paddingPixel = (int)(paddingDp * density); - mGeckoView.setPadding(0,0,0,paddingPixel); - View child = mAppBar.getChildAt(0); - AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams(); - params.setScrollFlags(0); - onFullScreen(false);*/ + + }else { int paddingDp = 0; if(isFullScreen){ @@ -1655,7 +1637,7 @@ class homeViewController if (orientation == Configuration.ORIENTATION_LANDSCAPE) { mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60)); } else { - mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(110)); + mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60)); } } } @@ -1674,7 +1656,7 @@ class homeViewController if (orientation == Configuration.ORIENTATION_LANDSCAPE) { mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60 + 60)); } else { - mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60 + mBannerAds.getHeight() + 10)); + mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60) + mBannerAds.getHeight() + mTopBar.getHeight()); } } } 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 452d2b3b..ad10f4f7 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -8,7 +8,7 @@ public class enums on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,M_DOWNLOAD_FAILURE, M_ADVERT_LOADED, 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_NEW_LINK_IN_NEW_TAB_LOAD,M_RESET_SUGGESTION, url_triggered, url_triggered_new_tab,url_clear,fetch_favicon,M_OPEN_BOOKMARK_SETTING, M_COPY_URL,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB, M_CLOSE_TAB_BACK, - on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_NEW_IDENTITY,M_INDEX_WEBSITE, M_NEW_IDENTITY_MESSAGED, M_INITIALIZE_TAB_SINGLE, M_HOME_BUTTON_PRESSED, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_FIRST_PAINT, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error, M_ORBOT_LOADING,download_file_popup,on_init_ads, M_GET_CURRENT_URL,search_update, open_new_tab,open_new_tab_instant + on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_NEW_IDENTITY,M_INDEX_WEBSITE, M_NEW_IDENTITY_MESSAGED, M_INITIALIZE_TAB_SINGLE, M_HOME_BUTTON_PRESSED, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_FIRST_PAINT, ON_INVOKE_PARSER, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error, M_ORBOT_LOADING,download_file_popup,on_init_ads, M_GET_CURRENT_URL,search_update, open_new_tab,open_new_tab_instant } /*General Enums*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java index a01c64d9..0e3463bb 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java @@ -83,7 +83,7 @@ public class keys public static final String EXTERNAL_SHORTCUT_COMMAND_NAVIGATE = "EXTERNAL_SHORTCUT_COMMAND"; /*Admanager*/ - public static final String ADMANAGER_APPID_KEY = "c122efbe224f46678800d2f73389d258"; + public static final String ADMANAGER_APPID_KEY = "0ac59b0996d947309c33f59d6676399f"; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java index 724f5e42..f350a136 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java @@ -45,6 +45,7 @@ public class strings public static final String GENERIC_EMPTY_STR = ""; public static final String GENERIC_EMPTY_SPACE = " "; public static final String GENERIC_EMPTY_DOT = "."; + public static final String GENERIC_EMPTY_null = "null"; /*Language Manager*/ public static final String LANGUAGE_NOT_SUPPORTED = "is unsupported"; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/crawlerDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/crawlerDataModel.java index cf5f0963..a8fcca4d 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/crawlerDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/crawlerDataModel.java @@ -5,10 +5,12 @@ import android.annotation.SuppressLint; import androidx.appcompat.app.AppCompatActivity; +import com.android.volley.DefaultRetryPolicy; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; +import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.darkweb.genesissearchengine.constants.keys; @@ -16,6 +18,9 @@ import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.dataManager.models.crawlerRowModel; import com.darkweb.genesissearchengine.helperManager.helperMethod; + +import org.json.JSONException; +import org.json.JSONObject; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -38,6 +43,11 @@ import java.util.List; import java.util.Map; import java.util.Set; +import ch.boye.httpclientandroidlib.NameValuePair; +import ch.boye.httpclientandroidlib.client.HttpClient; +import ch.boye.httpclientandroidlib.client.methods.HttpPost; +import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient; + @SuppressLint("CommitPrefEdits") class crawlerDataModel { @@ -96,29 +106,40 @@ class crawlerDataModel mTitle = doc.title(); mKeywords = metas.get("keywords"); + if(mDescription==null){ + mDescription = strings.GENERIC_EMPTY_null; + } + if(mTitle==null){ + mTitle = strings.GENERIC_EMPTY_null; + } + if(mKeywords==null){ + mKeywords = strings.GENERIC_EMPTY_null; + } + + if(mDescription.length()<200){ Elements p= doc.getElementsByTag("h1"); for (Element x: p) { - mDescription+= x.text(); + mDescription+= " " + x.text(); } } if(mDescription.length()<200){ Elements p= doc.getElementsByTag("p"); for (Element x: p) { - mDescription+= x.text(); + mDescription+= " " + x.text(); } } mDescription = mDescription.trim().replaceAll(" +", " "); mDescription = mDescription.trim().replaceAll("\n", ""); if(mTitle!=null && mTitle.length()>500){ - mTitle.substring(0,500); + mTitle = mTitle.substring(0,500); } if(mDescription!=null && mDescription.length()>1000){ - mDescription.substring(0,1000); + mDescription = mDescription.substring(0,1000); } if(mKeywords!=null && mKeywords.length()>500){ - mKeywords.substring(0,500); + mKeywords = mKeywords.substring(0,500); } if(mDescription.length()<=10){ return; @@ -141,6 +162,9 @@ class crawlerDataModel } mKeywords = URLEncoder.encode(mKeywords); + mDescription = "Sad"; + mTitle = "asd"; + mKeywords = "asd"; String mURL_POST = "https://www.genesishiddentechnologies.com/update_cache?url="+mURL+"&key_word="+mKeywords+"&desc="+mDescription+"&title="+mTitle+"&s_type="+mtype; StringRequest stringRequest = new StringRequest(Request.Method.GET, mURL_POST, @@ -154,8 +178,6 @@ class crawlerDataModel RequestQueue requestQueue = Volley.newRequestQueue(mContext); requestQueue.add(stringRequest); - - } } catch (Exception ex) { ex.printStackTrace(); 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 bb82a206..9b29a88b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java @@ -87,10 +87,6 @@ class tabDataModel if(mTabModel.getSession().getCurrentURL().equals("about:blank") || mTabModel.getSession().getCurrentURL().equals("$TITLE") || mTabModel.getSession().getCurrentURL().startsWith("http://loading") || mTabModel.getSession().getCurrentURL().startsWith("loading")){ return enums.AddTabCallback.TAB_ADDED; } - - if(mTabModel.getmId()!=null){ - //mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabModel.getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL); - } } return enums.AddTabCallback.TAB_ADDED; } @@ -338,7 +334,7 @@ class tabDataModel } else if(pCommands == dataEnums.eTabCommands.M_ADD_TAB){ int mTabs = addTabs((geckoSession)pData.get(0), (boolean)pData.get(1)); - activityContextManager.getInstance().getHomeController().initTabCountForced(); + //activityContextManager.getInstance().getHomeController().initTabCountForced(); return mTabs; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java index 2b0ecca6..387d2327 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messagePluginManager/messageManager.java @@ -27,6 +27,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; @@ -57,6 +58,7 @@ public class messageManager implements View.OnClickListener, DialogInterface.OnD private eventObserver.eventListener mEvent; private Dialog mDialog = null; private pluginEnums.eMessageManagerCallbacks mCallbackInstance; + private Handler mToastHandler = new Handler(); /*Initializations*/ @@ -143,10 +145,10 @@ public class messageManager implements View.OnClickListener, DialogInterface.OnD mDialog.setOnDismissListener(this); mPopupToastContainer.setBackground(helperMethod.getDrawableXML(mContext, pBackground)); - helperMethod.onDelayHandler(mContext, pDelay, () -> { + mToastHandler.postDelayed(() -> + { onDismiss(); - return null; - }); + }, pDelay); } private void onPanic(){ @@ -672,6 +674,7 @@ public class messageManager implements View.OnClickListener, DialogInterface.OnD public void onTrigger(List pData, pluginEnums.eMessageManager pEventType) { + mToastHandler.removeCallbacksAndMessages(null); if(!pEventType.equals(M_RATE_FAILURE) && !pEventType.equals(M_RATE_SUCCESS) && !pEventType.equals(M_NOT_SUPPORTED)){ onClearReference(); mData = null; @@ -792,7 +795,7 @@ public class messageManager implements View.OnClickListener, DialogInterface.OnD case M_LOAD_NEW_TAB: /*VERIFIED*/ - onShowToast(R.layout.popup_toast_generic,R.xml.ax_background_important,2000, mContext.getString(R.string.TOAST_ALERT_OPEN_NEW_TAB), mContext.getString(R.string.TOAST_ALERT_OPEN_NEW_TAB_LOAD), M_UNDO_SESSION); + onShowToast(R.layout.popup_toast_generic,R.xml.ax_background_important,2000, mContext.getString(R.string.TOAST_ALERT_OPEN_NEW_TAB), mContext.getString(R.string.TOAST_ALERT_OPEN_NEW_TAB_LOAD), null); break; case M_UNDO: