зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1344517 - Keep dynamic toolbar visible while page is loading r=kats
This commit is contained in:
Родитель
5463f0305e
Коммит
1b04875fd3
|
@ -647,6 +647,7 @@ public class BrowserApp extends GeckoApp
|
|||
});
|
||||
|
||||
mProgressView = (ToolbarProgressView) findViewById(R.id.progress);
|
||||
mProgressView.setDynamicToolbar(mDynamicToolbar);
|
||||
mBrowserToolbar.setProgressBar(mProgressView);
|
||||
|
||||
// Initialize Tab History Controller.
|
||||
|
@ -1454,6 +1455,10 @@ public class BrowserApp extends GeckoApp
|
|||
return;
|
||||
}
|
||||
|
||||
if (mProgressView != null) {
|
||||
mProgressView.setDynamicToolbar(null);
|
||||
}
|
||||
|
||||
mDynamicToolbar.destroy();
|
||||
|
||||
if (mBrowserToolbar != null)
|
||||
|
|
|
@ -520,8 +520,10 @@ public abstract class BrowserToolbar extends ThemedRelativeLayout
|
|||
progressBar.setProgress(progress);
|
||||
progressBar.setPrivateMode(selectedTab.isPrivate());
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.pinDynamicToolbar();
|
||||
} else {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
progressBar.unpinDynamicToolbar();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@ import android.support.v4.content.ContextCompat;
|
|||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.widget.themed.ThemedImageView;
|
||||
import org.mozilla.gecko.util.WeakReferenceHandler;
|
||||
import org.mozilla.gecko.DynamicToolbar;
|
||||
import org.mozilla.gecko.DynamicToolbar.VisibilityTransition;
|
||||
import org.mozilla.gecko.gfx.DynamicToolbarAnimator.PinReason;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
|
@ -53,6 +56,7 @@ public class ToolbarProgressView extends ThemedImageView {
|
|||
private ProgressBounds mBounds;
|
||||
private Handler mHandler;
|
||||
private int mCurrentProgress;
|
||||
private DynamicToolbar mDynamicToolbar;
|
||||
|
||||
private PorterDuffColorFilter mPrivateBrowsingColorFilter;
|
||||
|
||||
|
@ -66,6 +70,10 @@ public class ToolbarProgressView extends ThemedImageView {
|
|||
init(context);
|
||||
}
|
||||
|
||||
public void setDynamicToolbar(DynamicToolbar toolbar) {
|
||||
mDynamicToolbar = toolbar;
|
||||
}
|
||||
|
||||
private void init(Context ctx) {
|
||||
mBounds = new ProgressBounds();
|
||||
|
||||
|
@ -77,6 +85,19 @@ public class ToolbarProgressView extends ThemedImageView {
|
|||
mHandler = new ToolbarProgressHandler(this);
|
||||
}
|
||||
|
||||
void pinDynamicToolbar() {
|
||||
if ((mDynamicToolbar != null) && mDynamicToolbar.isEnabled()) {
|
||||
mDynamicToolbar.setPinned(true, PinReason.PAGE_LOADING);
|
||||
mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
|
||||
}
|
||||
}
|
||||
|
||||
void unpinDynamicToolbar() {
|
||||
if ((mDynamicToolbar != null) && mDynamicToolbar.isEnabled()) {
|
||||
mDynamicToolbar.setPinned(false, PinReason.PAGE_LOADING);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayout(boolean f, int l, int t, int r, int b) {
|
||||
mBounds.setLayoutRtl(ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL);
|
||||
|
@ -187,6 +208,7 @@ public class ToolbarProgressView extends ThemedImageView {
|
|||
|
||||
case MSG_HIDE:
|
||||
that.setVisibility(View.GONE);
|
||||
that.unpinDynamicToolbar();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@ public class DynamicToolbarAnimator {
|
|||
RELAYOUT,
|
||||
ACTION_MODE,
|
||||
FULL_SCREEN,
|
||||
CARET_DRAG
|
||||
CARET_DRAG,
|
||||
PAGE_LOADING
|
||||
}
|
||||
|
||||
private final Set<PinReason> pinFlags = Collections.synchronizedSet(EnumSet.noneOf(PinReason.class));
|
||||
|
|
Загрузка…
Ссылка в новой задаче