diff --git a/app/build.gradle b/app/build.gradle index fcf84f8d..56a66eeb 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/genesissearchwidget/ExampleInstrumentedTest.kt old mode 100755 new mode 100644 similarity index 100% rename from app/src/androidTest/java/com/example/myapplication/ExampleInstrumentedTest.kt rename to app/src/androidTest/java/com/example/genesissearchwidget/ExampleInstrumentedTest.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a9215354..f8001fe8 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,7 @@ + @@ -11,8 +12,7 @@ - - + - + + + + + + + + diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java index 9d7a72a8..4da066f3 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/bookmarkManager/bookmarkAdapter.java @@ -64,12 +64,6 @@ public class bookmarkAdapter extends RecyclerView.Adapter pModelList){ - notifyDataSetChanged(); - initializeModelWithDate(false); - } - - private void initializeModelWithDate(boolean pFilterEnabled){ int m_real_counter=0; @@ -140,10 +134,20 @@ public class bookmarkAdapter extends RecyclerView.Adapter{ 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 data, Object e_type) { + + if(e_type.equals(enums.etype.ON_KEYBOARD_CLOSE)){ + onHideSearch(null); + onClearMultipleSelection(null); + } + return null; + } + } /*Event Observer*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java index e54129c4..1f1f5a52 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/externalNavigationManager/externalNavigationController.java @@ -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); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java index fb42857a..d4f2b37c 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/historyManager/historyAdapter.java @@ -69,7 +69,7 @@ public class historyAdapter extends RecyclerView.Adapter pModelList){ - notifyDataSetChanged(); + //notifyDataSetChanged(); initializeModelWithDate(false); } @@ -157,7 +157,7 @@ public class historyAdapter extends RecyclerView.Adapter 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{ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java index 01537514..e3f22d72 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java @@ -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); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java index 0627ebfe..d760810e 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java @@ -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 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){ - mRenderedBitmap = mGeckoView.capturePixels(); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, pImageView, mGeckoView, 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)){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java index 6a21f4cd..25a0e6c1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java @@ -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,9 +322,11 @@ class homeViewController params.rightMargin = helperMethod.pxFromDp(17); } - mSearchbar.requestFocus(); - InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE); - imm.showSoftInput(mSearchbar, InputMethodManager.SHOW_IMPLICIT); + if(!mIsKeyboardOpened){ + mSearchbar.requestFocus(); + InputMethodManager imm = (InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.showSoftInput(mSearchbar, InputMethodManager.SHOW_IMPLICIT); + } } } @@ -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); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java index c2ebb64c..8e313763 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/landingManager/landingViewController.java @@ -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)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java index a2c08318..bca37541 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/orbotLogManager/orbotLogAdapter.java @@ -71,7 +71,7 @@ public class orbotLogAdapter extends RecyclerView.Adapter return mSelectedList.size(); } + private void onRemoveRowCross(int mIndex){ + for(int mCounter=0;mCounter mLoadSession.setOnClickListener(this); } - try{ - mItemSelectionMenuReference.animate().cancel(); - if(this.getLayoutPosition()==mModelList.size()-1){ - if(mSelectedList.size()>0){ - itemView.setVisibility(View.GONE); - mLongPressMenuEnabled = true; - }else { - itemView.setVisibility(View.VISIBLE); - mLongPressMenuEnabled = false; - mItemSelectionMenuButton.animate().cancel(); - mItemSelectionMenuButton.animate().setDuration(250).alpha(1); - } + mItemSelectionMenuReference.animate().cancel(); + if(this.getLayoutPosition()==mModelList.size()-1){ + if(mSelectedList.size()>0){ + itemView.setVisibility(View.GONE); + mLongPressMenuEnabled = true; }else { itemView.setVisibility(View.VISIBLE); mLongPressMenuEnabled = false; + mItemSelectionMenuButton.animate().cancel(); mItemSelectionMenuButton.animate().setDuration(250).alpha(1); } - }catch (Exception ex){ - ex.printStackTrace(); + }else { + itemView.setVisibility(View.VISIBLE); + mLongPressMenuEnabled = false; + mItemSelectionMenuButton.animate().setDuration(250).alpha(1); } } @@ -331,26 +346,7 @@ public class tabAdapter extends RecyclerView.Adapter v.setEnabled(false); v.setFocusableInTouchMode(false); v.setClickable(false); - for(int mCounter=0;mCounter 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; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java index b98221a7..0f77ec64 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabController.java @@ -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,13 +220,20 @@ 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())); - ViewGroup.LayoutParams params = mRecycleView.getLayoutParams(); - params.height = helperMethod.pxFromDp(mTabAdapter.getItemCount() * 90); - mRecycleView.setLayoutParams(params); + final Handler handler = new Handler(); + handler.postDelayed(() -> + { + if(mListModel.getList().size()>0){ + ViewGroup.LayoutParams params = mRecycleView.getLayoutParams(); + params.height = helperMethod.pxFromDp((mTabAdapter.getItemCount()) * 90); + mRecycleView.setLayoutParams(params); + } + }, pDelay); + } public void onClose(){ @@ -226,12 +241,12 @@ public class tabController extends Fragment } public void onNewTabInvoked(){ - mHomeController.onBackPressed(); int mBackupList = ((ArrayList)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 mBackup = (ArrayList)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); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java index fd82c8fe..3bf65263 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabEnums.java @@ -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 { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java index edded7eb..691a5770 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabViewController.java @@ -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); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java index 40b68f85..fad2c6dc 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -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; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java index 1a811014..5cd19980 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/status.java @@ -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*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java index 7ffbf3dd..9e8c08a9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java @@ -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; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/theme.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/theme.java new file mode 100644 index 00000000..4d1b6557 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/theme.java @@ -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; + } + +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java index 44f57ad4..19c485ac 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/pluginController.java @@ -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); diff --git a/app/src/main/java/com/widget/search/searchWidgetManager.java b/app/src/main/java/com/widget/search/searchWidgetManager.java new file mode 100644 index 00000000..c831d823 --- /dev/null +++ b/app/src/main/java/com/widget/search/searchWidgetManager.java @@ -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); + } + } +} \ No newline at end of file diff --git a/app/src/main/res/custom-xml/alert/xml/ax_load_new_tab.xml b/app/src/main/res/custom-xml/alert/xml/ax_load_new_tab.xml new file mode 100644 index 00000000..f96a98d5 --- /dev/null +++ b/app/src/main/res/custom-xml/alert/xml/ax_load_new_tab.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_right.xml b/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_right.xml index e399ab35..111ed5e4 100644 --- a/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_right.xml +++ b/app/src/main/res/custom-xml/alert/xml/ax_ripple_default_round_right.xml @@ -4,10 +4,10 @@ + android:topLeftRadius="4dp" + android:topRightRadius="4dp"/> \ No newline at end of file diff --git a/app/src/main/res/custom-xml/generic/xml/gx_generic_input_white.xml b/app/src/main/res/custom-xml/generic/xml/gx_generic_input_white.xml new file mode 100644 index 00000000..9cfc70ea --- /dev/null +++ b/app/src/main/res/custom-xml/generic/xml/gx_generic_input_white.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable-hdpi/widget_ref.png b/app/src/main/res/drawable-hdpi/widget_ref.png new file mode 100644 index 00000000..ac55eb09 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/widget_ref.png differ diff --git a/app/src/main/res/layouts/alert/layout/popup_data_cleared.xml b/app/src/main/res/layouts/alert/layout/popup_data_cleared.xml index a7ad1fad..70b10830 100644 --- a/app/src/main/res/layouts/alert/layout/popup_data_cleared.xml +++ b/app/src/main/res/layouts/alert/layout/popup_data_cleared.xml @@ -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"> diff --git a/app/src/main/res/layouts/alert/layout/popup_load_new_tab.xml b/app/src/main/res/layouts/alert/layout/popup_load_new_tab.xml index 51a262c9..61e97ceb 100644 --- a/app/src/main/res/layouts/alert/layout/popup_load_new_tab.xml +++ b/app/src/main/res/layouts/alert/layout/popup_load_new_tab.xml @@ -13,9 +13,9 @@ @@ -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 @@ + + + diff --git a/app/src/main/res/layouts/alert/layout/popup_undo.xml b/app/src/main/res/layouts/alert/layout/popup_undo.xml index d5b23791..0e94c748 100644 --- a/app/src/main/res/layouts/alert/layout/popup_undo.xml +++ b/app/src/main/res/layouts/alert/layout/popup_undo.xml @@ -13,7 +13,7 @@ @@ -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 @@ + + diff --git a/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml b/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml index c2a11708..0a9b214c 100644 --- a/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml +++ b/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml @@ -55,7 +55,7 @@ android:textSize="17sp" android:textStyle="bold" /> - - - \ No newline at end of file diff --git a/app/src/main/res/layouts/home/layout/home_view.xml b/app/src/main/res/layouts/home/layout/home_view.xml index 43fc7db5..fcb73d9f 100644 --- a/app/src/main/res/layouts/home/layout/home_view.xml +++ b/app/src/main/res/layouts/home/layout/home_view.xml @@ -63,7 +63,7 @@ tools:ignore="RtlHardcoded,UselessParent"> + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/searchWidget/values-night/themes.xml b/app/src/main/res/layouts/searchWidget/values-night/themes.xml new file mode 100644 index 00000000..69c78ba9 --- /dev/null +++ b/app/src/main/res/layouts/searchWidget/values-night/themes.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/searchWidget/values/attrs.xml b/app/src/main/res/layouts/searchWidget/values/attrs.xml new file mode 100644 index 00000000..97531a25 --- /dev/null +++ b/app/src/main/res/layouts/searchWidget/values/attrs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/searchWidget/values/colors.xml b/app/src/main/res/layouts/searchWidget/values/colors.xml new file mode 100644 index 00000000..b2bffa8d --- /dev/null +++ b/app/src/main/res/layouts/searchWidget/values/colors.xml @@ -0,0 +1,6 @@ + + #FFE1F5FE + #FF81D4FA + #FF039BE5 + #FF01579B + \ No newline at end of file diff --git a/app/src/main/res/layouts/searchWidget/values/dimens.xml b/app/src/main/res/layouts/searchWidget/values/dimens.xml new file mode 100644 index 00000000..4db8c590 --- /dev/null +++ b/app/src/main/res/layouts/searchWidget/values/dimens.xml @@ -0,0 +1,10 @@ + + + + + 0dp + + \ No newline at end of file diff --git a/app/src/main/res/layouts/searchWidget/values/strings.xml b/app/src/main/res/layouts/searchWidget/values/strings.xml new file mode 100644 index 00000000..1311c6a2 --- /dev/null +++ b/app/src/main/res/layouts/searchWidget/values/strings.xml @@ -0,0 +1,5 @@ + + + EXAMPLE + Add widget + \ No newline at end of file diff --git a/app/src/main/res/layouts/searchWidget/values/themes.xml b/app/src/main/res/layouts/searchWidget/values/themes.xml new file mode 100644 index 00000000..854d9a92 --- /dev/null +++ b/app/src/main/res/layouts/searchWidget/values/themes.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/searchWidget/xml/search_widget_manager_info.xml b/app/src/main/res/layouts/searchWidget/xml/search_widget_manager_info.xml new file mode 100644 index 00000000..bacde119 --- /dev/null +++ b/app/src/main/res/layouts/searchWidget/xml/search_widget_manager_info.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/setting/layout/setting_tracking_view.xml b/app/src/main/res/layouts/setting/layout/setting_tracking_view.xml index 76b29e78..0d90838f 100644 --- a/app/src/main/res/layouts/setting/layout/setting_tracking_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_tracking_view.xml @@ -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" diff --git a/app/src/main/res/layouts/tab/layout/tab_view.xml b/app/src/main/res/layouts/tab/layout/tab_view.xml index 92911b9f..5dd0617d 100644 --- a/app/src/main/res/layouts/tab/layout/tab_view.xml +++ b/app/src/main/res/layouts/tab/layout/tab_view.xml @@ -165,12 +165,23 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> + + @@ -181,19 +192,6 @@ - - #ffffff #910808 - #f32323 + #f76e6e #33cc33 #00802b #212d45 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 4f2223d9..76b16fe4 100755 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -3,7 +3,7 @@ #ffffff #501c1b21 #999999 - #1c1b21 + #302e38 #ebebeb #e6e6e6 #e6e6e6 diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml new file mode 100644 index 00000000..f3a7d305 --- /dev/null +++ b/app/src/main/res/values/ids.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ec97d562..02a11fff 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,6 +16,7 @@ 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 com.darkweb.genesissearchengine.fileprovider BBC | Israel Strikes Again + Search the web ... ru diff --git a/app/src/test/java/com/example/myapplication/ExampleUnitTest.kt b/app/src/test/java/com/example/genesissearchwidget/ExampleUnitTest.kt old mode 100755 new mode 100644 similarity index 100% rename from app/src/test/java/com/example/myapplication/ExampleUnitTest.kt rename to app/src/test/java/com/example/genesissearchwidget/ExampleUnitTest.kt diff --git a/orbotservice/build.gradle b/orbotservice/build.gradle index e881f448..18a16caf 100755 --- a/orbotservice/build.gradle +++ b/orbotservice/build.gradle @@ -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' diff --git a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java index f8d9963a..e4d43521 100644 --- a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java +++ b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java @@ -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); - mNotifyBuilder.setContentIntent(pendIntent); + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) { + final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); + final List 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 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());