Bug Fixes

Bug Fixes
master
Abdul Mannan 2022-04-03 17:15:23 +05:00
parent 2792fc6d62
commit 45afa3153c
12 changed files with 179 additions and 63 deletions

View File

@ -62,8 +62,8 @@
<entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml" value="0.16875" /> <entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/bookmark/layout/bookmark_view.xml" value="0.16875" />
<entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/history/layout/activity_adview_controller.xml" value="0.9" /> <entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/history/layout/activity_adview_controller.xml" value="0.9" />
<entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/history/layout/history_view.xml" value="0.22083333333333333" /> <entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/history/layout/history_view.xml" value="0.22083333333333333" />
<entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/home/layout/home_view.xml" value="0.22" /> <entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/home/layout/home_view.xml" value="0.33" />
<entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/home/layout/popup_search_view.xml" value="0.2" /> <entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/home/layout/popup_search_view.xml" value="0.1" />
<entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/orbot/layout/orbot_settings_view.xml" value="0.33" /> <entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/orbot/layout/orbot_settings_view.xml" value="0.33" />
<entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/orbotLog/layout/orbot_log_view.xml" value="0.33" /> <entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/orbotLog/layout/orbot_log_view.xml" value="0.33" />
<entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/proxyStatus/layout/proxy_status_view.xml" value="0.20260416666666667" /> <entry key="..\:/Workspace/Genesis-Android/app/src/main/res/layouts/proxyStatus/layout/proxy_status_view.xml" value="0.20260416666666667" />

View File

@ -69,20 +69,24 @@ public class geckoClients
mSession = (geckoSession) geckoView.getSession(); mSession = (geckoSession) geckoView.getSession();
} }
else { else {
if(geckoView.getSession()!=null){
//geckoView.releaseSession();
}
mSession = new geckoSession(new geckoViewClientCallback(),mSessionID,context, geckoView); mSession = new geckoSession(new geckoViewClientCallback(),mSessionID,context, geckoView);
//mSession.open(mRuntime);
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mSession.getSettings().setFullAccessibilityTree(true); mSession.getSettings().setFullAccessibilityTree(true);
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
//geckoView.setSession(mSession); if(geckoView.getSession()!=null){
geckoView.releaseSession();
mSession.open(mRuntime);
geckoView.setSession(mSession);
onUpdateFont();
}else if(status.sSettingIsAppStarted){
mSession.open(mRuntime);
geckoView.setSession(mSession);
onUpdateFont();
}
} }
mSession.onSetInitializeFromStartup(); mSession.onSetInitializeFromStartup();
//onUpdateFont();
} }
public void postInitRuntime(GeckoView geckoView, AppCompatActivity context){ public void postInitRuntime(GeckoView geckoView, AppCompatActivity context){
@ -313,8 +317,10 @@ public class geckoClients
} }
public void onLoadFavIcon(AppCompatActivity pcontext){ public void onLoadFavIcon(AppCompatActivity pcontext){
BrowserIconManager mIconManager = new BrowserIconManager(); if(mRuntime!=null){
mIconManager.onLoadIcon(pcontext.getApplicationContext(), mRuntime); BrowserIconManager mIconManager = new BrowserIconManager();
mIconManager.onLoadIcon(pcontext.getApplicationContext(), mRuntime);
}
} }
private int getCookiesBehaviour(){ private int getCookiesBehaviour(){
@ -356,6 +362,7 @@ public class geckoClients
} }
public void resetSession(){ public void resetSession(){
mSession.onStopMedia();
mSessionID = strings.GENERIC_EMPTY_STR; mSessionID = strings.GENERIC_EMPTY_STR;
} }
@ -371,6 +378,7 @@ public class geckoClients
public void initSession(geckoSession mSession){ public void initSession(geckoSession mSession){
mSessionID = mSession.getSessionID(); mSessionID = mSession.getSessionID();
this.mSession.onStopMedia();
this.mSession = mSession; this.mSession = mSession;
} }

View File

@ -120,7 +120,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
public boolean mCloseRequested = false; public boolean mCloseRequested = false;
public boolean mOnBackPressed = false; public boolean mOnBackPressed = false;
public SessionState mSessionState; public SessionState mSessionState;
MediaSession.Delegate mMediaSession; MediaSession mMediaSession = null;
geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){ geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){
@ -150,12 +150,14 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
@Override @Override
public void onActivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) { public void onActivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onActivated(session, mediaSession); MediaSession.Delegate.super.onActivated(session, mediaSession);
mMediaSession = mediaSession;
} }
@Override @Override
public void onDeactivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) { public void onDeactivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onDeactivated(session, mediaSession); MediaSession.Delegate.super.onDeactivated(session, mediaSession);
isMediaRunning = false; isMediaRunning = false;
mMediaSession = null;
} }
@Override @Override
@ -239,8 +241,8 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
} }
public void onStopMedia(){ public void onStopMedia(){
if(isMediaRunning){ if(isMediaRunning && mMediaSession!=null){
close(); mMediaSession.stop();
} }
} }

View File

@ -5,6 +5,8 @@ import android.app.ActivityManager;
import android.app.DownloadManager; import android.app.DownloadManager;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.ComponentCallbacks2; import android.content.ComponentCallbacks2;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
@ -46,7 +48,6 @@ import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.FragmentContainerView; import androidx.fragment.app.FragmentContainerView;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.applovin.mediation.ads.MaxAdView; import com.applovin.mediation.ads.MaxAdView;
import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkSettings.bookmarkSettingController; import com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkSettings.bookmarkSettingController;
@ -79,7 +80,6 @@ import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums; import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
import com.widget.onionservices.widgetManager.widgetController; import com.widget.onionservices.widgetManager.widgetController;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;
import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoSession;
@ -96,9 +96,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import mozilla.components.support.utils.DownloadUtils; import mozilla.components.support.utils.DownloadUtils;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
import static androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode; import static androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode;
@ -181,6 +179,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private CoordinatorLayout mCoordinatorLayout; private CoordinatorLayout mCoordinatorLayout;
private ImageView mImageDivider; private ImageView mImageDivider;
private ImageButton mPopoupFindCopy; private ImageButton mPopoupFindCopy;
private ImageButton mPopoupFindPaste;
/*Redirection Objects*/ /*Redirection Objects*/
private GeckoResult<Bitmap> mRenderedBitmap = null; private GeckoResult<Bitmap> mRenderedBitmap = null;
@ -197,8 +196,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private String mSearchBarPreviousText = strings.GENERIC_EMPTY_STR; private String mSearchBarPreviousText = strings.GENERIC_EMPTY_STR;
private Handler mScrollHandler = null; private Handler mScrollHandler = null;
private Runnable mScrollRunnable = null; private Runnable mScrollRunnable = null;
private String clipboard = "";
private int mResponseRequestCode = 10112; private int mResponseRequestCode = 10112;
private boolean msearchstatuscopy = false;
/*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/ /*-------------------------------------------------------INITIALIZATION-------------------------------------------------------*/
@ -509,6 +510,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mPanicButtonLandscape = findViewById(R.id.pPanicButtonLandscape); mPanicButtonLandscape = findViewById(R.id.pPanicButtonLandscape);
mGenesisLogo = findViewById(R.id.pGenesisLogo); mGenesisLogo = findViewById(R.id.pGenesisLogo);
mPopoupFindCopy = findViewById(R.id.pPopoupFindCopy); mPopoupFindCopy = findViewById(R.id.pPopoupFindCopy);
mPopoupFindPaste = findViewById(R.id.pPopoupFindPaste);
mGeckoView.setSaveEnabled(false); mGeckoView.setSaveEnabled(false);
mGeckoView.setSaveFromParentEnabled(false); mGeckoView.setSaveFromParentEnabled(false);
@ -998,12 +1000,25 @@ public class homeController extends AppCompatActivity implements ComponentCallba
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if(mSearchbar.getText().length()==0){ if(msearchstatuscopy){
mPopoupFindCopy.setEnabled(false); if(mSearchbar.getText().length()==0){
mPopoupFindCopy.setAlpha(0.2f); mPopoupFindCopy.setVisibility(View.GONE);
}else { }else {
mPopoupFindCopy.setEnabled(true); mPopoupFindCopy.setVisibility(View.VISIBLE);
mPopoupFindCopy.setAlpha(1f); mPopoupFindCopy.setAlpha(1f);
mPopoupFindCopy.setEnabled(true);
}
if(mSearchbar.getText().toString().equals(clipboard) || clipboard.length()<=0){
mPopoupFindPaste.setVisibility(View.GONE);
if(mPopoupFindCopy.getVisibility() == View.GONE){
mPopoupFindCopy.setVisibility(View.VISIBLE);
mPopoupFindCopy.setEnabled(false);
mPopoupFindCopy.setAlpha(0.2f);
}
}else {
mPopoupFindPaste.setVisibility(View.VISIBLE);
}
} }
} }
@ -1020,6 +1035,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
status.sUIInteracted = true; status.sUIInteracted = true;
if(!hasFocus) if(!hasFocus)
{ {
msearchstatuscopy = false;
mWasEdittextChanged = false; mWasEdittextChanged = false;
mSearchBarWasBackButtonPressed = true; mSearchBarWasBackButtonPressed = true;
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
@ -1043,6 +1059,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
mSearchbar.setSelection(0); mSearchbar.setSelection(0);
}else { }else {
msearchstatuscopy = true;
mSearchBarWasBackButtonPressed = false; mSearchBarWasBackButtonPressed = false;
if(!isFocusChanging){ if(!isFocusChanging){
if(!status.mThemeApplying){ if(!status.mThemeApplying){
@ -1467,7 +1484,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onUpdateFindBar(false); mHomeViewController.onUpdateFindBar(false);
mHomeViewController.onClearSelections(isKeyboardOpened); mHomeViewController.onClearSelections(isKeyboardOpened);
mTopBarContainer.getLayoutTransition().setDuration(0); mTopBarContainer.getLayoutTransition().setDuration(0);
mSearchbar.clearFocus(); mSearchbar.clearFocus();
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,false, true); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,false, true);
@ -1791,10 +1807,27 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void onCopySearch(View view){ public void onCopySearch(View view){
if(mSearchBarPreviousText.length()==0){ if(mSearchBarPreviousText.length()==0){
helperMethod.copyURL(mSearchbar.getText().toString(),this); helperMethod.copyURL(mSearchbar.getText().toString(),this);
clipboard = mSearchbar.getText().toString();
}else { }else {
helperMethod.copyURL(mSearchBarPreviousText,this); helperMethod.copyURL(mSearchBarPreviousText,this);
clipboard = mSearchBarPreviousText;
} }
helperMethod.showToastMessage("copied to clipboard", this); helperMethod.showToastMessage("copied to clipboard", this);
if(mSearchbar.getText().toString().length()>0 || mSearchbar.getText().toString().equals(clipboard) || clipboard.length()<=0){
mPopoupFindPaste.setVisibility(View.GONE);
}else {
mPopoupFindPaste.setVisibility(View.VISIBLE);
}
}
public void onCopyPaste(View view){
ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData pasteData = manager.getPrimaryClip();
ClipData.Item item = pasteData.getItemAt(0);
String paste = item.getText().toString();
mSearchbar.setText(paste);
mSearchbar.selectAll();
} }
public void onFindNext(View view){ public void onFindNext(View view){
@ -2329,6 +2362,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onUpdateSearchEngineBar(false, 150); mHomeViewController.onUpdateSearchEngineBar(false, 150);
((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter();
} }
msearchstatuscopy = false;
mHomeViewController.initSearchBarFocus(false, isKeyboardOpened); mHomeViewController.initSearchBarFocus(false, isKeyboardOpened);
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true);
helperMethod.hideKeyboard(homeController.this); helperMethod.hideKeyboard(homeController.this);

View File

@ -43,7 +43,6 @@ import androidx.fragment.app.FragmentContainerView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.applovin.mediation.ads.MaxAdView; import com.applovin.mediation.ads.MaxAdView;
import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.constants.*; import com.hiddenservices.onionservices.constants.*;
import com.hiddenservices.onionservices.dataManager.dataController; import com.hiddenservices.onionservices.dataManager.dataController;
import com.hiddenservices.onionservices.dataManager.dataEnums; import com.hiddenservices.onionservices.dataManager.dataEnums;
@ -118,6 +117,7 @@ class homeViewController
private boolean isFullScreen = false; private boolean isFullScreen = false;
private MovementMethod mSearchBarMovementMethod = null; private MovementMethod mSearchBarMovementMethod = null;
private boolean mIsTopBarExpanded = true; private boolean mIsTopBarExpanded = true;
private NestedScrollView.MarginLayoutParams mDefaultMargin = null;
void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, MaxAdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo, ImageButton pPanicButtonLandscape){ void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, MaxAdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo, ImageButton pPanicButtonLandscape){
this.mContext = context; this.mContext = context;
@ -225,6 +225,8 @@ class homeViewController
} }
params1.setMargins(0, 0, 0,(helperMethod.pxFromDp(60)+mBannerHeight)*-1); params1.setMargins(0, 0, 0,(helperMethod.pxFromDp(60)+mBannerHeight)*-1);
mNestedScroll.setLayoutParams(params1); mNestedScroll.setLayoutParams(params1);
} }
public void initSearchEngineView(){ public void initSearchEngineView(){
@ -259,6 +261,9 @@ class homeViewController
return; return;
} }
if(!status.sFullScreenBrowsing){ if(!status.sFullScreenBrowsing){
//View child = mAppBar.getChildAt(0);
//AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams();
//params.setMargins(0, 0, 0,helperMethod.pxFromDp(0));
}else { }else {
int paddingDp = 0; int paddingDp = 0;
if(isFullScreen){ if(isFullScreen){
@ -525,7 +530,7 @@ class homeViewController
}); });
animator.start(); animator.start();
}else { }else {
mSplashScreen.animate().alpha(0).setDuration(200).setStartDelay(mDelay).withEndAction(() -> onPostScreenDisable()); mSplashScreen.animate().alpha(0).setDuration(200).setStartDelay(mDelay).withEndAction(() -> onPostScreenDisable());
} }
} }
@ -880,12 +885,12 @@ class homeViewController
} }
if(!canGoForward){ if(!canGoForward){
back.setEnabled(false); back.setEnabled(false);
back.setColorFilter(Color.argb(255, 191, 191, 191)); back.setColorFilter(Color.argb(255, 191, 191, 191));
} }
if(!isLoading){ if(!isLoading){
close.setVisibility(View.GONE); close.setVisibility(View.GONE);
mRefresh.setVisibility(View.VISIBLE); mRefresh.setVisibility(View.VISIBLE);
}else { }else {
close.setVisibility(View.VISIBLE); close.setVisibility(View.VISIBLE);
mRefresh.setVisibility(View.GONE); mRefresh.setVisibility(View.GONE);
@ -997,11 +1002,11 @@ class homeViewController
void removeBanner(){ void removeBanner(){
if(!isFullScreen){ if(!isFullScreen){
if(isLandscape){ if(isLandscape){
mBannerAds.setVisibility(View.GONE); mBannerAds.setVisibility(View.GONE);
}else { }else {
mEvent.invokeObserver(null, enums.etype.M_ON_BANNER_UPDATE); mEvent.invokeObserver(null, enums.etype.M_ON_BANNER_UPDATE);
} }
onFullScreen(false); onFullScreen(false);
} }
} }
@ -1499,6 +1504,7 @@ class homeViewController
private int mDefaultColor = 0; private int mDefaultColor = 0;
private int mBannerHeight = 0; private int mBannerHeight = 0;
private boolean mFullScreenBrowsingTemp = false;
void onFullScreenUpdate(boolean pStatus){ void onFullScreenUpdate(boolean pStatus){
int value = !pStatus ? 1 : 0; int value = !pStatus ? 1 : 0;
@ -1508,12 +1514,18 @@ class homeViewController
mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.black)); mContext.getWindow().setStatusBarColor(mContext.getResources().getColor(R.color.black));
if(pStatus){ if(pStatus){
mDefaultMargin = (NestedScrollView.MarginLayoutParams) mNestedScroll.getLayoutParams();
mDefaultColor = mContext.getWindow().getNavigationBarColor(); mDefaultColor = mContext.getWindow().getNavigationBarColor();
mContext.getWindow().setNavigationBarColor(Color.BLACK); mContext.getWindow().setNavigationBarColor(Color.BLACK);
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
NestedScrollView.MarginLayoutParams params = (NestedScrollView.MarginLayoutParams) mNestedScroll.getLayoutParams();
mFullScreenBrowsingTemp = true;
status.sFullScreenBrowsing = false;
onFullScreen(false);
final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
@ -1522,9 +1534,7 @@ class homeViewController
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
mContext.getWindow().getDecorView().setSystemUiVisibility(flags); mContext.getWindow().getDecorView().setSystemUiVisibility(flags);
mContext.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); mContext.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
mBannerAds.setVisibility(View.GONE);
NestedScrollView.MarginLayoutParams params = (NestedScrollView.MarginLayoutParams) mNestedScroll.getLayoutParams();
params.setMargins(0, 0, 0,0); params.setMargins(0, 0, 0,0);
mNestedScroll.setLayoutParams(params); mNestedScroll.setLayoutParams(params);
@ -1548,8 +1558,6 @@ class homeViewController
mGeckoView.setLayoutParams(new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT)); mGeckoView.setLayoutParams(new ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT));
initTopBarPadding();
this.mBlockerFullSceen.animate().setStartDelay(250).setDuration(200).alpha(0).withEndAction(() -> { this.mBlockerFullSceen.animate().setStartDelay(250).setDuration(200).alpha(0).withEndAction(() -> {
mBlockerFullSceen.setVisibility(View.GONE); mBlockerFullSceen.setVisibility(View.GONE);
}); });
@ -1558,12 +1566,12 @@ class homeViewController
if(isLandscape){ if(isLandscape){
params.setMargins(0, 0, 0,-helperMethod.pxFromDp(120)); params.setMargins(0, 0, 0,-helperMethod.pxFromDp(120));
}else { }else {
if(mBannerAds.getHeight()>0){ if(mBannerAds.getHeight()>0 && mBannerAds.getVisibility()==View.VISIBLE){
Object mAdvertLoaded = mEvent.invokeObserver(null, enums.etype.M_ADVERT_LOADED); Object mAdvertLoaded = mEvent.invokeObserver(null, enums.etype.M_ADVERT_LOADED);
if(mAdvertLoaded!=null && (boolean)mAdvertLoaded){ if(mAdvertLoaded!=null && (boolean)mAdvertLoaded){
params.setMargins(0, 0, 0,-helperMethod.pxFromDp(35) - helperMethod.pxFromDp(mBannerAds.getHeight())); params.setMargins(0, 0, 0,-helperMethod.pxFromDp(170));
}else { }else {
params.setMargins(0, 0, 0,-helperMethod.pxFromDp(70) - helperMethod.pxFromDp(mBannerAds.getHeight())); params.setMargins(0, 0, 0,-helperMethod.pxFromDp(120));
} }
}else { }else {
params.setMargins(0, 0, 0,-helperMethod.pxFromDp(120)); params.setMargins(0, 0, 0,-helperMethod.pxFromDp(120));
@ -1573,21 +1581,21 @@ class homeViewController
if(isLandscape){ if(isLandscape){
params.setMargins(0, 0, 0,-helperMethod.pxFromDp(60)); params.setMargins(0, 0, 0,-helperMethod.pxFromDp(60));
}else { }else {
if(mBannerAds.getHeight()>0){ if(mBannerAds.getHeight()>0 && mBannerAds.getVisibility()==View.VISIBLE){
params.setMargins(0, 0, 0,-helperMethod.pxFromDp(120)); params.setMargins(0, 0, 0,-helperMethod.pxFromDp(120));
}else { }else {
params.setMargins(0, 0, 0,-helperMethod.pxFromDp(0)); params.setMargins(0, 0, 0,-helperMethod.pxFromDp(120));
} }
} }
} }
status.sFullScreenBrowsing = false;
mNestedScroll.setLayoutParams(params); mNestedScroll.setLayoutParams(params);
mBannerAds.setVisibility(View.GONE);
initTopBarPadding();
}, 200); }, 200);
}else { }else {
mFullScreenBrowsingTemp = false;
NestedScrollView.MarginLayoutParams params = (NestedScrollView.MarginLayoutParams) mNestedScroll.getLayoutParams(); NestedScrollView.MarginLayoutParams params = (NestedScrollView.MarginLayoutParams) mNestedScroll.getLayoutParams();
params.setMargins(0, 0, 0,helperMethod.pxFromDp(60)*-1); params.setMargins(0, 0, 0,helperMethod.pxFromDp(60)*-1);
mNestedScroll.setLayoutParams(params); mNestedScroll.setLayoutParams(params);
@ -1610,6 +1618,7 @@ class homeViewController
status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,false)); status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,false));
params.setMargins(mDefaultMargin.leftMargin,mDefaultMargin.topMargin,mDefaultMargin.rightMargin,mDefaultMargin.bottomMargin);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if(status.sTheme == enums.Theme.THEME_DARK || status.sDefaultNightMode){ if(status.sTheme == enums.Theme.THEME_DARK || status.sDefaultNightMode){
mContext.getWindow().getDecorView().setSystemUiVisibility(0); mContext.getWindow().getDecorView().setSystemUiVisibility(0);
@ -1621,7 +1630,7 @@ class homeViewController
} }
mContext.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); mContext.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
initTopBarPadding(); //initTopBarPadding();
mIsTopBarExpanded = false; mIsTopBarExpanded = false;
mAppBar.setExpanded(true,false); mAppBar.setExpanded(true,false);
@ -1644,11 +1653,18 @@ class homeViewController
} }
if(status.sFullScreenBrowsing){ if(status.sFullScreenBrowsing){
int orientation = mContext.getResources().getConfiguration().orientation; if(!mFullScreenBrowsingTemp){
if (orientation == Configuration.ORIENTATION_LANDSCAPE) { View child = mAppBar.getChildAt(0);
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60 + 60)); AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) child.getLayoutParams();
} else { if(isLandscape){
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(110)); mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60));
}else {
if(mBannerAds.getHeight()>0 && mBannerAds.getVisibility() == View.VISIBLE){
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(110));
}else {
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60));
}
}
} }
} }
else { else {
@ -1662,7 +1678,7 @@ class homeViewController
if (orientation == Configuration.ORIENTATION_LANDSCAPE) { if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60 + 60)); mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60 + 60));
} else { } else {
mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60) + mBannerAds.getHeight() + mTopBar.getHeight()); mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60) + helperMethod.pxFromDp(50) + mTopBar.getHeight());
} }
} }
} }

View File

@ -75,7 +75,11 @@ import java.io.OutputStreamWriter;
import java.io.Writer; import java.io.Writer;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.DatagramSocket;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.URI; import java.net.URI;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
@ -259,6 +263,33 @@ public class helperMethod
} }
} }
public static boolean availablePort(int port) {
ServerSocket ss = null;
DatagramSocket ds = null;
try {
ss = new ServerSocket(port);
ss.setReuseAddress(true);
ds = new DatagramSocket(port);
ds.setReuseAddress(true);
return true;
} catch (IOException e) {
} finally {
if (ds != null) {
ds.close();
}
if (ss != null) {
try {
ss.close();
} catch (IOException e) {
/* should not be thrown */
}
}
}
return false;
}
public static String completeURL(String pURL){ public static String completeURL(String pURL){
if(pURL.equals("about:blank") || pURL.equals("about:config")){ if(pURL.equals("about:blank") || pURL.equals("about:config")){
return pURL; return pURL;

View File

@ -13,6 +13,7 @@ import java.util.List;
import com.hiddenservices.onionservices.constants.constants; import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.keys; import com.hiddenservices.onionservices.constants.keys;
import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.pluginManager.pluginEnums; import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import static android.content.Context.MODE_PRIVATE; import static android.content.Context.MODE_PRIVATE;
import static com.hiddenservices.onionservices.pluginManager.orbotPluginManager.orbotPluginEnums.eLogManager.M_GET_CLEANED_LOGS; import static com.hiddenservices.onionservices.pluginManager.orbotPluginManager.orbotPluginEnums.eLogManager.M_GET_CLEANED_LOGS;
@ -45,6 +46,11 @@ public class orbotManager
} }
private void onInitlizeOrbot(String pBridgeCustomBridge, boolean pBridgeGatewayManual, String pBridgeCustomType, boolean pBridgeStatus, String pBridgesDefault){ private void onInitlizeOrbot(String pBridgeCustomBridge, boolean pBridgeGatewayManual, String pBridgeCustomType, boolean pBridgeStatus, String pBridgesDefault){
if(helperMethod.availablePort(9050)){
orbotLocalConstants.mSOCKSPort = 9050;
}
orbotLocalConstants.mBridges = pBridgeCustomBridge; orbotLocalConstants.mBridges = pBridgeCustomBridge;
orbotLocalConstants.mIsManualBridge = pBridgeGatewayManual; orbotLocalConstants.mIsManualBridge = pBridgeGatewayManual;
orbotLocalConstants.mManualBridgeType = pBridgeCustomType; orbotLocalConstants.mManualBridgeType = pBridgeCustomType;

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="19dp"
android:height="19dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,2h-4.18C14.4,0.84 13.3,0 12,0c-1.3,0 -2.4,0.84 -2.82,2L5,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,4c0,-1.1 -0.9,-2 -2,-2zM12,2c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM19,20L5,20L5,4h2v3h10L17,4h2v16z"/>
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -12,7 +12,7 @@
maxads:adUnitId="6afabb72c853c683" maxads:adUnitId="6afabb72c853c683"
xmlns:maxads="http://schemas.applovin.com/android/1.0" xmlns:maxads="http://schemas.applovin.com/android/1.0"
android:id="@+id/adView" android:id="@+id/adView"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
@ -37,7 +37,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/c_background" android:background="@color/c_background"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:translationZ="3dp" android:translationZ="3dp"
app:layout_scrollFlags="enterAlwaysCollapsed"> app:layout_scrollFlags="enterAlwaysCollapsed">
@ -47,7 +46,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:overScrollMode="never"
android:orientation="vertical" android:orientation="vertical"
app:layout_scrollFlags="enterAlwaysCollapsed" app:layout_scrollFlags="enterAlwaysCollapsed"
app:scrimAnimationDuration="10"> app:scrimAnimationDuration="10">
@ -236,10 +234,8 @@
android:id="@+id/pNestedScroll" android:id="@+id/pNestedScroll"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:overScrollMode="never"
android:background="@color/clear_alpha" android:background="@color/clear_alpha"
android:fillViewport="true" android:fillViewport="true"
android:isScrollContainer="true" android:isScrollContainer="true"
android:measureAllChildren="true" android:measureAllChildren="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
@ -248,20 +244,18 @@
android:id="@+id/pWebLayoutView" android:id="@+id/pWebLayoutView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/c_background" android:background="@color/c_white"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
android:overScrollMode="never"
app:layout_constraintTop_toBottomOf="@+id/pTopLayout"> app:layout_constraintTop_toBottomOf="@+id/pTopLayout">
<com.hiddenservices.onionservices.appManager.homeManager.geckoManager.NestedGeckoView <com.hiddenservices.onionservices.appManager.homeManager.geckoManager.NestedGeckoView
android:id="@+id/pWebView" android:id="@+id/pWebView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:alpha="1" android:alpha="1"
android:background="@color/c_background" android:background="@color/c_white"
android:visibility="visible" android:visibility="visible"
android:overScrollMode="never"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -113,9 +113,24 @@
android:background="@xml/gx_ripple_default_round" android:background="@xml/gx_ripple_default_round"
android:contentDescription="@string/GENERAL_TODO" android:contentDescription="@string/GENERAL_TODO"
android:onClick="onCopySearch" android:onClick="onCopySearch"
android:visibility="gone"
android:src="@xml/ic_baseline_clipboard" android:src="@xml/ic_baseline_clipboard"
app:tint="@color/c_navigation_tint" /> app:tint="@color/c_navigation_tint" />
<ImageButton
android:id="@+id/pPopoupFindPaste"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginStart="2dp"
android:layout_marginTop="0dp"
android:background="@xml/gx_ripple_default_round"
android:contentDescription="@string/GENERAL_TODO"
android:onClick="onCopyPaste"
android:visibility="gone"
android:src="@xml/ic_baseline_content_paste"
app:tint="@color/c_navigation_tint" />
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB