mirror of https://github.com/LeOS-GSI/LeOS-Genesis
parent
5d6508fb2b
commit
d386ea59ec
|
@ -102,6 +102,17 @@ public class geckoClients
|
||||||
onUpdateFont();
|
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){
|
public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
|
||||||
boolean mStatus = mSession.onValidateInitializeFromStartup();
|
boolean mStatus = mSession.onValidateInitializeFromStartup();
|
||||||
|
@ -632,7 +643,7 @@ public class geckoClients
|
||||||
if(e_type.equals(enums.etype.SESSION_ID)){
|
if(e_type.equals(enums.etype.SESSION_ID)){
|
||||||
return mSession.getSessionID();
|
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()){
|
if(mSession!=null && mSession.isClosed()){
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -384,6 +384,7 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
|
||||||
mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update));
|
mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update));
|
||||||
}else {
|
}else {
|
||||||
if(progress==100){
|
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")){
|
if(!mCurrentURL.contains("genesis") && helperMethod.getHost(mCurrentURL).contains(".onion")){
|
||||||
checkApplicationRate();
|
checkApplicationRate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
private boolean mSearchBarLoading = false;
|
private boolean mSearchBarLoading = false;
|
||||||
private boolean mSearchBarLoadingOpening = false;
|
private boolean mSearchBarLoadingOpening = false;
|
||||||
private boolean mSearchBarWasBackButtonPressed = false;
|
private boolean mSearchBarWasBackButtonPressed = false;
|
||||||
|
private boolean mWasEdittextChanged = false;
|
||||||
private String mSearchBarPreviousText = strings.GENERIC_EMPTY_STR;
|
private String mSearchBarPreviousText = strings.GENERIC_EMPTY_STR;
|
||||||
private Handler mScrollHandler = null;
|
private Handler mScrollHandler = null;
|
||||||
private Runnable mScrollRunnable = null;
|
private Runnable mScrollRunnable = null;
|
||||||
|
@ -377,7 +378,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
|
|
||||||
public void onUpdateBannerAdvert(){
|
public void onUpdateBannerAdvert(){
|
||||||
mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED));
|
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(){
|
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)
|
if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE)
|
||||||
{
|
{
|
||||||
onSearchBarInvoked(v);
|
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);
|
mHomeViewController.onClearSelections(true);
|
||||||
mGeckoClient.setLoading(true);
|
mGeckoClient.setLoading(true);
|
||||||
|
|
||||||
|
@ -930,6 +937,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
mWasEdittextChanged = true;
|
||||||
new Handler().postDelayed(() ->
|
new Handler().postDelayed(() ->
|
||||||
{
|
{
|
||||||
String mText = mSearchbar.getText().toString();
|
String mText = mSearchbar.getText().toString();
|
||||||
|
@ -946,6 +954,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
}
|
}
|
||||||
if(mSearchBarLoadingOpening){
|
if(mSearchBarLoadingOpening){
|
||||||
mSuggestions = (ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION, Collections.singletonList(mText));
|
mSuggestions = (ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION, Collections.singletonList(mText));
|
||||||
|
mSearchBarPreviousText = mSearchbar.getText().toString();
|
||||||
mHomeViewController.onUpdateSearchEngineBar(true, 0);
|
mHomeViewController.onUpdateSearchEngineBar(true, 0);
|
||||||
onUpdateSuggestionList(mSuggestions);
|
onUpdateSuggestionList(mSuggestions);
|
||||||
mEdittextChanged.postDelayed(postToServerRunnable, 0);
|
mEdittextChanged.postDelayed(postToServerRunnable, 0);
|
||||||
|
@ -953,7 +962,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mSearchBarLoading = false;
|
mSearchBarLoading = false;
|
||||||
|
|
||||||
mEdittextChanged.removeCallbacks(postToServerRunnable);
|
mEdittextChanged.removeCallbacks(postToServerRunnable);
|
||||||
mSuggestions = (ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mText));
|
mSuggestions = (ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mText));
|
||||||
mEdittextChanged.postDelayed(postToServerRunnable, 150);
|
mEdittextChanged.postDelayed(postToServerRunnable, 150);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -994,6 +1003,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
status.sUIInteracted = true;
|
status.sUIInteracted = true;
|
||||||
if(!hasFocus)
|
if(!hasFocus)
|
||||||
{
|
{
|
||||||
|
mWasEdittextChanged = false;
|
||||||
mSearchBarWasBackButtonPressed = true;
|
mSearchBarWasBackButtonPressed = true;
|
||||||
new Handler().postDelayed(() ->
|
new Handler().postDelayed(() ->
|
||||||
{
|
{
|
||||||
|
@ -1044,6 +1054,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
|
|
||||||
public void onSearchBarInvoked(View view){
|
public void onSearchBarInvoked(View view){
|
||||||
String url = mGeckoClient.getSession().getCurrentURL();
|
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());
|
String validated_url = mHomeModel.urlComplete(url, mHomeModel.getSearchEngine());
|
||||||
url = validated_url;
|
url = validated_url;
|
||||||
|
|
||||||
|
@ -1087,7 +1103,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mGeckoClient.getSession().setTheme(null);
|
mGeckoClient.getSession().setTheme(null);
|
||||||
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true);
|
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true);
|
||||||
mHomeViewController.onNewTabAnimation(Collections.singletonList(helperMethod.getDomainName(mHomeModel.getSearchEngine())), M_HOME_BUTTON_PRESSED);
|
mHomeViewController.onNewTabAnimation(Collections.singletonList(helperMethod.getDomainName(mHomeModel.getSearchEngine())), M_HOME_BUTTON_PRESSED);
|
||||||
mGeckoClient.onExtentionClicked();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*TAB CONTROLLER EVENTS*/
|
/*TAB CONTROLLER EVENTS*/
|
||||||
|
@ -1148,7 +1163,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mHomeViewController.progressBarReset();
|
mHomeViewController.progressBarReset();
|
||||||
mHomeViewController.onUpdateSearchBar(url,false,true, false);
|
mHomeViewController.onUpdateSearchBar(url,false,true, false);
|
||||||
mGeckoClient.loadURL(url, mGeckoView, homeController.this);
|
mGeckoClient.loadURL(url, mGeckoView, homeController.this);
|
||||||
Log.i("superman2222","superman2222");
|
|
||||||
if(isRemovable){
|
if(isRemovable){
|
||||||
mGeckoClient.setRemovableFromBackPressed(true);
|
mGeckoClient.setRemovableFromBackPressed(true);
|
||||||
}
|
}
|
||||||
|
@ -1168,18 +1182,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba
|
||||||
mAppBar.setTag(R.id.expandableBar,false);
|
mAppBar.setTag(R.id.expandableBar,false);
|
||||||
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false));
|
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false));
|
||||||
|
|
||||||
geckoSession mSession = mGeckoClient.getSession();
|
geckoSession mNewSession = mGeckoClient.initializeBackground(mGeckoView, new geckoViewCallback(), this,true);
|
||||||
mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,true);
|
onSaveCurrentTab(mNewSession,false);
|
||||||
geckoSession mNewSession = mGeckoClient.getSession();
|
|
||||||
|
|
||||||
mGeckoClient.initURL(url);
|
mNewSession.setURL(url);
|
||||||
mGeckoClient.getSession().setURL(url);
|
|
||||||
onSaveCurrentTab(mGeckoClient.getSession(),false);
|
|
||||||
onLoadTab(mSession,false,false, false);
|
|
||||||
mHomeViewController.progressBarReset();
|
mHomeViewController.progressBarReset();
|
||||||
|
|
||||||
initTabCountForced();
|
initTabCountForced();
|
||||||
mHomeViewController.onUpdateSearchBar(mSession.getCurrentURL(),false,true, false);
|
|
||||||
mNewSession.loadUri(url);
|
mNewSession.loadUri(url);
|
||||||
|
|
||||||
mAppBar.setTag(R.id.expandableBar,true);
|
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)){
|
else if(e_type.equals(enums.etype.ON_FIRST_PAINT)){
|
||||||
mHomeViewController.onFirstPaint();
|
mHomeViewController.onFirstPaint();
|
||||||
|
}
|
||||||
|
else if(e_type.equals(enums.etype.ON_INVOKE_PARSER)){
|
||||||
mGeckoClient.onExtentionClicked();
|
mGeckoClient.onExtentionClicked();
|
||||||
}
|
}
|
||||||
else if(e_type.equals(enums.etype.ON_SESSION_REINIT)){
|
else if(e_type.equals(enums.etype.ON_SESSION_REINIT)){
|
||||||
|
|
|
@ -244,6 +244,8 @@ class homeViewController
|
||||||
|
|
||||||
mBannerAds.setMinimumHeight(mBannerAds.getHeight());
|
mBannerAds.setMinimumHeight(mBannerAds.getHeight());
|
||||||
layoutParams.setMargins(0, mBannerAds.getHeight() + mTopBar.getHeight(), 0, 0);
|
layoutParams.setMargins(0, mBannerAds.getHeight() + mTopBar.getHeight(), 0, 0);
|
||||||
|
|
||||||
|
initTopBarPadding();
|
||||||
}else {
|
}else {
|
||||||
layoutParams.setMargins(0, helperMethod.pxFromDp(60), 0, 0);
|
layoutParams.setMargins(0, helperMethod.pxFromDp(60), 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -258,29 +260,9 @@ class homeViewController
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!status.sFullScreenBrowsing){
|
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 {
|
}else {
|
||||||
int paddingDp = 0;
|
int paddingDp = 0;
|
||||||
if(isFullScreen){
|
if(isFullScreen){
|
||||||
|
@ -1655,7 +1637,7 @@ class homeViewController
|
||||||
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60));
|
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60));
|
||||||
} else {
|
} 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) {
|
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60 + 60));
|
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60 + 60));
|
||||||
} else {
|
} else {
|
||||||
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60 + mBannerAds.getHeight() + 10));
|
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60) + mBannerAds.getHeight() + mTopBar.getHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
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,
|
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,
|
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*/
|
/*General Enums*/
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class keys
|
||||||
public static final String EXTERNAL_SHORTCUT_COMMAND_NAVIGATE = "EXTERNAL_SHORTCUT_COMMAND";
|
public static final String EXTERNAL_SHORTCUT_COMMAND_NAVIGATE = "EXTERNAL_SHORTCUT_COMMAND";
|
||||||
|
|
||||||
/*Admanager*/
|
/*Admanager*/
|
||||||
public static final String ADMANAGER_APPID_KEY = "c122efbe224f46678800d2f73389d258";
|
public static final String ADMANAGER_APPID_KEY = "0ac59b0996d947309c33f59d6676399f";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class strings
|
||||||
public static final String GENERIC_EMPTY_STR = "";
|
public static final String GENERIC_EMPTY_STR = "";
|
||||||
public static final String GENERIC_EMPTY_SPACE = " ";
|
public static final String GENERIC_EMPTY_SPACE = " ";
|
||||||
public static final String GENERIC_EMPTY_DOT = ".";
|
public static final String GENERIC_EMPTY_DOT = ".";
|
||||||
|
public static final String GENERIC_EMPTY_null = "null";
|
||||||
|
|
||||||
/*Language Manager*/
|
/*Language Manager*/
|
||||||
public static final String LANGUAGE_NOT_SUPPORTED = "is unsupported";
|
public static final String LANGUAGE_NOT_SUPPORTED = "is unsupported";
|
||||||
|
|
|
@ -5,10 +5,12 @@ import android.annotation.SuppressLint;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.android.volley.DefaultRetryPolicy;
|
||||||
import com.android.volley.Request;
|
import com.android.volley.Request;
|
||||||
import com.android.volley.RequestQueue;
|
import com.android.volley.RequestQueue;
|
||||||
import com.android.volley.Response;
|
import com.android.volley.Response;
|
||||||
import com.android.volley.VolleyError;
|
import com.android.volley.VolleyError;
|
||||||
|
import com.android.volley.toolbox.JsonObjectRequest;
|
||||||
import com.android.volley.toolbox.StringRequest;
|
import com.android.volley.toolbox.StringRequest;
|
||||||
import com.android.volley.toolbox.Volley;
|
import com.android.volley.toolbox.Volley;
|
||||||
import com.darkweb.genesissearchengine.constants.keys;
|
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.constants.strings;
|
||||||
import com.darkweb.genesissearchengine.dataManager.models.crawlerRowModel;
|
import com.darkweb.genesissearchengine.dataManager.models.crawlerRowModel;
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
@ -38,6 +43,11 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
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")
|
@SuppressLint("CommitPrefEdits")
|
||||||
class crawlerDataModel
|
class crawlerDataModel
|
||||||
{
|
{
|
||||||
|
@ -96,29 +106,40 @@ class crawlerDataModel
|
||||||
mTitle = doc.title();
|
mTitle = doc.title();
|
||||||
mKeywords = metas.get("keywords");
|
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){
|
if(mDescription.length()<200){
|
||||||
Elements p= doc.getElementsByTag("h1");
|
Elements p= doc.getElementsByTag("h1");
|
||||||
for (Element x: p) {
|
for (Element x: p) {
|
||||||
mDescription+= x.text();
|
mDescription+= " " + x.text();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mDescription.length()<200){
|
if(mDescription.length()<200){
|
||||||
Elements p= doc.getElementsByTag("p");
|
Elements p= doc.getElementsByTag("p");
|
||||||
for (Element x: p) {
|
for (Element x: p) {
|
||||||
mDescription+= x.text();
|
mDescription+= " " + x.text();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mDescription = mDescription.trim().replaceAll(" +", " ");
|
mDescription = mDescription.trim().replaceAll(" +", " ");
|
||||||
mDescription = mDescription.trim().replaceAll("\n", "");
|
mDescription = mDescription.trim().replaceAll("\n", "");
|
||||||
|
|
||||||
if(mTitle!=null && mTitle.length()>500){
|
if(mTitle!=null && mTitle.length()>500){
|
||||||
mTitle.substring(0,500);
|
mTitle = mTitle.substring(0,500);
|
||||||
}
|
}
|
||||||
if(mDescription!=null && mDescription.length()>1000){
|
if(mDescription!=null && mDescription.length()>1000){
|
||||||
mDescription.substring(0,1000);
|
mDescription = mDescription.substring(0,1000);
|
||||||
}
|
}
|
||||||
if(mKeywords!=null && mKeywords.length()>500){
|
if(mKeywords!=null && mKeywords.length()>500){
|
||||||
mKeywords.substring(0,500);
|
mKeywords = mKeywords.substring(0,500);
|
||||||
}
|
}
|
||||||
if(mDescription.length()<=10){
|
if(mDescription.length()<=10){
|
||||||
return;
|
return;
|
||||||
|
@ -141,6 +162,9 @@ class crawlerDataModel
|
||||||
}
|
}
|
||||||
mKeywords = URLEncoder.encode(mKeywords);
|
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;
|
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,
|
StringRequest stringRequest = new StringRequest(Request.Method.GET, mURL_POST,
|
||||||
|
@ -154,8 +178,6 @@ class crawlerDataModel
|
||||||
RequestQueue requestQueue = Volley.newRequestQueue(mContext);
|
RequestQueue requestQueue = Volley.newRequestQueue(mContext);
|
||||||
requestQueue.add(stringRequest);
|
requestQueue.add(stringRequest);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -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")){
|
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;
|
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;
|
return enums.AddTabCallback.TAB_ADDED;
|
||||||
}
|
}
|
||||||
|
@ -338,7 +334,7 @@ class tabDataModel
|
||||||
}
|
}
|
||||||
else if(pCommands == dataEnums.eTabCommands.M_ADD_TAB){
|
else if(pCommands == dataEnums.eTabCommands.M_ADD_TAB){
|
||||||
int mTabs = addTabs((geckoSession)pData.get(0), (boolean)pData.get(1));
|
int mTabs = addTabs((geckoSession)pData.get(0), (boolean)pData.get(1));
|
||||||
activityContextManager.getInstance().getHomeController().initTabCountForced();
|
//activityContextManager.getInstance().getHomeController().initTabCountForced();
|
||||||
|
|
||||||
return mTabs;
|
return mTabs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
|
||||||
import com.darkweb.genesissearchengine.constants.enums;
|
import com.darkweb.genesissearchengine.constants.enums;
|
||||||
|
import com.darkweb.genesissearchengine.constants.status;
|
||||||
import com.darkweb.genesissearchengine.constants.strings;
|
import com.darkweb.genesissearchengine.constants.strings;
|
||||||
import com.darkweb.genesissearchengine.eventObserver;
|
import com.darkweb.genesissearchengine.eventObserver;
|
||||||
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
import com.darkweb.genesissearchengine.helperManager.helperMethod;
|
||||||
|
@ -57,6 +58,7 @@ public class messageManager implements View.OnClickListener, DialogInterface.OnD
|
||||||
private eventObserver.eventListener mEvent;
|
private eventObserver.eventListener mEvent;
|
||||||
private Dialog mDialog = null;
|
private Dialog mDialog = null;
|
||||||
private pluginEnums.eMessageManagerCallbacks mCallbackInstance;
|
private pluginEnums.eMessageManagerCallbacks mCallbackInstance;
|
||||||
|
private Handler mToastHandler = new Handler();
|
||||||
|
|
||||||
/*Initializations*/
|
/*Initializations*/
|
||||||
|
|
||||||
|
@ -143,10 +145,10 @@ public class messageManager implements View.OnClickListener, DialogInterface.OnD
|
||||||
mDialog.setOnDismissListener(this);
|
mDialog.setOnDismissListener(this);
|
||||||
mPopupToastContainer.setBackground(helperMethod.getDrawableXML(mContext, pBackground));
|
mPopupToastContainer.setBackground(helperMethod.getDrawableXML(mContext, pBackground));
|
||||||
|
|
||||||
helperMethod.onDelayHandler(mContext, pDelay, () -> {
|
mToastHandler.postDelayed(() ->
|
||||||
|
{
|
||||||
onDismiss();
|
onDismiss();
|
||||||
return null;
|
}, pDelay);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onPanic(){
|
private void onPanic(){
|
||||||
|
@ -672,6 +674,7 @@ public class messageManager implements View.OnClickListener, DialogInterface.OnD
|
||||||
|
|
||||||
public void onTrigger(List<Object> pData, pluginEnums.eMessageManager pEventType)
|
public void onTrigger(List<Object> pData, pluginEnums.eMessageManager pEventType)
|
||||||
{
|
{
|
||||||
|
mToastHandler.removeCallbacksAndMessages(null);
|
||||||
if(!pEventType.equals(M_RATE_FAILURE) && !pEventType.equals(M_RATE_SUCCESS) && !pEventType.equals(M_NOT_SUPPORTED)){
|
if(!pEventType.equals(M_RATE_FAILURE) && !pEventType.equals(M_RATE_SUCCESS) && !pEventType.equals(M_NOT_SUPPORTED)){
|
||||||
onClearReference();
|
onClearReference();
|
||||||
mData = null;
|
mData = null;
|
||||||
|
@ -792,7 +795,7 @@ public class messageManager implements View.OnClickListener, DialogInterface.OnD
|
||||||
|
|
||||||
case M_LOAD_NEW_TAB:
|
case M_LOAD_NEW_TAB:
|
||||||
/*VERIFIED*/
|
/*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;
|
break;
|
||||||
|
|
||||||
case M_UNDO:
|
case M_UNDO:
|
||||||
|
|
Loading…
Reference in New Issue