Bug Fixes

Bug Fixes
master
msmannan00 2021-04-12 00:25:15 +05:00
parent c267a8f4eb
commit a928d311ca
87 changed files with 1409 additions and 817 deletions

View File

@ -29,5 +29,6 @@
<option name="useQualifiedModuleNames" value="true" /> <option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings> </GradleProjectSettings>
</option> </option>
<option name="offlineMode" value="true" />
</component> </component>
</project> </project>

Binary file not shown.

View File

@ -0,0 +1,18 @@
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.darkweb.genesissearchengine",
"variantName": "processAarch64ReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 600,
"versionName": "600.0",
"outputFile": "app-aarch64-release.apk"
}
]
}

View File

@ -139,7 +139,7 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalNavigationController"> <activity android:name="com.darkweb.genesissearchengine.externalNavigationManager.externalNavigationController">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
@ -185,15 +185,6 @@
android:name="com.google.android.gms.ads.APPLICATION_ID" android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-5074525529134731~2926711128" /> 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"
android:stopWithTask="true">
<intent-filter>
<action android:name="android.service.autofill.AutofillService" />
</intent-filter>
</service>
<service <service
android:name="com.darkweb.genesissearchengine.helperManager.downloadFileService" android:name="com.darkweb.genesissearchengine.helperManager.downloadFileService"
android:enabled="true" android:enabled="true"

View File

@ -32,7 +32,7 @@
<body class="clear_selection" id="pBody"> <body class="clear_selection" id="pBody">
<div class="hi_container_size"> <div class="hi_container_size">
<!--top bar--> <!--top bar-->
<p class="lh_light_header gs-disable-highlight" id="lh_light_header_identifier"> <p class="lh_light_header gs-disable-highlight" id="">
<span ><a href="https://boogle.store/search?q=random&p_num=1&s_type=image" class="lh_light_header__catagory lh_light_header__catagory_image">Images</a></span> <span ><a href="https://boogle.store/search?q=random&p_num=1&s_type=image" class="lh_light_header__catagory lh_light_header__catagory_image">Images</a></span>
<span ><a href="http://protonirockerxow.onion" class="lh_light_header__catagory lh_light_header__catagory_bold_mobile">Proton Mail</a></span> <span ><a href="http://protonirockerxow.onion" class="lh_light_header__catagory lh_light_header__catagory_bold_mobile">Proton Mail</a></span>
<span ><a href="https://www.bitfinex.com/" class="lh_light_header__catagory lh_light_header__bold lh_light_header__catagory-spacing-right" id="mobid">Bitcoin Market</a></span> <span ><a href="https://www.bitfinex.com/" class="lh_light_header__catagory lh_light_header__bold lh_light_header__catagory-spacing-right" id="mobid">Bitcoin Market</a></span>

View File

@ -21,7 +21,7 @@
text-align: right; text-align: right;
padding-top: 0px; padding-top: 0px;
border-bottom-color:#121212 !important; border-bottom-color:#121212 !important;
padding-top: 11px; padding-top: 10px;
padding-bottom: 15px; padding-bottom: 15px;
border-style: solid;border-right-width: 0; border-style: solid;border-right-width: 0;
border-left-width: 0;border-top-width: 0; border-left-width: 0;border-top-width: 0;
@ -31,7 +31,7 @@
@media only screen and (max-width: 943px) { @media only screen and (max-width: 943px) {
.lh_light_header { .lh_light_header {
border-bottom-width: 1px; border-bottom-width: 1px;
padding-bottom: 12px; padding-bottom: 15px;
} }
} }
@ -66,11 +66,11 @@
color: darkslategray; color: darkslategray;
text-decoration: none !important; text-decoration: none !important;
border-bottom: 4px solid lightslategray; border-bottom: 4px solid lightslategray;
background: whitesmoke; background: #18171c;
} }
.lh_light_header__catagory:focus{ .lh_light_header__catagory:focus{
color: darkslategray; color: darkslategray;
text-decoration: none !important; text-decoration: none !important;
border-bottom: 4px solid lightslategray; border-bottom: 4px solid lightslategray;
background: whitesmoke; background: #18171c;
} }

View File

@ -16,7 +16,7 @@
text-align: right; text-align: right;
padding-top: 0px; padding-top: 0px;
border-bottom-color:#efefef; border-bottom-color:#efefef;
padding-top: 11px; padding-top: 10px;
padding-bottom: 15px; padding-bottom: 15px;
border-style: solid;border-right-width: 0; border-style: solid;border-right-width: 0;
border-left-width: 0;border-top-width: 0; border-left-width: 0;border-top-width: 0;
@ -26,7 +26,7 @@
@media only screen and (max-width: 943px) { @media only screen and (max-width: 943px) {
.lh_light_header { .lh_light_header {
border-bottom-width: 1px; border-bottom-width: 1px;
padding-bottom: 12px; padding-bottom: 15px;
} }
} }

View File

@ -9,29 +9,31 @@ import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogContro
import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController; import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController;
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingHomeController; import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingHomeController;
import com.darkweb.genesissearchengine.appManager.tabManager.tabController; import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
public class activityContextManager public class activityContextManager
{ {
/*Private Variables*/ /*Private Variables*/
private static final activityContextManager ourInstance = new activityContextManager(); private static activityContextManager ourInstance = new activityContextManager();
public static activityContextManager getInstance() public static activityContextManager getInstance()
{ {
return ourInstance; return ourInstance;
} }
/*Private Contexts*/ /*Private Contexts*/
private bridgeController pBridgeController; private WeakReference<bridgeController> pBridgeController;
private historyController pHistoryController; private WeakReference<historyController> pHistoryController;
private bookmarkController pBookmarkController; private WeakReference<bookmarkController> pBookmarkController;
private homeController pHomeController; private WeakReference<homeController> pHomeController;
private tabController pTabController; private WeakReference<tabController> pTabController;
private android.app.Activity pCurrentActivity = null; private WeakReference<android.app.Activity> pCurrentActivity = null;
private settingHomeController pSettingController; private WeakReference<settingHomeController> pSettingController;
private settingGeneralController pSettingGeneralController; private WeakReference<settingGeneralController> pSettingGeneralController;
private orbotLogController pOrbotLogController; private WeakReference<orbotLogController> pOrbotLogController;
private ArrayList<AppCompatActivity> mStackList; private ArrayList<WeakReference<AppCompatActivity>> mStackList;
/*Initialization*/ /*Initialization*/
@ -42,85 +44,128 @@ public class activityContextManager
/*List ContextGetterSetters*/ /*List ContextGetterSetters*/
public historyController getHistoryController(){ public historyController getHistoryController(){
return pHistoryController; if(pHistoryController==null){
return null;
}
return pHistoryController.get();
} }
public void setHistoryController(historyController history_controller){ public void setHistoryController(historyController history_controller){
this.pHistoryController = history_controller; this.pHistoryController = new WeakReference(history_controller);
} }
public bookmarkController getBookmarkController(){ public bookmarkController getBookmarkController(){
return pBookmarkController; if(pBookmarkController==null){
return null;
}
return pBookmarkController.get();
} }
public void setBookmarkController(bookmarkController bookmark_controller){ public void setBookmarkController(bookmarkController bookmark_controller){
this.pBookmarkController = bookmark_controller; this.pBookmarkController = new WeakReference(bookmark_controller);
} }
public bridgeController getBridgeController(){ public bridgeController getBridgeController(){
return pBridgeController; if(pBridgeController==null){
return null;
}
return pBridgeController.get();
} }
public void setBridgeController(bridgeController bridge_controller){ public void setBridgeController(bridgeController bridge_controller){
this.pBridgeController = bridge_controller; this.pBridgeController = new WeakReference(bridge_controller);
} }
public homeController getHomeController(){ public homeController getHomeController(){
return pHomeController; if(pHomeController==null){
return null;
}
return pHomeController.get();
} }
public void setHomeController(homeController home_controller){ public void setHomeController(homeController home_controller){
this.pHomeController = home_controller; this.pHomeController = new WeakReference(home_controller);
} }
public tabController getTabController(){ public tabController getTabController(){
return pTabController; if(pTabController==null){
return null;
}
return pTabController.get();
} }
public void setTabController(tabController tab_controller){ public void setTabController(tabController tab_controller){
this.pTabController = tab_controller; this.pTabController = new WeakReference(tab_controller);
} }
public orbotLogController getOrbotLogController(){ public orbotLogController getOrbotLogController(){
return pOrbotLogController; if(pOrbotLogController==null){
return null;
}
return pOrbotLogController.get();
} }
public void setOrbotLogController(orbotLogController pOrbotLogController){ public void setOrbotLogController(orbotLogController pOrbotLogController){
this.pOrbotLogController = pOrbotLogController; this.pOrbotLogController = new WeakReference(pOrbotLogController);
} }
public settingGeneralController getSettingGeneralController(){ public settingGeneralController getSettingGeneralController(){
return pSettingGeneralController; if(pSettingGeneralController==null){
return null;
}
return pSettingGeneralController.get();
} }
public void setSettingGeneralController(settingGeneralController pSettingGeneralController){ public void setSettingGeneralController(settingGeneralController pSettingGeneralController){
this.pSettingGeneralController = pSettingGeneralController; this.pSettingGeneralController = new WeakReference(pSettingGeneralController);
} }
public settingHomeController getSettingController(){ public settingHomeController getSettingController(){
return pSettingController; if(pSettingController==null){
return null;
}
return pSettingController.get();
} }
public void setSettingController(settingHomeController pSettingController){ public void setSettingController(settingHomeController pSettingController){
this.pSettingController = pSettingController; this.pSettingController = new WeakReference(pSettingController);
} }
public void setCurrentActivity(android.app.Activity pCurrentActivity){ public void setCurrentActivity(android.app.Activity pCurrentActivity){
this.pCurrentActivity = pCurrentActivity; this.pCurrentActivity = new WeakReference(pCurrentActivity);
} }
public android.app.Activity getCurrentActivity(){ public android.app.Activity getCurrentActivity(){
return pCurrentActivity; if(pCurrentActivity==null){
return null;
}
return pCurrentActivity.get();
} }
public void onStack(AppCompatActivity pActivity){ public void onStack(AppCompatActivity pActivity) {
mStackList.add(pActivity); try{
if (mStackList.size() > 0) {
if (!mStackList.get(mStackList.size() - 1).get().getLocalClassName().equals(pActivity.getLocalClassName())) {
mStackList.add(new WeakReference(pActivity));
}
}else {
mStackList.add(new WeakReference(pActivity));
}
}catch (Exception ignored){}
} }
public void onRemoveStack(AppCompatActivity pActivity){ public void onRemoveStack(AppCompatActivity pActivity){
if(mStackList.size()>0 && mStackList.get(mStackList.size()-1).equals(pActivity)){ try{
mStackList.remove(mStackList.size()-1); for(int mCounter=0;mCounter<mStackList.size();mCounter++){
} if(mStackList.get(mCounter).get().getLocalClassName().equals(pActivity.getLocalClassName())){
mStackList.remove(mCounter);
mCounter-=1;
}
}
}catch (Exception ignored){}
} }
public void onClearStack(){ public void onClearStack(){
for(int mCounter=0;mCounter<mStackList.size();mCounter++){ for(int mCounter=0;mCounter<mStackList.size();mCounter++){
if(!mStackList.get(mCounter).isFinishing()){ try{
mStackList.get(mCounter).finish(); if(!mStackList.get(mCounter).get().isFinishing()){
mStackList.remove(mCounter); mStackList.get(mCounter).get().finish();
} mStackList.remove(mCounter);
mCounter-=1;
}
}catch (Exception ignored){}
} }
} }
} }

View File

