diff --git a/app/build.gradle b/app/build.gradle index 0800cee9..56989a5d 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,51 +21,24 @@ repositories { } android { - compileSdkVersion 29 - buildToolsVersion '29.0.2' + compileSdkVersion project.ext.compileSdkVersion + defaultConfig { applicationId project.ext.applicationId - minSdkVersion 21 + minSdkVersion project.ext.minSdkVersion + //targetSdkVersion project.ext.targetSdkVersion versionCode project.ext.versionCode versionName project.ext.versionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - - multiDexEnabled true } + buildToolsVersion '28.0.3' + + flavorDimensions "abi" compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } - dexOptions { - preDexLibraries true - } - - lintOptions { - lintConfig file("lint.xml") - } - - // We have a three dimensional build configuration: - // BUILD TYPE (debug, release) X PRODUCT FLAVOR (focus, klar) X ARCHITECTURE (x86, arm, aarch64) - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - splits { - abi { - enable true - reset() - include 'arm64-v8a' - include 'x86' - include 'armeabi-v7a' - include 'x86_64' - universalApk false - } - } - } flavorDimensions project.ext.dimen @@ -73,49 +46,86 @@ android { arm { versionCode project.ext.arm_vcode versionName project.ext.arm_vname - dimension project.ext.dimen + dimension "abi" + ndk { + abiFilter "armeabi-v7a" + } } aarch64 { versionCode project.ext.aarch_vcode versionName project.ext.aarch_vname - dimension project.ext.dimen + dimension "abi" + ndk { + abiFilter "arm64-v8a" + } } x86 { versionCode project.ext.x86_vcode versionName project.ext.x86_vname - dimension project.ext.dimen + dimension "abi" + ndk { + abiFilter "x86" + } } x86_64 { versionCode project.ext.x64_vcode versionName project.ext.x64_vname - dimension project.ext.dimen - } - } - - - sourceSets { - test { - resources { - srcDir "${projectDir}/src/main/assets/" + dimension "abi" + ndk { + abiFilter "x86_64" } } + signingConfigs { + release { + keyAlias 'demo' + keyPassword 'demodemo' + storeFile file("${rootProject.projectDir}/demo.keystore") + storePassword 'demodemo' + } + } } - configurations.all { - resolutionStrategy.force 'com.android.support:support-v4:26.1.0' // the lib is old dependencies version; + + + buildTypes { + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + + } + } + lintOptions { + checkReleaseBuilds false + // Or, if you prefer, you can continue to check for errors in release builds, + // but continue the build even when errors are found: + abortOnError false } } dependencies { + + // Android Support Repository dependencies + def supportVersion = '28.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.preference:preference:1.1.0' + implementation 'androidx.legacy:legacy-preference-v14:1.0.0' + implementation 'androidx.recyclerview:recyclerview:1.1.0' + + // Testing-only dependencies + androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0') { + exclude group: 'com.android.support', module: 'support-annotations' + } + /*Default Libraries*/ - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta4' implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4' - implementation 'com.google.android.material:material:1.2.0-alpha03' + implementation 'com.google.android.material:material:1.2.0-alpha04' implementation 'androidx.preference:preference:1.1.0' - implementation 'com.google.android.material:material:1.0.0' + implementation 'com.android.support:design:28.0.0' + implementation 'com.android.support:appcompat-v7:28.0.0' /*Firefox ABI Splits*/ implementation "org.mozilla.components:browser-engine-gecko:$mozilla_components_version" @@ -138,6 +148,8 @@ dependencies { /*Orbot Service*/ implementation project(path: ':orbotservice') + implementation 'com.android.support:support-v4:28.0.0' + implementation 'com.github.apl-devs:appintro:v4.2.2' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f199e6de..585b3e80 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,68 +1,70 @@ - - - + xmlns:tools="http://schemas.android.com/tools" + package="com.example.myapplication"> + + - - - - - - - + android:fullBackupContent="false" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:launchMode="singleTask" + android:networkSecurityConfig="@xml/ex_network_security_config" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/AppTheme" + android:usesCleartextTraffic="true"> + - + android:name="com.darkweb.genesissearchengine.appManager.orbotManager.orbotController" + android:launchMode="singleTop" /> + + - + + - + - @@ -81,51 +83,72 @@ - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + android:name="org.apache.http.legacy" + android:required="false" /> - + android:name="io.fabric.ApiKey" + android:value="be76c64dae2519d4ab8daaed88298da14c7c294f" /> + android:name="com.google.android.gms.ads.APPLICATION_ID" + android:value="ca-app-pub-5074525529134731~2926711128" /> - - + android:name="com.darkweb.genesissearchengine.helperManager.downloadFileService" + android:enabled="true" + android:exported="false" + android:stopWithTask="true" /> - - + android:exported="false" + android:stopWithTask="true" /> + android:permission="TODO" + android:stopWithTask="true"> - - \ No newline at end of file diff --git a/app/src/main/assets/error.html b/app/src/main/assets/error.html index a29f5596..7f39167b 100755 --- a/app/src/main/assets/error.html +++ b/app/src/main/assets/error.html @@ -20,17 +20,17 @@
-

This site can't be reached

-

An error occurred during a connection

+

$ERROR_M1

+

$ERROR_M2

$ERROR

- +
\ No newline at end of file diff --git a/app/src/main/assets/gpl.html b/app/src/main/assets/gpl.html old mode 100644 new mode 100755 diff --git a/app/src/main/assets/licenses.html b/app/src/main/assets/licenses.html old mode 100644 new mode 100755 diff --git a/app/src/main/assets/style.css b/app/src/main/assets/style.css old mode 100644 new mode 100755 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 9f56ef97..5cf8c29e 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 @@ -68,7 +68,7 @@ public class bookmarkController extends AppCompatActivity mListView = findViewById(R.id.listview); mClearButton = findViewById(R.id.clearButton); mBookmarkViewController = new bookmarkViewController(mEmptyListNotifier, mSearchBar, mListView, mClearButton,this); - mClearButton.setText(strings.CLEAR_BOOKMARK); + mClearButton.setText(R.string.tab_view_clear_bookmark); } public void initializeList(){ bookmarkAdapter adapter = new bookmarkAdapter(mListModel.getList(),new adapterCallback()); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java new file mode 100755 index 00000000..64996f88 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeController.java @@ -0,0 +1,170 @@ +package com.darkweb.genesissearchengine.appManager.bridgeManager; + +import android.os.Bundle; +import android.os.Handler; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.ScrollView; +import android.widget.Switch; +import androidx.appcompat.app.AppCompatActivity; + +import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.keys; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginController; +import com.example.myapplication.R; + +import java.util.Collections; + +public class bridgeController extends AppCompatActivity { + + + /*Private Variables*/ + + private bridgeViewController mBridgeViewController; + private Switch mAutoSwitch; + private Switch mManualSwitch; + private EditText mCustomBridgeInput1; + private RadioButton mObs4Proxy; + private RadioButton mMeekProxy; + private LinearLayout mTopPanel; + private LinearLayout mBottomPanel; + private Button mBridgeRequestButton; + /*Initializations*/ + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.bridge_settings_view); + + initializeAppModel(); + initializeConnections(); + initializeLocalEventHandlers(); + } + + public void initializeAppModel() + { + mBridgeViewController = new bridgeViewController(); + } + + public void initializeConnections() + { + mAutoSwitch = findViewById(R.id.bridgeSwitchAuto); + mManualSwitch = findViewById(R.id.bridgeSwitchManual); + mObs4Proxy = findViewById(R.id.bridge_obfs); + mMeekProxy = findViewById(R.id.bridge_china); + mTopPanel = findViewById(R.id.topPanel); + mBottomPanel = findViewById(R.id.bottomPanel); + mCustomBridgeInput1 = findViewById(R.id.port1); + mBridgeRequestButton = findViewById(R.id.bridgeButton); + + mBridgeViewController.initialization(mAutoSwitch,mManualSwitch,mCustomBridgeInput1,this,mObs4Proxy,mMeekProxy,mTopPanel,mBottomPanel,mBridgeRequestButton); + } + + private void initializeLocalEventHandlers() + { + mAutoSwitch.setOnClickListener(view -> + { + boolean isChecked = mAutoSwitch.isChecked(); + status.sGatewayAuto = isChecked; + dataController.getInstance().setBool(keys.GATEWAY_AUTO, isChecked); + + dataController.getInstance().setBool(keys.GATEWAY_MANUAL, !isChecked); + if (isChecked) + { + mBridgeViewController.setBridgeState(false, isChecked); + status.sGatewayManual = false; + } else + { + mBridgeViewController.setBridgeState(false, false); + } + + }); + + mManualSwitch.setOnClickListener(view -> + { + boolean isChecked = mManualSwitch.isChecked(); + status.sGatewayManual = isChecked; + dataController.getInstance().setBool(keys.GATEWAY_MANUAL, isChecked); + + dataController.getInstance().setBool(keys.GATEWAY_AUTO, !isChecked); + if (isChecked) + { + mBridgeViewController.setBridgeState(isChecked, false); + status.sGatewayAuto = false; + } else + { + mBridgeViewController.setBridgeState(false, false); + } + }); + mCustomBridgeInput1.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void afterTextChanged(Editable editable) { + status.sCustomBridge=mCustomBridgeInput1.getText().toString(); + } + }); + } + + @Override + protected void onPause() + { + super.onPause(); + dataController.getInstance().setString(keys.CUSTOM_BRIDGE_1,status.sCustomBridge); + dataController.getInstance().setBool(keys.GATEWAY_AUTO,status.sGatewayAuto); + dataController.getInstance().setBool(keys.GATEWAY_MANUAL,status.sGatewayManual); + } + + @Override + public void onResume() + { + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + } + + @Override + public void onBackPressed() { + finish(); + } + + public void onClose(View view){ + finish(); + } + + /*Helper Method*/ + + public void requestBridges(View view){ + pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(constants.BACKEND_GOOGLE_URL), enums.etype.on_bridge_mail); + } + + public void onMeekChecked(View view){ + status.sCustomBridge = "meek"; + dataController.getInstance().setString(keys.CUSTOM_BRIDGE_1,status.sCustomBridge); + } + public void onObfsChecked(View view){ + status.sCustomBridge = "obfs4"; + dataController.getInstance().setString(keys.CUSTOM_BRIDGE_1,status.sCustomBridge); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeViewController.java new file mode 100755 index 00000000..7fbeb240 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bridgeManager/bridgeViewController.java @@ -0,0 +1,129 @@ +package com.darkweb.genesissearchengine.appManager.bridgeManager; + +import android.animation.ValueAnimator; +import android.os.Build; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.view.animation.DecelerateInterpolator; +import android.widget.Button; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.Switch; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.constants.status; +import com.example.myapplication.R; + +class bridgeViewController +{ + /*Private Variables*/ + + private Switch mAutoSwitch; + private Switch mManualSwitch; + private EditText mCustomBridgeInput1; + private RadioButton mObs4Proxy; + private RadioButton mMeekProxy; + private Button mBridgeRequestButton; + + private LinearLayout mTopPanel; + private LinearLayout mBottomPanel; + + /*ViewControllers*/ + private int mPanelHeight = 0; + + private AppCompatActivity mContext; + + /*Initializations*/ + + void initialization(Switch mAutoSwitch,Switch mManualSwitch,EditText mCustomBridgeInput1,AppCompatActivity mContext,RadioButton mObs4Proxy,RadioButton mMeekProxy,LinearLayout mTopPanel,LinearLayout mBottomPanel,Button mBridgeRequestButton){ + this.mContext = mContext; + this.mAutoSwitch = mAutoSwitch; + this.mManualSwitch = mManualSwitch; + this.mCustomBridgeInput1 = mCustomBridgeInput1; + this.mObs4Proxy = mObs4Proxy; + this.mMeekProxy = mMeekProxy; + this.mTopPanel = mTopPanel; + this.mBottomPanel = mBottomPanel; + this.mBridgeRequestButton = mBridgeRequestButton; + + initPostUI(); + initViews(); + initPanels(); + } + + private void initPostUI(){ + mPanelHeight = 1000; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + } + else { + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white)); + } + } + } + + private void initViews(){ + mAutoSwitch.setChecked(status.sGatewayAuto); + mManualSwitch.setChecked(status.sGatewayManual); + + mMeekProxy.clearFocus(); + mObs4Proxy.clearFocus(); + + if(status.sGatewayAuto){ + if(status.sCustomBridge.contains("obfs")){ + mObs4Proxy.setChecked(true); + }else { + mMeekProxy.setChecked(true); + } + setBridgeState(false,true); + } + else if(status.sGatewayManual){ + mCustomBridgeInput1.setText(status.sCustomBridge); + setBridgeState(true,false); + } + else { + setBridgeState(false,false); + } + } + + void setBridgeState(boolean manual, boolean auto){ + mAutoSwitch.setChecked(auto); + mManualSwitch.setChecked(manual); + if(auto){ + mTopPanel.animate().setDuration(300).alpha(0.55f).withEndAction((() -> mTopPanel.setClickable(true))); + mBottomPanel.animate().setDuration(300).alpha(0.55f).withEndAction((() -> mBottomPanel.setClickable(false))); + mCustomBridgeInput1.setEnabled(false); + mMeekProxy.setEnabled(true); + mObs4Proxy.setEnabled(true); + mBridgeRequestButton.setEnabled(false); + } + if(manual){ + mTopPanel.animate().setDuration(300).alpha(0.55f).withEndAction((() -> mTopPanel.setClickable(false))); + mBottomPanel.animate().setDuration(300).alpha(1).withEndAction((() -> mBottomPanel.setClickable(true))); + mCustomBridgeInput1.setEnabled(true); + mMeekProxy.setEnabled(false); + mObs4Proxy.setEnabled(false); + mBridgeRequestButton.setEnabled(true); + } + if(!auto && !manual) { + mTopPanel.animate().setDuration(300).alpha(0.55f).withEndAction((() -> mTopPanel.setClickable(false))); + mBottomPanel.animate().setDuration(300).alpha(0.55f).withEndAction((() -> mBottomPanel.setClickable(false))); + mCustomBridgeInput1.setEnabled(false); + mMeekProxy.setEnabled(false); + mObs4Proxy.setEnabled(false); + mBridgeRequestButton.setEnabled(false); + } + } + + private void initPanels(){ + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyRowModel.java index dce90f1f..104c2349 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyRowModel.java @@ -25,6 +25,9 @@ public class historyRowModel public void updateTitle(String mTitle){ this.mTitle = mTitle; } + public void updateHeader(String mHeader){ + this.mHeader = mHeader; + } public void updateURL(String url){ this.mHeader = url; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java index 8bcf6cfd..d05f2498 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoClients.java @@ -3,6 +3,7 @@ package com.darkweb.genesissearchengine.appManager.homeManager; import android.content.Intent; import android.graphics.Color; import android.net.Uri; +import android.util.Log; import android.view.View; import androidx.appcompat.app.AppCompatActivity; @@ -12,9 +13,14 @@ import com.darkweb.genesissearchengine.helperManager.helperMethod; import java.io.File; import java.util.List; import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent; +import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; +import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; import static org.mozilla.geckoview.StorageController.ClearFlags.ALL; + +import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.GeckoRuntime; import org.mozilla.geckoview.GeckoSession; +import org.mozilla.geckoview.GeckoSessionSettings; import org.mozilla.geckoview.GeckoView; @@ -44,16 +50,26 @@ class geckoClients } else { geckoView.releaseSession(); + Log.i("GCHECKS:","GCHECKS:"+mGlobalSessionCounter); mSession = new geckoSession(new geckoViewClientCallback(),mGlobalSessionCounter,context); mSession.open(mRuntime); mSession.getSettings().setUseTrackingProtection(true); + mSession.getSettings().setFullAccessibilityTree(true); + mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE ); mSession.getSettings().setAllowJavascript(status.sJavaStatus); geckoView.releaseSession(); geckoView.setSession(mSession); } onUpdateFont(); + } + void toogleUserAgent(){ + mSession.toogleUserAgent(); + } + + int getUserAgent(){ + return mSession.getUserAgentMode(); } private void runtimeSettings(AppCompatActivity context){ @@ -61,6 +77,8 @@ class geckoClients mRuntime = GeckoRuntime.getDefault(context); mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour()); mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sFontAdjustable); + mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.AD); + mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.FINGERPRINTING); } } @@ -77,8 +95,8 @@ class geckoClients } void initSession(geckoSession mSession){ - this.mSession = mSession; mSessionID = mSession.getSessionID(); + this.mSession = mSession; } geckoSession getSession(){ @@ -148,6 +166,7 @@ class geckoClients } } + void onStop(){ mSession.stop(); } @@ -193,7 +212,7 @@ class geckoClients @Override public void invokeObserver(List data, enums.etype e_type) { - if (mSessionID == (int)data.get(1)) + if (mSessionID == (int)data.get(1) || 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 (e_type.equals(on_handle_external_intent)) { 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 2abc8b0d..693ed778 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 @@ -25,7 +25,9 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import androidx.core.content.FileProvider; import com.darkweb.genesissearchengine.constants.enums; +import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.AdBlocker; import com.darkweb.genesissearchengine.helperManager.JavaScriptInterface; import com.darkweb.genesissearchengine.helperManager.downloadFileService; import com.darkweb.genesissearchengine.helperManager.errorHandler; @@ -45,6 +47,9 @@ import java.io.OutputStream; import java.util.Arrays; import java.util.List; +import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; +import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; + public class geckoSession extends GeckoSession implements GeckoSession.PermissionDelegate,GeckoSession.ProgressDelegate, GeckoSession.HistoryDelegate,GeckoSession.NavigationDelegate,GeckoSession.ContentDelegate { private eventObserver.eventListener event; @@ -55,7 +60,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio private boolean mFullScreen = false; private boolean isPageLoading = false; private int mProgress = 0; - private String mCurrentTitle = strings.EMPTY_STR; + private String mCurrentTitle = "loading"; private String mCurrentURL = "about:blank"; private Uri mUriPermission = null; private AppCompatActivity mContext; @@ -103,10 +108,10 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio @Override public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) { if(!isPageLoading){ - mCurrentURL = "about:blank"; + mCurrentTitle = "loading"; } isPageLoading = true; - if(!var2.equals("about:blank")){ + if(!var2.equals("about:blank") && !mCurrentTitle.equals("loading")){ mProgress = 5; } @@ -155,8 +160,8 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio public void onLocationChange(@NonNull GeckoSession var1, @Nullable String var2) { String newUrl = var2.split("#")[0]; - if(!mCurrentURL.equals("about:blank")){ - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,newUrl), enums.etype.on_update_suggestion_url); + if(!mCurrentTitle.equals("loading")){ + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion_url); } mCurrentURL = newUrl; @@ -224,7 +229,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio @UiThread public void onTitleChange(@NonNull GeckoSession var1, @Nullable String var2) { - if(var2!=null && !var2.equals(strings.EMPTY_STR) && var2.length()>2 && !mCurrentURL.equals("about:blank")){ + if(var2!=null && !var2.equals(strings.EMPTY_STR) && var2.length()>2 && !var2.equals("about:blank")){ mCurrentTitle = var2; event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion); } @@ -471,6 +476,19 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio /*Helper Methods*/ + void toogleUserAgent(){ + if(getSettings().getUserAgentMode()==USER_AGENT_MODE_DESKTOP){ + getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); + }else { + getSettings().setUserAgentMode(USER_AGENT_MODE_DESKTOP); + } + + } + + int getUserAgentMode(){ + return getSettings().getUserAgentMode(); + } + public String getCurrentURL(){ return mCurrentURL; } 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 4c2cbf7d..529bcb0b 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 @@ -8,12 +8,15 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; +import android.content.res.Resources; import android.database.Cursor; +import android.net.Uri; import android.os.Build; 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; @@ -22,10 +25,13 @@ import android.widget.*; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.core.content.ContextCompat; + import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; import com.darkweb.genesissearchengine.appManager.historyManager.historyController; +import com.darkweb.genesissearchengine.appManager.landingManager.landingController; import com.darkweb.genesissearchengine.appManager.settingManager.settingController; import com.darkweb.genesissearchengine.appManager.tabManager.tabController; import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; @@ -37,6 +43,7 @@ import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController; import com.darkweb.genesissearchengine.helperManager.KeyboardUtils; +import com.darkweb.genesissearchengine.helperManager.LocaleUtils; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.pluginManager.pluginController; @@ -54,6 +61,7 @@ import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Objects; import java.util.concurrent.Callable; @@ -93,8 +101,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba @Override protected void onCreate(Bundle savedInstanceState) { - if(helperMethod.isBuildValid()) - { super.onCreate(savedInstanceState); setContentView(R.layout.home_view); initPreFixes(); @@ -111,21 +117,45 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().initialize(); initializeGeckoView(savedInstanceState == null); initializeLocalEventHandlers(); - } - else { - super.onCreate(savedInstanceState); - setContentView(R.layout.invalid_setup_view); - pluginController.getInstance().initializeWithAbiError(); - pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.EMPTY_STR),enums.etype.abi_error); + initLandingPage(); + onNewIntent(getIntent()); + initLocalLanguage(); + } + + private void initLocalLanguage() { + + String lang = Resources.getSystem().getConfiguration().locale.getLanguage(); + Locale locale = new Locale(lang); + Locale.setDefault(locale); + Configuration config = new Configuration(); + if (Build.VERSION.SDK_INT >= 24) { + config.setLocale(locale); + getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); + } else { + config.locale = locale; + getBaseContext().getApplicationContext().createConfigurationContext(config); } } - public void ignoreAbiError(){ - + @Override + protected void onNewIntent(Intent intent) + { + super.onNewIntent(intent); + Uri data = intent.getData(); + if(data!=null){ + status.sRedirectStatus = data.toString(); + if(status.sIsAppStarted){ + onLoadURL(status.sRedirectStatus); + } + } } - public void onClose(){ - mGeckoClient.onClose(); + public void initLandingPage(){ + if(status.sFirstStart){ + helperMethod.openActivity(landingController.class, constants.LIST_HISTORY, homeController.this,false); + status.sFirstStart = false; + dataController.getInstance().setBool(keys.FIRST_INSTALLED,false); + } } public void initializeAppModel() @@ -172,7 +202,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba field.setAccessible(true); method.invoke(field.get(null)); - } catch (Throwable e) { e.printStackTrace(); @@ -181,6 +210,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void initializeGeckoView(boolean isForced){ mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,isForced); + //mGeckoClient.loadURL("about:blank"); onSaveCurrentTab(mGeckoClient.getSession(),false); mHomeViewController.initTab(dataController.getInstance().getTotalTabs()); } @@ -224,7 +254,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void onLoadURL(String url){ mHomeViewController.onClearSelections(true); - mGeckoClient.loadURL(url.replace("genesis.onion","boogle.sts~>ore")); + mGeckoClient.loadURL(url.replace("genesis.onion","boogle.store")); } public void onLoadTab(geckoSession mTempSession,boolean isSessionClosed){ @@ -232,18 +262,17 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().moveTabToTop(mTempSession); } - mHomeViewController.onUpdateSearchBar(mTempSession.getCurrentURL()); + mGeckoView.releaseSession(); + mGeckoClient.initSession(mTempSession); + mGeckoView.setSession(mTempSession); + + mHomeViewController.onClearSelections(false); + mHomeViewController.onUpdateSearchBar(mTempSession.getCurrentURL(),false); if(mTempSession.getProgress()>0 && mTempSession.getProgress()<100){ mHomeViewController.onProgressBarUpdate(mTempSession.getProgress()); }else { mHomeViewController.progressBarReset(); } - - mGeckoView.releaseSession(); - mGeckoView.setSession(mTempSession); - mGeckoClient.initSession(mTempSession); - mHomeViewController.onClearSelections(false); - } /*-------------------------------------------------------USER EVENTS-------------------------------------------------------*/ @@ -310,7 +339,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba helperMethod.hideKeyboard(homeController.this); status.sIsAppStarted = true; pluginController.getInstance().onResetMessage(); - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL()); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false); } }); @@ -332,12 +361,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(!hasFocus) { if(!mGeckoClient.isLoading()){ - mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL()); + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false); } if(isSuggestionChanged){ isSuggestionChanged = false; mHomeViewController.initializeSuggestionView(dataController.getInstance().getSuggestions()); } + }else { + mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true); } }); pluginController.getInstance().logEvent(strings.APP_STARTED); @@ -351,14 +382,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(validated_url!=null){ url = validated_url; } - mHomeViewController.onUpdateSearchBar(url); + mHomeViewController.onUpdateSearchBar(url,false); onLoadURL(url); } public void onSuggestionInvoked(View view){ String val = ((TextView)view.findViewById(R.id.hintCompletionUrl)).getText().toString(); mSearchbar.clearFocus(); - mHomeViewController.onUpdateSearchBar(val); + mHomeViewController.onUpdateSearchBar(val,false); onLoadURL(val); } @@ -388,13 +419,15 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().logEvent(strings.MENU_INVOKED); status.sIsAppStarted = true; pluginController.getInstance().onResetMessage(); - mHomeViewController.onOpenMenu(view,mGeckoClient.canGoBack(),mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() ==View.INVISIBLE)); + initLocalLanguage(); + + + mHomeViewController.onOpenMenu(view,mGeckoClient.canGoBack(),mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() ==View.INVISIBLE),mGeckoClient.getUserAgent()); } @Override public void onBackPressed(){ pluginController.getInstance().logEvent(strings.ON_BACK); - mGeckoView.clearFocus(); mSearchbar.clearFocus(); if(mGeckoClient.getFullScreenStatus()){ mGeckoClient.onBackPressed(true); @@ -406,7 +439,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onSwitchSearch(View view){ - mHomeViewController.stopSearchButtonAnimation(); dataController.getInstance().setBool(keys.ENGINE_SWITCHED,true); pluginController.getInstance().logEvent(strings.SEARCH_SWITCH); @@ -475,7 +507,18 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onSetBannerAdMargin(true,pluginController.getInstance().isAdvertLoaded()); } } + } + @Override + public void onPause(){ + super.onPause(); + if(mHomeViewController!=null){ + mHomeViewController.closeMenu(); + helperMethod.hideKeyboard(this); + } + + mGeckoClient.onExitFullScreen(); + pluginController.getInstance().onResetMessage(); } @Override @@ -485,6 +528,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if (mGeckoClient!=null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mGeckoClient.getUriPermission()!=null) { this.revokeUriPermission(mGeckoClient.getUriPermission(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } + super.onResume(); } @@ -498,16 +542,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } } - @Override - public void onPause(){ - super.onPause(); - if(mHomeViewController!=null){ - mHomeViewController.closeMenu(); - helperMethod.hideKeyboard(this); - } - pluginController.getInstance().onResetMessage(); - } - public void onSetBannerAdMargin(){ mHomeViewController.onSetBannerAdMargin(true,pluginController.getInstance().isAdvertLoaded()); } @@ -557,7 +591,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba initializeGeckoView(true); mHomeViewController.progressBarReset(); mHomeViewController.onNewTab(false,isKeyboardOpened); - mHomeViewController.onUpdateSearchBar(url); + mHomeViewController.onUpdateSearchBar(url,false); mGeckoClient.loadURL(url); } @@ -633,7 +667,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if (menuId == R.id.menu5) { - pluginController.getInstance().MessageManagerHandler(homeController.this, Collections.singletonList(mSearchbar.getText().toString()),enums.etype.bookmark); + pluginController.getInstance().MessageManagerHandler(homeController.this, Collections.singletonList(mGeckoClient.getSession().getCurrentURL()),enums.etype.bookmark); } else if (menuId == R.id.menu4) { @@ -668,6 +702,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba if (menuId == R.id.menu24) { onHomeButton(view); } + if (menuId == R.id.menu26 || menuId == R.id.menu27 || menuId == R.id.menu28) { + mGeckoClient.toogleUserAgent(); + mGeckoClient.onReload(); + } } mHomeViewController.closeMenu(); } @@ -724,7 +762,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onProgressBarUpdate((int)data.get(0)); } else if(e_type.equals(enums.etype.on_url_load)){ - mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mSearchbar.getText().toString())); + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false); } else if(e_type.equals(enums.etype.back_list_empty)){ if(dataController.getInstance().getTotalTabs()>1){ @@ -739,6 +777,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().setProxy(dataToStr(data.get(0))); } else if(e_type.equals(enums.etype.on_request_completed)){ + Log.i("RUQUEST_SEND","REQUREST_SEND"+data.get(0)); dataController.getInstance().addHistory(data.get(0).toString(),data.get(2).toString()); } else if(e_type.equals(enums.etype.on_update_suggestion)){ @@ -759,7 +798,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba }; handler.postDelayed(runnable, 1300); }else { - pluginController.getInstance().initializeBannerAds(); + final Handler handler = new Handler(); + Runnable runnable = () -> + { + pluginController.getInstance().initializeBannerAds(); + }; + handler.postDelayed(runnable, 2000); } } else if(e_type.equals(enums.etype.rate_application)){ @@ -770,11 +814,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba } } else if(e_type.equals(enums.etype.on_load_error)){ + initLocalLanguage(); mHomeViewController.onPageFinished(); - mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mSearchbar.getText().toString())); + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false); } else if(e_type.equals(enums.etype.search_update)){ - mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mSearchbar.getText().toString())); + mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false); } else if(e_type.equals(enums.etype.download_file_popup)){ pluginController.getInstance().MessageManagerHandler(homeController.this,Collections.singletonList(dataToStr(data.get(0))),enums.etype.download_file); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java index 52988033..8bceb47e 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeViewController.java @@ -2,6 +2,7 @@ package com.darkweb.genesissearchengine.appManager.homeManager; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; +import android.animation.LayoutTransition; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.annotation.SuppressLint; @@ -14,6 +15,7 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; import android.os.Message; +import android.transition.Explode; import android.util.Log; import android.util.TypedValue; import android.view.Gravity; @@ -23,7 +25,9 @@ import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.Window; import android.view.WindowManager; +import android.view.animation.Animation; import android.view.animation.DecelerateInterpolator; +import android.view.animation.ScaleAnimation; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.*; @@ -51,6 +55,7 @@ import java.util.Objects; import java.util.concurrent.Callable; import static android.content.Context.LAYOUT_INFLATER_SERVICE; import static androidx.appcompat.widget.ListPopupWindow.WRAP_CONTENT; +import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; class homeViewController { @@ -108,11 +113,6 @@ class homeViewController initLock(); initSearchImage(); createUpdateUiHandler(); - initSearchButtonAnimation(is_triggered); - initTopBar(); - } - - private void initTopBar(){ } private void initSearchImage(){ @@ -139,33 +139,12 @@ class homeViewController .playOn(mNewTab); } - private void initSearchButtonAnimation(boolean is_triggered){ - if(!is_triggered){ - //mEngineAnimator = ValueAnimator.ofFloat(0.3f, 1); - //mEngineAnimator.addUpdateListener(animation -> mSwitchEngineBack.setAlpha((Float) animation.getAnimatedValue())); - //mEngineAnimator.setDuration(1000); - //mEngineAnimator.setRepeatCount(ValueAnimator.INFINITE); - //mEngineAnimator.setRepeatMode(ValueAnimator.REVERSE); - //mEngineAnimator.start(); - } - } - - void stopSearchButtonAnimation(){ - if(mEngineAnimator !=null){ - //mEngineAnimator.end(); - //TypedValue outValue = new TypedValue(); - //mContext.getTheme().resolveAttribute(android.R.attr.selectableItemBackgroundBorderless, outValue, true); - //mEngineLogo.setBackgroundResource(outValue.resourceId); - //mEngineAnimator = null; - } - } - private void initPostUI(boolean isSplash){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = mContext.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); if(isSplash){ - window.setStatusBarColor(mContext.getResources().getColor(R.color.ease_blue)); + window.setStatusBarColor(mContext.getResources().getColor(R.color.landing_ease_blue)); } else{ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { @@ -178,15 +157,14 @@ class homeViewController } } - - @RequiresApi(api = Build.VERSION_CODES.M) private void initStatusBarColor() { - animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.ease_blue), ContextCompat.getColor(mContext, R.color.black_blue)); - animatedColor twoToThree = new animatedColor(ContextCompat.getColor(mContext, R.color.ease_blue), ContextCompat.getColor(mContext, R.color.ease_blue_light)); - animatedColor ThreeToFour = new animatedColor(ContextCompat.getColor(mContext, R.color.ease_blue_light), ContextCompat.getColor(mContext, R.color.white)); + animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.landing_ease_blue_light_1)); + animatedColor twoToThree = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue_light_1), ContextCompat.getColor(mContext, R.color.white)); + animatedColor ThreeToFour = new animatedColor(ContextCompat.getColor(mContext, R.color.white), ContextCompat.getColor(mContext, R.color.white)); ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f).setDuration(0); + animator.setStartDelay(600); animator.addUpdateListener(animation -> { float v = (float) animation.getAnimatedValue(); @@ -225,13 +203,12 @@ class homeViewController } }); animator.start(); - } private void initLock(){ Drawable img = mContext.getResources().getDrawable( R.drawable.icon_lock); mSearchbar.measure(0, 0); - img.setBounds( 0, (int)(mSearchbar.getMeasuredHeight()*0.00), (int)(mSearchbar.getMeasuredHeight()*1.10), (int)(mSearchbar.getMeasuredHeight()*0.69) ); + img.setBounds( -10, (int)(mSearchbar.getMeasuredHeight()*0.00), (int)(mSearchbar.getMeasuredHeight()*1.10)-10, (int)(mSearchbar.getMeasuredHeight()*0.69) ); mSearchbar.setCompoundDrawables( img, null, null, null ); } @@ -294,6 +271,8 @@ class homeViewController View root = mSearchbar.getRootView(); root.setBackgroundColor(ContextCompat.getColor(mContext, R.color.dark_purple)); + mGeckoView.setBackgroundResource( R.color.dark_purple); + } void initProxyLoading(Callable logs){ @@ -303,7 +282,7 @@ class homeViewController new Thread(){ public void run(){ AppCompatActivity temp_context = mContext; - while (!orbotLocalConstants.sIsTorInitialized){ + while (!orbotLocalConstants.sIsTorInitialized || !orbotLocalConstants.sNetworkState){ try { sleep(1000); @@ -329,7 +308,7 @@ class homeViewController void onPageFinished(){ mSearchbar.setEnabled(true); mProgressBar.bringToFront(); - + mSplashScreen.bringToFront(); if(mSplashScreen.getVisibility()!=View.GONE){ mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER);//Set Portrait } @@ -340,15 +319,22 @@ class homeViewController if(mSplashScreen.getAlpha()>=1) { disableSplash = true; - mSplashScreen.animate().setDuration(300).alpha(0).withEndAction((() -> mSplashScreen.setVisibility(View.GONE))); - mProgressBar.animate().setStartDelay(250).alpha(1); + mSplashScreen.animate().setDuration(300).setStartDelay(500).alpha(0).withEndAction((() -> triggerPostUI())); initPostUI(false); } } + private void triggerPostUI(){ + mSplashScreen.setVisibility(View.GONE); + + if(mProgressBar.getProgress()>0 && mProgressBar.getProgress()<10000){ + mProgressBar.animate().setStartDelay(0).alpha(1); + } + } + /*-------------------------------------------------------Helper Methods-------------------------------------------------------*/ - void onOpenMenu(View view,boolean canGoForward,boolean canGoBack,boolean isLoading){ + void onOpenMenu(View view,boolean canGoForward,boolean canGoBack,boolean isLoading,int userAgent){ if(popupWindow!=null){ popupWindow.dismiss(); @@ -383,6 +369,8 @@ class homeViewController ImageButton back = popupView.findViewById(R.id.menu22); ImageButton forward = popupView.findViewById(R.id.menu23); ImageButton close = popupView.findViewById(R.id.menu20); + CheckBox desktop = popupView.findViewById(R.id.menu27); + desktop.setChecked(userAgent==USER_AGENT_MODE_DESKTOP); if(!canGoForward){ forward.setColorFilter(Color.argb(255, 191, 191, 191)); @@ -452,9 +440,16 @@ class homeViewController void onSetBannerAdMargin(boolean status,boolean isAdLoaded){ if(isAdLoaded){ if(status && !isLandscape){ - mWebviewContainer.setPadding(0,AdSize.SMART_BANNER.getHeightInPixels(mContext),0,0); mBannerAds.setVisibility(View.VISIBLE); - mBannerAds.animate().setDuration(500).alpha(1f); + mBannerAds.setAlpha(1f); + + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + mWebviewContainer.clearAnimation(); + mWebviewContainer.setPadding(0,AdSize.SMART_BANNER.getHeightInPixels(mContext)+1,0,0); + mProgressBar.bringToFront(); + }, 250); }else{ mWebviewContainer.setPadding(0,0,0,0); mBannerAds.setVisibility(View.GONE); @@ -462,13 +457,37 @@ class homeViewController } } - void onUpdateSearchBar(String url){ + private Handler searchBarUpdateHandler = new Handler(); + private String handlerLocalUrl = ""; + void onUpdateSearchBar(String url,boolean showProtocol){ + int delay = 50; + handlerLocalUrl = url; - if (mSearchbar == null || mSearchbar.isFocused() || url==null) + if(searchBarUpdateHandler.hasMessages(100)){ + delay=0; + return; + } + + searchBarUpdateHandler.sendEmptyMessage(100); + searchBarUpdateHandler.postDelayed(() -> + { + searchBarUpdateHandler.removeMessages(100); + triggerUpdateSearchBar(handlerLocalUrl,showProtocol); + + }, delay); + } + + private void triggerUpdateSearchBar(String url, boolean showProtocol){ + if (mSearchbar == null || url==null) { return; } + if(!showProtocol){ + url=url.replace("https://",""); + url=url.replace("http://",""); + } + url = url.replace("boogle.store","genesis.onion"); boolean isTextSelected = false; @@ -476,7 +495,9 @@ class homeViewController isTextSelected = true; } + if(url.length()<=300){ + url = removeEndingSlash(url); mSearchbar.setText(helperMethod.urlDesigner(url)); mSearchbar.selectAll(); @@ -485,11 +506,23 @@ class homeViewController } mSearchbar.setSelection(0); + }else { + url = removeEndingSlash(url); + mSearchbar.setText(url); + } + + if(mSearchbar.isFocused()){ + mSearchbar.setSelection(mSearchbar.getText().length()); + mSearchbar.selectAll(); } } + private String removeEndingSlash(String url){ + return helperMethod.removeLastSlash(url); + } + void onNewTab(boolean keyboard,boolean isKeyboardOpen){ - mSearchbar.setText(strings.BLANK_PAGE); + onUpdateSearchBar(strings.BLANK_PAGE,false); if(keyboard){ if(!isKeyboardOpen){ @@ -512,8 +545,10 @@ class homeViewController mProgressBar.setProgress(5); mProgressBar.setVisibility(View.INVISIBLE); } - void onProgressBarUpdate(int value){ + if(mSplashScreen.getAlpha()>0){ + mProgressBar.setProgress(value*100); + } if(value==100){ mProgressBar.setAlpha(1f); mProgressBar.animate().setStartDelay(200).alpha(0); @@ -641,7 +676,11 @@ class homeViewController { if(msg.what == messages.ON_URL_LOAD) { - mEvent.invokeObserver(Collections.singletonList(status.sSearchStatus), enums.etype.on_url_load); + if(status.sRedirectStatus.equals(strings.EMPTY_STR)){ + mEvent.invokeObserver(Collections.singletonList(status.sSearchStatus), enums.etype.on_url_load); + }else { + mEvent.invokeObserver(Collections.singletonList(status.sRedirectStatus), enums.etype.on_url_load); + } } if(msg.what == messages.UPDATE_LOADING_TEXT) { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/CustomSlideBigText.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/CustomSlideBigText.java new file mode 100755 index 00000000..4302362b --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/CustomSlideBigText.java @@ -0,0 +1,82 @@ +package com.darkweb.genesissearchengine.appManager.landingManager; + +import android.os.Bundle; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import android.text.TextUtils; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.TextView; + +import com.example.myapplication.R; + + +public class CustomSlideBigText extends Fragment { + + private static final String ARG_LAYOUT_RES_ID = "layoutResId"; + private int layoutResId; + private String mTitle; + private String mButtonText; + private String mSubTitle; + private View.OnClickListener mButtonListener; + + public static CustomSlideBigText newInstance(int layoutResId) { + CustomSlideBigText sampleSlide = new CustomSlideBigText(); + + Bundle args = new Bundle(); + args.putInt(ARG_LAYOUT_RES_ID, layoutResId); + sampleSlide.setArguments(args); + + return sampleSlide; + } + + public void setTitle (String title) + { + mTitle = title; + } + + public void setSubTitle(String subTitle) { mSubTitle = subTitle; } + + public void showButton (String buttonText, View.OnClickListener buttonListener) + { + mButtonText = buttonText; + mButtonListener = buttonListener; + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID)) { + layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID); + } + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View view = inflater.inflate(layoutResId, container, false); + ((TextView)view.findViewById(R.id.custom_slide_big_text)).setText(mTitle); + + if (!TextUtils.isEmpty(mSubTitle)) { + + TextView tv = + (TextView)view.findViewById(R.id.custom_slide_big_text_sub); + tv.setText(mSubTitle); + tv.setVisibility(View.VISIBLE); + } + + if (mButtonText != null) + { + Button button = (Button)view.findViewById(R.id.custom_slide_button); + button.setVisibility(View.VISIBLE); + button.setText(mButtonText); + button.setOnClickListener(mButtonListener); + } + return view; + + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingController.java new file mode 100755 index 00000000..1b17b1a3 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingController.java @@ -0,0 +1,66 @@ +package com.darkweb.genesissearchengine.appManager.landingManager; + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import android.view.View; + +import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController; +import com.example.myapplication.R; +import com.github.paolorotolo.appintro.AppIntro; + +public class landingController extends AppIntro { + + private landingViewController mLauncherViewController; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Instead of fragments, you can also use our default slide + // Just set a title, description, background and image. AppIntro will do the rest. + CustomSlideBigText welcome = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text); + welcome.setTitle(getString(R.string.hello)); + welcome.setSubTitle(getString(R.string.welcome)); + addSlide(welcome); + + CustomSlideBigText intro2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text); + intro2.setTitle(getString(R.string.browser_the_internet)); + intro2.setSubTitle(getString(R.string.no_tracking)); + addSlide(intro2); + + CustomSlideBigText cs2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text); + cs2.setTitle(getString(R.string.bridges_sometimes)); + cs2.showButton(getString(R.string.action_more), new View.OnClickListener() { + @Override + public void onClick(View v) { + startActivity(new Intent(landingController.this,bridgeController.class)); + } + }); + addSlide(cs2); + + + // OPTIONAL METHODS + // Override bar/separator color. + setBarColor(getResources().getColor(R.color.landing_ease_blue)); + setSeparatorColor(getResources().getColor(R.color.panel_background_main)); + + // Hide Skip/Done button. + showSkipButton(false); + setProgressButtonEnabled(true); + initConnections(); + } + + private void initConnections(){ + mLauncherViewController = new landingViewController(this,null); + } + + @Override + public void onDonePressed(Fragment currentFragment) { + super.onDonePressed(currentFragment); + finish(); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java new file mode 100755 index 00000000..36007213 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java @@ -0,0 +1,93 @@ +package com.darkweb.genesissearchengine.appManager.landingManager; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; +import android.animation.ValueAnimator; +import android.os.Build; +import android.view.Window; +import android.view.WindowManager; +import androidx.annotation.RequiresApi; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import com.darkweb.genesissearchengine.helperManager.animatedColor; +import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.example.myapplication.R; + +class landingViewController +{ + /*Private Variables*/ + private AppCompatActivity mContext; + + /*Initializations*/ + + landingViewController(AppCompatActivity mContext, eventObserver.eventListener event){ + this.mContext = mContext; + + + initPostUI(); + } + + private void initPostUI(){ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.landing_ease_blue)); + } + else { + initStatusBarColor(); + } + } + } + + @RequiresApi(api = Build.VERSION_CODES.M) + private void initStatusBarColor() { + animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + animatedColor twoToThree = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + animatedColor ThreeToFour = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.landing_ease_blue)); + + ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f).setDuration(0); + animator.addUpdateListener(animation -> + { + float v = (float) animation.getAnimatedValue(); + mContext.getWindow().setStatusBarColor(oneToTwo.with(v)); + mContext.getWindow().setStatusBarColor(oneToTwo.with(v)); + }); + animator.start(); + + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + final ValueAnimator animator2 = ObjectAnimator.ofFloat(0f, 1f).setDuration(217); + animator2.addUpdateListener(animation1 -> + { + float v = (float) animation1.getAnimatedValue(); + mContext.getWindow().setStatusBarColor(twoToThree.with(v)); + }); + animator2.start(); + + animator2.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + final ValueAnimator animator3 = ObjectAnimator.ofFloat(0f, 1f).setDuration(0); + animator3.addUpdateListener(animation1 -> + { + float v = (float) animation1.getAnimatedValue(); + mContext.getWindow().setStatusBarColor(ThreeToFour.with(v)); + + }); + animator3.start(); + } + }); + animator2.start(); + + } + }); + animator.start(); + + } + + + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/viewPagerModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/viewPagerModel.java new file mode 100755 index 00000000..c606de2a --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/viewPagerModel.java @@ -0,0 +1,15 @@ +package com.darkweb.genesissearchengine.appManager.landingManager; + +public class viewPagerModel +{ + + private int image_drawable; + + public int getImage_drawable() { + return image_drawable; + } + + public void setImage_drawable(int image_drawable) { + this.image_drawable = image_drawable; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java index bf1b01cc..3aae66ae 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotController.java @@ -1,15 +1,25 @@ package com.darkweb.genesissearchengine.appManager.orbotManager; import android.os.Bundle; +import android.os.Handler; import android.view.View; import android.widget.Switch; import androidx.appcompat.app.AppCompatActivity; import com.darkweb.genesissearchengine.appManager.activityContextManager; +import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController; +import com.darkweb.genesissearchengine.appManager.homeManager.homeController; +import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.helperManager.helperMethod; +import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.example.myapplication.R; +import java.util.Collections; + public class orbotController extends AppCompatActivity { private Switch mBridgeSwitch; @@ -28,6 +38,7 @@ public class orbotController extends AppCompatActivity { public void onResume() { activityContextManager.getInstance().setCurrentActivity(this); + mOrbotViewController.initViews(); super.onResume(); } @@ -54,11 +65,18 @@ public class orbotController extends AppCompatActivity { public void listenersInitializations() { - mBridgeSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> + mBridgeSwitch.setOnClickListener(view -> { - status.sGateway = isChecked; - dataController.getInstance().setBool(keys.GATEWAY,isChecked); + Switch switch_view = (Switch)view; + switch_view.setChecked(!switch_view.isChecked()); + helperMethod.openActivity(bridgeController.class, constants.LIST_HISTORY, orbotController.this,true); }); } + public void onClearCache(View view){ + + helperMethod.clearAppData(this); + ((Switch)view).setChecked(false); + } + } \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java index 107f5976..2e91b83a 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotManager/orbotViewController.java @@ -46,8 +46,8 @@ class orbotViewController } - private void initViews(){ - mBridgeSwitch.setChecked(status.sGateway); + public void initViews(){ + mBridgeSwitch.setChecked(status.sGatewayAuto || status.sGatewayManual); } 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 ed1a9a59..e9711315 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 @@ -124,7 +124,7 @@ public class tabAdapter extends RecyclerView.Adapter descriptionText = itemView.findViewById(R.id.mDescription); itemContainer = itemView.findViewById(R.id.item_container); - if(model.getSession().getTitle().equals("")){ + if(model.getSession().getTitle().equals("") || model.getSession().getTitle().equals("loading")){ heaaderText.setText(helperMethod.getDomainName(model.getSession().getCurrentURL())); } 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 4e900986..81612eb1 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,6 +1,7 @@ package com.darkweb.genesissearchengine.appManager.tabManager; import android.os.Bundle; +import android.os.Handler; import android.text.Editable; import android.text.TextWatcher; import android.view.View; @@ -23,6 +24,8 @@ import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.example.myapplication.R; +import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -68,7 +71,7 @@ public class tabController extends AppCompatActivity mListView = findViewById(R.id.listview); mClearButton = findViewById(R.id.clearButton); mtabViewController = new tabViewController(mEmptyListNotifier, mListView, mClearButton,this); - mClearButton.setText(strings.CLEAR_TABS); + mClearButton.setText(R.string.tab_view_clear_tab); } public void initializeList(){ tabAdapter adapter = new tabAdapter(mListModel.getList(),new adapterCallback()); @@ -186,7 +189,7 @@ public class tabController extends AppCompatActivity tabRowModel model = (tabRowModel)data.get(0); pluginController.getInstance().logEvent(strings.TAB_TRIGGERED); mHomeController.onLoadTab(model.getSession(),false); - finish(); + tabController.this.finish(); } else if(e_type.equals(enums.etype.url_clear)){ mListModel.onManualClear((int)data.get(0)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java index 6b195551..2dc1c52e 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabModel.java @@ -20,7 +20,7 @@ class tabModel } private void removeFromMainList(int index) { - if(mModelList.size()>0){ + if(mModelList.size()>index){ mModelList.remove(index); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java index 9c6e3909..8f1cf945 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/constants.java @@ -27,6 +27,7 @@ public class constants public static final boolean PROXY_MEMORY = true; public static final int DISK_CAPACITY = 10000; public static final String PROXY_USER_AGENT_OVERRIDE = "Mozilla/5.0 (Android 9; Mobile; rv:67.0) Gecko/67.0 Firefox/67.0"; + public static final String PROXY_USER_AGENT_OVERRIDE_DESKTOP = "Mozilla/5.0 (X11; Linux x86_64:68.0) Gecko/20100101 Firefox/68.0"; public static final boolean PROXY_DO_NOT_TRACK_HEADER_ENABLED = false; public static final int PROXY_DO_NOT_TRACK_HEADER_VALUE = 1; 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 61464bff..80faf1f6 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -10,6 +10,6 @@ public class enums welcome,abi_error,rate_success,reported_success,bookmark, clear_tab,clear_history,clear_bookmark,report_url,rate_app,version_warning,start_orbot,download_file,download_file_long_press,tor_banned,on_long_press_url, cancel_welcome,ignore_abi,reload,connect_vpn,start_home,disable_splash,app_rated,download_file_manual,download_folder, update_searcn, update_javascript,update_notification, update_history,update_cookies, update_font_size,update_font_adjustable,close_view,open_link_new_tab,open_link_current_tab,copy_link, url_triggered,url_clear,clear_recycler,url_clear_at,remove_from_database,is_empty,load_more, - on_close_sesson,on_long_press,on_long_press_with_link,on_full_screen,on_error_cert,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,redraw,start_proxy,start_proxy_back,start_proxy_forward,onMenuSelected,on_request_completed,on_update_suggestion,on_page_loaded,on_load_error,update_tab_title,download_file_popup,proxy_error,on_init_ads,rate_application,search_update, open_new_tab + on_close_sesson,on_long_press,on_long_press_with_link,on_reset_app,on_bridge_mail,on_not_support,on_full_screen,on_error_cert,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,redraw,start_proxy,start_proxy_back,start_proxy_forward,onMenuSelected,on_request_completed,on_update_suggestion,on_page_loaded,on_load_error,update_tab_title,download_file_popup,proxy_error,on_init_ads,rate_application,search_update, open_new_tab } } \ No newline at end of file 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 6ca5506f..ef93b33f 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/keys.java @@ -25,10 +25,13 @@ public class keys /*Settings*/ + public static final String LANGUAGE = "LANGUAGE"; public static final String SEARCH_ENGINE = "SEARCH_ENGINE"; + public static final String FIRST_INSTALLED = "FIRST_INSTALLED"; public static final String JAVA_SCRIPT = "JAVA_SCRIPT"; public static final String HISTORY_CLEAR = "HISTORY_CLEAR"; - public static final String GATEWAY = "pref_bridges_enabled"; + public static final String GATEWAY_AUTO = "pref_bridges_enabled_auto"; + public static final String GATEWAY_MANUAL = "pref_bridges_enabled_manual"; public static final String IS_BOOTSTRAPPED = "IS_BOOTSTRAPPED"; public static final String IS_WELCOME_ENABLED = "IS_WELCOME_ENABLED"; public static final String ENGINE_SWITCHED = "ENGINE_SWITCHED"; @@ -38,4 +41,7 @@ public class keys public static final String CLEAR_PREFS = "CLEAR_PREFS"; public static final String NOTIFICATION_STATUS = "NOTIFICATION_STATUS"; + /*Bridge Settings*/ + public static final String CUSTOM_BRIDGE_1 = "CLEAR_PREFS"; + } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java index d1857752..85b981c4 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -13,28 +13,42 @@ public class status /*Settings Status*/ public static String sSearchStatus = constants.BACKEND_GENESIS_URL; + public static String sRedirectStatus = strings.EMPTY_STR; public static boolean sJavaStatus = true; public static boolean sHistoryStatus = true; - public static boolean sGateway = false; public static boolean sIsAppPaused = false; public static boolean sIsWelcomeEnabled = true; public static boolean sIsAppStarted = false; public static boolean sIsAppRated = false; public static boolean sFontAdjustable = true; + public static boolean sFirstStart = true; + public static boolean sDesktopSite = false; public static int sCookieStatus = ACCEPT_FIRST_PARTY; public static float sFontSize = 1; + public static String sLanguage = "ru"; + + /*Bridge Status*/ + + public static boolean sGatewayAuto = false; + public static boolean sGatewayManual = false; + public static String sCustomBridge = strings.CUSTOM_BRIDGE; + public static void initStatus() { status.sJavaStatus = dataController.getInstance().getBool(keys.JAVA_SCRIPT,true); status.sHistoryStatus = dataController.getInstance().getBool(keys.HISTORY_CLEAR,true); status.sSearchStatus = dataController.getInstance().getString(keys.SEARCH_ENGINE,constants.BACKEND_GENESIS_URL); - status.sGateway = dataController.getInstance().getBool(keys.GATEWAY,false); + status.sGatewayAuto = dataController.getInstance().getBool(keys.GATEWAY_AUTO,false); + status.sGatewayManual = dataController.getInstance().getBool(keys.GATEWAY_MANUAL,false); status.sIsWelcomeEnabled = dataController.getInstance().getBool(keys.IS_WELCOME_ENABLED,true); status.sIsAppRated = dataController.getInstance().getBool(keys.IS_APP_RATED,false); status.sFontSize = dataController.getInstance().getFloat(keys.FONT_SIZE,100); status.sFontAdjustable = dataController.getInstance().getBool(keys.FONT_ADJUSTABLE,true); status.sCookieStatus = dataController.getInstance().getInt(keys.COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY); + status.sCustomBridge = dataController.getInstance().getString(keys.CUSTOM_BRIDGE_1,strings.CUSTOM_BRIDGE); + status.sFirstStart = dataController.getInstance().getBool(keys.FIRST_INSTALLED,true); + status.sLanguage = dataController.getInstance().getString(keys.LANGUAGE,strings.DEFAULT_LANGUAGE); } } 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 20693379..49739625 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java @@ -28,6 +28,10 @@ public class strings public static final String ORBOT_INIT_BT_1 = "Dismiss"; public static final String ORBOT_INIT_BT_2 = "Try Again"; + public static final String ORBOT_CLEAR_TITLE = "Data Cleared"; + public static final String ORBOT_CLEAR_DESC = "Genesis data has been cleared. Please try to start application from Homepage\n"; + public static final String ORBOT_CLEAR_BT_1 = "Dismiss"; + public static final String VERSION_TITLE = "Update Pending"; public static final String VERSION_DESC = "You have not updated this app for a while please update it to get best performance\n"; public static final String VERSION_BT_1 = "Update"; @@ -63,11 +67,12 @@ public class strings public static final String clear_bookmark_bt2 = "Dismiss"; public static final String DOWNLOAD_TITLE = "Download Notification"; - public static final String DOWNLOAD_LONG_PRESS_TITLE = "File Notification"; - public static final String DOWNLOAD_LONG_PRESS_MESSAGE = "File | "; public static final String DOWNLOAD_MESSAGE = "Download File | "; public static final String DOWNLOAD_POSITIVE = "Download"; - public static final String DOWNLOAD_NEGATIVE = "Dismiss"; + + public static final String BRIDGE_MAIL_TITLE = "Request New Bridge"; + public static final String BRIDGE_MAIL_MESSAGE = "You can get a bridge address through email, the web or by scanning a bridge QR code. Select 'Email' below to request a bridge address.\n\nOnce you have an address, copy & paste it into the above box and start."; + public static final String BRIDGE_MAIL_POSITIVE = "EMAIL"; public static final String LONG_URL_TITLE = "URL Notification"; public static final String LONG_URL_MESSAGE = ""; @@ -92,6 +97,10 @@ public class strings public static final String CLEAR_TABS = "CLEAR TABS"; + /*Bridge Manager*/ + + public static final String CUSTOM_BRIDGE = "obfs4"; + /*Text Manager*/ public static final String DARK_WEB = "Hidden Web"; @@ -102,6 +111,7 @@ public class strings public static final String CUSTOM_FONTS = "Custom Font"; public static final String PERCENT_SIGN = "%"; + public static final String DEFAULT_LANGUAGE = "ru"; /*Bookmark Manager*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java index b754cfda..e99f8a31 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataController.java @@ -11,6 +11,7 @@ import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession; import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.helperMethod; import java.util.ArrayList; @@ -39,6 +40,7 @@ public class dataController mPreferencesModel.setHistorySize(databaseController.getInstance().getLargestHistoryID()); } public void initializeListData(){ + mPreferencesModel.initSuggestions(); if(!status.sHistoryStatus) { mPreferencesModel.initializeHistory(databaseController.getInstance().selectHistory(0,constants.START_LIST_SIZE)); @@ -47,7 +49,6 @@ public class dataController { databaseController.getInstance().execSQL("delete from history where 1",null); } - mPreferencesModel.initSuggestions(); } /*Saving Preferences*/ @@ -93,11 +94,13 @@ public class dataController activityContextManager.getInstance().getHomeController().onSuggestionUpdate(); } public void updateSuggestionURL(String url,String title) { - mPreferencesModel.updateSuggestionURL(url,title); + url = helperMethod.removeLastSlash(url); + mPreferencesModel.updateSuggestionURL(url,title,false); activityContextManager.getInstance().getHomeController().onSuggestionUpdate(); } public void addSuggesion(String url,String title) { - mPreferencesModel.addSuggenstions(url,title); + url = helperMethod.removeLastSlash(url); + mPreferencesModel.addSuggenstions(url,title,false); activityContextManager.getInstance().getHomeController().onSuggestionUpdate(); } public void removeHistory(String url){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataModel.java index fc3e4f4a..7adb1e43 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataModel.java @@ -12,6 +12,10 @@ import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession; import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + +import java.net.URI; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -79,52 +83,71 @@ class dataModel void initializeHistory(ArrayList history){ this.mHistory = history; - initializeCache(history); - Log.i("",""); + if(!status.sHistoryStatus){ + initializeCache(history); + }else { + clearHistory(); + } } private void initializeCache(ArrayList history){ for(int count=0;count<=history.size()-1;count++){ + mHistoryCache.put(history.get(count).getmHeader(),true); historyRowModel tempSuggestion = new historyRowModel(history.get(count).getTitle(),history.get(count).getmHeader(),-1); - mSuggestions.add(tempSuggestion); - mSuggestionCache.put(history.get(count).getmHeader(),tempSuggestion); + + tempSuggestion.updateTitle(tempSuggestion.getmHeader()); + tempSuggestion.updateURL(history.get(count).getmHeader()); + addSuggenstions(tempSuggestion.getmHeader(),tempSuggestion.getTitle(),true); + mSuggestionCache.put(helperMethod.removeLastSlash(history.get(count).getmHeader()),tempSuggestion); + } } - void updateSuggestionURL(String url, String newURL){ + + + void updateSuggestionURL(String url, String newURL,boolean isLoading){ if(url.length()>1500){ return; } + url = helperMethod.removeLastSlash(url); + url = helperMethod.urlWithoutPrefix(url); historyRowModel model = mSuggestionCache.get(url); if(model!=null){ mSuggestionCache.remove(url); - model.updateURL(newURL); - mSuggestionCache.put(newURL,model); + if(!newURL.equals("loading")) + model.updateHeader(newURL); + model.updateTitle(model.getmHeader()); + mSuggestionCache.put(url,model); } + String[] params = new String[2]; + params[0] = newURL; + params[1] = url; + if(newURL.length()>0 && !isLoading){ + databaseController.getInstance().execSQL("UPDATE history SET title = ? , date = DateTime('now') WHERE url = ?",params); + } } - void addSuggenstions(String url, String title){ - if(url.length()>1500){ + void addSuggenstions(String url, String title,boolean isLoading){ + if(url.length()>1500 || title.equals("$TITLE") || title.equals("loading")){ return; } + url = helperMethod.removeLastSlash(url); + url = helperMethod.urlWithoutPrefix(url); historyRowModel tempModel = mSuggestionCache.get(url); if(tempModel==null){ historyRowModel model = new historyRowModel(title,url,-1); - mSuggestions.add(0,model); mSuggestionCache.put(url,model); + mSuggestions.add(0,mSuggestionCache.get(url)); } else { - historyRowModel model = mSuggestionCache.get(url); - if(model!=null){ - model.updateTitle(title); - } + updateSuggestionURL(url,title,isLoading); } String[] params = new String[2]; params[0] = title; params[1] = url; - if(title.length()>0){ + if(title.length()>0 && !isLoading){ databaseController.getInstance().execSQL("UPDATE history SET title = ? , date = DateTime('now') WHERE url = ?",params); } } @@ -133,6 +156,9 @@ class dataModel if(url.length()>1500){ return; } + url = helperMethod.removeLastSlash(url); + url = helperMethod.urlWithoutPrefix(url); + @SuppressLint("SimpleDateFormat") SimpleDateFormat d_form = new SimpleDateFormat("dd MMMM | hh:mm a"); String date = d_form.format(new Date()); @@ -150,10 +176,15 @@ class dataModel historyRowModel model = mSuggestionCache.get(url); if(model!=null){ - Log.i("ERERER3",mSuggestions.size()+""); - mSuggestions.remove(model); + for(int e=0;e history){ @@ -263,7 +292,7 @@ class dataModel mTabs.remove(0); } if(mTabs.size()>0){ - Log.i("FUCKERRROR125:","_FERROR_"); + //Log.i("FUCKERRROR125:","_FERROR_"); mTabs.get(0).getSession().closeSession(); } } @@ -318,111 +347,109 @@ class dataModel } void initSuggestions(){ - Log.i("ERERER9",mSuggestions.size()+""); - mSuggestions.add(new historyRowModel("Youtube","https://youtube.com",-1)); - mSuggestions.add(new historyRowModel("Facebook","https://facebook.com",-1)); - mSuggestions.add(new historyRowModel("Twitter","https://twitter.com",-1)); - mSuggestions.add(new historyRowModel("Amazon","https://amazon.com",-1)); - mSuggestions.add(new historyRowModel("IMDB","https://imdb.com",-1)); - mSuggestions.add(new historyRowModel("Reddit","https://reddit.com",-1)); - mSuggestions.add(new historyRowModel("Pinterest","https://pinterest.com",-1)); - mSuggestions.add(new historyRowModel("EBay","https://ebay.com",-1)); - mSuggestions.add(new historyRowModel("Trip Advisor","https://tripadvisor.com",-1)); - mSuggestions.add(new historyRowModel("Craigslist","https://craigslist.org",-1)); - mSuggestions.add(new historyRowModel("Walmart","https://walmart.com",-1)); - mSuggestions.add(new historyRowModel("Instagram","https://instagram.com",-1)); - mSuggestions.add(new historyRowModel("Google","https://google.com",-1)); - mSuggestions.add(new historyRowModel("NY Times","https://nytimes.com",-1)); - mSuggestions.add(new historyRowModel("Apple","https://apple.com",-1)); - mSuggestions.add(new historyRowModel("Linkedin","https://linkedin.com",-1)); - mSuggestions.add(new historyRowModel("Indeed","https://indeed.com",-1)); - mSuggestions.add(new historyRowModel("Play.Google","https://play.google.com",-1)); - mSuggestions.add(new historyRowModel("ESPN","https://espn.com",-1)); - mSuggestions.add(new historyRowModel("Webmd","https://webmd.com",-1)); - mSuggestions.add(new historyRowModel("CNN","https://cnn.com",-1)); - mSuggestions.add(new historyRowModel("Homedepot","https://homedepot.com",-1)); - mSuggestions.add(new historyRowModel("ETSY","https://etsy.com",-1)); - mSuggestions.add(new historyRowModel("Netflix","https://netflix.com",-1)); - mSuggestions.add(new historyRowModel("Quora","https://quora.com",-1)); - mSuggestions.add(new historyRowModel("Microsoft","https://microsoft.com",-1)); - mSuggestions.add(new historyRowModel("Target","https://target.com",-1)); - mSuggestions.add(new historyRowModel("Merriam Webster","https://merriam-webster.com",-1)); - mSuggestions.add(new historyRowModel("Forbes","https://forbes.com",-1)); - mSuggestions.add(new historyRowModel("Mapquest","https://mapquest.com",-1)); - mSuggestions.add(new historyRowModel("NIH","https://nih.gov",-1)); - mSuggestions.add(new historyRowModel("Gamepedia","https://gamepedia.com",-1)); - mSuggestions.add(new historyRowModel("Yahoo","https://yahoo.com",-1)); - mSuggestions.add(new historyRowModel("Healthline","https://healthline.com",-1)); - mSuggestions.add(new historyRowModel("Foxnews","https://foxnews.com",-1)); - mSuggestions.add(new historyRowModel("All Recipes","https://allrecipes.com",-1)); - mSuggestions.add(new historyRowModel("Quizlet","https://quizlet.com",-1)); - mSuggestions.add(new historyRowModel("Weather","https://weather.com",-1)); - mSuggestions.add(new historyRowModel("Bestbuy","https://bestbuy.com",-1)); - mSuggestions.add(new historyRowModel("Urbandictionary","https://urbandictionary.com",-1)); - mSuggestions.add(new historyRowModel("Mayoclinic","https://mayoclinic.org",-1)); - mSuggestions.add(new historyRowModel("AOL","https://aol.com",-1)); - mSuggestions.add(new historyRowModel("Genius","https://genius.com",-1)); - mSuggestions.add(new historyRowModel("Zillow","https://zillow.com",-1)); - mSuggestions.add(new historyRowModel("Usatoday","https://usatoday.com",-1)); - mSuggestions.add(new historyRowModel("Glassdoor","https://glassdoor.com",-1)); - mSuggestions.add(new historyRowModel("MSN","https://msn.com",-1)); - mSuggestions.add(new historyRowModel("Rotten Tomatoes","https://rottentomatoes.com",-1)); - mSuggestions.add(new historyRowModel("Lowes","https://lowes.com",-1)); - mSuggestions.add(new historyRowModel("Dictionary","https://dictionary.com",-1)); - mSuggestions.add(new historyRowModel("Business Insider","https://businessinsider.com",-1)); - mSuggestions.add(new historyRowModel("US News","https://usnews.com",-1)); - mSuggestions.add(new historyRowModel("Medical News Today","https://medicalnewstoday.com",-1)); - mSuggestions.add(new historyRowModel("Britannica","https://britannica.com",-1)); - mSuggestions.add(new historyRowModel("Washington Post","https://washingtonpost.com",-1)); - mSuggestions.add(new historyRowModel("USPS","https://usps.com",-1)); - mSuggestions.add(new historyRowModel("Finance Yahoo","https://finance.yahoo.com",-1)); - mSuggestions.add(new historyRowModel("IRS","https://irs.gov",-1)); - mSuggestions.add(new historyRowModel("Yellow Pages","https://yellowpages.com",-1)); - mSuggestions.add(new historyRowModel("Chase","https://chase.com",-1)); - mSuggestions.add(new historyRowModel("Retail Menot","https://retailmenot.com",-1)); - mSuggestions.add(new historyRowModel("Accuweather","https://accuweather.com",-1)); - mSuggestions.add(new historyRowModel("Way Fair","https://wayfair.com",-1)); - mSuggestions.add(new historyRowModel("GO","https://go.com",-1)); - mSuggestions.add(new historyRowModel("Live","https://live.com",-1)); - mSuggestions.add(new historyRowModel("Login Yahoo","https://login.yahoo.com",-1)); - mSuggestions.add(new historyRowModel("Steam Community","https://steamcommunity.com",-1)); - mSuggestions.add(new historyRowModel("XFinity","https://xfinity.com",-1)); - mSuggestions.add(new historyRowModel("CNET","https://cnet.com",-1)); - mSuggestions.add(new historyRowModel("IGN","https://ign.com",-1)); - mSuggestions.add(new historyRowModel("Steam Powered","https://steampowered.com",-1)); - mSuggestions.add(new historyRowModel("Macys","https://macys.com",-1)); - mSuggestions.add(new historyRowModel("Wikihow","https://wikihow.com",-1)); - mSuggestions.add(new historyRowModel("Mail Yahoo","https://mail.yahoo.com",-1)); - mSuggestions.add(new historyRowModel("Wiktionary","wiktionary.org",-1)); - mSuggestions.add(new historyRowModel("Cbssports","https://cbssports.com",-1)); - mSuggestions.add(new historyRowModel("CNBC","https://cnbc.com",-1)); - mSuggestions.add(new historyRowModel("Bank Of America","https://bankofamerica.com",-1)); - mSuggestions.add(new historyRowModel("Expedia","https://expedia.com",-1)); - mSuggestions.add(new historyRowModel("Wellsfargo","https://wellsfargo.com",-1)); - mSuggestions.add(new historyRowModel("Groupon","https://groupon.com",-1)); - mSuggestions.add(new historyRowModel("Twitch","https://twitch.tv",-1)); - mSuggestions.add(new historyRowModel("Khan Academy","https://khanacademy.org",-1)); - mSuggestions.add(new historyRowModel("The Guardian","https://theguardian.com",-1)); - mSuggestions.add(new historyRowModel("Paypal","https://paypal.com",-1)); - mSuggestions.add(new historyRowModel("Spotify","https://spotify.com",-1)); - mSuggestions.add(new historyRowModel("ATT","https://att.com",-1)); - mSuggestions.add(new historyRowModel("NFL","https://nfl.com",-1)); - mSuggestions.add(new historyRowModel("Realtor","https://realtor.com",-1)); - mSuggestions.add(new historyRowModel("CA Gov","https://ca.gov",-1)); - mSuggestions.add(new historyRowModel("Good Reads","https://goodreads.com",-1)); - mSuggestions.add(new historyRowModel("Office","https://office.com",-1)); - mSuggestions.add(new historyRowModel("UFL","https://ufl.edu",-1)); - mSuggestions.add(new historyRowModel("MLB","https://mlb.com",-1)); - mSuggestions.add(new historyRowModel("Food Network","https://foodnetwork.com",-1)); - mSuggestions.add(new historyRowModel("BBC","https://bbc.com",-1)); - mSuggestions.add(new historyRowModel("Apartments","https://apartments.com",-1)); - mSuggestions.add(new historyRowModel("NPR","https://npr.org",-1)); - mSuggestions.add(new historyRowModel("Wow Head","https://wowhead.com",-1)); - mSuggestions.add(new historyRowModel("Duckduckgo","https://duckduckgo.com",-1)); - mSuggestions.add(new historyRowModel("Bing","https://bing.com",-1)); - mSuggestions.add(new historyRowModel("Google","https://google.com",-1)); - mSuggestions.add(new historyRowModel("Genesis Search","https://boogle.store",-1)); - Log.i("ERERER10",mSuggestions.size()+""); + addSuggenstions("https://duckduckgo.com","Duckduckgo",true); + addSuggenstions("https://bbc.com","BBC",true); + addSuggenstions("https://youtube.com","Youtube",true); + addSuggenstions("https://facebook.com","Facebook",true); + addSuggenstions("https://twitter.com","Twitter",true); + addSuggenstions("https://amazon.com","Amazon",true); + addSuggenstions("https://imdb.com","IMDB",true); + addSuggenstions("https://reddit.com","Reddit",true); + addSuggenstions("https://pinterest.com","Pinterest",true); + addSuggenstions("https://ebay.com","EBay",true); + addSuggenstions("https://tripadvisor.com","Trip Advisor",true); + addSuggenstions("https://craigslist.org","Craigslist",true); + addSuggenstions("https://walmart.com","Walmart",true); + addSuggenstions("https://instagram.com","Instagram",true); + addSuggenstions("https://google.com","Google",true); + addSuggenstions("https://nytimes.com","NY Times",true); + addSuggenstions("https://apple.com","Apple",true); + addSuggenstions("https://linkedin.com","Linkedin",true); + addSuggenstions("https://indeed.com","Indeed",true); + addSuggenstions("https://play.google.com","Play.Google",true); + addSuggenstions("https://espn.com","ESPN",true); + addSuggenstions("https://webmd.com","Webmd",true); + addSuggenstions("https://cnn.com","CNN",true); + addSuggenstions("https://homedepot.com","Homedepot",true); + addSuggenstions("https://etsy.com","ETSY",true); + addSuggenstions("https://netflix.com","Netflix",true); + addSuggenstions("https://quora.com","Quora",true); + addSuggenstions("https://microsoft.com","Microsoft",true); + addSuggenstions("https://target.com","Target",true); + addSuggenstions("https://merriam-webster.com","Merriam Webster",true); + addSuggenstions("https://forbes.com","Forbes",true); + addSuggenstions("https://mapquest.com","Mapquest",true); + addSuggenstions("https://nih.gov","NIH",true); + addSuggenstions("https://gamepedia.com","Gamepedia",true); + addSuggenstions("https://yahoo.com","Yahoo",true); + addSuggenstions("https://healthline.com","Healthline",true); + addSuggenstions("https://foxnews.com","Foxnews",true); + addSuggenstions("https://allrecipes.com","All Recipes",true); + addSuggenstions("https://quizlet.com","Quizlet",true); + addSuggenstions("https://weather.com","Weather",true); + addSuggenstions("https://bestbuy.com","Bestbuy",true); + addSuggenstions("https://urbandictionary.com","Urbandictionary",true); + addSuggenstions("https://mayoclinic.org","Mayoclinic",true); + addSuggenstions("https://aol.com" ,"AOL",true); + addSuggenstions("https://genius.com","Genius",true); + addSuggenstions("https://zillow.com","Zillow",true); + addSuggenstions("https://usatoday.com","Usatoday",true); + addSuggenstions("https://glassdoor.com","Glassdoor",true); + addSuggenstions("https://msn.com","MSN",true); + addSuggenstions("https://rottentomatoes.com","Rotten Tomatoes",true); + addSuggenstions("https://lowes.com","Lowes",true); + addSuggenstions("https://dictionary.com","Dictionary",true); + addSuggenstions("https://businessinsider.com","Business Insider",true); + addSuggenstions("https://usnews.com","US News",true); + addSuggenstions("https://medicalnewstoday.com","Medical News Today",true); + addSuggenstions("https://britannica.com","Britannica",true); + addSuggenstions("https://washingtonpost.com","Washington Post",true); + addSuggenstions("https://usps.com","USPS",true); + addSuggenstions("https://finance.yahoo.com","Finance Yahoo",true); + addSuggenstions("https://irs.gov","IRS",true); + addSuggenstions("https://yellowpages.com","Yellow Pages",true); + addSuggenstions("https://chase.com","Chase",true); + addSuggenstions("https://retailmenot.com","Retail Menot",true); + addSuggenstions("https://accuweather.com","Accuweather",true); + addSuggenstions("https://wayfair.com","Way Fair",true); + addSuggenstions("https://go.com","GO",true); + addSuggenstions("https://live.com","Live",true); + addSuggenstions("https://login.yahoo.com","Login Yahoo",true); + addSuggenstions("https://steamcommunity.com","Steam Community",true); + addSuggenstions("https://xfinity.com","XFinity",true); + addSuggenstions("https://cnet.com","CNET",true); + addSuggenstions("https://ign.com","IGN",true); + addSuggenstions("https://steampowered.com","Steam Powered",true); + addSuggenstions("https://macys.com","Macys",true); + addSuggenstions("https://wikihow.com","Wikihow",true); + addSuggenstions("https://mail.yahoo.com","Mail Yahoo",true); + addSuggenstions("wiktionary.org","Wiktionary",true); + addSuggenstions("https://cbssports.com","Cbssports",true); + addSuggenstions("https://cnbc.com","CNBC",true); + addSuggenstions("https://bankofamerica.com","Bank Of America",true); + addSuggenstions("https://expedia.com","Expedia",true); + addSuggenstions("https://wellsfargo.com","Wellsfargo",true); + addSuggenstions("https://groupon.com","Groupon",true); + addSuggenstions("https://twitch.tv","Twitch",true); + addSuggenstions("https://khanacademy.org","Khan Academy",true); + addSuggenstions("https://theguardian.com","The Guardian",true); + addSuggenstions("https://paypal.com","Paypal",true); + addSuggenstions("https://spotify.com","Spotify",true); + addSuggenstions("https://att.com","ATT",true); + addSuggenstions("https://nfl.com","NFL",true); + addSuggenstions("https://realtor.com","Realtor",true); + addSuggenstions("https://ca.gov","CA Gov",true); + addSuggenstions("https://goodreads.com","Good Reads",true); + addSuggenstions("https://office.com","Office",true); + addSuggenstions("https://ufl.edu","UFL",true); + addSuggenstions("https://mlb.com","MLB",true); + addSuggenstions("https://foodnetwork.com","Food Network",true); + addSuggenstions("https://apartments.com","Apartments",true); + addSuggenstions("https://npr.org","NPR",true); + addSuggenstions("https://wowhead.com","Wow Head",true); + addSuggenstions("https://bing.com","Bing",true); + addSuggenstions("https://google.com","Google",true); + addSuggenstions("https://boogle.store","Genesis Search",true); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/AdBlocker.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/AdBlocker.java new file mode 100755 index 00000000..ce70c2b7 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/AdBlocker.java @@ -0,0 +1,28 @@ +package com.darkweb.genesissearchengine.helperManager; + +import android.content.Context; +import android.content.res.Resources; +import android.util.Log; + +import com.example.myapplication.R; + +/** + * Created by BrainWang on 05/01/2016. + */ +public class AdBlocker { + static String[] adUrls = null; + public static boolean isAd(Context context, String url) { + Resources res = context.getResources(); + if(adUrls==null) + { + adUrls = res.getStringArray(R.array.adBlockUrl); + } + + for (String adUrl : adUrls) { + if (url.contains(adUrl)) { + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/JavaScriptInterface.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/JavaScriptInterface.java old mode 100644 new mode 100755 diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/LocaleUtils.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/LocaleUtils.java new file mode 100755 index 00000000..def380f6 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/LocaleUtils.java @@ -0,0 +1,82 @@ +package com.darkweb.genesissearchengine.helperManager; + +import android.app.Application; +import android.content.Context; +import android.content.SharedPreferences; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.os.Build; +import android.preference.PreferenceManager; +import android.view.ContextThemeWrapper; + +import com.darkweb.genesissearchengine.appManager.homeManager.homeController; + +import java.util.Locale; + +/** + * Created by Umesh on 10/10/16. + */ +public class LocaleUtils { + + private static Locale mLocale; + + public static void setLocale(Locale locale){ + mLocale = locale; + if(mLocale != null){ + Locale.setDefault(mLocale); + } + } + + public static void updateConfiguration(ContextThemeWrapper wrapper){ + if(mLocale != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1){ + Configuration configuration = new Configuration(); + configuration.setLocale(mLocale); + wrapper.applyOverrideConfiguration(configuration); + } + } + + public static void updateConfiguration(homeController application, Configuration configuration){ + if(mLocale != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1){ + Configuration config = new Configuration(configuration); + config.locale = mLocale; + Resources res = application.getBaseContext().getResources(); + res.updateConfiguration(configuration, res.getDisplayMetrics()); + } + } + + public static void updateConfiguration(Context context, String language, String country){ + Locale locale = new Locale(language,country); + setLocale(locale); + if(mLocale != null){ + Resources res = context.getResources(); + Configuration configuration = res.getConfiguration(); + configuration.locale = mLocale; + res.updateConfiguration(configuration,res.getDisplayMetrics()); + } + } + + + + + public static String getPrefLangCode(Context context) { + return PreferenceManager.getDefaultSharedPreferences(context).getString("lang_code","en"); + } + + public static void setPrefLangCode(Context context, String mPrefLangCode) { + + SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); + editor.putString("lang_code",mPrefLangCode); + editor.commit(); + } + + public static String getPrefCountryCode(Context context) { + return PreferenceManager.getDefaultSharedPreferences(context).getString("country_code","US"); + } + + public static void setPrefCountryCode(Context context,String mPrefCountryCode) { + + SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); + editor.putString("country_code",mPrefCountryCode); + editor.commit(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/autoCompleteAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/autoCompleteAdapter.java index 31bce8c6..bcebbda7 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/autoCompleteAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/autoCompleteAdapter.java @@ -2,6 +2,7 @@ package com.darkweb.genesissearchengine.helperManager; import java.util.ArrayList; import android.content.Context; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -59,7 +60,11 @@ public class autoCompleteAdapter extends ArrayAdapter { Filter nameFilter = new Filter() { @Override public String convertResultToString(Object resultValue) { - String str = ((historyRowModel)(resultValue)).getmHeader(); + if(resultValue==null){ + return strings.EMPTY_STR; + } + historyRowModel model = (historyRowModel)(resultValue); + String str = model.getmHeader(); return str; } @Override @@ -70,8 +75,15 @@ public class autoCompleteAdapter extends ArrayAdapter { if(suggestions.size()>10){ break; } - if(customer.getmHeader().length()>2 && customer.getmDescription().toLowerCase().length()>2 && (customer.getmHeader().toLowerCase().contains(constraint.toString().toLowerCase()) || customer.getmDescription().toLowerCase().contains(constraint.toString().toLowerCase()))){ - suggestions.add(customer); + + + if(!customer.getTitle().equals("$TITLE") && customer.getmHeader().length()>2 && customer.getmDescription().toLowerCase().length()>2 && (customer.getmHeader().toLowerCase().contains(constraint.toString().toLowerCase()) || customer.getmDescription().toLowerCase().contains(constraint.toString().toLowerCase()))){ + Log.i("memememe:","memememe:"+constraint.toString().toLowerCase().replace("https://","").replace("http://","")); + Log.i("memememe1:","memememe2:"+customer.getmDescription().replace("https://","").replace("http://","")); + + if(!constraint.toString().toLowerCase().replace("https://","").replace("http://","").equals(customer.getmDescription().replace("https://","").replace("http://",""))){ + suggestions.add(customer); + } } } FilterResults filterResults = new FilterResults(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/errorHandler.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/errorHandler.java index 26a32a01..06d0609c 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/errorHandler.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/errorHandler.java @@ -5,6 +5,7 @@ import android.webkit.URLUtil; import androidx.appcompat.app.AppCompatActivity; import com.darkweb.genesissearchengine.constants.strings; +import com.example.myapplication.R; import org.mozilla.geckoview.WebRequestError; @@ -47,14 +48,41 @@ public class errorHandler if (reader != null) { try { reader.close(); - } catch (IOException e) { + } catch (IOException ignored) { } } } } - String title = helperMethod.getHost(url); - return createErrorPage("CODE : " + categoryToString(category) + "
TYPE : " + errorToString(error)).replace("$URL",url).replace("$TITLE",title); + + if(url==null){ + url = "Hidden Error"; + } + if(title==null){ + title = "Hidden Error"; + } + + String replaceUrl = errorToString(error).replace("$URL",url); + // String replaceUrl = errorToString(error).replace("$URL",url); + // if(replaceUrl==null){ + // replaceUrl = "Hidden Error"; + // } + + String errorPage = createErrorPage("CODE : " + categoryToString(category) + "
TYPE : " + replaceUrl.replace("$TITLE",title),url); + errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category)); + return errorPage; + } + + private String translateMessage(String message,String error){ + message = message.replace("$ERROR_M1",mContext.getString(R.string.error_m1)); + message = message.replace("$ERROR_M2",mContext.getString(R.string.error_m2)); + message = message.replace("$ERROR_M3",mContext.getString(R.string.error_m3)); + message = message.replace("$ERROR_M4",mContext.getString(R.string.error_m4)); + message = message.replace("$ERROR_M5",mContext.getString(R.string.error_m5)); + message = message.replace("$ERROR_M6",mContext.getString(R.string.error_m6)); + message = message.replace("$ERROR", error); + + return message; } private String errorToString(final int error) { @@ -137,7 +165,7 @@ public class errorHandler return "UNKNOWN"; } } - private String createErrorPage(final String error) { + private String createErrorPage(final String error,String url) { if(error==null){ return strings.EMPTY_STR; } @@ -175,8 +203,9 @@ public class errorHandler } } } + String replaceUrl = mErrorTemplate.replace("$URL",url); - return mErrorTemplate.replace("$ERROR", error); + return replaceUrl; } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java index 113ee873..fbd8a960 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java @@ -1,6 +1,7 @@ package com.darkweb.genesissearchengine.helperManager; import android.Manifest; +import android.app.ActivityManager; import android.app.DownloadManager; import android.content.ClipData; import android.content.ClipboardManager; @@ -10,11 +11,13 @@ import android.content.pm.PackageManager; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Point; +import android.net.NetworkInfo; import android.net.Uri; import android.os.Build; import android.text.SpannableString; import android.text.Spanned; import android.text.style.ForegroundColorSpan; +import android.util.Log; import android.view.Display; import android.view.Gravity; import android.view.View; @@ -33,6 +36,7 @@ import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.dataManager.dataController; import com.example.myapplication.BuildConfig; +import java.io.File; import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; @@ -117,6 +121,16 @@ public class helperMethod } } + public static void sendBridgeEmail(Context context){ + Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); + String aEmailList[] = { "bridges@torproject.org"}; + emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList); + emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "get transport"); + emailIntent.setType("plain/text"); + emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "get transport"); + context.startActivity(emailIntent); + } + public static void hideKeyboard(AppCompatActivity context) { View view = context.findViewById(android.R.id.content); if (view != null) @@ -152,6 +166,10 @@ public class helperMethod } } + public static void openLocaleSettings(Context context){ + Intent i = new Intent(android.provider.Settings.ACTION_LOCALE_SETTINGS); + context.startActivity(i); + } static String getHost(String link){ URL url; @@ -168,6 +186,38 @@ public class helperMethod } + public static String capitalizeString(String string) { + char[] chars = string.toLowerCase().toCharArray(); + boolean found = false; + for (int i = 0; i < chars.length; i++) { + if (!found && Character.isLetter(chars[i])) { + chars[i] = Character.toUpperCase(chars[i]); + found = true; + } else if (Character.isWhitespace(chars[i]) || chars[i]=='.' || chars[i]=='\'') { // You can add other chars here + found = false; + } + } + return String.valueOf(chars); + } + + public static String removeLastSlash(String url){ + if(url.length()>2){ + if(url.charAt(url.length()-1)=='/'){ + return url.substring(0,url.length()-1); + } + } + return url; + } + + public static String urlWithoutPrefix(String url){ + try{ + url = url.substring(url.indexOf(getHost(url)),url.length()).replace("www.","").replace("m.",""); + return url; + }catch (Exception ex){ + return url; + } + } + public static void openActivity( Class cls,int type,AppCompatActivity context,boolean animation){ Intent myIntent = new Intent(context, cls); myIntent.putExtra(keys.list_type, type); @@ -260,6 +310,7 @@ public class helperMethod public static void copyURL(String url,Context context){ + ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("link", url); clipboard.setPrimaryClip(clip); @@ -295,4 +346,9 @@ public class helperMethod return true; } + public static void clearAppData(Context context) { + Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + intent.setData(Uri.parse("package:" + context.getPackageName())); + context.startActivity(intent); + } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adManager.java index 02e03d91..28b01950 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/adManager.java @@ -58,7 +58,7 @@ class adManager @Override public void onAdFailedToLoad(int errorCode) { - Log.i("Failure___",""+errorCode); + //Log.i("Failure___",""+errorCode); } @Override 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 181f8874..cac590f7 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/messageManager.java @@ -1,7 +1,6 @@ package com.darkweb.genesissearchengine.pluginManager; import android.annotation.SuppressLint; -import android.app.DownloadManager; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; @@ -59,32 +58,32 @@ class messageManager private void welcomeMessage() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) - .setTitle(strings.WELCOME_MESSAGE_TITLE) + .setTitle(app_context.getString(R.string.WELCOME_MESSAGE_TITLE)) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha_v1)) .setTextColor(app_context.getResources().getColor(R.color.blue_dark)) - .setMessage(strings.WELCOME_MESSAGE_DESC) + .setMessage(app_context.getString(R.string.WELCOME_MESSAGE_DESC)) .onDismissListener(dialog -> is_popup_open = false) - .addButton(strings.WELCOME_MESSAGE_BT_1, -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (DialogInterface tempDialog, int which) -> + .addButton(app_context.getString(R.string.WELCOME_MESSAGE_BT_1), -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (DialogInterface tempDialog, int which) -> { tempDialog.dismiss(); event.invokeObserver(Collections.singletonList(constants.BLACK_MARKET_URL), enums.etype.welcome); }) - .addButton(strings.WELCOME_MESSAGE_BT_2, -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + .addButton(app_context.getString(R.string.WELCOME_MESSAGE_BT_2), -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> { tempDialog.dismiss(); event.invokeObserver(Collections.singletonList(constants.LEAKED_DOCUMENT_URL), enums.etype.welcome); }) - .addButton(strings.WELCOME_MESSAGE_BT_3, -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + .addButton(app_context.getString(R.string.WELCOME_MESSAGE_BT_3), -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> { tempDialog.dismiss(); event.invokeObserver(Collections.singletonList(constants.NEWS_URL), enums.etype.welcome); }) - .addButton(strings.WELCOME_MESSAGE_BT_4, -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + .addButton(app_context.getString(R.string.WELCOME_MESSAGE_BT_4), -1, Color.rgb(77,136,255 ), CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> { tempDialog.dismiss(); event.invokeObserver(Collections.singletonList(constants.SOFTWARE_URL), enums.etype.welcome); }) - .addButton(strings.WELCOME_MESSAGE_BT_5, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + .addButton(app_context.getString(R.string.WELCOME_MESSAGE_BT_5), -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> { event.invokeObserver(null, enums.etype.cancel_welcome); tempDialog.dismiss(); @@ -107,12 +106,12 @@ class messageManager private void abiError() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) - .setTitle(strings.ABI_ERROR_TITLE) + .setTitle(app_context.getString(R.string.ABI_ERROR_TITLE)) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) .onDismissListener(dialog -> abiErrorRestart()) - .setMessage(strings.ABI_ERROR_DESC) - .addButton(strings.ABI_ERROR_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + .setMessage(app_context.getString(R.string.ABI_ERROR_DESC)) + .addButton(app_context.getString(R.string.ABI_ERROR_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.GENESIS_UPDATE_URL + status.current_ABI)); if(browserIntent.resolveActivity(app_context.getPackageManager()) != null) @@ -122,7 +121,7 @@ class messageManager helperMethod.showToastMessage("Not Supported",app_context); } }) - .addButton(strings.ABI_ERROR_BT_2, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + .addButton(app_context.getString(R.string.ABI_ERROR_BT_2), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.PLAYSTORE_URL)); if(browserIntent.resolveActivity(app_context.getPackageManager()) != null) @@ -133,7 +132,7 @@ class messageManager } }) /* - .addButton(strings.ABI_ERROR_BT_3, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + .addButton(app_context.getString(R.string.ABI_ERROR_BT_3, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> { event.invokeObserver(null, enums.etype.ignore_abi); tempDialog.dismiss(); @@ -145,28 +144,52 @@ class messageManager private void ratedSuccessfully() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) - .setTitle(strings.RATE_SUCCESS_TITLE) + .setTitle(app_context.getString(R.string.RATE_SUCCESS_TITLE)) .onDismissListener(dialog -> is_popup_open = false) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) - .setMessage(strings.RATE_SUCCESS_DESC) - .addButton(strings.RATE_SUCCESS_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + .setMessage(app_context.getString(R.string.RATE_SUCCESS_DESC)) + .addButton(app_context.getString(R.string.RATE_SUCCESS_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> { - helperMethod.sendRateEmail(app_context); tempDialog.dismiss(); + onFinish(); + final Handler handler = new Handler(); + Runnable runnable = () -> + { + try{ + helperMethod.sendRateEmail(app_context); + } + catch (Exception ex){ + createMessage(app_context,Collections.singletonList(app_context.getString(R.string.NOT_SUPPORTED_MESSAGE)),enums.etype.on_not_support); + } + }; + handler.postDelayed(runnable, 250); }); } private void reportedSuccessfully() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) - .setTitle(strings.REPORT_SUCCESS_TITLE) + .setTitle(app_context.getString(R.string.REPORT_SUCCESS_TITLE)) .onDismissListener(dialog -> is_popup_open = false) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) - .setMessage(strings.REPORT_SUCCESS_DESC) - .addButton(strings.REPORT_SUCCESS_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> - tempDialog.dismiss()); + .setMessage(app_context.getString(R.string.REPORT_SUCCESS_DESC)) + .addButton(app_context.getString(R.string.REPORT_SUCCESS_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + onFinish()); + } + + private void notSupportMessage() + { + String message = data.get(0); + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(app_context.getString(R.string.NOT_SUPPORTED_TITLE)) + .onDismissListener(dialog -> is_popup_open = false) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(message) + .addButton(app_context.getString(R.string.NOT_SUPPORTED_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + onFinish()); } @SuppressLint("ResourceType") @@ -187,25 +210,25 @@ class messageManager .setHeaderView(input) .onDismissListener(dialog -> is_popup_open = false) .setMessage("Bookmark URL | " + data.get(0) + "\n") - .addButton(strings.BOOKMARK_URL_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + .addButton(app_context.getString(R.string.BOOKMARK_URL_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> { event.invokeObserver(Collections.singletonList(data.get(0).replace("genesis.onion","boogle.store")+"split"+input.getText().toString()), enums.etype.bookmark); - tempDialog.dismiss(); + onFinish(); }); } private void clearHistory() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) - .setTitle(strings.CLEAR_HISTORY_TITLE) + .setTitle(app_context.getString(R.string.CLEAR_HISTORY_TITLE)) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) .onDismissListener(dialog -> is_popup_open = false) - .setMessage(strings.CLEAR_HISTORY_DESC) - .addButton(strings.CLEAR_HISTORY_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + .setMessage(app_context.getString(R.string.CLEAR_HISTORY_DESC)) + .addButton(app_context.getString(R.string.CLEAR_HISTORY_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> { - tempDialog.dismiss(); + onFinish(); final Handler handler = new Handler(); Runnable runnable = () -> { @@ -219,14 +242,14 @@ class messageManager private void clearTabs() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) - .setTitle(strings.CLEAR_TAB_TITLE) + .setTitle(app_context.getString(R.string.CLEAR_TAB_TITLE)) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) .onDismissListener(dialog -> is_popup_open = false) - .setMessage(strings.CLEAR_TAB_DESC) - .addButton(strings.CLEAR_TAB_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + .setMessage(app_context.getString(R.string.CLEAR_TAB_DESC)) + .addButton(app_context.getString(R.string.CLEAR_TAB_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> { - tempDialog.dismiss(); + onFinish(); final Handler handler = new Handler(); Runnable runnable = () -> { @@ -240,30 +263,30 @@ class messageManager private void clearBookmark() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) - .setTitle(strings.clear_bookmark_title) + .setTitle(app_context.getString(R.string.clear_bookmark_title)) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) .onDismissListener(dialog -> is_popup_open = false) - .setMessage(strings.clear_bookmark_desc) - .addButton(strings.clear_bookmark_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + .setMessage(app_context.getString(R.string.clear_bookmark_desc)) + .addButton(app_context.getString(R.string.clear_bookmark_bt1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> { is_popup_open = false; event.invokeObserver(null, enums.etype.clear_bookmark); - tempDialog.dismiss(); + onFinish(); }); } private void reportURL() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) - .setTitle(strings.REPORT_URL_TITLE) + .setTitle(app_context.getString(R.string.REPORT_URL_TITLE)) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) .onDismissListener(dialog -> is_popup_open = false) - .setMessage(strings.REPORT_URL_DESC) - .addButton(strings.REPORT_URL_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + .setMessage(app_context.getString(R.string.REPORT_URL_DESC)) + .addButton(app_context.getString(R.string.REPORT_URL_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> { - tempDialog.dismiss(); + onFinish(); final Handler handler = new Handler(); Runnable runnable = () -> createMessage(app_context,Collections.singletonList(strings.EMPTY_STR), enums.etype.reported_success); @@ -277,12 +300,12 @@ class messageManager private void rateApp() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) - .setTitle(strings.RATE_TITLE) + .setTitle(app_context.getString(R.string.RATE_TITLE)) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha_v1)) .setTextColor(app_context.getResources().getColor(R.color.black)) .onDismissListener(dialog -> is_popup_open = false) - .setMessage(strings.RATE_MESSAGE) - .addButton(strings.RATE_POSITIVE, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + .setMessage(app_context.getString(R.string.RATE_MESSAGE)) + .addButton(app_context.getString(R.string.RATE_POSITIVE), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> { event.invokeObserver(null, enums.etype.app_rated); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine")); @@ -292,12 +315,12 @@ class messageManager }else { helperMethod.showToastMessage("Playstore Not Found",app_context); } - tempDialog.dismiss(); + onFinish(); }) - .addButton(strings.RATE_NEGATIVE, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + .addButton(app_context.getString(R.string.RATE_NEGATIVE), -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> { event.invokeObserver(null, enums.etype.app_rated); - tempDialog.dismiss(); + onFinish(); final Handler handler = new Handler(); handler.postDelayed(() -> createMessage(app_context,Collections.singletonList(strings.EMPTY_STR), enums.etype.rate_success), 1000); @@ -307,15 +330,15 @@ class messageManager private void downloadFile() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) - .setTitle(strings.DOWNLOAD_TITLE) + .setTitle(app_context.getString(R.string.DOWNLOAD_TITLE)) .onDismissListener(dialog -> is_popup_open = false) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) - .setMessage(strings.DOWNLOAD_MESSAGE + data.get(0)) - .addButton(strings.DOWNLOAD_POSITIVE, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) -> + .setMessage(app_context.getString(R.string.DOWNLOAD_MESSAGE) + data.get(0)) + .addButton(app_context.getString(R.string.DOWNLOAD_POSITIVE), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) -> { event.invokeObserver(null, enums.etype.download_file); - dialog.dismiss(); + onFinish(); }); } @@ -338,25 +361,25 @@ class messageManager .setTextColor(app_context.getResources().getColor(R.color.black)) .setMessage(title + f.getName().substring(0,size)+"...") .setTextGravity(Gravity.START) - .addButton(strings.LONG_URL_OPTION_4, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_OPTION_4), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.download_file_manual); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_OPTION_1, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_OPTION_1), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_new_tab); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_OPTION_2, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_OPTION_2), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_current_tab); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_OPTION_3, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_OPTION_3), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link); - dialog.dismiss(); + onFinish(); }); } @@ -375,30 +398,43 @@ class messageManager .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) .setMessage(title + data.get(0).substring(0,size)+"...") - .addButton(strings.LONG_URL_OPTION_1, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_OPTION_1), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_new_tab); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_OPTION_2, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_OPTION_2), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.open_link_current_tab); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_OPTION_3, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_OPTION_3), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.copy_link); - dialog.dismiss(); + onFinish(); }); } + private void onResetApp() + { + is_popup_open = true; + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(app_context.getString(R.string.ORBOT_CLEAR_TITLE)) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(app_context.getString(R.string.ORBOT_CLEAR_DESC)) + .onDismissListener(dialog -> is_popup_open = false) + .addButton(app_context.getString(R.string.ORBOT_CLEAR_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + onFinish()); + } + private void popupDownloadFull(){ String url = data.get(0); String file = data.get(1); String title = data.get(2); - String data_local = strings.LONG_URL_MESSAGE; + String data_local = app_context.getString(R.string.LONG_URL_MESSAGE); int size = url.length(); if(size>35){ @@ -424,40 +460,40 @@ class messageManager .setTextColor(app_context.getResources().getColor(R.color.black)) .setMessage(data_local) - .addButton(strings.LONG_URL_FULL_OPTION_1, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_1), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(url), enums.etype.open_link_new_tab); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_FULL_OPTION_2, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_2), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(url), enums.etype.open_link_current_tab); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_FULL_OPTION_3, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_3), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(url), enums.etype.copy_link); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_FULL_OPTION_7, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_7), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(file), enums.etype.download_file_manual); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_FULL_OPTION_4, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_4), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(file), enums.etype.open_link_new_tab); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_FULL_OPTION_5, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_5), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(file), enums.etype.open_link_current_tab); - dialog.dismiss(); + onFinish(); }) - .addButton(strings.LONG_URL_FULL_OPTION_6, -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.LONG_URL_FULL_OPTION_6), -1, Color.rgb(242,242,242 ), CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { event.invokeObserver(Collections.singletonList(file), enums.etype.copy_link); - dialog.dismiss(); + onFinish(); }); } @@ -465,15 +501,15 @@ class messageManager { is_popup_open = true; popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) - .setTitle(strings.ORBOT_INIT_TITLE) + .setTitle(app_context.getString(R.string.ORBOT_INIT_TITLE)) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) - .setMessage(strings.ORBOT_INIT_DESC) + .setMessage(app_context.getString(R.string.ORBOT_INIT_DESC)) .onDismissListener(dialog -> is_popup_open = false) - .addButton(strings.ORBOT_INIT_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> - tempDialog.dismiss()).addButton(strings.ORBOT_INIT_BT_2, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> + .addButton(app_context.getString(R.string.ORBOT_INIT_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> + onFinish()).addButton(app_context.getString(R.string.ORBOT_INIT_BT_2), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { - dialog.dismiss(); + onFinish(); final Handler handler = new Handler(); handler.postDelayed(() -> @@ -482,15 +518,41 @@ class messageManager }); } + private void sendBridgeMail() + { + popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) + .setTitle(app_context.getString(R.string.BRIDGE_MAIL_TITLE)) + .onDismissListener(dialog -> is_popup_open = false) + .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) + .setTextColor(app_context.getResources().getColor(R.color.black)) + .setMessage(app_context.getString(R.string.BRIDGE_MAIL_MESSAGE)) + .addButton(app_context.getString(R.string.BRIDGE_MAIL_POSITIVE), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (dialog, which) -> + { + onFinish(); + final Handler handler = new Handler(); + Runnable runnable = () -> + { + try + { + helperMethod.sendBridgeEmail(app_context); + onFinish(); + }catch (Exception ex){ + createMessage(app_context,Collections.singletonList(app_context.getString(R.string.NOT_SUPPORTED_MESSAGE)),enums.etype.on_not_support); + } + }; + handler.postDelayed(runnable, 250); + }); + } + private void versionWarning() { popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .onDismissListener(dialog -> is_popup_open = false) - .setTitle(strings.VERSION_TITLE) + .setTitle(app_context.getString(R.string.VERSION_TITLE)) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) - .setMessage(strings.VERSION_DESC) - .addButton(strings.VERSION_BT_1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> + .setMessage(app_context.getString(R.string.VERSION_DESC)) + .addButton(app_context.getString(R.string.VERSION_BT_1), -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.END, (tempDialog, which) -> { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.GENESIS_UPDATE_URL + data.get(0))); app_context.startActivity(browserIntent); @@ -499,13 +561,13 @@ class messageManager private void torBanned() { - isDialogDismissed = true; + /*isDialogDismissed = true; popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) - .setTitle(strings.BANNED_TITLE) + .setTitle(app_context.getString(R.string.BANNED_TITLE) .setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha)) .setTextColor(app_context.getResources().getColor(R.color.black)) - .setMessage(strings.BANNED_DESC) + .setMessage(app_context.getString(R.string.BANNED_DESC) .onDismissListener(dialog -> is_popup_open = false) .onDismissListener(dialog -> startHome()); @@ -521,9 +583,9 @@ class messageManager popup_instance.addButton(btn_text, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) -> { isDialogDismissed = false; - tempDialog.dismiss(); + onFinish(); event.invokeObserver(Collections.singletonList(!status.sGateway), enums.etype.connect_vpn); - }); + });*/ } private void startHome(){ @@ -534,9 +596,13 @@ class messageManager } void onReset(){ - if(dialog_main!=null && dialog_main.isShowing() && !app_context.isFinishing()){ + onFinish(); + dialog_main = null; + } + + private void onFinish(){ + if(dialog_main!=null && dialog_main.isShowing() && !app_context.isFinishing() && !app_context.isFinishing()){ dialog_main.dismiss(); - dialog_main = null; } } @@ -621,6 +687,14 @@ class messageManager case on_long_press_with_link: popupDownloadFull(); break; + + case on_bridge_mail: + sendBridgeMail(); + break; + + case on_not_support: + notSupportMessage(); + break; } dialog_main = popup_instance.show(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java index 63f9048a..38026139 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbotManager.java @@ -8,6 +8,8 @@ import androidx.appcompat.app.AppCompatActivity; import com.darkweb.genesissearchengine.constants.*; import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.helperManager.eventObserver; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + import org.mozilla.gecko.PrefsHelper; import org.torproject.android.service.TorService; import org.torproject.android.service.util.Prefs; @@ -35,8 +37,10 @@ class orbotManager } void startOrbot(Context context){ + orbotLocalConstants.bridges = status.sCustomBridge; + orbotLocalConstants.sIsManualBridge = status.sGatewayManual; this.mAppContext = context; - Prefs.putBridgesEnabled(status.sGateway); + Prefs.putBridgesEnabled(status.sGatewayManual|status.sGatewayAuto); Intent mServiceIntent = new Intent(context, TorService.class); mServiceIntent.setAction(ACTION_START); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { @@ -68,14 +72,6 @@ class orbotManager /*------------------------------------------------------- POST TASK HANDLER -------------------------------------------------------*/ - void onClose(){ - if(mAppContext!=null){ - disableTorNotification(); - //Intent intent = new Intent(orbotLocalConstants.sHomeContext, TorService.class); - //mAppContext.getApplicationContext().stopService(intent); - } - } - void setProxy(String url){ if(url.contains("boogle.store")){ PrefsHelper.setPref(keys.PROXY_TYPE, 0); @@ -109,7 +105,6 @@ class orbotManager PrefsHelper.setPref(keys.PROXY_CACHE,constants.PROXY_CACHE); PrefsHelper.setPref(keys.PROXY_MEMORY,constants.PROXY_MEMORY); - PrefsHelper.setPref(keys.PROXY_USER_AGENT_OVERRIDE, constants.PROXY_USER_AGENT_OVERRIDE); PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_ENABLED,constants.PROXY_DO_NOT_TRACK_HEADER_ENABLED); PrefsHelper.setPref(keys.PROXY_DO_NOT_TRACK_HEADER_VALUE,constants.PROXY_DO_NOT_TRACK_HEADER_VALUE); @@ -124,8 +119,8 @@ class orbotManager { PrefsHelper.setPref("browser.cache.disk.enable",false); PrefsHelper.setPref("browser.cache.memory.enable",true); - PrefsHelper.setPref(keys.PROXY_USER_AGENT_OVERRIDE, constants.PROXY_USER_AGENT_OVERRIDE); PrefsHelper.setPref("browser.cache.disk.capacity",0); + PrefsHelper.setPref("privacy.resistFingerprinting",true); PrefsHelper.setPref("privacy.clearOnShutdown.cache",status.sHistoryStatus); PrefsHelper.setPref("privacy.clearOnShutdown.downloads",status.sHistoryStatus); PrefsHelper.setPref("privacy.clearOnShutdown.formdata",status.sHistoryStatus); @@ -153,7 +148,9 @@ class orbotManager mLogsStarted = true; } else { - logs = logs.replace("(","").replace(":","_FERROR_").replace("NOTICE","").replace(")",""); + logs = logs.replaceAll("[^a-zA-Z0-9%\\s+]", ""); + logs = helperMethod.capitalizeString(logs); + logs = logs.replace("(","").replace(":","_FERROR_").replace("NOTICE","").replace(")","").replace("_FERROR_",""); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java index 527e2ccb..fd798367 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java @@ -202,7 +202,7 @@ public class pluginController dataController.getInstance().setBool(keys.IS_WELCOME_ENABLED,false); } else if(event_type.equals(enums.etype.ignore_abi)){ - mHomeController.ignoreAbiError(); + //mHomeController.ignoreAbiError(); } else if(event_type.equals(enums.etype.reload)){ if(orbotManager.getInstance().isOrbotRunning()) @@ -215,7 +215,6 @@ public class pluginController } else if(event_type.equals(enums.etype.clear_history)){ dataController.getInstance().clearHistory(); - dataController.getInstance().clearSuggestions(); mContextManager.getHistoryController().onclearData(); mHomeController.onClearSession(); dataController.getInstance().clearTabs(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/securityManager/securityController.java b/app/src/main/java/com/darkweb/genesissearchengine/securityManager/securityController.java new file mode 100755 index 00000000..ba199565 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/securityManager/securityController.java @@ -0,0 +1,16 @@ +package com.darkweb.genesissearchengine.securityManager; + +public class securityController +{ + private static final securityController ourInstance = new securityController(); + + public static securityController getInstance() + { + return ourInstance; + } + + private securityController() + { + + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/widget/DrawableWrapper.java b/app/src/main/java/com/darkweb/genesissearchengine/widget/DrawableWrapper.java index ceec188d..a953f8cc 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/widget/DrawableWrapper.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/widget/DrawableWrapper.java @@ -7,6 +7,9 @@ import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.Region; import android.graphics.drawable.Drawable; +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.AttributeSet; import org.xmlpull.v1.XmlPullParser; @@ -14,10 +17,6 @@ import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; -import androidx.annotation.IntRange; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - /** * DrawableWrapper was added since API Level 23. But in v7 support library, it has annotation * "@RestrictTo(LIBRARY_GROUP)". Hence we should not extends it, so we create this wrapper for now. @@ -48,7 +47,7 @@ public class DrawableWrapper extends Drawable { } @Override - public ConstantState getConstantState() { + public Drawable.ConstantState getConstantState() { return mWrapped.getConstantState(); } @@ -99,7 +98,7 @@ public class DrawableWrapper extends Drawable { @Override public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs) - throws XmlPullParserException, IOException { + throws XmlPullParserException, IOException { mWrapped.inflate(r, parser, attrs); } @@ -172,4 +171,4 @@ public class DrawableWrapper extends Drawable { protected boolean onStateChange(int[] state) { return mWrapped.setState(state); } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/widget/ShiftDrawable.java b/app/src/main/java/com/darkweb/genesissearchengine/widget/ShiftDrawable.java index 42110057..7182538b 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/widget/ShiftDrawable.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/widget/ShiftDrawable.java @@ -6,11 +6,10 @@ import android.graphics.Canvas; import android.graphics.Path; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.view.animation.Interpolator; -import android.view.animation.LinearInterpolator; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import android.view.animation.Interpolator; +import android.view.animation.LinearInterpolator; public class ShiftDrawable extends DrawableWrapper { @@ -104,7 +103,7 @@ public class ShiftDrawable extends DrawableWrapper { private void updateBounds() { final Rect b = getBounds(); final int width = (int) ((float) b.width() * getLevel() / MAX_LEVEL); - final float radius = b.height() / 2.5f; + final float radius = b.height() / 2f; mVisibleRect.set(b.left, b.top, b.left + width, b.height()); // draw round to head of progressbar. I know it looks stupid, don't blame me now. @@ -112,4 +111,4 @@ public class ShiftDrawable extends DrawableWrapper { mPath.addRect(b.left, b.top, b.left + width - radius, b.height(), Path.Direction.CCW); mPath.addCircle(b.left + width - radius, radius, radius, Path.Direction.CCW); } -} +} \ No newline at end of file diff --git a/app/src/main/res/anim/slide_in.xml b/app/src/main/res/anim/slide_in.xml new file mode 100755 index 00000000..6c1c77c0 --- /dev/null +++ b/app/src/main/res/anim/slide_in.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/app/src/main/res/anim/slide_out.xml b/app/src/main/res/anim/slide_out.xml new file mode 100755 index 00000000..cb528378 --- /dev/null +++ b/app/src/main/res/anim/slide_out.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/duck_logo.png b/app/src/main/res/drawable-hdpi/duck_logo.png old mode 100644 new mode 100755 diff --git a/app/src/main/res/drawable-hdpi/genesis_logo.png b/app/src/main/res/drawable-hdpi/genesis_logo.png old mode 100644 new mode 100755 diff --git a/app/src/main/res/drawable-hdpi/google_logo.png b/app/src/main/res/drawable-hdpi/google_logo.png old mode 100644 new mode 100755 diff --git a/app/src/main/res/drawable-hdpi/screen_0.png b/app/src/main/res/drawable-hdpi/screen_0.png new file mode 100755 index 00000000..227f02eb Binary files /dev/null and b/app/src/main/res/drawable-hdpi/screen_0.png differ diff --git a/app/src/main/res/drawable-hdpi/screen_1.png b/app/src/main/res/drawable-hdpi/screen_1.png new file mode 100755 index 00000000..31387635 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/screen_1.png differ diff --git a/app/src/main/res/drawable-hdpi/screen_2.png b/app/src/main/res/drawable-hdpi/screen_2.png new file mode 100755 index 00000000..ff36fc6e Binary files /dev/null and b/app/src/main/res/drawable-hdpi/screen_2.png differ diff --git a/app/src/main/res/drawable-hdpi/screen_3.png b/app/src/main/res/drawable-hdpi/screen_3.png new file mode 100755 index 00000000..59e2ed21 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/screen_3.png differ diff --git a/app/src/main/res/drawable-hdpi/screen_4.png b/app/src/main/res/drawable-hdpi/screen_4.png new file mode 100755 index 00000000..bb36f964 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/screen_4.png differ diff --git a/app/src/main/res/drawable-hdpi/screen_text_0.png b/app/src/main/res/drawable-hdpi/screen_text_0.png new file mode 100755 index 00000000..d496ee99 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/screen_text_0.png differ diff --git a/app/src/main/res/layout/bridge_settings_view.xml b/app/src/main/res/layout/bridge_settings_view.xml new file mode 100755 index 00000000..bfc89225 --- /dev/null +++ b/app/src/main/res/layout/bridge_settings_view.xml @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +