Bug Fixes

master
msmannan00 2020-11-11 17:11:13 +05:00
parent 31192667e5
commit 19f96483f2
335 changed files with 44837 additions and 3799 deletions

View File

@ -11,7 +11,15 @@
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/Application" />
<option value="$PROJECT_DIR$/afservice" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/autofillLib" />
<option value="$PROJECT_DIR$/autofillManager" />
<option value="$PROJECT_DIR$/autofillServer" />
<option value="$PROJECT_DIR$/autofillService" />
<option value="$PROJECT_DIR$/autofillServices" />
<option value="$PROJECT_DIR$/chromiumTabs" />
<option value="$PROJECT_DIR$/orbotservice" />
</set>
</option>

View File

@ -1,8 +1,21 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintPxUsage" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintSuspiciousImport" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BusyWait" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EmptyStatementBody" enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_reportEmptyBlocks" value="true" />
</inspection_tool>
<inspection_tool class="FieldCanBeLocal" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="FieldMayBeFinal" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="IfStatementWithIdenticalBranches" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="IgnoreResultOfCall" enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_reportAllNonLibraryCalls" value="false" />
<option name="callCheckString" value="java.io.File,.*,java.io.InputStream,read|skip|available|markSupported,java.io.Reader,read|skip|ready|markSupported,java.lang.Boolean,.*,java.lang.Byte,.*,java.lang.Character,.*,java.lang.Double,.*,java.lang.Float,.*,java.lang.Integer,.*,java.lang.Long,.*,java.lang.Math,.*,java.lang.Object,equals|hashCode|toString,java.lang.Short,.*,java.lang.StrictMath,.*,java.lang.String,.*,java.lang.Thread,interrupted,java.math.BigInteger,.*,java.math.BigDecimal,.*,java.net.InetAddress,.*,java.net.URI,.*,java.util.Arrays,.*,java.util.List,of,java.util.Set,of,java.util.Map,of|ofEntries|entry,java.util.Collections,(?!addAll).*,java.util.UUID,.*,java.util.regex.Matcher,pattern|toMatchResult|start|end|group|groupCount|matches|find|lookingAt|quoteReplacement|replaceAll|replaceFirst|regionStart|regionEnd|hasTransparentBounds|hasAnchoringBounds|hitEnd|requireEnd,java.util.regex.Pattern,.*,java.util.stream.BaseStream,.*" />
</inspection_tool>
<inspection_tool class="InfiniteLoopStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InnerClassMayBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SameParameterValue" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
@ -13,5 +26,6 @@
<inspection_tool class="SuspiciousListRemoveInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TrivialIf" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UNCHECKED_WARNING" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnusedReturnValue" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -21,11 +21,12 @@ repositories {
android {
compileSdkVersion project.ext.compileSdkVersion
ndkVersion "21.3.6528147"
defaultConfig {
applicationId project.ext.applicationId
minSdkVersion project.ext.minSdkVersion
// targetSdkVersion project.ext.targetSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionCode project.ext.versionCode
versionName project.ext.versionName
}
@ -74,8 +75,10 @@ android {
res.srcDirs =
[
'src/main/res/layouts/history',
'src/main/res/layouts/tab',
'src/main/res/layouts/language',
'src/main/res/layouts/orbot',
'src/main/res/layouts/orbotLog',
'src/main/res/layouts/setting',
'src/main/res/layouts/bridge',
'src/main/res/layouts/alert',
@ -84,6 +87,7 @@ android {
'src/main/res/layouts/shared/listviews',
'src/main/res/layouts/other',
'src/main/res/custom-xml/alert',
'src/main/res/custom-xml/tab',
'src/main/res/custom-xml/images',
'src/main/res/custom-xml/bookmark',
'src/main/res/custom-xml/generic',
@ -91,6 +95,7 @@ android {
'src/main/res/custom-xml/home',
'src/main/res/custom-xml/landing',
'src/main/res/custom-xml/orbot',
'src/main/res/custom-xml/orbot_log',
'src/main/res/custom-xml/setting',
'src/main/res/layouts',
'src/main/res/images',
@ -124,6 +129,7 @@ dependencies {
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
// Testing-only dependencies
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0') {
@ -149,7 +155,7 @@ dependencies {
implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'
/*Ads Manager*/
implementation 'com.google.android.gms:play-services-ads:19.4.0'
implementation 'com.google.android.gms:play-services-ads:19.5.0'
/*Crashlytics*/
@ -163,9 +169,11 @@ dependencies {
implementation project(path: ':orbotservice')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.github.apl-devs:appintro:v4.2.2'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
/*Helper Libraries*/
implementation 'com.chauthai.overscroll:overscroll-bouncy:0.1.1'
androidTestImplementation "junit:junit:4.13.1"
}
apply plugin: 'com.android.application'

View File

@ -28,58 +28,89 @@
<!-- Activities -->
<activity
android:name="com.darkweb.genesissearchengine.appManager.orbotManager.orbotController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTop" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:label="@string/SETTING_HEADER"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.historyManager.historyController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.languageManager.languageController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:label="@string/SETTING_HEADER"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:label="@string/SETTING_HEADER"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.settingManager.clearManager.settingClearController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:label="@string/SETTING_HEADER"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.settingManager.privacyManager.settingPrivacyController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController"
android:configChanges="uiMode"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController"
android:configChanges="uiMode"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.tabManager.tabController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.landingManager.landingController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.homeManager.homeController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize">
@ -151,6 +182,15 @@
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-5074525529134731~2926711128" />
<service
android:name="com.darkweb.genesissearchengine.helperManager.autoFillService"
android:label="Genesis | Secure Autofill"
android:permission="android.permission.BIND_AUTOFILL_SERVICE">
<intent-filter>
<action android:name="android.service.autofill.AutofillService" />
</intent-filter>
</service>
<service
android:name="com.darkweb.genesissearchengine.helperManager.downloadFileService"
android:enabled="true"

View File

@ -0,0 +1,11 @@
<html>
<head>
<title>
A Simple HTML Document
</title>
</head>
<body>
<p>This is a very simple HTML document</p>
<p>It only has two paragraphs</p>
</body>
</html>

View File

@ -3,6 +3,8 @@ package com.darkweb.genesissearchengine.appManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyController;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController;
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController;
import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
public class activityContextManager
@ -16,11 +18,13 @@ public class activityContextManager
}
/*Private Contexts*/
private historyController history_controller;
private bookmarkController bookmark_controller;
private homeController home_controller;
private tabController tab_controller;
private android.app.Activity sCurrentActivity = null;
private historyController pHistoryController;
private bookmarkController pBookmarkController;
private homeController pHomeController;
private tabController pTabController;
private android.app.Activity pCurrentActivity = null;
private settingController pSettingController;
private orbotLogController pOrbotLogController;
/*Initialization*/
@ -30,37 +34,51 @@ public class activityContextManager
/*List ContextGetterSetters*/
public historyController getHistoryController(){
return history_controller;
return pHistoryController;
}
public void setHistoryController(historyController history_controller){
this.history_controller = history_controller;
this.pHistoryController = history_controller;
}
public bookmarkController getBookmarkController(){
return bookmark_controller;
return pBookmarkController;
}
public void setBookmarkController(bookmarkController bookmark_controller){
this.bookmark_controller = bookmark_controller;
this.pBookmarkController = bookmark_controller;
}
public homeController getHomeController(){
return home_controller;
return pHomeController;
}
public void setHomeController(homeController home_controller){
this.home_controller = home_controller;
this.pHomeController = home_controller;
}
public tabController getTabController(){
return tab_controller;
return pTabController;
}
public void setTabController(tabController tab_controller){
this.tab_controller = tab_controller;
this.pTabController = tab_controller;
}
public void setCurrentActivity(android.app.Activity sCurrentActivity){
this.sCurrentActivity = sCurrentActivity;
public orbotLogController getOrbotLogController(){
return pOrbotLogController;
}
public void setOrbotLogController(orbotLogController pOrbotLogController){
this.pOrbotLogController = pOrbotLogController;
}
public settingController getSettingController(){
return pSettingController;
}
public void setSettingController(settingController pSettingController){
this.pSettingController = pSettingController;
}
public void setCurrentActivity(android.app.Activity pCurrentActivity){
this.pCurrentActivity = pCurrentActivity;
}
public android.app.Activity setCurrentActivity(){
return sCurrentActivity;
return pCurrentActivity;
}
}

View File

@ -14,7 +14,6 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
@ -28,6 +27,7 @@ import java.util.Date;
import java.util.List;
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
import static com.darkweb.genesissearchengine.constants.constants.HISTORY_LOAD_MORE;
public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listViewHolder>
{
@ -41,7 +41,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
private ArrayList<Date> mLongSelectedDate = new ArrayList<>();
private ArrayList<String> mLongSelectedIndex = new ArrayList<>();
private ArrayList<Integer> mLongSelectedID = new ArrayList<>();
private ArrayList<View> mLongPressedViewHolders = new ArrayList<>();
private AppCompatActivity mContext;
private bookmarkAdapterView mHistroyAdapterView;
@ -70,15 +69,14 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
private void onLoading(){
mContext.runOnUiThread(() -> {
mCurrentList.add(new bookmarkRowModel(null, "loading",-2));
mCurrentList.add(new bookmarkRowModel(HISTORY_LOAD_MORE,null,-2));
notifyItemInserted(mCurrentList.size());
});
}
private void onLoadingClear(){
for(int mCounter = 0; mCounter< mCurrentList.size(); mCounter++){
if(mCurrentList.get(mCounter).getHeader().equals("loading")){
if(mCurrentList.get(mCounter).getHeader().equals(HISTORY_LOAD_MORE)){
int finalM_counter = mCounter;
mContext.runOnUiThread(() -> {
mCurrentList.remove(finalM_counter);
@ -121,7 +119,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
if(diff==0){
if(m_date_state!=1){
this.mModelList.add(new bookmarkRowModel(null, "Today ",-1));
this.mModelList.add(new bookmarkRowModel("Today ",null,-1));
mRealID.add(m_real_counter);
mRealIndex.add(m_real_counter);
m_date_state = 1;
@ -130,14 +128,14 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
if(m_date_state!=2 || m_last_day!=(int)(Math.ceil(diff/7)*7)){
m_last_day = (int)(Math.ceil(diff/7)*7);
this.mModelList.add(new bookmarkRowModel(null, "Last " + m_last_day + " Days",-1));
this.mModelList.add(new bookmarkRowModel("Last " + m_last_day + " Days",null,-1));
mRealID.add(m_real_counter);
mRealIndex.add(m_real_counter);
m_date_state = 2;
}
}else {
if(m_date_state!=3){
this.mModelList.add(new bookmarkRowModel(null, "Older ",-1));
this.mModelList.add(new bookmarkRowModel("Older ",null,-1));
mRealID.add(m_real_counter);
mRealIndex.add(m_real_counter);
m_date_state = 3;
@ -154,22 +152,21 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
/*Initializations*/
private ArrayList<String> getLongSelectedURL(){
private ArrayList<String> getLongSelectedleURL(){
return mLongSelectedIndex;
}
public void onDeleteSelected(){
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
for(int m_counter_inner = 0; m_counter_inner< mCurrentList.size(); m_counter_inner++){
if(mCurrentList.get(m_counter_inner).getDate() == mLongSelectedDate.get(m_counter) && mLongSelectedIndex.get(m_counter).equals(mCurrentList.get(m_counter_inner).getDescription())){
if(mCurrentList.get(m_counter_inner).getDate() == mLongSelectedDate.get(m_counter) && mLongSelectedIndex.get(m_counter).equals("https://"+ mCurrentList.get(m_counter_inner).getDescription())){
mEvent.invokeObserver(Collections.singletonList(mRealIndex.get(m_counter_inner)),enums.etype.url_clear);
mEvent.invokeObserver(Collections.singletonList(mLongSelectedID.get(m_counter)),enums.etype.url_clear_at);
invokeFilter(false);
mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.is_empty);
boolean mDateVerify = false;
initializeModelWithDate(false);
if(mCurrentList.size()>0 && mCurrentList.get(m_counter_inner-1).getHeader()==null && (mCurrentList.size()>m_counter_inner+1 && mCurrentList.get(m_counter_inner+1).getHeader()==null || mCurrentList.size()==m_counter_inner+1)){
if(mCurrentList.size()>0 && mCurrentList.get(m_counter_inner-1).getDescription()==null && (mCurrentList.size()>m_counter_inner+1 && mCurrentList.get(m_counter_inner+1).getDescription()==null || mCurrentList.size()==m_counter_inner+1)){
mDateVerify = true;
}
@ -197,18 +194,10 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
}
private void clearLongSelectedURL(){
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
View m_item_view = mLongPressedViewHolders.get(m_counter);
ImageButton m_popup_menu = m_item_view.findViewById(R.id.pRowMenu);
ImageView p_logo_image = m_item_view.findViewById(R.id.pLogoImage);
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW, Arrays.asList(m_popup_menu, p_logo_image, m_item_view));
}
mLongSelectedDate.clear();
mLongSelectedIndex.clear();
mLongSelectedID.clear();
mLongPressedViewHolders.clear();
notifyDataSetChanged();
}
private String getSelectedURL(){
@ -247,7 +236,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mSearchEnabled = p_is_searched;
}
public void onSelectView(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){
public void onSelectView(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){
if(!mSearchEnabled){
try {
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced, true));
@ -261,7 +250,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mLongSelectedDate.add(pDate);
mLongSelectedIndex.add(pUrl);
mLongSelectedID.add(pId);
mLongPressedViewHolders.add(pItem);
}
onVerifyLongSelectedURL();
@ -276,14 +264,13 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
}
}
public void onClearHighlight(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate)
public void onClearHighlight(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate)
{
try {
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced));
mLongSelectedDate.remove(pDate);
mLongSelectedIndex.remove(pUrl);
mLongSelectedID.remove((Integer) pId);
mLongPressedViewHolders.remove(pItem);
if(mLongSelectedID.size()==0){
notifyDataSetChanged();
}
@ -295,7 +282,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
private float mPointerPosition = 0;
@SuppressLint("ClickableViewAccessibility")
public void onSwipe(View pItem, View pItemView, int pPosition, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){
public void onSwipe(View pItemView, int pPosition, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){
Handler handler = new Handler();
@ -303,9 +290,10 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
if(!mDisableCallable && Math.abs(mRecyclerPositionX1-mPointerPosition) <= 20){
if(!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
mLongPressedMenuActive = true;
onSelectView(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
onSelectView(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
}else {
onClearHighlight(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
Log.i("I AM HERE 22","I AM HERE");
onClearHighlight(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
mLongPressedMenuActive = true;
}
}else {
@ -329,6 +317,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
notifyItemRangeChanged(0, 1);
mEvent.invokeObserver(Collections.singletonList(0),enums.etype.is_empty);
}else {
initializeModelWithDate(false);
bookmarkAdapter.this.onClose(pPosition);
}
return true;
@ -339,14 +328,15 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mRecyclerPositionX2 = event.getX();
float deltaX = mRecyclerPositionX2 - mRecyclerPositionX1;
Log.i("FCK2","FCK2 : " + mLongSelectedIndex.size());
if (mLongSelectedIndex.size() > 0) {
if (Math.abs(deltaX) <= 20 && !mLongPressedMenuActive) {
if (mLongSelectedIndex.contains(pUrl) && mLongSelectedID.contains(pId)) {
handler.removeCallbacks(mLongPressed);
bookmarkAdapter.this.onClearHighlight(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
bookmarkAdapter.this.onClearHighlight(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
} else{
handler.removeCallbacks(mLongPressed);
bookmarkAdapter.this.onSelectView(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
bookmarkAdapter.this.onSelectView(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
}
}
return false;
@ -417,16 +407,17 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mPopupWindow.dismiss();
}
else if(v.getId() == R.id.pMenuDelete){
initializeModelWithDate(false);
onClose(pPosition);
mPopupWindow.dismiss();
}
});
}
private void setItemViewOnClickListener(View pItem, View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate)
private void setItemViewOnClickListener(View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate)
{
pItemMenu.setOnClickListener((View v) -> onOpenMenu(v, pUrl, pPosition, pTitle));
onSwipe(pItem, pItemView, pPosition, pUrl,pMenuItem, pLogoImage, pId, pDate);
onSwipe(pItemView, pPosition, pUrl,pMenuItem, pLogoImage, pId, pDate);
}
private void onClose(int pIndex){
@ -436,7 +427,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mEvent.invokeObserver(Collections.singletonList(mRealID.get(pIndex)),enums.etype.is_empty);
boolean mDateVerify = false;
if(mPassedList.size()>0){
if(mCurrentList.size()>0 && mCurrentList.get(pIndex-1).getHeader()==null && (mCurrentList.size()>pIndex+1 && mCurrentList.get(pIndex+1).getHeader()==null || mCurrentList.size()==pIndex+1)){
if(mCurrentList.size()>0 && mCurrentList.get(pIndex-1).getDescription()==null && (mCurrentList.size()>pIndex+1 && mCurrentList.get(pIndex+1).getDescription()==null || mCurrentList.size()==pIndex+1)){
mDateVerify = true;
}
}else {
@ -504,18 +495,20 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
if(model.getID() == -1){
mDate.setText(model.getDescription());
mDate.setText(model.getHeader());
mDateContainer.setVisibility(View.VISIBLE);
mRowContainer.setVisibility(View.GONE);
mRowMenu.setVisibility(View.GONE);
mRowMenu.setVisibility(View.INVISIBLE);
mRowMenu.setClickable(false);
mWebLogo.setVisibility(View.GONE);
mLoadingContainer.setVisibility(View.GONE);
}
else if(model.getID() == -2){
mDate.setText(model.getDescription());
mDate.setText(model.getHeader());
mDateContainer.setVisibility(View.GONE);
mRowContainer.setVisibility(View.GONE);
mRowMenu.setVisibility(View.GONE);
mRowMenu.setVisibility(View.INVISIBLE);
mRowMenu.setClickable(false);
mWebLogo.setVisibility(View.GONE);
mLoadingContainer.setVisibility(View.VISIBLE);
}
@ -524,24 +517,26 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mLoadingContainer.setVisibility(View.GONE);
mRowContainer.setVisibility(View.VISIBLE);
mRowMenu.setVisibility(View.VISIBLE);
mRowMenu.setClickable(true);
mWebLogo.setVisibility(View.VISIBLE);
mWebLogo.setText((helperMethod.getDomainName(model.getDescription()).toUpperCase().charAt(0)+""));
mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0)+""));
String header = model.getHeader();
mDescription.setText((model.getDescription()));
mDescription.setText(("https://"+model.getDescription()));
mHeader.setText(model.getHeader());
setItemViewOnClickListener(itemView, mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate());
setItemViewOnClickListener(mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate());
}
if(mLongSelectedID.size()>0){
mRowMenu.setVisibility(View.GONE);
mRowMenu.setVisibility(View.INVISIBLE);
mRowMenu.setClickable(false);
}else {
mRowMenu.setVisibility(View.VISIBLE);
mRowMenu.setClickable(true);
}
if(mLongSelectedIndex.contains(model.getDescription()) && mLongSelectedID.contains(model.getID())){
if(mLongSelectedIndex.contains("https://" + model.getDescription()) && mLongSelectedID.contains(model.getID())){
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false));
}else if(mLogoImage.getAlpha()>0){
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(bookmarkEnums.eBookmarkViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(mRowContainer, mRowMenu, mLogoImage, true, false));
@ -582,7 +577,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
clearLongSelectedURL();
}
else if(pCommands == bookmarkEnums.eBookmarkAdapterCommands.GET_LONG_SELECTED_URL){
return getLongSelectedURL();
return getLongSelectedleURL();
}
return null;
}

View File

@ -9,7 +9,6 @@ import android.widget.ImageView;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.List;

View File

@ -18,7 +18,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
@ -37,7 +36,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU;
import static com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU;
public class bookmarkController extends AppCompatActivity

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.appManager.historyManager;
package com.darkweb.genesissearchengine.appManager.bookmarkManager;
public class bookmarkEnums
{

View File

@ -12,10 +12,11 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.historyManager.bookmarkEnums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
@ -57,24 +58,26 @@ class bookmarkViewController
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));
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
}
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));
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void updateIfListEmpty(int pSize,int pDuration){
if(pSize>0){
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
mEmptyListNotification.animate().setDuration(pDuration).alpha(0f);
mClearButton.setText(strings.BOOKMARK_CLEAR_BOOKMARK);
mClearButton.setClickable(true);
}
else {
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mEmptyListNotification.animate().setDuration(pDuration).alpha(1f);
mClearButton.animate().setDuration(pDuration).alpha(0.4f);
@ -82,10 +85,13 @@ class bookmarkViewController
mMenuButton.animate().setDuration(pDuration).alpha(0f);
mClearButton.setEnabled(false);
mClearButton.setClickable(false);
mSearchButton.setClickable(false);
mMenuButton.setClickable(false);
mSearchInput.setVisibility(View.GONE);
mClearButton.setAlpha(0f);
mClearButton.animate().setDuration(300).alpha(1);
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mClearButton.setText(strings.BOOKMARK_NO_BOOKMARK_FOUND);
mClearButton.setClickable(false);
}
@ -95,14 +101,15 @@ class bookmarkViewController
if(mPopupWindow !=null && mPopupWindow.isShowing()){
mPopupWindow.dismiss();
}
onSelectionMenu(true);
}
private void onSelectionMenu(boolean pStatus){
if(!pStatus){
mClearButton.setClickable(false);
mClearButton.animate().cancel();
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
mClearButton.animate().setDuration(150).alpha(0.4f);
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mClearButton.animate().setDuration(200).alpha(0.4f);
mMenuButton.setVisibility(View.VISIBLE);
mSearchButton.setVisibility(View.GONE);
if (mSearchInput.getVisibility() == View.VISIBLE){
@ -111,9 +118,9 @@ class bookmarkViewController
}else {
if (mSearchInput.getVisibility() != View.VISIBLE) {
mClearButton.setClickable(true);
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
mClearButton.animate().cancel();
mClearButton.animate().setDuration(150).alpha(1);
mClearButton.animate().setDuration(200).alpha(1);
}
mMenuButton.setVisibility(View.GONE);
mSearchButton.setVisibility(View.VISIBLE);
@ -123,7 +130,6 @@ class bookmarkViewController
}
private void updateList(){
int index = Objects.requireNonNull(mRecycleView.getAdapter()).getItemCount()-1;
mRecycleView.getAdapter().notifyDataSetChanged();
}
@ -138,6 +144,7 @@ class bookmarkViewController
updateIfListEmpty(mRecycleView.getAdapter().getItemCount(),300);
mSearchInput.clearFocus();
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
}
private boolean onHideSearch() {
@ -151,7 +158,7 @@ class bookmarkViewController
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
mSearchInput.setClickable(false);
mClearButton.setClickable(true);
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
mClearButton.animate().cancel();
mClearButton.animate().setDuration(150).alpha(1f);
return false;
@ -163,7 +170,7 @@ class bookmarkViewController
mSearchInput.setClickable(true);
mClearButton.setClickable(false);
mSearchInput.requestFocus();
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mClearButton.animate().cancel();
mClearButton.animate().setDuration(150).alpha(0.4f);
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);

View File

@ -1,33 +1,42 @@
package com.darkweb.genesissearchengine.appManager.bridgeManager;
import android.content.Context;
import android.graphics.Rect;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.historyManager.historyAdapter;
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.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class bridgeController extends AppCompatActivity {
/*Private Variables*/
private bridgeModel mBridgeModel;
private bridgeViewController mBridgeViewController;
private RadioButton mBridgeObfs;
private RadioButton mBridgeChina;
private RadioButton mBridgeCustom;
@ -63,11 +72,18 @@ public class bridgeController extends AppCompatActivity {
mCustomBridgeBlocker = findViewById(R.id.pCustomBridgeBlocker);
mBridgeViewController.initialization(mCustomPort, mBridgeButton,this, mBridgeObfs, mBridgeChina, mBridgeCustom, mCustomBridgeBlocker);
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,0));
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,0));
mBridgeModel = new bridgeModel(new bridgeController.bridgeModelCallback(), this);
}
private void initializeLocalEventHandlers()
{
mCustomPort.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
helperMethod.hideKeyboard(this);
}
});
mCustomPort.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2)
@ -86,6 +102,18 @@ public class bridgeController extends AppCompatActivity {
});
}
/* LISTENERS */
public class bridgeModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
protected void onPause()
{
@ -109,30 +137,28 @@ public class bridgeController extends AppCompatActivity {
finish();
}
/*Helper Method*/
public void onClose(View view){
finish();
}
/*Helper Method*/
public void requestBridges(View view){
mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_REQUEST_BRIDGE, null);
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL), enums.etype.on_bridge_mail);
}
public void onCustomChecked(View view){
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_CUSTOM;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_CUSTOM_BRIDGE, null);
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
}
public void onMeekChecked(View view){
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_MEEK_BRIDGE, null);
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
}
public void onObfsChecked(View view){
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_MEEK;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_OBFS_CHECK, null);
mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250));
}
}

View File

@ -4,6 +4,11 @@ public class bridgeEnums
{
/*Settings Manager*/
public enum eBridgeViewCommands {
S_INIT_VIEWS
M_INIT_VIEWS
}
public enum eBridgeModelCommands {
M_REQUEST_BRIDGE, M_CUSTOM_BRIDGE, M_MEEK_BRIDGE, M_OBFS_CHECK
}
}

View File

@ -0,0 +1,69 @@
package com.darkweb.genesissearchengine.appManager.bridgeManager;
import androidx.appcompat.app.AppCompatActivity;
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.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
class bridgeModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
/*Initializations*/
bridgeModel(eventObserver.eventListener mEvent, AppCompatActivity pContext){
this.mEvent = mEvent;
mContext = pContext;
}
/*Helper Methods*/
public void requestBridges(){
pluginController.getInstance().MessageManagerHandler(mContext, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL), enums.etype.on_bridge_mail);
}
public void onCustomChecked(){
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_CUSTOM;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
}
public void onMeekChecked(){
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_MEEK;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
}
public void onObfsChecked(){
status.sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,status.sBridgeCustomBridge));
}
public void onTrigger(bridgeEnums.eBridgeModelCommands pCommands, List<Object> pData){
if(pCommands == bridgeEnums.eBridgeModelCommands.M_REQUEST_BRIDGE){
requestBridges();
}
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_CUSTOM_BRIDGE){
onCustomChecked();
}
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_MEEK_BRIDGE){
onMeekChecked();
}
else if(pCommands == bridgeEnums.eBridgeModelCommands.M_OBFS_CHECK){
onObfsChecked();
}
}
}