@ -23,10 +23,9 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.sql; import com.darkweb.genesissearchengine.constants.sql;
@ -84,8 +83,8 @@ public class bookmarkController extends AppCompatActivity
} }
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -165,6 +164,12 @@ public class bookmarkController extends AppCompatActivity
}); });
} }
@Override
protected void onDestroy() {
activityContextManager.getInstance().setBookmarkController(null);
super.onDestroy();
}
private void initSwipe(){ private void initSwipe(){
ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {

View File

@ -74,7 +74,8 @@ class bookmarkViewController
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3)); window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -49,8 +49,8 @@ public class bridgeController extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
activityContextManager.getInstance().setBridgeController(this); activityContextManager.getInstance().setBridgeController(this);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.bridge_settings_view); setContentView(R.layout.bridge_settings_view);
@ -61,8 +61,8 @@ public class bridgeController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -171,6 +171,13 @@ public class bridgeController extends AppCompatActivity {
super.onResume(); super.onResume();
} }
@Override
protected void onDestroy() {
activityContextManager.getInstance().setBridgeController(null);
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
@ -178,10 +185,11 @@ public class bridgeController extends AppCompatActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
activityContextManager.getInstance().onRemoveStack(this);
finish(); finish();
} }
/*Helper Method*/ /*Helper Method*/
public void onClose(View view){ public void onClose(View view){

View File

@ -56,7 +56,8 @@ class bridgeViewController
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { 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.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -62,9 +62,7 @@ public class helpController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }

View File

@ -46,6 +46,7 @@ class helpViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -24,8 +24,7 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkEnums; import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
@ -87,8 +86,8 @@ public class historyController extends AppCompatActivity
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -300,6 +299,8 @@ public class historyController extends AppCompatActivity
@Override @Override
protected void onDestroy() { protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
activityContextManager.getInstance().setHistoryController(null);
super.onDestroy(); super.onDestroy();
} }

View File

@ -72,7 +72,8 @@ class historyViewController
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3)); window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -17,7 +17,7 @@ public class NestedGeckoView extends GeckoView {
private final int[] mScrollOffset = new int[2]; private final int[] mScrollOffset = new int[2];
private final int[] mScrollConsumed = new int[2]; private final int[] mScrollConsumed = new int[2];
private int mNestedOffsetY; private int mNestedOffsetY;
private final NestedScrollingChildHelper mChildHelper; private NestedScrollingChildHelper mChildHelper;
private eventObserver.eventListener mEvent; private eventObserver.eventListener mEvent;
@ -25,8 +25,13 @@ public class NestedGeckoView extends GeckoView {
mEvent = pEvent; mEvent = pEvent;
} }
public void onDestroy() {
mEvent = null;
mChildHelper = null;
}
public NestedGeckoView(Context context, AttributeSet attrs) { public NestedGeckoView(Context context, AttributeSet attrs) {
super(context, attrs); super(context.getApplicationContext(), attrs);
mChildHelper = new NestedScrollingChildHelper(this); mChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true); setNestedScrollingEnabled(true);

View File

@ -5,6 +5,8 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.BrowserIconManager; import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.BrowserIconManager;
import com.darkweb.genesissearchengine.constants.*; import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
@ -41,7 +43,6 @@ public class geckoClients
private GeckoRuntime mRuntime = null; private GeckoRuntime mRuntime = null;
private BrowserIconManager mIconManager; private BrowserIconManager mIconManager;
private eventObserver.eventListener event; private eventObserver.eventListener event;
private AppCompatActivity context;
/*Local Variable*/ /*Local Variable*/
@ -49,7 +50,6 @@ public class geckoClients
public void initialize(GeckoView geckoView, eventObserver.eventListener event, AppCompatActivity context, boolean isForced) public void initialize(GeckoView geckoView, eventObserver.eventListener event, AppCompatActivity context, boolean isForced)
{ {
this.context = context;
this.event = event; this.event = event;
mSessionID = helperMethod.createRandomID(); mSessionID = helperMethod.createRandomID();
initRuntimeSettings(context); initRuntimeSettings(context);
@ -72,10 +72,10 @@ public class geckoClients
onUpdateFont(); onUpdateFont();
} }
public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView){ public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
boolean mStatus = mSession.onValidateInitializeFromStartup(); boolean mStatus = mSession.onValidateInitializeFromStartup();
if(mStatus){ if(mStatus){
loadURL(mSession.getCurrentURL(), mNestedGeckoView); loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext);
} }
} }
@ -87,7 +87,7 @@ public class geckoClients
public geckoSession initFreeSession(GeckoView pGeckoView, AppCompatActivity pcontext, eventObserver.eventListener event){ public geckoSession initFreeSession(GeckoView pGeckoView, AppCompatActivity pcontext, eventObserver.eventListener event){
this.event = event; this.event = event;
initRuntimeSettings(pcontext); initRuntimeSettings(pcontext);
geckoSession mTempSession = new geckoSession(new geckoViewClientCallback(),mSessionID,context, pGeckoView); geckoSession mTempSession = new geckoSession(new geckoViewClientCallback(),mSessionID,pcontext, pGeckoView);
mTempSession.open(mRuntime); mTempSession.open(mRuntime);
mTempSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); mTempSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mTempSession.getSettings().setFullAccessibilityTree(true); mTempSession.getSettings().setFullAccessibilityTree(true);
@ -96,6 +96,14 @@ public class geckoClients
return mTempSession; return mTempSession;
} }
public void onDestroy(){
mSession.onDestroy();
mSession = null;
mRuntime = null;
mIconManager = null;
event = null;
}
public GeckoRuntime getmRuntime(){ public GeckoRuntime getmRuntime(){
return mRuntime; return mRuntime;
} }
@ -115,7 +123,7 @@ public class geckoClients
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
public void initRuntimeSettings(AppCompatActivity context){ public void initRuntimeSettings(AppCompatActivity context){
if(mRuntime==null){ if(mRuntime==null){
mRuntime = GeckoRuntime.getDefault(context); mRuntime = GeckoRuntime.getDefault(context.getApplicationContext());
mRuntime.getSettings().setAboutConfigEnabled(true); mRuntime.getSettings().setAboutConfigEnabled(true);
mRuntime.getSettings().setAutomaticFontSizeAdjustment(false); mRuntime.getSettings().setAutomaticFontSizeAdjustment(false);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts); mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
@ -132,14 +140,14 @@ public class geckoClients
} }
} }
public void onGetFavIcon(ImageView pImageView, String pURL){ public void onGetFavIcon(ImageView pImageView, String pURL, AppCompatActivity pcontext){
pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL)); pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL));
mIconManager.onLoadIconIntoView(context,mRuntime, pImageView, pURL); mIconManager.onLoadIconIntoView(pcontext,mRuntime, pImageView, pURL);
} }
public void onLoadFavIcon(){ public void onLoadFavIcon(AppCompatActivity pcontext){
BrowserIconManager mIconManager = new BrowserIconManager(); BrowserIconManager mIconManager = new BrowserIconManager();
mIconManager.onLoadIcon(context, mRuntime); mIconManager.onLoadIcon(pcontext.getApplicationContext(), mRuntime);
} }
private int getCookiesBehaviour(){ private int getCookiesBehaviour(){
@ -147,7 +155,7 @@ public class geckoClients
} }
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
public void updateSetting(NestedGeckoView mNestedGeckoView){ public void updateSetting(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
mRuntime.getSettings().setRemoteDebuggingEnabled(false); mRuntime.getSettings().setRemoteDebuggingEnabled(false);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts); mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour()); mRuntime.getSettings().getContentBlocking().setCookieBehavior(getCookiesBehaviour());
@ -168,7 +176,7 @@ public class geckoClients
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE ); mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE );
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
onUpdateFont(); onUpdateFont();
onReload(mNestedGeckoView); onReload(mNestedGeckoView, pcontext);
} }
public void initSession(geckoSession mSession){ public void initSession(geckoSession mSession){
@ -192,7 +200,7 @@ public class geckoClients
mSession.initURL(url); mSession.initURL(url);
} }
public void loadURL(String url, NestedGeckoView mNestedGeckoView) { public void loadURL(String url, NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext) {
mSession = (geckoSession)mNestedGeckoView.getSession(); mSession = (geckoSession)mNestedGeckoView.getSession();
if(mSession==null){ if(mSession==null){
return; return;
@ -202,7 +210,7 @@ public class geckoClients
if(!url.startsWith(CONST_REPORT_URL) && (url.startsWith("https://boogle.store/?pG") || url.startsWith("https://boogle.store?pG") || url.endsWith("boogle.store") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED))){ if(!url.startsWith(CONST_REPORT_URL) && (url.startsWith("https://boogle.store/?pG") || url.startsWith("https://boogle.store?pG") || url.endsWith("boogle.store") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED))){
try{ try{
mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL); mSession.initURL(constants.CONST_GENESIS_DOMAIN_URL);
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(context)){ if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){
String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null); String mURL = constants.CONST_GENESIS_URL_CACHED + "?pData="+ dataController.getInstance().invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands.M_FETCH,null);
mSession.getSettings().setAllowJavascript(true); mSession.getSettings().setAllowJavascript(true);
mSession.loadUri(mURL); mSession.loadUri(mURL);
@ -218,7 +226,7 @@ public class geckoClients
try{ try{
mSession.initURL(constants.CONST_GENESIS_HELP_URL); mSession.initURL(constants.CONST_GENESIS_HELP_URL);
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(context)){ if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(pcontext)){
mSession.getSettings().setAllowJavascript(true); mSession.getSettings().setAllowJavascript(true);
mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE); mSession.loadUri(constants.CONST_GENESIS_HELP_URL_CACHE);
}else { }else {
@ -235,9 +243,9 @@ public class geckoClients
} }
} }
public void onRedrawPixel(){ public void onRedrawPixel(AppCompatActivity pcontext){
mSession.onRedrawPixel(); mSession.onRedrawPixel();
onLoadFavIcon(); onLoadFavIcon(pcontext);
} }
public void onClearSiteData(){ public void onClearSiteData(){
@ -312,9 +320,9 @@ public class geckoClients
mSession.stop(); mSession.stop();
} }
public void onReload(NestedGeckoView mNestedGeckoView){ public void onReload(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
mSession.stop(); mSession.stop();
loadURL(mSession.getCurrentURL(), mNestedGeckoView); loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext);
} }
public void manual_download(String url, AppCompatActivity context){ public void manual_download(String url, AppCompatActivity context){
@ -337,16 +345,16 @@ public class geckoClients
} }
} }
public void downloadFile() public void downloadFile(AppCompatActivity pcontext)
{ {
if(helperMethod.checkPermissions(context)){ if(helperMethod.checkPermissions(pcontext)){
mSession.downloadRequestedFile(); mSession.downloadRequestedFile();
} }
} }
public void downloadFile(String mURL) public void downloadFile(String mURL, AppCompatActivity pcontext)
{ {
if(helperMethod.checkPermissions(context)){ if(helperMethod.checkPermissions(pcontext)){
mSession.downloadRequestedFile(); mSession.downloadRequestedFile();
} }
} }
@ -374,7 +382,7 @@ public class geckoClients
WebResponse responseInfo = (WebResponse)data.get(0); WebResponse responseInfo = (WebResponse)data.get(0);
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.headers.get("Content-Type")); intent.setDataAndTypeAndNormalize(Uri.parse(responseInfo.uri), responseInfo.headers.get("Content-Type"));
context.startActivity(intent); activityContextManager.getInstance().getHomeController().startActivity(intent);
}catch (Exception ignored){} }catch (Exception ignored){}
} else } else
{ {

View File

@ -32,20 +32,16 @@ import android.widget.ScrollView;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.TimePicker; import android.widget.TimePicker;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.helperManager.PathUtil; import com.darkweb.genesissearchengine.helperManager.PathUtil;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.lang.ref.WeakReference;
import java.net.URISyntaxException;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import org.mozilla.geckoview.AllowOrDeny; import org.mozilla.geckoview.AllowOrDeny;
import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoSession;
@ -55,24 +51,24 @@ import org.mozilla.geckoview.SlowScriptResponse;
final class geckoPromptView implements GeckoSession.PromptDelegate { final class geckoPromptView implements GeckoSession.PromptDelegate {
protected static final String LOGTAG = "geckoPromptView"; protected static final String LOGTAG = "geckoPromptView";
private final Activity mActivity; private final WeakReference<Activity> mActivity;
public int filePickerRequestCode = 1; public int filePickerRequestCode = 1;
private int mFileType; private int mFileType;
private GeckoResult<PromptResponse> mFileResponse; private GeckoResult<PromptResponse> mFileResponse;
private FilePrompt mFilePrompt; private FilePrompt mFilePrompt;
public geckoPromptView(final Activity activity) { public geckoPromptView(final Activity activity) {
mActivity = activity; mActivity = new WeakReference(activity);
} }
@Override @Override
public GeckoResult<PromptResponse> onAlertPrompt(final GeckoSession session, public GeckoResult<PromptResponse> onAlertPrompt(final GeckoSession session,
final AlertPrompt prompt) { final AlertPrompt prompt) {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null) { if (activity == null) {
return GeckoResult.fromValue(prompt.dismiss()); return GeckoResult.fromValue(prompt.dismiss());
} }
final AlertDialog.Builder builder = new AlertDialog.Builder(activity) final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext())
.setTitle(prompt.title) .setTitle(prompt.title)
.setMessage(prompt.message) .setMessage(prompt.message)
.setPositiveButton(android.R.string.ok, /* onClickListener */ null); .setPositiveButton(android.R.string.ok, /* onClickListener */ null);
@ -84,11 +80,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
@Override @Override
public GeckoResult<PromptResponse> onButtonPrompt(final GeckoSession session, public GeckoResult<PromptResponse> onButtonPrompt(final GeckoSession session,
final ButtonPrompt prompt) { final ButtonPrompt prompt) {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null) { if (activity == null) {
return GeckoResult.fromValue(prompt.dismiss()); return GeckoResult.fromValue(prompt.dismiss());
} }
final AlertDialog.Builder builder = new AlertDialog.Builder(activity) final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext())
.setTitle(prompt.title) .setTitle(prompt.title)
.setMessage(prompt.message); .setMessage(prompt.message);
@ -157,11 +153,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
@Override @Override
public GeckoResult<PromptResponse> onTextPrompt(final GeckoSession session, public GeckoResult<PromptResponse> onTextPrompt(final GeckoSession session,
final TextPrompt prompt) { final TextPrompt prompt) {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null) { if (activity == null) {
return GeckoResult.fromValue(prompt.dismiss()); return GeckoResult.fromValue(prompt.dismiss());
} }
final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
final LinearLayout container = addStandardLayout(builder, prompt.title, prompt.message); final LinearLayout container = addStandardLayout(builder, prompt.title, prompt.message);
final EditText editText = new EditText(builder.getContext()); final EditText editText = new EditText(builder.getContext());
editText.setText(prompt.defaultValue); editText.setText(prompt.defaultValue);
@ -185,11 +181,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
@Override @Override
public GeckoResult<PromptResponse> onAuthPrompt(final GeckoSession session, public GeckoResult<PromptResponse> onAuthPrompt(final GeckoSession session,
final AuthPrompt prompt) { final AuthPrompt prompt) {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null) { if (activity == null) {
return GeckoResult.fromValue(prompt.dismiss()); return GeckoResult.fromValue(prompt.dismiss());
} }
final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
final LinearLayout container = addStandardLayout(builder, prompt.title, prompt.message); final LinearLayout container = addStandardLayout(builder, prompt.title, prompt.message);
final int flags = prompt.authOptions.flags; final int flags = prompt.authOptions.flags;
@ -285,12 +281,12 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
final String message, final int type, final String message, final int type,
final ChoicePrompt.Choice[] choices, final ChoicePrompt prompt, final ChoicePrompt.Choice[] choices, final ChoicePrompt prompt,
final GeckoResult<PromptResponse> res) { final GeckoResult<PromptResponse> res) {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null) { if (activity == null) {
res.complete(prompt.dismiss()); res.complete(prompt.dismiss());
return; return;
} }
final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
addStandardLayout(builder, title, message); addStandardLayout(builder, title, message);
final ListView list = new ListView(builder.getContext()); final ListView list = new ListView(builder.getContext());
@ -476,11 +472,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
@Override @Override
public GeckoResult<PromptResponse> onColorPrompt(final GeckoSession session, public GeckoResult<PromptResponse> onColorPrompt(final GeckoSession session,
final ColorPrompt prompt) { final ColorPrompt prompt) {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null) { if (activity == null) {
return GeckoResult.fromValue(prompt.dismiss()); return GeckoResult.fromValue(prompt.dismiss());
} }
final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
addStandardLayout(builder, prompt.title, /* msg */ null); addStandardLayout(builder, prompt.title, /* msg */ null);
final int initial = parseColor(prompt.defaultValue, /* def */ 0); final int initial = parseColor(prompt.defaultValue, /* def */ 0);
@ -587,7 +583,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
@Override @Override
public GeckoResult<PromptResponse> onDateTimePrompt(final GeckoSession session, public GeckoResult<PromptResponse> onDateTimePrompt(final GeckoSession session,
final DateTimePrompt prompt) { final DateTimePrompt prompt) {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null) { if (activity == null) {
return GeckoResult.fromValue(prompt.dismiss()); return GeckoResult.fromValue(prompt.dismiss());
} }
@ -613,7 +609,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
final Calendar cal = formatter.getCalendar(); final Calendar cal = formatter.getCalendar();
cal.setTime(date); cal.setTime(date);
final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
final LayoutInflater inflater = LayoutInflater.from(builder.getContext()); final LayoutInflater inflater = LayoutInflater.from(builder.getContext());
final DatePicker datePicker; final DatePicker datePicker;
if (prompt.type == DateTimePrompt.Type.DATE || prompt.type == DateTimePrompt.Type.MONTH || if (prompt.type == DateTimePrompt.Type.DATE || prompt.type == DateTimePrompt.Type.MONTH ||
@ -706,12 +702,12 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
@TargetApi(19) @TargetApi(19)
public GeckoResult<PromptResponse> onFilePrompt(GeckoSession session, FilePrompt prompt) public GeckoResult<PromptResponse> onFilePrompt(GeckoSession session, FilePrompt prompt)
{ {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null) { if (activity == null) {
return GeckoResult.fromValue(prompt.dismiss()); return GeckoResult.fromValue(prompt.dismiss());
} }
if(!helperMethod.checkPermissions((AppCompatActivity)mActivity)){ if(!helperMethod.checkPermissions((AppCompatActivity)mActivity.get().getApplicationContext())){
return GeckoResult.fromValue(prompt.dismiss()); return GeckoResult.fromValue(prompt.dismiss());
} }
@ -787,7 +783,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
String filePath = null; String filePath = null;
filePath = PathUtil.getPath(mActivity.getApplicationContext(),uri); filePath = PathUtil.getPath(mActivity.get().getApplicationContext(),uri);
if (filePath==null) { if (filePath==null) {
res.complete(prompt.dismiss()); res.complete(prompt.dismiss());
@ -800,7 +796,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
if (prompt.type == FilePrompt.Type.SINGLE || if (prompt.type == FilePrompt.Type.SINGLE ||
(prompt.type == FilePrompt.Type.MULTIPLE && clip == null)) { (prompt.type == FilePrompt.Type.MULTIPLE && clip == null)) {
res.complete(prompt.confirm(mActivity, uri)); res.complete(prompt.confirm(mActivity.get().getApplicationContext(), uri));
} else if (prompt.type == FilePrompt.Type.MULTIPLE) { } else if (prompt.type == FilePrompt.Type.MULTIPLE) {
if (clip == null) { if (clip == null) {
Log.w(LOGTAG, "No selected file"); Log.w(LOGTAG, "No selected file");
@ -812,18 +808,18 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
uris.add(clip.getItemAt(i).getUri()); uris.add(clip.getItemAt(i).getUri());
} }
res.complete(prompt.confirm(mActivity, uris.toArray(new Uri[uris.size()]))); res.complete(prompt.confirm(mActivity.get().getApplicationContext(), uris.toArray(new Uri[uris.size()])));
} }
} }
public void onPermissionPrompt(final GeckoSession session, final String title, public void onPermissionPrompt(final GeckoSession session, final String title,
final GeckoSession.PermissionDelegate.Callback callback) { final GeckoSession.PermissionDelegate.Callback callback) {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null) { if (activity == null) {
callback.reject(); callback.reject();
return; return;
} }
final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
builder.setTitle(title) builder.setTitle(title)
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override @Override
@ -843,11 +839,11 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
} }
public void onSlowScriptPrompt(GeckoSession geckoSession, String title, GeckoResult<SlowScriptResponse> reportAction) { public void onSlowScriptPrompt(GeckoSession geckoSession, String title, GeckoResult<SlowScriptResponse> reportAction) {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null) { if (activity == null) {
return; return;
} }
final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
builder.setTitle(title) builder.setTitle(title)
.setNegativeButton("Wait", new DialogInterface.OnClickListener() { .setNegativeButton("Wait", new DialogInterface.OnClickListener() {
@Override @Override
@ -904,12 +900,12 @@ final class geckoPromptView implements GeckoSession.PromptDelegate {
final MediaSource[] video, final MediaSource[] audio, final MediaSource[] video, final MediaSource[] audio,
final String[] videoNames, final String[] audioNames, final String[] videoNames, final String[] audioNames,
final GeckoSession.PermissionDelegate.MediaCallback callback) { final GeckoSession.PermissionDelegate.MediaCallback callback) {
final Activity activity = mActivity; final Activity activity = mActivity.get();
if (activity == null || (video == null && audio == null)) { if (activity == null || (video == null && audio == null)) {
callback.reject(); callback.reject();
return; return;
} }
final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final AlertDialog.Builder builder = new AlertDialog.Builder(activity.getApplicationContext());
final LinearLayout container = addStandardLayout(builder, title, /* msg */ null); final LinearLayout container = addStandardLayout(builder, title, /* msg */ null);
final Spinner videoSpinner; final Spinner videoSpinner;

View File

@ -60,6 +60,7 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -92,7 +93,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
private String mCurrentTitle = "loading"; private String mCurrentTitle = "loading";
private String mCurrentURL = "about:blank"; private String mCurrentURL = "about:blank";
private Uri mUriPermission = null; private Uri mUriPermission = null;
private AppCompatActivity mContext; private WeakReference<AppCompatActivity> mContext;
private geckoDownloadManager mDownloadManager; private geckoDownloadManager mDownloadManager;
private String mTheme = null; private String mTheme = null;
private boolean mPreviousErrorPage = false; private boolean mPreviousErrorPage = false;
@ -112,7 +113,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){ geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){
this.mGeckoView = pGeckoView; this.mGeckoView = pGeckoView;
this.mContext = mContext; this.mContext = new WeakReference(mContext);
this.mSessionID = mSessionID; this.mSessionID = mSessionID;
this.event = event; this.event = event;
@ -128,6 +129,25 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
setPromptDelegate(new geckoPromptView(mContext)); setPromptDelegate(new geckoPromptView(mContext));
} }
public void onDestroy(){
close();
setProgressDelegate(null);
setHistoryDelegate(null);
setNavigationDelegate(null);
setContentDelegate(null);
setAutoFillDelegate();
setPermissionDelegate(null);
setScrollDelegate(null);
mDownloadManager = null;
setPromptDelegate(null);
event = null;
mContext = null;
mDownloadManager = null;
mHistoryList = null;
mFindHandler = null;
mGeckoView = null;
}
public void onSetInitializeFromStartup(){ public void onSetInitializeFromStartup(){
mIsLoaded = true; mIsLoaded = true;
} }
@ -162,7 +182,10 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
mFindHandler = new Handler(); mFindHandler = new Handler();
mFindHandler.postDelayed(() -> mFindHandler.postDelayed(() ->
{ {
mContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); if(mContext!=null){
mContext.get().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER);
}
}, 1500); }, 1500);
} }
@ -220,7 +243,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
} }
final AutofillManager manager = final AutofillManager manager =
mContext.getSystemService(AutofillManager.class); mContext.get().getApplicationContext().getSystemService(AutofillManager.class);
if (manager == null) { if (manager == null) {
return; return;
} }
@ -287,7 +310,9 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
{ {
if(!mThemeChanged){ if(!mThemeChanged){
mTheme = null; mTheme = null;
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); if(event!=null) {
event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME);
}
} }
}, 500); }, 500);
} }
@ -305,12 +330,12 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
if(progress==100){ if(progress==100){
if(!mIsProgressBarChanging){ if(!mIsProgressBarChanging){
mIsProgressBarChanging = true; mIsProgressBarChanging = true;
mContext.runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update));
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND); event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND);
} }
}else { }else {
mIsProgressBarChanging = false; mIsProgressBarChanging = false;
mContext.runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update));
} }
} }
@ -355,7 +380,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
setURL(constants.CONST_GENESIS_DOMAIN_URL); setURL(constants.CONST_GENESIS_DOMAIN_URL);
} }
else if(newUrl.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){ else if(newUrl.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext)){ if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())){
setURL(constants.CONST_GENESIS_HELP_URL); setURL(constants.CONST_GENESIS_HELP_URL);
}else { }else {
setURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); setURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK);
@ -414,7 +439,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
if(mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ if(mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK)){
setURL(constants.CONST_GENESIS_DOMAIN_URL); setURL(constants.CONST_GENESIS_DOMAIN_URL);
}else if(mCurrentURL.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){ }else if(mCurrentURL.equals(constants.CONST_GENESIS_HELP_URL_CACHE)){
if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext)){ if(status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get())){
setURL(constants.CONST_GENESIS_HELP_URL); setURL(constants.CONST_GENESIS_HELP_URL);
}else { }else {
setURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); setURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK);
@ -459,7 +484,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
mPreviousErrorPage = true; mPreviousErrorPage = true;
event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error); event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error);
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME);
return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code,mContext,var2)); return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code,mContext.get(),var2));
} }
/*Content Delegate*/ /*Content Delegate*/
@ -468,7 +493,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
public void onExternalResponse(@NonNull GeckoSession session, @NonNull WebResponse response) { public void onExternalResponse(@NonNull GeckoSession session, @NonNull WebResponse response) {
try { try {
if(response.headers.containsKey("Content-Disposition")){ if(response.headers.containsKey("Content-Disposition")){
mDownloadManager.downloadFile(response,this,mContext,event); mDownloadManager.downloadFile(response,this,mContext.get(),event);
}else if(response.headers.containsKey("Content-Type")){ }else if(response.headers.containsKey("Content-Type")){
event.invokeObserver(Arrays.asList(response,mSessionID), enums.etype.on_handle_external_intent); event.invokeObserver(Arrays.asList(response,mSessionID), enums.etype.on_handle_external_intent);
stop(); stop();
@ -588,11 +613,11 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
} }
if(var4.type!=0){ if(var4.type!=0){
if(var4.linkUri!=null){ if(var4.linkUri!=null){
event.invokeObserver(Arrays.asList(var4.linkUri,mSessionID,var4.srcUri,title, mTheme, mContext), M_LONG_PRESS_WITH_LINK); event.invokeObserver(Arrays.asList(var4.linkUri,mSessionID,var4.srcUri,title, mTheme, mContext.get()), M_LONG_PRESS_WITH_LINK);
} }
else { else {
try{ try{
event.invokeObserver(Arrays.asList(var4.srcUri,mSessionID,title, mTheme, mContext), enums.etype.on_long_press); event.invokeObserver(Arrays.asList(var4.srcUri,mSessionID,title, mTheme, mContext.get()), enums.etype.on_long_press);
}catch (Exception ex){ }catch (Exception ex){
ex.printStackTrace(); ex.printStackTrace();
Log.i("",""); Log.i("","");
@ -600,7 +625,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
} }
} }
else{ else{
event.invokeObserver(Arrays.asList(var4.linkUri,mSessionID,title, mTheme, mContext), M_LONG_PRESS_URL); event.invokeObserver(Arrays.asList(var4.linkUri,mSessionID,title, mTheme, mContext.get()), M_LONG_PRESS_URL);
} }
} }
@ -625,7 +650,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
{ {
if(mDownloadManager.getDownloadURL()!=null && mDownloadManager.getDownloadFile()!=null){ if(mDownloadManager.getDownloadURL()!=null && mDownloadManager.getDownloadFile()!=null){
if(!createAndSaveFileFromBase64Url(mDownloadManager.getDownloadURL().toString())){ if(!createAndSaveFileFromBase64Url(mDownloadManager.getDownloadURL().toString())){
mContext.startService(downloadFileService.getDownloadService(mContext, mDownloadManager.getDownloadURL()+"__"+mDownloadManager.getDownloadFile(), Environment.DIRECTORY_DOWNLOADS)); mContext.get().startService(downloadFileService.getDownloadService(mContext.get().getApplicationContext(), mDownloadManager.getDownloadURL()+"__"+mDownloadManager.getDownloadFile(), Environment.DIRECTORY_DOWNLOADS));
} }
} }
} }
@ -634,7 +659,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
{ {
if(downloadURL!=null && downloadFile!=null){ if(downloadURL!=null && downloadFile!=null){
if(!createAndSaveFileFromBase64Url(downloadURL.toString())){ if(!createAndSaveFileFromBase64Url(downloadURL.toString())){
mContext.startService(downloadFileService.getDownloadService(mContext, downloadURL + "__" + downloadFile, Environment.DIRECTORY_DOWNLOADS)); mContext.get().startService(downloadFileService.getDownloadService(mContext.get().getApplicationContext(), downloadURL + "__" + downloadFile, Environment.DIRECTORY_DOWNLOADS));
} }
} }
} }
@ -645,7 +670,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
return false; return false;
} }
else if(url.startsWith("blob")){ else if(url.startsWith("blob")){
Toast toast = Toast.makeText(mContext.getApplicationContext(), Toast toast = Toast.makeText(mContext.get().getApplicationContext(),
"Unable to download urls that contain prefix blob. Not Supported", "Unable to download urls that contain prefix blob. Not Supported",
Toast.LENGTH_SHORT); Toast.LENGTH_SHORT);
@ -681,7 +706,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
os.close(); os.close();
//Tell the media scanner about the new file so that it is immediately available to the user. //Tell the media scanner about the new file so that it is immediately available to the user.
MediaScannerConnection.scanFile(mContext, MediaScannerConnection.scanFile(mContext.get().getApplicationContext(),
new String[]{file.toString()}, null, new String[]{file.toString()}, null,
(path1, uri) -> (path1, uri) ->
{ {
@ -693,20 +718,20 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
String mimetype = url.substring(url.indexOf(":") + 1, url.indexOf("/")); String mimetype = url.substring(url.indexOf(":") + 1, url.indexOf("/"));
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW); intent.setAction(android.content.Intent.ACTION_VIEW);
Uri uri_temp = FileProvider.getUriForFile(mContext,mContext.getString(R.string.GENERAL_FILE_PROVIDER_AUTHORITY), file); Uri uri_temp = FileProvider.getUriForFile(mContext.get().getApplicationContext(),mContext.get().getString(R.string.GENERAL_FILE_PROVIDER_AUTHORITY), file);
intent.setDataAndType(uri_temp, (mimetype + "/*")); intent.setDataAndType(uri_temp, (mimetype + "/*"));
List<ResolveInfo> resInfoList = mContext.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); List<ResolveInfo> resInfoList = mContext.get().getApplicationContext().getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo resolveInfo : resInfoList) { for (ResolveInfo resolveInfo : resInfoList) {
String packageName = resolveInfo.activityInfo.packageName; String packageName = resolveInfo.activityInfo.packageName;
mUriPermission = uri_temp; mUriPermission = uri_temp;
mContext.grantUriPermission(packageName, uri_temp, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); mContext.get().getApplicationContext().grantUriPermission(packageName, uri_temp, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
} }
PendingIntent pIntent = PendingIntent.getActivity(mContext, 0, intent, 0); PendingIntent pIntent = PendingIntent.getActivity(mContext.get().getApplicationContext(), 0, intent, 0);
String channel_id = createNotificationChannel(mContext); String channel_id = createNotificationChannel(mContext.get().getApplicationContext());
assert channel_id != null; assert channel_id != null;
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext, channel_id) NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext.get().getApplicationContext(), channel_id)
.setSmallIcon(R.xml.ic_download) .setSmallIcon(R.xml.ic_download)
.setContentTitle(filename) .setContentTitle(filename)
.setContentIntent(pIntent); .setContentIntent(pIntent);
@ -714,7 +739,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
notificationBuilder.setAutoCancel(true); notificationBuilder.setAutoCancel(true);
int notificationId = 85851; int notificationId = 85851;
NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager notificationManager = (NotificationManager) mContext.get().getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationId, notificationBuilder.build()); notificationManager.notify(notificationId, notificationBuilder.build());
} catch (IOException e) { } catch (IOException e) {

View File

@ -32,6 +32,7 @@ import android.webkit.URLUtil;
import android.widget.*; import android.widget.*;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.widget.NestedScrollView; import androidx.core.widget.NestedScrollView;
@ -40,7 +41,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyController; import com.darkweb.genesissearchengine.appManager.historyManager.historyController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView;
@ -73,6 +75,8 @@ import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.darkweb.genesissearchengine.widget.progressBar.AnimatedProgressBar; import com.darkweb.genesissearchengine.widget.progressBar.AnimatedProgressBar;
import com.example.myapplication.R; import com.example.myapplication.R;
import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.AdView;
import com.google.firebase.installations.time.SystemClock;
import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoSession;
import org.torproject.android.service.OrbotService; import org.torproject.android.service.OrbotService;
@ -96,7 +100,8 @@ import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_
import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_CHANGED; import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_CHANGED;
import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_LINK; import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_LINK;
import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE; import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE;
import static com.darkweb.genesissearchengine.constants.enums.etype.ON_OPEN_TAB_VIEW; import static com.darkweb.genesissearchengine.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB;
import static com.darkweb.genesissearchengine.constants.enums.etype.open_new_tab;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION;
import static java.lang.Character.isLetter; import static java.lang.Character.isLetter;
@ -135,6 +140,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private ImageButton mMenu; private ImageButton mMenu;
private NestedScrollView mNestedScroll; private NestedScrollView mNestedScroll;
private ImageView mBlockerFullSceen; private ImageView mBlockerFullSceen;
private ImageView mNewTabBlocker;
private TextView mCopyright; private TextView mCopyright;
private RecyclerView mHintListView; private RecyclerView mHintListView;
private ImageView mSearchLock; private ImageView mSearchLock;
@ -167,16 +173,15 @@ public class homeController extends AppCompatActivity implements ComponentCallba
@Override @Override
protected void onCreate(Bundle savedInstanceState) protected void onCreate(Bundle savedInstanceState)
{ {
onInitTheme();
onInitBooleans(); onInitBooleans();
orbotLocalConstants.mHomeIntent = getIntent(); orbotLocalConstants.mHomeIntent = getIntent();
getWindow().getDecorView().setBackgroundColor(Color.WHITE); getWindow().getDecorView().setBackgroundColor(Color.WHITE);
pluginController.getInstance().preInitialize(this); pluginController.getInstance().preInitialize(this);
databaseController.getInstance().initialize(this);
dataController.getInstance().initialize(this); dataController.getInstance().initialize(this);
status.initStatus(); status.initStatus(this);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); databaseController.getInstance().initialize(this);
trueTime.getInstance().initTime(); trueTime.getInstance().initTime();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -233,7 +238,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
public void initAdmob(){ public void initAdmob(){
pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS); pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS);
} }
public void onInitBooleans(){ public void onInitBooleans(){
@ -264,6 +269,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.splashScreenDisableInstant(); mHomeViewController.splashScreenDisableInstant();
onLoadTabOnResume(); onLoadTabOnResume();
mSearchLock.setColorFilter(ContextCompat.getColor(this, R.color.c_lock_tint)); mSearchLock.setColorFilter(ContextCompat.getColor(this, R.color.c_lock_tint));
}else {
new Handler().postDelayed(() ->
{
mTabFragment.setAlpha(1f);
mTabFragment.setVisibility(View.VISIBLE);
activityContextManager.getInstance().getTabController().onInit();
mTabFragment.setVisibility(View.GONE);
}, 500);
} }
initSuggestionView(new ArrayList<>(), strings.GENERIC_EMPTY_STR); initSuggestionView(new ArrayList<>(), strings.GENERIC_EMPTY_STR);
} }
@ -284,7 +297,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
onLoadURL(model.getSession().getCurrentURL()); onLoadURL(model.getSession().getCurrentURL());
} }
mGeckoClient.onValidateInitializeFromStartup(mGeckoView); mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this);
mGeckoClient.onSessionReinit(); mGeckoClient.onSessionReinit();
} }
@ -321,7 +334,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(!status.mThemeApplying){ if(!status.mThemeApplying){
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false);
} }
status.mThemeApplying = false;
} }
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
@ -420,16 +432,17 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mTabFragment = findViewById(R.id.mTabFragment); mTabFragment = findViewById(R.id.mTabFragment);
mPopupLoadNewTab = findViewById(R.id.pPopupLoadNewTab); mPopupLoadNewTab = findViewById(R.id.pPopupLoadNewTab);
mTopBarHider = findViewById(R.id.pTopBarHider); mTopBarHider = findViewById(R.id.pTopBarHider);
mNewTabBlocker = findViewById(R.id.pNewTabBlocker);
mGeckoView.setSaveEnabled(false); mGeckoView.setSaveEnabled(false);
mGeckoView.setSaveFromParentEnabled(false); mGeckoView.setSaveFromParentEnabled(false);
mGeckoView.setAutofillEnabled(true); mGeckoView.setAutofillEnabled(true);
mGeckoClient = new geckoClients(); mGeckoClient = new geckoClients();
mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mPopupLoadNewTab, mTopBarHider); mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mPopupLoadNewTab, mTopBarHider, mNewTabBlocker);
mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback()); mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback());
mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false); mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false);
mGeckoClient.onValidateInitializeFromStartup(mGeckoView); mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this);
dataController.getInstance().initializeListData(); dataController.getInstance().initializeListData();
} }
@ -494,7 +507,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
/*-------------------------------------------------------Helper Methods-------------------------------------------------------*/ /*-------------------------------------------------------Helper Methods-------------------------------------------------------*/
public void onGetFavIcon(ImageView pImageView, String pURL){ public void onGetFavIcon(ImageView pImageView, String pURL){
mGeckoClient.onGetFavIcon(pImageView, pURL); mGeckoClient.onGetFavIcon(pImageView, pURL, homeController.this);
} }
public void onGetThumbnail(ImageView pImageView,boolean pLoadTabView){ public void onGetThumbnail(ImageView pImageView,boolean pLoadTabView){
@ -524,7 +537,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void initRuntimeSettings() public void initRuntimeSettings()
{ {
mGeckoClient.updateSetting(mGeckoView); mGeckoClient.updateSetting(mGeckoView, homeController.this);
} }
public void onReDrawGeckoview(){ public void onReDrawGeckoview(){
@ -540,7 +553,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mAppBar.animate().cancel(); mAppBar.animate().cancel();
mHomeViewController.onClearSelections(true); mHomeViewController.onClearSelections(true);
Objects.requireNonNull(mGeckoView.getSession()).stop(); Objects.requireNonNull(mGeckoView.getSession()).stop();
mGeckoClient.loadURL(url.replace("genesis.onion","boogle.store"),mGeckoView); mGeckoClient.loadURL(url.replace("genesis.onion","boogle.store"),mGeckoView, homeController.this);
} }
public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed, boolean pExpandAppBar){ public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed, boolean pExpandAppBar){
@ -567,7 +580,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.progressBarReset(); mHomeViewController.progressBarReset();
} }
mGeckoClient.onValidateInitializeFromStartup(mGeckoView); mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this);
mGeckoClient.onSessionReinit(); mGeckoClient.onSessionReinit();
mHomeViewController.onUpdateStatusBarTheme(mTempSession.getTheme(), false); mHomeViewController.onUpdateStatusBarTheme(mTempSession.getTheme(), false);
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false);
@ -590,11 +603,33 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onProgressBarUpdate(mGeckoClient.getSession().getProgress(),true); mHomeViewController.onProgressBarUpdate(mGeckoClient.getSession().getProgress(),true);
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false)); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false));
mGeckoView.invalidate();
mGeckoView.refreshDrawableState(); TouchView(mGeckoView);
mGeckoView.requestFocus(); TouchView(mNestedScroll);
} }
public void TouchView(View view)
{
long downTime = 3000;
long eventTime = 3000;
float x = 0f;
float y = 100f;
int metaState = 0;
MotionEvent motionEvent = MotionEvent.obtain(
downTime,
eventTime,
MotionEvent.ACTION_SCROLL,
x,
y,
metaState
);
view.dispatchTouchEvent(motionEvent);
view.dispatchTouchEvent(MotionEvent.obtain(0,0,MotionEvent.ACTION_DOWN, 100,100,0.5f,5,0,1,1,0,0));
}
/*-------------------------------------------------------USER EVENTS-------------------------------------------------------*/ /*-------------------------------------------------------USER EVENTS-------------------------------------------------------*/
private BroadcastReceiver downloadStatus = new BroadcastReceiver() private BroadcastReceiver downloadStatus = new BroadcastReceiver()
@ -649,12 +684,46 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
} }
@SuppressLint("ClickableViewAccessibility")
@Override @Override
protected void onDestroy() { protected void onDestroy() {
mBackSplash.setImageDrawable(null);
mBackSplash.setBackground(null);
if(!status.sSettingIsAppStarted){ if(!status.sSettingIsAppStarted){
Intent intent = new Intent(getApplicationContext(), OrbotService.class); Intent intent = new Intent(getApplicationContext(), OrbotService.class);
stopService(intent); stopService(intent);
} }
KeyboardUtils.removeAllKeyboardToggleListeners();
mGatewaySplash.setOnTouchListener(null);
((ConstraintLayout)mGatewaySplash.getParent()).removeView(mGatewaySplash);
((ConstraintLayout)mGeckoView.getParent()).removeView(mGeckoView);
((ConstraintLayout)mTabFragment.getParent()).removeView(mTabFragment);
((LinearLayout)mSearchbar.getParent()).removeView(mSearchbar);
mTabFragment = null;
mNestedScroll = null;
mGeckoView.setOnFocusChangeListener(null);
mGeckoView.setOnTouchListener(null);
mGeckoView.destroyDrawingCache();
mGeckoView.releaseSession();
mGeckoClient.onDestroy();
mGeckoView.onDestroy();
mGeckoClient=null;
mHomeViewController = null;
activityContextManager.getInstance().setHomeController(null);
mGeckoView.releaseSession();
mGeckoView = null;
activityContextManager.getInstance().setHomeController(null);
activityContextManager.getInstance().setCurrentActivity(null);
pluginController.getInstance().onRemoveInstances();
unregisterReceiver(downloadStatus);
super.onDestroy(); super.onDestroy();
} }
@ -668,9 +737,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mNewTab.setOnTouchListener((v, event) -> { mNewTab.setOnTouchListener((v, event) -> {
if(event.getAction() == MotionEvent.ACTION_DOWN){ if(event.getAction() == MotionEvent.ACTION_DOWN){
onOpenTabViewBoundary(null); onOpenTabViewBoundary(null);
initTabCount(null, null); mNewTab.setPressed(true);
} }
return false; return true;
}); });
mFindText.addTextChangedListener(new TextWatcher() { mFindText.addTextChangedListener(new TextWatcher() {
@ -722,7 +791,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}); });
mGeckoView.setOnTouchListener((v, event) -> { mGeckoView.setOnTouchListener((v, event) -> {
helperMethod.hideKeyboard(homeController.this); mHomeViewController.onClearSelections(true);
return false; return false;
}); });
@ -851,7 +920,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
KeyboardUtils.addKeyboardToggleListener(this, isVisible -> isKeyboardOpened = isVisible); KeyboardUtils.addKeyboardToggleListener(this, isVisible -> isKeyboardOpened = isVisible);
mNestedScroll.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { mNestedScroll.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
if(v.getChildAt(v.getChildCount() - 1) != null) { if(v.getChildAt(v.getChildCount() - 1) != null) {
if ((scrollY >= (v.getChildAt(v.getChildCount() - 1).getMeasuredHeight() - v.getMeasuredHeight())) && if ((scrollY >= (v.getChildAt(v.getChildCount() - 1).getMeasuredHeight() - v.getMeasuredHeight())) &&
@ -968,7 +1036,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
initializeGeckoView(true, true); initializeGeckoView(true, true);
mHomeViewController.progressBarReset(); mHomeViewController.progressBarReset();
mHomeViewController.onUpdateSearchBar(url,false,true, false); mHomeViewController.onUpdateSearchBar(url,false,true, false);
mGeckoClient.loadURL(url, mGeckoView); mGeckoClient.loadURL(url, mGeckoView, homeController.this);
if(isRemovable){ if(isRemovable){
mGeckoClient.setRemovableFromBackPressed(true); mGeckoClient.setRemovableFromBackPressed(true);
@ -976,8 +1044,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
public void postNewLinkTabAnimationInBackgroundTrigger(String url){ public void postNewLinkTabAnimationInBackgroundTrigger(String url){
postNewLinkTabAnimationInBackground(dataToStr(url)); initTabCount(M_NEW_LINK_IN_NEW_TAB, Collections.singletonList(url));
mHomeViewController.onShowLoadTabDialog();
} }
public void postNewLinkTabAnimationInBackground(String url){ public void postNewLinkTabAnimationInBackground(String url){
@ -987,7 +1054,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,true); mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,true);
mHomeViewController.progressBarReset(); mHomeViewController.progressBarReset();
mGeckoClient.initURL(url); mGeckoClient.initURL(url);
mGeckoClient.loadURL(url, mGeckoView); mGeckoClient.loadURL(url, mGeckoView, homeController.this);
mGeckoClient.getSession().setURL(url); mGeckoClient.getSession().setURL(url);
onSaveCurrentTab(mGeckoClient.getSession(),false); onSaveCurrentTab(mGeckoClient.getSession(),false);
onLoadTab(mSession,false,false); onLoadTab(mSession,false,false);
@ -1017,6 +1084,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
public void onOpenLinkNewTab(String url){ public void onOpenLinkNewTab(String url){
mNewTab.setPressed(true);
final Handler handler = new Handler(); final Handler handler = new Handler();
handler.postDelayed(() -> { handler.postDelayed(() -> {
onGetThumbnail(null, false); onGetThumbnail(null, false);
@ -1035,7 +1103,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(!status.mThemeApplying){ if(!status.mThemeApplying){
runOnUiThread(() -> { runOnUiThread(() -> {
mHomeViewController.onShowTabContainer(); mHomeViewController.onShowTabContainer();
activityContextManager.getInstance().getTabController().onInit(); activityContextManager.getInstance().getTabController().onInitInvoked();
}); });
} }
} }
@ -1055,7 +1123,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void onOpenMenuItem(View view){ public void onOpenMenuItem(View view){
pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); pluginController.getInstance().onMessageManagerInvoke(null, M_RESET);
initLocalLanguage(); initLocalLanguage();
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
helperMethod.hideKeyboard(this); helperMethod.hideKeyboard(this);
mHomeViewController.onOpenMenu(view,mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() ==View.INVISIBLE),mGeckoClient.getUserAgent()); mHomeViewController.onOpenMenu(view,mGeckoClient.canGoForward(),!(mProgressBar.getAlpha()<=0 || mProgressBar.getVisibility() ==View.INVISIBLE),mGeckoClient.getUserAgent());
@ -1082,7 +1149,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
@Override @Override
public void onBackPressed(){ public void onBackPressed(){
if(mTabFragment.getVisibility()==View.VISIBLE){ if(mTabFragment.getVisibility()==View.VISIBLE){
if(activityContextManager.getInstance().getTabController().getSelectionCount()>0){ if(activityContextManager.getInstance().getTabController().isSelectionOpened()){
activityContextManager.getInstance().getTabController().onClearSelection(null); activityContextManager.getInstance().getTabController().onClearSelection(null);
}else { }else {
onResumeDump(); onResumeDump();
@ -1143,7 +1210,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.closeMenu(); mHomeViewController.closeMenu();
final Handler handler = new Handler(); final Handler handler = new Handler();
handler.postDelayed(() -> mGeckoClient.onRedrawPixel(), 300); handler.postDelayed(() -> mGeckoClient.onRedrawPixel(homeController.this), 300);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
mHomeViewController.setOrientation(true); mHomeViewController.setOrientation(true);
if(mGeckoClient.getFullScreenStatus()) if(mGeckoClient.getFullScreenStatus())
@ -1171,7 +1238,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(mSearchEngineBar.getVisibility() == View.VISIBLE){ if(mSearchEngineBar.getVisibility() == View.VISIBLE){
mHomeViewController.onClearSelections(true); mHomeViewController.onClearSelections(true);
} }
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
} }
@Override @Override
@ -1234,11 +1301,28 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mAppRestarted = true; mAppRestarted = true;
pluginController.getInstance().onNotificationInvoke(null, pluginEnums.eNotificationManager.M_CLEAR_NOTIFICATION ); pluginController.getInstance().onNotificationInvoke(null, pluginEnums.eNotificationManager.M_CLEAR_NOTIFICATION );
if(!status.mThemeApplying){
activityContextManager.getInstance().onClearStack();
}
initWidget(); initWidget();
initTabCountForced(); initTabCountForced();
if(status.sSettingIsAppStarted && !status.mThemeApplying){
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_INIT_LOCALE);
}
status.mThemeApplying = false;
super.onResume(); super.onResume();
} }
public void onChangeDefaultLanguage(){
if(status.sSettingIsAppStarted){
setContentView(R.layout.home_view);
recreate();
}
}
public void onResumeDump() public void onResumeDump()
{ {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
@ -1336,7 +1420,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
public void onDownloadFile(){ public void onDownloadFile(){
mGeckoClient.downloadFile(); mGeckoClient.downloadFile(homeController.this);
} }
public void onManualDownload(String url){ public void onManualDownload(String url){
@ -1454,8 +1538,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
else if (menuId == R.id.menu9) { else if (menuId == R.id.menu9) {
helperMethod.hideKeyboard(this); helperMethod.hideKeyboard(this);
mGeckoClient.onRedrawPixel(); mGeckoClient.onRedrawPixel(homeController.this);
mHomeViewController.onShowTabContainer(); mHomeViewController.onShowTabContainer();
Log.i("I AM FUCKED,","I AM FUCKED : 1");
activityContextManager.getInstance().getTabController().onInit(); activityContextManager.getInstance().getTabController().onInit();
} }
else if (menuId == R.id.menu8) { else if (menuId == R.id.menu8) {
@ -1478,6 +1563,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
else if (menuId == R.id.pMenuOpenRecentTab) else if (menuId == R.id.pMenuOpenRecentTab)
{ {
mHomeViewController.onShowTabContainer(); mHomeViewController.onShowTabContainer();
Log.i("I AM FUCKED,","I AM FUCKED : 1");
activityContextManager.getInstance().getTabController().onInit(); activityContextManager.getInstance().getTabController().onInit();
// overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out); // overridePendingTransition(R.anim.popup_anim_in, R.anim.popup_anim_out);
} }
@ -1558,7 +1644,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if (menuId == R.id.menu26 || menuId == R.id.menu27) { if (menuId == R.id.menu26 || menuId == R.id.menu27) {
helperMethod.hideKeyboard(this); helperMethod.hideKeyboard(this);
mGeckoClient.toogleUserAgent(); mGeckoClient.toogleUserAgent();
mGeckoClient.onReload(mGeckoView); mGeckoClient.onReload(mGeckoView, homeController.this);
} }
if(menuId == R.id.menu25){ if(menuId == R.id.menu25){
helperMethod.hideKeyboard(this); helperMethod.hideKeyboard(this);
@ -1568,7 +1654,25 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.closeMenu(); mHomeViewController.closeMenu();
} }
private void onInitTheme(){
if(status.mThemeApplying){
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);
}
}
}
}
public void onReInitTheme(){ public void onReInitTheme(){
recreate();
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true);
} }
@ -1598,15 +1702,20 @@ public class homeController extends AppCompatActivity implements ComponentCallba
{ {
initTabCountForced(); initTabCountForced();
} }
else if(e_type.equals(enums.etype.M_NEW_LINK_IN_NEW_TAB))
{
postNewLinkTabAnimationInBackground(dataToStr(data.get(0)));
mHomeViewController.onShowLoadTabDialog();
}
else if(e_type.equals(open_new_tab))
{
if(status.sSettingPopupStatus){
pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_POPUP_BLOCKED);
}else {
postNewLinkTabAnimation(dataToStr(data.get(0)), true);
}
}
else if(e_type.equals(enums.etype.M_CACHE_UPDATE_TAB)){ else if(e_type.equals(enums.etype.M_CACHE_UPDATE_TAB)){
new Handler().postDelayed(() ->
{
mTabFragment.setAlpha(0.01f);
mTabFragment.setVisibility(View.VISIBLE);
activityContextManager.getInstance().getTabController().onInit();
mTabFragment.setVisibility(View.GONE);
mHomeViewController.onHideTabContainer();
}, 1000);
} }
else if(e_type.equals(enums.etype.M_UPDATE_PIXEL_BACKGROUND)){ else if(e_type.equals(enums.etype.M_UPDATE_PIXEL_BACKGROUND)){
onInvokePixelGenerator(); onInvokePixelGenerator();
@ -1623,7 +1732,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
else if(e_type.equals(enums.etype.M_UPDATE_THEME)) else if(e_type.equals(enums.etype.M_UPDATE_THEME))
{ {
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true); if(mGeckoClient!=null) {
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), true);
}
} }
else if(e_type.equals(enums.etype.ON_UPDATE_THEME)){ else if(e_type.equals(enums.etype.ON_UPDATE_THEME)){
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),false); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),false);
@ -1648,7 +1759,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
else if(e_type.equals(enums.etype.on_url_load)){ else if(e_type.equals(enums.etype.on_url_load)){
if(status.sSettingIsAppRedirected){ if(status.sSettingIsAppRedirected){
mHomeViewController.onPageFinished(); mHomeViewController.onPageFinished();
mGeckoClient.onRedrawPixel(); mGeckoClient.onRedrawPixel(homeController.this);
status.sSettingIsAppRedirected = false; status.sSettingIsAppRedirected = false;
onLoadURL(status.sSettingRedirectStatus); onLoadURL(status.sSettingRedirectStatus);
@ -1675,7 +1786,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
else if(status.sSettingIsAppStarted){ else if(status.sSettingIsAppStarted){
mHomeViewController.onPageFinished(); mHomeViewController.onPageFinished();
mGeckoClient.onRedrawPixel(); mGeckoClient.onRedrawPixel(homeController.this);
mHomeViewController.onProgressBarUpdate(5, false); mHomeViewController.onProgressBarUpdate(5, false);
onLoadTabOnResume(); onLoadTabOnResume();
} }
@ -1743,7 +1854,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
@Override @Override
public Object invokeObserver(List<Object> data, Object e_type) { public Object invokeObserver(List<Object> data, Object e_type) {
if(e_type.equals(enums.etype.fetch_favicon)){ if(e_type.equals(enums.etype.fetch_favicon)){
mGeckoClient.onGetFavIcon((ImageView) data.get(0), (String) data.get(1)); mGeckoClient.onGetFavIcon((ImageView) data.get(0), (String) data.get(1), homeController.this);
} }
return null; return null;
} }
@ -1763,7 +1874,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void onInvokePixelGenerator(){ public void onInvokePixelGenerator(){
if(mTabFragment.getVisibility()==View.VISIBLE){ if(mTabFragment==null || mTabFragment.getVisibility()==View.VISIBLE){
return; return;
} }
@ -1779,10 +1890,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}catch (Exception ignored){} }catch (Exception ignored){}
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
if(mTabFragment.getVisibility()!=View.VISIBLE){ if(mTabFragment!=null){
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, true)); if(mTabFragment.getVisibility()!=View.VISIBLE){
}else { dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, true));
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, true)); }else {
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, true));
}
} }
}, 150); }, 150);
@ -1851,7 +1964,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
else if(e_type.equals(enums.etype.on_page_loaded)){ else if(e_type.equals(enums.etype.on_page_loaded)){
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_BOOTSTRAPPED,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_BOOTSTRAPPED,true));
mHomeViewController.onPageFinished(); mHomeViewController.onPageFinished();
mGeckoClient.onRedrawPixel(); mGeckoClient.onRedrawPixel(homeController.this);
} }
else if(e_type.equals(M_RATE_APPLICATION)){ else if(e_type.equals(M_RATE_APPLICATION)){
if(!status.sSettingIsAppRated){ if(!status.sSettingIsAppRated){
@ -1864,7 +1977,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(homeController.this), pluginEnums.eLangManager.M_SET_LANGUAGE); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(homeController.this), pluginEnums.eLangManager.M_SET_LANGUAGE);
initLocalLanguage(); initLocalLanguage();
mHomeViewController.onPageFinished(); mHomeViewController.onPageFinished();
mGeckoClient.onRedrawPixel(); mGeckoClient.onRedrawPixel(homeController.this);
mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true, false); mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true, false);
} }
else if(e_type.equals(enums.etype.search_update)){ else if(e_type.equals(enums.etype.search_update)){
@ -1893,12 +2006,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba
else if(e_type.equals(M_LONG_PRESS_URL)){ else if(e_type.equals(M_LONG_PRESS_URL)){
pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_URL); pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_URL);
} }
else if(e_type.equals(enums.etype.open_new_tab)){ else if(e_type.equals(open_new_tab)){
if(status.sSettingPopupStatus){ initTabCount(open_new_tab, data);
pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_POPUP_BLOCKED);
}else {
postNewLinkTabAnimation(dataToStr(data.get(0)), true);
}
} }
else if(e_type.equals(enums.etype.on_close_sesson)){ else if(e_type.equals(enums.etype.on_close_sesson)){
if(!onCloseCurrentTab(mGeckoClient.getSession())){ if(!onCloseCurrentTab(mGeckoClient.getSession())){

View File

@ -110,6 +110,7 @@ class homeViewController
private ImageView mSearchLock; private ImageView mSearchLock;
private View mPopupLoadNewTab; private View mPopupLoadNewTab;
private ImageView mTopBarHider; private ImageView mTopBarHider;
private ImageView mNewTabBlocker;
/*Local Variables*/ /*Local Variables*/
private Callable<String> mLogs = null; private Callable<String> mLogs = null;
@ -119,7 +120,7 @@ class homeViewController
private Handler mTabDialogHandler = null; private Handler mTabDialogHandler = null;
private Runnable mTabDialogRunnable = null; private Runnable mTabDialogRunnable = null;
void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, AnimatedProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, View pPopupLoadNewTab, ImageView pTopBarHider){ void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, AnimatedProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, View pPopupLoadNewTab, ImageView pTopBarHider, ImageView pNewTabBlocker){
this.mContext = context; this.mContext = context;
this.mProgressBar = progressBar; this.mProgressBar = progressBar;
this.mSearchbar = searchbar; this.mSearchbar = searchbar;
@ -155,6 +156,7 @@ class homeViewController
this.mSearchLock = pSearchLock; this.mSearchLock = pSearchLock;
this.mPopupLoadNewTab = pPopupLoadNewTab; this.mPopupLoadNewTab = pPopupLoadNewTab;
this.mTopBarHider = pTopBarHider; this.mTopBarHider = pTopBarHider;
this.mNewTabBlocker = pNewTabBlocker;
initSplashScreen(); initSplashScreen();
createUpdateUiHandler(); createUpdateUiHandler();
@ -237,25 +239,25 @@ class homeViewController
if(mTabFragment.getAlpha()==0 || mTabFragment.getAlpha()==1){ if(mTabFragment.getAlpha()==0 || mTabFragment.getAlpha()==1){
onUpdateStatusBarTheme(null, false);
mTabFragment.animate().cancel(); mTabFragment.animate().cancel();
mTabFragment.setAlpha(0); mTabFragment.setAlpha(0);
mTabFragment.setVisibility(View.VISIBLE); mTabFragment.setVisibility(View.VISIBLE);
mTabFragment.animate().alpha(1).setDuration(250); mTabFragment.animate().alpha(1).setStartDelay(100).setDuration(150).withEndAction(() -> mNewTab.setPressed(false));
onUpdateStatusBarTheme(null, false);
} }
} }
public void onHideTabContainer(){ public void onHideTabContainer(){
if(mTabFragment.getAlpha()>0 || mTabFragment.getVisibility()!=View.GONE){ if(mTabFragment.getAlpha()>0 || mTabFragment.getVisibility()!=View.GONE){
mNewTab.setPressed(false);
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
mTopBarHider.animate().alpha(0).setDuration(250).setStartDelay(0).withEndAction(() -> mTopBarHider.setVisibility(View.GONE)); mTopBarHider.animate().alpha(0).setDuration(250).setStartDelay(0).withEndAction(() -> mTopBarHider.setVisibility(View.GONE));
mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME); mEvent.invokeObserver(null, enums.etype.M_UPDATE_THEME);
}, 250); }, 250);
mTabFragment.animate().setDuration(150).setStartDelay(150).alpha(0f).withEndAction(() -> { mTabFragment.animate().setDuration(150).alpha(0f).withEndAction(() -> {
mTabFragment.setVisibility(View.GONE); mTabFragment.setVisibility(View.GONE);
mEvent.invokeObserver(null, enums.etype.M_UPDATE_PIXEL_BACKGROUND); mEvent.invokeObserver(null, enums.etype.M_UPDATE_PIXEL_BACKGROUND);
}); });
@ -320,6 +322,8 @@ class homeViewController
if(!pStatus){ if(!pStatus){
this.mVoiceInput.animate().setDuration(0).alpha(0).withEndAction(() -> { this.mVoiceInput.animate().setDuration(0).alpha(0).withEndAction(() -> {
mVoiceInput.setClickable(true);
mVoiceInput.setFocusable(true);
onUpdateSearchIcon(1); onUpdateSearchIcon(1);
mVoiceInput.setVisibility(View.GONE); mVoiceInput.setVisibility(View.GONE);
mNewTab.setVisibility(View.VISIBLE); mNewTab.setVisibility(View.VISIBLE);
@ -360,6 +364,8 @@ class homeViewController
ex.printStackTrace(); ex.printStackTrace();
} }
mVoiceInput.setVisibility(View.VISIBLE); mVoiceInput.setVisibility(View.VISIBLE);
mVoiceInput.setClickable(true);
mVoiceInput.setFocusable(true);
}, 0); }, 0);
mNewTab.setVisibility(View.GONE); mNewTab.setVisibility(View.GONE);
@ -414,6 +420,9 @@ class homeViewController
}); });
} }
if(count==0){
count=1;
}
mNewTab.setText((count+strings.GENERIC_EMPTY_STR)); mNewTab.setText((count+strings.GENERIC_EMPTY_STR));
} }
@ -433,43 +442,48 @@ class homeViewController
} }
public void initStatusBarColor(boolean mInstant) { public void initStatusBarColor(boolean mInstant) {
animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
animatedColor oneToTwo = new animatedColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2));
int mDelay = 800; int mDelay = 800;
if(status.mThemeApplying || mInstant){ if(status.mThemeApplying || mInstant){
mDelay = 0; mDelay = 0;
}
ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f);
animator.setDuration(300).setStartDelay(mDelay);
animator.addUpdateListener(animation ->
{
float v = (float) animation.getAnimatedValue();
mContext.getWindow().setStatusBarColor(oneToTwo.with(v));
mContext.getWindow().setStatusBarColor(oneToTwo.with(v));
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
});
animator.addListener(new AnimatorListenerAdapter()
{
@Override
public void onAnimationEnd(Animator animation)
{
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}else {
View decorView = mContext.getWindow().getDecorView();
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
});
animator.start();
}else {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
} }
ValueAnimator animator = ObjectAnimator.ofFloat(0f, 1f);
animator.setDuration(300).setStartDelay(mDelay);
animator.addUpdateListener(animation ->
{
float v = (float) animation.getAnimatedValue();
mContext.getWindow().setStatusBarColor(oneToTwo.with(v));
mContext.getWindow().setStatusBarColor(oneToTwo.with(v));
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}
});
animator.addListener(new AnimatorListenerAdapter()
{
@Override
public void onAnimationEnd(Animator animation)
{
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}else {
View decorView = mContext.getWindow().getDecorView();
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
});
animator.start();
} }
void initializeSuggestionView(ArrayList<historyRowModel> suggestions){ void initializeSuggestionView(ArrayList<historyRowModel> suggestions){
@ -614,6 +628,7 @@ class homeViewController
mGatewaySplash.setVisibility(View.GONE); mGatewaySplash.setVisibility(View.GONE);
mConnectButton.setVisibility(View.GONE); mConnectButton.setVisibility(View.GONE);
mEvent.invokeObserver(null, enums.etype.M_CACHE_UPDATE_TAB); mEvent.invokeObserver(null, enums.etype.M_CACHE_UPDATE_TAB);
mEvent.invokeObserver(null, enums.etype.M_SPLASH_DISABLE);
})); }));
mEvent.invokeObserver(null, enums.etype.M_WELCOME_MESSAGE); mEvent.invokeObserver(null, enums.etype.M_WELCOME_MESSAGE);
mOrbotLogManager.setClickable(false); mOrbotLogManager.setClickable(false);
@ -673,7 +688,8 @@ class homeViewController
helperMethod.hideKeyboard(mContext); helperMethod.hideKeyboard(mContext);
popupWindow.setHeight(height); popupWindow.setHeight(height);
} }
if(status.sSettingLanguageRegion.equals("Ur")){
if(status.sSettingLanguageRegion.equals("Ur") || status.sSettingLanguage.equals("default") && status.mSystemLocale.getLanguage().equals("ur")){
popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.START,0,0); popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.START,0,0);
}else { }else {
popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.END,0,0); popupWindow.showAtLocation(parent, Gravity.TOP|Gravity.END,0,0);
@ -844,7 +860,10 @@ class homeViewController
public void onUpdateStatusBarTheme(String pTheme, boolean mForced) public void onUpdateStatusBarTheme(String pTheme, boolean mForced)
{ {
if(mSplashScreen.getAlpha()<=0 && (status.sTheme != enums.Theme.THEME_DARK && !status.sDefaultNightMode) && mTabFragment.getAlpha()<=0 || mForced){ if(mSplashScreen.getAlpha()<=0 && (status.sTheme != enums.Theme.THEME_DARK) && mTabFragment.getAlpha()<=0 || mForced){
if(status.sDefaultNightMode && status.sTheme == enums.Theme.THEME_DEFAULT){
return;
}
int mColor; int mColor;
try{ try{
mColor = Color.parseColor(pTheme); mColor = Color.parseColor(pTheme);
@ -899,7 +918,7 @@ class homeViewController
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mContext.getWindow().setStatusBarColor(Color.parseColor(pTheme)); mContext.getWindow().setStatusBarColor(Color.parseColor(pTheme));
}else { }else {
mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
if(helperMethod.isColorDark(mColor)){ if(helperMethod.isColorDark(mColor)){
@ -918,6 +937,7 @@ class homeViewController
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background));
}else { }else {
mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
GradientDrawable gradientDrawable1 = new GradientDrawable(); GradientDrawable gradientDrawable1 = new GradientDrawable();
@ -948,7 +968,7 @@ class homeViewController
onUpdateSearchIcon(1); onUpdateSearchIcon(1);
} }
if(status.sTheme != enums.Theme.THEME_DARK && !status.sDefaultNightMode){ if(status.sTheme != enums.Theme.THEME_DARK || (status.sDefaultNightMode && status.sTheme != enums.Theme.THEME_DEFAULT)){
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}else { }else {
View decorView = mContext.getWindow().getDecorView(); View decorView = mContext.getWindow().getDecorView();
@ -1097,7 +1117,61 @@ class homeViewController
} }
public void onNewTabAnimation(List<Object> data, Object e_type){ public void onNewTabAnimation(List<Object> data, Object e_type){
mEvent.invokeObserver(data, e_type); mGeckoView.setPivotX(0);
mGeckoView.setPivotY(0);
mGeckoView.setClickable(false);
mGeckoView.setFocusable(false);
mGeckoView.setEnabled(false);
ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mGeckoView,
PropertyValuesHolder.ofFloat("scaleX", 1, 0.35f),
PropertyValuesHolder.ofFloat("scaleY", 1, 0.35f));
scaleDown.setDuration(300);
mNewTabBlocker.setAlpha(0f);
mNewTabBlocker.setVisibility(View.VISIBLE);
mNewTabBlocker.animate().setDuration(300).alpha(1);
mNewTabBlocker.setTranslationZ(100);
scaleDown.start();
scaleDown.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation, boolean isReverse) {
}
@Override
public void onAnimationEnd(Animator animation, boolean isReverse) {
mEvent.invokeObserver(data, e_type);
ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(mGeckoView,
PropertyValuesHolder.ofFloat("scaleX", 0.35f, 1f),
PropertyValuesHolder.ofFloat("scaleY", 0.35f, 1f));
scaleDown.setDuration(300);
scaleDown.setStartDelay(650);
mNewTabBlocker.animate().setStartDelay(650).setDuration(300).alpha(0).withEndAction(() -> {
mNewTabBlocker.setAlpha(0f);
mNewTabBlocker.setVisibility(View.GONE);
});
scaleDown.start();
mGeckoView.setClickable(true);
mGeckoView.setFocusable(true);
mGeckoView.setEnabled(true);
}
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
} }
void onClearSelections(boolean hideKeyboard){ void onClearSelections(boolean hideKeyboard){

View File

@ -65,8 +65,8 @@ public class languageController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -135,7 +135,7 @@ public class languageController extends AppCompatActivity {
String mSystemLangugage = mSystemLocale.toString(); String mSystemLangugage = mSystemLocale.toString();
status.sSettingLanguage = CONST_LANGUAGE_DEFAULT_LANG; status.sSettingLanguage = CONST_LANGUAGE_DEFAULT_LANG;
status.sSettingLanguageRegion = CONST_LANGUAGE_DEFAULT_LANG; status.sSettingLanguageRegion = CONST_LANGUAGE_DEFAULT_LANG;
if(!mSystemLangugage.equals("en_US") && !mSystemLangugage.equals("de_DE") && !mSystemLangugage.equals("ca_ES") && !mSystemLangugage.equals("zh_CN") && !mSystemLangugage.equals("ch_CZ") && !mSystemLangugage.equals("nl_NL") && !mSystemLangugage.equals("fr_FR") && !mSystemLangugage.equals("el_GR") && !mSystemLangugage.equals("hu_HU") && !mSystemLangugage.equals("in_ID") && !mSystemLangugage.equals("it_IT") && !mSystemLangugage.equals("ja_JP") && !mSystemLangugage.equals("ko_KR") && !mSystemLangugage.equals("pt_PT") && !mSystemLangugage.equals("ro_RO") && !mSystemLangugage.equals("ru_RU") && !mSystemLangugage.equals("th_TH") && !mSystemLangugage.equals("tr_TR") && !mSystemLangugage.equals("uk_UA") && !mSystemLangugage.equals("vi_VN")){ if(!mSystemLangugage.equals("cs_CZ") && !mSystemLangugage.equals("en_US") && !mSystemLangugage.equals("ur_PK") && !mSystemLangugage.equals("de_DE") && !mSystemLangugage.equals("ca_ES") && !mSystemLangugage.equals("zh_CN") && !mSystemLangugage.equals("ch_CZ") && !mSystemLangugage.equals("nl_NL") && !mSystemLangugage.equals("fr_FR") && !mSystemLangugage.equals("el_GR") && !mSystemLangugage.equals("hu_HU") && !mSystemLangugage.equals("in_ID") && !mSystemLangugage.equals("it_IT") && !mSystemLangugage.equals("ja_JP") && !mSystemLangugage.equals("ko_KR") && !mSystemLangugage.equals("pt_PT") && !mSystemLangugage.equals("ro_RO") && !mSystemLangugage.equals("ru_RU") && !mSystemLangugage.equals("th_TH") && !mSystemLangugage.equals("tr_TR") && !mSystemLangugage.equals("uk_UA") && !mSystemLangugage.equals("vi_VN")){
mDefaultLanguageNotSupported = true; mDefaultLanguageNotSupported = true;
} }
}else { }else {
@ -167,12 +167,21 @@ public class languageController extends AppCompatActivity {
status.mThemeApplying = true; status.mThemeApplying = true;
activityContextManager.getInstance().getHomeController().recreate(); activityContextManager.getInstance().getHomeController().recreate();
if(activityContextManager.getInstance().getSettingGeneralController()!=null){
activityContextManager.getInstance().getSettingGeneralController().recreate();
}
return true; return true;
} }
/*View Callbacks*/ /*View Callbacks*/
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
private class languageViewCallback implements eventObserver.eventListener{ private class languageViewCallback implements eventObserver.eventListener{
@Override @Override

View File

@ -40,6 +40,7 @@ class languageViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -52,9 +52,9 @@ public class orbotLogController extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse); overridePendingTransition(R.anim.push_anim_out_reverse, R.anim.push_anim_in_reverse);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.orbot_log_view); setContentView(R.layout.orbot_log_view);
@ -66,8 +66,8 @@ public class orbotLogController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -226,6 +226,8 @@ public class orbotLogController extends AppCompatActivity {
@Override @Override
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
activityContextManager.getInstance().onRemoveStack(this);
activityContextManager.getInstance().setOrbotLogController(null);
mActivityClosed = true; mActivityClosed = true;
} }

View File

@ -50,6 +50,7 @@ class orbotLogViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -47,9 +47,9 @@ public class orbotController extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out); overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.orbot_settings_view); setContentView(R.layout.orbot_settings_view);
@ -59,8 +59,8 @@ public class orbotController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -126,6 +126,12 @@ public class orbotController extends AppCompatActivity {
/* LOCAL OVERRIDES */ /* LOCAL OVERRIDES */
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
@Override @Override
public void onResume() public void onResume()
{ {

View File

@ -40,6 +40,7 @@ class orbotViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -37,9 +37,9 @@ public class proxyStatusController extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out); overridePendingTransition(R.anim.push_anim_in, R.anim.push_anim_out);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.proxy_status_view); setContentView(R.layout.proxy_status_view);
@ -48,8 +48,8 @@ public class proxyStatusController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -91,6 +91,12 @@ public class proxyStatusController extends AppCompatActivity {
/* LOCAL OVERRIDES */ /* LOCAL OVERRIDES */
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
@Override @Override
public void onResume() public void onResume()
{ {

View File

@ -45,6 +45,7 @@ class proxyStatusViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -58,8 +58,8 @@ public class settingAccessibilityController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -159,6 +159,12 @@ public class settingAccessibilityController extends AppCompatActivity {
} }
} }
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
public void onZoomSettingUpdate(View view){ public void onZoomSettingUpdate(View view){
mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING, Collections.singletonList(!mZoom.isChecked())); mSettingAccessibilityModel.onTrigger(settingAccessibilityEnums.eAccessibilityViewController.M_ZOOM_SETTING, Collections.singletonList(!mZoom.isChecked()));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,status.sSettingEnableZoom)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,status.sSettingEnableZoom));

