]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java
Autopopulate the text in the create bookmark and create shortcut dialog boxes. Imple...
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / MainWebViewActivity.java
index 23e000a6b438c99a534c99f77c76f609db2afd34..a5713ae104f3b649e8a377aef913c325d810a38f 100644 (file)
@@ -135,6 +135,9 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
     // `orbotStatus` is public static so it can be accessed from `OrbotProxyHelper`.  It is also used in `onCreate()`.
     public static String orbotStatus;
 
+    // `webViewTitle` is public static so it can be accessed from `CreateHomeScreenShorcutDialog`.  It is also used in `onCreate()`.
+    public static String webViewTitle;
+
 
     // `navigatingHistory` is used in `onCreate()` and `onNavigationItemSelected()`.
     private boolean navigatingHistory;
@@ -679,7 +682,7 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
             // Set the favorite icon when it changes.
             @Override
             public void onReceivedIcon(WebView view, Bitmap icon) {
-                // Save a copy of the favorite icon for use if a shortcut is added to the home screen.
+                // Save a copy of the favorite icon.
                 favoriteIcon = icon;
 
                 // Place the favorite icon in the appBar.
@@ -687,6 +690,13 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation
                 imageViewFavoriteIcon.setImageBitmap(Bitmap.createScaledBitmap(icon, 64, 64, true));
             }
 
+            // Save a copy of the title when it changes.
+            @Override
+            public void onReceivedTitle(WebView view, String title) {
+                // Save a copy of the title.
+                webViewTitle = title;
+            }
+
             // Enter full screen video
             @Override
             public void onShowCustomView(View view, CustomViewCallback callback) {