View File

@ -15,7 +15,10 @@ import android.widget.RadioButton;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
@ -56,8 +59,10 @@ class bridgeViewController
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));
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
@ -70,17 +75,17 @@ class bridgeViewController
}
private void resetRadioButtons(int p_duration){
animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.float_white), "textColor", p_duration);
animateColor(mBridgeCustom, mBridgeCustom.getCurrentTextColor(), mContext.getResources().getColor(R.color.float_white), "textColor", p_duration);
animateColor(mBridgeChina, mBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.float_white), "textColor", p_duration);
animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.holo_dark_gray), "textColor", p_duration);
animateColor(mBridgeCustom, mBridgeCustom.getCurrentTextColor(), mContext.getResources().getColor(R.color.holo_dark_gray), "textColor", p_duration);
animateColor(mBridgeChina, mBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.holo_dark_gray), "textColor", p_duration);
mBridgeObfs.setHighlightColor(mContext.getResources().getColor(R.color.float_white));
mBridgeCustom.setHighlightColor(mContext.getResources().getColor(R.color.float_white));
mBridgeChina.setHighlightColor(mContext.getResources().getColor(R.color.float_white));
mBridgeObfs.setHighlightColor(mContext.getResources().getColor(R.color.holo_dark_gray));
mBridgeCustom.setHighlightColor(mContext.getResources().getColor(R.color.holo_dark_gray));
mBridgeChina.setHighlightColor(mContext.getResources().getColor(R.color.holo_dark_gray));
mBridgeObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.float_white)));
mBridgeCustom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.float_white)));
mBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.float_white)));
mBridgeObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.holo_dark_gray)));
mBridgeCustom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.holo_dark_gray)));
mBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.holo_dark_gray)));
helperMethod.hideKeyboard(mContext);
mCustomPort.clearFocus();
@ -93,22 +98,21 @@ class bridgeViewController
resetRadioButtons(p_duration);
switch (p_bridge) {
case strings.BRIDGE_CUSTOM_BRIDGE_OBFS4:
animateColor(mBridgeChina, mBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.black), "textColor", p_duration);
mBridgeChina.setHighlightColor(Color.BLACK);
mBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.cursor_blue)));
mBridgeChina.setChecked(true);
break;
case strings.BRIDGE_CUSTOM_BRIDGE_MEEK:
animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.black), "textColor", p_duration);
animateColor(mBridgeObfs, mBridgeObfs.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration);
mBridgeObfs.setHighlightColor(Color.BLACK);
mBridgeObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.cursor_blue)));
mBridgeObfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mBridgeObfs.setChecked(true);
break;
case strings.BRIDGE_CUSTOM_BRIDGE_MEEK:
animateColor(mBridgeChina, mBridgeChina.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration);
mBridgeChina.setHighlightColor(Color.BLACK);
mBridgeChina.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mBridgeChina.setChecked(true);
break;
case strings.BRIDGE_CUSTOM_BRIDGE_CUSTOM:
animateColor(mBridgeCustom, mBridgeCustom.getCurrentTextColor(), mContext.getResources().getColor(R.color.black), "textColor", p_duration);
animateColor(mBridgeCustom, mBridgeCustom.getCurrentTextColor(), mContext.getResources().getColor(R.color.c_text_v1), "textColor", p_duration);
mBridgeCustom.setHighlightColor(Color.BLACK);
mBridgeCustom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.cursor_blue)));
mBridgeCustom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mBridgeCustom.setChecked(true);
mCustomPort.animate().setDuration(p_duration).alpha(1f);
@ -119,7 +123,7 @@ class bridgeViewController
}
public void onTrigger(bridgeEnums.eBridgeViewCommands p_commands, List<Object> p_data){
if(p_commands == bridgeEnums.eBridgeViewCommands.S_INIT_VIEWS){
if(p_commands == bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS){
initViews((String) p_data.get(0), (int)p_data.get(1));
}
}

View File

@ -27,6 +27,7 @@ import java.util.Date;
import java.util.List;
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
import static com.darkweb.genesissearchengine.constants.constants.HISTORY_LOAD_MORE;
public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listViewHolder>
{
@ -40,7 +41,6 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
private ArrayList<Date> mLongSelectedDate = new ArrayList<>();
private ArrayList<String> mLongSelectedIndex = new ArrayList<>();
private ArrayList<Integer> mLongSelectedID = new ArrayList<>();
private ArrayList<View> mLongPressedViewHolders = new ArrayList<>();
private AppCompatActivity mContext;
private historyAdapterView mHistroyAdapterView;
@ -69,15 +69,14 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
private void onLoading(){
mContext.runOnUiThread(() -> {
mCurrentList.add(new historyRowModel("loading",null,-2));
mCurrentList.add(new historyRowModel(HISTORY_LOAD_MORE,null,-2));
notifyItemInserted(mCurrentList.size());
});
}
private void onLoadingClear(){
for(int mCounter = 0; mCounter< mCurrentList.size(); mCounter++){
if(mCurrentList.get(mCounter).getHeader().equals("loading")){
if(mCurrentList.get(mCounter).getHeader().equals(HISTORY_LOAD_MORE)){
int finalM_counter = mCounter;
mContext.runOnUiThread(() -> {
mCurrentList.remove(finalM_counter);
@ -195,18 +194,10 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
}
private void clearLongSelectedURL(){
for(int m_counter = 0; m_counter< mLongSelectedIndex.size(); m_counter++){
View m_item_view = mLongPressedViewHolders.get(m_counter);
ImageButton m_popup_menu = m_item_view.findViewById(R.id.pRowMenu);
ImageView p_logo_image = m_item_view.findViewById(R.id.pLogoImage);
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_CLEAR_LONG_SELECTED_VIEW, Arrays.asList(m_popup_menu, p_logo_image, m_item_view));
}
mLongSelectedDate.clear();
mLongSelectedIndex.clear();
mLongSelectedID.clear();
mLongPressedViewHolders.clear();
notifyDataSetChanged();
}
private String getSelectedURL(){
@ -245,7 +236,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
mSearchEnabled = p_is_searched;
}
public void onSelectView(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){
public void onSelectView(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate){
if(!mSearchEnabled){
try {
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced, true));
@ -259,7 +250,6 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
mLongSelectedDate.add(pDate);
mLongSelectedIndex.add(pUrl);
mLongSelectedID.add(pId);
mLongPressedViewHolders.add(pItem);
}
onVerifyLongSelectedURL();
@ -274,14 +264,13 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
}
}
public void onClearHighlight(View pItem, View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate)
public void onClearHighlight(View pItemView, String pUrl, View pMenuItem, ImageView pLogoImage, boolean pIsForced, int pId, Date pDate)
{
try {
mPopupWindow = (PopupWindow) mHistroyAdapterView.onTrigger(historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT, Arrays.asList(pItemView, pMenuItem, pLogoImage, pIsForced));
mLongSelectedDate.remove(pDate);
mLongSelectedIndex.remove(pUrl);
mLongSelectedID.remove((Integer) pId);
mLongPressedViewHolders.remove(pItem);
if(mLongSelectedID.size()==0){
notifyDataSetChanged();
}
@ -293,7 +282,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
private float mPointerPosition = 0;
@SuppressLint("ClickableViewAccessibility")
public void onSwipe(View pItem, View pItemView, int pPosition, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){
public void onSwipe(View pItemView, int pPosition, String pUrl, View pMenuItem, ImageView pLogoImage, int pId, Date pDate){
Handler handler = new Handler();
@ -301,10 +290,10 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
if(!mDisableCallable && Math.abs(mRecyclerPositionX1-mPointerPosition) <= 20){
if(!mLongSelectedIndex.contains(pUrl) || !mLongSelectedID.contains(pId)) {
mLongPressedMenuActive = true;
onSelectView(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
onSelectView(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
}else {
Log.i("I AM HERE 22","I AM HERE");
onClearHighlight(pItem, pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
onClearHighlight(pItemView, pUrl,pMenuItem, pLogoImage, false, pId, pDate);
mLongPressedMenuActive = true;
}
}else {
@ -344,10 +333,10 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
if (Math.abs(deltaX) <= 20 && !mLongPressedMenuActive) {
if (mLongSelectedIndex.contains(pUrl) && mLongSelectedID.contains(pId)) {
handler.removeCallbacks(mLongPressed);
historyAdapter.this.onClearHighlight(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
historyAdapter.this.onClearHighlight(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
} else{
handler.removeCallbacks(mLongPressed);
historyAdapter.this.onSelectView(pItem, pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
historyAdapter.this.onSelectView(pItemView, pUrl, pMenuItem, pLogoImage, false, pId, pDate);
}
}
return false;
@ -425,10 +414,10 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
});
}
private void setItemViewOnClickListener(View pItem, View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate)
private void setItemViewOnClickListener(View pItemView, View pItemMenu, String pUrl, int pPosition, String pTitle, View pMenuItem, ImageView pLogoImage, int pId, Date pDate)
{
pItemMenu.setOnClickListener((View v) -> onOpenMenu(v, pUrl, pPosition, pTitle));
onSwipe(pItem, pItemView, pPosition, pUrl,pMenuItem, pLogoImage, pId, pDate);
onSwipe(pItemView, pPosition, pUrl,pMenuItem, pLogoImage, pId, pDate);
}
private void onClose(int pIndex){
@ -509,7 +498,8 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
mDate.setText(model.getHeader());
mDateContainer.setVisibility(View.VISIBLE);
mRowContainer.setVisibility(View.GONE);
mRowMenu.setVisibility(View.GONE);
mRowMenu.setVisibility(View.INVISIBLE);
mRowMenu.setClickable(false);
mWebLogo.setVisibility(View.GONE);
mLoadingContainer.setVisibility(View.GONE);
}
@ -517,7 +507,8 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
mDate.setText(model.getHeader());
mDateContainer.setVisibility(View.GONE);
mRowContainer.setVisibility(View.GONE);
mRowMenu.setVisibility(View.GONE);
mRowMenu.setVisibility(View.INVISIBLE);
mRowMenu.setClickable(false);
mWebLogo.setVisibility(View.GONE);
mLoadingContainer.setVisibility(View.VISIBLE);
}
@ -526,6 +517,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
mLoadingContainer.setVisibility(View.GONE);
mRowContainer.setVisibility(View.VISIBLE);
mRowMenu.setVisibility(View.VISIBLE);
mRowMenu.setClickable(true);
mWebLogo.setVisibility(View.VISIBLE);
mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0)+""));
@ -533,13 +525,15 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
mDescription.setText(("https://"+model.getDescription()));
mHeader.setText(model.getHeader());
setItemViewOnClickListener(itemView, mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate());
setItemViewOnClickListener(mRowContainer, mRowMenu, mDescription.getText().toString(), p_position, header, mRowMenu, mLogoImage, model.getID(), model.getDate());
}
if(mLongSelectedID.size()>0){
mRowMenu.setVisibility(View.GONE);
mRowMenu.setVisibility(View.INVISIBLE);
mRowMenu.setClickable(false);
}else {
mRowMenu.setVisibility(View.VISIBLE);
mRowMenu.setClickable(true);
}
if(mLongSelectedIndex.contains("https://" + model.getDescription()) && mLongSelectedID.contains(model.getID())){

View File

@ -40,7 +40,7 @@ public class historyAdapterView
pView.getLocationOnScreen(location);
int y = location[1];
int height = helperMethod.getScreenHeight(mContext);
int m_offset_height = 0;
int m_offset_height;
if(y + helperMethod.pxFromDp(300) >height){
m_offset_height = helperMethod.pxFromDp(203);
}
@ -59,15 +59,16 @@ public class historyAdapterView
private void clearLongSelectedURL(ImageButton pPopupMenu, ImageView pLogoImage, View mItemView){
mItemView.setPressed(false);
pPopupMenu.setVisibility(View.VISIBLE);
pPopupMenu.animate().setDuration(150).alpha(1);
pPopupMenu.setVisibility(View.GONE);
pPopupMenu.animate().setDuration(150).alpha(0);
pPopupMenu.setClickable(true);
pLogoImage.setAlpha(1f);
pLogoImage.setAlpha(0f);
pLogoImage.animate().cancel();
pLogoImage.setVisibility(View.GONE);
pLogoImage.animate().setDuration(150).alpha(0).withEndAction(() -> pLogoImage.setVisibility(View.GONE));
}
public void onSelectView(View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){
public void onSelectView(View pItemView, ImageView pLogoImage, boolean pIsForced, boolean pVibrate){
pItemView.setPressed(false);
int speed = 150;
if(pIsForced){
@ -83,7 +84,7 @@ public class historyAdapterView
pLogoImage.animate().setDuration(speed).alpha(1);
}
public void onClearHighlight( View pItemView, View pMenuItem, ImageView pLogoImage, boolean pIsForced)
public void onClearHighlight(View pItemView, ImageView pLogoImage, boolean pIsForced)
{
try {
if(pLogoImage.getAlpha()>0){
@ -109,10 +110,10 @@ public class historyAdapterView
clearLongSelectedURL((ImageButton)pData.get(0), (ImageView)pData.get(1), (View)pData.get(2));
}
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_SELECT_VIEW){
onSelectView((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4));
onSelectView((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3), (Boolean) pData.get(4));
}
if(pCommands == historyEnums.eHistoryViewAdapterCommands.M_CLEAR_HIGHLIGHT){
onClearHighlight((View)pData.get(0), (View)pData.get(1), (ImageView)pData.get(2), (Boolean) pData.get(3));
onClearHighlight((View)pData.get(0), (ImageView)pData.get(2), (Boolean) pData.get(3));
}
return null;
}

View File

@ -35,8 +35,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static com.darkweb.genesissearchengine.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU;
public class historyController extends AppCompatActivity
@ -59,7 +57,6 @@ public class historyController extends AppCompatActivity
private historyViewController mHistoryViewController;
private boolean isUpdatingRecyclerView = false;
private boolean mIsScrollingUp;
/*Initializations*/
@ -152,8 +149,8 @@ public class historyController extends AppCompatActivity
if (!hasFocus) {
mSearchInput.clearFocus();
}else {
((historyAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).setFilter(mSearchInput.getText().toString());
((historyAdapter) mRecycleView.getAdapter()).invokeFilter(true);
mHistoryAdapter.setFilter(mSearchInput.getText().toString());
mHistoryAdapter.invokeFilter(true);
}
});
@ -172,8 +169,8 @@ public class historyController extends AppCompatActivity
@Override
public void afterTextChanged(Editable editable)
{
((historyAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).setFilter(mSearchInput.getText().toString());
((historyAdapter) mRecycleView.getAdapter()).invokeFilter(true);
mHistoryAdapter.setFilter(mSearchInput.getText().toString());
mHistoryAdapter.invokeFilter(true);
}
});
}
@ -240,7 +237,7 @@ public class historyController extends AppCompatActivity
}
public void onHideSearch(View view) {
((historyAdapter) mRecycleView.getAdapter()).onUpdateSearchStatus((boolean) mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_HIDE_SEARCH, null));
mHistoryAdapter.onUpdateSearchStatus((boolean) mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_HIDE_SEARCH, null));
}
public void onLongPressMenu(View view) {
@ -279,7 +276,7 @@ public class historyController extends AppCompatActivity
public void onclearData(){
mHistoryModel.clearList();
((historyAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).invokeFilter(true );
mHistoryAdapter.invokeFilter(true );
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLEAR_LIST, null);
databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null);
}
@ -295,9 +292,7 @@ public class historyController extends AppCompatActivity
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY ,null);
try {
sleep(500);
activityContextManager.getInstance().getHistoryController().runOnUiThread(() -> {
mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_LOADING_CLEAR, null);
});
activityContextManager.getInstance().getHistoryController().runOnUiThread(() -> mHistoryAdapter.onTrigger(historyEnums.eHistoryAdapterCommands.M_LOADING_CLEAR, null));
sleep(1000);
isUpdatingRecyclerView = false;
} catch (InterruptedException e) {

View File

@ -12,6 +12,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.strings;
@ -24,14 +25,12 @@ class historyViewController
{
/*Private Variables*/
private AppCompatActivity mContext;
private ImageView mEmptyListNotification;
private EditText mSearchInput;
private RecyclerView mRecycleView;
private Button mClearButton;
private ImageButton mMenuButton;
private ImageButton mSearchButton;
private PopupWindow mPopupWindow = null;
/*Initializations*/
@ -55,24 +54,26 @@ class historyViewController
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));
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
}
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));
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void updateIfListEmpty(int pSize,int pDuration){
if(pSize>0){
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
mEmptyListNotification.animate().setDuration(pDuration).alpha(0f);
mClearButton.setText(strings.HISTORY_CLEAR_HISTORY);
mClearButton.setClickable(true);
}
else {
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mEmptyListNotification.animate().setDuration(pDuration).alpha(1f);
mClearButton.animate().setDuration(pDuration).alpha(0.4f);
@ -82,7 +83,10 @@ class historyViewController
mClearButton.setEnabled(false);
mSearchButton.setClickable(false);
mMenuButton.setClickable(false);
mSearchInput.setVisibility(View.GONE);
mClearButton.animate().setDuration(300).alpha(1);
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mClearButton.setText(strings.HISTORY_NO_HISTORY_FOUND);
mClearButton.setClickable(false);
}
@ -92,14 +96,15 @@ class historyViewController
if(mPopupWindow !=null && mPopupWindow.isShowing()){
mPopupWindow.dismiss();
}
onSelectionMenu(true);
}
private void onSelectionMenu(boolean pStatus){
if(!pStatus){
mClearButton.setClickable(false);
mClearButton.animate().cancel();
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
mClearButton.animate().setDuration(150).alpha(0.4f);
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mClearButton.animate().setDuration(200).alpha(0.4f);
mMenuButton.setVisibility(View.VISIBLE);
mSearchButton.setVisibility(View.GONE);
if (mSearchInput.getVisibility() == View.VISIBLE){
@ -108,9 +113,9 @@ class historyViewController
}else {
if (mSearchInput.getVisibility() != View.VISIBLE) {
mClearButton.setClickable(true);
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
mClearButton.animate().cancel();
mClearButton.animate().setDuration(150).alpha(1);
mClearButton.animate().setDuration(200).alpha(1);
}
mMenuButton.setVisibility(View.GONE);
mSearchButton.setVisibility(View.VISIBLE);
@ -120,7 +125,6 @@ class historyViewController
}
private void updateList(){
int index = Objects.requireNonNull(mRecycleView.getAdapter()).getItemCount()-1;
mRecycleView.getAdapter().notifyDataSetChanged();
}
@ -135,6 +139,7 @@ class historyViewController
updateIfListEmpty(mRecycleView.getAdapter().getItemCount(),300);
mSearchInput.clearFocus();
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
}
private boolean onHideSearch() {
@ -148,7 +153,7 @@ class historyViewController
mSearchInput.setText(strings.GENERIC_EMPTY_STR);
mSearchInput.setClickable(false);
mClearButton.setClickable(true);
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.blue));
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_setting_heading));
mClearButton.animate().cancel();
mClearButton.animate().setDuration(150).alpha(1f);
return false;
@ -160,7 +165,7 @@ class historyViewController
mSearchInput.setClickable(true);
mClearButton.setClickable(false);
mSearchInput.requestFocus();
mClearButton.setTextColor(mContext.getApplication().getResources().getColor(R.color.holo_dark_gray_alpha));
mClearButton.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mClearButton.animate().cancel();
mClearButton.animate().setDuration(150).alpha(0.4f);
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);

View File

