Bug Fixes

Bug Fixes
master
msmannan00 2021-03-18 22:42:53 +05:00
parent e2619cdc71
commit 2cb59f8d0d
53 changed files with 896 additions and 260 deletions

View File

@ -91,6 +91,7 @@ android {
'src/main/res/layouts/bookmark',
'src/main/res/layouts/shared',
'src/main/res/layouts/shared/listviews',
'src/main/res/layouts/searchWidget',
'src/main/res/layouts/home',
'src/main/res/custom-xml/alert',
'src/main/res/custom-xml/tab',
@ -145,15 +146,15 @@ dependencies {
}
/*Default Libraries*/
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'com.google.android.material:material:1.3.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.4.0-alpha01'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.21"
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.31'
/*Firefox ABI Splits*/
implementation "org.mozilla.components:browser-engine-gecko:$mozilla_components_version"
@ -164,7 +165,7 @@ dependencies {
implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'
/*Ads Manager*/
implementation 'com.google.android.gms:play-services-ads:19.5.0'
implementation 'com.google.android.gms:play-services-ads:19.8.0'
/*Crashlytics*/
@ -182,12 +183,12 @@ dependencies {
/*Helper Libraries*/
implementation 'com.chauthai.overscroll:overscroll-bouncy:0.1.1'
androidTestImplementation "junit:junit:4.13.1"
androidTestImplementation 'junit:junit:4.13.2'
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
implementation 'com.android.support:design:24.0.0'
implementation 'com.android.support:design:28.0.0'
implementation "org.mozilla.components:browser-icons:9.0.0"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.30.1'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.android.volley:volley:1.2.0'
implementation 'com.github.gabrielemariotti.recyclerview:recyclerview-animators:0.3.0-SNAPSHOT@aar'
implementation 'com.github.instacart.truetime-android:library-extension-rx:3.3'

View File

@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.myapplication">
<!-- Permissions -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
@ -11,8 +12,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.READ_CLIPBOARD" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<application
android:allowBackup="true"
@ -26,7 +26,16 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:targetApi="n">
<!-- Activities -->
<receiver android:name="com.widget.search.searchWidgetManager">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/search_widget_manager_info" />
</receiver>
<activity
android:name="com.darkweb.genesissearchengine.appManager.orbotManager.orbotController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" />

View File

@ -64,12 +64,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
initializeModelWithDate(false);
}
public void onLoadMore(ArrayList<bookmarkRowModel> pModelList){
notifyDataSetChanged();
initializeModelWithDate(false);
}
private void initializeModelWithDate(boolean pFilterEnabled){
int m_real_counter=0;
@ -140,10 +134,20 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
}
private void clearLongSelectedURL(){
for(int m_counter = 0; m_counter< mCurrentList.size(); m_counter++){
for(int m_counter_inner = 0; m_counter_inner< mLongSelectedID.size(); m_counter_inner++){
if(mCurrentList.get(m_counter).getID() == mLongSelectedID.get(m_counter_inner)){
mLongSelectedID.remove(m_counter_inner);
notifyItemChanged(m_counter);
m_counter-=1;
break;
}
}
}
mLongSelectedDate.clear();
mLongSelectedIndex.clear();
mLongSelectedID.clear();
//notifyDataSetChanged();
}
private String getSelectedURL(){
@ -190,9 +194,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
e.printStackTrace();
}
if(!pIsForced){
if(mLongSelectedID.size()==0){
//notifyDataSetChanged();
}
mLongSelectedDate.add(pDate);
mLongSelectedIndex.add(pUrl);
mLongSelectedID.add(pId);
@ -217,9 +218,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mLongSelectedDate.remove(pDate);
mLongSelectedIndex.remove(pUrl);
mLongSelectedID.remove((Integer) pId);
if(mLongSelectedID.size()==0){
//notifyDataSetChanged();
}
onVerifyLongSelectedURL();
} catch (Exception e) {
e.printStackTrace();
@ -321,6 +319,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
else if(v.getId() == R.id.pMenuDelete){
initializeModelWithDate(false);
onClose(pPosition);
invokeFilter(true);
mPopupWindow.dismiss();
}
});
@ -344,7 +343,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
}
}else {
mCurrentList.clear();
notifyDataSetChanged();
//notifyDataSetChanged();
return;
}
int size = mCurrentList.size();

View File

@ -19,12 +19,12 @@ import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
@ -35,6 +35,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
@ -43,7 +44,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU;
@ -60,7 +60,7 @@ public class bookmarkController extends AppCompatActivity
/*Private Views*/
private ImageView mEmptyListNotification;
private EditText mSearchInput;
private editTextManager mSearchInput;
private RecyclerView mRecycleView;
private Button mClearButton;
private ImageButton mMenuButton;
@ -85,6 +85,8 @@ public class bookmarkController extends AppCompatActivity
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
theme.getInstance().onConfigurationChanged(this);
}
public void initializeListModel(){
@ -121,6 +123,8 @@ public class bookmarkController extends AppCompatActivity
public void initCustomListeners(){
mClearButton.requestFocusFromTouch();
mSearchInput.setEventHandler(new edittextManagerCallback());
mSearchInput.setOnEditorActionListener((v, actionId, event) ->{
if (actionId == EditorInfo.IME_ACTION_NEXT)
{
@ -294,6 +298,18 @@ public class bookmarkController extends AppCompatActivity
finish();
}
public class edittextManagerCallback implements eventObserver.eventListener {
@Override
public Object invokeObserver(List<Object> data, Object e_type) {
if(e_type.equals(enums.etype.ON_KEYBOARD_CLOSE)){
onHideSearch(null);
onClearMultipleSelection(null);
}
return null;
}
}
/*Event Observer*/

View File

@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentActivity;
@ -16,6 +17,10 @@ import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
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 {
@Override
public void onCreate(Bundle savedInstanceState) {
@ -23,7 +28,15 @@ public class externalNavigationController extends AppCompatActivity {
if(status.sSettingIsAppStarted){
finish();
Uri data = externalNavigationController.this.getIntent().getData();
activityContextManager.getInstance().getHomeController().onLoadURL(data.toString());
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString());
final Handler handler = new Handler();
handler.postDelayed(() -> {
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.darkweb.genesissearchengine");
startActivity(launchIntent);
}, 500);
return;
}
setContentView(R.layout.home_view);
@ -32,7 +45,7 @@ public class externalNavigationController extends AppCompatActivity {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
Uri data = this.getIntent().getData();
if(data!=null){
activityContextManager.getInstance().getHomeController().onLoadURL(data.toString());
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString());
}
this.startActivity(intent);
@ -46,15 +59,22 @@ public class externalNavigationController extends AppCompatActivity {
}
}
}.start();
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.darkweb.genesissearchengine");
startActivity(launchIntent);
}
@Override
protected void onNewIntent(Intent intent)
{
super.onNewIntent(intent);
Uri data = intent.getData();
if(data!=null){
activityContextManager.getInstance().getHomeController().onLoadURL("https://bbc.com");
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString());
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.darkweb.genesissearchengine");
startActivity(launchIntent);
}
}

View File

@ -69,7 +69,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
}
public void onLoadMore(ArrayList<historyRowModel> pModelList){
notifyDataSetChanged();
//notifyDataSetChanged();
initializeModelWithDate(false);
}
@ -157,7 +157,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
}
if(m_counter_inner==0){
notifyDataSetChanged();
//notifyDataSetChanged();
}else {
if(mDateVerify){
@ -178,10 +178,20 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
}
private void clearLongSelectedURL(){
for(int m_counter = 0; m_counter< mCurrentList.size(); m_counter++){
for(int m_counter_inner = 0; m_counter_inner< mLongSelectedID.size(); m_counter_inner++){
if(mCurrentList.get(m_counter).getID() == mLongSelectedID.get(m_counter_inner)){
mLongSelectedID.remove(m_counter_inner);
notifyItemChanged(m_counter);
m_counter-=1;
break;
}
}
}
mLongSelectedDate.clear();
mLongSelectedIndex.clear();
mLongSelectedID.clear();
//notifyDataSetChanged();
}
private String getSelectedURL(){
@ -228,9 +238,6 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
e.printStackTrace();
}
if(!pIsForced){
if(mLongSelectedID.size()==0){
// notifyDataSetChanged();
}
mLongSelectedDate.add(pDate);
mLongSelectedIndex.add(pUrl);
mLongSelectedID.add(pId);
@ -255,9 +262,6 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
mLongSelectedDate.remove(pDate);
mLongSelectedIndex.remove(pUrl);
mLongSelectedID.remove((Integer) pId);
if(mLongSelectedID.size()==0){
//notifyDataSetChanged();
}
onVerifyLongSelectedURL();
} catch (Exception e) {
e.printStackTrace();
@ -359,6 +363,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
else if(v.getId() == R.id.pMenuDelete){
initializeModelWithDate(false);
onClose(pPosition);
invokeFilter(true);
mPopupWindow.dismiss();
}
});