View File

@ -52,6 +52,7 @@ class settingAccessibilityViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -54,8 +54,8 @@ public class settingAdvanceController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -135,6 +135,12 @@ public class settingAdvanceController extends AppCompatActivity {
/*UI Redirection*/ /*UI Redirection*/
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
public void onClose(View view){ public void onClose(View view){
if(mIsChanged){ if(mIsChanged){
pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_UPDATE_PRIVACY); pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_UPDATE_PRIVACY);

View File

@ -93,6 +93,7 @@ class settingAdvanceViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -10,7 +10,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController; import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
@ -46,18 +46,17 @@ public class settingClearController extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.setting_clear_view); setContentView(R.layout.setting_clear_view);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
viewsInitializations(); viewsInitializations();
} }
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -147,7 +146,7 @@ public class settingClearController extends AppCompatActivity {
mCheckBoxList.get(7).setChecked(false); mCheckBoxList.get(7).setChecked(false);
mCheckBoxList.get(7).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); mCheckBoxList.get(7).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
onClearSettings(); onClearSettings();
status.initStatus(); status.initStatus(activityContextManager.getInstance().getHomeController());
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mHomeInvoked = true; mHomeInvoked = true;
} }
@ -230,6 +229,12 @@ public class settingClearController extends AppCompatActivity {
} }
} }
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
public void onClose(View view){ public void onClose(View view){
activityContextManager.getInstance().onRemoveStack(this); activityContextManager.getInstance().onRemoveStack(this);
finish(); finish();

View File

@ -40,6 +40,7 @@ class settingClearViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -5,7 +5,6 @@ import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
@ -50,6 +49,9 @@ public class settingGeneralController extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if(!status.mThemeApplying){
activityContextManager.getInstance().onStack(this);
}
setContentView(R.layout.setting_general_view); setContentView(R.layout.setting_general_view);
activityContextManager.getInstance().setSettingGeneralController(this); activityContextManager.getInstance().setSettingGeneralController(this);
@ -58,8 +60,8 @@ public class settingGeneralController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -73,30 +75,10 @@ public class settingGeneralController extends AppCompatActivity {
mHomePageText = findViewById(R.id.pHomePageText); mHomePageText = findViewById(R.id.pHomePageText);
mOpenURLInNewTab = findViewById(R.id.pOpenURLInNewTab); mOpenURLInNewTab = findViewById(R.id.pOpenURLInNewTab);
activityContextManager.getInstance().onStack(this);
mSettingGeneralViewController = new settingGeneralViewController(this, new settingGeneralViewCallback(), mFullScreenMode, mThemeLight, mThemeDark, mThemeDefault, mHomePageText, mOpenURLInNewTab); mSettingGeneralViewController = new settingGeneralViewController(this, new settingGeneralViewCallback(), mFullScreenMode, mThemeLight, mThemeDark, mThemeDefault, mHomePageText, mOpenURLInNewTab);
mSettingGeneralModel = new settingGeneralModel(new settingGeneralModelCallback()); mSettingGeneralModel = new settingGeneralModel(new settingGeneralModelCallback());
} }
private void onInitTheme(){
if(status.sTheme == enums.Theme.THEME_DARK){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
activityContextManager.getInstance().getHomeController().recreate();
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
activityContextManager.getInstance().getHomeController().recreate();
}else {
if(!status.sDefaultNightMode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
activityContextManager.getInstance().getHomeController().recreate();
}else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
activityContextManager.getInstance().getHomeController().recreate();
}
}
}
/*View Callbacks*/ /*View Callbacks*/
private class settingGeneralViewCallback implements eventObserver.eventListener{ private class settingGeneralViewCallback implements eventObserver.eventListener{
@ -134,9 +116,9 @@ public class settingGeneralController extends AppCompatActivity {
if(mIsThemeChangable){ if(mIsThemeChangable){
status.mThemeApplying = true; status.mThemeApplying = true;
onInitTheme();
onBackPressed(); onBackPressed();
overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang); overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang);
activityContextManager.getInstance().getHomeController().onReInitTheme();
activityContextManager.getInstance().getSettingController().onReInitTheme(); activityContextManager.getInstance().getSettingController().onReInitTheme();
helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, settingGeneralController.this,true); helperMethod.openActivity(settingGeneralController.class, constants.CONST_LIST_HISTORY, settingGeneralController.this,true);
} }
@ -161,6 +143,9 @@ public class settingGeneralController extends AppCompatActivity {
@Override @Override
public void onResume() public void onResume()
{ {
if(status.mThemeApplying){
// activityContextManager.getInstance().onStack(this);
}
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this); activityContextManager.getInstance().setCurrentActivity(this);
super.onResume(); super.onResume();
@ -174,7 +159,6 @@ public class settingGeneralController extends AppCompatActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
activityContextManager.getInstance().onRemoveStack(this);
finish(); finish();
} }
@ -190,6 +174,15 @@ public class settingGeneralController extends AppCompatActivity {
finish(); finish();
} }
@Override
protected void onDestroy() {
if(!status.mThemeApplying){
activityContextManager.getInstance().onRemoveStack(this);
}
activityContextManager.getInstance().setSettingGeneralController(null);
super.onDestroy();
}
public void onManageLanguage(View view) { public void onManageLanguage(View view) {
helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, this,true); helperMethod.openActivity(languageController.class, constants.CONST_LIST_HISTORY, this,true);
} }