@ -2,17 +2,24 @@ package com.darkweb.genesissearchengine.appManager.homeManager;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.io.File;
import java.net.URI;
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_MOBILE;
import static org.mozilla.geckoview.StorageController.ClearFlags.ALL;
import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS;
import static org.mozilla.geckoview.StorageController.ClearFlags.COOKIES;
import static org.mozilla.geckoview.StorageController.ClearFlags.DOM_STORAGES;
import static org.mozilla.geckoview.StorageController.ClearFlags.IMAGE_CACHE;
import static org.mozilla.geckoview.StorageController.ClearFlags.NETWORK_CACHE;
import static org.mozilla.geckoview.StorageController.ClearFlags.PERMISSIONS;
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_DATA;
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_SETTINGS;
import org.mozilla.geckoview.ContentBlocking;
import org.mozilla.geckoview.GeckoRuntime;
@ -29,6 +36,7 @@ class geckoClients
private int mSessionID=0;
private int mGlobalSessionCounter=0;
private eventObserver.eventListener event;
private AppCompatActivity context;
@ -38,19 +46,18 @@ class geckoClients
this.event = event;
mGlobalSessionCounter+=1;
mSessionID = mGlobalSessionCounter;
runtimeSettings(context);
initRuntimeSettings(context);
if(!isForced && geckoView.getSession()!=null && geckoView.getSession().isOpen()){
mSession = (geckoSession) geckoView.getSession();
}
else {
geckoView.releaseSession();
Log.i("GCHECKS:","GCHECKS:"+mGlobalSessionCounter);
mSession = new geckoSession(new geckoViewClientCallback(),mGlobalSessionCounter,context);
mSession = new geckoSession(new geckoViewClientCallback(),mGlobalSessionCounter,context, geckoView);
mSession.open(mRuntime);
mSession.getSettings().setUseTrackingProtection(true);
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mSession.getSettings().setFullAccessibilityTree(true);
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE );
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
geckoView.releaseSession();
geckoView.setSession(mSession);
@ -67,13 +74,21 @@ class geckoClients
return mSession.getUserAgentMode();
}
private void runtimeSettings(AppCompatActivity context){
public void initRuntimeSettings(AppCompatActivity context){
if(mRuntime==null){
mRuntime = GeckoRuntime.getDefault(context);
mRuntime.getSettings().setAboutConfigEnabled(true);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
mRuntime.getSettings().setRemoteDebuggingEnabled(false);
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT);
mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sSettingFontAdjustable);
if(status.sSettingTrackingProtection){
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.AD);
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.FINGERPRINTING);
}else {
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT);
}
}
}
@ -81,12 +96,25 @@ class geckoClients
return status.sSettingCookieStatus;
}
void updateCookies(){
mRuntime.getSettings().getContentBlocking().setCookieBehavior(status.sSettingCookieStatus);
onReload();
void updateSetting(){
mRuntime.getSettings().setRemoteDebuggingEnabled(false);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
mRuntime.getSettings().setAutomaticFontSizeAdjustment(status.sSettingFontAdjustable);
mRuntime.getSettings().getContentBlocking().setSafeBrowsing(ContentBlocking.SafeBrowsing.DEFAULT);
if(status.sSettingTrackingProtection){
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.AD);
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.FINGERPRINTING);
}else {
mRuntime.getSettings().getContentBlocking().setAntiTracking(ContentBlocking.AntiTracking.STRICT);
}
void onClose(){
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mSession.getSettings().setFullAccessibilityTree(true);
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE );
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
onReload();
}
void initSession(geckoSession mSession){
@ -118,8 +146,24 @@ class geckoClients
mSession.loadUri(url);
}
void onClearSiteData(){
mRuntime.getStorageController().clearData(SITE_SETTINGS);
mRuntime.getStorageController().clearData(SITE_DATA);
}
void onClearSession(){
mRuntime.getStorageController().clearData(ALL);
mRuntime.getStorageController().clearData(AUTH_SESSIONS);
mRuntime.getStorageController().clearData(PERMISSIONS);
}
void onClearCache(){
mRuntime.getStorageController().clearData(NETWORK_CACHE);
mRuntime.getStorageController().clearData(IMAGE_CACHE);
mRuntime.getStorageController().clearData(DOM_STORAGES);
}
void onClearCookies(){
mRuntime.getStorageController().clearData(COOKIES);
}
void onBackPressed(boolean isFinishAllowed){

View File

@ -1,6 +1,5 @@
package com.darkweb.genesissearchengine.appManager.homeManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
@ -9,6 +8,9 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
@ -16,8 +18,9 @@ import android.os.Environment;
import android.os.Handler;
import android.util.Base64;
import android.util.Log;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillValue;
import android.widget.Toast;
import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
@ -25,17 +28,19 @@ 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.JavaScriptInterface;
import com.darkweb.genesissearchengine.helperManager.downloadFileService;
import com.darkweb.genesissearchengine.helperManager.errorHandler;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import org.mozilla.gecko.GeckoSystemStateListener;
import org.mozilla.gecko.GeckoThread;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.AllowOrDeny;
import org.mozilla.geckoview.Autofill;
import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView;
import org.mozilla.geckoview.WebRequestError;
import java.io.File;
import java.io.FileOutputStream;
@ -43,7 +48,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
@ -67,15 +72,19 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
private GeckoSession.HistoryDelegate.HistoryList mHistoryList = null;
private int rateCount=0;
private int m_current_url_id = -1;
private GeckoView mGeckoView;
geckoSession(eventObserver.eventListener event,int mSessionID,AppCompatActivity mContext){
geckoSession(eventObserver.eventListener event,int mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){
this.mGeckoView = pGeckoView;
this.mContext = mContext;
this.mSessionID = mSessionID;
setProgressDelegate(this);
setHistoryDelegate(this);
setNavigationDelegate(this);
setContentDelegate(this);
setAutoFillDelegate();
setPermissionDelegate(this);
mDownloadManager = new geckoDownloadManager();
setPromptDelegate(new geckoPromptView(mContext));
this.event = event;
@ -84,7 +93,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
void onFileUploadRequest(int resultCode, Intent data){
geckoPromptView mPromptDelegate = (geckoPromptView)getPromptDelegate();
mPromptDelegate.onFileCallbackResult(resultCode,data);
Objects.requireNonNull(mPromptDelegate).onFileCallbackResult(resultCode,data);
}
void initURL(String url){
@ -93,7 +102,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
mCurrentTitle = mCurrentURL;
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion);
if(!url.equals("about:blank"))
if(!url.equals("about:blank") && !url.equals("about:config"))
{
mProgress = 5;
event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update);
@ -101,6 +110,69 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
m_current_url_id = -1;
}
/*Autofill Delegate*/
public void setAutoFillDelegate(){
this.setAutofillDelegate(new AndroidAutofillDelegate());
}
private class AndroidAutofillDelegate implements Autofill.Delegate {
private Rect displayRectForId(@NonNull final GeckoSession session,
@NonNull final Autofill.Node node) {
final Matrix matrix = new Matrix();
final RectF rectF = new RectF(node.getDimensions());
session.getPageToScreenMatrix(matrix);
matrix.mapRect(rectF);
final Rect screenRect = new Rect();
rectF.roundOut(screenRect);
return screenRect;
}
@Override
public void onAutofill(@NonNull final GeckoSession session,
final int notification,
final Autofill.Node node) {
ThreadUtils.assertOnUiThread();
if (Build.VERSION.SDK_INT < 26) {
return;
}
final AutofillManager manager =
mContext.getSystemService(AutofillManager.class);
if (manager == null) {
return;
}
switch (notification) {
case Autofill.Notify.SESSION_STARTED:
case Autofill.Notify.SESSION_CANCELED:
manager.cancel();
break;
case Autofill.Notify.SESSION_COMMITTED:
manager.commit();
break;
case Autofill.Notify.NODE_FOCUSED:
manager.notifyViewEntered(
mGeckoView, node.getId(),
displayRectForId(session, node));
break;
case Autofill.Notify.NODE_BLURRED:
manager.notifyViewExited(mGeckoView, node.getId());
break;
case Autofill.Notify.NODE_UPDATED:
manager.notifyValueChanged(
mGeckoView,
node.getId(),
AutofillValue.forText(node.getValue()));
break;
case Autofill.Notify.NODE_ADDED:
case Autofill.Notify.NODE_REMOVED:
break;
}
}
}
/*Progress Delegate*/
@Override
@ -116,12 +188,6 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
}
@AnyThread
public void shutdown() {
GeckoSystemStateListener.getInstance().shutdown();
GeckoThread.forceQuit();
}
@UiThread
public void onPageStop(@NonNull GeckoSession var1, boolean var2) {
@ -159,13 +225,13 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
/*Navigation Delegate*/
public void onLocationChange(@NonNull GeckoSession var1, @Nullable String var2) {
String newUrl = var2.split("#")[0];
String newUrl = Objects.requireNonNull(var2).split("#")[0];
if(!mCurrentTitle.equals("loading")){
m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.on_update_history);
}
mCurrentURL = newUrl;
if (var2 != null && !var2.equals("about:blank"))
if (!var2.equals("about:blank"))
{
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.start_proxy);
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID), enums.etype.search_update);
@ -260,6 +326,21 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
}
}
/*Permission Delegate*/
@Override
public void onContentPermissionRequest(final GeckoSession session, final String uri,
final int type, final Callback callback) {
if (PERMISSION_AUTOPLAY_AUDIBLE == type || PERMISSION_AUTOPLAY_INAUDIBLE == type) {
if (!status.sAutoPlay) {
callback.reject();
} else {
callback.grant();
}
}else {
callback.reject();
}
}
/*Download Manager*/
void downloadRequestedFile()
@ -280,70 +361,6 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
}
}
public boolean downloadBlobFile(String url){
try{
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
String filetype = "";
String filename = "";
filetype = url.substring(url.indexOf("/") + 1, url.indexOf(";"));
filename = System.currentTimeMillis() + "." + filetype;
File file = new File(path, filename);
try {
if(!path.exists())
path.mkdirs();
if(!file.exists())
file.createNewFile();
String base64EncodedString = url.substring(url.indexOf(",") + 1);
byte[] decodedBytes = Base64.decode(base64EncodedString, Base64.DEFAULT);
OutputStream os = new FileOutputStream(file);
os.write(decodedBytes);
os.close();
//Tell the media scanner about the new file so that it is immediately available to the user.
MediaScannerConnection.scanFile(mContext,
new String[]{file.toString()}, null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Log.i("ExternalStorage", "Scanned " + path + ":");
Log.i("ExternalStorage", "-> uri=" + uri);
}
});
//Set notification after download complete and add "click to view" action to that
String mimetype = url.substring(url.indexOf(":") + 1, url.indexOf("/"));
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), (mimetype + "/*"));
PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
Notification notification = new NotificationCompat.Builder(mContext)
.setSmallIcon(R.xml.ic_download)
.setContentTitle(filename)
.setContentIntent(pIntent)
.build();
notification.flags |= Notification.FLAG_AUTO_CANCEL;
int notificationId = 85851;
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationId, notification);
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
catch (Exception ignored){
}
return true;
}
private boolean createAndSaveFileFromBase64Url(String url) {
if(!url.startsWith("data") && !url.startsWith("blob")){
@ -361,8 +378,8 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
try{
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
String filetype = "";
String filename = "";
String filetype;
String filename;
if(url.startsWith("blob")){
loadUri(JavaScriptInterface.getBase64StringFromBlobUrl(url));
@ -397,10 +414,6 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
//Set notification after download complete and add "click to view" action to that
String mimetype = url.substring(url.indexOf(":") + 1, url.indexOf("/"));
Intent intent = new Intent();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), (mimetype + "/*"));
} else {
intent.setAction(android.content.Intent.ACTION_VIEW);
Uri uri_temp = FileProvider.getUriForFile(mContext,mContext.getString(R.string.GENERAL_FILE_PROVIDER_AUTHORITY), file);
intent.setDataAndType(uri_temp, (mimetype + "/*"));
@ -411,23 +424,10 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
mUriPermission = uri_temp;
mContext.grantUriPermission(packageName, uri_temp, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
}
PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Notification notification = new NotificationCompat.Builder(mContext)
.setSmallIcon(R.xml.ic_download)
.setContentTitle(filename)
.setContentIntent(pIntent)
.build();
notification.flags |= Notification.FLAG_AUTO_CANCEL;
int notificationId = 85851;
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationId, notification);
} else {
String channel_id = createNotificationChannel(mContext);
assert channel_id != null;
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext, channel_id)
.setSmallIcon(R.xml.ic_download)
.setContentTitle(filename)
@ -438,8 +438,6 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
int notificationId = 85851;
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationId, notificationBuilder.build());
}
} catch (IOException e) {
e.printStackTrace();
@ -461,10 +459,9 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
CharSequence channelName = "Application_name";
String channelDescription = "Application_name Alert";
int channelImportance = NotificationManager.IMPORTANCE_DEFAULT;
boolean channelEnableVibrate = true;
NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, channelImportance);
notificationChannel.setDescription(channelDescription);
notificationChannel.enableVibration(channelEnableVibrate);
notificationChannel.enableVibration(true);
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
assert notificationManager != null;
notificationManager.createNotificationChannel(notificationChannel);
@ -536,11 +533,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
if(mHistoryList!=null && index>=0 && index<mHistoryList.size()){
event.invokeObserver(Arrays.asList(mHistoryList.get(index).getUri(),mSessionID), enums.etype.start_proxy);
new Handler().postDelayed(() ->
{
goBack();
}, 100);
new Handler().postDelayed(this::goBack, 100);
}
}
else {
@ -558,11 +551,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
{
event.invokeObserver(Arrays.asList(mHistoryList.get(index), mSessionID), enums.etype.start_proxy);
new Handler().postDelayed(() ->
{
goForward();
}, 100);
new Handler().postDelayed(this::goForward, 100);
}
}else {
goForward();

View File

@ -23,14 +23,18 @@ import android.webkit.URLUtil;
import android.widget.*;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.constraintlayout.widget.ConstraintLayout;
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.historyManager.historyRowModel;
import com.darkweb.genesissearchengine.appManager.landingManager.landingController;
import com.darkweb.genesissearchengine.appManager.languageManager.languageController;
import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController;
import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController;
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController;
import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
@ -40,7 +44,6 @@ 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.appManager.orbotManager.orbotController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.KeyboardUtils;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
@ -57,6 +60,7 @@ import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -82,9 +86,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private ImageView mLoadingIcon;
private TextView mLoadingText;
private AdView mBannerAds = null;
private ImageView mEngineLogo;
private ImageButton mGatewaySplash;
private ImageButton mSwitchEngineBack;
private LinearLayout mTopBar;
private ImageView mBackSplash;
private Button mConnectButton;
@ -94,17 +96,21 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private boolean mPageClosed = false;
private boolean isKeyboardOpened = false;
private boolean isSuggestionChanged = false;
private boolean isTabMenuOpened = false;
/*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/
@Override
protected void onCreate(Bundle savedInstanceState)
{
pluginController.getInstance().preInitialize(this);
databaseController.getInstance().initialize(this);
dataController.getInstance().initialize(this);
onChangeTheme();
status.initStatus();
pluginController.getInstance().onCreate(this);
onInitTheme();
super.onCreate(savedInstanceState);
setContentView(R.layout.home_view);
@ -123,6 +129,29 @@ public class homeController extends AppCompatActivity implements ComponentCallba
initLocalLanguage();
}
public void onInitTheme(){
if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
}else {
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
}
}
}
private void initLocalLanguage() {
String lang = Resources.getSystem().getConfiguration().locale.getLanguage();
@ -167,7 +196,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void initializeConnections()
{
mGeckoView = findViewById(R.id.webLoader);
mGeckoView = findViewById(R.id.pWebView);
mProgressBar = findViewById(R.id.progressBar);
mSplashScreen = findViewById(R.id.splashScreen);
@ -186,9 +215,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoView.setSaveFromParentEnabled(false);
mGeckoClient = new geckoClients();
boolean is_engine_switched = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_ENGINE_SWITCHED,false));
mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,(ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null), mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton);
}
mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,dataController.getInstance().getSuggestions(), mGatewaySplash, mTopBar, mGeckoView, mBackSplash,is_engine_switched, mConnectButton, mSwitchEngineBack);
public void onChangeTheme(){
if(!status.sSettingIsAppStarted){
status.sDefaultNightMode = (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
}
}
public void initPreFixes() {
@ -212,18 +245,18 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,isForced);
//mGeckoClient.loadURL("about:blank");
onSaveCurrentTab(mGeckoClient.getSession(),false);
mHomeViewController.initTab(dataController.getInstance().getTotalTabs());
mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null));
}
public void initTab(boolean isKeyboardOpened){
onNewTab(isKeyboardOpened, false);
mHomeViewController.initTab(dataController.getInstance().getTotalTabs());
mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null));
}
@Override
protected void attachBaseContext(Context base) {
Prefs.setContext(base);
orbotLocalConstants.sHomeContext = new WeakReference<>(base);
orbotLocalConstants.mHomeContext = new WeakReference<>(base);
super.attachBaseContext(LocaleHelper.onAttach(base, Prefs.getDefaultLocale()));
}
@ -242,14 +275,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
}
public void onUpdateJavascript(){
mGeckoView.clearFocus();
mGeckoClient.updateJavascript();
}
public void onUpdateCookies(){
mGeckoView.clearFocus();
mGeckoClient.updateCookies();
public void initRuntimeSettings()
{
mGeckoClient.updateSetting();
}
public void onLoadURL(String url){
@ -257,9 +286,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoClient.loadURL(url.replace("genesis.onion","boogle.store"));
}
public GeckoView getmGeckoView(){
return mGeckoView;
}
public void onLoadTab(geckoSession mTempSession,boolean isSessionClosed){
if(!isSessionClosed){
dataController.getInstance().moveTabToTop(mTempSession);
dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession));
}
mGeckoView.releaseSession();
@ -365,7 +398,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
if(isSuggestionChanged){
isSuggestionChanged = false;
mHomeViewController.initializeSuggestionView(dataController.getInstance().getSuggestions());
mHomeViewController.initializeSuggestionView((ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null));
}
}else {
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),true);
@ -401,7 +434,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){
initializeGeckoView(true);
if(status.sOpenURLInNewTab){
onLoadURL(helperMethod.getDomainName(status.sSettingSearchStatus));
mHomeViewController. onUpdateSearchBar(helperMethod.getDomainName(status.sSettingSearchStatus),false);
}else {
mGeckoView.releaseSession();
onLoadURL("about:blank");
mHomeViewController. onUpdateSearchBar(strings.HOME_BLANK_PAGE,false);
}
mHomeViewController.progressBarReset();
mHomeViewController.onNewTab(isKeyboardOpened,isKeyboardOpenedTemp);
mHomeViewController.onSessionChanged();
@ -409,7 +449,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void onOpenTabViewBoundary(View view){
mNewTab.setPressed(true);
isTabMenuOpened = true;
helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
}
public void onNotificationInvoked(String message,enums.etype e_type){
@ -451,6 +493,19 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoClient.onClearSession();
}
public void onClearSiteData(){
mGeckoClient.onClearSiteData();
}
public void onClearCache(){
mGeckoClient.onClearCache();
}
public void onClearCookies(){
mGeckoClient.onClearCookies();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
@ -493,9 +548,23 @@ 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);
}
if(status.sSettingIsAppStarted){
onStartApplication(null);
}
super.onResume();
}
public void onAcquireDisplay(){
isTabMenuOpened = false;
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
if(model==null){
onLoadTab(model.getSession(),true);
}else {
mGeckoView.releaseSession();
mGeckoView.setSession(model.getSession());
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if(requestCode==1){
@ -514,7 +583,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void onSuggestionUpdate(){
if(!mSearchbar.isFocused()){
mHomeViewController.initializeSuggestionView(dataController.getInstance().getSuggestions());
mHomeViewController.initializeSuggestionView((ArrayList<historyRowModel>)dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_GET_SUGGESTION, null));
}else {
isSuggestionChanged = true;
}
@ -560,37 +629,42 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
public void onSaveCurrentTab(geckoSession session,boolean isHardCopy){
dataController.getInstance().addTab(session,isHardCopy);
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_ADD_TAB, Arrays.asList(session,isHardCopy));
}
public boolean onCloseCurrentTab(geckoSession session){
dataController.getInstance().closeTab(session);
tabRowModel model = dataController.getInstance().getCurrentTab();
dataController.getInstance().invokeTab(dataEnums.eTabCommands.CLOSE_TAB, Collections.singletonList(session));
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
session.stop();
session.close();
initTabCount();
if(model!=null){
if(activityContextManager.getInstance().getTabController()==null || activityContextManager.getInstance().getTabController()!=null && (activityContextManager.getInstance().getTabController().isDestroyed())){
onLoadTab(model.getSession(),true);
}
return true;
}
else {
if(activityContextManager.getInstance().getTabController()==null || activityContextManager.getInstance().getTabController()!=null && (activityContextManager.getInstance().getTabController().isDestroyed())){
return false;
}else {
return true;
}
}
}
public void initTabCount(){
mHomeViewController.initTab(dataController.getInstance().getTotalTabs());
mHomeViewController.initTab((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null));
}
public void releaseSession(){
mGeckoView.releaseSession();
}
public void loadExistingTab()
{
tabRowModel model = dataController.getInstance().getCurrentTab();
public void loadExistingTab(){
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
if (model != null)
{
onLoadTab(model.getSession(), true);
@ -615,7 +689,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
else {
mSearchbar.clearFocus();
if (menuId == R.id.menu9) {
if (menuId == R.id.menu12) {
helperMethod.hideKeyboard(this);
helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
}
else if (menuId == R.id.menu9) {
helperMethod.hideKeyboard(this);
helperMethod.openActivity(tabController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
}
@ -672,7 +750,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
if (menuId == R.id.menu23) {
helperMethod.hideKeyboard(this);
mGeckoClient.onBackPressed(false);
pluginController.getInstance().MessageManagerHandler(homeController.this, Collections.singletonList(mGeckoClient.getSession().getCurrentURL()),enums.etype.bookmark);
}
if (menuId == R.id.menu24) {
helperMethod.hideKeyboard(this);
@ -691,6 +769,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.closeMenu();
}
public void onOrbotLog(View view) {
helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this,true);
}
public class homeViewCallback implements eventObserver.eventListener{
@Override
@ -746,7 +828,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
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){
if((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null)>1){
if(!onCloseCurrentTab(mGeckoClient.getSession())){
onNewTab(true,false);
}
@ -758,10 +840,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
pluginController.getInstance().setProxy(dataToStr(data.get(0)));
}
else if(e_type.equals(enums.etype.on_update_history)){
if(activityContextManager.getInstance().getTabController()!=null && !activityContextManager.getInstance().getTabController().isDestroyed() && !activityContextManager.getInstance().getTabController().isFinishing()){
activityContextManager.getInstance().getTabController().onTabRowChanged((int)data.get(1));
}
return dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_ADD_HISTORY ,data);
}
else if(e_type.equals(enums.etype.on_update_suggestion)){
dataController.getInstance().addSuggesion(data.get(0).toString(),data.get(2).toString());
dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_ADD_SUGGESTION, Arrays.asList(data.get(0).toString(),data.get(2).toString()));
}
else if(e_type.equals(enums.etype.on_page_loaded)){
pluginController.getInstance().logEvent(strings.EVENT_PAGE_OPENED_SUCCESS);
@ -779,10 +864,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
handler.postDelayed(runnable, 1300);
}else {
final Handler handler = new Handler();
Runnable runnable = () ->
{
pluginController.getInstance().initializeBannerAds();
};
Runnable runnable = () -> pluginController.getInstance().initializeBannerAds();
handler.postDelayed(runnable, 2000);
}
}
@ -810,7 +892,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onFullScreenUpdate(status);
}
else if(e_type.equals(enums.etype.on_update_favicon)){
boolean status = (Boolean)data.get(0);
dataController.getInstance().invokeImageCache(dataEnums.eImageCacheCommands.M_SET_IMAGE ,data);
}
else if(e_type.equals(enums.etype.on_long_press_with_link)){
@ -834,7 +915,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
helperMethod.openPlayStore(dataToStr(data.get(0)).split("__")[1],homeController.this);
}
else if(e_type.equals(enums.etype.on_update_suggestion_url)){
dataController.getInstance().updateSuggestionURL(dataToStr(data.get(0)),dataToStr(data.get(2)));
dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_UPDATE_SUGGESTION, Arrays.asList(dataToStr(data.get(0)),dataToStr(data.get(2))));
}
return null;
}

View File

@ -16,6 +16,9 @@ class homeModel
}
String urlComplete(String url){
if(url.equals("about:config")){
return url;
}else {
try
{
String updateUrl = helperMethod.completeURL(url);
@ -33,6 +36,7 @@ class homeModel
return constants.CONST_BACKEND_GOOGLE_URL.replace("$s",url.replaceAll(" ","+"));
}
}
}

View File

@ -27,6 +27,7 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.*;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import com.daimajia.androidanimations.library.Techniques;
@ -42,7 +43,6 @@ import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import org.mozilla.geckoview.GeckoView;
import org.torproject.android.service.wrapper.orbotLocalConstants;
//import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Objects;
@ -66,7 +66,6 @@ class homeViewController
private TextView mLoadingText;
private AdView mBannerAds = null;
private Handler mUpdateUIHandler = null;
private ImageButton mSwitchEngineBack;
private ImageButton mGatewaySplash;
private LinearLayout mTopBar;
private GeckoView mGeckoView;
@ -76,12 +75,10 @@ class homeViewController
private PopupWindow popupWindow = null;
/*Local Variables*/
private ValueAnimator mEngineAnimator = null;
private Callable<String> mLogs = null;
private boolean isLandscape = false;
private boolean disableSplash = false;
void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, FrameLayout webviewContainer, TextView loadingText, com.darkweb.genesissearchengine.widget.AnimatedProgressBar progressBar, AutoCompleteTextView searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ArrayList<historyRowModel> suggestions, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, boolean is_triggered, Button connect_button, ImageButton switch_engine_back){
void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, FrameLayout webviewContainer, TextView loadingText, com.darkweb.genesissearchengine.widget.AnimatedProgressBar progressBar, AutoCompleteTextView searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ArrayList<historyRowModel> suggestions, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button){
this.mContext = context;
this.mProgressBar = progressBar;
this.mSearchbar = searchbar;
@ -96,7 +93,6 @@ class homeViewController
this.mGeckoView = gecko_view;
this.mBackSplash = backsplash;
this.mConnectButton = connect_button;
//this.mSwitchEngineBack = switch_engine_back;
this.mNewTab = mNewTab;
this.popupWindow = null;
@ -111,7 +107,7 @@ class homeViewController
}
void initTab(int count){
mNewTab.setText(count+strings.GENERIC_EMPTY_STR);
mNewTab.setText((count+strings.GENERIC_EMPTY_STR));
YoYo.with(Techniques.FlipInX)
.duration(450)
@ -127,16 +123,22 @@ class homeViewController
window.setStatusBarColor(mContext.getResources().getColor(R.color.landing_ease_blue));
}
else{
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));
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
}
else {
initStatusBarColor();
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
}
@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_light_1));
@ -237,7 +239,7 @@ class homeViewController
mConnectButton.setClickable(false);
mGatewaySplash.setClickable(false);
mConnectButton.animate().setDuration(300).alpha(0f).withEndAction((() -> initSplashLoading()));
mConnectButton.animate().setDuration(300).alpha(0f).withEndAction((this::initSplashLoading));
mGatewaySplash.animate().setDuration(300).alpha(0f);
}
@ -262,7 +264,7 @@ class homeViewController
new Thread(){
public void run(){
AppCompatActivity temp_context = mContext;
while (!orbotLocalConstants.sIsTorInitialized || !orbotLocalConstants.sNetworkState){
while (!orbotLocalConstants.mIsTorInitialized || !orbotLocalConstants.mNetworkState){
try
{
sleep(1000);
@ -298,8 +300,7 @@ class homeViewController
mTopBar.setAlpha(1);
if(mSplashScreen.getAlpha()>=1)
{
disableSplash = true;
mSplashScreen.animate().setDuration(300).setStartDelay(500).alpha(0).withEndAction((() -> triggerPostUI()));
mSplashScreen.animate().setDuration(300).setStartDelay(500).alpha(0).withEndAction((this::triggerPostUI));
initPostUI(false);
}
}
@ -326,9 +327,7 @@ class homeViewController
final View popupView = layoutInflater.inflate(R.layout.popup_menu, null);
int height = 0;
height = helperMethod.getScreenHeight(mContext)*90 /100;
int height = helperMethod.getScreenHeight(mContext)*90 /100;
popupWindow = new PopupWindow(
popupView,
@ -346,16 +345,15 @@ class homeViewController
}
popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.END,0,0);
if(!status.sCharacterEncoding){
popupView.findViewById(R.id.menu30).setVisibility(View.GONE);
}
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));
forward.setEnabled(false);
}
if(!canGoBack){
back.setEnabled(false);
back.setColorFilter(Color.argb(255, 191, 191, 191));
@ -444,7 +442,6 @@ class homeViewController
handlerLocalUrl = url;
if(searchBarUpdateHandler.hasMessages(100)){
delay=0;
return;
}
@ -478,7 +475,7 @@ class homeViewController
if(url.length()<=300){
url = removeEndingSlash(url);
mSearchbar.setText(helperMethod.urlDesigner(url));
mSearchbar.setText(helperMethod.urlDesigner(url, mContext));
mSearchbar.selectAll();
if(isTextSelected){
@ -502,7 +499,6 @@ class homeViewController
}
void onNewTab(boolean keyboard,boolean isKeyboardOpen){
onUpdateSearchBar(strings.HOME_BLANK_PAGE,false);
if(keyboard){
if(!isKeyboardOpen){

View File

@ -5,6 +5,10 @@ import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
@ -23,12 +27,15 @@ class languageViewController
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().setStatusBarColor(mContext.getColor(R.color.white));
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}

View File

@ -0,0 +1,111 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.util.Collections;
import java.util.List;
public class orbotLogController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private orbotLogModel mOrbotModel;
private orbotLogViewController mOrbotViewController;
private TextView mLogs;
private int mLogCounter=0;
private boolean mActivityClosed = false;
/* INITIALIZATIONS */
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onCreate(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.orbot_log_view);
viewsInitializations();
onUpdateLogs();
}
public void viewsInitializations() {
mLogs = findViewById(R.id.pLogs);
activityContextManager.getInstance().setOrbotLogController(this);
mOrbotViewController = new orbotLogViewController(this, mLogs);
mOrbotModel = new orbotLogModel(new orbotModelCallback());
}
/* LISTENERS */
public void onUpdateLogs(){
new Thread(){
public void run(){
while (true){
try {
if(mActivityClosed){
break;
}
if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){
sleep(0);
}else {
sleep(400);
}
if(orbotLocalConstants.mTorLogsHistory.size()>0){
runOnUiThread(() -> {
if(orbotLocalConstants.mTorLogsHistory.size()>mLogCounter){
mOrbotViewController.onTrigger(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS, Collections.singletonList(orbotLocalConstants.mTorLogsHistory.get(mLogCounter)));
mLogCounter+=1;
}
});
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
}
public class orbotModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
finish();
mActivityClosed = true;
}
public void onClose(View view){
finish();
mActivityClosed = true;
}
}

View File

@ -0,0 +1,12 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
public class orbotLogEnums
{
/*Settings Manager*/
public enum eOrbotLogViewCommands {
M_UPDATE_LOGS
}
public enum eOrbotLogModelCommands {
}
}

View File

@ -0,0 +1,30 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import java.util.Arrays;
import java.util.List;
class orbotLogModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
orbotLogModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
public void onTrigger(orbotLogEnums.eOrbotLogModelCommands pCommands, List<Object> pData){
}
}

View File

@ -0,0 +1,64 @@
package com.darkweb.genesissearchengine.appManager.orbotLogManager;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List;
class orbotLogViewController
{
/*Private Variables*/
private AppCompatActivity mContext;
private TextView mLogs;
/*Initializations*/
orbotLogViewController(AppCompatActivity pContext, TextView pLogs)
{
this.mContext = pContext;
this.mLogs = pLogs;
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.blue_dark));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void onUpdateLogs(String pLogs){
mLogs.append("\n\n~ " + (pLogs));
}
public void onTrigger(orbotLogEnums.eOrbotLogViewCommands pCommands, List<Object> pData){
if(pCommands.equals(orbotLogEnums.eOrbotLogViewCommands.M_UPDATE_LOGS)){
onUpdateLogs((String) pData.get(0));
}
}
}

View File

@ -7,25 +7,25 @@ import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class orbotController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private com.darkweb.genesissearchengine.appManager.orbotManager.orbotModel mOrbotModel;
private com.darkweb.genesissearchengine.appManager.orbotManager.orbotViewController mOrbotViewController;
private SwitchMaterial mBridgeSwitch;
private SwitchMaterial mVpnSwitch;
private orbotViewController mOrbotViewController;
private LinearLayout mCustomizableBridgeMenu;
/* INITIALIZATIONS */
@ -44,18 +44,24 @@ public class orbotController extends AppCompatActivity {
mVpnSwitch = findViewById(R.id.pVpnSwitch);
mCustomizableBridgeMenu = findViewById(R.id.pCustomizableBridgeMenu);
mOrbotViewController = new orbotViewController(mBridgeSwitch, mVpnSwitch, this, mCustomizableBridgeMenu);
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.S_INIT_UI, Arrays.asList(status.sBridgeVPNStatus,status.sBridgeStatus));
mOrbotViewController = new com.darkweb.genesissearchengine.appManager.orbotManager.orbotViewController(mBridgeSwitch, mVpnSwitch, this, mCustomizableBridgeMenu);
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.M_INIT_UI, Arrays.asList(status.sBridgeVPNStatus,status.sBridgeStatus));
mOrbotModel = new com.darkweb.genesissearchengine.appManager.orbotManager.orbotModel(new orbotModelCallback());
}
/* LISTENERS */
public class orbotModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
public void onBridgeSwitch(View view){
status.sBridgeStatus = !mBridgeSwitch.isChecked();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_BRIDGE_ENABLES,status.sBridgeStatus));
pluginController.getInstance().updateBridges(status.sBridgeStatus);
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.S_UPDATE_BRIDGE_SETTINGS_VIEWS, Collections.singletonList(status.sBridgeStatus));
mOrbotModel.onTrigger(orbotEnums.eOrbotModelCommands.M_BRIDGE_SWITCH,Collections.singletonList(!mBridgeSwitch.isChecked()));
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.M_UPDATE_BRIDGE_SETTINGS_VIEWS, Collections.singletonList(status.sBridgeStatus));
}
public void openBridgeSettings(View view){
@ -63,10 +69,8 @@ public class orbotController extends AppCompatActivity {
}
public void onVPNSwitch(View view){
status.sBridgeVPNStatus = !mVpnSwitch.isChecked();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,status.sBridgeVPNStatus));
mOrbotViewController.updateVPN(status.sBridgeVPNStatus);
pluginController.getInstance().updateVPN(status.sBridgeVPNStatus);
mOrbotModel.onTrigger(orbotEnums.eOrbotModelCommands.M_VPN_SWITCH,Collections.singletonList(!mVpnSwitch.isChecked()));
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.M_UPDATE_VPN,Collections.singletonList(status.sBridgeVPNStatus));
}
/* LOCAL OVERRIDES */
@ -75,7 +79,7 @@ public class orbotController extends AppCompatActivity {
public void onResume()
{
activityContextManager.getInstance().setCurrentActivity(this);
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.S_INIT_POST_UI,null);
mOrbotViewController.onTrigger(orbotEnums.eOrbotViewCommands.M_INIT_POST_UI,null);
super.onResume();
}