View File

@ -25,6 +25,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
@ -59,7 +60,7 @@ public class historyController extends AppCompatActivity
/*Private Views*/
private ImageView mEmptyListNotification;
private EditText mSearchInput;
private editTextManager mSearchInput;
private RecyclerView mRecycleView;
private Button mClearButton;
private ImageButton mMenuButton;
@ -122,6 +123,8 @@ public class historyController extends AppCompatActivity
}
public void initCustomListeners(){
mSearchInput.setEventHandler(new edittextManagerCallback());
mRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
@ -362,6 +365,19 @@ public class historyController extends AppCompatActivity
}
}
public class edittextManagerCallback implements eventObserver.eventListener {
@Override
public Object invokeObserver(List<Object> data, Object e_type) {
if(e_type.equals(enums.etype.ON_KEYBOARD_CLOSE)){
onHideSearch(null);
onClearMultipleSelection(null);
}
return null;
}
}
/*Event Observer*/
public class adapterCallback implements eventObserver.eventListener{

View File

@ -390,6 +390,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
/* Its Absence causes delay on first launch*/
if(mCurrentURL.contains("boogle.store")){
mProgress = 5;
event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced);
}
@ -763,12 +764,14 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
final Handler handler = new Handler();
handler.postDelayed(this::goBack, 100);
mProgress = 5;
event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced);
event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK);
}
else {
final Handler handler = new Handler();
handler.postDelayed(this::goBack, 100);
mProgress = 5;
event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced);
event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK);
}
@ -786,11 +789,13 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
}
final Handler handler = new Handler();
handler.postDelayed(this::goForward, 100);
mProgress = 5;
event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced);
event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK);
}else {
final Handler handler = new Handler();
handler.postDelayed(this::goForward, 100);
mProgress = 5;
event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced);
event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK);
}

View File