View File

@ -61,6 +61,7 @@ class settingGeneralViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -45,8 +45,8 @@ public class settingLogController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -100,7 +100,12 @@ public class settingLogController extends AppCompatActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
finish(); finish();
}
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this); activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
} }
/*UI Redirection*/ /*UI Redirection*/

View File

@ -51,6 +51,7 @@ class settingLogViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -44,8 +44,8 @@ public class settingNotificationController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -106,7 +106,12 @@ public class settingNotificationController extends AppCompatActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
finish(); finish();
}
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this); activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
} }
/*UI Redirection*/ /*UI Redirection*/

View File

@ -49,6 +49,7 @@ class settingNotificationViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -51,8 +51,8 @@ public class settingPrivacyController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -118,10 +118,15 @@ public class settingPrivacyController extends AppCompatActivity {
activityContextManager.getInstance().setCurrentActivity(this); activityContextManager.getInstance().setCurrentActivity(this);
activityContextManager.getInstance().getHomeController().initRuntimeSettings(); activityContextManager.getInstance().getHomeController().initRuntimeSettings();
} }
activityContextManager.getInstance().onRemoveStack(this);
finish(); finish();
} }
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
/*UI Redirection*/ /*UI Redirection*/
public void onClose(View view){ public void onClose(View view){

View File

@ -55,6 +55,7 @@ class settingPrivacyViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -46,8 +46,8 @@ public class settingSearchController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -111,6 +111,12 @@ public class settingSearchController extends AppCompatActivity {
finish(); finish();
} }
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
/*UI Redirection*/ /*UI Redirection*/
public void onClose(View view){ public void onClose(View view){

View File

@ -54,6 +54,7 @@ class settingSearchViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -56,16 +56,19 @@ public class settingHomeController extends AppCompatActivity
{ {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.setting); if(!status.mThemeApplying){
activityContextManager.getInstance().onStack(this);
}
setContentView(R.layout.setting);
viewsInitializations(); viewsInitializations();
listenersInitializations(); listenersInitializations();
} }
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -117,10 +120,13 @@ public class settingHomeController extends AppCompatActivity
@Override @Override
public void onResume() public void onResume()
{ {
if(status.mThemeApplying){
// activityContextManager.getInstance().onStack(this);
}
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME);
activityContextManager.getInstance().setCurrentActivity(this); activityContextManager.getInstance().setCurrentActivity(this);
status.sSettingIsAppPaused = false; status.sSettingIsAppPaused = false;
activityContextManager.getInstance().onStack(this);
super.onResume(); super.onResume();
} }
@ -133,10 +139,18 @@ public class settingHomeController extends AppCompatActivity
@Override @Override
public void onBackPressed(){ public void onBackPressed(){
activityContextManager.getInstance().onRemoveStack(this);
finish(); finish();
} }
@Override
protected void onDestroy() {
if(!status.mThemeApplying){
activityContextManager.getInstance().onRemoveStack(this);
}
activityContextManager.getInstance().setSettingController(null);
super.onDestroy();
}
/*External Redirection*/ /*External Redirection*/
public void onRedrawXML(){ public void onRedrawXML(){
@ -157,7 +171,7 @@ public class settingHomeController extends AppCompatActivity
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
startActivity(new Intent(android.provider.Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS)); startActivity(new Intent(android.provider.Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS));
}else{ }else{
pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_NOT_SUPPORTED); //pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_NOT_SUPPORTED);
} }
} }