View File

@ -4,6 +4,10 @@ public class orbotEnums
{
/*Settings Manager*/
public enum eOrbotViewCommands {
S_UPDATE_BRIDGE_SETTINGS_VIEWS, S_INIT_POST_UI, S_INIT_UI
M_UPDATE_BRIDGE_SETTINGS_VIEWS, M_INIT_POST_UI, M_INIT_UI, M_UPDATE_VPN, M_UPDATE_BRIDGES
}
public enum eOrbotModelCommands {
M_BRIDGE_SWITCH, M_VPN_SWITCH
}
}

View File

@ -0,0 +1,49 @@
package com.darkweb.genesissearchengine.appManager.orbotManager;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import java.util.Arrays;
import java.util.List;
class orbotModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
orbotModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
public void onBridgeSwitch(boolean pStatus){
status.sBridgeStatus = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_BRIDGE_ENABLES,status.sBridgeStatus));
pluginController.getInstance().updateBridges(status.sBridgeStatus);
}
public void onVPNSwitch(boolean pStatus){
status.sBridgeVPNStatus = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_VPN_ENABLED,status.sBridgeVPNStatus));
pluginController.getInstance().updateVPN(status.sBridgeVPNStatus);
}
public void onTrigger(com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands pCommands, List<Object> pData){
if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_BRIDGE_SWITCH){
onBridgeSwitch((boolean) pData.get(0));
}
else if(pCommands == com.darkweb.genesissearchengine.appManager.orbotManager.orbotEnums.eOrbotModelCommands.M_VPN_SWITCH){
onVPNSwitch((boolean) pData.get(0));
}
}
}

View File

@ -6,7 +6,9 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List;
@ -41,34 +43,36 @@ class orbotViewController
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));
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void bridgeSettingsStatus(boolean p_status){
updateBridgeViews(p_status, true);
private void bridgeSettingsStatus(boolean pStatus){
updateBridgeViews(pStatus, true);
}
public void updateVPN(boolean p_status){
mVpnSwitch.setChecked(p_status);
private void updateVPN(boolean pStatus){
mVpnSwitch.setChecked(pStatus);
}
public void updateBridgeViews(boolean p_status,boolean p_is_invoked){
mBridgeSwitch.setChecked(p_status);
if(p_status){
private void updateBridgeViews(boolean pStatus,boolean pIsInvoked){
mBridgeSwitch.setChecked(pStatus);
if(pStatus){
mCustomizableBridgeMenu.setClickable(true);
mCustomizableBridgeMenu.setAlpha(0);
mCustomizableBridgeMenu.setVisibility(View.VISIBLE);
if(p_is_invoked){
if(pIsInvoked){
mCustomizableBridgeMenu.animate().alpha(1);
}else {
mCustomizableBridgeMenu.setAlpha(1);
}
}else {
mCustomizableBridgeMenu.setClickable(false);
if(p_is_invoked){
if(pIsInvoked){
mCustomizableBridgeMenu.animate().alpha(0).withEndAction(() -> mCustomizableBridgeMenu.setVisibility(View.GONE));
}else {
mCustomizableBridgeMenu.setAlpha(0);
@ -77,20 +81,26 @@ class orbotViewController
}
}
private void initViews(boolean p_vpn_status, boolean p_gateway_status){
updateBridgeViews(p_gateway_status, false);
updateVPN(p_vpn_status);
private void initViews(boolean pVPNStatus, boolean pGatewayStatus){
updateBridgeViews(pGatewayStatus, false);
updateVPN(pVPNStatus);
}
public void onTrigger(orbotEnums.eOrbotViewCommands p_commands, List<Object> p_data){
if(p_commands == orbotEnums.eOrbotViewCommands.S_UPDATE_BRIDGE_SETTINGS_VIEWS){
bridgeSettingsStatus((boolean) p_data.get(0));
public void onTrigger(orbotEnums.eOrbotViewCommands pCommands, List<Object> pData){
if(pCommands == orbotEnums.eOrbotViewCommands.M_UPDATE_BRIDGE_SETTINGS_VIEWS){
bridgeSettingsStatus((boolean) pData.get(0));
}
else if(p_commands == orbotEnums.eOrbotViewCommands.S_INIT_POST_UI){
else if(pCommands == orbotEnums.eOrbotViewCommands.M_INIT_POST_UI){
initPostUI();
}
else if(p_commands == orbotEnums.eOrbotViewCommands.S_INIT_UI){
initViews((boolean)p_data.get(0),(boolean) p_data.get(1));
else if(pCommands == orbotEnums.eOrbotViewCommands.M_INIT_UI){
initViews((boolean)pData.get(0),(boolean) pData.get(1));
}
else if(pCommands == orbotEnums.eOrbotViewCommands.M_UPDATE_VPN){
updateVPN((boolean) pData.get(0));
}
else if(pCommands == orbotEnums.eOrbotViewCommands.M_UPDATE_BRIDGES){
updateBridgeViews((boolean) pData.get(1), (boolean) pData.get(1));
}
}
}

View File

@ -4,9 +4,9 @@ import android.os.Bundle;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;
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;
@ -16,8 +16,8 @@ import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class settingAccessibilityController extends AppCompatActivity {
@ -27,7 +27,6 @@ public class settingAccessibilityController extends AppCompatActivity {
private settingAccessibilityViewController mSettingAccessibilityViewController;
private SwitchMaterial mZoom;
private SwitchMaterial mVoiceInput;
private SwitchMaterial mFontSizeAdjustable;
private SeekBar mSeekBar;
private TextView mSeekBarSample;
private TextView mScalePercentage;
@ -45,12 +44,11 @@ public class settingAccessibilityController extends AppCompatActivity {
public void viewsInitializations() {
mZoom = findViewById(R.id.pZoom);
mVoiceInput = findViewById(R.id.pVoiceInput);
mFontSizeAdjustable = findViewById(R.id.pFontSizeAdjustable);
mSeekBar = findViewById(R.id.pSeekBar);
mSeekBarSample = findViewById(R.id.pSeekBarSample);
mScalePercentage = findViewById(R.id.pScalePercentage);
mSettingAccessibilityViewController = new settingAccessibilityViewController(this, new settingAccessibilityController.settingAccessibilityViewCallback(), mZoom, mVoiceInput, mFontSizeAdjustable, mSeekBar, mSeekBarSample, mScalePercentage);
mSettingAccessibilityViewController = new settingAccessibilityViewController(this, new settingAccessibilityController.settingAccessibilityViewCallback(), mZoom, mVoiceInput, mSeekBar, mSeekBarSample, mScalePercentage);
mSettingAccessibilityModel = new settingAccessibilityModel(new settingAccessibilityController.settingAccessibilityModelCallback());
}
@ -88,8 +86,9 @@ public class settingAccessibilityController extends AppCompatActivity {
@Override
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
int percentage = ((progress+5)*10);
mSeekBarSample.setTextSize((int)((12.0*percentage)/100));
mScalePercentage.setText(percentage+"%");
mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT, Collections.singletonList((int)((12.0*percentage)/100)));
mSettingAccessibilityViewController.onTrigger(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE, Collections.singletonList((percentage+ constants.CONST_PERCENTAGE_SIGN)));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,percentage));
status.sSettingFontSize = percentage;
activityContextManager.getInstance().getHomeController().onLoadFont();
@ -123,25 +122,13 @@ public class settingAccessibilityController extends AppCompatActivity {
}
public void onZoomSettingUpdate(View view){
mSettingAccessibilityModel.onZoomSettingUpdate(!mZoom.isChecked());
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING, Collections.singletonList(!mZoom.isChecked()));
mZoom.toggle();
}
public void onVoiceInputSettingUpdate(View view){
mSettingAccessibilityModel.onVoiceInputSettingUpdate(!mVoiceInput.isChecked());
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING, Collections.singletonList(!mVoiceInput.isChecked()));
mVoiceInput.toggle();
}
public void onFontSizeAdjustableUpdate(View view){
mSettingAccessibilityModel.onFontSizeAdjustableUpdate(!mFontSizeAdjustable.isChecked());
mFontSizeAdjustable.toggle();
if(!mFontSizeAdjustable.isChecked()){
mSettingAccessibilityViewController.enableFontManual();
}else {
mSettingAccessibilityViewController.disableFontManual();
}
activityContextManager.getInstance().getHomeController().onLoadFont();
}
}

View File

@ -0,0 +1,14 @@
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
class settingAccessibilityEnums
{
/*History Manager*/
public enum eAccessibilityModel {
M_UPDATE_SAMPLE_TEXT, M_UPDATE_PERCENTAGE
}
public enum eAccessibilityViewController {
M_ZOOM_SETTING, M_VOICE_INPUT_SETTING
}
}

View File

@ -1,14 +1,12 @@
package com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager;
import android.view.View;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import java.util.Arrays;
import java.util.List;
class settingAccessibilityModel
{
@ -24,21 +22,24 @@ class settingAccessibilityModel
/*Helper Methods*/
public void onZoomSettingUpdate(boolean pStatus){
private void onZoomSettingUpdate(boolean pStatus){
status.sSettingEnableZoom = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,pStatus));
}
public void onVoiceInputSettingUpdate(boolean pStatus){
private void onVoiceInputSettingUpdate(boolean pStatus){
status.sSettingEnableVoiceInput = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,pStatus));
}
public void onFontSizeAdjustableUpdate(boolean pStatus){
status.sSettingFontAdjustable = pStatus;
status.sSettingFontSize = 5;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,pStatus));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_FONT_SIZE,(int)status.sSettingFontSize));
public Object onTrigger(settingAccessibilityEnums.eAccessibilityViewController pCommands, List<Object> pData){
if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING)){
onZoomSettingUpdate((boolean)pData.get(0));
}
else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityViewController.M_VOICE_INPUT_SETTING)){
onVoiceInputSettingUpdate((boolean)pData.get(0));
}
return null;
}
}

View File

@ -6,14 +6,15 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List;
class settingAccessibilityViewController
{
@ -24,20 +25,18 @@ class settingAccessibilityViewController
private SwitchMaterial mZoom;
private SwitchMaterial mVoiceInput;
private SwitchMaterial mFontSizeAdjustable;
private SeekBar mSeekBar;
private TextView mSeekBarSample;
private TextView mScalePercentage;
/*Initializations*/
settingAccessibilityViewController(settingAccessibilityController pContext, eventObserver.eventListener pEvent, SwitchMaterial pZoom, SwitchMaterial pVoiceInput, SwitchMaterial pFontSizeAdjustable, SeekBar pSeekBar, TextView mSeekBarSample, TextView pScalePercentage)
settingAccessibilityViewController(settingAccessibilityController pContext, eventObserver.eventListener pEvent, SwitchMaterial pZoom, SwitchMaterial pVoiceInput, SeekBar pSeekBar, TextView mSeekBarSample, TextView pScalePercentage)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mZoom = pZoom;
this.mVoiceInput = pVoiceInput;
this.mFontSizeAdjustable = pFontSizeAdjustable;
this.mSeekBar = pSeekBar;
this.mSeekBarSample = mSeekBarSample;
this.mScalePercentage = pScalePercentage;
@ -55,8 +54,10 @@ class settingAccessibilityViewController
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));
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
@ -73,50 +74,38 @@ class settingAccessibilityViewController
}else {
mVoiceInput.setChecked(false);
}
if(status.sSettingFontAdjustable){
mFontSizeAdjustable.setChecked(true);
mSeekBar.setProgress(5);
mScalePercentage.setText("100%");
mSeekBar.setEnabled(false);
mSeekBar.setAlpha(0.5f);
mScalePercentage.setAlpha(0.5f);
mSeekBarSample.setAlpha(0.3f);
disableFontManual();
}else {
mFontSizeAdjustable.setChecked(false);
mSeekBar.setProgress((int)status.sSettingFontSize/10-5);
int percentage = (int)status.sSettingFontSize;
float percentage = status.sSettingFontSize;
if(status.sSettingFontSize<100){
mSeekBarSample.setTextSize((int)(12.0*percentage)/100);
mSeekBarSample.setTextSize((int)((12*percentage)/100));
}else if(status.sSettingFontSize>100){
mSeekBarSample.setTextSize((int)(12.0*percentage)/100);
mSeekBarSample.setTextSize((int)((12*percentage)/100));
}
mScalePercentage.setText(percentage+"%");
mScalePercentage.setText(((int)percentage + constants.CONST_PERCENTAGE_SIGN));
mSeekBar.setAlpha(1f);
mScalePercentage.setAlpha(1f);
mSeekBarSample.setAlpha(1f);
mSeekBar.setEnabled(true);
}
private void updateSampleTextSize(int pText){
mSeekBarSample.setTextSize(pText);
}
public void disableFontManual(){
mSeekBar.setProgress(5);
mSeekBarSample.setTextSize(12);
mScalePercentage.setText("100%");
mSeekBar.setEnabled(false);
mSeekBar.animate().setDuration(250).alpha(0.5f);
mScalePercentage.animate().setDuration(250).alpha(0.5f);
mSeekBarSample.animate().setDuration(250).alpha(0.3f);
private void updatePercentage(String pText){
mScalePercentage.setText(pText);
}
public void enableFontManual(){
mSeekBar.setProgress(5);
mSeekBarSample.setTextSize(12);
mScalePercentage.setText("100%");
mSeekBar.setEnabled(true);
mSeekBar.animate().setDuration(250).alpha(1f);
mScalePercentage.animate().setDuration(250).alpha(1f);
mSeekBarSample.animate().setDuration(250).alpha(1f);
public Object onTrigger(settingAccessibilityEnums.eAccessibilityModel pCommands, List<Object> pData){
if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_SAMPLE_TEXT)){
updateSampleTextSize((int)pData.get(0));
}
else if(pCommands.equals(settingAccessibilityEnums.eAccessibilityModel.M_UPDATE_PERCENTAGE)){
updatePercentage((String)pData.get(0));
}
return null;
}
}

View File

@ -0,0 +1,132 @@
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class settingAdvanceController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private settingAdvanceModel mSettingAdvanceModel;
private settingAdvanceViewController mSettingAdvanceViewController;
private SwitchMaterial mRestoreTabs;
private SwitchMaterial mShowWebFonts;
private SwitchMaterial mAllowAutoPlay;
private ArrayList<RadioButton> mImageOption = new ArrayList<>();
private boolean mIsChanged = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onCreate(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_advance_view);
viewsInitializations();
}
public void viewsInitializations() {
mRestoreTabs = findViewById(R.id.pRestoreTabs);
mShowWebFonts = findViewById(R.id.pShowWebFonts);
mAllowAutoPlay = findViewById(R.id.pAllowAutoPlay);
mImageOption.add(findViewById(R.id.pAdvanceImageOption1));
mImageOption.add(findViewById(R.id.pAdvanceImageOption2));
mSettingAdvanceViewController = new settingAdvanceViewController(this, new settingAdvanceViewCallback(), mRestoreTabs, mShowWebFonts, mAllowAutoPlay, mImageOption);
mSettingAdvanceModel = new settingAdvanceModel(new settingAdvanceModelCallback());
}
/* LISTENERS */
public class settingAdvanceViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
public class settingAdvanceModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
int notificationStatus = pluginController.getInstance().getNotificationStatus();
if(notificationStatus==0){
pluginController.getInstance().disableTorNotification();
} else if(notificationStatus==1){
pluginController.getInstance().enableTorNotification();
}
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
if(mIsChanged){
pluginController.getInstance().updatePrivacy();
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
}
finish();
}
/*UI Redirection*/
public void onClose(View view){
if(mIsChanged){
pluginController.getInstance().updatePrivacy();
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
}
finish();
}
public void onRestoreTabs(View view) {
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB, Collections.singletonList(!mRestoreTabs.isChecked()));
mRestoreTabs.toggle();
}
public void onShowImages(View view) {
mIsChanged = true;
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE, Collections.singletonList(null));
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE, Collections.singletonList(view));
mSettingAdvanceViewController.onTrigger(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE, Collections.singletonList(view));
}
public void onShowWebFonts(View view) {
mIsChanged = true;
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS, Collections.singletonList(!mShowWebFonts.isChecked()));
mShowWebFonts.toggle();
}
public void onAllowAutoPlay(View view) {
mIsChanged = true;
mSettingAdvanceModel.onTrigger(settingAdvanceEnums.eAdvanceModel.M_ALLOW_AUTOPLAY, Collections.singletonList(!mAllowAutoPlay.isChecked()));
mAllowAutoPlay.toggle();
}
}

View File

@ -0,0 +1,14 @@
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
class settingAdvanceEnums
{
/*History Manager*/
public enum eAdvanceModel {
M_RESTORE_TAB, M_SHOW_IMAGE, M_SHOW_WEB_FONTS, M_ALLOW_AUTOPLAY
}
public enum eAdvanceViewController {
M_CLEAR_IMAGE, M_SET_IMAGE
}
}

View File

@ -0,0 +1,71 @@
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
import android.view.View;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import java.util.Arrays;
import java.util.List;
class settingAdvanceModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingAdvanceModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
private void onRestoreTabs(boolean pStatus) {
status.sRestoreTabs = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,pStatus));
}
private void onShowImages(View pView) {
if(pView.getId() == R.id.pAdvanceOption1){
status.sShowImages = 0;
}
else if(pView.getId() == R.id.pAdvanceOption2){
status.sShowImages = 2;
}
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,status.sShowImages));
}
private void onShowWebFonts(boolean pStatus) {
status.sShowWebFonts = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,pStatus));
}
private void onAllowAutoPlay(boolean pStatus) {
status.sAutoPlay = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_AUTO_PLAY,pStatus));
}
public Object onTrigger(settingAdvanceEnums.eAdvanceModel pCommands, List<Object> pData){
if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_RESTORE_TAB)){
onRestoreTabs((boolean)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_IMAGE)){
onShowImages((View)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_SHOW_WEB_FONTS)){
onShowWebFonts((boolean)pData.get(0));
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceModel.M_ALLOW_AUTOPLAY)){
onAllowAutoPlay((boolean)pData.get(0));
}
return null;
}
}

View File

@ -0,0 +1,125 @@
package com.darkweb.genesissearchengine.appManager.settingManager.advanceManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RadioButton;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.List;
class settingAdvanceViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private SwitchMaterial mRestoreTabs;
private SwitchMaterial mShowWebFonts;
private SwitchMaterial mAllowAutoPlay;
private ArrayList<RadioButton> mImageOption;
/*Initializations*/
settingAdvanceViewController(settingAdvanceController pContext, eventObserver.eventListener pEvent, SwitchMaterial pRestoreTabs, SwitchMaterial pShowWebFonts, SwitchMaterial pAllowAutoPlay, ArrayList<RadioButton> pImageOption)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mRestoreTabs = pRestoreTabs;
this.mShowWebFonts = pShowWebFonts;
this.mAllowAutoPlay = pAllowAutoPlay;
this.mImageOption = pImageOption;
initViews();
initPostUI();
}
private void initViews()
{
if(status.sRestoreTabs){
mRestoreTabs.setChecked(true);
}else {
mRestoreTabs.setChecked(false);
}
if(status.sShowWebFonts){
mShowWebFonts.setChecked(true);
}else {
mShowWebFonts.setChecked(false);
}
if(status.sAutoPlay){
mAllowAutoPlay.setChecked(true);
}else {
mAllowAutoPlay.setChecked(false);
}
clearImageOptions();
if(status.sShowImages == 0){
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(0).setChecked(true);
}
else if(status.sShowImages == 2){
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(1).setChecked(true);
}
}
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.blue_dark));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void clearImageOptions(){
mImageOption.get(0).setChecked(false);
mImageOption.get(1).setChecked(false);
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
}
private void setImageOptions(View pView){
clearImageOptions();
if(pView.getId() == R.id.pAdvanceOption1){
mImageOption.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(0).setChecked(true);
}
else if(pView.getId() == R.id.pAdvanceOption2){
mImageOption.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mImageOption.get(1).setChecked(true);
}
}
public Object onTrigger(settingAdvanceEnums.eAdvanceViewController pCommands, List<Object> pData){
if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_CLEAR_IMAGE)){
clearImageOptions();
}
else if(pCommands.equals(settingAdvanceEnums.eAdvanceViewController.M_SET_IMAGE)){
setImageOptions((View) pData.get(0));
}
return null;
}
}

View File