@ -9,6 +9,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
@ -68,6 +69,7 @@ import com.darkweb.genesissearchengine.helperManager.OnClearFromRecentService;
import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme;
import com.darkweb.genesissearchengine.helperManager.trueTime;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
@ -167,11 +169,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba
onInitBooleans();
orbotLocalConstants.mHomeIntent = getIntent();
getWindow().getDecorView().setBackgroundColor(Color.WHITE);
pluginController.getInstance().preInitialize(this);
databaseController.getInstance().initialize(this);
dataController.getInstance().initialize(this);
onChangeTheme();
status.initStatus();
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
trueTime.getInstance().initTime();
@ -191,6 +193,42 @@ public class homeController extends AppCompatActivity implements ComponentCallba
onInitResume(false);
initSuggestions();
initAdmob();
initWidget();
}
public void initWidget(){
if(status.sWidgetResponse == enums.WidgetResponse.SEARCHBAR){
if(!status.sSettingIsAppStarted){
if(mSplashScreen.getAlpha()==1 && mConnectButton.isEnabled()){
onStartApplication(null);
status.sWidgetResponse = enums.WidgetResponse.NONE;
}
}else {
mHomeViewController.initSearchBarFocus(false, isKeyboardOpened);
final Handler handler = new Handler();
handler.postDelayed(() ->
{
if(mSearchEngineBar.getVisibility() != View.VISIBLE){
mHomeViewController.initSearchBarFocus(true, isKeyboardOpened);
status.sWidgetResponse = enums.WidgetResponse.NONE;
}
}, 500);
}
}
else if(status.sWidgetResponse == enums.WidgetResponse.VOICE){
if(!status.sSettingIsAppStarted){
if(mSplashScreen.getAlpha()==1 && mConnectButton.isEnabled()){
onStartApplication(null);
status.sWidgetResponse = enums.WidgetResponse.NONE;
}
}else {
if(mSearchEngineBar.getVisibility() != View.VISIBLE){
onVoiceClick(null);
status.sWidgetResponse = enums.WidgetResponse.NONE;
}
}
}
}
public void initAdmob(){
@ -237,7 +275,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP1:",(String)model.getSession().getCurrentURL());
mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(), false, false, false);
}
onLoadTab(model.getSession(),false);
onLoadTab(model.getSession(),false,true);
onLoadURL(model.getSession().getCurrentURL());
}else {
onNewIntent(getIntent());
@ -255,48 +293,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
if(model!=null){
if(!mGeckoClient.getSession().getSessionID().equals(model.getSession().getSessionID())){
onLoadTab(model.getSession(),true);
onLoadTab(model.getSession(),true,true);
}
}else {
postNewTabAnimation(false, false);
}
}
public Context setupTheme(Context context) {
Resources res = context.getResources();
int mode = res.getConfiguration().uiMode;
if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(!status.sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}
}
Configuration config = new Configuration(res.getConfiguration());
config.uiMode = mode;
context = context.createConfigurationContext(config);
return context;
}
@SuppressLint("ClickableViewAccessibility")
private void initSuggestionView(ArrayList<historyRowModel> pList, String pSearch){
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
@ -383,7 +386,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mCopyright = findViewById(R.id.pCopyright);
mHintListView = mSearchEngineBar.findViewById(R.id.pHistListView);
mAppBar = findViewById(R.id.pAppbar);
mSearchLock = findViewById(R.id.pSearchLock);
mSearchLock = findViewById(R.id.pSearchLogo);
mOrbotLogManager = findViewById(R.id.pOrbotLogManager);
mFindBar = findViewById(R.id.pFindBar);
mInfoPortrait = findViewById(R.id.pInfoPortrait);
@ -408,16 +411,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(), false);
}
public void onUpdateToolbarTheme(){
mHomeViewController.onUpdateToolbarTheme();
}
public void onChangeTheme(){
if(!status.sSettingIsAppStarted){
status.sDefaultNightMode = (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if(inSignatureArea(event)){
@ -465,11 +458,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba
protected void attachBaseContext(Context base) {
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(base);
status.sTheme = mPrefs.getInt(keys.SETTING_THEME,enums.Theme.THEME_DEFAULT);
Prefs.setContext(base);
orbotLocalConstants.mHomeContext = new WeakReference<>(base);
Context context = setupTheme(base);
super.attachBaseContext(LocaleHelper.onAttach(context, Prefs.getDefaultLocale()));
Context mContext = theme.getInstance().initTheme(base);
super.attachBaseContext(LocaleHelper.onAttach(mContext, Prefs.getDefaultLocale()));
}
/*-------------------------------------------------------Helper Methods-------------------------------------------------------*/
@ -479,8 +472,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
public void onGetThumbnail(ImageView pImageView,boolean pLoadTabView){
try{
mRenderedBitmap = mGeckoView.capturePixels();
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, pImageView, mGeckoView, pLoadTabView));
}catch (Exception ignored){}
}
@ -502,7 +497,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
public void onReDrawGeckoview(){
mGeckoClient.getSession().closeSession();
mGeckoClient.getSession().close();
mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false);
}
@ -514,7 +508,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoClient.loadURL(url.replace("genesis.onion","boogle.store"));
}
public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed){
public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed, boolean pExpandAppBar){
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false));
if(!isSessionClosed){
@ -540,8 +534,19 @@ public class homeController extends AppCompatActivity implements ComponentCallba
org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP4:",(String)mGeckoClient.getSession().getCurrentURL());
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, false);
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getSession().getTheme(),true);
mAppBar.setExpanded(true,true);
mRenderedBitmap = mGeckoView.capturePixels();
if(pExpandAppBar){
mHomeViewController.expandTopBar();
}
if(mGeckoClient.getSession().getCurrentURL().contains("boogle.store") || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){
mHomeViewController.updateBannerAdvertStatus(false, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED));
}else {
mHomeViewController.updateBannerAdvertStatus(true, (boolean)pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED));
}
mHomeViewController.onProgressBarUpdate(mGeckoClient.getSession().getProgress(),true);
}
/*-------------------------------------------------------USER EVENTS-------------------------------------------------------*/
@ -762,7 +767,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(mHintListView!=null && mHintListView.getAdapter()!=null && mHintListView.getAdapter().getItemCount()>0){
mHomeViewController.onUpdateSearchEngineBar(false, 150);
}
mHomeViewController.initSearchBarFocus(false);
mHomeViewController.initSearchBarFocus(false, isKeyboardOpened);
if(!mGeckoClient.isLoading()){
org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP8:",(String)mGeckoClient.getSession().getCurrentURL());
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false);
@ -774,7 +779,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}else {
if(!isFocusChanging){
if(!status.mThemeApplying){
mHomeViewController.initSearchBarFocus(true);
mHomeViewController.initSearchBarFocus(true, isKeyboardOpened);
}
isSuggestionChanged = true;
isSuggestionSearchOpened = false;
@ -869,11 +874,15 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onHideLoadTabDialog();
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_RECENT_TAB, null);
if(model!=null && !mGeckoClient.getSession().getSessionID().equals(model.getSession().getSessionID())){
mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(),false,false,false);
onLoadTab(model.getSession(), false);
mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(),false,false,true);
onLoadTab(model.getSession(), false,true);
}
}
public void onRestoreTab(View view){
activityContextManager.getInstance().getTabController().onRestoreTab(view);
}
public void onClearSelection(View view){
activityContextManager.getInstance().getTabController().onClearSelection(view);
}
@ -911,19 +920,23 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void postNewLinkTabAnimationInBackgroundTrigger(String url){
postNewLinkTabAnimationInBackground(dataToStr(url));
mHomeViewController.onShowLoadTabDialog();
initTabCount();
}
public void postNewLinkTabAnimationInBackground(String url){
mAppBar.setTag(R.id.expandableBar,false);
geckoSession mSession = mGeckoClient.getSession();
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView,false));
mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,true);
onSaveCurrentTab(mGeckoClient.getSession(),true);
mHomeViewController.progressBarReset();
mHomeViewController.onUpdateSearchBar(url,false,true, false);
mGeckoClient.initURL(url);
mGeckoClient.loadURL(url);
onLoadTab(mSession,false);
onSaveCurrentTab(mGeckoClient.getSession(),false);
onLoadTab(mSession,false,false);
mAppBar.setTag(R.id.expandableBar,true);
initTabCount();
}
public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened){
@ -942,10 +955,12 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
public void onOpenLinkNewTab(String url){
onGetThumbnail(null, false);
final Handler handler = new Handler();
handler.postDelayed(() -> mHomeViewController.onNewTabAnimation(Collections.singletonList(url),M_INITIALIZE_TAB_LINK), 100);
handler.postDelayed(() -> {
onGetThumbnail(null, false);
mHomeViewController.expandTopBar();
mHomeViewController.onNewTabAnimation(Collections.singletonList(url), M_INITIALIZE_TAB_LINK);
}, 100);
}
public void onOpenTabViewBoundary(View view){
@ -1115,21 +1130,22 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mSearchbar.requestFocus();
mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor()));
mSearchbar.selectAll();
mHomeViewController.initSearchBarFocus(true);
mHomeViewController.initSearchBarFocus(true, isKeyboardOpened);
}
if(status.sSettingIsAppStarted && mAppRestarted){
onUpdateStatusBarTheme();
activityContextManager.getInstance().onClearStack();
tabRowModel model = (tabRowModel)dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_CURRENT_TAB, null);
if(model==null || !mGeckoClient.getSession().getSessionID().equals(model.getSession().getSessionID())){
if(model==null){
onInitDefaultTab();
}else {
onLoadTab(model.getSession(), false);
onLoadTab(model.getSession(), false,true);
}
}
}
if(mAppBar!=null){
mAppBar.setExpanded(true,true);
mHomeViewController.expandTopBar();
mAppBar.refreshDrawableState();
mAppBar.invalidate();
@ -1151,6 +1167,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
}
initWidget();
super.onResume();
}
@ -1260,7 +1277,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(model!=null){
if(mTabFragment.getVisibility()!=View.VISIBLE){
onLoadTab(model.getSession(),true);
onLoadTab(model.getSession(),true, true);
}
return true;
}
@ -1535,7 +1552,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
else if(e_type.equals(enums.etype.M_HOME_PAGE)){
geckoSession mSession = (geckoSession)dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_HOME_PAGE, null);
if(mSession!=null){
onLoadTab(mSession, false);
onLoadTab(mSession, false,true);
}
return dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_HOME_PAGE, null);
}
@ -1575,7 +1592,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(mHintListView!=null && mHintListView.getAdapter()!=null && mHintListView.getAdapter().getItemCount()>0){
mHomeViewController.onUpdateSearchEngineBar(false, 150);
}
mHomeViewController.initSearchBarFocus(false);
mHomeViewController.initSearchBarFocus(false, isKeyboardOpened);
if(!mGeckoClient.isLoading()){
org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP19:",(String)mGeckoClient.getSession().getCurrentURL());
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, false);
@ -1607,7 +1624,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
{
if(e_type.equals(enums.etype.ON_EXPAND_TOP_BAR)){
mAppBar.setExpanded(true,true);
mHomeViewController.expandTopBar();
}
else if(e_type.equals(enums.etype.M_ON_BANNER_UPDATE)){
Object mAdvertResponse = pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED);
@ -1670,7 +1687,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
initLocalLanguage();
mHomeViewController.onPageFinished();
mGeckoClient.onRedrawPixel();
org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log.i("SUPPPP12:",(String)data.get(0));
mHomeViewController.onUpdateSearchBar(dataToStr(data.get(0),mGeckoClient.getSession().getCurrentURL()),false,true, false);
}
else if(e_type.equals(enums.etype.search_update)){
@ -1704,7 +1720,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
else if(e_type.equals(enums.etype.on_close_sesson)){
if(!onCloseCurrentTab(mGeckoClient.getSession())){
postNewTabAnimation(true,false);
postNewTabAnimation(true,true);
}
}
else if(e_type.equals(enums.etype.on_playstore_load)){

View File

@ -48,7 +48,6 @@ import com.darkweb.genesissearchengine.widget.progressBar.AnimatedProgressBar;
import com.example.myapplication.R;
import com.google.android.gms.ads.AdView;
import org.mozilla.geckoview.GeckoView;
import org.mozilla.thirdparty.com.google.android.exoplayer2.util.Log;
import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.util.ArrayList;
import java.util.Arrays;
@ -170,6 +169,7 @@ class homeViewController
}, 1500);
updateBannerAdvertStatus(false, false);
expandTopBar();
}
public void initTopBarPadding(){
@ -206,7 +206,7 @@ class homeViewController
mPopupLoadNewTab.animate().setDuration(350).alpha(1);
final Handler handler = new Handler();
handler.postDelayed(this::onHideLoadTabDialog, 2000);
handler.postDelayed(this::onHideLoadTabDialog, 2500);
}
public void onHideLoadTabDialog() {
@ -275,7 +275,7 @@ class homeViewController
}
@SuppressLint("UseCompatLoadingForDrawables")
public void initSearchBarFocus(boolean pStatus){
public void initSearchBarFocus(boolean pStatus, boolean mIsKeyboardOpened){
if(!pStatus){
this.mVoiceInput.animate().setDuration(0).alpha(0).withEndAction(() -> {
@ -322,11 +322,13 @@ class homeViewController
params.rightMargin = helperMethod.pxFromDp(17);
}
if(!mIsKeyboardOpened){
mSearchbar.requestFocus();
InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mSearchbar, InputMethodManager.SHOW_IMPLICIT);
}
}
}
void initTab(int count){
mNewTab.animate().cancel();
@ -357,7 +359,7 @@ class homeViewController
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
@ -560,12 +562,19 @@ class homeViewController
}
private void triggerPostUI(){
mAppBar.setExpanded(true,true);
expandTopBar();
if(mProgressBar.getProgress()>0 && mProgressBar.getProgress()<10000){
mProgressBar.animate().setStartDelay(0).alpha(1);
}
}
public void expandTopBar(){
Object mTag = mAppBar.getTag(R.id.expandableBar);
if(mTag!=null && (boolean) mTag){
mAppBar.setExpanded(true,true);
}
}
/*-------------------------------------------------------Helper Methods-------------------------------------------------------*/
void onOpenMenu(View view, boolean canGoForward, boolean isLoading, int userAgent){
@ -745,7 +754,7 @@ class homeViewController
public void onUpdateStatusBarTheme(String pTheme, boolean mForced)
{
if(mSplashScreen.getAlpha()<=0 && status.sTheme != enums.Theme.THEME_DARK){
if(mSplashScreen.getAlpha()<=0 && (status.sTheme != enums.Theme.THEME_DARK && status.sDefaultNightMode)){
int mColor = -1;
try{
mColor = Color.parseColor(pTheme);
@ -826,7 +835,7 @@ class homeViewController
mVoiceInput.setColorFilter(ContextCompat.getColor(mContext, R.color.c_navigation_tint));
mSearchbar.setTextColor(ContextCompat.getColor(mContext, R.color.c_text_v1));
if(status.sTheme == enums.Theme.THEME_DARK){
if(status.sTheme != enums.Theme.THEME_DARK && !status.sDefaultNightMode){
View decorView = mContext.getWindow().getDecorView();
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}else {
@ -919,7 +928,6 @@ class homeViewController
void onNewTab(){
mSearchbar.requestFocus();
mSearchbar.selectAll();
((InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
}
void onUpdateLogs(String log){
@ -1054,7 +1062,7 @@ class homeViewController
initTopBarPadding();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if(status.sTheme == enums.Theme.THEME_DARK){
if(status.sTheme == enums.Theme.THEME_DARK || status.sDefaultNightMode){
mContext.getWindow().getDecorView().setSystemUiVisibility(0);
}else {
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

View File

@ -36,7 +36,7 @@ class landingViewController
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_text_v3));
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));
}
else {
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue));

View File

@ -71,7 +71,7 @@ public class orbotLogAdapter extends RecyclerView.Adapter<orbotLogAdapter.listVi
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://google.com/search?q=tor logs " + mHeader.getText()));
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://duckduckgo.com/?q=tor logs " + mHeader.getText()));
intent.putExtra(SearchManager.QUERY, mDescription.getText());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activityContextManager.getInstance().getHomeController().startActivity(intent);

View File

@ -25,6 +25,9 @@ import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R;
import org.mozilla.geckoview.ContentBlocking;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@ -150,7 +153,7 @@ public class settingClearController extends AppCompatActivity {
pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_DATA_CLEARED);
if(mHomeInvoked){
activityContextManager.getInstance().getHomeController().onReDrawGeckoview();
activityContextManager.getInstance().getHomeController().initializeGeckoView(true, true);
activityContextManager.getInstance().getHomeController().onHomeButton(null);
}
}
@ -169,7 +172,7 @@ public class settingClearController extends AppCompatActivity {
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TRACKING_PROTECTION,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
@ -185,8 +188,9 @@ public class settingClearController extends AppCompatActivity {
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true));
}
/* LOCAL OVERRIDES */

View File

@ -187,6 +187,25 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
return mSelectedList.size();
}
private void onRemoveRowCross(int mIndex){
for(int mCounter=0;mCounter<mSelectedList.size();mCounter++){
if(mSelectedList.get(mCounter).equals(mModelList.get(mIndex).getmId())){
mSelectedList.remove(mCounter);
break;
}
}
mModelList.remove(mIndex);
if(mModelList.size()!=1){
notifyItemRemoved(mIndex);
notifyItemChanged(mModelList.size()-1);
notifyItemRangeChanged(mIndex, mModelList.size());
}
mEvent.invokeObserver(Collections.singletonList(mIndex), tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW);
mEvent.invokeObserver(null, tabEnums.eTabAdapterCallback.ON_SHOW_UNDO_DIALOG);
}
/*View Holder Extensions*/
class listViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener
{
@ -275,7 +294,6 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
mLoadSession.setOnClickListener(this);
}
try{
mItemSelectionMenuReference.animate().cancel();
if(this.getLayoutPosition()==mModelList.size()-1){
if(mSelectedList.size()>0){
@ -292,9 +310,6 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
mLongPressMenuEnabled = false;
mItemSelectionMenuButton.animate().setDuration(250).alpha(1);
}
}catch (Exception ex){
ex.printStackTrace();
}
}
@ -331,26 +346,7 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
v.setEnabled(false);
v.setFocusableInTouchMode(false);
v.setClickable(false);
for(int mCounter=0;mCounter<mSelectedList.size();mCounter++){
if(mSelectedList.get(mCounter).equals(mModelList.get(this.getLayoutPosition()).getmId())){
mSelectedList.remove(mCounter);
break;
}
}
mModelList.remove(this.getLayoutPosition());
notifyItemRemoved(this.getLayoutPosition());
notifyItemChanged(mModelList.size()-1);
notifyItemRangeChanged(this.getLayoutPosition(), mModelList.size());
if(mModelList.size()==1){
mModelList.remove(this.getLayoutPosition());
notifyItemRemoved(this.getLayoutPosition());
notifyItemChanged(mModelList.size()-1);
notifyItemRangeChanged(this.getLayoutPosition(), mModelList.size());
}
mEvent.invokeObserver(Collections.singletonList(this.getLayoutPosition()), tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW);
mEvent.invokeObserver(null, tabEnums.eTabAdapterCallback.ON_SHOW_UNDO_DIALOG);
onRemoveRowCross(this.getLayoutPosition());
}
else if(v.getId() == R.id.pItemSelectionMenuButton){
onEnableLongClickMenu();
@ -397,6 +393,8 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
return getSelectionSize();
}else if(pCommands.equals(tabEnums.eTabAdapterCommands.REMOVE_ALL)){
onRemoveAll();
}else if(pCommands.equals(tabEnums.eTabAdapterCommands.REMOVE_ROW_CROSSED)){
onRemoveRowCross((int)pData.get(0));
}
return null;
}

View File

@ -2,9 +2,8 @@ package com.darkweb.genesissearchengine.appManager.tabManager;
import android.annotation.SuppressLint;
import android.graphics.Canvas;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.util.Log;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@ -12,7 +11,6 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
@ -23,6 +21,8 @@ import androidx.recyclerview.widget.SimpleItemAnimator;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingHomeController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
@ -55,7 +55,6 @@ public class tabController extends Fragment
private tabViewController mtabViewController;
private RecyclerView mRecycleView;
private tabAdapter mTabAdapter;
private ColorDrawable mBackground;
/*Initializations*/
@ -90,7 +89,6 @@ public class tabController extends Fragment
}
public void initializeViews(){
mBackground = new ColorDrawable();
mRecycleView = mRootView.findViewById(R.id.pRecycleView);
mTabs = mRootView.findViewById(R.id.pTabs);
mRemoveSelection = mRootView.findViewById(R.id.pRemoveSelection);
@ -128,7 +126,7 @@ public class tabController extends Fragment
mRecycleView.setDrawingCacheEnabled(true);
mRecycleView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
mRecycleView.setLayoutManager(new LinearLayoutManager(this.getContext()));
initTabCount();
initTabCount(0);
}
/*Listeners*/
@ -171,6 +169,15 @@ public class tabController extends Fragment
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.NOTIFY_SWIPE, Collections.singletonList(position));
}
onShowUndoDialog();
final Handler handler = new Handler();
handler.postDelayed(() ->
{
ViewGroup.LayoutParams params = mRecycleView.getLayoutParams();
params.height = helperMethod.pxFromDp((mTabAdapter.getItemCount()) * 90);
mRecycleView.setLayoutParams(params);
}, 400);
}
@Override
@ -193,18 +200,19 @@ public class tabController extends Fragment
public void onRemoveTab(int pIndex){
mListModel.onTrigger(tabEnums.eModelCallback.M_REMOVE_TAB,Collections.singletonList(pIndex));
if(mListModel.getList().size()<1){
mRecycleView.animate().setStartDelay(250).alpha(0);
mRecycleView.animate().setDuration(350).alpha(0);
}
initTabCount();
initTabCount(400);
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.INIT_FIRST_ROW, null);
}
public boolean onInitRemoveView(int pIndex, boolean pCreateBackup){
mListModel.onTrigger(tabEnums.eModelCallback.M_REMOVE_TAB,Collections.singletonList(pIndex));
mListModel.getList().remove(pIndex);
initTabCount();
if(mListModel.getList().size()<1){
mRecycleView.animate().setStartDelay(250).alpha(0).withEndAction(() -> mTabAdapter.notifyDataSetChanged());
mRecycleView.animate().setDuration(350).alpha(0).withEndAction(() -> {
mTabAdapter.notifyDataSetChanged();
});
return false;
}else{
mTabAdapter.notifyItemRangeChanged(pIndex, mTabAdapter.getItemCount() - pIndex);
@ -212,26 +220,33 @@ public class tabController extends Fragment
}
}
public void initTabCount()
public void initTabCount(int pDelay)
{
mtabViewController.onTrigger(tabEnums.eTabViewCommands.INIT_TAB_COUNT, Collections.singletonList(mListModel.getList().size()));
final Handler handler = new Handler();
handler.postDelayed(() ->
{
if(mListModel.getList().size()>0){
ViewGroup.LayoutParams params = mRecycleView.getLayoutParams();
params.height = helperMethod.pxFromDp(mTabAdapter.getItemCount() * 90);
params.height = helperMethod.pxFromDp((mTabAdapter.getItemCount()) * 90);
mRecycleView.setLayoutParams(params);
}
}, pDelay);
}
public void onClose(){
onClearTabBackup();
}
public void onNewTabInvoked(){
mHomeController.onBackPressed();
int mBackupList = ((ArrayList<tabRowModel>)mListModel.onTrigger(tabEnums.eModelCallback.M_GET_BACKUP,null)).size();
if(mListModel.getList().size()-mBackupList>=1){
mHomeController.onNewTabBackground(true,false);
}
onClose();
mHomeController.onBackPressed();
}
public void onRestoreTab(View view){
@ -242,13 +257,13 @@ public class tabController extends Fragment
initializeList();
mRecycleView.animate().cancel();
mRecycleView.setVisibility(View.VISIBLE);
mRecycleView.animate().setDuration(250).alpha(1);
mRecycleView.animate().setDuration(350).alpha(1);
}
ArrayList<tabRowModel> mBackup = (ArrayList<tabRowModel>)mListModel.onTrigger(tabEnums.eModelCallback.M_LOAD_BACKUP,null);
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.REINIT_DATA, Collections.singletonList(mBackup));
mListModel.onTrigger(tabEnums.eModelCallback.M_CLEAR_BACKUP_RETAIN_DATABASE,null);
initTabCount();
initTabCount(400);
}
public void onShowUndoDialog(){
@ -286,7 +301,7 @@ public class tabController extends Fragment
public void onRemoveSelection(View view) {
int mSelectionSize = (int)mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.GET_SELECTION_SIZE,null);
if(mSelectionSize >= mListModel.getList().size()){
mRecycleView.animate().setStartDelay(250).alpha(0).withEndAction(() -> {
mRecycleView.animate().setDuration(350).alpha(0).withEndAction(() -> {
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.M_REMOVE_ALL_SELECTION, null);
onShowUndoDialog();
});
@ -318,14 +333,14 @@ public class tabController extends Fragment
onNewTabInvoked();
}
else if(pView.getId() == R.id.pCloseTab){
mRecycleView.animate().setDuration(250).alpha(0).withEndAction(() -> {
mRecycleView.animate().setDuration(350).alpha(0).withEndAction(() -> {
onClearTabBackup();
mTabAdapter.onTrigger(tabEnums.eTabAdapterCommands.REMOVE_ALL, null);
initTabCount();
initTabCount(400);
});
}
else if(pView.getId() == R.id.pOpenSetting){
// helperMethod.openActivity(settingHomeController.class, constants.CONST_LIST_HISTORY, this,true);
helperMethod.openActivity(settingHomeController.class, constants.CONST_LIST_HISTORY, activityContextManager.getInstance().getHomeController(),true);
}
mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_DISMISS_MENU, null);
}
@ -383,16 +398,17 @@ public class tabController extends Fragment
onRemoveTab((Integer) data.get(0));
}
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_INIT_TAB_COUNT)){
initTabCount();
initTabCount(400);
}
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_BACK_PRESSED)){
onBackPressed();
}
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_LOAD_TAB)){
mHomeController.onLoadTab((geckoSession)data.get(0),(boolean)data.get(1));
mHomeController.onLoadTab((geckoSession)data.get(0),(boolean)data.get(1),true);
}
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW)){
onInitRemoveView((Integer) data.get(0), true);
initTabCount(400);
}
else if(e_type.equals(tabEnums.eTabAdapterCallback.ON_REMOVE_TAB_VIEW_RETAIN_BACKUP)){
onInitRemoveView((Integer) data.get(0), false);

View File

@ -8,7 +8,7 @@ public class tabEnums
}
public enum eTabAdapterCommands {
M_SELECTION_MENU_SHOWING, M_REMOVE_ALL_SELECTION, M_CLEAR_ALL_SELECTION, ENABLE_LONG_CLICK_MENU, INIT_FIRST_ROW, REINIT_DATA, NOTIFY_SWIPE, GET_SELECTION_SIZE, REMOVE_ALL
M_SELECTION_MENU_SHOWING, M_REMOVE_ALL_SELECTION, M_CLEAR_ALL_SELECTION, ENABLE_LONG_CLICK_MENU, INIT_FIRST_ROW, REINIT_DATA, NOTIFY_SWIPE, GET_SELECTION_SIZE, REMOVE_ALL, REMOVE_ROW_CROSSED
}
public enum eTabAdapterCallback {

View File

@ -85,6 +85,8 @@ class tabViewController
mMenuButton.setAlpha(0f);
mMenuButton.animate().setStartDelay(200).setDuration(350).alpha(1);
mMenuButton.setVisibility(View.VISIBLE);
onHideUndoDialogInit();
}
public void initExitUI(){
@ -180,6 +182,13 @@ class tabViewController
mToastLayoutRoot.animate().alpha(0).withEndAction(() -> mToastLayoutRoot.setVisibility(View.GONE));
}
private void onHideUndoDialogInit() {
mToastLayoutRoot.animate().cancel();
mToastLayoutRoot.setAlpha(0);
mToastLayoutRoot.setVisibility(View.GONE);
}
private void onDrawSwipableBackground(Canvas pCanvas, RecyclerView.ViewHolder pViewHolder, float pDX, int pActionState) {
Bitmap icon;
@ -194,18 +203,18 @@ class tabViewController
if(pDX > 0){
if(status.sTheme == enums.Theme.THEME_DARK){
pCanvas.drawARGB(255, 59, 57, 70);
pCanvas.drawARGB(150, 59, 57, 70);
}else {
pCanvas.drawARGB(255, 230, 230, 230);
pCanvas.drawARGB(150, 230, 230, 230);
}
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
RectF icon_dest = new RectF((float) itemView.getLeft() + width ,(float) itemView.getTop() + width,(float) itemView.getLeft()+ 2*width,(float)itemView.getBottom() - width);
pCanvas.drawBitmap(icon,null,icon_dest, mPainter);
} else {
if(status.sTheme == enums.Theme.THEME_DARK){
pCanvas.drawARGB(255, 59, 57, 70);
pCanvas.drawARGB(150, 59, 57, 70);
}else {
pCanvas.drawARGB(255, 230, 230, 230);
pCanvas.drawARGB(150, 230, 230, 230);
}
icon = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.dustbin);
RectF icon_dest = new RectF((float) itemView.getRight() - 2*width ,(float) itemView.getTop() + width,(float) itemView.getRight() - width,(float)itemView.getBottom() - width);

View File

@ -19,6 +19,12 @@ public class enums
public static final int THEME_DEFAULT = 2;
}
public static class WidgetResponse {
public static final int NONE = 0;
public static final int VOICE = 1;
public static final int SEARCHBAR = 2;
}
public static class ImageQueueStatus {
public static final int M_IMAGE_LOADING = 0;
public static final int M_IMAGE_LOADED_SUCCESSFULLY = 1;

View File

@ -57,6 +57,7 @@ public class status
public static int sTheme = enums.Theme.THEME_DEFAULT;
public static int sSettingCookieStatus = ContentBlocking.AntiTracking.DEFAULT;
public static int sShowImages = -1;
public static int sWidgetResponse = enums.WidgetResponse.NONE;
/*Bridge Status*/

View File

@ -68,7 +68,7 @@ class tabDataModel
params[2] = mTabModel.getSession().getTheme();
String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime());
databaseController.getInstance().execSQL("INSERT INTO tab(mid,date,title,url,theme) VALUES('"+ mTabModel.getmId() +"','" + m_date + "',?,?,?);",params);
databaseController.getInstance().execSQL("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabModel.getmId() +"','" + m_date + "',?,?,?);",params);
}
}
@ -77,12 +77,13 @@ class tabDataModel
for(int counter = 0; counter< size; counter++){
if(mTabs.size()>0){
mTabs.get(0).getSession().stop();
mTabs.get(0).getSession().closeSession();
mTabs.get(0).getSession().close();
mTabs.remove(0);
}
}
if(mTabs.size()>0){
mTabs.get(0).getSession().closeSession();
mTabs.get(0).getSession().close();
mTabs.remove(0);
}
databaseController.getInstance().execSQL("DELETE FROM tab WHERE 1",null);
@ -90,11 +91,15 @@ class tabDataModel
}
void closeTab(geckoSession mSession,Object pID) {
mSession.stop();
mSession.close();
if(pID == null){
String mID = strings.GENERIC_EMPTY_STR;
for(int counter = 0; counter< mTabs.size(); counter++){
if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID()))
{
mTabs.get(counter).getSession().stop();
mTabs.get(counter).getSession().close();
mTabs.remove(counter);
mID = mTabs.get(counter).getmId();
break;
@ -105,6 +110,8 @@ class tabDataModel
for(int counter = 0; counter< mTabs.size(); counter++){
if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID()))
{
mTabs.get(counter).getSession().stop();
mTabs.get(counter).getSession().close();
mTabs.remove(counter);
break;
}

View File

@ -0,0 +1,120 @@
package com.darkweb.genesissearchengine.helperManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
public class theme {
private boolean mLocalThemeChanged;
private static theme ourInstance = new theme();
int mode = -1;
public static theme getInstance()
{
return ourInstance;
}
public void onConfigurationChanged(AppCompatActivity pContext){
boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if(status.sDefaultNightMode != sDefaultNightMode){
setupThemeLocal(pContext, sDefaultNightMode);
pContext.recreate();
}
}
public void setupThemeLocal(Context context, boolean sDefaultNightMode) {
Resources res = context.getResources();
mode = res.getConfiguration().uiMode;
if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
mLocalThemeChanged = true;
}
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
mLocalThemeChanged = true;
}
}else {
if(!sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
mLocalThemeChanged = true;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
mLocalThemeChanged = true;
}
}
}
}
public Context setupTheme(Context context) {
Resources res = context.getResources();
if(mode==-1){
mode = res.getConfiguration().uiMode;
if(status.sTheme == enums.Theme.THEME_DARK){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(!status.sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO;
}
}else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES;
}
}
}
}
Configuration config = new Configuration(res.getConfiguration());
config.uiMode = mode;
context = context.createConfigurationContext(config);
return context;
}
public Context initTheme(Context pContext){
boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
boolean sDefaultNightModeCurrent = (pContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if(status.sSettingIsAppStarted){
status.mThemeApplying = true;
}
status.sDefaultNightMode = sDefaultNightMode;
pContext = setupTheme(pContext);
mLocalThemeChanged = false;
mode = -1;
return pContext;
}
}

View File

@ -1,5 +1,7 @@
package com.darkweb.genesissearchengine.pluginManager;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
@ -211,7 +213,7 @@ public class pluginController
mContextManager.getHistoryController().onclearData();
mHomeController.onClearSession();
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
mHomeController.initTab(false);
mHomeController.initTab(true);
}
else if(pEventType.equals(M_CLEAR_BOOKMARK)){
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,pData);

View File

@ -0,0 +1,112 @@
package com.widget.search;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.RemoteViews;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.example.myapplication.R;
public class searchWidgetManager extends AppWidgetProvider {
private static final String SHARED_PREF_FILE = "com.example.android.appwidgetsample";
private static final String COUNT_KEY = "count";
private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) {
SharedPreferences prefs = context.getSharedPreferences(SHARED_PREF_FILE, 0);
int count = prefs.getInt(COUNT_KEY + appWidgetId, 0);
count++;
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller);
SharedPreferences.Editor prefEditor = prefs.edit();
prefEditor.putInt(COUNT_KEY + appWidgetId, count);
prefEditor.apply();
int[] idArray = new int[]{appWidgetId};
Intent intentUpdate = new Intent(context, searchWidgetManager.class);
intentUpdate.setAction("mOpenApplication");
intentUpdate.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, idArray);
PendingIntent pendingUpdate = PendingIntent.getBroadcast(context, appWidgetId, intentUpdate, PendingIntent.FLAG_UPDATE_CURRENT);
Intent mintentUpdate = new Intent(context, searchWidgetManager.class);
mintentUpdate.setAction("mOpenVoice");
mintentUpdate.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, idArray);
PendingIntent mpintentUpdate = PendingIntent.getBroadcast(context, appWidgetId, mintentUpdate, PendingIntent.FLAG_UPDATE_CURRENT);
views.setOnClickPendingIntent(R.id.pSearchLogo, pendingUpdate);
views.setOnClickPendingIntent(R.id.pTopBarContainer, pendingUpdate);
views.setOnClickPendingIntent(R.id.pSearchInput, pendingUpdate);
views.setOnClickPendingIntent(R.id.pVoiceInput, mpintentUpdate);
appWidgetManager.updateAppWidget(appWidgetId, views);
}
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(action.equals("mOpenApplication")){
status.sWidgetResponse = enums.WidgetResponse.SEARCHBAR;
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage("com.darkweb.genesissearchengine");
launchIntent.putExtra("mOpenApplication",true);
context.startActivity(launchIntent);
}
else if(action.equals("mOpenVoice")){
status.sWidgetResponse = enums.WidgetResponse.VOICE;
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage("com.darkweb.genesissearchengine");
launchIntent.putExtra("mOpenApplication",true);
context.startActivity(launchIntent);
}
else if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)) {
Bundle extras = intent.getExtras();
if (extras != null) {
int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (appWidgetIds != null && appWidgetIds.length > 0) {
this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds);
}
}
} else if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) {
Bundle extras = intent.getExtras();
if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
this.onDeleted(context, new int[] { appWidgetId });
}
} else if (AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED.equals(action)) {
Bundle extras = intent.getExtras();
if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)
&& extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) {
int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS);
this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context),
appWidgetId, widgetExtras);
}
} else if (AppWidgetManager.ACTION_APPWIDGET_ENABLED.equals(action)) {
this.onEnabled(context);
} else if (AppWidgetManager.ACTION_APPWIDGET_DISABLED.equals(action)) {
this.onDisabled(context);
} else if (AppWidgetManager.ACTION_APPWIDGET_RESTORED.equals(action)) {
Bundle extras = intent.getExtras();
if (extras != null) {
int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS);
int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (oldIds != null && oldIds.length > 0) {
this.onRestored(context, oldIds, newIds);
this.onUpdate(context, AppWidgetManager.getInstance(context), newIds);
}
}
}
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
for (int appWidgetId : appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId);
}
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/holo_gray">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/holo_gray" />
<corners android:radius="5.5dp" />
</shape>
</item>
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#264d73"
android:startColor="#264d73"
android:type="linear" />
<corners android:radius="5.5dp" />
</shape>
</item>
</ripple>

View File

@ -4,10 +4,10 @@
<shape android:shape="rectangle">
<solid android:color="@color/c_button_text_v2" />
<corners
android:bottomLeftRadius="0dp"
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp"/>
android:topLeftRadius="4dp"
android:topRightRadius="4dp"/>
</shape>
</item>
</ripple>

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -3,6 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginBottom="20dp"
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@ -13,9 +13,9 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/pMainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="60dp"
android:layout_marginBottom="25dp"
android:background="@xml/ax_background_inverted"
android:background="@xml/ax_load_new_tab"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
@ -25,16 +25,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="25dp"
android:alpha="0.6"
android:alpha="0.8"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:text="@string/ALERT_OPEN_NEW_TAB"
android:textAlignment="textStart"
android:textStyle="bold"
android:textColor="@color/c_alert_text_inverted"
android:textSize="14sp"
app:layout_constraintStart_toStartOf="parent"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/pMainLayout"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="SmallSp" />
@ -47,8 +47,8 @@
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@xml/ax_ripple_default_round_right"
android:padding="0dp"
android:onClick="onLoadRecentTab"
android:padding="0dp"
android:text="@string/ALERT_OPEN_NEW_TAB_LOAD"
android:textAllCaps="false"
android:textColor="@color/c_button_text_v1_inverted"
@ -60,19 +60,30 @@
<ImageView
android:id="@+id/pBlockerUndo"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="55dp"
android:clickable="true"
android:contentDescription="@string/GENERAL_TODO"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_height="55dp"
android:translationZ="211dp"
android:contentDescription="@string/GENERAL_TODO"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/pMainLayout" />
<View
android:id="@+id/view4"
android:layout_width="1dp"
android:layout_height="30dp"
android:layout_marginEnd="20dp"
android:background="#3973ac"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/pUndo"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -13,7 +13,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/pMainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="60dp"
android:layout_marginBottom="25dp"
android:background="@xml/ax_background_inverted"
app:layout_constraintBottom_toBottomOf="parent"
@ -25,16 +25,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="25dp"
android:alpha="0.6"
android:alpha="0.8"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:text="@string/ALERT_UNDO_TAB_REMOVE_INFO"
android:textAlignment="textStart"
android:textStyle="bold"
android:textColor="@color/c_alert_text_inverted"
android:textSize="14sp"
app:layout_constraintStart_toStartOf="parent"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/pMainLayout"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="SmallSp" />
@ -47,8 +47,8 @@
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@xml/ax_ripple_default_round_right"
android:onClick="onRestoreTab"
android:padding="0dp"
android:onClick="onLoadRecentTab"
android:text="@string/ALERT_UNDO_TAB_REMOVE_BUTTON"
android:textAllCaps="false"
android:textColor="@color/c_button_text_v1_inverted"
@ -60,19 +60,29 @@
<ImageView
android:id="@+id/pBlockerUndo"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="55dp"
android:clickable="true"
android:contentDescription="@string/GENERAL_TODO"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_height="55dp"
android:translationZ="211dp"
android:contentDescription="@string/GENERAL_TODO"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/pMainLayout" />
<View
android:id="@+id/view6"
android:layout_width="1dp"
android:layout_height="30dp"
android:layout_marginEnd="20dp"
android:background="@color/c_border_background_divider"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/pUndo"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -55,7 +55,7 @@
android:textSize="17sp"
android:textStyle="bold" />
<EditText
<com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager
android:id="@+id/pSearchInput"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -55,7 +55,7 @@
android:textSize="17sp"
android:textStyle="bold" />
<EditText
<com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager
android:id="@+id/pSearchInput"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>

