X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2FWebview.java;h=7e87fdfdde415fd4de5765fd526c4988b3cd0fa5;hp=fb72f87ce2e414d1ad55f8238c97f0560d7486a6;hb=20d57b6738e2676b9bf4c902d0d825b2c5ad6e8d;hpb=3756702edf3e068e3a3977cecb55c3bfd766e6d0 diff --git a/app/src/main/java/com/stoutner/privacybrowser/Webview.java b/app/src/main/java/com/stoutner/privacybrowser/Webview.java index fb72f87c..7e87fdfd 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/Webview.java +++ b/app/src/main/java/com/stoutner/privacybrowser/Webview.java @@ -15,6 +15,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewTreeObserver; +import android.view.Window; import android.view.inputmethod.InputMethodManager; import android.webkit.WebChromeClient; import android.webkit.WebView; @@ -45,17 +46,24 @@ public class Webview extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_webview); - urlTextBox = (EditText) findViewById(R.id.urlTextBox); swipeToRefresh = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayoutContainer); mainWebView = (WebView) findViewById(R.id.mainWebView); - progressBar = (ProgressBar) findViewById(R.id.progressBar); - favoriteIcon = (ImageView) findViewById(R.id.favoriteIcon); - // Remove the title from the action bar. final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { + // Remove the title from the action bar. actionBar.setDisplayShowTitleEnabled(false); - // actionBar.setHideOnContentScrollEnabled(true); + + // Add the custom app_bar layout, which shows the favoriteIcon, urlTextBar, and progressBar. + actionBar.setCustomView(R.layout.app_bar); + actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); + + // Initialize the variables for favoriteIcon, urlTextBox, and progressBar + favoriteIcon = (ImageView) actionBar.getCustomView().findViewById(R.id.favoriteIcon); + urlTextBox = (EditText) actionBar.getCustomView().findViewById(R.id.urlTextBox); + progressBar = (ProgressBar) actionBar.getCustomView().findViewById(R.id.progressBar); + + //actionBar.setHideOnContentScrollEnabled(true); } // Implement swipe down to refresh.