@ -0,0 +1,167 @@
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.sql;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class settingClearController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private settingClearModel mSettingClearModel;
private settingClearViewController mSettingClearViewController;
private ArrayList<CheckBox> mCheckBoxList = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_clear_view);
pluginController.getInstance().onCreate(this);
viewsInitializations();
initializeListeners();
}
public void viewsInitializations() {
mCheckBoxList.add(findViewById(R.id.pClearChecked_1));
mCheckBoxList.add(findViewById(R.id.pClearChecked_2));
mCheckBoxList.add(findViewById(R.id.pClearChecked_3));
mCheckBoxList.add(findViewById(R.id.pClearChecked_4));
mCheckBoxList.add(findViewById(R.id.pClearChecked_6));
mCheckBoxList.add(findViewById(R.id.pClearChecked_7));
mCheckBoxList.add(findViewById(R.id.pClearChecked_8));
mCheckBoxList.add(findViewById(R.id.pClearChecked_9));
mSettingClearViewController = new settingClearViewController(this, new settingClearController.settingClearViewCallback(), mCheckBoxList);
mSettingClearModel = new settingClearModel(new settingClearController.settingClearModelCallback());
}
/* LISTENERS */
public class settingClearViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
public class settingClearModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
public void initializeListeners(){
}
public void onCheckBoxTriggered(View view){
mSettingClearViewController.onTrigger(settingClearEnums.eClearViewController.M_CHECK_INVOKE, Arrays.asList(view.getTag(),!mCheckBoxList.get(Integer.parseInt(view.getTag().toString())).isChecked()));
}
public void onClearData(View view){
try{
if(mCheckBoxList.get(0).isChecked()){
mCheckBoxList.get(0).setChecked(false);
mCheckBoxList.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearSession();
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
activityContextManager.getInstance().getHomeController().initTab(false);
}
if(mCheckBoxList.get(1).isChecked()){
mCheckBoxList.get(1).setChecked(false);
mCheckBoxList.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null);
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null);
}
if(mCheckBoxList.get(2).isChecked()){
mCheckBoxList.get(2).setChecked(false);
mCheckBoxList.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
databaseController.getInstance().execSQL(sql.SQL_CLEAR_BOOKMARK,null);
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,null);
}
if(mCheckBoxList.get(3).isChecked()){
mCheckBoxList.get(3).setChecked(false);
mCheckBoxList.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearCache();
}
if(mCheckBoxList.get(4).isChecked()){
mCheckBoxList.get(4).setChecked(false);
mCheckBoxList.get(4).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
dataController.getInstance().invokeSuggestion(dataEnums.eSuggestionCommands.M_CLEAR_SUGGESTION ,null);
}
if(mCheckBoxList.get(5).isChecked()){
mCheckBoxList.get(5).setChecked(false);
mCheckBoxList.get(5).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearSiteData();
}
if(mCheckBoxList.get(6).isChecked()){
mCheckBoxList.get(6).setChecked(false);
mCheckBoxList.get(6).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearSession();
}
if(mCheckBoxList.get(7).isChecked()){
mCheckBoxList.get(7).setChecked(false);
mCheckBoxList.get(7).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
activityContextManager.getInstance().getHomeController().onClearCookies();
}
if(mCheckBoxList.get(8).isChecked()){
mCheckBoxList.get(8).setChecked(false);
mCheckBoxList.get(8).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_CLEAR_PREFS, null);
status.initStatus();
}
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
pluginController.getInstance().MessageManagerHandler(this, null, enums.etype.data_cleared);
}catch (Exception ex){
ex.printStackTrace();
}
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
finish();
}
/*UI Redirection*/
public void onClose(View view){
finish();
}
}

View File

@ -0,0 +1,13 @@
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
class settingClearEnums
{
/*History Manager*/
public enum eClearModel {
}
public enum eClearViewController {
M_CHECK_INVOKE
}
}

View File

@ -0,0 +1,20 @@
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
class settingClearModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingClearModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
}

View File

@ -0,0 +1,74 @@
package com.darkweb.genesissearchengine.appManager.settingManager.clearManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CheckBox;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.List;
class settingClearViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private ArrayList<CheckBox> mCheckBoxList;
/*Initializations*/
settingClearViewController(settingClearController pContext, eventObserver.eventListener pEvent, ArrayList<CheckBox> pCheckBoxList)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mCheckBoxList = pCheckBoxList;
initViews();
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.blue_dark));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initViews()
{
}
private void onClearCheckbox(int pIndex, boolean pStatus){
mCheckBoxList.get(pIndex).setChecked(pStatus);
if(pStatus){
mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint)));
}else {
mCheckBoxList.get(pIndex).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_checkbox_tint_default)));
}
}
public Object onTrigger(settingClearEnums.eClearViewController pCommands, List<Object> pData){
if(pCommands.equals(settingClearEnums.eClearViewController.M_CHECK_INVOKE)){
onClearCheckbox(Integer.parseInt(pData.get(0).toString()), (boolean)pData.get(1));
}
return null;
}
}

View File

@ -0,0 +1,170 @@
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.languageManager.languageController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Collections;
import java.util.List;
public class settingGeneralController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private settingGeneralModel mSettingGeneralModel;
private settingGeneralViewController mSettingGeneralViewController;
private SwitchMaterial mFullScreenMode;
private SwitchMaterial mOpenURLInNewTab;
private RadioButton mThemeLight;
private RadioButton mThemeDark;
private RadioButton mThemeDefault;
private TextView mHomePageText;
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onCreate(this);
onInitTheme();
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_general_view);
viewsInitializations();
initializeListeners();
}
public void viewsInitializations() {
mFullScreenMode = findViewById(R.id.pFullScreenMode);
mThemeLight = findViewById(R.id.pThemeLight);
mThemeDark = findViewById(R.id.pThemeDark);
mThemeDefault = findViewById(R.id.pThemeDefault);
mHomePageText = findViewById(R.id.pHomePageText);
mOpenURLInNewTab = findViewById(R.id.pOpenURLInNewTab);
mSettingGeneralViewController = new settingGeneralViewController(this, new settingGeneralViewCallback(), mFullScreenMode, mThemeLight, mThemeDark, mThemeDefault, mHomePageText, mOpenURLInNewTab);
mSettingGeneralModel = new settingGeneralModel(new settingGeneralModelCallback());
}
public void onInitTheme(){
if(status.sTheme == enums.Theme.THEME_DARK){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}else {
if(!status.sDefaultNightMode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
}
}
/* LISTENERS */
public class settingGeneralViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
if(enums.etype.M_RESET_THEME_INVOKED_BACK.equals(e_type))
{
helperMethod.restartActivity(getIntent(), settingGeneralController.this);
new Handler().postDelayed(() -> {
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
activityContextManager.getInstance().getSettingController().applyTheme();
}, 150);
}
return null;
}
}
public class settingGeneralModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
public void initializeListeners(){
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
activityContextManager.getInstance().setCurrentActivity(this);
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
finish();
}
/*UI Redirection*/
public void onClose(View view){
finish();
}
public void onManageLanguage(View view) {
helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onFullScreenBrowsing(View view){
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING, Collections.singletonList(!mFullScreenMode.isChecked()));
mFullScreenMode.toggle();
}
public void onSelectTheme(View view){
if(view.getId() == R.id.pOption1){
if(status.sTheme != enums.Theme.THEME_DARK) {
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DARK));
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DARK));
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DARK));
}
}else if(view.getId() == R.id.pOption2) {
if(status.sTheme != enums.Theme.THEME_LIGHT) {
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT));
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT));
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_LIGHT));
}
}else {
if(status.sTheme != enums.Theme.THEME_DEFAULT) {
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null);
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT));
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_SELECT_THEME, Collections.singletonList(enums.Theme.THEME_DEFAULT));
mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER, Collections.singletonList(enums.Theme.THEME_DEFAULT));
}
}
}
public void onURLInNewTab(View view) {
mSettingGeneralModel.onTrigger(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB, Collections.singletonList(!mOpenURLInNewTab.isChecked()));
mOpenURLInNewTab.toggle();
}
}

View File

@ -0,0 +1,14 @@
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
class settingGeneralEnums
{
/*History Manager*/
public enum eGeneralModel {
M_FULL_SCREEN_BROWSING, M_SELECT_THEME, M_URL_NEW_TAB
}
public enum eGeneralViewController {
M_SET_THEME, M_RESET_THEME, M_UPDATE_THEME_BLOCKER
}
}

View File

@ -0,0 +1,52 @@
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import java.util.Arrays;
import java.util.List;
class settingGeneralModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingGeneralModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
private void onFullScreenBrowsing(boolean pStatus){
status.sFullScreenBrowsing = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,pStatus));
}
private void onSelectThemeLight(int pStatus){
status.sTheme = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME,pStatus));
}
private void onURLInNewTab(boolean pStatus) {
status.sOpenURLInNewTab = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,pStatus));
}
public Object onTrigger(settingGeneralEnums.eGeneralModel pCommands, List<Object> pData){
if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_FULL_SCREEN_BROWSING)){
onFullScreenBrowsing((boolean)pData.get(0));
}
else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_SELECT_THEME)){
onSelectThemeLight((int)pData.get(0));
}
else if(pCommands.equals(settingGeneralEnums.eGeneralModel.M_URL_NEW_TAB)){
onURLInNewTab((boolean)pData.get(0));
}
return null;
}
}

View File

@ -0,0 +1,140 @@
package com.darkweb.genesissearchengine.appManager.settingManager.generalManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Collections;
import java.util.List;
class settingGeneralViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private SwitchMaterial mFullScreenMode;
private SwitchMaterial mOpenURLInNewTab;
private RadioButton mThemeLight;
private RadioButton mThemeDark;
private RadioButton mThemeDefault;
private TextView mHomePageText;
/*Initializations*/
settingGeneralViewController(settingGeneralController pContext, eventObserver.eventListener pEvent, SwitchMaterial pFullScreenMode, RadioButton pThemeLight, RadioButton pThemeDark, RadioButton pThemeDefault, TextView pHomePageText, SwitchMaterial pOpenURLInNewTab)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mFullScreenMode = pFullScreenMode;
this.mThemeLight = pThemeLight;
this.mThemeDark = pThemeDark;
this.mThemeDefault = pThemeDefault;
this.mHomePageText = pHomePageText;
this.mOpenURLInNewTab = pOpenURLInNewTab;
initViews();
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.blue_dark));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initViews()
{
resetThemeSelection();
if(status.sTheme == enums.Theme.THEME_LIGHT){
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeLight.setChecked(true);
}else if(status.sTheme == enums.Theme.THEME_DARK){
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDark.setChecked(true);
}else{
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDefault.setChecked(true);
}
if(status.sFullScreenBrowsing){
mFullScreenMode.setChecked(true);
}else {
mFullScreenMode.setChecked(false);
}
if(status.sOpenURLInNewTab){
mOpenURLInNewTab.setChecked(true);
}else {
mOpenURLInNewTab.setChecked(false);
}
mHomePageText.setText(helperMethod.getDomainName(status.sSettingSearchStatus));
}
private void updateThemeChanger(int pStatus){
mEvent.invokeObserver(Collections.singletonList(status.sTheme), enums.etype.M_RESET_THEME_INVOKED_BACK);
}
private void resetThemeSelection(){
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mThemeDark.setChecked(false);
mThemeLight.setChecked(false);
mThemeDefault.setChecked(false);
}
private void setThemeLight(int pTheme){
if(pTheme == enums.Theme.THEME_LIGHT){
mThemeLight.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeLight.setChecked(true);
}else if(pTheme == enums.Theme.THEME_DARK){
mThemeDark.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDark.setChecked(true);
}else{
mThemeDefault.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mThemeDefault.setChecked(true);
}
}
public Object onTrigger(settingGeneralEnums.eGeneralViewController pCommands, List<Object> pData){
if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_SET_THEME)){
setThemeLight((int)pData.get(0));
}
else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_RESET_THEME)){
resetThemeSelection();
}
else if(pCommands.equals(settingGeneralEnums.eGeneralViewController.M_UPDATE_THEME_BLOCKER)){
updateThemeChanger((int)pData.get(0));
}
return null;
}
}

View File

@ -1,16 +1,16 @@
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Collections;
import java.util.List;
public class settingNotificationController extends AppCompatActivity {
@ -90,14 +90,11 @@ public class settingNotificationController extends AppCompatActivity {
}
public void onOpenNotificationSettings(View view){
Intent intent = new Intent();
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("android.provider.extra.APP_PACKAGE", getPackageName());
startActivity(intent);
helperMethod.openNotification(this);
}
public void onSaveLocalNotificationSettings(View view){
mSettingNotificationModel.updateLocalNotification(!mNotificationManual.isChecked());
mSettingNotificationModel.onTrigger(settingNotificationEnums.eNotificationModel.M_UPDATE_LOCAL_NOTIFICATION, Collections.singletonList(!mNotificationManual.isChecked()));
mNotificationManual.toggle();
}
}

View File

@ -0,0 +1,14 @@
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
class settingNotificationEnums
{
/*History Manager*/
public enum eNotificationModel {
M_UPDATE_LOCAL_NOTIFICATION
}
public enum eNotificationViewController {
}
}

View File

@ -1,18 +1,13 @@
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
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.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import java.util.Arrays;
import java.util.Collections;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
import java.util.List;
class settingNotificationModel
{
@ -29,7 +24,7 @@ class settingNotificationModel
/*Helper Methods*/
public void updateLocalNotification(boolean pStatus){
private void updateLocalNotification(boolean pStatus){
int mStatus = pStatus ? 1 : 0;
status.sBridgeNotificationManual = mStatus;
@ -46,5 +41,11 @@ class settingNotificationModel
}
}
public Object onTrigger(settingNotificationEnums.eNotificationModel pCommands, List<Object> pData){
if(pCommands.equals(settingNotificationEnums.eNotificationModel.M_UPDATE_LOCAL_NOTIFICATION)){
updateLocalNotification((boolean)pData.get(0));
}
return null;
}
}

View File

@ -1,28 +1,19 @@
package com.darkweb.genesissearchengine.appManager.settingManager.notificationManager;
import android.annotation.SuppressLint;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import static com.darkweb.genesissearchengine.constants.status.sSettingHistoryStatus;
import static com.darkweb.genesissearchengine.constants.status.sSettingJavaStatus;
class settingNotificationViewController
{
/*Private Variables*/
@ -62,8 +53,10 @@ class settingNotificationViewController
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));
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}

View File

@ -0,0 +1,138 @@
package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class settingPrivacyController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private settingPrivacyModel mSettingPrivacyModel;
private settingPrivacyViewController mSettingPrivacyViewController;
private SwitchMaterial mJavaScript;
private SwitchMaterial mDoNotTrack;
private SwitchMaterial mTrackingProtection;
private SwitchMaterial mClearDataOnExit;
private ArrayList<RadioButton> mCookie = new ArrayList<>();
private boolean mSettingChanged = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onCreate(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.setting_privacy_view);
viewsInitializations();
initializeListeners();
}
public void viewsInitializations() {
mJavaScript = findViewById(R.id.pJavascript);
mDoNotTrack = findViewById(R.id.pDoNotTrack);
mTrackingProtection = findViewById(R.id.pTrackingProtection);
mClearDataOnExit = findViewById(R.id.pClearDataOnExit);
mCookie.add(findViewById(R.id.pCookieRadioOption1));
mCookie.add(findViewById(R.id.pCookieRadioOption2));
mCookie.add(findViewById(R.id.pCookieRadioOption3));
mCookie.add(findViewById(R.id.pCookieRadioOption4));
mSettingPrivacyViewController = new settingPrivacyViewController(this, new settingPrivacyController.settingAccessibilityViewCallback(), mJavaScript, mDoNotTrack, mTrackingProtection, mClearDataOnExit, mCookie);
mSettingPrivacyModel = new settingPrivacyModel(new settingPrivacyController.settingAccessibilityModelCallback());
}
/* LISTENERS */
public class settingAccessibilityViewCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
public class settingAccessibilityModelCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
public void initializeListeners(){
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
if(mSettingChanged){
activityContextManager.getInstance().setCurrentActivity(this);
}
super.onResume();
}
@Override
public void onPause()
{
super.onPause();
}
@Override
public void onBackPressed() {
if(mSettingChanged){
activityContextManager.getInstance().setCurrentActivity(this);
}
finish();
}
/*UI Redirection*/
public void onClose(View view){
activityContextManager.getInstance().getHomeController().initRuntimeSettings();
finish();
}
public void onJavaScript(View view){
mSettingChanged = true;
mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.M_SET_JAVASCRIPT, Collections.singletonList(!status.sSettingJavaStatus));
mJavaScript.toggle();
}
public void onDoNotTrack(View view){
mSettingChanged = true;
mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.SET_DONOT_TRACK, Collections.singletonList(!status.sStatusDoNotTrack));
mDoNotTrack.toggle();
}
public void onTrackingProtection(View view){
mSettingChanged = true;
mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.SET_TRACKING_PROTECTION, Collections.singletonList(!status.sSettingTrackingProtection));
mTrackingProtection.toggle();
}
public void onCookies(View view){
mSettingChanged = true;
mSettingPrivacyViewController.onTrigger(settingPrivacyEnums.ePrivacyViewController.SET_COOKIE_STATUS, Collections.singletonList(view));
mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.SET_COOKIES, Collections.singletonList(view));
}
public void onClearPrivateData(View view){
mSettingChanged = true;
mSettingPrivacyModel.onTrigger(settingPrivacyEnums.ePrivacyModel.SET_CLEAR_PRIVATE_DATA, Collections.singletonList(!status.sClearOnExit));
mClearDataOnExit.toggle();
}
}

View File

@ -0,0 +1,14 @@
package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager;
class settingPrivacyEnums
{
/*History Manager*/
public enum ePrivacyModel {
M_SET_JAVASCRIPT, SET_DONOT_TRACK, SET_TRACKING_PROTECTION, SET_COOKIES, SET_CLEAR_PRIVATE_DATA
}
public enum ePrivacyViewController {
SET_COOKIE_STATUS
}
}

View File

@ -0,0 +1,87 @@
package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager;
import android.view.View;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import java.util.Arrays;
import java.util.List;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_ALL;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NONE;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS;
class settingPrivacyModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
/*Initializations*/
settingPrivacyModel(eventObserver.eventListener mEvent){
this.mEvent = mEvent;
}
/*Helper Methods*/
private void onJavaScript(boolean pStatus){
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,pStatus));
status.sSettingJavaStatus = pStatus;
}
private void onDoNotTrack(boolean pStatus){
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,pStatus));
status.sStatusDoNotTrack = pStatus;
}
private void onTrackingProtection(boolean pStatus){
status.sSettingTrackingProtection = pStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TRACKING_PROTECTION,pStatus));
}
private void onCookies(View pView){
if(pView.getId() == R.id.pCookieOption1){
status.sSettingCookieStatus = ACCEPT_ALL;
}
if(pView.getId() == R.id.pCookieOption2){
status.sSettingCookieStatus = ACCEPT_NON_TRACKERS;
}
if(pView.getId() == R.id.pCookieOption3){
status.sSettingCookieStatus = ACCEPT_FIRST_PARTY;
}
if(pView.getId() == R.id.pCookieOption4){
status.sSettingCookieStatus = ACCEPT_NONE;
}
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,status.sSettingCookieStatus));
}
private void onClearPrivateData(boolean pStatus){
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,pStatus));
status.sClearOnExit = pStatus;
}
public Object onTrigger(settingPrivacyEnums.ePrivacyModel pCommands, List<Object> pData){
if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.M_SET_JAVASCRIPT)){
onJavaScript((boolean)pData.get(0));
}
else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.SET_DONOT_TRACK)){
onDoNotTrack((boolean)pData.get(0));
}
else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.SET_TRACKING_PROTECTION)){
onTrackingProtection((boolean)pData.get(0));
}
else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.SET_COOKIES)){
onCookies((View) pData.get(0));
}
else if(pCommands.equals(settingPrivacyEnums.ePrivacyModel.SET_CLEAR_PRIVATE_DATA)){
onClearPrivateData((Boolean) pData.get(0));
}
return null;
}
}

View File

@ -0,0 +1,148 @@
package com.darkweb.genesissearchengine.appManager.settingManager.privacyManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RadioButton;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.List;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_ALL;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NONE;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_NON_TRACKERS;
class settingPrivacyViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private SwitchMaterial mJavaScript;
private SwitchMaterial mDoNotTrack;
private SwitchMaterial mTrackingProtection;
private SwitchMaterial mClearDataOnExit;
private ArrayList<RadioButton> mCookie;
/*Initializations*/
settingPrivacyViewController(settingPrivacyController pContext, eventObserver.eventListener pEvent, SwitchMaterial pJavaScript, SwitchMaterial pDoNotTrack, SwitchMaterial pTrackingProtection, SwitchMaterial pClearDataOnExit, ArrayList<RadioButton> pCookie)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mJavaScript = pJavaScript;
this.mTrackingProtection = pTrackingProtection;
this.mClearDataOnExit = pClearDataOnExit;
this.mCookie = pCookie;
this.mDoNotTrack = pDoNotTrack;
initViews();
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.blue_dark));
}
else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initViews(){
if(status.sSettingJavaStatus){
this.mJavaScript.setChecked(true);
}else{
this.mJavaScript.setChecked(false);
}
if(status.sClearOnExit){
this.mClearDataOnExit.setChecked(true);
}else{
this.mClearDataOnExit.setChecked(false);
}
if(status.sSettingTrackingProtection){
this.mTrackingProtection.setChecked(true);
}else{
this.mTrackingProtection.setChecked(false);
}
if(status.sStatusDoNotTrack){
this.mDoNotTrack.setChecked(true);
}else{
this.mDoNotTrack.setChecked(false);
}
clearCookieSetting();
if(status.sSettingCookieStatus == ACCEPT_ALL){
mCookie.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mCookie.get(0).setChecked(true);
}
if(status.sSettingCookieStatus == ACCEPT_NON_TRACKERS){
mCookie.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mCookie.get(1).setChecked(true);
}
if(status.sSettingCookieStatus == ACCEPT_FIRST_PARTY){
mCookie.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mCookie.get(2).setChecked(true);
}
if(status.sSettingCookieStatus == ACCEPT_NONE){
mCookie.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mCookie.get(3).setChecked(true);
}
}
private void clearCookieSetting(){
for(int mCounter=0; mCounter<mCookie.size();mCounter++){
mCookie.get(mCounter).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mCookie.get(mCounter).setChecked(false);
}
}
private void setCookieStatus(View pView){
clearCookieSetting();
if(pView.getId() == R.id.pCookieOption1){
mCookie.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mCookie.get(0).setChecked(true);
}
else if(pView.getId() == R.id.pCookieOption2){
mCookie.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mCookie.get(1).setChecked(true);
}
else if(pView.getId() == R.id.pCookieOption3){
mCookie.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mCookie.get(2).setChecked(true);
}
else if(pView.getId() == R.id.pCookieOption4){
mCookie.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mCookie.get(3).setChecked(true);
}
}
public Object onTrigger(settingPrivacyEnums.ePrivacyViewController pCommands, List<Object> pData){
if(pCommands.equals(settingPrivacyEnums.ePrivacyViewController.SET_COOKIE_STATUS)){
setCookieStatus((View)pData.get(0));
}
return null;
}
}

View File

@ -1,13 +1,9 @@
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import android.widget.Spinner;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
@ -15,8 +11,8 @@ import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class settingSearchController extends AppCompatActivity {
@ -52,32 +48,32 @@ public class settingSearchController extends AppCompatActivity {
public void onSelectSearchEngine(View view) {
if(view.getId() == R.id.pOption1){
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_GENESIS_URL);
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_GENESIS_URL));
}
else if(view.getId() == R.id.pOption2){
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_DUCK_DUCK_GO_URL);
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_DUCK_DUCK_GO_URL));
}
else if(view.getId() == R.id.pOption3){
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_GOOGLE_URL);
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL));
}
else if(view.getId() == R.id.pOption4){
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_BING_URL);
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_BING_URL));
}
else if(view.getId() == R.id.pOption5){
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_WIKI_URL);
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_WIKI_URL));
}
mSettingSearchViewController.resetSearchEngine();
mSettingSearchViewController.initSearchEngine();
mSettingSearchViewController.onTrigger(settingSearchEnums.eSearchViewController.M_RESET_SEARCH_ENGINE, Collections.singletonList(null));
mSettingSearchViewController.onTrigger(settingSearchEnums.eSearchViewController.M_INIT_SEARCH_ENGINE, Collections.singletonList(null));
}
public void setSearchHistory(View view){
mSettingSearchModel.setSearchHistory(!mSearchHistory.isChecked());
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_HISTORY, Collections.singletonList(!mSearchHistory.isChecked()));
mSearchHistory.toggle();
}
public void setSearchStatus(View view){
mSettingSearchModel.setSearchStatus(!mSearchSuggestions.isChecked());
mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_HISTORY, Collections.singletonList(!mSearchSuggestions.isChecked()));
mSearchSuggestions.toggle();
}

View File

@ -0,0 +1,14 @@
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
class settingSearchEnums
{
/*History Manager*/
public enum eSearchModel {
M_SET_SEARCH_ENGINE, M_SET_SEARCH_HISTORY, M_SET_SEARCH_STATUS
}
public enum eSearchViewController {
M_INIT_SEARCH_ENGINE, M_RESET_SEARCH_ENGINE
}
}

View File

@ -1,12 +1,15 @@
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
import android.view.View;
import com.darkweb.genesissearchengine.appManager.historyManager.historyEnums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import java.util.Arrays;
import java.util.List;
class settingSearchModel
@ -24,18 +27,33 @@ class settingSearchModel
/*Helper Methods*/
public void onSetSearchEngine(String pUrl){
private void onSetSearchEngine(String pUrl){
status.sSettingSearchStatus = pUrl;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, pUrl));
}
public void setSearchHistory(boolean pStatus){
private void setSearchHistory(boolean pStatus){
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY, pStatus));
status.sSettingSearchHistory = pStatus;
}
public void setSearchStatus(boolean pStatus){
private void setSearchStatus(boolean pStatus){
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION, pStatus));
status.getsSettingSearchSuggestion = pStatus;
}
public Object onTrigger(settingSearchEnums.eSearchModel pCommands, List<Object> pData){
if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE)){
onSetSearchEngine((String) pData.get(0));
}
else if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_HISTORY)){
setSearchHistory((boolean) pData.get(0));
}
else if(pCommands.equals(settingSearchEnums.eSearchModel.M_SET_SEARCH_STATUS)){
setSearchStatus((boolean) pData.get(0));
}
return null;
}
}

View File

