From 7f8620e81518589f44c8517edbfc8989a5f04845 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Wed, 22 Mar 2017 16:39:15 -0700 Subject: [PATCH] Move the progress bar to the bottom of the app bar. Implements https://redmine.stoutner.com/issues/107. --- .idea/dictionaries/soren.xml | 2 + .../com/stoutner/privacybrowser/BannerAd.java | 28 +++---- app/src/free/res/layout/main_webview.xml | 15 ++-- .../activities/MainWebViewActivity.java | 62 ++++++++-------- ...drawerlayout.xml => main_drawerlayout.xml} | 17 ++++- app/src/main/res/layout/main_webview.xml | 14 ++-- app/src/main/res/layout/url_app_bar.xml | 73 +++++++------------ 7 files changed, 104 insertions(+), 107 deletions(-) rename app/src/main/res/layout/{drawerlayout.xml => main_drawerlayout.xml} (79%) diff --git a/.idea/dictionaries/soren.xml b/.idea/dictionaries/soren.xml index a5cc4b46..780edc6d 100644 --- a/.idea/dictionaries/soren.xml +++ b/.idea/dictionaries/soren.xml @@ -4,6 +4,7 @@ aaaa adsense adservers + adview amiunique androidversion anonymized @@ -75,6 +76,7 @@ radiogroup redmine referer + refreshlayout relativelayout requery robinlinus diff --git a/app/src/free/java/com/stoutner/privacybrowser/BannerAd.java b/app/src/free/java/com/stoutner/privacybrowser/BannerAd.java index 3f9d9a73..88e3985b 100644 --- a/app/src/free/java/com/stoutner/privacybrowser/BannerAd.java +++ b/app/src/free/java/com/stoutner/privacybrowser/BannerAd.java @@ -1,5 +1,5 @@ -/** - * Copyright 2016 Soren Stoutner . +/* + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -39,24 +39,24 @@ public class BannerAd extends AppCompatActivity{ } 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. @@ -65,7 +65,7 @@ public class BannerAd extends AppCompatActivity{ } public static void hideAd(View view) { - // Cast view to an AdView. + // Cast `view` to an `AdView`. AdView adView = (AdView) view; // Hide the ad. @@ -73,26 +73,26 @@ public class BannerAd extends AppCompatActivity{ } 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 diff --git a/app/src/free/res/layout/main_webview.xml b/app/src/free/res/layout/main_webview.xml index 6013ae29..a6fd37b4 100644 --- a/app/src/free/res/layout/main_webview.xml +++ b/app/src/free/res/layout/main_webview.xml @@ -1,7 +1,7 @@ - + + tools:showIn="@layout/main_drawerlayout"> + android:layout_above="@id/adview"> = 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); @@ -1978,7 +1980,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation } // 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`. @@ -2161,7 +2163,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation 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. diff --git a/app/src/main/res/layout/drawerlayout.xml b/app/src/main/res/layout/main_drawerlayout.xml similarity index 79% rename from app/src/main/res/layout/drawerlayout.xml rename to app/src/main/res/layout/main_drawerlayout.xml index ca8cffed..c616f68e 100644 --- a/app/src/main/res/layout/drawerlayout.xml +++ b/app/src/main/res/layout/main_drawerlayout.xml @@ -1,7 +1,7 @@ + + diff --git a/app/src/main/res/layout/main_webview.xml b/app/src/main/res/layout/main_webview.xml index bda4ce53..d395ac59 100644 --- a/app/src/main/res/layout/main_webview.xml +++ b/app/src/main/res/layout/main_webview.xml @@ -1,7 +1,7 @@ - + + tools:showIn="@layout/main_drawerlayout" > - + \ No newline at end of file diff --git a/app/src/main/res/layout/url_app_bar.xml b/app/src/main/res/layout/url_app_bar.xml index 34d6339f..377deff4 100644 --- a/app/src/main/res/layout/url_app_bar.xml +++ b/app/src/main/res/layout/url_app_bar.xml @@ -1,7 +1,7 @@ - - + - - + + + + - - - - - - - - - - - \ 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" /> + \ No newline at end of file -- 2.45.2