// `fullScreenBrowsingModeEnabled` is used in `onCreate()` and `applySettings()`.
private boolean fullScreenBrowsingModeEnabled;
- // `inFullScreenBrowsingMode` is used in `onCreate()` and `applySettings()`.
+ // `inFullScreenBrowsingMode` is used in `onCreate()`, `onConfigurationChanged()`, and `applySettings()`.
private boolean inFullScreenBrowsingMode;
// `hideSystemBarsOnFullscreen` is used in `onCreate()` and `applySettings()`.
formattedUrlString = intentUriData.toString();
}
+ // Initialize `inFullScreenBrowsingMode`, which is always false at this point because Privacy Browser never starts in full screen browsing mode.
+ inFullScreenBrowsingMode = false;
+
+ // Initialize AdView for the free flavor.
+ adView = findViewById(R.id.adView);
+
// Apply the settings from the shared preferences.
applySettings();
// Load `formattedUrlString` if we are not proxying through Orbot and waiting for Orbot to connect.
- if (!(proxyThroughOrbot & !orbotStatus.equals("ON"))) {
+ if (!(proxyThroughOrbot && !orbotStatus.equals("ON"))) {
mainWebView.loadUrl(formattedUrlString, customHeaders);
}
BitmapDrawable favoriteIconBitmapDrawable = (BitmapDrawable) favoriteIconDrawable;
favoriteIcon = favoriteIconBitmapDrawable.getBitmap();
}
-
- // Initialize `inFullScreenBrowsingMode`, which is always false at this point because Privacy Browser never starts in full screen browsing mode.
- inFullScreenBrowsingMode = false;
-
- // Initialize AdView for the free flavor and request an ad. If this is not the free flavor BannerAd.requestAd() does nothing.
- adView = findViewById(R.id.adView);
- BannerAd.requestAd(adView);
}
startActivity(settingsIntent);
break;
- /*
case R.id.domains:
// Launch `DomainsList`.
Intent domainsIntent = new Intent(this, DomainsList.class);
startActivity(domainsIntent);
break;
- */
case R.id.guide:
// Launch `Guide`.
super.onConfigurationChanged(newConfig);
// Reload the ad for the free flavor if we are not in full screen mode.
- if (BuildConfig.FLAVOR.contentEquals("free") && adView.isShown() && !fullScreenVideoFrameLayout.isShown()) {
+ if (BuildConfig.FLAVOR.contentEquals("free") && !inFullScreenBrowsingMode) {
// Reload the ad.
BannerAd.reloadAfterRotate(adView, getApplicationContext(), getString(R.string.ad_id));
customHeaders.remove("DNT");
}
- // Update the `SYSTEM_UI` flags if we are in full screen mode.
- if (inFullScreenBrowsingMode) {
+ // Apply the appropriate full screen mode the `SYSTEM_UI` flags.
+ if (fullScreenBrowsingModeEnabled && inFullScreenBrowsingMode) {
if (hideSystemBarsOnFullscreen) { // Hide everything.
// Remove the translucent navigation setting if it is currently flagged.
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
}
+ } else { // Switch to normal viewing mode.
+ // Reset `inFullScreenBrowsingMode` to `false`.
+ inFullScreenBrowsingMode = false;
+
+ // Show the `appBar`.
+ appBar.show();
+
+ // Show the `BannerAd` in the free flavor.
+ if (BuildConfig.FLAVOR.contentEquals("free")) {
+ // Reload the ad. Because the screen may have rotated, we need to use `reloadAfterRotate`.
+ BannerAd.reloadAfterRotate(adView, getApplicationContext(), getString(R.string.ad_id));
+
+ // Reinitialize the `adView` variable, as the `View` will have been removed and re-added by `BannerAd.reloadAfterRotate()`.
+ adView = findViewById(R.id.adView);
+ }
+
+ // Remove the translucent navigation bar flag if it is set.
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
+
+ // Add the translucent status flag if it is unset. This also resets `drawerLayout's` `View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN`.
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
+
+ // Remove any `SYSTEM_UI` flags from `rootCoordinatorLayout`.
+ rootCoordinatorLayout.setSystemUiVisibility(0);
+
+ // Constrain `rootCoordinatorLayout` inside the status and navigation bars.
+ rootCoordinatorLayout.setFitsSystemWindows(true);
}
}
You should have received a copy of the GNU General Public License
along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>. -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+<!-- `android:baselineAligned="False"` reduces unneeded computational overhead with `RecyclerViews`. -->
+<LinearLayout
+ 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_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:baselineAligned="false"
+ android:divider="?android:attr/dividerHorizontal"
+ android:showDividers="middle"
+ tools:context=".activities.DomainsList">
+ <android.support.v7.widget.RecyclerView
+ android:layout_height="match_parent"
+ android:layout_width="200dp"
+ app:layoutManager="LinearLayoutManager" />
</LinearLayout>
\ No newline at end of file