View File

@ -63,7 +63,7 @@
tools:ignore="RtlHardcoded,UselessParent">
<ImageButton
android:id="@+id/pSearchLock"
android:id="@+id/pSearchLogo"
android:layout_width="31dp"
android:layout_height="31dp"
android:layout_gravity="center_vertical"
@ -765,6 +765,7 @@
android:id="@+id/pPopupLoadNewTab"
layout="@layout/popup_load_new_tab"
android:translationZ="5dp"
android:alpha="0"
android:visibility="gone" />
<androidx.fragment.app.FragmentContainerView

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -0,0 +1,89 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/widget_margin"
android:theme="@style/ThemeOverlay.GenesisAndroid.AppWidgetContainer">
<LinearLayout
android:id="@+id/pTopBarContainer"
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:minWidth="187dp"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_height="49dp"
android:animateLayoutChanges="true"
android:gravity="start"
android:orientation="horizontal"
tools:ignore="UselessParent">
<ImageButton
android:id="@+id/pSearchLogo"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="5dp"
android:background="@xml/gx_ripple_default_round"
android:contentDescription="@string/GENERAL_TODO"
android:padding="6dp"
android:scaleType="fitCenter"
android:src="@drawable/genesis"
android:translationZ="10dp"/>
<TextView
android:id="@+id/pSearchInput"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="-56dp"
android:layout_gravity="center_vertical"
android:paddingTop="13dp"
android:layout_marginEnd="1dp"
android:animateLayoutChanges="true"
android:background="@xml/gx_generic_input_white"
android:fontFamily="sans-serif"
android:completionHintView="@layout/hint_view"
android:dropDownAnchor="@id/pSearchEngineBar"
android:ems="10"
android:fadingEdgeLength="20dp"
android:focusableInTouchMode="true"
android:hint="@string/GENERAL_HIDDEN_WEB"
android:importantForAutofill="no"
android:inputType="textNoSuggestions"
android:maxLines="1"
android:paddingStart="70dp"
android:paddingEnd="15dp"
android:popupElevation="0dp"
android:privateImeOptions="nm"
android:requiresFadingEdge="horizontal"
android:selectAllOnFocus="true"
android:textColor="@color/c_text_v1"
android:textColorHighlight="@color/text_color_highlight_v3"
android:textColorHint="#737373"
android:textCursorDrawable="@xml/gx_search_cursor_state"
android:textIsSelectable="false"
android:textSize="15sp">
</TextView>
<ImageButton
android:id="@+id/pVoiceInput"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="-48dp"
android:layout_marginTop="-1dp"
android:layout_marginEnd="-5dp"
android:background="@color/white"
android:contentDescription="@string/GENERAL_TODO"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:scaleX="1.1"
android:scaleY="1.1"
android:src="@xml/ic_baseline_keyboard_voice"
android:tint="@color/c_navigation_tint"
android:visibility="visible" />
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,7 @@
<resources>
<style name="ThemeOverlay.GenesisAndroid.AppWidgetContainer" parent="">
<item name="appWidgetBackgroundColor">@color/light_blue_900</item>
<item name="appWidgetTextColor">@color/light_blue_200</item>
</style>
</resources>

