<w>aaaa</w>
<w>adsense</w>
<w>adservers</w>
+ <w>adview</w>
<w>amiunique</w>
<w>androidversion</w>
<w>anonymized</w>
<w>radiogroup</w>
<w>redmine</w>
<w>referer</w>
+ <w>refreshlayout</w>
<w>relativelayout</w>
<w>requery</w>
<w>robinlinus</w>
-/**
- * Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+/*
+ * Copyright 2016-2017 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
*
}
public static void reloadAfterRotate (View view, Context applicationContext, String ad_id) {
- // Cast view to an AdView.
+ // Cast `view` to an `AdView`.
AdView adView = (AdView) view;
// Save the layout parameters.
RelativeLayout.LayoutParams adViewLayoutParameters = (RelativeLayout.LayoutParams) adView.getLayoutParams();
- // Remove the AdView.
+ // Remove the `AdView`.
RelativeLayout adViewParentLayout = (RelativeLayout) adView.getParent();
adViewParentLayout.removeView(adView);
- // Setup the new AdView.
+ // Setup the new `AdView`.
adView = new AdView(applicationContext);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(ad_id);
- adView.setId(R.id.adView);
+ adView.setId(R.id.adview);
adView.setLayoutParams(adViewLayoutParameters);
- // Display the new AdView.
+ // Display the new `AdView`.
adViewParentLayout.addView(adView);
// Request a new ad.
}
public static void hideAd(View view) {
- // Cast view to an AdView.
+ // Cast `view` to an `AdView`.
AdView adView = (AdView) view;
// Hide the ad.
}
public static void showAd(View view) {
- // Cast view to an AdView.
+ // Cast `view` to an `AdView`.
AdView adView = (AdView) view;
- // Hide the ad.
+ // Show the ad.
adView.setVisibility(View.VISIBLE);
}
public static void pauseAd(View view) {
- // Cast view to an AdView.
+ // Cast `view` to an `AdView`.
AdView adView = (AdView) view;
- // Pause the AdView.
+ // Pause the `AdView`.
adView.pause();
}
public static void resumeAd(View view) {
- // Cast view to an AdView.
+ // Cast `view` to an `AdView`.
AdView adView = (AdView) view;
- // Resume the AdView.
+ // Resume the `AdView`.
adView.resume();
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+ Copyright 2016-2017 Soren Stoutner <soren@stoutner.com>.
This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
You should have received a copy of the GNU General Public License
along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>. -->
-<!-- android:layout_martinTop="?attr/actionBarSize" moves adRelativeLayout below the appBarLayout, which otherwise would cover the top of mainWebView.
- android:layout_weight="1" sets the RelativeLayout to fill the rest of the screen because it is encapsulated in a LinearLayout with android:orientation="vertical"-->
+<!-- `android:layout_weight="1"` sets the `RelativeLayout` to fill the rest of the screen because it is encapsulated in a `LinearLayout` with `android:orientation="vertical"`.-->
<RelativeLayout
android:id="@+id/main_webview_relativelayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="0dp"
android:layout_weight="1"
tools:context="com.stoutner.privacybrowser.activities.MainWebViewActivity"
- tools:showIn="@layout/drawerlayout">
+ tools:showIn="@layout/main_drawerlayout">
<com.google.android.gms.ads.AdView
- android:id="@+id/adView"
+ android:id="@+id/adview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
</com.google.android.gms.ads.AdView>
<android.support.v4.widget.SwipeRefreshLayout
- android:id="@+id/swipeRefreshLayout"
+ android:id="@+id/swipe_refreshlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_above="@id/adView">
+ android:layout_above="@id/adview">
<!-- Google does not currently want to support hiding the AppBar on scroll for a WebView child with the Support Toolbar. https://code.google.com/p/android/issues/detail?id=200394 -->
<WebView
- android:id="@+id/mainWebView"
+ android:id="@+id/main_webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
@SuppressLint("SetJavaScriptEnabled")
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.drawerlayout);
+ setContentView(R.layout.main_drawerlayout);
// Get a handle for `inputMethodManager`.
inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
// This is needed to get rid of the Android Studio warning that `appBar` might be null.
assert appBar != null;
- // Add the custom url_app_bar layout, which shows the favoriteIcon, urlTextBar, and progressBar.
+ // Add the custom `url_app_bar` layout, which shows the favorite icon and the URL text bar.
appBar.setCustomView(R.layout.url_app_bar);
appBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
// Set the "go" button on the keyboard to load the URL in urlTextBox.
- urlTextBox = (EditText) appBar.getCustomView().findViewById(R.id.urlTextBox);
+ urlTextBox = (EditText) appBar.getCustomView().findViewById(R.id.url_edittext);
urlTextBox.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
drawerLayout = (DrawerLayout) findViewById(R.id.drawerlayout);
rootCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.root_coordinatorlayout);
mainWebViewRelativeLayout = (RelativeLayout) findViewById(R.id.main_webview_relativelayout);
- mainWebView = (WebView) findViewById(R.id.mainWebView);
+ mainWebView = (WebView) findViewById(R.id.main_webview);
findOnPageLinearLayout = (LinearLayout) findViewById(R.id.find_on_page_linearlayout);
findOnPageEditText = (EditText) findViewById(R.id.find_on_page_edittext);
fullScreenVideoFrameLayout = (FrameLayout) findViewById(R.id.full_screen_video_framelayout);
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);
+ adView = findViewById(R.id.adview);
}
// Remove the translucent navigation bar flag if it is set.
});
// Implement swipe to refresh
- swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
+ swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refreshlayout);
swipeRefreshLayout.setColorSchemeResources(R.color.blue_700);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
}
});
+ // Get a handle for the progress bar.
+ final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress_bar);
+
mainWebView.setWebChromeClient(new WebChromeClient() {
// Update the progress bar when a page is loading.
@Override
public void onProgressChanged(WebView view, int progress) {
- ProgressBar progressBar = (ProgressBar) appBar.getCustomView().findViewById(R.id.progressBar);
progressBar.setProgress(progress);
if (progress < 100) {
progressBar.setVisibility(View.VISIBLE);
favoriteIcon = icon;
// Place the favorite icon in the appBar.
- ImageView imageViewFavoriteIcon = (ImageView) appBar.getCustomView().findViewById(R.id.favoriteIcon);
+ ImageView imageViewFavoriteIcon = (ImageView) appBar.getCustomView().findViewById(R.id.favorite_icon);
imageViewFavoriteIcon.setImageBitmap(Bitmap.createScaledBitmap(icon, 64, 64, true));
}
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);
+ adView = findViewById(R.id.adview);
}
}
});
inFullScreenBrowsingMode = false;
// Initialize AdView for the free flavor.
- adView = findViewById(R.id.adView);
+ adView = findViewById(R.id.adview);
// Initialize the privacy settings variables.
javaScriptEnabled = false;
// Display a `Snackbar`.
if (javaScriptEnabled) { // JavaScrip is enabled.
- Snackbar.make(findViewById(R.id.mainWebView), R.string.javascript_enabled, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.javascript_enabled, Snackbar.LENGTH_SHORT).show();
} else if (firstPartyCookiesEnabled) { // JavaScript is disabled, but first-party cookies are enabled.
- Snackbar.make(findViewById(R.id.mainWebView), R.string.javascript_disabled, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.javascript_disabled, Snackbar.LENGTH_SHORT).show();
} else { // Privacy mode.
- Snackbar.make(findViewById(R.id.mainWebView), R.string.privacy_mode, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.privacy_mode, Snackbar.LENGTH_SHORT).show();
}
// Reload the WebView.
// Display a `Snackbar`.
if (firstPartyCookiesEnabled) { // First-party cookies are enabled.
- Snackbar.make(findViewById(R.id.mainWebView), R.string.first_party_cookies_enabled, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.first_party_cookies_enabled, Snackbar.LENGTH_SHORT).show();
} else if (javaScriptEnabled){ // JavaScript is still enabled.
- Snackbar.make(findViewById(R.id.mainWebView), R.string.first_party_cookies_disabled, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.first_party_cookies_disabled, Snackbar.LENGTH_SHORT).show();
} else { // Privacy mode.
- Snackbar.make(findViewById(R.id.mainWebView), R.string.privacy_mode, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.privacy_mode, Snackbar.LENGTH_SHORT).show();
}
// Reload the WebView.
// Display a `Snackbar`.
if (thirdPartyCookiesEnabled) {
- Snackbar.make(findViewById(R.id.mainWebView), R.string.third_party_cookies_enabled, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.third_party_cookies_enabled, Snackbar.LENGTH_SHORT).show();
} else {
- Snackbar.make(findViewById(R.id.mainWebView), R.string.third_party_cookies_disabled, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.third_party_cookies_disabled, Snackbar.LENGTH_SHORT).show();
}
// Reload the WebView.
// Display a `Snackbar`.
if (domStorageEnabled) {
- Snackbar.make(findViewById(R.id.mainWebView), R.string.dom_storage_enabled, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.dom_storage_enabled, Snackbar.LENGTH_SHORT).show();
} else {
- Snackbar.make(findViewById(R.id.mainWebView), R.string.dom_storage_disabled, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.dom_storage_disabled, Snackbar.LENGTH_SHORT).show();
}
// Reload the WebView.
// Display a `Snackbar`.
if (saveFormDataEnabled) {
- Snackbar.make(findViewById(R.id.mainWebView), R.string.form_data_enabled, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.form_data_enabled, Snackbar.LENGTH_SHORT).show();
} else {
- Snackbar.make(findViewById(R.id.mainWebView), R.string.form_data_disabled, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.form_data_disabled, Snackbar.LENGTH_SHORT).show();
}
// Update the privacy icon. `true` runs `invalidateOptionsMenu` as the last step.
} else {
cookieManager.removeAllCookies(null);
}
- Snackbar.make(findViewById(R.id.mainWebView), R.string.cookies_deleted, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.cookies_deleted, Snackbar.LENGTH_SHORT).show();
return true;
case R.id.clearDomStorage:
WebStorage webStorage = WebStorage.getInstance();
webStorage.deleteAllData();
- Snackbar.make(findViewById(R.id.mainWebView), R.string.dom_storage_deleted, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.dom_storage_deleted, Snackbar.LENGTH_SHORT).show();
return true;
case R.id.clearFormData:
WebViewDatabase mainWebViewDatabase = WebViewDatabase.getInstance(this);
mainWebViewDatabase.clearFormData();
- Snackbar.make(findViewById(R.id.mainWebView), R.string.form_data_deleted, Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(findViewById(R.id.main_webview), R.string.form_data_deleted, Snackbar.LENGTH_SHORT).show();
return true;
case R.id.fontSizeFiftyPercent:
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);
+ adView = findViewById(R.id.adview);
}
// `invalidateOptionsMenu` should recalculate the number of action buttons from the menu to display on the app bar, but it doesn't because of the this bug: https://code.google.com/p/android/issues/detail?id=20493#c8
hostname = hostname.substring(hostname.indexOf(".") + 1);
}
- FrameLayout urlAppBarFrameLayout = (FrameLayout) findViewById(R.id.url_app_bar_framelayout);
+ RelativeLayout urlAppBarRelativeLayout = (RelativeLayout) findViewById(R.id.url_app_bar_relativelayout);
if (hostHasDomainSettings) { // The url we are loading has custom domain settings.
// Get a cursor for the current host and move it to the first position.
}
// Set a green background on `urlTextBox` to indicate that custom domain settings are being used. We have to use the deprecated `.getDrawable()` until the minimum API >= 21.
- urlAppBarFrameLayout.setBackground(getResources().getDrawable(R.drawable.url_bar_background_green));
+ urlAppBarRelativeLayout.setBackground(getResources().getDrawable(R.drawable.url_bar_background_green));
} else { // The URL we are loading does not have custom domain settings. Load the defaults.
// Get the shared preference values. `this` references the current context.
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
}
// Set a transparent background on `urlTextBox`. We have to use the deprecated `.getDrawable()` until the minimum API >= 21.
- urlAppBarFrameLayout.setBackgroundDrawable(getResources().getDrawable(R.drawable.url_bar_background_transparent));
+ urlAppBarRelativeLayout.setBackgroundDrawable(getResources().getDrawable(R.drawable.url_bar_background_transparent));
}
// Close `domainsDatabaseHelper`.
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);
+ adView = findViewById(R.id.adview);
}
// Remove the translucent navigation bar flag if it is set.
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- Copyright 2015-2016 Soren Stoutner <soren@stoutner.com>.
-
- This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>>.
-
- Privacy Browser is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Privacy Browser is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>. -->
-
-<android.support.v4.widget.DrawerLayout
- android:id="@+id/drawerlayout"
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_height="match_parent"
- android:layout_width="match_parent" >
-
- <!-- android:fitsSystemWindows="true" moves rootCoordinatorLayout below the system status bar.
- When it is specified the theme should include <item name="android:windowTranslucentStatus">true</item>.
- Setting the layout root to be focusableInTouchMode prevents urlTextBox from stealing focus on launch and opening the keyboard. -->
- <android.support.design.widget.CoordinatorLayout
- android:id="@+id/root_coordinatorlayout"
- xmlns:tools="http://schemas.android.com/tools"
- tools:context="com.stoutner.privacybrowser.activities.MainWebViewActivity"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:fitsSystemWindows="true"
- android:focusable="true"
- android:focusableInTouchMode="true" >
-
- <!-- The purpose of the LinearLayout is to place the included main_webview below appBarLayout. -->
- <LinearLayout
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:orientation="vertical" >
-
- <android.support.design.widget.AppBarLayout
- android:id="@+id/app_bar_layout"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:theme="@style/AppBarOverlay" >
-
- <!-- The `FrameLayout` allows `appBar` and `find_on_page_app_bar` to occupy the same space. -->
- <FrameLayout
- android:layout_height="wrap_content"
- android:layout_width="match_parent" >
-
- <android.support.v7.widget.Toolbar
- android:id="@+id/app_bar"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:background="@color/gray_100"
- app:popupTheme="@style/LightPopupOverlay" />
-
- <include layout="@layout/find_on_page_app_bar" />
- </FrameLayout>
- </android.support.design.widget.AppBarLayout>
-
- <include layout="@layout/main_webview" />
- </LinearLayout>
-
- <!-- `full_screen_video_framelayout` is used to display full screen videos. It is initially `android:visibility="gone"` to hide it from view. -->
- <FrameLayout
- android:id="@+id/full_screen_video_framelayout"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:visibility="gone"
- android:background="@color/black" />
- </android.support.design.widget.CoordinatorLayout>
-
- <!-- The navigation drawer. -->
- <android.support.design.widget.NavigationView
- android:id="@+id/navigationview"
- android:layout_height="match_parent"
- android:layout_width="wrap_content"
- android:layout_gravity="start"
- app:headerLayout="@layout/navigation_header"
- app:menu="@menu/webview_navigation_menu"
- app:itemIconTint="@color/blue_800" />
-</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ Copyright 2015-2017 Soren Stoutner <soren@stoutner.com>.
+
+ This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>>.
+
+ Privacy Browser is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Privacy Browser is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>. -->
+
+<android.support.v4.widget.DrawerLayout
+ android:id="@+id/drawerlayout"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent" >
+
+ <!-- android:fitsSystemWindows="true" moves rootCoordinatorLayout below the system status bar.
+ When it is specified the theme should include <item name="android:windowTranslucentStatus">true</item>.
+ Setting the layout root to be focusableInTouchMode prevents urlTextBox from stealing focus on launch and opening the keyboard. -->
+ <android.support.design.widget.CoordinatorLayout
+ android:id="@+id/root_coordinatorlayout"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:context="com.stoutner.privacybrowser.activities.MainWebViewActivity"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:fitsSystemWindows="true"
+ android:focusable="true"
+ android:focusableInTouchMode="true" >
+
+ <!-- The purpose of the LinearLayout is to place the included main_webview below appBarLayout. -->
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:orientation="vertical" >
+
+ <android.support.design.widget.AppBarLayout
+ android:id="@+id/app_bar_layout"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:theme="@style/AppBarOverlay" >
+
+ <!-- The `FrameLayout` allows `appBar` and `find_on_page_app_bar` to occupy the same space. -->
+ <FrameLayout
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent" >
+
+ <android.support.v7.widget.Toolbar
+ android:id="@+id/app_bar"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:background="@color/gray_100"
+ app:popupTheme="@style/LightPopupOverlay" />
+
+ <!-- `android:max` changes the maximum `ProgressBar` value from 10000 to 100 to match progress percentage.
+ `android:layout_height="2dp"` works best for API >= 23, but `3dp` is required for visibility on API <= 22.
+ `tools:ignore="UnusedAttribute"` removes the lint waring about `progressTint` and `progressBackgroundTint` not applying to API < 21. -->
+ <ProgressBar
+ android:id="@+id/progress_bar"
+ style="?android:attr/progressBarStyleHorizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="3dp"
+ android:layout_gravity="bottom"
+ android:max="100"
+ android:progressTint="@color/blue_700"
+ android:progressBackgroundTint="@color/transparent"
+ android:visibility="gone"
+ tools:ignore="UnusedAttribute" />
+
+ <include layout="@layout/find_on_page_app_bar" />
+ </FrameLayout>
+ </android.support.design.widget.AppBarLayout>
+
+ <include layout="@layout/main_webview" />
+ </LinearLayout>
+
+ <!-- `full_screen_video_framelayout` is used to display full screen videos. It is initially `android:visibility="gone"` to hide it from view. -->
+ <FrameLayout
+ android:id="@+id/full_screen_video_framelayout"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:visibility="gone"
+ android:background="@color/black" />
+ </android.support.design.widget.CoordinatorLayout>
+
+ <!-- The navigation drawer. -->
+ <android.support.design.widget.NavigationView
+ android:id="@+id/navigationview"
+ android:layout_height="match_parent"
+ android:layout_width="wrap_content"
+ android:layout_gravity="start"
+ app:headerLayout="@layout/navigation_header"
+ app:menu="@menu/webview_navigation_menu"
+ app:itemIconTint="@color/blue_800" />
+</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+ Copyright 2016-2017 Soren Stoutner <soren@stoutner.com>.
This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
You should have received a copy of the GNU General Public License
along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>. -->
-<!-- android:layout_weight="1" sets the RelativeLayout to fill the rest of the screen because it is encapsulated in a LinearLayout with android:orientation="vertical". -->
+<!-- `android:layout_weight="1"` sets the `RelativeLayout` to fill the rest of the screen because it is encapsulated in a `LinearLayout` with `android:orientation="vertical"`. -->
<RelativeLayout
android:id="@+id/main_webview_relativelayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="0dp"
android:layout_weight="1"
tools:context="com.stoutner.privacybrowser.activities.MainWebViewActivity"
- tools:showIn="@layout/drawerlayout" >
+ tools:showIn="@layout/main_drawerlayout" >
<!-- This `TextView` has an id of `adView` so that the ad commands (which do nothing in the standard flavor) don't produce errors. -->
<TextView
- android:id="@+id/adView"
+ android:id="@+id/adview"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:visibility="gone" />
<android.support.v4.widget.SwipeRefreshLayout
- android:id="@+id/swipeRefreshLayout"
+ android:id="@+id/swipe_refreshlayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- Google does not currently want to support hiding the AppBar on scroll for a WebView child with the Support Toolbar. https://code.google.com/p/android/issues/detail?id=200394 -->
<WebView
- android:id="@+id/mainWebView"
+ android:id="@+id/main_webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"/>
</android.support.v4.widget.SwipeRefreshLayout>
-</RelativeLayout>
+</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright 2015-2016 Soren Stoutner <soren@stoutner.com>.
+ Copyright 2015-2017 Soren Stoutner <soren@stoutner.com>.
This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
You should have received a copy of the GNU General Public License
along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>. -->
-<!-- `FrameLayout` lets the `ProgressBar` float on top of `urlTextBox`. -->
-<FrameLayout
- android:id="@+id/url_app_bar_framelayout"
- xmlns:tools="http://schemas.android.com/tools"
+<!-- `RelativeLayout` is used instead of a `LinearLayout` because `supportAppBar` does not let `android:layout_weight="1"` cause `urlTextBox` to fill all the available space. -->
+<RelativeLayout
+ android:id="@+id/url_app_bar_relativelayout"
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_height="wrap_content"
android:layout_width="match_parent"
tools:context=".activities.MainWebViewActivity" >
- <!-- `RelativeLayout` is used instead of a `LinearLayout` because `supportAppBar` does not let `android:layout_weight="1"` cause `urlTextBox` to fill all the available space. -->
- <RelativeLayout
+ <!-- Set `@drawable/world` as the initial `favoriteIcon`.
+ `layout_height` and `layout_width` of 26dp matches the `AppBar` icons. -->
+ <ImageView
+ android:id="@+id/favorite_icon"
+ android:src="@drawable/world"
+ android:layout_height="26dp"
+ android:layout_width="26dp"
+ android:layout_centerVertical="true"
+ android:onClick="viewSslCertificate"
+ android:contentDescription="@string/favorite_icon" />
+
+ <!-- `android:imeOptions="actionGo"` sets the keyboard to have a `go` key instead of a `new line` key.
+ `android:inputType="textUri"` disables spell check in the `EditText`. -->
+ <EditText
+ android:id="@+id/url_edittext"
android:layout_height="wrap_content"
- android:layout_width="match_parent" >
-
- <!-- Set the program icon as the initial `favoriteIcon`.
- `layout_height` and `layout_width` of 26dp matches the `AppBar` icons. -->
- <ImageView
- android:id="@+id/favoriteIcon"
- android:src="@drawable/world"
- android:layout_height="26dp"
- android:layout_width="26dp"
- android:layout_centerVertical="true"
- android:onClick="viewSslCertificate"
- android:contentDescription="@string/favorite_icon" />
-
- <!-- `android:imeOptions="actionGo"` sets the keyboard to have a `go` key instead of a `new line` key.
- `android:inputType="textUri"` disables spell check in the `EditText`. -->
- <EditText
- android:id="@+id/urlTextBox"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_toEndOf="@id/favoriteIcon"
- android:hint="@string/url_or_search_terms"
- android:imeOptions="actionGo"
- android:inputType="textUri" />
- </RelativeLayout>
-
- <!-- `android:max` changes the maximum `ProgressBar` value from 10000 to 100 to match progress percentage.
- `android:layout_height="2dp"` works best for API 23 Marshmallow, but `3dp` is required for visibility on API <= 22.
- `tools:ignore="UnusedAttribute"` removes the lint waring about `progressTint` and `progressBackgroundTint` not applying to API < 21. -->
- <ProgressBar
- android:id="@+id/progressBar"
- style="?android:attr/progressBarStyleHorizontal"
- android:layout_width="fill_parent"
- android:layout_height="3dp"
- android:layout_gravity="bottom"
- android:max="100"
- android:progressTint="@color/blue_700"
- android:progressBackgroundTint="@color/white"
- android:visibility="gone"
- tools:ignore="UnusedAttribute" />
-</FrameLayout>
\ No newline at end of file
+ android:layout_width="match_parent"
+ android:layout_toEndOf="@id/favorite_icon"
+ android:hint="@string/url_or_search_terms"
+ android:imeOptions="actionGo"
+ android:inputType="textUri" />
+</RelativeLayout>
\ No newline at end of file