@ -1,22 +1,21 @@
package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RadioButton;
import android.widget.Spinner;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.List;
class settingSearchViewController
{
@ -48,41 +47,6 @@ class settingSearchViewController
initSearchViews();
}
public void initSearchViews(){
if(status.sSettingSearchHistory){
mSearchHistory.setChecked(true);
}
if(status.getsSettingSearchSuggestion){
mSearchSuggestions.setChecked(true);
}
}
public void initSearchEngine(){
switch (status.sSettingSearchStatus) {
case constants.CONST_BACKEND_GOOGLE_URL:
mSearchEngines.get(2).setChecked(true);
break;
case constants.CONST_BACKEND_GENESIS_URL:
mSearchEngines.get(0).setChecked(true);
break;
case constants.CONST_BACKEND_DUCK_DUCK_GO_URL:
mSearchEngines.get(1).setChecked(true);
break;
case constants.CONST_BACKEND_BING_URL:
mSearchEngines.get(3).setChecked(true);
break;
case constants.CONST_BACKEND_WIKI_URL:
mSearchEngines.get(4).setChecked(true);
break;
}
}
public void resetSearchEngine(){
for(int mCounter=0;mCounter<mSearchEngines.size();mCounter++){
mSearchEngines.get(mCounter).setChecked(false);
}
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
@ -92,10 +56,64 @@ class settingSearchViewController
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));
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initSearchViews(){
if(status.sSettingSearchHistory){
mSearchHistory.setChecked(true);
}
if(status.getsSettingSearchSuggestion){
mSearchSuggestions.setChecked(true);
}
}
private void initSearchEngine(){
resetSearchEngine();
switch (status.sSettingSearchStatus) {
case constants.CONST_BACKEND_GOOGLE_URL:
mSearchEngines.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mSearchEngines.get(2).setChecked(true);
break;
case constants.CONST_BACKEND_GENESIS_URL:
mSearchEngines.get(0).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mSearchEngines.get(0).setChecked(true);
break;
case constants.CONST_BACKEND_DUCK_DUCK_GO_URL:
mSearchEngines.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mSearchEngines.get(1).setChecked(true);
break;
case constants.CONST_BACKEND_BING_URL:
mSearchEngines.get(3).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mSearchEngines.get(3).setChecked(true);
break;
case constants.CONST_BACKEND_WIKI_URL:
mSearchEngines.get(4).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint)));
mSearchEngines.get(4).setChecked(true);
break;
}
}
private void resetSearchEngine(){
for(int mCounter=0;mCounter<mSearchEngines.size();mCounter++){
mSearchEngines.get(mCounter).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(mContext, R.color.c_radio_tint_default)));
mSearchEngines.get(mCounter).setChecked(false);
}
}
public Object onTrigger(settingSearchEnums.eSearchViewController pCommands, List<Object> pData){
if(pCommands.equals(settingSearchEnums.eSearchViewController.M_INIT_SEARCH_ENGINE)){
initSearchEngine();
}
else if(pCommands.equals(settingSearchEnums.eSearchViewController.M_RESET_SEARCH_ENGINE)){
resetSearchEngine();
}
return null;
}
}

View File

@ -1,18 +1,20 @@
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
import com.darkweb.genesissearchengine.appManager.settingManager.accessibilityManager.settingAccessibilityController;
import com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController;
import com.darkweb.genesissearchengine.appManager.settingManager.clearManager.settingClearController;
import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController;
import com.darkweb.genesissearchengine.appManager.settingManager.notificationManager.settingNotificationController;
import com.darkweb.genesissearchengine.appManager.settingManager.privacyManager.settingPrivacyController;
import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
@ -28,80 +30,59 @@ import com.example.myapplication.R;
import java.util.Arrays;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.enums.etype.on_not_support;
import static com.darkweb.genesissearchengine.constants.status.sSettingCookieStatus;
import static com.darkweb.genesissearchengine.constants.status.sSettingHistoryStatus;
import static com.darkweb.genesissearchengine.constants.status.sSettingJavaStatus;
public class settingController extends AppCompatActivity
{
/*Private Observer Classes*/
private homeController mHomeController;
private settingViewController mSettingViewController;
private settingModel mSettingModel;
/*Private Variables*/
private Spinner mSearch;
private Spinner mJavascript;
private Spinner mHistory;
private Spinner mCookies;
private Spinner mFontAdjustable;
private Spinner mNotification;
private SeekBar mFontSize;
private TextView mFontSizePercentage;
/*Initializations*/
public settingController(){
mHomeController = activityContextManager.getInstance().getHomeController();
mSettingModel = new settingModel(new settingModelCallback());
mSettingModel.initNotification(pluginController.getInstance().getNotificationStatus());
}
@Override
protected void onCreate(Bundle savedInstanceState)
{
pluginController.getInstance().onCreate(this);
onInitTheme();
super.onCreate(savedInstanceState);
setContentView(R.layout.setting);
pluginController.getInstance().onCreate(this);
viewsInitializations();
modelInitialization();
listenersInitializations();
initializeFontSizeListener();
}
public void modelInitialization(){
mSettingModel.setJavaStatus(sSettingJavaStatus, true);
mSettingModel.setHistoryStatus(sSettingHistoryStatus, true);
mSettingModel.setSearchStatus(status.sSettingSearchStatus, true);
mSettingModel.setAdjustableStatus(status.sSettingFontAdjustable, true);
mSettingModel.setFontSize(status.sSettingFontSize, true);
public void onInitTheme(){
if(status.sTheme == enums.Theme.THEME_DARK){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}else {
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
}
}
public void applyTheme(){
recreate();
}
public void viewsInitializations()
{
mSearch = findViewById(R.id.search_manager);
mJavascript = findViewById(R.id.javascript_manager);
mHistory = findViewById(R.id.history_manager);
mFontSize = findViewById(R.id.font_size);
mFontAdjustable = findViewById(R.id.font_adjustable);
mFontSizePercentage = findViewById(R.id.font_size_percentage);
mCookies = findViewById(R.id.cookies_manager);
mNotification = findViewById(R.id.notification_manager);
mSettingViewController = new settingViewController(mSearch, mJavascript, mHistory, mFontSize, mFontAdjustable, mFontSizePercentage,this, new settingModelCallback(), mCookies,mNotification,pluginController.getInstance().getNotificationStatus());
activityContextManager.getInstance().setSettingController(this);
mSettingViewController = new settingViewController(this, new settingModelCallback());
}
public void listenersInitializations()
{
initializeItemSelectedListener(mSearch);
initializeItemSelectedListener(mJavascript);
initializeItemSelectedListener(mNotification);
initializeItemSelectedListener(mHistory);
initializeItemSelectedListener(mFontAdjustable);
initializeItemSelectedListener(mCookies);
pluginController.getInstance().logEvent(strings.EVENT_SETTINGS_OPENED);
}
@ -117,11 +98,13 @@ public class settingController extends AppCompatActivity
}
}
@Override
public void onResume()
{
activityContextManager.getInstance().setCurrentActivity(this);
status.sSettingIsAppPaused = false;
onInitTheme();
super.onResume();
}
@ -137,73 +120,7 @@ public class settingController extends AppCompatActivity
finish();
}
public void initializeItemSelectedListener(Spinner view){
view.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
if(parentView.getId()== R.id.search_manager)
{
mSettingModel.setSearchStatus(getEngineURL(position), false);
}
else if(parentView.getId()== R.id.javascript_manager)
{
mSettingModel.setJavaStatus(position==0, false);
}
else if(parentView.getId()== R.id.history_manager)
{
mSettingModel.setHistoryStatus(position==0, false);
}
else if(parentView.getId()== R.id.font_adjustable)
{
if(position==0){
mSettingModel.setFontSize(100, false);
}
mSettingViewController.setFontSizeAdjustable(position==0);
mSettingModel.setAdjustableStatus(position==0, false);
}
else if(parentView.getId()== R.id.cookies_manager)
{
mSettingModel.setCookieStatus(position, false);
}
else if(parentView.getId()== R.id.notification_manager)
{
mSettingModel.setmNotificationStatus(position, false);
}
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
}
});
}
public void initializeFontSizeListener(){
mFontSize.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
float cur_progress = seekBar.getProgress();
mSettingModel.setFontSize((cur_progress), false);
mSettingViewController.updatePercentage(mFontSize.getProgress());
mSettingViewController.setFontSize(b);
mSettingModel.setAdjustableStatus(b, false);
if(cur_progress<1){
mFontSize.setProgress(1);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
public void onNavigationBackPressed(View view){
mSettingModel.onSaveSettings();
finish();
}
@ -227,6 +144,22 @@ public class settingController extends AppCompatActivity
helperMethod.openActivity(settingAccessibilityController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onManageGeneral(View view) {
helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onManageSearchClearData(View view) {
helperMethod.openActivity(settingClearController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onManageSearchPrivacy(View view) {
helperMethod.openActivity(settingPrivacyController.class, constants.CONST_LIST_HISTORY, this,true);
}
public void onManageSearchAdvanced(View view) {
helperMethod.openActivity(settingAdvanceController.class, constants.CONST_LIST_HISTORY, this,true);
}
/*Event Observer*/
public class settingViewCallback implements eventObserver.eventListener{
@ -243,67 +176,8 @@ public class settingController extends AppCompatActivity
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
if(e_type == enums.etype.update_searcn){
status.sSettingSearchStatus = (String)data.get(0);
mHomeController.onHomeButton(null);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, mSettingModel.getSearchStatus()));
}
else if(e_type == enums.etype.update_javascript){
status.sSettingJavaStatus = (boolean)data.get(0);
mHomeController.onUpdateJavascript();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT, status.sSettingJavaStatus));
}
else if(e_type == enums.etype.update_history){
sSettingHistoryStatus = (boolean)data.get(0);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR, sSettingHistoryStatus));
}
else if(e_type == enums.etype.update_notification){
pluginController.getInstance().setNotificationStatus((int)data.get(0));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS, pluginController.getInstance().getNotificationStatus()));
int notificationStatus = pluginController.getInstance().getNotificationStatus();
if(notificationStatus==0){
pluginController.getInstance().disableTorNotification();
} else if(notificationStatus==1){
pluginController.getInstance().enableTorNotification();
}else {
pluginController.getInstance().enableTorNotificationNoBandwidth();
}
}
else if(e_type == enums.etype.update_font_adjustable || e_type == enums.etype.update_font_size){
mHomeController.onLoadFont();
}
else if(e_type == enums.etype.update_cookies){
sSettingCookieStatus = (int)data.get(0);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE, sSettingCookieStatus));
mHomeController.onUpdateCookies();
pluginController.getInstance().updateCookiesStatus();
}
else if(e_type == enums.etype.close_view){
finish();
}
return null;
}
}
/*Helper Methods*/
public String getEngineURL(int index){
if (index == 0)
{
return constants.CONST_BACKEND_GENESIS_URL;
}
else if (index == 1)
{
return constants.CONST_BACKEND_GOOGLE_URL;
}
else
{
return constants.CONST_BACKEND_DUCK_DUCK_GO_URL;
}
}
}

View File

@ -0,0 +1,12 @@
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
public class settingHomeEnums
{
/*History Manager*/
public enum eHomeModel {
}
public enum eHomeViewController {
}
}

View File

@ -1,135 +1,19 @@
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
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.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import java.util.Arrays;
import java.util.Collections;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
class settingModel
{
/*Variable Declaration*/
private eventObserver.eventListener mEvent;
private String mSearchStatus = strings.GENERIC_EMPTY_STR;
private int mCookieStatus = ACCEPT_FIRST_PARTY;
private int mNotificationStatus = 0;
private boolean mJavaStatus = false;
private boolean mHistoryStatus = true;
private boolean mFontAdjustable = true;
private float mFontSize = 1;
private int notificationStatusGlobal;
/*Initializations*/
settingModel(eventObserver.eventListener mEvent){
init_status();
this.mEvent = mEvent;
}
/*Helper Methods*/
private void init_status()
{
mSearchStatus = status.sSettingSearchStatus;
mHistoryStatus = status.sSettingHistoryStatus;
mJavaStatus = status.sSettingJavaStatus;
mCookieStatus = status.sSettingCookieStatus;
}
void initNotification(int notificationStatus){
mNotificationStatus = notificationStatus;
notificationStatusGlobal = notificationStatus;
}
/*Changed Status*/
String getSearchStatus(){
return mSearchStatus;
}
void setCookieStatus(int cookie_status, boolean isActivityLoading){
this.mCookieStatus = cookie_status;
if(!isActivityLoading){
onSaveSettings();
}
}
void setSearchStatus(String search_status, boolean isActivityLoading){
this.mSearchStatus = search_status;
if(!isActivityLoading){
onSaveSettings();
}
}
void setFontSize(float font_size, boolean isActivityLoading){
this.mFontSize = font_size;
if(!isActivityLoading){
onSaveSettings();
}
}
void setAdjustableStatus(boolean font_status, boolean isActivityLoading){
this.mFontAdjustable = font_status;
if(!isActivityLoading){
onSaveSettings();
}
}
void setJavaStatus(boolean java_status, boolean isActivityLoading){
this.mJavaStatus = java_status;
if(!isActivityLoading){
onSaveSettings();
}
}
void setmNotificationStatus(int notification_status, boolean isActivityLoading){
this.mNotificationStatus = notification_status;
if(!isActivityLoading){
onSaveSettings();
}
}
void setHistoryStatus(boolean history_status, boolean isActivityLoading){
this.mHistoryStatus = history_status;
if(!isActivityLoading){
onSaveSettings();
}
}
void onSaveSettings()
{
if(!status.sSettingSearchStatus.equals(mSearchStatus))
{
mEvent.invokeObserver(Collections.singletonList(mSearchStatus), enums.etype.update_searcn);
}
if(status.sSettingJavaStatus != mJavaStatus)
{
mEvent.invokeObserver(Collections.singletonList(mJavaStatus), enums.etype.update_javascript);
}
if(notificationStatusGlobal != mNotificationStatus)
{
mEvent.invokeObserver(Collections.singletonList(mNotificationStatus), enums.etype.update_notification);
}
if(status.sSettingHistoryStatus != mHistoryStatus)
{
status.sSettingHistoryStatus = mHistoryStatus;
mEvent.invokeObserver(Collections.singletonList(mHistoryStatus), enums.etype.update_history);
}
if(status.sSettingCookieStatus != mCookieStatus)
{
status.sSettingCookieStatus = mCookieStatus;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,status.sSettingCookieStatus));
mEvent.invokeObserver(Collections.singletonList(mCookieStatus), enums.etype.update_cookies);
}
}
}

View File

@ -1,22 +1,17 @@
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import static com.darkweb.genesissearchengine.constants.status.sSettingHistoryStatus;
import static com.darkweb.genesissearchengine.constants.status.sSettingJavaStatus;
class settingViewController
{
@ -25,39 +20,13 @@ class settingViewController
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private Spinner mSearch;
private Spinner mJavaScript;
private Spinner mNotification;
private Spinner mHistory;
private Spinner mCookies;
private Spinner mFontAdjustable;
private SeekBar mFontSize;
private TextView mFontSizePercentage;
/*Initializations*/
settingViewController(Spinner mSearch, Spinner mJavaScript, Spinner mHistory, SeekBar mFontSize, Spinner mFontAdjustable, TextView mFontSizePercentage, settingController mContext, eventObserver.eventListener mEvent, Spinner mCookies, Spinner mNotification, int notificationStatus)
settingViewController(settingController mContext, eventObserver.eventListener mEvent)
{
this.mFontSizePercentage = mFontSizePercentage;
this.mSearch = mSearch;
this.mJavaScript = mJavaScript;
this.mNotification = mNotification;
this.mHistory = mHistory;
this.mFontAdjustable = mFontAdjustable;
this.mFontSize = mFontSize;
this.mCookies = mCookies;
this.mEvent = mEvent;
this.mContext = mContext;
initNotification(notificationStatus);
initViews();
initJavascript();
initHistory();
initSearchEngine();
initFontAdjustable();
initCookies();
initFontSize();
initPostUI();
}
@ -70,113 +39,12 @@ class settingViewController
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));
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
private void initViews()
{
mSearch.setDropDownVerticalOffset(15);
mSearch.setDropDownHorizontalOffset(-15);
mJavaScript.setDropDownVerticalOffset(15);
mJavaScript.setDropDownHorizontalOffset(-15);
mNotification.setDropDownVerticalOffset(15);
mNotification.setDropDownHorizontalOffset(-15);
mHistory.setDropDownVerticalOffset(15);
mHistory.setDropDownHorizontalOffset(-15);
mCookies.setDropDownVerticalOffset(15);
mCookies.setDropDownHorizontalOffset(-15);
mFontAdjustable.setDropDownHorizontalOffset(-15);
mFontAdjustable.setDropDownVerticalOffset(15);
}
private void initJavascript()
{
if (sSettingJavaStatus)
{
mJavaScript.setSelection(0);
}
else
{
mJavaScript.setSelection(1);
}
}
private void initNotification(int status)
{
mNotification.setSelection(status);
}
private void initHistory()
{
if (sSettingHistoryStatus)
{
mHistory.setSelection(0);
}
else
{
mHistory.setSelection(1);
}
}
private void initCookies()
{
mCookies.setSelection(status.sSettingCookieStatus);
}
private void initFontAdjustable()
{
if (status.sSettingFontAdjustable)
{
mFontAdjustable.setSelection(0);
}
else
{
mFontAdjustable.setSelection(1);
}
}
private void initFontSize()
{
mFontSize.setProgress((int)status.sSettingFontSize);
updatePercentage(mFontSize.getProgress());
}
void setFontSize(boolean status){
if(status){
mFontAdjustable.setSelection(1);
}
}
void setFontSizeAdjustable(boolean status){
if(status){
mFontSize.setProgress(100);
}
}
private void initSearchEngine()
{
mSearch.setSelection(getEngineIndex());
}
/*External Helper Methods*/
private int getEngineIndex(){
if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GENESIS_URL)){
return 0;
}
else if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GOOGLE_URL)){
return 1;
}
else
return 2;
}
@SuppressLint("SetTextI18n")
void updatePercentage(int font_size){
mFontSizePercentage.setText(strings.SETTING_CUSTOM_FONTS + strings.GENERIC_EMPTY_SPACE + font_size +strings.SETTING_PERCENT_SIGN);
}
}

View File

@ -1,5 +1,7 @@
package com.darkweb.genesissearchengine.appManager.tabManager;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -9,11 +11,16 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import org.mozilla.geckoview.GeckoView;
import java.util.ArrayList;
import java.util.Collections;
@ -22,15 +29,17 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
/*Private Variables*/
private ArrayList<tabRowModel> mModelList;
private ArrayList<tabRowModel> mTempModelList;
private eventObserver.eventListener mEvent;
private String filter = strings.GENERIC_EMPTY_STR;
private boolean isClosing = false;
tabAdapter(ArrayList<tabRowModel> model_list, eventObserver.eventListener event) {
private GeckoView mCurrentGeckoView = null;
private int mCurrentSession;
tabAdapter(ArrayList<tabRowModel> model_list, eventObserver.eventListener event, GeckoView pGeckoView, int pCurrentSession) {
this.mModelList = model_list;
this.mEvent = event;
mTempModelList = new ArrayList<>();
pGeckoView.releaseSession();
this.mCurrentSession = pCurrentSession;
}
/*Initializations*/
@ -38,128 +47,76 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
@NonNull
@Override
public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recyclerview_row, parent, false);
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.tabview_row, parent, false);
return new listViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull tabAdapter.listViewHolder holder, int position)
{
holder.bindListView(mTempModelList.get(position));
clearMessageItem(holder.messageButton,position,holder.data_model);
clearMessageItemContainer(holder.itemContainer,position,holder.data_model);
holder.bindListView(mModelList.get(position));
}
@Override
public int getItemCount() {
return mTempModelList.size();
return mModelList.size();
}
/*Listeners*/
private void clearMessageItem(ImageButton clearButton, int index,tabRowModel model)
{
clearButton.setOnClickListener(v ->
{
if(!isClosing){
isClosing = true;
int size = mModelList.size();
public void onClose(){
if(mCurrentGeckoView!=null){
mCurrentGeckoView.releaseSession();
}
}
mEvent.invokeObserver(Collections.singletonList(mTempModelList.get(index).getmId()),enums.etype.url_clear);
mEvent.invokeObserver(Collections.singletonList(index),enums.etype.is_empty);
invokeFilter(false);
model.getSession().stop();
model.getSession().close();
if(size>1){
new Thread(){
public void run(){
try
{
sleep(500);
isClosing = false;
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}.start();
}
}
public void setOnClickListener(ImageView pLoadSession, tabRowModel model, GeckoView pGeckoView, ImageButton mRemoveRow){
pLoadSession.setOnClickListener(v -> {
pGeckoView.releaseSession();
activityContextManager.getInstance().getHomeController().onLoadTab(model.getSession(), false);
activityContextManager.getInstance().getTabController().onBackPressed(null);
activityContextManager.getInstance().getTabController().initTabCount();
});
}
private void clearMessageItemContainer(LinearLayout clearButton, int index,tabRowModel model)
{
clearButton.setOnClickListener(v ->
{
if(mTempModelList.size()>index){
invokeFilter(false);
mEvent.invokeObserver(Collections.singletonList(model),enums.etype.url_triggered);
}
mRemoveRow.setOnClickListener(v -> {
model.getSession().closeSession();
activityContextManager.getInstance().getTabController().onRemoveView(model.getSession().getSessionID());
notifyDataSetChanged();
activityContextManager.getInstance().getTabController().initTabCount();
});
}
/*View Holder Extensions*/
class listViewHolder extends RecyclerView.ViewHolder
{
TextView heaaderText;
TextView descriptionText;
ImageButton messageButton;
ImageView empty_message;
LinearLayout itemContainer;
tabRowModel data_model;
GeckoView mGeckoView;
TextView mHeader;
TextView mDescription;
ImageView mLoadSession;
ImageButton mRemoveRow;
listViewHolder(View itemView) {
super(itemView);
}
void bindListView(tabRowModel model) {
mGeckoView = itemView.findViewById(R.id.pGeckoView);
mHeader = itemView.findViewById(R.id.pHeader);
mDescription = itemView.findViewById(R.id.pDescription);
mLoadSession = itemView.findViewById(R.id.pLoadSession);
mRemoveRow = itemView.findViewById(R.id.pRemoveRow);
heaaderText = itemView.findViewById(R.id.pHeader);
descriptionText = itemView.findViewById(R.id.pDescription);
//itemContainer = itemView.findViewById(R.id.pRowContainer);
if(model.getSession().getTitle().equals("") || model.getSession().getTitle().equals("loading")){
heaaderText.setText(helperMethod.getDomainName(model.getSession().getCurrentURL()));
}
else {
heaaderText.setText(model.getSession().getTitle());
mGeckoView.releaseSession();
mGeckoView.setSession(model.getSession());
if(model.getmId() == mCurrentSession){
mCurrentGeckoView = mGeckoView;
}
model.setGeckoView(mGeckoView);
mHeader.setText(model.getSession().getTitle());
mDescription.setText(model.getSession().getCurrentURL());
/*Large file or content based url handling*/
String url = model.getSession().getCurrentURL();
if(url.length()>200){
url = url.substring(0,200);
}
descriptionText.setText(url);
// messageButton = itemView.findViewById(R.id.message_button);
empty_message = itemView.findViewById(R.id.pEmptyListNotification);
data_model = model;
setOnClickListener(mLoadSession, model, mGeckoView, mRemoveRow);
}
}
void setFilter(String filter){
this.filter = filter;
}
void invokeFilter(boolean notify){
mTempModelList.clear();
for(int counter = 0; counter< mModelList.size(); counter++){
if(mModelList.get(counter).getSession().getTitle().contains(filter) || mModelList.get(counter).getSession().getCurrentURL().contains(filter)){
tabRowModel model = mModelList.get(counter);
mTempModelList.add(new tabRowModel(model.getSession(),counter));
}
}
if(notify){
mEvent.invokeObserver(null,enums.etype.clear_recycler);
notifyDataSetChanged();
}
}
}

View File

@ -1,18 +1,17 @@
package com.darkweb.genesissearchengine.appManager.tabManager;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
@ -23,26 +22,24 @@ import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class tabController extends AppCompatActivity
{
/*Private Views*/
private Button mTabs;
/*Private Variables*/
private tabModel mListModel;
private homeController mHomeController;
private activityContextManager mContextManager;
private ImageView mEmptyListNotifier;
private EditText mSearchBar;
private RecyclerView mListView;
private Button mClearButton;
private tabViewController mtabViewController;
private RecyclerView mRecycleView;
private tabAdapter mTabAdapter;
/*Initializations*/
@ -54,88 +51,115 @@ public class tabController extends AppCompatActivity
initializeListModel();
initializeViews();
initializeList();
onEditorInvoked();
onCustomeListeners();
}
public void initializeListModel(){
mListModel = new tabModel();
mListModel.setList(dataController.getInstance().getTab());
mListModel.setList((ArrayList<tabRowModel>)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TAB, null));
mContextManager = activityContextManager.getInstance();
mHomeController = activityContextManager.getInstance().getHomeController();
mContextManager.setTabController(this);
pluginController.getInstance().logEvent(strings.EVENT_TAB_OPENED);
}
public void initializeViews(){
mEmptyListNotifier = findViewById(R.id.pEmptyListNotification);
mSearchBar = findViewById(R.id.pSearchInput);
mListView = findViewById(R.id.pRecycleView);
mClearButton = findViewById(R.id.pClearButton);
mtabViewController = new tabViewController(mEmptyListNotifier, mListView, mClearButton,this);
mRecycleView = findViewById(R.id.pRecycleView);
mTabs = findViewById(R.id.pTabs);
mtabViewController = new tabViewController(this, mTabs);
}
public void initializeList(){
tabAdapter adapter = new tabAdapter(mListModel.getList(),new adapterCallback());
adapter.invokeFilter(false);
mListView.setAdapter(adapter);
mListView.setLayoutManager(new LinearLayoutManager(this));
mtabViewController.updateIfListEmpty(mListModel.getList().size(),0);
LinearLayoutManager layoutManager = new LinearLayoutManager(tabController.this);
tabAdapter adapter = new tabAdapter(mListModel.getList(),new adapterCallback(), mHomeController.getmGeckoView(), ((tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB,null)).getmId());
mTabAdapter = adapter;
layoutManager.setReverseLayout(true);
mRecycleView.setAdapter(adapter);
mRecycleView.setItemViewCacheSize(100);
mRecycleView.setNestedScrollingEnabled(false);
mRecycleView.setHasFixedSize(true);
mRecycleView.setAdapter(adapter);
mRecycleView.setItemViewCacheSize(100);
mRecycleView.setDrawingCacheEnabled(true);
mRecycleView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
mRecycleView.setLayoutManager(new LinearLayoutManager(tabController.this));
}
/*View Handlers*/
public void onEditorInvoked(){
mSearchBar.setOnEditorActionListener((v, actionId, event) ->{
if (actionId == EditorInfo.IME_ACTION_NEXT)
{
helperMethod.hideKeyboard(this);
return true;
}
return false;
});
mSearchBar.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2){
public void onCustomeListeners(){
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2){
}
@Override
public void afterTextChanged(Editable editable)
{
if(mListView!=null){
((tabAdapter) Objects.requireNonNull(mListView.getAdapter())).setFilter(mSearchBar.getText().toString());
((tabAdapter) mListView.getAdapter()).invokeFilter(true);
}
}
});
}
public void reset(){
if(mListView!=null){
mListView.setAdapter(null);
}
mListView = null;
public void onReleaseDisplay(){
mTabAdapter.onClose();
mHomeController.onAcquireDisplay();
}
@Override
public void onBackPressed() {
super.onBackPressed();
reset();
overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
}
public void onBackPressed(View view){
this.finish();
reset();
public void onBackPressed(View view) {
onReleaseDisplay();
finish();
overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
}
public void onclearDataTrigger(View view){
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.GENERIC_EMPTY_STR),enums.etype.clear_tab);
public void onRemoveView(int pId){
for(int mCounter=0; mCounter<mListModel.getList().size();mCounter++){
if(mListModel.getList().get(mCounter).getSession().getSessionID() == pId){
mListModel.getList().get(mCounter).releaseGeckoView();
mListModel.getList().remove(mCounter);
mTabAdapter.notifyDataSetChanged();
//mTabAdapter.notifyItemRemoved(mCounter);
//mTabAdapter.notifyItemRangeChanged(mCounter-1, mListModel.getList().size());
}
}
}
public void initTabCount()
{
mtabViewController.onTrigger(tabEnums.eTabViewCommands.INIT_TAB_COUNT, null);
}
public void onNewTabInvoked(){
mHomeController.onNewTab(true,false);
onReleaseDisplay();
finish();
overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
}
/*UI Triggers*/
public void openTabMenu(View view) {
mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_SHOW_MENU, Collections.singletonList(view));
}
/*Tab Menu*/
public void onMenuTrigger(View pView){
if(pView.getId() == R.id.pNewTab){
onNewTabInvoked();
}
else if(pView.getId() == R.id.pCloseTab){
}
else if(pView.getId() == R.id.pOpenSetting){
mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_DISMISS_MENU, null);
helperMethod.openActivity(settingController.class, constants.CONST_LIST_HISTORY, this,true);
}
}
public void onTabRowChanged(int pId){
for(int mCounter=0; mCounter<mListModel.getList().size();mCounter++){
if(mListModel.getList().get(mCounter).getSession().getSessionID() == pId){
mListModel.getList().get(mCounter).releaseGeckoView();
mTabAdapter.notifyItemChanged(mCounter);
}
}
}
@Override
@ -144,16 +168,11 @@ public class tabController extends AppCompatActivity
if(status.sSettingIsAppPaused && (level==80 || level==15))
{
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HOME_LOW_MEMORY,true));
onReleaseDisplay();
finish();
}
}
public void onNewTabInvoked(View view)
{
mHomeController.onNewTab(true,false);
finish();
}
@Override
public void onResume()
{
@ -177,39 +196,10 @@ public class tabController extends AppCompatActivity
/*Event Observer*/
public class adapterCallback implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
if(e_type.equals(enums.etype.clear_recycler)){
mListView.getRecycledViewPool().clear();
}
if(e_type.equals(enums.etype.url_triggered)){
tabRowModel model = (tabRowModel)data.get(0);
pluginController.getInstance().logEvent(strings.EVENT_TAB_TRIGGERED);
mHomeController.onLoadTab(model.getSession(),false);
tabController.this.finish();
}
else if(e_type.equals(enums.etype.url_clear)){
mListModel.onManualClear((int)data.get(0));
mHomeController.initTabCount();
}
else if(e_type.equals(enums.etype.is_empty)){
mtabViewController.removeFromList((int)data.get(0));
mtabViewController.updateIfListEmpty(mListModel.getList().size(),300);
mHomeController.releaseSession();
if(dataController.getInstance().getTotalTabs()<1){
mHomeController.onNewTab(true,false);
finish();
}else {
mHomeController.loadExistingTab();
}
mHomeController.initTabCount();
}
return null;
}
}
}

