Bug 1437988 - [2.0] Use progress tracking events for custom tabs progress bar. r=droeh a=ritu
--- 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();
}