View File

@ -35,6 +35,7 @@ class settingHomeViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -21,6 +21,9 @@ import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.switchmaterial.SwitchMaterial;
import org.mozilla.geckoview.ContentBlocking;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -46,8 +49,8 @@ public class settingTrackingController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig);
theme.getInstance().onConfigurationChanged(this); theme.getInstance().onConfigurationChanged(this);
} }
@ -112,6 +115,12 @@ public class settingTrackingController extends AppCompatActivity {
finish(); finish();
} }
@Override
protected void onDestroy() {
activityContextManager.getInstance().onRemoveStack(this);
super.onDestroy();
}
/*UI Redirection*/ /*UI Redirection*/
public void onClose(View view){ public void onClose(View view){
@ -122,7 +131,7 @@ public class settingTrackingController extends AppCompatActivity {
mSettingChanged = true; mSettingChanged = true;
mSettingPrivacyViewController.onTrigger(settingTrackingEnums.eTrackingViewController.M_SET_TRACKING_STATUS, Collections.singletonList(view)); mSettingPrivacyViewController.onTrigger(settingTrackingEnums.eTrackingViewController.M_SET_TRACKING_STATUS, Collections.singletonList(view));
mSettingPrivacyModel.onTrigger(settingTrackingEnums.eTrackingModel.M_SET_TRACKING_PROTECTION, Collections.singletonList(view)); mSettingPrivacyModel.onTrigger(settingTrackingEnums.eTrackingModel.M_SET_TRACKING_PROTECTION, Collections.singletonList(view));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,status.sSettingCookieStatus)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, status.sSettingTrackingProtection));
} }
public void onOpenInfo(View view) { public void onOpenInfo(View view) {

View File

@ -43,6 +43,7 @@ class settingTrackingViewController
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
} }
else { else {
if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){

View File

@ -4,18 +4,14 @@ import android.animation.Animator;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder; import android.animation.PropertyValuesHolder;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable; import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.ScaleAnimation;
import android.widget.Button; import android.widget.Button;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageButton; import android.widget.ImageButton;
@ -101,74 +97,53 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
holder.itemView.setTag(position); holder.itemView.setTag(position);
holder.itemView.findViewById(R.id.pRemoveRow).setTag(position); holder.itemView.findViewById(R.id.pRemoveRow).setTag(position);
holder.itemView.findViewById(R.id.pLoadSession).setTag(position); holder.itemView.findViewById(R.id.pLoadSession).setTag(position);
if(position == 0 && status.sTabGridLayoutEnabled && !mViewLoaded){ if(position == 0 && status.sTabGridLayoutEnabled && !mViewLoaded){
onExpandScale(holder.itemView);
mViewLoaded = true; }else{
}else if(position != mModelList.size()-1){
holder.itemView.setScaleY(1f);
holder.itemView.setScaleX(1f);
} }
} }
private boolean mFirstRowAnimating = false; public void scaleView(View v, tabRowModel mTabRowModel) {
public void onExpandScale(View v) {
if(mFirstRowAnimating){
return;
}
mFirstRowAnimating = true;
v.bringToFront(); v.bringToFront();
if(mFirstRow!=null){ ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(v,
mFirstRow.end(); PropertyValuesHolder.ofFloat("scaleX", 1, 0.9f),
mFirstRow.cancel(); PropertyValuesHolder.ofFloat("scaleY", 1, 0.9f));
} scaleDown.setDuration(130);
v.setScaleY(0.85f); scaleDown.start();
v.setScaleX(0.85f); v.setClickable(false);
mFirstRow = ObjectAnimator.ofPropertyValuesHolder(v, v.setFocusable(false);
PropertyValuesHolder.ofFloat("scaleX", 0.85f, 1), v.setEnabled(false);
PropertyValuesHolder.ofFloat("scaleY", 0.85f, 1)); mEvent.invokeObserver(Arrays.asList(mTabRowModel.getSession(), false), tabEnums.eTabAdapterCallback.ON_LOAD_TAB);
mFirstRow.setDuration(200);
mFirstRow.setStartDelay(150); scaleDown.addListener(new Animator.AnimatorListener() {
mFirstRow.start();
mFirstRow.addListener(new Animator.AnimatorListener() {
@Override @Override
public void onAnimationStart(Animator animation, boolean isReverse) { public void onAnimationStart(Animator animation, boolean isReverse) {
} }
@Override @Override
public void onAnimationEnd(Animator animation, boolean isReverse) { public void onAnimationEnd(Animator animation, boolean isReverse) {
mFirstRowAnimating = false; onTriggerURL(mTabRowModel);
} }
@Override @Override
public void onAnimationStart(Animator animation) { public void onAnimationStart(Animator animation) {
} }
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
mFirstRowAnimating = false;
} }
@Override @Override
public void onAnimationCancel(Animator animation) { public void onAnimationCancel(Animator animation) {
mFirstRowAnimating = false;
} }
@Override @Override
public void onAnimationRepeat(Animator animation) { public void onAnimationRepeat(Animator animation) {
} }
}); });
}
public void scaleView(View v) {
v.bringToFront();
ObjectAnimator scaleDown = ObjectAnimator.ofPropertyValuesHolder(v,
PropertyValuesHolder.ofFloat("scaleX", 1, 0.85f),
PropertyValuesHolder.ofFloat("scaleY", 1, 0.85f));
scaleDown.setDuration(200);
scaleDown.start();
} }
@Override @Override
@ -183,7 +158,8 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
} }
private void onRemoveAllSelection() { private void onRemoveAllSelection() {
if(mSelectedList!=null && mSelectedList.size()>0){ if(mSelectedList.size()>0){
int mSelectionInitialSize = mSelectedList.size();
for(int mCounter=0;mCounter<mSelectedList.size();mCounter++){ for(int mCounter=0;mCounter<mSelectedList.size();mCounter++){
for(int mCounterInner=0;mCounterInner<mModelList.size();mCounterInner++){ for(int mCounterInner=0;mCounterInner<mModelList.size();mCounterInner++){
if(mSelectedList.get(mCounter).equals(mModelList.get(mCounterInner).getmId())){ if(mSelectedList.get(mCounter).equals(mModelList.get(mCounterInner).getmId())){
@ -191,7 +167,11 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
mModelList.remove(mCounterInner); mModelList.remove(mCounterInner);
notifyItemRemoved(mCounterInner); notifyItemRemoved(mCounterInner);
notifyItemRangeChanged(mCounterInner,mModelList.size()); notifyItemRangeChanged(mCounterInner,mModelList.size());
mEvent.invokeObserver(Collections.singletonList(mCounterInner), tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP); if(mSelectionInitialSize == 1){
mEvent.invokeObserver(Arrays.asList(mCounterInner, true), tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP);
}else {
mEvent.invokeObserver(Arrays.asList(mCounterInner, false), tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP);
}
mCounter=-1; mCounter=-1;
break; break;
} }
@ -216,12 +196,17 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
private void onRemoveAll(){ private void onRemoveAll(){
int mSize = mModelList.size()-1; int mSize = mModelList.size()-1;
for(int mCounter=0;mCounter<mSize;mCounter++){ if(mSize==1){
mModelList.remove(0); mModelList.remove(0);
notifyDataSetChanged(); notifyDataSetChanged();
mEvent.invokeObserver(Collections.singletonList(0), tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP); mEvent.invokeObserver(Arrays.asList(0, true), tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP);
}else {
for(int mCounter=0;mCounter<mSize;mCounter++){
mModelList.remove(0);
notifyDataSetChanged();
mEvent.invokeObserver(Arrays.asList(0, false), tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP);
}
} }
} }
private void onClearAllSelection(){ private void onClearAllSelection(){
@ -269,7 +254,6 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
private void onTriggerURL(tabRowModel model){ private void onTriggerURL(tabRowModel model){
if(model.getSession()!=null){ if(model.getSession()!=null){
mEvent.invokeObserver(Arrays.asList(model.getSession(), false), tabEnums.eTabAdapterCallback.ON_LOAD_TAB);
mEvent.invokeObserver(null, tabEnums.eTabAdapterCallback.ON_BACK_PRESSED); mEvent.invokeObserver(null, tabEnums.eTabAdapterCallback.ON_BACK_PRESSED);
mEvent.invokeObserver(null, tabEnums.eTabAdapterCallback.ON_INIT_TAB_COUNT); mEvent.invokeObserver(null, tabEnums.eTabAdapterCallback.ON_INIT_TAB_COUNT);
} }
@ -330,7 +314,11 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
mItemSelectionMenuReference = itemView.findViewById(R.id.pRowContainer); mItemSelectionMenuReference = itemView.findViewById(R.id.pRowContainer);
mBorder = itemView.findViewById(R.id.pBorder); mBorder = itemView.findViewById(R.id.pBorder);
itemView.setScaleX(1);
itemView.setScaleY(1);
itemView.setClickable(true); itemView.setClickable(true);
itemView.setFocusable(true);
itemView.setEnabled(true);
mRemoveRow.setEnabled(true); mRemoveRow.setEnabled(true);
if(model.getmId()==null){ if(model.getmId()==null){
@ -340,6 +328,7 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
mLoadSession.setOnLongClickListener(this); mLoadSession.setOnLongClickListener(this);
mRemoveRow.setOnClickListener(this); mRemoveRow.setOnClickListener(this);
mLoadSession.setOnClickListener(this); mLoadSession.setOnClickListener(this);
if(model.getSession().getTheme()==null){ if(model.getSession().getTheme()==null){
if(status.sTabGridLayoutEnabled){ if(status.sTabGridLayoutEnabled){
mBorder.setBackgroundColor(ContextCompat.getColor(itemView.getContext(), R.color.c_view_divier_background_inner)); mBorder.setBackgroundColor(ContextCompat.getColor(itemView.getContext(), R.color.c_view_divier_background_inner));
@ -361,7 +350,7 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
} }
mItemSelectionMenu.setVisibility(View.GONE); mItemSelectionMenu.setVisibility(View.GONE);
if(model.getSession().getTitle().equals("$TITLE") || model.getSession().getTitle().toLowerCase().equals("loading")){ if(model.getSession().getTitle().contains("TITLE") || model.getSession().getTitle().contains("title") || model.getSession().getTitle().toLowerCase().equals("loading")){
mHeader.setText(helperMethod.getDomainName(mURL)); mHeader.setText(helperMethod.getDomainName(mURL));
}else { }else {
mHeader.setText(model.getSession().getTitle()); mHeader.setText(model.getSession().getTitle());
@ -377,21 +366,15 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
if(mURL.equals("about:blank")){ if(mURL.equals("about:blank")){
mWebThumbnail.setAlpha(0f); mWebThumbnail.setAlpha(0f);
}else { }else {
Thread timer = new Thread() new Handler().postDelayed(() ->
{
public void run()
{ {
runOnUiThread(() -> { if(mWebThumbnail.getDrawable()==null){
if(mWebThumbnail.getDrawable()==null){ mWebThumbnail.setImageBitmap(model.getBitmap());
mWebThumbnail.setImageBitmap(model.getBitmap()); }else {
}else { Drawable mDrawable = new BitmapDrawable(itemView.getContext().getResources(), model.getBitmap());
Drawable mDrawable = new BitmapDrawable(itemView.getContext().getResources(), model.getBitmap()); helperMethod.setImageDrawableWithAnimation(mWebThumbnail, mDrawable,250);
helperMethod.setImageDrawableWithAnimation(mWebThumbnail, mDrawable,250); }
} }, 1 * getLayoutPosition());
});
}
};
timer.start();
} }
if(mSelectedList.contains(model.getSession().getSessionID())){ if(mSelectedList.contains(model.getSession().getSessionID())){
@ -411,12 +394,14 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
} }
} }
itemView.setBackgroundColor(ContextCompat.getColor(activityContextManager.getInstance().getHomeController(), R.color.clear_alpha)); new Handler().postDelayed(() ->
if(!status.sTabGridLayoutEnabled){ {
if(getLayoutPosition() == 0){ itemView.setBackgroundColor(ContextCompat.getColor(activityContextManager.getInstance().getHomeController(), R.color.clear_alpha));
itemView.setBackgroundColor(ContextCompat.getColor(activityContextManager.getInstance().getHomeController(), R.color.c_list_item_current)); if(!status.sTabGridLayoutEnabled){
if(getLayoutPosition() == 0){
itemView.setBackgroundColor(ContextCompat.getColor(activityContextManager.getInstance().getHomeController(), R.color.c_list_item_current));
}
} }
}
if(status.sTabGridLayoutEnabled){ if(status.sTabGridLayoutEnabled){
CardView mLayout = itemView.findViewById(R.id.pRowContainerInner); CardView mLayout = itemView.findViewById(R.id.pRowContainerInner);
@ -470,6 +455,8 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
mItemSelectionMenuButton.animate().setDuration(250).alpha(1); mItemSelectionMenuButton.animate().setDuration(250).alpha(1);
} }
mRemoveRow.bringToFront(); mRemoveRow.bringToFront();
}, 10 * getLayoutPosition());
} }
@ -485,9 +472,8 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
notifyItemChanged(mModelList.size()-1); notifyItemChanged(mModelList.size()-1);
}else { }else {
onTriggerURL(mModelList.get(this.getLayoutPosition()));
if(status.sTabGridLayoutEnabled){ if(status.sTabGridLayoutEnabled){
scaleView(itemView); scaleView(itemView, mModelList.get(this.getLayoutPosition()));
} }
} }
}else { }else {

View File

@ -2,6 +2,7 @@ package com.darkweb.genesissearchengine.appManager.tabManager;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
@ -26,9 +27,7 @@ import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController; import com.darkweb.genesissearchengine.appManager.settingManager.advanceManager.settingAdvanceController;
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingHomeController;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
@ -52,7 +51,7 @@ public class tabController extends Fragment
private TextView mSelectionCount; private TextView mSelectionCount;
private ImageView mBlocker; private ImageView mBlocker;
private View mRootView; private View mRootView;
private NestedScrollView mNestedScrollView; private NestedScrollView mNestedScrollView = null;
/*Private Variables*/ /*Private Variables*/
@ -71,6 +70,7 @@ public class tabController extends Fragment
private float getmScreenWidth; private float getmScreenWidth;
private boolean mClosed = false; private boolean mClosed = false;
private boolean mClosedByNewTab = false; private boolean mClosedByNewTab = false;
boolean mScrolled = true;
/*Initializations*/ /*Initializations*/
@ -84,39 +84,61 @@ public class tabController extends Fragment
return root; return root;
} }
@Override
public void onDestroy() {
mListModel = null;
mHomeController = null;
mContextManager = null;
mtabViewController = null;
mRecycleView = null;
mTabAdapter = null;
mScrollHandler = null;
mScrollRunnable = null;
mScrolled = false;
super.onDestroy();
}
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
activityContextManager.getInstance().setTabController(this); activityContextManager.getInstance().setTabController(this);
mTabGridLayoutEnabled = status.sTabGridLayoutEnabled;
onInit();
} }
public void onInit(){
if(mTabAdapter==null || mTabGridLayoutEnabled!=status.sTabGridLayoutEnabled){
initializeActivity();
initializeViews();
initializeLocalEventHandlers();
initializeList();
initSwipe();
mTabGridLayoutEnabled = status.sTabGridLayoutEnabled;
}else {
initializeList();
}
public void onInit(){
initializeActivity();
initializeViews();
initializeLocalEventHandlers();
initializeList();
initSwipe();
mClosed = false;
mTabGridLayoutEnabled = status.sTabGridLayoutEnabled;
mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_RELEASE_BLOCKER, null);
mNestedScrollView.scrollTo(0,0);
mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG_INIT, null);
mRecycleView.animate().setDuration(150).alpha(1);
mRecycleView.setAlpha(1);
}
public void onInitInvoked(){
initializeList();
mClosed = false; mClosed = false;
mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_RELEASE_BLOCKER, null); mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_RELEASE_BLOCKER, null);
mNestedScrollView.scrollTo(0,0); mNestedScrollView.scrollTo(0,0);
mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG_INIT, null); mtabViewController.onTrigger(tabEnums.eTabViewCommands.ON_HIDE_UNDO_DIALOG_INIT, null);
mRecycleView.setAlpha(1); mRecycleView.setAlpha(1);
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.M_INITIALIZE, Collections.singletonList(mListModel.getList()));
mTabAdapter.notifyDataSetChanged(); mTabAdapter.notifyDataSetChanged();
} }
public void onInitFirstElement(){ public void onInitFirstElement(){
if(mTabAdapter!=null){ if(mTabAdapter!=null){
mHomeController.runOnUiThread(new Runnable() { mHomeController.runOnUiThread(() -> {
@Override if(mBlocker.getVisibility() != View.VISIBLE){
public void run() {
mTabAdapter.notifyItemChanged(0); mTabAdapter.notifyItemChanged(0);
} }
}); });
@ -147,6 +169,7 @@ public class tabController extends Fragment
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
public void initializeLocalEventHandlers(){ public void initializeLocalEventHandlers(){
mTabs.setOnTouchListener((v, event) -> { mTabs.setOnTouchListener((v, event) -> {
if(event.getAction() == MotionEvent.ACTION_DOWN){ if(event.getAction() == MotionEvent.ACTION_DOWN){
onBackPressedInvoked(null); onBackPressedInvoked(null);
@ -168,21 +191,24 @@ public class tabController extends Fragment
minScroll = scrollY; minScroll = scrollY;
int orientation = this.getResources().getConfiguration().orientation; int orientation = this.getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT) { if (orientation == Configuration.ORIENTATION_PORTRAIT) {
maxScroll = mRecycleView.computeVerticalScrollRange() - mScreenHeight*0.350f; maxScroll = mRecycleView.computeVerticalScrollRange() - mScreenHeight*0.350f + helperMethod.pxFromDp(helperMethod.getNavigationBarSize(getContext()).y);
} else { } else {
maxScroll = mRecycleView.computeVerticalScrollRange() - getmScreenWidth*0.20f; maxScroll = mRecycleView.computeVerticalScrollRange() - getmScreenWidth*0.20f + helperMethod.pxFromDp(helperMethod.getNavigationBarSize(getContext()).y);
} }
onSwipeBounce(300); if(!mScrolled){
onSwipeBounce(300);
}
}); });
mNestedScrollView.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { mNestedScrollView.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
mScrolled = false;
if (mRecycleView.getChildAt(mRecycleView.getChildCount() - 1) != null) { if (mRecycleView.getChildAt(mRecycleView.getChildCount() - 1) != null) {
if ((scrollY >= (mRecycleView.getChildAt(mRecycleView.getChildCount() - 1).getMeasuredHeight() - mRecycleView.getMeasuredHeight())) && scrollY > oldScrollY) { if ((scrollY >= (mRecycleView.getChildAt(mRecycleView.getChildCount() - 1).getMeasuredHeight() - mRecycleView.getMeasuredHeight())) && scrollY > oldScrollY) {
Log.i("FUCK2:::::::",scrollY+""); Log.i("FUCK2:::::::",scrollY+"");
onSwipeBounce(0); onSwipeBounce(0);
} }
} }
}); });
} }
@ -262,7 +288,7 @@ public class tabController extends Fragment
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
int position = viewHolder.getAdapterPosition(); int position = viewHolder.getAdapterPosition();
onExitAndClearBackup(); onExitAndClearBackup();
boolean mStatus = onInitRemoveView(position, true); boolean mStatus = onInitRemoveView(position, true, true);
if(mStatus){ if(mStatus){
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.NOTIFY_SWIPE, Collections.singletonList(position)); mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.NOTIFY_SWIPE, Collections.singletonList(position));
} }
@ -303,12 +329,17 @@ public class tabController extends Fragment
onSwipeBounce(0); onSwipeBounce(0);
} }
public boolean onInitRemoveView(int pIndex, boolean pCreateBackup){ public boolean onInitRemoveView(int pIndex, boolean pCreateBackup, boolean pShowPopupOnClearAll){
if(mListModel.getList().size()<=pIndex){
return false;
}
mListModel.onTrigger(tabEnums.eModelCallback.M_REMOVE_TAB,Collections.singletonList(pIndex)); mListModel.onTrigger(tabEnums.eModelCallback.M_REMOVE_TAB,Collections.singletonList(pIndex));
mListModel.getList().remove(pIndex); mListModel.getList().remove(pIndex);
if(mListModel.getList().size()<1){ if(mListModel.getList().size()<1){
mRecycleView.animate().setDuration(200).alpha(0).withEndAction(() -> { mRecycleView.animate().setDuration(200).alpha(0).withEndAction(() -> {
onShowUndoDialog(); if(pShowPopupOnClearAll){
onShowUndoDialog();
}
mTabAdapter.notifyDataSetChanged(); mTabAdapter.notifyDataSetChanged();
}); });
activityContextManager.getInstance().getHomeController().onLoadTabFromTabController(); activityContextManager.getInstance().getHomeController().onLoadTabFromTabController();
@ -341,12 +372,15 @@ public class tabController extends Fragment
ArrayList<tabRowModel> mBackup = (ArrayList<tabRowModel>)mListModel.onTrigger(tabEnums.eModelCallback.M_GET_BACKUP,null); ArrayList<tabRowModel> mBackup = (ArrayList<tabRowModel>)mListModel.onTrigger(tabEnums.eModelCallback.M_GET_BACKUP,null);
if(mListModel.getList().size()>=1 && mBackup.size()!=1){ if(mListModel.getList().size()>=1 && mBackup.size()!=1){
mHomeController.onNewTabBackground(true,false); mHomeController.onNewTabBackground(true,false);
}
mClosedByNewTab = false; mClosedByNewTab = false;
onPostExit(); onPostExit();
onBackPressed(); onBackPressed();
onClose(); onClose();
}
else {
onExitAndClearBackup();
}
} }
public void onRestoreTab(View view){ public void onRestoreTab(View view){
@ -390,7 +424,9 @@ public class tabController extends Fragment
if(mListModel!=null){ if(mListModel!=null){
for(int mCounter=0; mCounter<mListModel.getList().size();mCounter++){ for(int mCounter=0; mCounter<mListModel.getList().size();mCounter++){
if(mListModel.getList().get(mCounter).getSession().getSessionID().equals(pId)){ if(mListModel.getList().get(mCounter).getSession().getSessionID().equals(pId)){
mTabAdapter.notifyItemChanged(mCounter); if(mBlocker.getVisibility() != View.VISIBLE){
mTabAdapter.notifyItemChanged(mCounter);
}
} }
} }
} }
@ -412,6 +448,10 @@ public class tabController extends Fragment
return (int)mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.GET_SELECTION_SIZE,null); return (int)mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.GET_SELECTION_SIZE,null);
} }
public boolean isSelectionOpened(){
return mClearSelection.getVisibility() == View.VISIBLE;
}
public void onRemoveSelection(View view) { public void onRemoveSelection(View view) {
int mSelectionSize = (int)mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.GET_SELECTION_SIZE,null); int mSelectionSize = (int)mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.GET_SELECTION_SIZE,null);
if(mSelectionSize >= mListModel.getList().size()){ if(mSelectionSize >= mListModel.getList().size()){
@ -458,19 +498,20 @@ public class tabController extends Fragment
public void onMenuTrigger(View pView){ public void onMenuTrigger(View pView){
if(pView.getId() == R.id.pNewTab){ if(pView.getId() == R.id.pNewTab){
new Handler().postDelayed(this::onNewTabInvoked, 350); onNewTabInvoked();
mClosedByNewTab = true; mClosedByNewTab = true;
mHomeController.onBackPressed(); mHomeController.onBackPressed();
} }
if(pView.getId() == R.id.pNewTabMenu){ if(pView.getId() == R.id.pNewTabMenu){
new Handler().postDelayed(this::onNewTabInvoked, 350); onNewTabInvoked();
mClosedByNewTab = true; mClosedByNewTab = true;
mHomeController.onBackPressed(); mHomeController.onBackPressed();
} }
else if(pView.getId() == R.id.pCloseTab){ else if(pView.getId() == R.id.pCloseTab){
mRecycleView.animate().setDuration(200).alpha(0).withEndAction(() -> { mRecycleView.animate().setDuration(200).alpha(0).withEndAction(() -> {
onClearTabBackup(); ArrayList<tabRowModel> mBackup = (ArrayList<tabRowModel>)mListModel.onTrigger(tabEnums.eModelCallback.M_GET_BACKUP,null);
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.REMOVE_ALL, null); mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.REMOVE_ALL, null);
onClearTabBackup();
}); });
} }
else if(pView.getId() == R.id.pOpenSetting){ else if(pView.getId() == R.id.pOpenSetting){
@ -545,11 +586,11 @@ public class tabController extends Fragment
mHomeController.onLoadTab((geckoSession)data.get(0),(boolean)data.get(1),true); mHomeController.onLoadTab((geckoSession)data.get(0),(boolean)data.get(1),true);
} }
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW)){ else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW)){
onInitRemoveView((Integer) data.get(0), true); onInitRemoveView((Integer) data.get(0), true, true);
initTabCount(400); initTabCount(400);
} }
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP)){ else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP)){
onInitRemoveView((Integer) data.get(0), false); onInitRemoveView((Integer) data.get(0), false, (boolean)data.get(1));
} }
else if(e_type.equals(tabEnums.eTabAdapterCallback.M_CLEAR_BACKUP)){ else if(e_type.equals(tabEnums.eTabAdapterCallback.M_CLEAR_BACKUP)){
onExitAndClearBackup(); onExitAndClearBackup();

View File

@ -27,7 +27,9 @@ class tabModel
} }
private void onRemoveTab(int pIndex){ private void onRemoveTab(int pIndex){
mBackupIndex.add(mModelList.get(pIndex)); if(mModelList.size()>pIndex){
mBackupIndex.add(mModelList.get(pIndex));
}
} }
private ArrayList<tabRowModel> onGetBackup(){ private ArrayList<tabRowModel> onGetBackup(){

View File

@ -79,7 +79,7 @@ class tabViewController
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
public void onHoldInteraction(){ public void onHoldInteraction(){
final Handler handler = new Handler(); final Handler handler = new Handler();
handler.postDelayed(() -> mBlocker.setVisibility(View.GONE), 350); handler.postDelayed(() -> mBlocker.setVisibility(View.GONE), 250);
} }
private void initTabCount(int pCount){ private void initTabCount(int pCount){
@ -103,23 +103,6 @@ class tabViewController
} }
private void initPostUI(){ private void initPostUI(){
mRecycleView.setAlpha(1);
mContext.getView().setBackgroundColor(Color.WHITE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getActivity().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.getActivity().getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
mContext.getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(mContext.getActivity(), R.color.c_background));
}
}
} }
public void onOpenTabMenu(View view) { public void onOpenTabMenu(View view) {

View File

@ -6,7 +6,7 @@ public class enums
public enum etype{ public enum etype{
on_update_favicon,ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW,ON_NEW_TAB_ANIMATION, ON_LOAD_REQUEST,GECKO_SCROLL_CHANGED,GECKO_SCROLL_FINISHED,ON_UPDATE_SEARCH_BAR,M_ON_MAIL,SESSION_ID,M_UPDATE_PIXEL_BACKGROUND,M_CACHE_UPDATE_TAB, on_update_favicon,ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW,ON_NEW_TAB_ANIMATION, ON_LOAD_REQUEST,GECKO_SCROLL_CHANGED,GECKO_SCROLL_FINISHED,ON_UPDATE_SEARCH_BAR,M_ON_MAIL,SESSION_ID,M_UPDATE_PIXEL_BACKGROUND,M_CACHE_UPDATE_TAB,
on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION, on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,
welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT,M_INIT_TAB_COUNT_FORCED, welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT,M_INIT_TAB_COUNT_FORCED,M_SPLASH_DISABLE,M_NEW_LINK_IN_NEW_TAB,
url_triggered, url_triggered_new_tab,url_clear,fetch_favicon, fetch_thumbnail,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB, url_triggered, url_triggered_new_tab,url_clear,fetch_favicon, fetch_thumbnail,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB,
on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_INITIALIZE_TAB_SINGLE, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_UPDATE_TITLE_BAR,ON_FIRST_PAINT, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error,download_file_popup,on_init_ads,search_update, open_new_tab on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_INITIALIZE_TAB_SINGLE, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_UPDATE_TITLE_BAR,ON_FIRST_PAINT, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error,download_file_popup,on_init_ads,search_update, open_new_tab
} }

View File

@ -24,46 +24,44 @@ public class keys
/*Settings*/ /*Settings*/
public static final String SETTING_LANGUAGE = "LANGUAGE"; public static final String SETTING_VERSION = "VERSION_V1";
public static final String SETTING_LANGUAGE_REGION = "LANGUAGE_REGION"; public static final String SETTING_LANGUAGE = "LANGUAGE_V1";
public static final String SETTING_SEARCH_ENGINE = "SEARCH_ENGINE"; public static final String SETTING_LANGUAGE_REGION = "LANGUAGE_REGION_V1";
public static final String SETTING_FIRST_INSTALLED = "FIRST_INSTALLED"; public static final String SETTING_SEARCH_ENGINE = "SEARCH_ENGINE_V1";
public static final String SETTING_JAVA_SCRIPT = "JAVA_SCRIPT"; public static final String SETTING_FIRST_INSTALLED = "FIRST_INSTALLED_V1";
public static final String SETTING_POPUP = "POPUP"; public static final String SETTING_JAVA_SCRIPT = "JAVA_SCRIPT_V1";
public static final String SETTING_HISTORY_CLEAR = "HISTORY_CLEAR"; public static final String SETTING_POPUP = "POPUP_V1";
public static final String SETTING_GATEWAY = "pref_bridges_enabled_auto"; public static final String SETTING_HISTORY_CLEAR = "HISTORY_CLEAR_V1";
public static final String SETTING_GATEWAY_MANUAL = "pref_bridges_enabled_manual"; public static final String SETTING_GATEWAY = "pref_bridges_enabled_auto_V1";
public static final String SETTING_IS_BOOTSTRAPPED = "IS_BOOTSTRAPPED"; public static final String SETTING_GATEWAY_MANUAL = "pref_bridges_enabled_manual_V1";
public static final String SETTING_IS_WELCOME_ENABLED = "IS_WELCOME_ENABLED"; public static final String SETTING_IS_BOOTSTRAPPED = "IS_BOOTSTRAPPED_V1";
public static final String SETTING_ENGINE_SWITCHED = "ENGINE_SWITCHED"; public static final String SETTING_IS_WELCOME_ENABLED = "IS_WELCOME_ENABLED_V1";
public static final String SETTING_FONT_SIZE = "FONT_SIZE"; public static final String SETTING_FONT_SIZE = "FONT_SIZE_V1";
public static final String SETTING_FONT_ADJUSTABLE = "FONT_ADJUSTABLE"; public static final String SETTING_FONT_ADJUSTABLE = "FONT_ADJUSTABLE_V1";
public static final String SETTING_COOKIE_ADJUSTABLE = "COOKIE_ADJUSTABLE_NEW"; public static final String SETTING_COOKIE_ADJUSTABLE = "COOKIE_ADJUSTABLE_NEW_V1";
public static final String SETTING_NOTIFICATION_STATUS = "NOTIFICATION_STATUS"; public static final String SETTING_NOTIFICATION_STATUS = "NOTIFICATION_STATUS_V1";
public static final String SETTING_SEARCH_HISTORY = "SETTING_SEARCH_HISTORY"; public static final String SETTING_SEARCH_HISTORY = "SETTING_SEARCH_HISTORY_V1";
public static final String SETTING_SEARCH_SUGGESTION = "SETTING_SEARCH_STATUS"; public static final String SETTING_SEARCH_SUGGESTION = "SETTING_SEARCH_STATUS_V1";
public static final String SETTING_ZOOM = "SETTING_ZOOM"; public static final String SETTING_ZOOM = "SETTING_ZOOM_V1";
public static final String SETTING_VOICE_INPUT = "SETTING_VOICE_INPUT"; public static final String SETTING_VOICE_INPUT = "SETTING_VOICE_INPUT_V1";
public static final String SETTING_TRACKING_PROTECTION = "SETTING_TRACKING_PROTECTION"; public static final String SETTING_TRACKING_PROTECTION = "SETTING_TRACKING_PROTECTION_V1";
public static final String SETTING_DONOT_TRACK = "SETTING_DONOT_TRACK"; public static final String SETTING_DONOT_TRACK = "SETTING_DONOT_TRACK_V1";
public static final String SETTING_RESTORE_TAB = "SETTING_RESTORE_TAB"; public static final String SETTING_RESTORE_TAB = "SETTING_RESTORE_TAB_V1";
public static final String SETTING_CHARACTER_ENCODING = "SETTING_CHARACTER_ENCODING"; public static final String SETTING_CHARACTER_ENCODING = "SETTING_CHARACTER_ENCODING_V1";
public static final String SETTING_SHOW_IMAGES = "SETTING_SHOW_IMAGES"; public static final String SETTING_SHOW_IMAGES = "SETTING_SHOW_IMAGES_V1";
public static final String SETTING_SHOW_TAB_GRID = "SETTING_SHOW_TAB_GRID"; public static final String SETTING_SHOW_TAB_GRID = "SETTING_SHOW_TAB_GRID_V1";
public static final String SETTING_SHOW_FONTS = "SETTING_SHOW_FONTS"; public static final String SETTING_SHOW_FONTS = "SETTING_SHOW_FONTS_V1";
public static final String SETTING_TOOLBAR_THEME = "SETTING_TOOLBAR_THEME"; public static final String SETTING_TOOLBAR_THEME = "SETTING_TOOLBAR_THEME_V1";
public static final String SETTING_THEME = "SETTING_THEME_LIGHT"; public static final String SETTING_THEME = "SETTING_THEME_LIGHT_V1";
public static final String SETTING_FULL_SCREEN_BROWSIING = "SETTING_FULL_SCREEN_BROWSIING"; public static final String SETTING_FULL_SCREEN_BROWSIING = "SETTING_FULL_SCREEN_BROWSIING_V1";
public static final String SETTING_OPEN_URL_IN_NEW_TAB = "SETTING_OPEN_URL_IN_NEW_TAB"; public static final String SETTING_OPEN_URL_IN_NEW_TAB = "SETTING_OPEN_URL_IN_NEW_TAB_V1";
public static final String SETTING_LIST_VIEW = "SETTING_LIST_VIEW"; public static final String SETTING_LIST_VIEW = "SETTING_LIST_VIEW_V1";
public static final String SETTING_TOOLBAR_THEME_ALLOWED = "SETTING_TOOLBAR_THEME_ALLOWED";
/*Bridge Settings*/ /*Bridge Settings*/
public static final String BRIDGE_CUSTOM_BRIDGE_1 = "CLEAR_PREFS"; public static final String BRIDGE_CUSTOM_BRIDGE_1 = "CLEAR_PREFS_V1";
public static final String BRIDGE_CUSTOM_TYPE = "BRIDGE_CUSTOM_TYPE"; public static final String BRIDGE_CUSTOM_TYPE = "BRIDGE_CUSTOM_TYPE_V1";
public static final String BRIDGE_NOTIFICATION = "BRIDGE_NOTIFICATION"; public static final String BRIDGE_ENABLES = "pref_bridges_enabled_V1";
public static final String BRIDGE_ENABLES = "pref_bridges_enabled"; public static final String VPN_ENABLED = "pref_vpn_V1";
public static final String VPN_ENABLED = "pref_vpn";
} }