View File

@ -0,0 +1,12 @@
package com.darkweb.genesissearchengine.appManager.tabManager;
public class tabEnums
{
/*Settings Manager*/
public enum eTabViewCommands {
M_DISMISS_MENU, M_SHOW_MENU, INIT_TAB_COUNT
}
public enum eTabModelCommands {
}
}

View File

@ -14,19 +14,10 @@ class tabModel
{
mModelList = model;
}
ArrayList<tabRowModel> getList()
{
return mModelList;
}
private void removeFromMainList(int index)
{
if(mModelList.size()>index){
mModelList.remove(index);
}
}
void onManualClear(int index){
removeFromMainList(index);
}
}

View File

@ -2,12 +2,15 @@ package com.darkweb.genesissearchengine.appManager.tabManager;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession;
import org.mozilla.geckoview.GeckoView;
public class tabRowModel
{
/*Private Variables*/
private geckoSession mSession;
private int mId;
private GeckoView mGeckoView = null;
/*Initializations*/
@ -21,6 +24,16 @@ public class tabRowModel
return mSession;
}
public void setGeckoView(GeckoView pGeckoView){
mGeckoView = pGeckoView;
}
public void releaseGeckoView(){
if(mGeckoView!=null){
mGeckoView.releaseSession();
}
}
public int getmId() {
return mId;
}

View File

@ -1,37 +1,52 @@
package com.darkweb.genesissearchengine.appManager.tabManager;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ActionMenuView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.example.myapplication.R;
import java.util.Objects;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.List;
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
class tabViewController
{
/*Private Variables*/
private AppCompatActivity mContext;
private ImageView mEmptyListNotifier;
private RecyclerView mListView;
private Button mClearButton;
private PopupWindow mTabOptionMenu = null;
private Button mTabs;
/*Initializations*/
tabViewController(ImageView mEmptyListNotifier, RecyclerView mListView, Button mClearButton, AppCompatActivity mContext)
tabViewController(AppCompatActivity mContext, Button pTabs)
{
this.mContext = mContext;
this.mEmptyListNotifier = mEmptyListNotifier;
this.mListView = mListView;
this.mClearButton = mClearButton;
this.mTabs = pTabs;
initPostUI();
initUI();
}
private void initUI(){
initTabCount();
}
private void initTabCount(){
mTabs.setText((((int)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null))+ strings.GENERIC_EMPTY_STR));
}
private void initPostUI(){
@ -40,30 +55,45 @@ class tabViewController
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));
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
}
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));
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
}
}
void updateIfListEmpty(int size,int duration){
if(size>0){
mEmptyListNotifier.animate().setDuration(duration).alpha(0f);
mClearButton.animate().setDuration(duration).alpha(1f);
private void onOpenTabMenu(View view) {
onCloseTabMenu();
LayoutInflater layoutInflater = (LayoutInflater) view.getContext().getSystemService(LAYOUT_INFLATER_SERVICE);
@SuppressLint("InflateParams") final View mPopupView = layoutInflater.inflate(R.layout.tab_menu, null);
mTabOptionMenu = new PopupWindow( mPopupView, ActionMenuView.LayoutParams.WRAP_CONTENT, ActionMenuView.LayoutParams.WRAP_CONTENT, true);
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
mTabOptionMenu.setOutsideTouchable(true);
mTabOptionMenu.setFocusable(true);
mTabOptionMenu.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mTabOptionMenu.setAnimationStyle(R.style.popup_window_animation);
mTabOptionMenu.setElevation(7);
mTabOptionMenu.showAsDropDown(view,0, helperMethod.pxFromDp(-45));
}
else {
mEmptyListNotifier.animate().setDuration(duration).alpha(1f);
mClearButton.animate().setDuration(duration).alpha(0f);
private void onCloseTabMenu() {
if(mTabOptionMenu!=null){
mTabOptionMenu.dismiss();
}
}
void removeFromList(int index)
{
Objects.requireNonNull(mListView.getAdapter()).notifyItemRemoved(index);
mListView.getAdapter().notifyItemRangeChanged(index, mListView.getAdapter().getItemCount()-1);
public void onTrigger(tabEnums.eTabViewCommands pCommands, List<Object> pData){
if(pCommands.equals(tabEnums.eTabViewCommands.M_SHOW_MENU)){
onOpenTabMenu((View) pData.get(0));
}else if(pCommands.equals(tabEnums.eTabViewCommands.M_DISMISS_MENU)){
onCloseTabMenu();
}else if(pCommands.equals(tabEnums.eTabViewCommands.INIT_TAB_COUNT)){
initTabCount();
}
}
}

View File

@ -15,7 +15,6 @@ public class constants
public static final String CONST_GENESIS_UPDATE_URL = "https://boogle.store/manual?abi=";
public static final String CONST_PLAYSTORE_URL = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine";
public static final String CONST_BACKEND_GENESIS_URL = "http://boogle.store/q=$s";
public static final String CONST_BACKEND_GOOGLE_URL = "https://www.google.com/q=$s";
public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com/q=$s";
@ -32,6 +31,14 @@ public class constants
public static final boolean CONST_PROXY_DO_NOT_TRACK_HEADER_ENABLED = false;
public static final int CONST_PROXY_DO_NOT_TRACK_HEADER_VALUE = 1;
/*HISTORY CONSTANTS*/
public static final String HISTORY_LOAD_MORE = "loading_more";
/*BOOKMARK CONSTANTS*/
public static final String BOOKMARK_LOAD_MORE = "loading_more";
/*MENU CONSTANTS*/
public static final int CONST_LIST_HISTORY = 1;
@ -43,6 +50,8 @@ public class constants
public static final int CONST_FETCHABLE_LIST_SIZE =100;
public static final int CONST_MAX_BOOKMARK_SIZE =500;
public static final String CONST_DATABASE_NAME ="genesis_dbase";
public static final String CONST_PERCENTAGE_SIGN ="%";
public static final String CONST_PERCENTAGE_SIGN_100 ="100%";
/*ADMOB CONSTANTS*/

View File

@ -4,11 +4,17 @@ public class enums
{
/*Settings Manager*/
public enum etype{
on_update_favicon,
on_update_favicon,M_RESET_THEME_INVOKED_BACK,
onion,on_verify_selected_url_menu,
welcome,abi_error, rate_failure,reported_success,bookmark, clear_tab,clear_history,clear_bookmark,report_url,rate_app,version_warning,start_orbot,download_file,download_file_long_press,on_long_press_url,
welcome,abi_error, rate_failure,reported_success,bookmark, clear_tab,clear_history,clear_bookmark,report_url,default_home,rate_app,version_warning,start_orbot,download_file,download_file_long_press,on_long_press_url,
cancel_welcome,ignore_abi,reload,connect_vpn,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_triggered_new_tab,url_clear,clear_recycler,url_clear_at,remove_from_database,is_empty,
on_close_sesson,on_long_press,on_long_press_with_link,on_reset_app,on_bridge_mail,on_not_support,on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy,on_request_completed, on_update_history,on_update_suggestion,on_page_loaded,on_load_error,download_file_popup,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, data_cleared,on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy,on_request_completed, on_update_history,on_update_suggestion,on_page_loaded,on_load_error,download_file_popup,on_init_ads,rate_application,search_update, open_new_tab
}
public static class Theme {
public static final int THEME_LIGHT = 0;
public static final int THEME_DARK = 1;
public static final int THEME_DEFAULT = 2;
}
}

View File

@ -19,6 +19,7 @@ public class keys
public static final String PROXY_DO_NOT_TRACK_HEADER_VALUE = "privacy.donottrackheader.value";
public static final String PROXY_IS_APP_RATED = "IS_APP_RATED";
public static final String PROXY_LIST_TYPE = "list_type";
public static final String PROXY_IMAGE = "permissions.default.image";
/*Settings*/
@ -40,6 +41,16 @@ public class keys
public static final String SETTING_SEARCH_SUGGESTION = "SETTING_SEARCH_STATUS";
public static final String SETTING_ZOOM = "SETTING_ZOOM";
public static final String SETTING_VOICE_INPUT = "SETTING_VOICE_INPUT";
public static final String SETTING_TRACKING_PROTECTION = "SETTING_TRACKING_PROTECTION";
public static final String SETTING_DONOT_TRACK = "SETTING_DONOT_TRACK";
public static final String SETTING_RESTORE_TAB = "SETTING_RESTORE_TAB";
public static final String SETTING_CHARACTER_ENCODING = "SETTING_CHARACTER_ENCODING";
public static final String SETTING_SHOW_IMAGES = "SETTING_SHOW_IMAGES";
public static final String SETTING_SHOW_FONTS = "SETTING_SHOW_FONTS";
public static final String SETTING_AUTO_PLAY = "SETTING_AUTO_PLAY";
public static final String SETTING_THEME = "SETTING_THEME_LIGHT";
public static final String SETTING_FULL_SCREEN_BROWSIING = "SETTING_FULL_SCREEN_BROWSIING";
public static final String SETTING_OPEN_URL_IN_NEW_TAB = "SETTING_OPEN_URL_IN_NEW_TAB";
/*Bridge Settings*/

View File

@ -1,5 +1,7 @@
package com.darkweb.genesissearchengine.constants;
import android.content.res.Configuration;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
@ -11,8 +13,8 @@ public class status
{
/*App Status*/
public static String sAppCurrentABI = "7.0";
public static boolean sPaidStatus = false;
public static String sAppCurrentABI = "7.0";
/*Settings Status*/
@ -20,29 +22,41 @@ public class status
public static String sSettingRedirectStatus = strings.GENERIC_EMPTY_STR;
public static boolean sThemeChanged = false;
public static boolean sSettingEnableZoom = true;
public static boolean sSettingEnableVoiceInput = true;
public static boolean sSettingSearchHistory = false;
public static boolean getsSettingSearchSuggestion = false;
public static boolean sSettingJavaStatus = true;
public static boolean sSettingHistoryStatus = true;
public static boolean sClearOnExit = true;
public static boolean sSettingIsAppPaused = false;
public static boolean sSettingIsWelcomeEnabled = true;
public static boolean sSettingIsAppStarted = false;
public static boolean sSettingIsAppRated = false;
public static boolean sSettingFontAdjustable = true;
public static boolean sSettingFirstStart = true;
public static boolean sSettingTrackingProtection = true;
public static boolean sStatusDoNotTrack = true;
public static boolean sRestoreTabs = false;
public static boolean sCharacterEncoding = false;
public static boolean sShowWebFonts = false;
public static boolean sAutoPlay = false;
public static boolean sFullScreenBrowsing = false;
public static boolean sOpenURLInNewTab = false;
public static int sTheme = enums.Theme.THEME_DEFAULT;
public static int sSettingCookieStatus = ACCEPT_FIRST_PARTY;
public static int sShowImages = -1;
public static float sSettingFontSize = 1;
public static String sSettingLanguage = "en";
public static boolean sDefaultNightMode;
/*Bridge Status*/
public static int sBridgeNotificationManual = 0;
public static boolean sBridgeGatewayAuto = false;
public static boolean sBridgeGatewayManual = false;
public static boolean sBridgeVPNStatus = false;
public static boolean sBridgeStatus = false;
public static int sBridgeNotificationManual = 0;
public static String sBridgeCustomBridge = strings.BRIDGE_CUSTOM_BRIDGE_OBFS4;
@ -51,7 +65,7 @@ public class status
status.sSettingSearchHistory = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true));
status.getsSettingSearchSuggestion = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true));
status.sSettingJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true));
status.sSettingHistoryStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true));
status.sClearOnExit = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true));
status.sBridgeGatewayAuto = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_AUTO,true));
status.sBridgeGatewayManual = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
status.sSettingIsWelcomeEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true));
@ -62,7 +76,8 @@ public class status
status.sSettingFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FIRST_INSTALLED,true));
status.sSettingEnableZoom = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true));
status.sSettingEnableVoiceInput = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true));
status.sSettingTrackingProtection = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_TRACKING_PROTECTION,true));
status.sStatusDoNotTrack = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true));
status.sSettingCookieStatus = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
status.sSettingFontSize = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
@ -70,6 +85,15 @@ public class status
status.sSettingSearchStatus = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
status.sBridgeCustomBridge = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
status.sBridgeNotificationManual = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,0));
status.sRestoreTabs = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false));
status.sCharacterEncoding = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
status.sShowImages = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0));
status.sShowWebFonts = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,false));
status.sAutoPlay = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_AUTO_PLAY,false));
status.sFullScreenBrowsing = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,false));
status.sTheme = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_THEME,enums.Theme.THEME_DEFAULT));
status.sOpenURLInNewTab = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,false));
}
}

View File

@ -27,6 +27,7 @@ public class strings
public static final String SETTING_CUSTOM_FONTS = "Custom Font";
public static final String SETTING_PERCENT_SIGN = "%";
public static final String SETTING_DEFAULT_LANGUAGE = "en";
public static final String SETTING_DEFAULT_NEW_TAB_URL = "about:blank";
/*Home Manager*/

View File

