Bug 1437988 - [2.0] Use progress tracking events for custom tabs progress bar. r=droeh a=ritu
authorEugen Sawin <esawin@mozilla.com>
Thu, 26 Jul 2018 16:50:38 +0200
changeset 478204 94572bfa7c3b448672ce944d1292406c193e50d9
parent 478203 9dcf2844400a88a44cc9c39a7e88e9af867ba264
child 478205 5d23a4e11e09af2f1d1b47f2a6f9ab2236ac96ce
push id9571
push usernerli@mozilla.com
push dateThu, 02 Aug 2018 13:49:02 +0000
treeherdermozilla-beta@60840467a49e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdroeh, ritu
bugs1437988
milestone62.0
Bug 1437988 - [2.0] Use progress tracking events for custom tabs progress bar. r=droeh a=ritu
mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java
--- a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java
@@ -108,17 +108,16 @@ public class CustomTabsActivity extends 
 
         setContentView(R.layout.customtabs_activity);
 
         final SafeIntent intent = new SafeIntent(getIntent());
 
         doorhangerOverlay = findViewById(R.id.custom_tabs_doorhanger_overlay);
 
         mProgressView = (ProgressBar) findViewById(R.id.page_progress);
-        updateProgress(10);
         final Toolbar toolbar = (Toolbar) findViewById(R.id.actionbar);
         setSupportActionBar(toolbar);
         final ActionBar actionBar = getSupportActionBar();
         bindNavigationCallback(toolbar);
 
         actionBarPresenter = new ActionBarPresenter(actionBar, getActionBarTextColor());
         actionBarPresenter.displayUrlOnly(intent.getDataString());
         actionBarPresenter.setBackgroundColor(IntentUtil.getToolbarColor(intent), getWindow());
@@ -581,17 +580,16 @@ public class CustomTabsActivity extends 
         return null;
     }
 
     /* GeckoSession.NavigationDelegate */
     @Override
     public void onLocationChange(GeckoSession session, String url) {
         mCurrentUrl = url;
         updateActionBar();
-        updateProgress(60);
     }
 
     @Override
     public void onCanGoBack(GeckoSession session, boolean canGoBack) {
         mCanGoBack = canGoBack;
     }
 
     @Override
@@ -648,28 +646,31 @@ public class CustomTabsActivity extends 
 
     /* GeckoSession.ProgressDelegate */
     @Override
     public void onPageStart(GeckoSession session, String url) {
         mCurrentUrl = url;
         mCanStop = true;
         updateActionBar();
         updateCanStop();
-        updateProgress(20);
     }
 
     @Override
     public void onPageStop(GeckoSession session, boolean success) {
         mCanStop = false;
         updateCanStop();
-        updateProgress(100);
     }
 
     @Override
     public void onProgressChange(GeckoSession session, int progress) {
+        if (progress == 100) {
+            mCanStop = false;
+            updateCanStop();
+        }
+        updateProgress(progress);
     }
 
     @Override
     public void onSecurityChange(GeckoSession session, SecurityInformation securityInfo) {
         mSecurityInformation = securityInfo;
         updateActionBar();
     }