Bug 1403566 - Support mutli login for PWA. r?jchen draft
authorNevin Chen <cnevinchen@gmail.com>
Tue, 28 Nov 2017 17:54:56 +0800
changeset 704130 b890856065ca6e6c6498f1490417f49455c27c44
parent 704018 19be2692215b5d0e9c9f73dfe6ddedc4b8909add
child 742017 94d533ba5c8bb9d2a796691f45f5666bc8231da1
push id91094
push userbmo:cnevinchen@gmail.com
push dateTue, 28 Nov 2017 09:55:35 +0000
reviewersjchen
bugs1403566
milestone59.0a1
Bug 1403566 - Support mutli login for PWA. r?jchen MozReview-Commit-ID: LuQPnrtn1Wa
mobile/android/app/src/main/res/layout/webapp_activity.xml
mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
new file mode 100644
--- /dev/null
+++ b/mobile/android/app/src/main/res/layout/webapp_activity.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<RelativeLayout
+    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:id="@+id/root_layout"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+
+    <org.mozilla.gecko.GeckoView
+        android:id="@+id/pwa_gecko_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:scrollbars="none"/>
+
+    <org.mozilla.gecko.FormAssistPopup android:id="@+id/pwa_form_assist_popup"
+                                       android:layout_width="match_parent"
+                                       android:layout_height="match_parent"
+                                       android:visibility="gone"/>
+
+</RelativeLayout>
\ No newline at end of file
--- a/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
@@ -28,16 +28,17 @@ import android.view.View;
 import android.view.Window;
 import android.view.WindowManager;
 import android.widget.TextView;
 
 import org.mozilla.gecko.ActivityHandlerHelper;
 import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.BrowserApp;
 import org.mozilla.gecko.DoorHangerPopup;
+import org.mozilla.gecko.FormAssistPopup;
 import org.mozilla.gecko.GeckoAccessibility;
 import org.mozilla.gecko.GeckoScreenOrientation;
 import org.mozilla.gecko.GeckoSession;
 import org.mozilla.gecko.GeckoSessionSettings;
 import org.mozilla.gecko.GeckoSharedPrefs;
 import org.mozilla.gecko.GeckoView;
 import org.mozilla.gecko.preferences.GeckoPreferences;
 import org.mozilla.gecko.R;
@@ -56,16 +57,18 @@ public class WebAppActivity extends AppC
     private static final String LOGTAG = "WebAppActivity";
 
     public static final String MANIFEST_PATH = "MANIFEST_PATH";
     public static final String MANIFEST_URL = "MANIFEST_URL";
     private static final String SAVED_INTENT = "savedIntent";
 
     private GeckoSession mGeckoSession;
     private GeckoView mGeckoView;
+    private FormAssistPopup mFormAssistPopup;
+
     private PromptService mPromptService;
     private DoorHangerPopup mDoorHangerPopup;
 
     private ActionMode mActionMode;
     private TextSelection mTextSelection;
 
     private boolean mIsFullScreenMode;
     private boolean mIsFullScreenContent;
@@ -88,18 +91,19 @@ public class WebAppActivity extends AppC
             // This below is needed if we should ever decide to store a custom class as intent extra.
             savedInstanceState.setClassLoader(getClass().getClassLoader());
 
             Intent lastLaunchIntent = savedInstanceState.getParcelable(SAVED_INTENT);
             setIntent(lastLaunchIntent);
         }
 
         super.onCreate(savedInstanceState);
+        setContentView(R.layout.webapp_activity);
+        mGeckoView = (GeckoView) findViewById(R.id.pwa_gecko_view);
 
-        mGeckoView = new GeckoView(this);
         mGeckoSession = new GeckoSession();
         mGeckoView.setSession(mGeckoSession);
 
         mGeckoSession.setNavigationListener(this);
         mGeckoSession.setContentListener(this);
 
         GeckoAccessibility.setDelegate(mGeckoView);
 
@@ -133,17 +137,21 @@ public class WebAppActivity extends AppC
             finish();
             return;
         }
 
         updateFromManifest();
 
         mGeckoSession.loadUri(mManifest.getStartUri().toString());
 
-        setContentView(mGeckoView);
+        mFormAssistPopup = (FormAssistPopup) findViewById(R.id.pwa_form_assist_popup);
+        mFormAssistPopup.create(mGeckoView);
+
+
+
     }
 
     @Override
     public void onResume() {
         mGeckoSession.setActive(true);
         super.onResume();
     }
 
@@ -153,17 +161,17 @@ public class WebAppActivity extends AppC
         super.onPause();
     }
 
     @Override
     public void onDestroy() {
         mTextSelection.destroy();
         mDoorHangerPopup.destroy();
         mPromptService.destroy();
-
+        mFormAssistPopup.destroy();
         super.onDestroy();
     }
 
     @Override
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
         if (!ActivityHandlerHelper.handleActivityResult(requestCode, resultCode, data)) {
             super.onActivityResult(requestCode, resultCode, data);
         }