@ -23,8 +23,10 @@ public class bookmarkDataModel {
return mBookmarks;
}
void addBookmark(String url, String title){
if(url.length()>1500){
void addBookmark(String pURL, String pTitle){
if(pURL.endsWith("about:blank"))
pURL = "about:blank";
if(pURL.length()>1500){
return;
}
int autoval = 0;
@ -38,20 +40,26 @@ public class bookmarkDataModel {
autoval = mBookmarks.get(0).getID()+1;
}
if(title.equals(""))
if(pTitle.equals(""))
{
title = "New_Bookmark"+autoval;
pTitle = "New_Bookmark"+autoval;
}
String[] params = new String[2];
params[0] = title;
params[1] = url;
params[0] = pTitle;
params[1] = pURL;
if(!pTitle.equals("loading")){
databaseController.getInstance().execSQL("INSERT INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params);
mBookmarks.add(0,new bookmarkRowModel(title, url,autoval));
}
mBookmarks.add(0,new bookmarkRowModel(pTitle, pURL,autoval));
}
void clearBookmark(int pID) {
void clearBookmark(){
mBookmarks.clear();
}
void deleteBookmark(int pID) {
for(int mCounter=0;mCounter<mBookmarks.size();mCounter++){
if(mBookmarks.get(mCounter).getID()==pID){
mBookmarks.remove(mCounter);
@ -60,15 +68,18 @@ public class bookmarkDataModel {
databaseController.getInstance().execSQL("delete from bookmark where id="+ pID,null);
}
public Object onTrigger(dataEnums.eBookmarkCommands p_commands, List<Object> p_data){
public Object onTrigger(dataEnums.eBookmarkCommands p_commands, List<Object> pData){
if(p_commands == dataEnums.eBookmarkCommands.M_GET_BOOKMARK){
return getBookmark();
}
if(p_commands == dataEnums.eBookmarkCommands.M_ADD_BOOKMARK){
addBookmark((String)p_data.get(0), (String)p_data.get(1));
addBookmark((String)pData.get(0), (String)pData.get(1));
}
if(p_commands == dataEnums.eBookmarkCommands.M_DELETE_BOOKMARK){
clearBookmark((int)p_data.get(0));
deleteBookmark((int)pData.get(0));
}
if(p_commands == dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK){
clearBookmark();
}
return null;

View File

@ -3,13 +3,8 @@ package com.darkweb.genesissearchengine.dataManager;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
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.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -18,11 +13,12 @@ public class dataController
{
/*Private Variables*/
private dataModel mDataModel;
private tabDataModel mTabModel;
private preferenceDataModel mPreferenceModel;
private historyDataModel mHistoryModel;
private imageCacheModel mImageCacheModel;
private bookmarkDataModel mBookMarkDataModel;
private suggestionDataModel mSuggestionDataModel;
/*Private Declarations*/
@ -36,15 +32,16 @@ public class dataController
public void initialize(AppCompatActivity app_context){
mHistoryModel = new historyDataModel();
mDataModel = new dataModel();
mTabModel = new tabDataModel();
mPreferenceModel = new preferenceDataModel(app_context);
mImageCacheModel = new imageCacheModel();
mBookMarkDataModel = new bookmarkDataModel();
mSuggestionDataModel = new suggestionDataModel();
}
public void initializeListData(){
mDataModel.initSuggestions();
invokeSuggestion(dataEnums.eSuggestionCommands.M_INIT_SUGGESTION, null);
mBookMarkDataModel.initializebookmark(databaseController.getInstance().selectBookmark());
if(!status.sSettingHistoryStatus)
if(!status.sClearOnExit)
{
mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY, Arrays.asList(databaseController.getInstance().selectHistory(0,constants.CONST_FETCHABLE_LIST_SIZE), databaseController.getInstance().getLargestHistoryID(),databaseController.getInstance().getLargestHistoryID()));
}
@ -74,71 +71,27 @@ public class dataController
return mPreferenceModel.onTrigger(p_commands, p_data);
}
/*Recieving History*/
public Object invokeBookmark(dataEnums.eBookmarkCommands p_commands, List<Object> p_data){
return mBookMarkDataModel.onTrigger(p_commands, p_data);
}
/*Recieving Suggestions*/
public ArrayList<historyRowModel> getSuggestions(){
return mDataModel.getmSuggestions();
}
/*Recieving Tabs*/
public ArrayList<tabRowModel> getTab(){
return mDataModel.getTab();
}
public void addTab(geckoSession mSession,boolean isHardCopy){
mDataModel.addTabs(mSession,isHardCopy);
}
public void clearTabs(){
mDataModel.clearTab();
}
public void closeTab(geckoSession session){
mDataModel.closeTab(session);
}
public void moveTabToTop(geckoSession session){
mDataModel.moveTabToTop(session);
}
public tabRowModel getCurrentTab(){
return mDataModel.getCurrentTab();
}
public int getTotalTabs(){
return mDataModel.getTotalTabs();
}
public void updateSuggestionURL(String url,String title) {
url = helperMethod.removeLastSlash(url);
mDataModel.updateSuggestionURL(url,title,false);
public Object invokeSuggestion(dataEnums.eSuggestionCommands p_commands, List<Object> p_data){
if(dataEnums.eSuggestionCommands.M_UPDATE_SUGGESTION.equals(p_commands)){
mSuggestionDataModel.onTrigger(p_commands, p_data);
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
}
public void addSuggesion(String url,String title) {
url = helperMethod.removeLastSlash(url);
mDataModel.addSuggenstions(url,title,false);
else if(dataEnums.eSuggestionCommands.M_ADD_SUGGESTION.equals(p_commands)){
mSuggestionDataModel.onTrigger(p_commands, p_data);
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
}else {
return mSuggestionDataModel.onTrigger(p_commands, p_data);
}
return null;
}
public Object invokeTab(dataEnums.eTabCommands p_commands, List<Object> p_data){
return mTabModel.onTrigger(p_commands, p_data);
}
}

View File

@ -18,4 +18,12 @@ public class dataEnums
public enum eImageCacheCommands{
M_SET_IMAGE, M_GET_IMAGE, M_CLEAR_IMAGE, M_CLEAR_OLD_IMAGES
}
public enum eSuggestionCommands{
M_UPDATE_SUGGESTION, M_CLEAR_SUGGESTION, M_INIT_SUGGESTION, M_ADD_SUGGESTION, M_GET_SUGGESTION
}
public enum eTabCommands{
M_ADD_TAB, M_CLEAR_TAB, M_CLOSE_TAB_PARAMETERIZED, CLOSE_TAB, GET_TAB, GET_CURRENT_TAB, GET_TOTAL_TAB, MOVE_TAB_TO_TOP
}
}

View File

@ -29,7 +29,7 @@ public class historyDataModel {
m_max_history_Id = pMaxHistoryId;
m_history_size = pHistorySize;
this.m_history = history;
if(!status.sSettingHistoryStatus){
if(!status.sClearOnExit){
initializeCache(history);
}else {
clearHistory();
@ -117,7 +117,11 @@ public class historyDataModel {
m_history_size += 1;
String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime());
if(!p_header.equals("loading")){
databaseController.getInstance().execSQL("INSERT INTO history(id,date,url,title) VALUES("+ m_max_history_Id +",'" + m_date + "',?,?);",params);
}
m_history.add(0,new historyRowModel(p_header,p_url, m_max_history_Id));
m_history_cache.put(m_max_history_Id,m_history.get(0));
removeDuplicateURLFromHistory(m_max_history_Id, p_url);

View File

@ -1,149 +1,18 @@
package com.darkweb.genesissearchengine.dataManager;
import android.annotation.SuppressLint;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
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.helperManager.helperMethod;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@SuppressLint("CommitPrefEdits")
class dataModel
{
private ArrayList<tabRowModel> mTabs = new ArrayList<>();
public class suggestionDataModel {
private ArrayList<historyRowModel> mSuggestions = new ArrayList<>();
private Map<String, historyRowModel> mSuggestionCache = new HashMap<>();
/*List History*/
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);
if(!newURL.equals("loading"))
model.setHeader(newURL);
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,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);
mSuggestionCache.put(url, model);
mSuggestions.add(0, mSuggestionCache.get(url));
}
else {
updateSuggestionURL(url,title,isLoading);
}
String[] params = new String[2];
params[0] = title;
params[1] = url;
if(title.length()>0 && !isLoading){
//databaseController.getInstance().execSQL("UPDATE history SET title = ? , date = DateTime('now') WHERE url = ?",params);
}
}
/*List Tabs*/
void addTabs(geckoSession mSession,boolean isHardCopy){
if(!isHardCopy){
mTabs.add(0,new tabRowModel(mSession,mTabs.size()));
}
else {
mTabs.add(0,new tabRowModel(mSession,mTabs.size()));
}
}
ArrayList<tabRowModel> getTab(){
return mTabs;
}
void clearTab() {
int size = mTabs.size();
for(int counter = 0; counter< size; counter++){
mTabs.get(0).getSession().stop();
mTabs.remove(0);
}
if(mTabs.size()>0){
//Log.i("FUCKERRROR125:","_FERROR_");
mTabs.get(0).getSession().closeSession();
}
}
void closeTab(geckoSession mSession) {
for(int counter = 0; counter< mTabs.size(); counter++){
if(mTabs.get(counter).getSession().getSessionID()==mSession.getSessionID())
{
mTabs.remove(counter);
break;
}
else {
mTabs.get(counter).setId(mTabs.get(counter).getmId()+1);
}
}
}
void moveTabToTop(geckoSession mSession) {
for(int counter = 0; counter< mTabs.size(); counter++){
if(mTabs.get(counter).getSession().getSessionID()==mSession.getSessionID())
{
/***BIG PROBLEM***/
mTabs.remove(counter);
mTabs.add(0,new tabRowModel(mSession,0));
break;
}else {
mTabs.get(counter).setId(mTabs.get(counter).getmId()+1);
}
}
}
tabRowModel getCurrentTab(){
if(mTabs.size()>0){
return mTabs.get(0);
}
else {
return null;
}
}
int getTotalTabs(){
return mTabs.size();
}
/*List Suggestion*/
ArrayList<historyRowModel> getmSuggestions(){
return mSuggestions;
}
void clearSuggestion(){
mSuggestions.clear();
initSuggestions();
}
void initSuggestions(){
private void initSuggestions(){
addSuggenstions("https://duckduckgo.com","Duckduckgo",true);
addSuggenstions("https://bbc.com","BBC",true);
@ -250,4 +119,70 @@ class dataModel
addSuggenstions("https://boogle.store","Genesis Search",true);
}
private void addSuggenstions(String url, String title,boolean isLoading){
url = helperMethod.removeLastSlash(url);
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);
mSuggestionCache.put(url, model);
mSuggestions.add(0, mSuggestionCache.get(url));
}
else {
updateSuggestionURL(url,title);
}
}
private void clearSuggestion(){
mSuggestions.clear();
initSuggestions();
}
private void updateSuggestionURL(String url, String newURL){
url = helperMethod.removeLastSlash(url);
if(url.length()>1500){
return;
}
url = helperMethod.removeLastSlash(url);
url = helperMethod.urlWithoutPrefix(url);
historyRowModel model = mSuggestionCache.get(url);
if(model!=null){
mSuggestionCache.remove(url);
if(!newURL.equals("loading"))
model.setHeader(newURL);
mSuggestionCache.put(url,model);
}
}
private ArrayList<historyRowModel> getmSuggestions(){
return mSuggestions;
}
public Object onTrigger(dataEnums.eSuggestionCommands p_commands, List<Object> p_data){
if(p_commands.equals(dataEnums.eSuggestionCommands.M_CLEAR_SUGGESTION)){
clearSuggestion();
}
else if(p_commands.equals(dataEnums.eSuggestionCommands.M_INIT_SUGGESTION)){
initSuggestions();
}
else if(p_commands.equals(dataEnums.eSuggestionCommands.M_GET_SUGGESTION)){
return getmSuggestions();
}
else if(p_commands.equals(dataEnums.eSuggestionCommands.M_UPDATE_SUGGESTION)){
updateSuggestionURL((String)p_data.get(0),(String) p_data.get(1));
}
else if(p_commands.equals(dataEnums.eSuggestionCommands.M_ADD_SUGGESTION)){
addSuggenstions((String)p_data.get(0),(String) p_data.get(1),true);
}
return null;
}
}

View File

@ -0,0 +1,108 @@
package com.darkweb.genesissearchengine.dataManager;
import android.annotation.SuppressLint;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession;
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
import java.util.ArrayList;
import java.util.List;
@SuppressLint("CommitPrefEdits")
class tabDataModel
{
private ArrayList<tabRowModel> mTabs = new ArrayList<>();
/*List Tabs*/
void addTabs(geckoSession mSession,boolean isHardCopy){
if(!isHardCopy){
mTabs.add(0,new tabRowModel(mSession,mTabs.size()));
}
else {
mTabs.add(0,new tabRowModel(mSession,mTabs.size()));
}
}
ArrayList<tabRowModel> getTab(){
return mTabs;
}
void clearTab() {
int size = mTabs.size();
for(int counter = 0; counter< size; counter++){
mTabs.get(0).getSession().stop();
mTabs.remove(0);
}
if(mTabs.size()>0){
mTabs.get(0).getSession().closeSession();
}
}
void closeTab(geckoSession mSession) {
for(int counter = 0; counter< mTabs.size(); counter++){
if(mTabs.get(counter).getSession().getSessionID()==mSession.getSessionID())
{
mTabs.remove(counter);
break;
}
else {
mTabs.get(counter).setId(mTabs.get(counter).getmId()+1);
}
}
}
void moveTabToTop(geckoSession mSession) {
for(int counter = 0; counter< mTabs.size(); counter++){
if(mTabs.get(counter).getSession().getSessionID()==mSession.getSessionID())
{
/* BIG PROBLEM */
mTabs.remove(counter);
mTabs.add(0,new tabRowModel(mSession,0));
break;
}else {
mTabs.get(counter).setId(mTabs.get(counter).getmId()+1);
}
}
}
tabRowModel getCurrentTab(){
if(mTabs.size()>0){
return mTabs.get(0);
}
else {
return null;
}
}
int getTotalTabs(){
return mTabs.size();
}
/*List Suggestion*/
public Object onTrigger(dataEnums.eTabCommands p_commands, List<Object> p_data){
if(p_commands == dataEnums.eTabCommands.GET_TOTAL_TAB){
return getTotalTabs();
}
else if(p_commands == dataEnums.eTabCommands.GET_CURRENT_TAB){
return getCurrentTab();
}
else if(p_commands == dataEnums.eTabCommands.MOVE_TAB_TO_TOP){
moveTabToTop((geckoSession)p_data.get(0));
}
else if(p_commands == dataEnums.eTabCommands.CLOSE_TAB){
closeTab((geckoSession)p_data.get(0));
}
else if(p_commands == dataEnums.eTabCommands.M_CLEAR_TAB){
clearTab();
}
else if(p_commands == dataEnums.eTabCommands.M_CLOSE_TAB_PARAMETERIZED){
closeTab((geckoSession)p_data.get(0));
}
else if(p_commands == dataEnums.eTabCommands.M_ADD_TAB){
addTabs((geckoSession)p_data.get(0), (boolean)p_data.get(1));
}
else if(p_commands == dataEnums.eTabCommands.GET_TAB){
return getTab();
}
return null;
}
}

View File

@ -0,0 +1,25 @@
package com.darkweb.genesissearchengine.helperManager;
import android.os.Build;
import android.os.CancellationSignal;
import android.service.autofill.AutofillService;
import android.service.autofill.FillCallback;
import android.service.autofill.FillRequest;
import android.service.autofill.SaveCallback;
import android.service.autofill.SaveRequest;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
@RequiresApi(api = Build.VERSION_CODES.O)
public class autoFillService extends AutofillService {
@Override
public void onFillRequest(@NonNull FillRequest request, @NonNull CancellationSignal cancellationSignal, @NonNull FillCallback callback) {
}
@Override
public void onSaveRequest(@NonNull SaveRequest request, @NonNull SaveCallback callback) {
}
}

View File

@ -61,12 +61,14 @@ public class helperMethod
{
/*Helper Methods General*/
public static String completeURL(String url){
public static String completeURL(String pURL){
if(pURL.equals("about:blank")){
return pURL;
}
URL weburl = null;
try
{
weburl = new URL(url);
weburl = new URL(pURL);
URLConnection result = weburl.openConnection();
if (result instanceof HttpsURLConnection) {
@ -83,16 +85,16 @@ public class helperMethod
e.printStackTrace();
}
if(!url.startsWith("www.")&& !url.startsWith("http://")&& !url.startsWith("https://")){
url = ""+url;
if(!pURL.startsWith("www.")&& !pURL.startsWith("http://")&& !pURL.startsWith("https://")){
pURL = ""+pURL;
}
if(!url.startsWith("http://")&&!url.startsWith("https://")){
url = "http://"+url;
if(!pURL.startsWith("http://")&&!pURL.startsWith("https://")){
pURL = "http://"+pURL;
}
return url;
return pURL;
}
public static SpannableString urlDesigner(String url){
public static SpannableString urlDesigner(String url, Context pContext){
if (url.contains("https://"))
{
@ -109,7 +111,7 @@ public class helperMethod
} else
{
SpannableString ss = new SpannableString(url);
ss.setSpan(new ForegroundColorSpan(Color.BLACK), 0, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
ss.setSpan(new ForegroundColorSpan(pContext.getResources().getColor(R.color.c_text_v1)), 0, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return ss;
}
}
@ -255,6 +257,11 @@ public class helperMethod
context.startActivity(myIntent);
}
public static void restartActivity( Intent pIntent, AppCompatActivity pContext){
pContext.finish();
pContext.startActivity(pIntent);
}
public static void onMinimizeApp(AppCompatActivity context){
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
@ -274,6 +281,23 @@ public class helperMethod
return rotate;
}
public static void openNotification(AppCompatActivity pContext)
{
Intent intent = new Intent();
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("android.provider.extra.APP_PACKAGE", pContext.getPackageName());
pContext.startActivity(intent);
}
public static String ellipsize(String input, int maxLength) {
String ellip = "...";
if (input == null || input.length() <= maxLength
|| input.length() < ellip.length()) {
return input;
}
return input.substring(0, maxLength - ellip.length()).concat(ellip);
}
public static String getDomainName(String url)
{
try{

View File

@ -1,18 +1,16 @@
package com.darkweb.genesissearchengine.pluginManager;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.google.android.gms.ads.*;
import static com.darkweb.genesissearchengine.constants.status.paid_status;
import static com.darkweb.genesissearchengine.constants.status.sPaidStatus;
class adManager
{
/*Private Variables*/
/*Private Variables */
private AppCompatActivity mAppContext;
private eventObserver.eventListener mEvent;
@ -29,12 +27,12 @@ class adManager
}
void loadAds(){
if(!paid_status)
if(!sPaidStatus)
{
if (!bannerAdsLoading)
{
bannerAdsLoading = true;
MobileAds.initialize(mAppContext, constants.ADMOB_KEY);
MobileAds.initialize(mAppContext, constants.CONST_ADMOB_KEY);
mBannerAds.setAlpha(0f);
initializeBannerAds();
}
@ -48,7 +46,7 @@ class adManager
/*Local Helper Methods*/
private void admobListeners(){
if(!paid_status){
if(!sPaidStatus){
mBannerAds.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
@ -83,7 +81,7 @@ class adManager
/*External Helper Methods*/
private void initializeBannerAds(){
if(!paid_status){
if(!sPaidStatus){
AdRequest request = new AdRequest.Builder().addTestDevice("E731DE5933CDC0E42B335787CE3E23EF").build();
mBannerAds.loadAd(request);
admobListeners();

View File

@ -1,91 +0,0 @@
package com.darkweb.genesissearchengine.pluginManager;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.google.android.gms.ads.*;
import static com.darkweb.genesissearchengine.constants.status.sPaidStatus;
class adManager
{
/*Private Variables */
private AppCompatActivity mAppContext;
private eventObserver.eventListener mEvent;
private AdView mBannerAds;
private boolean bannerAdsLoading = false;
private boolean bannerAdsLoaded = false;
/*Initializations*/
adManager(AppCompatActivity app_context, eventObserver.eventListener event, AdView banner_ads) {
this.mAppContext = app_context;
this.mEvent = event;
mBannerAds = banner_ads;
}
void loadAds(){
if(!sPaidStatus)
{
if (!bannerAdsLoading)
{
bannerAdsLoading = true;
MobileAds.initialize(mAppContext, constants.CONST_ADMOB_KEY);
mBannerAds.setAlpha(0f);
initializeBannerAds();
}
}
}
boolean isAdvertLoaded(){
return bannerAdsLoaded;
}
/*Local Helper Methods*/
private void admobListeners(){
if(!sPaidStatus){
mBannerAds.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
bannerAdsLoaded = true;
mEvent.invokeObserver(null,null);
}
@Override
public void onAdFailedToLoad(int errorCode) {
//Log.i("Failure___",""+errorCode);
}
@Override
public void onAdOpened() {
}
@Override
public void onAdClicked() {
}
@Override
public void onAdLeftApplication() {
}
@Override
public void onAdClosed() {
}
});
}
}
/*External Helper Methods*/
private void initializeBannerAds(){
if(!sPaidStatus){
AdRequest request = new AdRequest.Builder().addTestDevice("E731DE5933CDC0E42B335787CE3E23EF").build();
mBannerAds.loadAd(request);
admobListeners();
}
}
}

View File

@ -3,7 +3,6 @@ package com.darkweb.genesissearchengine.pluginManager;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.appcompat.app.AppCompatActivity;
import com.crashlytics.android.Crashlytics;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
@ -11,7 +10,7 @@ import java.util.UUID;
class analyticManager
{
/*Private Variables*/
/*Private Variables */
private AppCompatActivity mAppContext;
private String mUniqueID = null;
@ -24,7 +23,7 @@ class analyticManager
}
private void initialize(){
final String PREF_UNIQUE_ID = constants.UNIQUE_KEY_ID;
final String PREF_UNIQUE_ID = constants.CONST_UNIQUE_KEY_ID;
if (mUniqueID == null)
{
@ -53,9 +52,6 @@ class analyticManager
/*Helper Methods*/
void logUser(){
Crashlytics.setUserIdentifier(mUniqueID);
Crashlytics.setUserEmail(constants.USER_EMAIL);
Crashlytics.setUserName(mUniqueID);
}
}

View File

@ -1,57 +0,0 @@
package com.darkweb.genesissearchengine.pluginManager;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import java.util.UUID;
class analyticManager
{
/*Private Variables */
private AppCompatActivity mAppContext;
private String mUniqueID = null;
/*Initializations*/
analyticManager(AppCompatActivity app_context, eventObserver.eventListener event){
this.mAppContext = app_context;
initialize();
}
private void initialize(){
final String PREF_UNIQUE_ID = constants.CONST_UNIQUE_KEY_ID;
if (mUniqueID == null)
{
SharedPreferences sharedPrefs = mAppContext.getSharedPreferences(
PREF_UNIQUE_ID, Context.MODE_PRIVATE);
mUniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null);
if (mUniqueID == null) {
new Thread(){
public void run(){
try{
mUniqueID = UUID.randomUUID().toString();
}catch (Exception ex){
mUniqueID = UUID.randomUUID().toString();
}
SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putString(PREF_UNIQUE_ID, mUniqueID);
editor.apply();
}
}.start();
}
}
}
/*Helper Methods*/
void logUser(){
}
}

View File

@ -79,11 +79,11 @@ class messageManager
});
}
@SuppressLint("QueryPermissionsNeeded")
private void abiError()
{
initializeDialog(R.layout.popup_abi_error, Gravity.CENTER);
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> dialog.dismiss());
dialog.findViewById(R.id.pOption2).setOnClickListener(v -> {
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
dialog.dismiss();
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_GENESIS_UPDATE_URL + status.sAppCurrentABI));
if(browserIntent.resolveActivity(app_context.getPackageManager()) != null)
@ -136,6 +136,12 @@ class messageManager
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
}
private void dataClearedSuccessfully()
{
initializeDialog(R.layout.popup_data_cleared, Gravity.BOTTOM);
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
}
@SuppressLint("ResourceType")
private void bookmark()
{
@ -211,6 +217,7 @@ class messageManager
});
}
@SuppressLint("QueryPermissionsNeeded")
private void rateApp()
{
initializeDialog(R.layout.popup_rate_us, Gravity.CENTER);
@ -251,12 +258,12 @@ class messageManager
String title = data.get(1);
int size = name.length();
if(size>35){
size = 35;
if(size>235){
size = 235;
}
initializeDialog(R.layout.popup_file_longpress, Gravity.CENTER);
((TextView)dialog.findViewById(R.id.pDescription)).setText((title + data.get(0).substring(0,size)+"..."));
((TextView)dialog.findViewById(R.id.pDescription)).setText((title + " | " + data.get(0).substring(0,size)+"..."));
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
event.invokeObserver(Collections.singletonList(data.get(0)), enums.etype.download_file_manual);
@ -281,8 +288,8 @@ class messageManager
int size = data.get(0).length()-1;
String title = data.get(1);
if(size>35){
size = 35;
if(size>235){
size = 235;
}
initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER);
@ -303,7 +310,6 @@ class messageManager
}
private void popupDownloadFull(){
String url = data.get(0);
String file = data.get(1);
String title = data.get(2);
@ -311,25 +317,28 @@ class messageManager
String data_local = app_context.getString(R.string.ALERT_LONG_URL_MESSAGE);
int size = url.length();
if(size>35){
size = 35;
if(size>235){
size = 235;
}
int size1 = file.length();
if(size1>35){
size1 = 35;
if(size1>235){
size1 = 235;
}
if(!url.equals("")){
data_local = title + url.substring(0,size)+"...";
}
else if(!file.equals("")){
data_local = title + file.substring(0,size1)+"...";
data_local = file.substring(0,size1)+"...";
}
String mTitle = title;
if(mTitle.length()<=1){
mTitle = data.get(0).substring(0,size)+"...";
}
initializeDialog(R.layout.popup_url_longpress, Gravity.CENTER);
((TextView)dialog.findViewById(R.id.pHeader)).setText((title + data.get(0).substring(0,size)+"..."));
initializeDialog(R.layout.popup_download_full, Gravity.CENTER);
((TextView)dialog.findViewById(R.id.pHeader)).setText(mTitle);
((TextView)dialog.findViewById(R.id.pDescription)).setText((data_local));
dialog.findViewById(R.id.pDismiss).setOnClickListener(v -> dialog.dismiss());
dialog.findViewById(R.id.pOption1).setOnClickListener(v -> {
@ -465,6 +474,10 @@ class messageManager
case on_not_support:
notSupportMessage();
break;
case data_cleared:
dataClearedSuccessfully();
break;
}
}
}

View File

@ -5,6 +5,7 @@ import android.content.Intent;
import android.os.Build;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
@ -41,8 +42,8 @@ class orbotManager
}
void startOrbot(Context context){
orbotLocalConstants.bridges = status.sBridgeCustomBridge;
orbotLocalConstants.sIsManualBridge = status.sBridgeGatewayManual;
orbotLocalConstants.mBridges = status.sBridgeCustomBridge;
orbotLocalConstants.mIsManualBridge = status.sBridgeGatewayManual;
this.mAppContext = context;
Prefs.putBridgesEnabled(status.sBridgeGatewayManual |status.sBridgeGatewayAuto);
Intent mServiceIntent = new Intent(context, OrbotService.class);
@ -58,10 +59,10 @@ class orbotManager
}
int getNotificationStatus(){
return orbotLocalConstants.sNotificationStatus;
return orbotLocalConstants.mNotificationStatus;
}
void initNotification(int status){
orbotLocalConstants.sNotificationStatus = status;
orbotLocalConstants.mNotificationStatus = status;
}
void enableTorNotification(){
OrbotService.getServiceObject().enableNotification();
@ -129,20 +130,22 @@ class orbotManager
setPrivacyPrefs();
}
private void setPrivacyPrefs ()
public void setPrivacyPrefs ()
{
PrefsHelper.setPref(keys.PROXY_IMAGE, status.sShowImages);
PrefsHelper.setPref("browser.display.show_image_placeholders",true);
PrefsHelper.setPref("browser.cache.disk.enable",false);
PrefsHelper.setPref("browser.cache.memory.enable",true);
PrefsHelper.setPref("browser.cache.disk.capacity",0);
PrefsHelper.setPref("privacy.resistFingerprinting",true);
PrefsHelper.setPref("privacy.clearOnShutdown.cache",status.sSettingHistoryStatus);
PrefsHelper.setPref("privacy.clearOnShutdown.downloads",status.sSettingHistoryStatus);
PrefsHelper.setPref("privacy.clearOnShutdown.formdata",status.sSettingHistoryStatus);
PrefsHelper.setPref("privacy.clearOnShutdown.history",status.sSettingHistoryStatus);
PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",status.sSettingHistoryStatus);
PrefsHelper.setPref("privacy.clearOnShutdown.passwords",status.sSettingHistoryStatus);
PrefsHelper.setPref("privacy.clearOnShutdown.sessions",status.sSettingHistoryStatus);
PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",status.sSettingHistoryStatus);
PrefsHelper.setPref("privacy.clearOnShutdown.cache",status.sClearOnExit);
PrefsHelper.setPref("privacy.clearOnShutdown.downloads",status.sClearOnExit);
PrefsHelper.setPref("privacy.clearOnShutdown.formdata",status.sClearOnExit);
PrefsHelper.setPref("privacy.clearOnShutdown.history",status.sClearOnExit);
PrefsHelper.setPref("privacy.clearOnShutdown.offlineApps",status.sClearOnExit);
PrefsHelper.setPref("privacy.clearOnShutdown.passwords",status.sClearOnExit);
PrefsHelper.setPref("privacy.clearOnShutdown.sessions",status.sClearOnExit);
PrefsHelper.setPref("privacy.clearOnShutdown.siteSettings",status.sClearOnExit);
PrefsHelper.setPref("privacy.donottrackheader.enabled",false);
PrefsHelper.setPref("privacy.donottrackheader.value",1);
PrefsHelper.setPref("network.http.sendRefererHeader", 0);
@ -155,7 +158,7 @@ class orbotManager
String getLogs()
{
String logs = orbotLocalConstants.tor_logs_status;
String logs = orbotLocalConstants.mTorLogsStatus;
if(!logs.contains("Bootstrapped") && !mLogsStarted){
logs = "Initializing Bootstrap";
@ -178,7 +181,7 @@ class orbotManager
}
boolean isOrbotRunning(){
return orbotLocalConstants.sIsTorInitialized;
return orbotLocalConstants.mIsTorInitialized;
}
}

View File

@ -121,6 +121,9 @@ public class pluginController
public void setProxy(String url){
orbotManager.getInstance().setProxy(url);
}
public void updatePrivacy(){
orbotManager.getInstance().setPrivacyPrefs();
}
public String orbotLogs(){
return orbotManager.getInstance().getLogs();
}
@ -245,7 +248,7 @@ public class pluginController
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null);
mContextManager.getHistoryController().onclearData();
mHomeController.onClearSession();
dataController.getInstance().clearTabs();
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mHomeController.initTab(false);
}
else if(event_type.equals(enums.etype.clear_bookmark)){
@ -283,7 +286,7 @@ public class pluginController
helperMethod.copyURL(data.get(0).toString(),mContextManager.getHomeController());
}
else if(event_type.equals(enums.etype.clear_tab)){
dataController.getInstance().clearTabs();
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mHomeController.initTab(true);
activityContextManager.getInstance().getTabController().finish();
}

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator">
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="100"
android:fromAlpha="0.1"
android:toAlpha="1.0">
</alpha>
android:fromAlpha="0.5"
android:interpolator="@android:anim/linear_interpolator"
android:toAlpha="1.0" />
</set>

View File

@ -0,0 +1,7 @@
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="100"
android:fromAlpha="1.0"
android:interpolator="@android:anim/linear_interpolator"
android:toAlpha="0.5" />
</set>

View File

@ -1,5 +1,5 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/button_gray">
android:color="@color/c_view_divier_background">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/button_gray" />

View File

@ -1,5 +1,5 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/button_gray">
android:color="@color/c_ripple">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/button_gray" />

View File

@ -0,0 +1,13 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/c_ripple">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/c_button_text_v2" />
<corners
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp"/>
</shape>
</item>
</ripple>

View File

@ -1,11 +1,11 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/button_gray">
android:color="@color/c_ripple">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/button_gray" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="4dp"
android:bottomLeftRadius="4dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp"/>
</shape>

View File

@ -1,11 +1,11 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/button_gray">
android:color="@color/c_ripple">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/button_gray" />
<solid android:color="@color/c_button_text_v2" />
<corners
android:bottomLeftRadius="4dp"
android:bottomRightRadius="0dp"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp"/>
</shape>

View File

@ -5,7 +5,7 @@
android:top="113dp">
<shape
android:shape="rectangle" android:padding="10dp" >
<solid android:color="@color/button_gray"/>
<solid android:color="@color/c_edittext_background"/>
<corners android:radius="5dp"/>
</shape>
</item>
@ -13,7 +13,7 @@
android:top="113dp">
<shape
android:shape="rectangle" android:padding="10dp">
<solid android:color="@color/white_dark"/>
<solid android:color="@color/c_edittext_background"/>
<corners android:radius="5dp"/>
</shape>
</item>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:top="113dp">
<shape
android:shape="rectangle" android:padding="10dp" >
<solid android:color="@color/c_border_background"/>
<corners android:radius="0dp"/>
</shape>
</item>
<item android:state_pressed="false"
android:top="113dp">
<shape
android:shape="rectangle" android:padding="10dp">
<solid android:color="@color/c_border_background"/>
<corners android:radius="0dp"/>
</shape>
</item>
</selector>

Some files were not shown because too many files have changed in this diff Show More