View File

@ -0,0 +1,6 @@
<resources>
<declare-styleable name="AppWidgetAttrs">
<attr name="appWidgetBackgroundColor" format="color" />
<attr name="appWidgetTextColor" format="color" />
</declare-styleable>
</resources>

View File

@ -0,0 +1,6 @@
<resources>
<color name="light_blue_50">#FFE1F5FE</color>
<color name="light_blue_200">#FF81D4FA</color>
<color name="light_blue_600">#FF039BE5</color>
<color name="light_blue_900">#FF01579B</color>
</resources>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Refer to App Widget Documentation for margin information
http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
-->
<dimen name="widget_margin">0dp</dimen>
</resources>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="appwidget_text">EXAMPLE</string>
<string name="add_widget">Add widget</string>
</resources>

View File

@ -0,0 +1,7 @@
<resources>
<style name="ThemeOverlay.GenesisAndroid.AppWidgetContainer" parent="">
<item name="appWidgetBackgroundColor">@color/light_blue_600</item>
<item name="appWidgetTextColor">@color/light_blue_50</item>
</style>
</resources>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialKeyguardLayout="@layout/widget_search_controller"
android:initialLayout="@layout/widget_search_controller"
android:minWidth="100dp"
android:previewImage="@drawable/widget_ref"
android:resizeMode="horizontal"
android:updatePeriodMillis="86400000"
android:widgetCategory="home_screen">
</appwidget-provider>