View File

@ -1,11 +1,14 @@
package com.darkweb.genesissearchengine.constants; package com.darkweb.genesissearchengine.constants;
import android.content.Context;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
@ -14,7 +17,6 @@ public class status
/*App Status*/ /*App Status*/
public static boolean sPaidStatus = false; public static boolean sPaidStatus = false;
public static String mCurrentReloadURL = "";
public static int mNotificationID = 1001; public static int mNotificationID = 1001;
/*Settings Status*/ /*Settings Status*/
@ -26,6 +28,8 @@ public class status
public static String mReferenceWebsites; public static String mReferenceWebsites;
public static String sBridgeCustomBridge = strings.GENERIC_EMPTY_STR; public static String sBridgeCustomBridge = strings.GENERIC_EMPTY_STR;
public static String sBridgeCustomType = strings.GENERIC_EMPTY_STR; public static String sBridgeCustomType = strings.GENERIC_EMPTY_STR;
public static String sVersion = "";
public static Locale mSystemLocale = null;
public static boolean sSettingEnableZoom = true; public static boolean sSettingEnableZoom = true;
public static boolean sSettingEnableVoiceInput = true; public static boolean sSettingEnableVoiceInput = true;
@ -67,8 +71,20 @@ public class status
public static float sSettingFontSize = 1; public static float sSettingFontSize = 1;
public static void initStatus() private static void versionVerifier(Context pContext){
status.sVersion = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_VERSION,strings.GENERIC_EMPTY_STR));
if(!status.sVersion.equals("1.0.0.1")){
pContext.deleteDatabase(constants.CONST_DATABASE_NAME);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_CLEAR_PREFS, null);
status.sVersion = "1.0.0.1";
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_VERSION,strings.SETTING_DEFAULT_VERSION));
}
}
public static void initStatus(Context pContext)
{ {
versionVerifier(pContext);
status.sSettingSearchHistory = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true)); status.sSettingSearchHistory = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true));
status.sSearchSuggestionStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true)); status.sSearchSuggestionStatus = (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.sSettingJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true));

View File

@ -36,12 +36,13 @@ public class strings
public static final String GENERIC_EMPTY_SPACE = " "; public static final String GENERIC_EMPTY_SPACE = " ";
/*Language Manager*/ /*Language Manager*/
public static final String LANGUAGE_NOT_SUPPORTED = "not supported"; public static final String LANGUAGE_NOT_SUPPORTED = "is unsupported";
/*Settings Manager*/ /*Settings Manager*/
public static final String SETTING_DEFAULT_LANGUAGE = "en"; public static final String SETTING_DEFAULT_LANGUAGE = "en";
public static final String SETTING_DEFAULT_LANGUAGE_REGION = "Us"; public static final String SETTING_DEFAULT_LANGUAGE_REGION = "Us";
public static final String SETTING_DEFAULT_VERSION = "1.0.0.1";
/*Home Manager*/ /*Home Manager*/

View File

@ -1,7 +1,7 @@
package com.darkweb.genesissearchengine.dataManager; package com.darkweb.genesissearchengine.dataManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel; import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -2,12 +2,10 @@ package com.darkweb.genesissearchengine.dataManager;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -89,6 +87,9 @@ public class dataController
/*Recieving Preferences*/ /*Recieving Preferences*/
public Object invokePrefs(dataEnums.ePreferencesCommands pCommands, List<Object> pData){ public Object invokePrefs(dataEnums.ePreferencesCommands pCommands, List<Object> pData){
if(mPreferenceModel==null){
return null;
}
return mPreferenceModel.onTrigger(pCommands, pData); return mPreferenceModel.onTrigger(pCommands, pData);
} }

View File

@ -1,6 +1,6 @@
package com.darkweb.genesissearchengine.dataManager; package com.darkweb.genesissearchengine.dataManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;

View File

