Skip to content

Commit

Permalink
Fix loading icon stuck on startup or pause/resume
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Dec 18, 2018
1 parent f4868c7 commit e330fb6
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,19 @@ protected void onPause() {
}
mAudioEngine.pauseEngine();
SessionStore.get().setActive(false);
for (Widget widget: mWidgets.values()) {
widget.onPause();
}
super.onPause();
}

@Override
protected void onResume() {
SessionStore.get().setActive(true);
mAudioEngine.resumeEngine();
for (Widget widget: mWidgets.values()) {
widget.onResume();
}
super.onResume();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ private void initialize(Context aContext) {
// Prevent the URL TextEdit to get focus when user touches something outside of it
setFocusable(true);
setClickable(true);
syncViews();
}

public void onPause() {
if (mIsLoading) {
mLoadingView.clearAnimation();
}
}

public void onResume() {
if (mIsLoading) {
mLoadingView.startAnimation(mLoadingAnimation);
}

}

public void setDelegate(NavigationURLBarDelegate delegate) {
Expand Down Expand Up @@ -340,6 +354,8 @@ private void syncViews() {
}
else {
mURLLeftContainer.setVisibility(View.GONE);
mLoadingView.setVisibility(View.GONE);
mInsecureIcon.setVisibility(View.GONE);
}

mURL.setPadding(leftPadding, mURL.getPaddingTop(), mURL.getPaddingRight(), mURL.getPaddingBottom());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,18 @@ else if (SessionStore.get().canUnstackSession())
handleSessionState();
}

@Override
public void onPause() {
super.onPause();
mURLBar.onPause();
}

@Override
public void onResume() {
super.onResume();
mURLBar.onResume();
}

@Override
public void releaseWidget() {
mWidgetManager.removeUpdateListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ private void initialize() {
mBackHandler = () -> onDismiss();
}

@Override
public void onPause() {
}

@Override
public void onResume() {
}

@Override
public void resizeByMultiplier(float aspect, float multiplier) {
// To be implemented by inheriting widgets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import android.view.Surface;

public interface Widget {
void onPause();
void onResume();
void setSurfaceTexture(SurfaceTexture aTexture, final int aWidth, final int aHeight);
void setSurface(Surface aSurface, final int aWidth, final int aHeight, Runnable aFirstDrawCallback);
void resizeSurface(final int aWidth, final int aHeight);
Expand Down

0 comments on commit e330fb6

Please sign in to comment.