View File

@ -131,8 +131,6 @@
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:background="@xml/sx_border_left"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -148,8 +146,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="13dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginEnd="0dp"
android:layout_marginStart="5dp"
android:background="@xml/gx_ripple_gray"
android:onClick="onTracking"
android:orientation="vertical">
@ -162,6 +160,7 @@
android:buttonTint="@color/c_radio_tint"
android:textColor="@color/c_text_v1"
android:layout_marginEnd="10dp"
android:layout_marginStart="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textSize="15sp"
@ -190,8 +189,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="13dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginEnd="0dp"
android:layout_marginStart="5dp"
android:background="@xml/gx_ripple_gray"
android:onClick="onTracking"
android:orientation="vertical">
@ -203,6 +202,7 @@
android:clickable="false"
android:buttonTint="@color/c_radio_tint"
android:textColor="@color/c_text_v1"
android:layout_marginStart="20dp"
android:layout_marginEnd="10dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
@ -232,8 +232,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="13dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginEnd="0dp"
android:layout_marginStart="5dp"
android:background="@xml/gx_ripple_gray"
android:onClick="onTracking"
android:orientation="vertical">
@ -246,6 +246,7 @@
android:buttonTint="@color/c_radio_tint"
android:textColor="@color/c_text_v1"
android:layout_marginEnd="10dp"
android:layout_marginStart="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:textSize="15sp"

View File

@ -165,12 +165,23 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/pEmptyView"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="65dp"
android:gravity="center"
android:text="@string/HOME_TAB_EMPTY"
android:textColor="@color/c_text_v2"
android:textSize="15sp"
android:textStyle="bold"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/pRecycleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/c_background"
android:layout_marginTop="66dp"
android:layout_marginTop="-150dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/pHeaderContainer">
@ -181,19 +192,6 @@
</androidx.core.widget.NestedScrollView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="65dp"
android:text="@string/HOME_TAB_EMPTY"
android:textSize="15sp"
android:translationZ="1dp"
android:textStyle="bold"
android:textColor="@color/c_text_v2"
app:layout_constraintEnd_toEndOf="@+id/pHeaderContainer"
app:layout_constraintStart_toStartOf="@+id/pHeaderContainer"
app:layout_constraintTop_toBottomOf="@+id/pHeaderContainer" />
<include
android:id="@+id/pPopupUndo"
layout="@layout/popup_undo"

View File

@ -117,7 +117,7 @@
<color name="white">#ffffff</color>
<color name="dark_red">#910808</color>
<color name="dark_red_soft">#f32323</color>
<color name="dark_red_soft">#f76e6e</color>
<color name="green">#33cc33</color>
<color name="green_button">#00802b</color>
<color name="green_dark">#212d45</color>

View File

@ -3,7 +3,7 @@
<color name="c_background">#ffffff</color>
<color name="c_background_alpha">#501c1b21</color>
<color name="c_background_keyboard">#999999</color>
<color name="c_background_inverted">#1c1b21</color>
<color name="c_background_inverted">#302e38</color>
<color name="c_view_divier_background_inner">#ebebeb</color>
<color name="c_view_divier_background_inner_v1">#e6e6e6</color>
<color name="c_view_divier_background">#e6e6e6</color>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="expandableBar" type="id" />
</resources>

View File

@ -16,6 +16,7 @@
<string name="GENERAL_INTERNET_ERROR_MESSAGE" translatable="true">These might be the problems you are facing \n\n• Webpage or Website might be down \n• Your Internet connection might be poor \n• You might be using a proxy \n• Website might be blocked by firewall</string>
<string name="GENERAL_FILE_PROVIDER_AUTHORITY" translatable="false">com.darkweb.genesissearchengine.fileprovider</string>
<string name="GENERAL_DEFAULT_HINT_SUGGESTION" translatable="true">BBC | Israel Strikes Again</string>
<string name="GENERAL_HIDDEN_WEB" translatable="false">Search the web ...</string>
<!-- Settings -->
<string name="SETTING_DEFAULT_LANGUAGE" translatable="false">ru</string>

View File

@ -58,7 +58,7 @@ dependencies {
implementation 'androidx.core:core:1.3.2'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
testImplementation 'junit:junit:4.13.1'
testImplementation 'junit:junit:4.13.2'
implementation 'com.offbynull.portmapper:portmapper:2.0.5'

View File

@ -8,12 +8,14 @@
package org.torproject.android.service;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.Application;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.app.TaskStackBuilder;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.ContentValues;
@ -77,6 +79,7 @@ import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Random;
import java.util.StringTokenizer;
@ -244,7 +247,6 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
@SuppressLint("NewApi")
protected void showToolbarNotification(String notifyMsg, int notifyType, int icon) {
if(orbotLocalConstants.mHomeContext ==null){
return;
}
@ -252,7 +254,6 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
PackageManager pm = getPackageManager();
Intent mIntent = orbotLocalConstants.mHomeIntent;
mIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendIntent = PendingIntent.getActivity(orbotLocalConstants.mHomeContext.get(), 0, mIntent, PendingIntent.FLAG_UPDATE_CURRENT);
if (mNotifyBuilder == null) {
@ -264,7 +265,35 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
.setColor(Color.parseColor("#84989f"))
.setSmallIcon(R.drawable.ic_stat_tor_logo);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final List<ActivityManager.AppTask> recentTaskInfos = activityManager.getAppTasks();
if (!recentTaskInfos.isEmpty()) {
for (ActivityManager.AppTask appTaskTaskInfo: recentTaskInfos) {
if (appTaskTaskInfo.getTaskInfo().baseIntent.getComponent().getPackageName().equals("com.darkweb.genesissearchengine")) {
Intent resultIntent = null;
try
{
Class mClass = Class.forName("com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController"); //without the .class
resultIntent = new Intent(this, mClass);
resultIntent.setAction("android.intent.action.MAIN");
resultIntent.addCategory("android.intent.category.LAUNCHER");
PendingIntent resultPendingIntent = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mNotifyBuilder.setContentIntent(resultPendingIntent);
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
}
}
}
}else {
PendingIntent pendIntent = PendingIntent.getActivity(orbotLocalConstants.mHomeContext.get(), 0, mIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mNotifyBuilder.setContentIntent(pendIntent);
}
}
@ -276,9 +305,36 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
Intent intentRefresh = new Intent();
intentRefresh.setAction(CMD_NEWNYM);
PendingIntent pendingIntentNewNym = PendingIntent.getBroadcast(orbotLocalConstants.mHomeContext.get(), 0, intentRefresh, PendingIntent.FLAG_ONE_SHOT);
mNotifyBuilder.addAction(R.drawable.ic_refresh_white_24dp, getString(R.string.menu_new_identity),
pendingIntentNewNym);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final List<ActivityManager.AppTask> recentTaskInfos = activityManager.getAppTasks();
if (!recentTaskInfos.isEmpty()) {
for (ActivityManager.AppTask appTaskTaskInfo: recentTaskInfos) {
if (appTaskTaskInfo.getTaskInfo().baseIntent.getComponent().getPackageName().equals("com.darkweb.genesissearchengine")) {
Intent resultIntent = null;
try
{
Class mClass = Class.forName("com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController"); //without the .class
resultIntent = new Intent(this, mClass);
resultIntent.setAction("android.intent.action.MAIN");
resultIntent.addCategory("android.intent.category.LAUNCHER");
PendingIntent resultPendingIntent = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mNotifyBuilder.setContentIntent(resultPendingIntent);
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
}
}
}
}else {
PendingIntent pendIntent = PendingIntent.getActivity(orbotLocalConstants.mHomeContext.get(), 0, mIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mNotifyBuilder.setContentIntent(pendIntent);
}
mNotifyBuilder.setOngoing(Prefs.persistNotifications());