@ -10,7 +10,7 @@ import android.util.Log;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController; import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession;
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
@ -18,6 +18,8 @@ import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoView;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -213,7 +215,7 @@ class tabDataModel
}; };
// int isLoading = 0; // int isLoading = 0;
public void updatePixels(String pSessionID, GeckoResult<Bitmap> pBitmapManager, ImageView pImageView, NestedGeckoView pGeckoView, boolean pOpenTabView){ public void updatePixels(String pSessionID, GeckoResult<Bitmap> pBitmapManager, ImageView pImageView, GeckoView pGeckoView, boolean pOpenTabView){
new Thread(){ new Thread(){
public void run(){ public void run(){
@ -241,11 +243,9 @@ class tabDataModel
} }
byte[] mThumbnail = out.toByteArray(); byte[] mThumbnail = out.toByteArray();
if(status.sRestoreTabs){ ContentValues mContentValues = new ContentValues();
ContentValues mContentValues = new ContentValues(); mContentValues.put("mThumbnail", mThumbnail);
mContentValues.put("mThumbnail", mThumbnail); databaseController.getInstance().execTab("tab",mContentValues, mTabs.get(finalCounter).getmId());
databaseController.getInstance().execTab("tab",mContentValues, mTabs.get(finalCounter).getmId());
}
} }
} }
} }
@ -320,7 +320,7 @@ class tabDataModel
return getSuggestions((String) pData.get(0)); return getSuggestions((String) pData.get(0));
} }
else if(pCommands == dataEnums.eTabCommands.M_UPDATE_PIXEL){ else if(pCommands == dataEnums.eTabCommands.M_UPDATE_PIXEL){
updatePixels((String)pData.get(0), (GeckoResult<Bitmap>)pData.get(1), (ImageView) pData.get(2), (NestedGeckoView) pData.get(3), (Boolean) pData.get(4)); updatePixels((String)pData.get(0), (GeckoResult<Bitmap>)pData.get(1), (ImageView) pData.get(2), (GeckoView) pData.get(3), (Boolean) pData.get(4));
} }
else if(pCommands == dataEnums.eTabCommands.M_HOME_PAGE){ else if(pCommands == dataEnums.eTabCommands.M_HOME_PAGE){
return getHomePage(); return getHomePage();

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.appManager.databaseManager; package com.darkweb.genesissearchengine.databaseManager;
import android.content.ContentValues; import android.content.ContentValues;
import android.database.Cursor; import android.database.Cursor;

View File

@ -1,26 +1,17 @@
package com.darkweb.genesissearchengine.appManager.externalNavigationManager; package com.darkweb.genesissearchengine.externalNavigationManager;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.appManager.landingManager.landingController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R; import com.example.myapplication.R;
import java.util.Collections;
import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_LINK;
public class externalNavigationController extends AppCompatActivity { public class externalNavigationController extends AppCompatActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {

View File

@ -22,6 +22,7 @@ import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable; import android.graphics.drawable.TransitionDrawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Vibrator; import android.os.Vibrator;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
@ -32,6 +33,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewAnimationUtils; import android.view.ViewAnimationUtils;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.view.animation.RotateAnimation; import android.view.animation.RotateAnimation;
@ -485,6 +487,42 @@ public class helperMethod
} }
} }
public static Point getNavigationBarSize(Context context) {
Point appUsableSize = getAppUsableScreenSize(context);
Point realScreenSize = getRealScreenSize(context);
// navigation bar on the side
if (appUsableSize.x < realScreenSize.x) {
return new Point(realScreenSize.x - appUsableSize.x, appUsableSize.y);
}
// navigation bar at the bottom
if (appUsableSize.y < realScreenSize.y) {
return new Point(appUsableSize.x, realScreenSize.y - appUsableSize.y);
}
// navigation bar is not present
return new Point();
}
public static Point getAppUsableScreenSize(Context context) {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
return size;
}
public static Point getRealScreenSize(Context context) {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();
Point size = new Point();
display.getRealSize(size);
return size;
}
public static void openActivity( Class<?> cls,int type,AppCompatActivity context,boolean animation){ public static void openActivity( Class<?> cls,int type,AppCompatActivity context,boolean animation){
Intent myIntent = new Intent(context, cls); Intent myIntent = new Intent(context, cls);
myIntent.putExtra(keys.PROXY_LIST_TYPE, type); myIntent.putExtra(keys.PROXY_LIST_TYPE, type);

View File

@ -59,7 +59,6 @@ public class theme {
} }
} }
} }
} }
public Context setupTheme(Context context) { public Context setupTheme(Context context) {

View File

@ -5,6 +5,8 @@ import android.view.View;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.google.android.gms.ads.*; import com.google.android.gms.ads.*;
import java.lang.ref.WeakReference;
import java.util.List; import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
@ -17,38 +19,36 @@ class adManager
/*Private Variables */ /*Private Variables */
private AppCompatActivity mAppContext;
private eventObserver.eventListener mEvent; private eventObserver.eventListener mEvent;
private AdView mBannerAds; private WeakReference<AdView> mBannerAds;
private boolean bannerAdsLoading = false; private boolean bannerAdsLoading = false;
private boolean bannerAdsLoaded = false; private boolean bannerAdsLoaded = false;
/*Initializations*/ /*Initializations*/
adManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, AdView pBannerAds) { adManager(eventObserver.eventListener pEvent, AdView pBannerAds) {
this.mAppContext = pAppContext;
this.mEvent = pEvent; this.mEvent = pEvent;
mBannerAds = pBannerAds; mBannerAds = new WeakReference(pBannerAds);
} }
private void initializeBannerAds(){ private void initializeBannerAds(){
if(!sPaidStatus){ if(!sPaidStatus){
AdRequest request = new AdRequest.Builder().build(); AdRequest request = new AdRequest.Builder().build();
mBannerAds.loadAd(request); mBannerAds.get().loadAd(request);
admobListeners(); admobListeners();
} }
} }
/*Local Helper Methods*/ /*Local Helper Methods*/
private void loadAds(){ private void loadAds(AppCompatActivity pAppContext){
if(!sPaidStatus) if(!sPaidStatus)
{ {
if (!bannerAdsLoading) if (!bannerAdsLoading)
{ {
bannerAdsLoading = true; bannerAdsLoading = true;
MobileAds.initialize(mAppContext, initializationStatus -> { }); MobileAds.initialize(pAppContext.getApplicationContext(), initializationStatus -> { });
initializeBannerAds(); initializeBannerAds();
} }
@ -63,7 +63,7 @@ class adManager
private void admobListeners(){ private void admobListeners(){
if(!sPaidStatus){ if(!sPaidStatus){
mBannerAds.setAdListener(new AdListener() { mBannerAds.get().setAdListener(new AdListener() {
@Override @Override
public void onAdLoaded() { public void onAdLoaded() {
bannerAdsLoaded = true; bannerAdsLoaded = true;
@ -93,7 +93,7 @@ class adManager
Object onTrigger(List<Object> pData, pluginEnums.eAdManager pEventType) { Object onTrigger(List<Object> pData, pluginEnums.eAdManager pEventType) {
if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS))
{ {
loadAds(); loadAds((AppCompatActivity)pData.get(0));
} }
else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED))
{ {

View File

@ -3,17 +3,19 @@ package com.darkweb.genesissearchengine.pluginManager;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.flurry.android.FlurryAgent; import com.flurry.android.FlurryAgent;
import java.lang.ref.WeakReference;
import java.util.List; import java.util.List;
class analyticManager class analyticManager
{ {
/*Private Variables*/ /*Private Variables*/
private AppCompatActivity mAppContext; private WeakReference<AppCompatActivity> mAppContext;
/*Initializations*/ /*Initializations*/
analyticManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent){ analyticManager(WeakReference<AppCompatActivity> pAppContext, eventObserver.eventListener pEvent){
this.mAppContext = pAppContext; this.mAppContext = pAppContext;
initialize(); initialize();
} }
@ -22,7 +24,7 @@ class analyticManager
{ {
new FlurryAgent.Builder() new FlurryAgent.Builder()
.withLogEnabled(true) .withLogEnabled(true)
.build(mAppContext, "BKFSCH4CRS6RB9HSCM9H"); .build(mAppContext.get().getApplicationContext(), "BKFSCH4CRS6RB9HSCM9H");
} }
/*External Triggers*/ /*External Triggers*/

View File

@ -5,6 +5,8 @@ import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.helperManager.localFileDownloader; import com.darkweb.genesissearchengine.helperManager.localFileDownloader;
import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.lang.ref.WeakReference;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -14,12 +16,12 @@ class downloadManager
{ {
/*Private Variables*/ /*Private Variables*/
private AppCompatActivity mAppContext; private WeakReference<AppCompatActivity> mAppContext;
private Map<Integer, localFileDownloader> mDownloads = new HashMap<Integer, localFileDownloader>(); private Map<Integer, localFileDownloader> mDownloads = new HashMap<Integer, localFileDownloader>();
/*Initializations*/ /*Initializations*/
downloadManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent){ downloadManager(WeakReference<AppCompatActivity> pAppContext, eventObserver.eventListener pEvent){
this.mAppContext = pAppContext; this.mAppContext = pAppContext;
initialize(); initialize();
} }
@ -30,7 +32,7 @@ class downloadManager
private void startDownload(String pPath,String pFile) { private void startDownload(String pPath,String pFile) {
int mID = helperMethod.createNotificationID(); int mID = helperMethod.createNotificationID();
localFileDownloader mFileDownloader = (localFileDownloader)new localFileDownloader(mAppContext,pPath, pFile, mID).execute(pPath); localFileDownloader mFileDownloader = (localFileDownloader)new localFileDownloader(mAppContext.get().getApplicationContext(),pPath, pFile, mID).execute(pPath);
mDownloads.put(mID,mFileDownloader); mDownloads.put(mID,mFileDownloader);
} }

View File

@ -3,38 +3,75 @@ package com.darkweb.genesissearchengine.pluginManager;
import android.app.Activity; import android.app.Activity;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Build;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.eventObserver;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Objects;
import static com.darkweb.genesissearchengine.constants.status.mSystemLocale;
class langManager { class langManager {
/*Private Variables*/ /*Private Variables*/
private AppCompatActivity mAppContext;
private eventObserver.eventListener mEvent; private eventObserver.eventListener mEvent;
private Locale mLanguage; private Locale mLanguage;
/*Initializations*/ /*Initializations*/
langManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, Locale pLanguage) { langManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, Locale pLanguage) {
this.mAppContext = pAppContext;
this.mEvent = pEvent; this.mEvent = pEvent;
this.mLanguage = pLanguage; this.mLanguage = pLanguage;
onInitLanguage(pAppContext); onInitLanguage(pAppContext);
} }
private boolean initLocale(){
if(!status.mThemeApplying){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Locale mSystemLocale = Resources.getSystem().getConfiguration().getLocales().get(0);
if(mSystemLocale!=status.mSystemLocale || !mSystemLocale.getLanguage().equals(mLanguage.getLanguage()) ){
status.mSystemLocale = mSystemLocale;
/*if(activityContextManager.getInstance().getHomeController()!=null && status.sSettingLanguage.equals("default")){
return true;
}*/
}
} else {
Locale mSystemLocale = Resources.getSystem().getConfiguration().locale;
if(mSystemLocale!=status.mSystemLocale || !mSystemLocale.getLanguage().equals(mLanguage.getLanguage())){
status.mSystemLocale = mSystemLocale;
activityContextManager.getInstance().getCurrentActivity().recreate();
/*if(activityContextManager.getInstance().getHomeController()!=null && status.sSettingLanguage.equals("default")){
return true;
}*/
}
}
}
return false;
}
private void onInitLanguage(AppCompatActivity pAppContext) { private void onInitLanguage(AppCompatActivity pAppContext) {
if(status.sSettingLanguage.equals("default")){ if(status.sSettingLanguage.equals("default")){
if(mLanguage==null || !mLanguage.getLanguage().equals(Resources.getSystem().getConfiguration().locale.getLanguage()) || !mLanguage.getCountry().equals(Resources.getSystem().getConfiguration().locale.getCountry())) if(!mLanguage.getLanguage().equals(Resources.getSystem().getConfiguration().locale.getLanguage()) || !mLanguage.getCountry().equals(Resources.getSystem().getConfiguration().locale.getCountry()))
{ {
Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; if(mSystemLocale==null){
initLocale();
}
String mSystemLangugage = mSystemLocale.toString(); String mSystemLangugage = mSystemLocale.toString();
if(mSystemLangugage.equals("en_US") || mSystemLangugage.equals("de_DE") || mSystemLangugage.equals("ur_UR") || mSystemLangugage.equals("ca_ES") || mSystemLangugage.equals("zh_CN") || mSystemLangugage.equals("ch_CZ") || mSystemLangugage.equals("nl_NL") || mSystemLangugage.equals("fr_FR") || mSystemLangugage.equals("el_GR") || mSystemLangugage.equals("hu_HU") || mSystemLangugage.equals("in_ID") || mSystemLangugage.equals("it_IT") || mSystemLangugage.equals("ja_JP") || mSystemLangugage.equals("ko_KR") || mSystemLangugage.equals("pt_PT") || mSystemLangugage.equals("ro_RO") || mSystemLangugage.equals("ru_RU") || mSystemLangugage.equals("th_TH") || mSystemLangugage.equals("tr_TR") || mSystemLangugage.equals("uk_UA") || mSystemLangugage.equals("vi_VN")){ if(mSystemLangugage.equals("en_US") || mSystemLangugage.equals("de_DE") || mSystemLangugage.equals("ur_UR") || mSystemLangugage.equals("ur_PK") || mSystemLangugage.equals("ca_ES") || mSystemLangugage.equals("zh_CN") || mSystemLangugage.equals("ch_CZ") || mSystemLangugage.equals("nl_NL") || mSystemLangugage.equals("fr_FR") || mSystemLangugage.equals("el_GR") || mSystemLangugage.equals("hu_HU") || mSystemLangugage.equals("in_ID") || mSystemLangugage.equals("it_IT") || mSystemLangugage.equals("ja_JP") || mSystemLangugage.equals("ko_KR") || mSystemLangugage.equals("pt_PT") || mSystemLangugage.equals("ro_RO") || mSystemLangugage.equals("ru_RU") || mSystemLangugage.equals("th_TH") || mSystemLangugage.equals("tr_TR") || mSystemLangugage.equals("uk_UA") || mSystemLangugage.equals("vi_VN")){
mLanguage = new Locale(mSystemLocale.getLanguage(), mSystemLocale.getCountry()); if(mSystemLangugage.equals("ur_PK")){
mLanguage = new Locale("ur", "Ur");
} else if(mSystemLangugage.equals("vi_VN")){
mLanguage = new Locale("ch", "Cz");
} else {
mLanguage = new Locale(mSystemLocale.getLanguage(), mSystemLocale.getCountry());
}
}else { }else {
mLanguage = new Locale("en", "Us"); mLanguage = new Locale("en", "Us");
} }
@ -66,7 +103,8 @@ class langManager {
if(status.sSettingLanguage.equals("default")){ if(status.sSettingLanguage.equals("default")){
Locale mSystemLocale = Resources.getSystem().getConfiguration().locale; Locale mSystemLocale = Resources.getSystem().getConfiguration().locale;
String mSystemLangugage = mSystemLocale.toString(); String mSystemLangugage = mSystemLocale.toString();
if(mSystemLangugage.equals("en_US") || mSystemLangugage.equals("de_DE") || mSystemLangugage.equals("ca_ES") || mSystemLangugage.equals("zh_CN") || mSystemLangugage.equals("ch_CZ") || mSystemLangugage.equals("nl_NL") || mSystemLangugage.equals("fr_FR") || mSystemLangugage.equals("el_GR") || mSystemLangugage.equals("hu_HU") || mSystemLangugage.equals("in_ID") || mSystemLangugage.equals("it_IT") || mSystemLangugage.equals("ja_JP") || mSystemLangugage.equals("ko_KR") || mSystemLangugage.equals("pt_PT") || mSystemLangugage.equals("ro_RO") || mSystemLangugage.equals("ru_RU") || mSystemLangugage.equals("th_TH") || mSystemLangugage.equals("tr_TR") || mSystemLangugage.equals("uk_UA") || mSystemLangugage.equals("vi_VN")){
if(mSystemLangugage.equals("cs_CZ") || mSystemLangugage.equals("ur_PK") || mSystemLangugage.equals("en_US") || mSystemLangugage.equals("de_DE") || mSystemLangugage.equals("ca_ES") || mSystemLangugage.equals("zh_CN") || mSystemLangugage.equals("ch_CZ") || mSystemLangugage.equals("nl_NL") || mSystemLangugage.equals("fr_FR") || mSystemLangugage.equals("el_GR") || mSystemLangugage.equals("hu_HU") || mSystemLangugage.equals("in_ID") || mSystemLangugage.equals("it_IT") || mSystemLangugage.equals("ja_JP") || mSystemLangugage.equals("ko_KR") || mSystemLangugage.equals("pt_PT") || mSystemLangugage.equals("ro_RO") || mSystemLangugage.equals("ru_RU") || mSystemLangugage.equals("th_TH") || mSystemLangugage.equals("tr_TR") || mSystemLangugage.equals("uk_UA") || mSystemLangugage.equals("vi_VN")){
return "Default | " + mSystemLocale.getDisplayName(); return "Default | " + mSystemLocale.getDisplayName();
}else { }else {
return mSystemLocale.getDisplayName() + " | is unsupported"; return mSystemLocale.getDisplayName() + " | is unsupported";
@ -85,6 +123,7 @@ class langManager {
} }
else if(pEventType.equals(pluginEnums.eLangManager.M_RESUME)) else if(pEventType.equals(pluginEnums.eLangManager.M_RESUME))
{ {
boolean mStatus = initLocale();
onResume((AppCompatActivity) pData.get(0)); onResume((AppCompatActivity) pData.get(0));
} }
else if(pEventType.equals(pluginEnums.eLangManager.M_SET_LANGUAGE)) else if(pEventType.equals(pluginEnums.eLangManager.M_SET_LANGUAGE))

View File

@ -1,6 +1,7 @@
package com.darkweb.genesissearchengine.pluginManager; package com.darkweb.genesissearchengine.pluginManager;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Color; import android.graphics.Color;
@ -48,32 +49,39 @@ class messageManager
/*Initializations*/ /*Initializations*/
private void onClearReference(){
mContext = null;
mData = null;
}
private void initializeDialog(int pLayout, int pGravity){ private void initializeDialog(int pLayout, int pGravity){
if(mDialog !=null && mDialog.isShowing()){
mDialog.dismiss();
}
mDialog = new Dialog(mContext);
mDialog.getWindow().setGravity(pGravity);
mDialog.getWindow().getAttributes().windowAnimations = R.style.dialiog_animation;
Drawable myDrawable;
Resources res = mContext.getResources();
try { try {
myDrawable = Drawable.createFromXml(res, res.getXml(R.xml.hox_rounded_corner)); if(mDialog !=null && mDialog.isShowing()){
mDialog.getWindow().setBackgroundDrawable(myDrawable); mDialog.dismiss();
} catch (Exception ignored) { }
}
mDialog.setCancelable(true); mDialog = new Dialog(mContext);
mDialog.setContentView(pLayout); mDialog.getWindow().setGravity(pGravity);
mDialog.getWindow().getAttributes().windowAnimations = R.style.dialiog_animation;
ColorDrawable back = new ColorDrawable(Color.TRANSPARENT); Drawable myDrawable;
InsetDrawable inset = new InsetDrawable(back, helperMethod.pxFromDp(15),0,helperMethod.pxFromDp(15),0); Resources res = mContext.getResources();
mDialog.getWindow().setBackgroundDrawable(inset); try {
mDialog.getWindow().setLayout(helperMethod.pxFromDp(350), -1); myDrawable = Drawable.createFromXml(res, res.getXml(R.xml.hox_rounded_corner));
mDialog.getWindow().setLayout(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT); mDialog.getWindow().setBackgroundDrawable(myDrawable);
mDialog.show(); } catch (Exception ignored) {
}
mDialog.setCancelable(true);
mDialog.setContentView(pLayout);
ColorDrawable back = new ColorDrawable(Color.TRANSPARENT);
InsetDrawable inset = new InsetDrawable(back, helperMethod.pxFromDp(15),0,helperMethod.pxFromDp(15),0);
mDialog.getWindow().setBackgroundDrawable(inset);
mDialog.getWindow().setLayout(helperMethod.pxFromDp(350), -1);
mDialog.getWindow().setLayout(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.WRAP_CONTENT);
mDialog.show();
}catch (Exception ignored){}
} }
messageManager(eventObserver.eventListener event) messageManager(eventObserver.eventListener event)
@ -113,6 +121,8 @@ class messageManager
mEvent.invokeObserver(null, M_CANCEL_WELCOME); mEvent.invokeObserver(null, M_CANCEL_WELCOME);
mDialog.dismiss(); mDialog.dismiss();
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void languageSupportFailure() private void languageSupportFailure()
@ -120,6 +130,7 @@ class messageManager
initializeDialog(R.layout.popup_language_support, Gravity.CENTER); initializeDialog(R.layout.popup_language_support, Gravity.CENTER);
((TextView) mDialog.findViewById(R.id.pLanguage)).setText((mData.get(0).toString())); ((TextView) mDialog.findViewById(R.id.pLanguage)).setText((mData.get(0).toString()));
mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss());
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void rateFailure() private void rateFailure()
@ -140,12 +151,14 @@ class messageManager
}; };
handler.postDelayed(runnable, 1000); handler.postDelayed(runnable, 1000);
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void reportedSuccessfully() private void reportedSuccessfully()
{ {
initializeDialog(R.layout.popup_reported_successfully, Gravity.BOTTOM); initializeDialog(R.layout.popup_reported_successfully, Gravity.BOTTOM);
mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mDialog.dismiss()); mDialog.findViewById(R.id.pNext).setOnClickListener(v -> mDialog.dismiss());
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void newIdentityCreated() private void newIdentityCreated()
@ -156,7 +169,10 @@ class messageManager
initializeDialog(R.layout.popup_new_circuit, Gravity.BOTTOM); initializeDialog(R.layout.popup_new_circuit, Gravity.BOTTOM);
mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss());
mDialog.setOnDismissListener(dialog -> handler.removeCallbacks(runnable)); mDialog.setOnDismissListener(dialog -> {
handler.removeCallbacks(runnable);
onClearReference();
});
handler.postDelayed(runnable, 1500); handler.postDelayed(runnable, 1500);
} }
@ -175,10 +191,12 @@ class messageManager
handler.removeCallbacks(runnable); handler.removeCallbacks(runnable);
}); });
mDialog.setOnDismissListener(dialog -> handler.removeCallbacks(runnable)); mDialog.setOnDismissListener(dialog -> {
handler.removeCallbacks(runnable);
onClearReference();
});
handler.postDelayed(runnable, 1500); handler.postDelayed(runnable, 1500);
} }
private void maxTabReached() private void maxTabReached()
@ -195,7 +213,10 @@ class messageManager
handler.removeCallbacks(runnable); handler.removeCallbacks(runnable);
}); });
mDialog.setOnDismissListener(dialog -> handler.removeCallbacks(runnable)); mDialog.setOnDismissListener(dialog -> {
handler.removeCallbacks(runnable);
onClearReference();
});
handler.postDelayed(runnable, 1500); handler.postDelayed(runnable, 1500);
@ -205,12 +226,14 @@ class messageManager
{ {
initializeDialog(R.layout.popup_not_supported, Gravity.BOTTOM); initializeDialog(R.layout.popup_not_supported, Gravity.BOTTOM);
mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss());
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void dataClearedSuccessfully() private void dataClearedSuccessfully()
{ {
initializeDialog(R.layout.popup_data_cleared, Gravity.BOTTOM); initializeDialog(R.layout.popup_data_cleared, Gravity.BOTTOM);
mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss()); mDialog.findViewById(R.id.pDismiss).setOnClickListener(v -> mDialog.dismiss());
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
@ -245,6 +268,7 @@ class messageManager
} }
((TextView) mDialog.findViewById(R.id.pHeaderSubpart)).setText(helperMethod.getDomainName(mData.get(0).toString())); ((TextView) mDialog.findViewById(R.id.pHeaderSubpart)).setText(helperMethod.getDomainName(mData.get(0).toString()));
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void bookmark() private void bookmark()
@ -259,6 +283,7 @@ class messageManager
helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController());
dialog.dismiss(); dialog.dismiss();
mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
onClearReference();
}; };
handler.postDelayed(runnable, 50); handler.postDelayed(runnable, 50);
}); });
@ -292,6 +317,7 @@ class messageManager
helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController()); helperMethod.hideKeyboard(activityContextManager.getInstance().getHomeController());
dialog.dismiss(); dialog.dismiss();
mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); mContext.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
onClearReference();
}; };
handler.postDelayed(runnable, 50); handler.postDelayed(runnable, 50);
}); });
@ -324,6 +350,7 @@ class messageManager
mDialog.dismiss(); mDialog.dismiss();
mEvent.invokeObserver(null, M_CLEAR_HISTORY); mEvent.invokeObserver(null, M_CLEAR_HISTORY);
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void clearBookmark() private void clearBookmark()
@ -334,6 +361,7 @@ class messageManager
mDialog.dismiss(); mDialog.dismiss();
mEvent.invokeObserver(null, M_CLEAR_BOOKMARK); mEvent.invokeObserver(null, M_CLEAR_BOOKMARK);
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void reportURL() private void reportURL()
@ -347,6 +375,7 @@ class messageManager
Runnable runnable = () -> onTrigger(Arrays.asList(strings.GENERIC_EMPTY_STR, mContext),M_RATE_SUCCESS); Runnable runnable = () -> onTrigger(Arrays.asList(strings.GENERIC_EMPTY_STR, mContext),M_RATE_SUCCESS);
handler.postDelayed(runnable, 1000); handler.postDelayed(runnable, 1000);
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void downloadSingle() private void downloadSingle()
@ -362,6 +391,7 @@ class messageManager
}; };
handler.postDelayed(runnable, 1000); handler.postDelayed(runnable, 1000);
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void rateApp() private void rateApp()
@ -387,6 +417,7 @@ class messageManager
mDialog.dismiss(); mDialog.dismiss();
} }
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void downloadFileLongPress() private void downloadFileLongPress()
@ -416,6 +447,7 @@ class messageManager
mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK); mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK);
mDialog.dismiss(); mDialog.dismiss();
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void openURLLongPress() private void openURLLongPress()
@ -437,6 +469,7 @@ class messageManager
mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK); mEvent.invokeObserver(Collections.singletonList(mData.get(0)), M_COPY_LINK);
mDialog.dismiss(); mDialog.dismiss();
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void popupDownloadFull(){ private void popupDownloadFull(){
@ -488,6 +521,7 @@ class messageManager
mEvent.invokeObserver(Collections.singletonList(file), M_DOWNLOAD_FILE_MANUAL); mEvent.invokeObserver(Collections.singletonList(file), M_DOWNLOAD_FILE_MANUAL);
mDialog.dismiss(); mDialog.dismiss();
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
private void sendBridgeMail() private void sendBridgeMail()
@ -507,6 +541,7 @@ class messageManager
}; };
handler.postDelayed(runnable, 1000); handler.postDelayed(runnable, 1000);
}); });
mDialog.setOnDismissListener(dialog -> onClearReference());
} }
void onReset(){ void onReset(){
@ -519,6 +554,7 @@ class messageManager
void onTrigger(List<Object> pData, pluginEnums.eMessageManager pEventType) void onTrigger(List<Object> pData, pluginEnums.eMessageManager pEventType)
{ {
onClearReference();
if(pEventType.equals(pluginEnums.eMessageManager.M_RESET)){ if(pEventType.equals(pluginEnums.eMessageManager.M_RESET)){
onReset(); onReset();
} }

View File

@ -13,6 +13,8 @@ import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.userEngagementNotification; import com.darkweb.genesissearchengine.helperManager.userEngagementNotification;
import com.example.myapplication.R; import com.example.myapplication.R;
import java.lang.ref.WeakReference;
import java.util.List; import java.util.List;
import static com.darkweb.genesissearchengine.constants.constants.*; import static com.darkweb.genesissearchengine.constants.constants.*;
@ -20,17 +22,17 @@ class notifictionManager
{ {
/*Private Variables*/ /*Private Variables*/
private AppCompatActivity mAppContext; private WeakReference<AppCompatActivity> mAppContext;
/*Initializations*/ /*Initializations*/
notifictionManager(AppCompatActivity pAppContext, eventObserver.eventListener pEvent){ notifictionManager(WeakReference<AppCompatActivity> pAppContext, eventObserver.eventListener pEvent){
this.mAppContext = pAppContext; this.mAppContext = pAppContext;
onNotificationClear(); onNotificationClear();
} }
private void onNotificationClear(){ private void onNotificationClear(){
NotificationManager notificationManager = (NotificationManager) mAppContext.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager notificationManager = (NotificationManager) mAppContext.get().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(status.mNotificationID); notificationManager.cancel(status.mNotificationID);
} }
@ -39,18 +41,18 @@ class notifictionManager
} }
private void onSchedule(Notification pNotification , int pDelay){ private void onSchedule(Notification pNotification , int pDelay){
Intent notificationIntent = new Intent( mAppContext, userEngagementNotification.class) ; Intent notificationIntent = new Intent( mAppContext.get().getApplicationContext(), userEngagementNotification.class) ;
notificationIntent.putExtra(CONST_NOTIFICATION_ID_NAME, CONST_NOTIFICATION_ID_VALUE) ; notificationIntent.putExtra(CONST_NOTIFICATION_ID_NAME, CONST_NOTIFICATION_ID_VALUE) ;
notificationIntent.putExtra(CONST_NOTIFICATION_ID_NAME, pNotification) ; notificationIntent.putExtra(CONST_NOTIFICATION_ID_NAME, pNotification) ;
PendingIntent pendingIntent = PendingIntent. getBroadcast ( mAppContext, CONST_NOTIFICATION_REQUEST_CODE, notificationIntent , PendingIntent. FLAG_UPDATE_CURRENT ) ; PendingIntent pendingIntent = PendingIntent. getBroadcast ( mAppContext.get().getApplicationContext(), CONST_NOTIFICATION_REQUEST_CODE, notificationIntent , PendingIntent. FLAG_UPDATE_CURRENT ) ;
long futureInMillis = SystemClock. elapsedRealtime () + pDelay ; long futureInMillis = SystemClock. elapsedRealtime () + pDelay ;
AlarmManager alarmManager = (AlarmManager) mAppContext.getSystemService(Context. ALARM_SERVICE ) ; AlarmManager alarmManager = (AlarmManager) mAppContext.get().getSystemService(Context. ALARM_SERVICE ) ;
assert alarmManager != null; assert alarmManager != null;
alarmManager.set(AlarmManager. ELAPSED_REALTIME_WAKEUP , futureInMillis , pendingIntent) ; alarmManager.set(AlarmManager. ELAPSED_REALTIME_WAKEUP , futureInMillis , pendingIntent) ;
} }
private Notification getNotification () { private Notification getNotification () {
NotificationCompat.Builder builder = new NotificationCompat.Builder(mAppContext, CONST_NOTIFICATION_ID_NAME) ; NotificationCompat.Builder builder = new NotificationCompat.Builder(mAppContext.get().getApplicationContext(), CONST_NOTIFICATION_ID_NAME) ;
builder.setContentTitle(CONST_NOTIFICATION_TITLE) ; builder.setContentTitle(CONST_NOTIFICATION_TITLE) ;
builder.setSmallIcon(R.drawable.notification_logo); builder.setSmallIcon(R.drawable.notification_logo);
builder.setAutoCancel(true) ; builder.setAutoCancel(true) ;

View File

@ -8,6 +8,8 @@ import org.mozilla.gecko.PrefsHelper;
import org.torproject.android.service.OrbotService; import org.torproject.android.service.OrbotService;
import org.torproject.android.service.util.Prefs; import org.torproject.android.service.util.Prefs;
import org.torproject.android.service.wrapper.orbotLocalConstants; import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.lang.ref.WeakReference;
import java.util.List; import java.util.List;
import com.darkweb.genesissearchengine.constants.*; import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.eventObserver;
@ -19,7 +21,7 @@ class orbotManager
/*Private Variables*/ /*Private Variables*/
private Context mAppContext; private WeakReference<Context> mAppContext;
private boolean mLogsStarted = false; private boolean mLogsStarted = false;
/*Initialization*/ /*Initialization*/
@ -31,24 +33,28 @@ class orbotManager
} }
public void initialize(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, int pNotificationStatus){ public void initialize(AppCompatActivity pAppContext, eventObserver.eventListener pEvent, int pNotificationStatus){
this.mAppContext = pAppContext; this.mAppContext = new WeakReference(pAppContext);
onInitNotificationStatus(pNotificationStatus); onInitNotificationStatus(pNotificationStatus);
} }
public void onRemoveInstances(){
this.mAppContext = null;
}
private void onStartOrbot(){ private void onStartOrbot(){
orbotLocalConstants.mBridges = status.sBridgeCustomBridge; orbotLocalConstants.mBridges = status.sBridgeCustomBridge;
orbotLocalConstants.mIsManualBridge = status.sBridgeGatewayManual; orbotLocalConstants.mIsManualBridge = status.sBridgeGatewayManual;
orbotLocalConstants.mManualBridgeType = status.sBridgeCustomType; orbotLocalConstants.mManualBridgeType = status.sBridgeCustomType;
Prefs.putBridgesEnabled(status.sBridgeStatus); Prefs.putBridgesEnabled(status.sBridgeStatus);
Intent mServiceIntent = new Intent(mAppContext.getApplicationContext(), OrbotService.class); Intent mServiceIntent = new Intent(mAppContext.get().getApplicationContext(), OrbotService.class);
mServiceIntent.setAction(ACTION_START); mServiceIntent.setAction(ACTION_START);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mAppContext.startForegroundService(mServiceIntent); mAppContext.get().getApplicationContext().startForegroundService(mServiceIntent);
} }
else else
{ {
mAppContext.startService(mServiceIntent); mAppContext.get().getApplicationContext().startService(mServiceIntent);
} }
initializeProxy(); initializeProxy();

View File

@ -1,7 +1,5 @@
package com.darkweb.genesissearchengine.pluginManager; package com.darkweb.genesissearchengine.pluginManager;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
@ -14,6 +12,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.lang.ref.WeakReference;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -38,7 +37,7 @@ public class pluginController
/*Private Variables*/ /*Private Variables*/
private static pluginController ourInstance = new pluginController(); private static pluginController ourInstance = new pluginController();
private homeController mHomeController; private WeakReference<AppCompatActivity> mHomeController;
private boolean mIsInitialized = false; private boolean mIsInitialized = false;
/*Initializations*/ /*Initializations*/
@ -57,13 +56,18 @@ public class pluginController
mIsInitialized = true; mIsInitialized = true;
} }
public void onRemoveInstances(){
mHomeController = null;
mOrbotManager.onRemoveInstances();
}
private void instanceObjectInitialization() private void instanceObjectInitialization()
{ {
mHomeController = activityContextManager.getInstance().getHomeController(); mHomeController = new WeakReference(activityContextManager.getInstance().getHomeController());
mContextManager = activityContextManager.getInstance(); mContextManager = activityContextManager.getInstance();
mNotificationManager = new notifictionManager(mHomeController,new notificationCallback()); mNotificationManager = new notifictionManager(mHomeController,new notificationCallback());
mAdManager = new adManager(mHomeController,new admobCallback(), mHomeController.getBannerAd()); mAdManager = new adManager(new admobCallback(), ((homeController)mHomeController.get()).getBannerAd());
mAnalyticsManager = new com.darkweb.genesissearchengine.pluginManager.analyticManager(mHomeController,new analyticManager()); mAnalyticsManager = new com.darkweb.genesissearchengine.pluginManager.analyticManager(mHomeController,new analyticManager());
mMessageManager = new messageManager(new messageCallback()); mMessageManager = new messageManager(new messageCallback());
mOrbotManager = orbotManager.getInstance(); mOrbotManager = orbotManager.getInstance();
@ -89,7 +93,7 @@ public class pluginController
public Object invokeObserver(List<Object> data, Object event_type) public Object invokeObserver(List<Object> data, Object event_type)
{ {
if(event_type.equals(M_SHOW_LOADED_ADS)) if(event_type.equals(M_SHOW_LOADED_ADS))
mHomeController.onSetBannerAdMargin(); ((homeController)mHomeController.get()).onSetBannerAdMargin();
return null; return null;
} }
} }
@ -165,6 +169,9 @@ public class pluginController
/*Lang Manager*/ /*Lang Manager*/
public Object onLanguageInvoke(List<Object> pData, pluginEnums.eLangManager pEventType){ public Object onLanguageInvoke(List<Object> pData, pluginEnums.eLangManager pEventType){
if(mLangManager==null){
return null;
}
return mLangManager.onTrigger(pData, pEventType); return mLangManager.onTrigger(pData, pEventType);
} }
@ -178,7 +185,9 @@ public class pluginController
/*Message Manager*/ /*Message Manager*/
public void onMessageManagerInvoke(List<Object> pData, pluginEnums.eMessageManager pEventType){ public void onMessageManagerInvoke(List<Object> pData, pluginEnums.eMessageManager pEventType){
mMessageManager.onTrigger(pData,pEventType); if(mMessageManager!=null){
mMessageManager.onTrigger(pData,pEventType);
}
} }
private class messageCallback implements eventObserver.eventListener{ private class messageCallback implements eventObserver.eventListener{
@ -187,13 +196,13 @@ public class pluginController
{ {
if(pEventType.equals(enums.etype.welcome)) if(pEventType.equals(enums.etype.welcome))
{ {
mHomeController.onLoadURL(pData.get(0).toString()); ((homeController)mHomeController.get()).onLoadURL(pData.get(0).toString());
} }
else if(pEventType.equals(M_DOWNLOAD_SINGLE)){ else if(pEventType.equals(M_DOWNLOAD_SINGLE)){
activityContextManager.getInstance().getHomeController().onManualDownloadFileName((String)pData.get(2),(String)pData.get(0)); activityContextManager.getInstance().getHomeController().onManualDownloadFileName((String)pData.get(2),(String)pData.get(0));
} }
else if(pEventType.equals(M_SECURE_CONNECTION)){ else if(pEventType.equals(M_SECURE_CONNECTION)){
helperMethod.openActivity(settingPrivacyController.class, constants.CONST_LIST_HISTORY, mHomeController,true); helperMethod.openActivity(settingPrivacyController.class, constants.CONST_LIST_HISTORY, mHomeController.get(),true);
} }
else if(pEventType.equals(M_CANCEL_WELCOME)){ else if(pEventType.equals(M_CANCEL_WELCOME)){
status.sSettingIsWelcomeEnabled = false; status.sSettingIsWelcomeEnabled = false;
@ -202,14 +211,14 @@ public class pluginController
else if(pEventType.equals(enums.etype.reload)){ else if(pEventType.equals(enums.etype.reload)){
if((Boolean) mOrbotManager.onTrigger(null, pluginEnums.eOrbotManager.M_IS_ORBOT_RUNNING)) if((Boolean) mOrbotManager.onTrigger(null, pluginEnums.eOrbotManager.M_IS_ORBOT_RUNNING))
{ {
mHomeController.onReload(null); ((homeController)mHomeController.get()).onReload(null);
} }
else { else {
mMessageManager.onTrigger(Arrays.asList(mHomeController, Collections.singletonList(pData.get(0).toString())),M_START_ORBOT); mMessageManager.onTrigger(Arrays.asList(mHomeController, Collections.singletonList(pData.get(0).toString())),M_START_ORBOT);
} }
} }
else if(pEventType.equals(M_OPEN_PRIVACY)){ else if(pEventType.equals(M_OPEN_PRIVACY)){
helperMethod.openActivity(settingPrivacyController.class, constants.CONST_LIST_HISTORY, mHomeController,true); helperMethod.openActivity(settingPrivacyController.class, constants.CONST_LIST_HISTORY, mHomeController.get(),true);
} }
else if(pEventType.equals(M_CLEAR_BOOKMARK)){ else if(pEventType.equals(M_CLEAR_BOOKMARK)){
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,pData); dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,pData);
@ -227,24 +236,24 @@ public class pluginController
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,true));
} }
else if(pEventType.equals(M_DOWNLOAD_FILE)){ else if(pEventType.equals(M_DOWNLOAD_FILE)){
mHomeController.onDownloadFile(); ((homeController)mHomeController.get()).onDownloadFile();
} }
else if(pEventType.equals(M_DOWNLOAD_FILE_MANUAL)){ else if(pEventType.equals(M_DOWNLOAD_FILE_MANUAL)){
mHomeController.onManualDownload(pData.get(0).toString()); ((homeController)mHomeController.get()).onManualDownload(pData.get(0).toString());
} }
else if(pEventType.equals(M_OPEN_LINK_NEW_TAB)){ else if(pEventType.equals(M_OPEN_LINK_NEW_TAB)){
mHomeController.postNewLinkTabAnimationInBackgroundTrigger(pData.get(0).toString()); ((homeController)mHomeController.get()).postNewLinkTabAnimationInBackgroundTrigger(pData.get(0).toString());
} }
else if(pEventType.equals(M_OPEN_LINK_CURRENT_TAB)){ else if(pEventType.equals(M_OPEN_LINK_CURRENT_TAB)){
mHomeController.onLoadURL(pData.get(0).toString()); ((homeController)mHomeController.get()).onLoadURL(pData.get(0).toString());
} }
else if(pEventType.equals(M_COPY_LINK)){ else if(pEventType.equals(M_COPY_LINK)){
helperMethod.copyURL(pData.get(0).toString(),mContextManager.getHomeController()); helperMethod.copyURL(pData.get(0).toString(),mContextManager.getHomeController());
} }
else if(pEventType.equals(M_CLEAR_TAB)){ else if(pEventType.equals(M_CLEAR_TAB)){
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mHomeController.initTab(true); ((homeController)mHomeController.get()).initTab(true);
mHomeController.onDisableTabViewController(); ((homeController)mHomeController.get()).onDisableTabViewController();
} }
else if(pEventType.equals(M_REQUEST_BRIDGES)){ else if(pEventType.equals(M_REQUEST_BRIDGES)){
pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(constants.CONST_BACKEND_GOOGLE_URL, this), M_BRIDGE_MAIL); pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(constants.CONST_BACKEND_GOOGLE_URL, this), M_BRIDGE_MAIL);

View File

@ -19,7 +19,7 @@ public class pluginEnums
/*Lanuage Manager*/ /*Lanuage Manager*/
public enum eLangManager{ public enum eLangManager{
M_SET_LANGUAGE, M_ACTIVITY_CREATED, M_RESUME, M_SUPPORTED_SYSTEM_LANGUAGE_INFO M_SET_LANGUAGE, M_ACTIVITY_CREATED, M_RESUME, M_SUPPORTED_SYSTEM_LANGUAGE_INFO, M_INIT_LOCALE
} }
public enum eLangManagerCallbacks{ public enum eLangManagerCallbacks{

View File

@ -28,29 +28,16 @@
</item> </item>
<item android:state_pressed="true"> <item android:state_pressed="true">
<shape
android:shape="rectangle" android:padding="15dp" >
<!-- you can use any color you want I used here gray color-->
<solid android:color="@color/c_background"/>
<corners android:radius="4dp"/>
<stroke
android:width="2.5dp"
android:color="@color/c_text_v5" />
<corners android:radius="4dp" />
</shape>
</item>
<!--<item android:state_pressed="true">
<shape <shape
android:shape="rectangle" android:padding="15dp" > android:shape="rectangle" android:padding="15dp" >
<solid android:color="@color/c_background" /> <solid android:color="@color/c_background" />
<corners android:radius="4dp"/> <corners android:radius="4dp"/>
<stroke <stroke
android:width="2dp" android:width="2.5dp"
android:color="@color/c_tab_border" /> android:color="@color/c_tab_border" />
<corners android:radius="4dp" /> <corners android:radius="4dp" />
</shape> </shape>
</item>--> </item>
</selector> </selector>
</inset> </inset>
</item> </item>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 864 KiB

View File

@ -42,6 +42,7 @@
android:text="Deuche (de)" android:text="Deuche (de)"
android:textDirection="locale" android:textDirection="locale"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textColor="@color/c_text_v6"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/pHeader" /> app:layout_constraintTop_toBottomOf="@+id/pHeader" />

View File

@ -16,7 +16,7 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">f app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/pAppbar" android:id="@+id/pAppbar"
@ -258,6 +258,23 @@
app:wrapShiftDrawable="true" app:wrapShiftDrawable="true"
tools:progress="0" /> tools:progress="0" />
<ImageView
android:id="@+id/pNewTabBlocker"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:background="@color/c_background"
android:contentDescription="@string/GENERAL_TODO"
android:focusable="false"
android:translationZ="15dp"
android:visibility="gone"
android:elevation="100dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -147,41 +147,56 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layoutDirection="ltr" android:layoutDirection="ltr"
android:paddingTop="9dp"
android:paddingBottom="13dp" android:paddingBottom="13dp"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:background="@xml/gx_ripple_gray" android:background="@xml/gx_ripple_gray"
android:onClick="onTracking" android:onClick="onTracking"
android:orientation="vertical"> android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layoutDirection="ltr"
android:layout_marginTop="-2dp"
android:textColor="@color/c_text_v1"
android:textSize="15sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION1"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layoutDirection="ltr"
android:layout_marginTop="5dp"
android:textColor="@color/c_text_v6"
android:textSize="13sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION1_INFO"
/>
</LinearLayout>
<RadioButton <RadioButton
android:id="@+id/pTrackingRadioOption1" android:id="@+id/pTrackingRadioOption1"
android:layoutDirection="rtl" android:layoutDirection="rtl"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_marginTop="8dp"
android:clickable="false" android:clickable="false"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:buttonTint="@color/c_radio_tint" android:buttonTint="@color/c_radio_tint"
android:textColor="@color/c_text_v1" android:layout_marginTop="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:textSize="15sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION1"
tools:ignore="RtlHardcoded" tools:ignore="RtlHardcoded"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layoutDirection="ltr"
android:layout_marginEnd="42dp"
android:layout_marginTop="-2dp"
android:paddingEnd="17dp"
android:textColor="@color/c_text_v6"
android:textSize="13sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION1_INFO"
/>
</LinearLayout> </LinearLayout>
<View <View
@ -195,40 +210,56 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layoutDirection="ltr" android:layoutDirection="ltr"
android:paddingTop="9dp"
android:paddingBottom="13dp" android:paddingBottom="13dp"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:background="@xml/gx_ripple_gray" android:background="@xml/gx_ripple_gray"
android:onClick="onTracking" android:onClick="onTracking"
android:orientation="vertical"> android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layoutDirection="ltr"
android:layout_marginTop="-2dp"
android:textColor="@color/c_text_v1"
android:textSize="15sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION2"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layoutDirection="ltr"
android:layout_marginTop="5dp"
android:textColor="@color/c_text_v6"
android:textSize="13sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION2_INFO"
/>
</LinearLayout>
<RadioButton <RadioButton
android:id="@+id/pTrackingRadioOption2" android:id="@+id/pTrackingRadioOption2"
android:layoutDirection="rtl" android:layoutDirection="rtl"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_marginTop="8dp"
android:clickable="false" android:clickable="false"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:buttonTint="@color/c_radio_tint" android:buttonTint="@color/c_radio_tint"
android:textColor="@color/c_text_v1" android:layout_marginTop="10dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:layout_marginStart="15dp"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:textSize="15sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION2"
tools:ignore="RtlHardcoded" tools:ignore="RtlHardcoded"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="42dp"
android:layout_marginTop="-2dp"
android:textColor="@color/c_text_v6"
android:paddingEnd="16dp"
android:textSize="13sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION2_INFO"
/>
</LinearLayout> </LinearLayout>
<View <View
@ -239,43 +270,59 @@
<LinearLayout <LinearLayout
android:id="@+id/pTrackingOption3" android:id="@+id/pTrackingOption3"
android:layoutDirection="ltr"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layoutDirection="ltr"
android:paddingTop="9dp"
android:paddingBottom="13dp" android:paddingBottom="13dp"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:background="@xml/gx_ripple_gray" android:background="@xml/gx_ripple_gray"
android:onClick="onTracking" android:onClick="onTracking"
android:orientation="vertical"> android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layoutDirection="ltr"
android:layout_marginTop="-2dp"
android:textColor="@color/c_text_v1"
android:textSize="15sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION3"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layoutDirection="ltr"
android:layout_marginTop="5dp"
android:textColor="@color/c_text_v6"
android:textSize="13sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION3_INFO"
/>
</LinearLayout>
<RadioButton <RadioButton
android:id="@+id/pTrackingRadioOption3" android:id="@+id/pTrackingRadioOption3"
android:layoutDirection="rtl" android:layoutDirection="rtl"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_marginTop="8dp"
android:clickable="false" android:clickable="false"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:buttonTint="@color/c_radio_tint" android:buttonTint="@color/c_radio_tint"
android:textColor="@color/c_text_v1" android:layout_marginTop="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:layout_marginStart="15dp" android:layout_marginStart="15dp"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:textSize="15sp"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION3"
tools:ignore="RtlHardcoded" tools:ignore="RtlHardcoded"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="42dp"
android:layout_marginTop="-2dp"
android:paddingEnd="16dp"
android:textSize="13sp"
android:textColor="@color/c_text_v6"
android:text="@string/SETTING_PRIVACY_TRACKING_OPTION3_INFO"
/>
</LinearLayout> </LinearLayout>
<View <View

View File

@ -7,6 +7,8 @@
android:layout_marginTop="-5dp" android:layout_marginTop="-5dp"
android:layout_marginStart="0dp" android:layout_marginStart="0dp"
android:clickable="true" android:clickable="true"
android:scaleX="1"
android:scaleY="1"
android:background="@color/clear_alpha" android:background="@color/clear_alpha"
android:focusable="true" android:focusable="true"
android:orientation="horizontal" android:orientation="horizontal"

View File

@ -16,7 +16,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/c_background" android:background="@color/c_background"
android:clickable="true" android:clickable="true"
android:elevation="8dp" android:elevation="4dp"
android:focusable="true" android:focusable="true"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -26,7 +26,8 @@
<LinearLayout <LinearLayout
android:id="@+id/pHeaderContainerTop" android:id="@+id/pHeaderContainerTop"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="65dp" android:paddingTop="5dp"
android:layout_height="60dp"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:orientation="horizontal" android:orientation="horizontal"
@ -148,11 +149,11 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="fill_vertical" android:layout_gravity="fill_vertical"
android:layout_marginTop="60dp" android:layout_marginTop="60dp"
android:paddingEnd="5dp"
android:paddingStart="5dp"
android:paddingTop="10dp"
android:background="@color/c_background" android:background="@color/c_background"
android:fillViewport="true" android:fillViewport="true"
android:paddingStart="5dp"
android:paddingTop="0dp"
android:paddingEnd="5dp"
android:translationZ="2dp" android:translationZ="2dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -167,10 +168,10 @@
android:clickable="true" android:clickable="true"
android:clipToPadding="false" android:clipToPadding="false"
android:elevation="8dp" android:elevation="8dp"
android:paddingTop="5dp"
android:focusable="true" android:focusable="true"
android:onClick="onClearSelection" android:onClick="onClearSelection"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="0dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
@ -192,8 +193,10 @@
android:id="@+id/pRecycleView" android:id="@+id/pRecycleView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:alpha="0"
android:background="@color/c_background" android:background="@color/c_background"
android:clickable="true" android:clickable="true"
android:paddingTop="10dp"
android:clipToPadding="false" android:clipToPadding="false"
android:focusable="true" android:focusable="true"
android:onClick="onClearSelection" android:onClick="onClearSelection"

View File

@ -451,11 +451,15 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
} }
protected void logNotice(String msg) { protected void logNotice(String msg) {
if (msg != null && msg.trim().length() > 0) { try{
if (Prefs.useDebugLogging()) if (msg != null && msg.trim().length() > 0) {
Log.d(OrbotConstants.TAG, msg); if (Prefs.useDebugLogging())
Log.d(OrbotConstants.TAG, msg);
sendCallbackLogMessage(msg);
}
}catch (Exception ignored){
sendCallbackLogMessage(msg);
} }
} }